MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




Looping Vertices

This is a discussion on Looping Vertices within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; Any body has a sample C# code to loop through the vertices of freeform shape? I'm not C# guru and ...


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 (1) Thread Tools Display Modes
  1 links from elsewhere to this Post. Click to view. #1 (permalink)  
Old 03-14-2007
Junior Member
Yellow Belt
 
Join Date: Mar 2007
Posts: 21
Looping Vertices

Any body has a sample C# code to loop through the vertices of freeform shape? I'm not C# guru and I tried many ways and I always failed.
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 03-15-2007
Winwaed's Avatar
Mapping-Tools.com
Red Belt
 
Join Date: Feb 2004
Posts: 833
Blog Entries: 6
Re: Looping Vertices

I'd recommend Chandu Thota's "Programming MapPoint in .NET". I haven't tried it (yet), but pg.108 has the following code:

object[] vertices = shape.Vertices as object[];
foreach(object vertex in vertices)
{
MapPoint.Location loc = vertex as MapPoint.Location;
}

Richard
__________________
Winwaed Software Technology LLC
http://www.winwaed.com
See http://www.mapping-tools.com for MapPoint Tools
Pre-Order MapPoint 2009 today: http://www.mapping-tools.com/mappoint2009
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 03-15-2007
Junior Member
Yellow Belt
 
Join Date: Mar 2007
Posts: 21
Re: Looping Vertices

Thanks, Richard. I test it and your sample code works fine.

I fingured out the shape vertices is actual a COM object, I used following way to solve the problem. Silly but works.

Object obj = shape.Vertices;
Type thisType = obj.GetType();
object[] args = new object[1];
int numEntries = (int)thisType.InvokeMember("Length", BindingFlags.GetProperty, null, obj, null);
if (numEntries > 0)
{
for (int j = 0; j < numEntries; j++)
{
args[0] = j;
objLoc[j] = (MapPoint.Location)thisType.InvokeMember("GetValue ", BindingFlags.InvokeMethod, null, obj, args);
}
}
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
looping, vertices


LinkBacks (?)
LinkBack to this Thread: http://www.mapforums.com/looping-vertices-5750.html

Posted By For Type Date
Delphi Address Verifier - MapPoint Articles - MP2K Magazine This thread Refback 03-18-2007 07:34 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
Looping through Vertices of PolyLine? OOT MapPoint 2006/2009 Discussion 3 12-12-2006 01:11 PM
How to get the Locations for the 4 vertices of a Square? cx123 MapPoint 2006/2009 Discussion 0 10-26-2004 10:01 AM
Vertices and VB.Net alon MapPoint 2006/2009 Discussion 2 08-26-2004 02:12 AM
How to determine the length of Shape.vertices in Delphi? schuchhardp MapPoint 2006/2009 Discussion 0 12-13-2002 04:45 AM
Zip codes or cities vertices or shapes Claude VERDIER MapPoint 2006/2009 Discussion 2 09-17-2002 05:21 AM


All times are GMT -5. The time now is 06:34 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

Gatwick flight arrivals
On Holiday Hypermarket you can see where to find out information on Gatwick including flight arrivals and departures. Check it out now.

Turkey Weather
Check Turkey Weather before you travel. We provide information on Turkey including weather, flights and accommodation.

Holiday in Turkey
A Holiday in Turkey is great value when you book with dealchecker.co.uk. There is an abundance of things to see and do. Check out the well-preserved Greco-Roman ruins.

Holidays in Egypt
A holiday in Egypt will stimulate your mind, captivate your heart and spark your senses. Visit this exceptional country, book today!

Balearics
Before booking to the Balearics Islands make sure you check out our travel guide online. The Balearics are renowned for their vibrant nightlife but there are also some stunning Gothic cathedrals, Stone Age ruins and fishing villages.

All inclusive holidays
To plan all inclusive holidays, use Travel.co.uk to explore all the possibilities.

Holidays to Fuerteventura
Come on; jump on the plane to the Canary Islands. Get information on cheap holidays to Fuerteventura 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