Eric,

I assume that you're doing this with Alter Object. The result of the operation requires that you Update the table that you started with after you're done "altering" the object.

For example:

'--------------------------------------------------------------------------
include "mapbasic.def"

Declare Sub Main()
Declare Sub movePolygons(ByVal tableName As String, ByVal deltaX As Float, ByVal deltaY As Float)

Sub Main()

Open Table "C:\Program Files\MapInfo\Professional\Data\Tut_Data\Tut_USA\USA\States.Tab"

   Call movePolygons("States", 1.0, 1.0)

End Sub

Sub movePolygons(ByVal tableName As String, ByVal deltaX As Float, ByVal deltaY As Float)

   Dim x, y As Float
   Dim oRegion As Object
   Dim alObject As Alias
   Dim i, j, k As Integer
   Dim nPolys, nNodes As Integer

   For i = 1 to TableInfo(tableName, TAB_INFO_NROWS)
       Print "Working on Object #" + i
       Fetch Rec i From tableName
       OnError Goto ErrHandler
       alObject = tableName + ".Obj"
       oRegion = alObject
       If ObjectInfo(oRegion, OBJ_INFO_TYPE) = OBJ_TYPE_REGION Then
           nPolys = ObjectInfo(oRegion, OBJ_INFO_NPOLYGONS)
           Print "  " + nPolys + " Polygon(s) to process..."
           For j = 1 to nPolys
               nNodes = ObjectInfo(oRegion, OBJ_INFO_NPOLYGONS + j)
               Print "    " + nNodes + " Node(s) in Polygon # " + j
               For k = 1 to (nNodes - 1)
                   If k Mod 1000 = 0 Then
                       Print "      " + k
                   End If
                   x = ObjectNodeX(oRegion, j, k)
                   y = ObjectNodeY(oRegion, j, k)
                   Alter Object oRegion
                   Node Set Position j, k (x + deltaX, y + deltaY)
               Next
           Next
           Update tableName Set Obj = oRegion Where RowID = i
       End If
   Next

   Exit Sub

ErrHandler:
   Resume Next

End Sub

'--------------------------------------------------------------------------

Ian Erickson
AnalyGIS, LLC
http:// www.analygis.com




Comparri, Erin @ Tempe wrote:

Hi All,
I'm trying to move all the nodes of a polygon. I can verify that the code is changing the x and y coords by asking for a Note with the current x and y coords. The node isnt moving on the mapper though. When I tried to remove one of the nodes, to see if that would work, I get an "Alter Object Remove Node Failed" error. Any thoughts on whats happening here? Erin Erin Comparri | Mapping Specialist
CB Richard Ellis | CBRE Mapping Center
1620 Fountainhead Pkwy, Suite 610 | Tempe, AZ 85282
MC 877 580 4674 | F 480 929 6400
[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> | www.cbre.com <http://www.cbre.com/> | mapping.cbre.com
------------------------------------------------------------------------

_______________________________________________
MapInfo-L mailing list
[email protected]
http://www.directionsmag.com/mailman/listinfo/mapinfo-l

_______________________________________________
MapInfo-L mailing list
[email protected]
http://www.directionsmag.com/mailman/listinfo/mapinfo-l

Reply via email to