Welcome to MapForums!

Register, sign in, or use Facebook Connect above to join in and participate in the forum.

When you are signed in, this message, the ads in this row, and the red-underlined link ads all go away.

Subscribe to receive our newsletter.
Subscribe Unsubscribe
Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Using MP2004 with Delphi

This is a discussion on Using MP2004 with Delphi within the MapPoint Desktop 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 ...

  1. #1
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137

    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

  2. #2
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137

  3. #3
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433
    Hi,

    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!

  4. #4
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433
    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.

  5. #5
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137
    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

  6. #6
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433
    Hi,

    Ok this works:

    Code:
       with OpenDialog1 do
          if Execute then
             Application1.OpenMap&#40;FileName, False&#41;;
    But can you get a visual map on the form ?

  7. #7
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137
    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.

  8. #8
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137
    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

  9. #9
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137
    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;

  10. #10
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433
    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&#40;street, city, othercity, region, zip, country&#41;;
    
                foreach &#40;object o in AddrResults&#41; &#123;
                    Location Loc = o as Location;
    
                    if &#40;Loc != null&#41; &#123;
                        double Lat;
                        double Lon;
                        pos.CalcPos&#40;Loc, out Lat, out Lon&#41;;
                        Console.WriteLine&#40;Loc.Name + " " + Lat.ToString&#40;&#41; + " " + Lon.ToString&#40;&#41;&#41;;
                    &#125;
    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...

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

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

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


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 55 56 57 58 59