Hi Ede,

About GCPlugin, I did the minimum to fix the problem I reported.

There are probably more to do

- in constructPolygons, holesWithoutShells sometimes contains list of rings and sometimes rings

- constructing polygon from rings based on ring orientation is hasardeous as there is not a single rule (shapefile and

jts "normalization" follow one rule while OGC, geodatabase, oracle... follow the other one :-(

The whole plugin is difficult to read because it is based on reflexion and IMHO, reasonning  on available methods

hide more important characteristics like geometry dimension or number of components.

If I had to rewrite it, I would consider the following rules

general cases

- empty geometry can be converted to any type and any type can be converted to a GeometryCollection

simple to multi

- a simple geometry can always be wrapped into a multi-geometry

multi to simple

- a multi-geometry can only be converted into a simple one if it has a single component

high to low dimension

- a simple or multi-geometry can always be converted to a multi-geometry with a lower dimension
  (sometimes, it can be converted to a simple geometry like polygon without hole -> linestring)

low to high dimension

- a single point cannot be converted to a geometry of higher dimension

- a multipoint can be converted to a linestring if it has >= 2 point and to a polygon it it has >= 3 points and the resulting linestring does not intersect itself

- a linestring can be converted to a polygon (or multi-polygon)

- a multi-linestring can be converted to a Multi-Polygon with certain conditions and to a single Polygon with even more restrictive condition, but the algo is not trivial and I don't know an easy method to do it with JTS (polygonizer is probably the nearest thing, but after polygonization, some original rings can describe a hole "and" a nested shell. For conversion, we probably prefer rings to describe a shell "or" a hole : rings included in an odd number of outer rings are holes and rings not included or included in an even number of rings are shells).

I probably forgot some corner cases


Michaël

_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

Reply via email to