MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




Using MP2004 with Delphi

This is a discussion on Using MP2004 with Delphi within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; Hi, I need to use MP 2004 in our delivery managment software. I have got the type library installed so ...


Go Back   MapPoint Forums > Map Forums > MapPoint 2006/2009 Discussion

Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read



Click here to register

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-06-2005
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
Using MP2004 with Delphi

Hi,
I need to use MP 2004 in our delivery managment software. I have got the type library installed so i have got the three controls Application, map and mappointUtilities.

What I need to do is very basic, which is displaying a direction map, using two postcodes, the first one is the warehouse postcode and the second one is the customer postcode.

Can any one show me some delphi code or direct me to the right place.

I am using Delphi 6 and MapPoint 2004.

Thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2 (permalink)  
Old 01-06-2005
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
This is an example of what I want to achieve.

http://212.50.188.108/cgi-win/vebra..../VALEW/17775/1

Thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3 (permalink)  
Old 01-06-2005
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,112
Hi,

Quote:
I have got the type library installed so i have got the three controls Application, map and mappointUtilities.
How did you get the AcitveX components in Delphi? I have written my own component because it failed to install in Delphi <8 with "not supported interface". Any advice is welcome!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4 (permalink)  
Old 01-06-2005
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,112
Hi,

Code:
This is an example of what I want to achieve
I have Delphi code for that using Ole object. Also in C# using the component. For the former I have it on a defective machine Next week it is ok. For the latter I can easy give yuo some example using C# wich is very easy to transform into Delph. Please let me know what you prefere.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5 (permalink)  
Old 01-06-2005
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
Hi,

Choose 'Import Type Library', select 'Microsoft MapPoint 11.0 Object Library', tick 'Generate Component Wrapper' and then click 'Install'. This will compile and build a Delphi package and as a result three MapPoint components will appear on the ActiveX-tab of the Component Palette: TApplication, TMap and TMapPointUtilities.

Regards
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6 (permalink)  
Old 01-06-2005
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,112
Hi,

Ok this works:

Code:
   with OpenDialog1 do
      if Execute then
         Application1.OpenMap(FileName, False);
But can you get a visual map on the form ?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7 (permalink)  
Old 01-06-2005
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
Hi,

I am new to MP, I managed to display the mep but not embaded within the form. this is the code


procedure TForm1.FormShow(Sender: TObject);
var
MyMap: _Map;
begin
MyMap := MyApplication.ActiveMap;
MyMap.Application.Visible := True;
MyMap.GoToLatLong(43, -3, 100);
end;

you need to drop MP TApplication component on the form first.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #8 (permalink)  
Old 01-06-2005
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
Quote:
Originally Posted by Wilfried
Hi,

Code:
This is an example of what I want to achieve
I have Delphi code for that using Ole object. Also in C# using the component. For the former I have it on a defective machine Next week it is ok. For the latter I can easy give yuo some example using C# wich is very easy to transform into Delph. Please let me know what you prefere.
I don't mind trying C# code for now if you would.

Thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #9 (permalink)  
Old 01-06-2005
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
This code will embed it into a form, you need to drop a TOleContainer onto the form

procedure TForm1.FormShow(Sender: TObject);
var
vGuid : TGuid;
FMap:_map;
begin
OleContainer.CreateObject('MapPoint.Map.EU.11', False);
OleContainer.DoVerb(1);
OleContainer.OleObjectInterface.GetUserClassID(vGu id);
FMap := IDispatch(OleContainer.OleObject) as _Map;

end;
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #10 (permalink)  
Old 01-07-2005
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,112
Hi,

This is VB code for geocoding:
http://www.mp2kmag.com/articles.asp?...xtract.lat.lon
This is the same one converted into C#:
http://www.mp2kmag.com/mappoint/disc...pic.asp?t=3291

I have something similar in Delphi5 but cant find it at the moment.

What you have to do is first get a Location object form the address information you get. Something similar like this:

Code:
            FindResults AddrResults = MP.ActiveMap.FindAddressResults(street, city, othercity, region, zip, country);

            foreach (object o in AddrResults) {
                Location Loc = o as Location;

                if (Loc != null) {
                    double Lat;
                    double Lon;
                    pos.CalcPos(Loc, out Lat, out Lon);
                    Console.WriteLine(Loc.Name + " " + Lat.ToString() + " " + Lon.ToString());
                }
The pos.CalcPos is the geocoding function described in the both URL's. Once you have the position of all the points you can calculate the route. But I will this post a litte later today as I have to go now...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
delphi, mp2004


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
MP2004 and terminal services SeanB MapPoint 2006/2009 Discussion 5 10-16-2006 12:16 PM
MP2004 - XYToLocation AndyWood MapPoint 2006/2009 Discussion 2 06-05-2006 11:13 AM
Using S&T 2005 maps in MP2004 Fleet MapPoint 2006/2009 Discussion 1 11-18-2004 01:54 PM
Coords to address MP2004 Anonymous MapPoint 2006/2009 Discussion 1 04-23-2004 10:07 AM
voice commands in MP2004 Anonymous MapPoint 2006/2009 Discussion 3 03-28-2004 06:33 AM


All times are GMT -5. The time now is 12:11 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
MP2K Magazine
Visitor Map


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54