MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




Vertices and VB.Net

This is a discussion on Vertices and VB.Net within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; hi, i'm trying to use Vertices of shape drawen by user for later use. The problem is that i cant ...


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 07-12-2004
Junior Member
White Belt
 
Join Date: Jul 2004
Posts: 1
Vertices and VB.Net

hi,
i'm trying to use Vertices of shape drawen by user for later use.
The problem is that i cant get the vertices content.
here is a sample of my code:

Me.MPCtl.NewMap(MapPoint.GeoMapRegion.geoMapNorthA merica)
Dim iShape As MapPoint.Shape
iShape = Me.MPCtl.ActiveMap.Shapes.Item(1)
Dim MyMap As MapPoint.Map
MyMap = Me.MPCtl.ActiveMap
Dim MyLoc() As MapPoint.Location
MyLoc = CType(iShape.Vertices, MapPoint.Location())

(i'm using VB.Net with an activeX of MapPoint)

now, the last line is doing my headache... the compiler saids it cant do the casting... BUT vertices is a collection of locations, isn't it ?
another by the way question is - why do i need to do all those castings every where ? (i mean when using findresults, etc.) - i cant (dont want to) put the option explicit off ...


thaks a lot,

alon
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 08-26-2004
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
Vertices with C#

Hi.

To use Vertices, you must be a expert in casting...

This is a sample in C# but you can try to convert this code. I use this code to find distance between a Location object and Vertices (from AddDrivetimeZone method)

double dblMaxDistance = 0;
foreach(object obj in ((object[])objShape.Vertices))
{
double dblDistance = ((MapPoint.Location)obj).DistanceTo(objLoc);
if (dblDistance > dblMaxDistance) dblMaxDistance = dblDistance;
}


I hope this code help you.
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 08-26-2004
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
Vertices - Thanks...

hi "Guest",

well it doesnt require an expert !!
and it sure did help !!!
thank you !!!!

anyway, didnt thought to cast to an object, after all the vertices are an array of locations...

As i looked for a solution for this problem i saw lots of developers stuck on it - your solution is a salvation for a lot of people....

keep on doing what ever you up to,

Alon
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
vbnet, vertices


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
How to get the Locations for the 4 vertices of a Square? cx123 MapPoint 2006/2009 Discussion 0 10-26-2004 11:01 AM
How to determine the length of Shape.vertices in Delphi? schuchhardp MapPoint 2006/2009 Discussion 0 12-13-2002 05:45 AM
Zip codes or cities vertices or shapes Claude VERDIER MapPoint 2006/2009 Discussion 2 09-17-2002 06:21 AM


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


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