If you had to go through the process of redefining the x-y for each centroid and
to do a whole of manipulations after that, "programmatic" or not, why didn't you
simply adjust the centroid positions directly in one operation?
display option for the "editable" polygon layer : show centroid
select polygon; reshape (Ctrl-R)
move centroid to desired location
select next polygon
move centroid
....
I think it would be faster and safer as you see the results as you go along.
Jacques
_______________________________________________________________________
Jacques Paris Institut d'Urbanisme Universite de Montreal
e-mail [EMAIL PROTECTED]
web page http://www.total.net/~rparis/gisproducts.htm
(documents and software)
________________________________________________________________________
On Wed, 21 Apr 1999, Gabriel Bincik wrote:
> I agree with Jacques methodology of resetting a centroid to its
> 'correct' location. Alternately, I had a problem where I had to
> redefine the position of polygon centroids (so that it didn't fall in
> the water regions of another table). To do this I determined the
> desired centroid coordinates and exported the table to mid/mif and
> edited the mif file and inserted a 'Center' clause with the calculated
> coordinates and finally reimported the file. This was all done
> programmatically.
>
> Gabriel Bincik, Programmer
> Desktop Mapping Technologies Inc.
> 11 Allstate Parkway Suite 450
> Markham ON
> L3R 9T8
> Phone: (905)477-0770 x222
> Fax: (905)477-6551
> Email: [EMAIL PROTECTED]
> Web: www.desktopmapping.com
>
>
>
> -----Original Message-----
> From: David M Haycraft [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, April 21, 1999 1:34 AM
> To: [EMAIL PROTECTED]
> Subject: MI MapBasic question - can one set the centroid of a region
> programatically?
>
>
> Advice sought!
>
> As described in the Mapbasic on-line help, you can create a
> run-time-defined region object using the statements:
> Dim fltNodeX( ) as float
> Dim fltNodeY( ) as float
> Dim intNodes as integer
> Dim fltCentroidX as float
> Dim fltCentroidY as float
> Dim objRegion as object
> Create Region Into objRegion 0
> for i=1 to intNodes
> Alter Object objRegion Node Add ( fltNodeX(i), fltNodeX(i) )
> next
>
> This approach works fine, except that the default centroid of the
> resultant object is always positioned at the first node on the
> perimeter.
>
> If you compute centroid coords and try to set them explicitly using
> Create Region Into objRegion 0 Center (fltCentroidX ,fltCentroidY )
> then the Center clause appears to be ignored, because the centroid
> remains positioned at the first node on the perimeter.
>
> There does not seem to be a variant of the Alter Object statement to fix
> up the position of the centroid of a new region object.
>
> How do you set the centroid of a region programatically?
>
>
> David M Haycraft Phone/Fax: 61 + 2 + 6231 8104
> Information Analysis Assocs P/L Mobile: 0412 001 134
> ACN 085 516 105 Email:
> [EMAIL PROTECTED]
> 1 Cumming Place, Wanniassa Web:
> www.acslink.aone.net.au/actaa/iaa.htm
> A.C.T. 2903, Australia A MapInfo Partner
> ----------------------------------------------------------------------
> To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
> "unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]
>
----------------------------------------------------------------------
To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
"unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]