Sergi Gàmiz
Ribelles (627481954)
REGS DE CATALUNYA S.A.
(www.regsa.es)
Unitat de Promoció de Regadius i Concentració
Parcel·lària
c/General
Brito, 6, 5è
25007
Lleida
tel.
973222838 fax 973222627
s...@regsa.cat
If a region object has self-intersections, then "island" and "hole" status is meaningless.
If it does not have self-intersections, then you can save time by extracting a representative point from a polygon (its centroid or one of its nodes) and finding out if the polygon contains the point.
In the general case, you have to worry about islands inside holes, and holes inside islands inside holes. For example, Treasure Island is in Lake Mindemoya, on Manitoulin Island, in Lake Huron, in North America.
Because of this, in order to determine if any one of a region's polygons is the outside of an island, or a hole, you have to determine this status for all of them. Count how many other polygons contain a polygon's representative point. If it's an even number, you have the outside of an "island". If it's odd, you have a "hole".
This is an NxN operation, but it used to be that if an "island" component of a region object had any "holes", they would immediately follow the outside" polygon of the corresponding "island" in the region object's sequence of polygons. This allowed you to reduce the number of polygons you had to compare to the polygon in question.
Another way to tell was that the nodes of outside polygons of islands went clockwise, and the nodes of holes went counterclockwise. Or the other way around; I forget. The old BDYIMP program that imported a MapInfo-for-DOS .MBI file choked if this was not the case.
Pretty complicated for such a simple operation, and it's probably stored in the object anyway, so it should have been something you could get out of ObjectInfo().
Spencer
Sergi Gàmiz
Ribelles (627481954)
REGS DE CATALUNYA S.A.
(www.regsa.es)
Unitat de Promoció de Regadius i Concentració
Parcel·lària
c/General
Brito, 6, 5è
25007
Lleida
tel.
973222838 fax 973222627
s...@regsa.cat
-----Mensaje original-----
De: mapi...@googlegroups.com [mailto:mapi...@googlegroups.com]En nombre de Spencer Simpson
Enviado el: martes, 28 de abril de 2009 16:28
Para: mapi...@googlegroups.com
Asunto: [MI-L] Re: 1 hole vs 2 polygons in a region