MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




How do I use AddPolyline method in Delphi

This is a discussion on How do I use AddPolyline method in Delphi within the Development forums, part of the MapPoint 2006/2009 Discussion category; Can anyone give me some code that shows how to use the AddPolyline method to the shapes collection in Delphi. ...


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

Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read
  1 links from elsewhere to this Post. Click to view. #1 (permalink)  
Old 09-10-2007
Junior Member
Yellow Belt
 
Join Date: Jun 2004
Posts: 27
Question How do I use AddPolyline method in Delphi

Can anyone give me some code that shows how to use the AddPolyline method to the shapes collection in Delphi. The number of points is dynamic. I have tried the following (VertexList just contains the list of points where each item is Latitude,Longitude

var
VertexList: TStringList;
LocationArray: array of variant;
begin
SetLength(LocationArray, VertexList.Count);
for i := 0 to VertexList.Count - 1 do
begin
LocationArray[i] := oMap.GetLocation(Piece(VertexList[i],',', 1), Piece(VertexList[i], ',', 2));
end;
oMap.Shapes.AddPolyline(VarArrayRef(LocationArray) );

This does actually draw the polyline but I get an access violation in oleaut32.dll. This seems to be when the procedure ends. I can only think this is something to do with the array being freed.
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 09-10-2007
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,055
Re: How do I use AddPolyline method in Delphi

Hi,

If it is because the array being freed you can try to put it as a private member in your class instead of on the stack frame as you do now. Please let us know if this works. If not then please post the complete procedure.

Oh yes and please put code into [ code ] tags. Then it shows up with the right indent and is much better to read
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 09-18-2007
Junior Member
Yellow Belt
 
Join Date: Jun 2004
Posts: 27
Red face Re: How do I use AddPolyline method in Delphi

Hi

I tried moving the variable to a private member of my form but it made no difference which implied that wasn't the actual problem. I have now found a solution that works by making my LocationArray variable a variant and then using the VarArrayCreate function to create my array and then just passing my LocationArray variable to the AddPolyline method.
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 09-18-2007
Junior Member
Yellow Belt
 
Join Date: Jun 2004
Posts: 27
Question Re: How do I use AddPolyline method in Delphi

Hi

According to the help file in order to make the polyline closed you need to create an extra vertex which is the same as the first one which is fine. However, how do I know if freeform shapes drawn on the map are closed since the vertices property just contains the different points, i.e. when a polyline is closed it doesn't contain an extra vertex for the start point and there isn't a property that tells you if it is closed.

Stephen
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 09-20-2007
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,055
Re: How do I use AddPolyline method in Delphi

Hi,

I don't think you can see in the code if it is visually closed.
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


LinkBacks (?)
LinkBack to this Thread: http://www.mapforums.com/how-do-i-use-addpolyline-method-delphi-6213.html

Posted By For Type Date
MapPoint Articles - MP2K Magazine This thread Refback 09-10-2007 10:31 AM

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
Addpolyline from a dataset micheln MapPoint 2006/2009 Discussion 3 05-04-2007 06:49 AM
AddPolyLine (s) array problem FreddyD MapPoint 2006/2009 Discussion 1 12-20-2006 12:45 PM
Shapes.AddPolyline is very slow tdaffin MapPoint 2006/2009 Discussion 4 01-27-2006 07:08 AM
Addpolyline , Array , Visual Basic and Other languages Anonymous MapPoint 2006/2009 Discussion 2 08-26-2004 03:58 AM
addpolyline Anonymous Wish List 2 04-25-2003 03:50 PM


All times are GMT -5. The time now is 12:06 AM.


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

Ski Holidays Austria
Ski holidays in Austria offer ski schools for all types of skiers. They range from beginner classes of all ages to more advanced classes. Learn new techniques and refresh skills.

European City Breaks
Book European city breaks with Travel Counsellors. A personal travel counselor will help plan your European city break.

Cheap Holidays to Cuba
Cheap holidays to Cuba are a reality when you book with dealchecker.co.uk. We search leading UK Travel agents and tour operators to bring you some great deals.

Dominican Republic Holidays
Dominican Republic holidays have something to offer for everyone. From water sports, to sun bathing and more, enjoy a holiday there!

Spain
Spain is such a diverse country that it has something to offer most holidaymakers. Finding delicious cuisine is no challenge and the shopping ranges from designer boutiques to unknown flea markets. Spain has much to offer.

Travel
Check out the travel options on Travel.co.uk.

Cheap Gran Canaria Holidays
Want to take a break and visit the Canary Islands? Get information on cheap Gran Canaria holidays at On The Beach.


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