Hello Mike,

One pitfall when deleting nodes is that the inherent node numbering changes.
E.g. If you had nodes 1, 2, 3, 4 and delete note 2, you are left with 1, 2,
3. If you are looping through your nodes with a for...next loop, you can
either change your node count every time you delete a node or (the trick I
use) process your nodes backwards. 

As for multi-part objects and node counting, the ObjectInfo() function is
your best friend.

ObjectInfo(YourObj, OBJ_INFO_NPOLYGONS) gives you the number of polygons in
a region, or the number of sections in a polyline.
ObjectInfo(YourObj, OBJ_INFO_NPOLYGONS+i) gives you the number of nodes in
polygon/section number "i".

Use the above to construct your outer loop (for polygons and sections) and
inner loop (for nodes), then use:

ObjectNodeX(YourObj, i, j,) to get the X/longitude for polygon/section I,
node j
ObjectNodeY(YourObj, i, j) to get the Y/latitude

Make sure you coordsys is set (explicitly or from a table) so that the
coordinates coming out of these functions are what you expect.

Delete your nodes with:

Alter Object YourObj node remove position i, j

When you're done changing YourObj, make sure you write it back to a table
using a SQL "update". Since you only want to change the row where the object
came from you should keep track of the .rowid and update "where rowid =
YourRowId".

Hope that helps. Node strip away...

Regards,
Warren Vick
Europa Technologies Ltd.
http://www.europa-tech.com

-----Original Message-----
From: Cummings, Mike [mailto:[EMAIL PROTECTED] 
Sent: 09 April 2004 01:43
To: [EMAIL PROTECTED]
Subject: MI-L Problems with nodes in mapbasic


I've been trying to write code to delete nodes basic on certain criteria.  I
can't get the "alter object" code to work. None of the nodes are deleted,
even when I remove the criteria and I loop through all the nodes.
 
I'm clearly missing something.  (Because I can't get the alter table command
to work either.-halt with an error message about having to save the file.)

Also, if you have a multi-region object: I know you can determine the number
of polygons and the number of nodes for the object.  How do you determine
what nodes are with what polygons?  I've been looking for a reference that
explains nodes and the related mapbasic codes and haven't been too
successful.  Does anyone have a good reference?

---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com | To
unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 11345




---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 11351

Reply via email to