On 28.05.2022 15:50, Michaud Michael wrote:
Hi Ede,

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

looks good on a quick glance
commit msg is somewaht short and lacks a minimum of information. also a proper 
link to the github issue is a good idea in case the git is located somewhere 
else ;)

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 :-(

"good" to know

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.

sorry, don't follow.

reflection was used initially as i wasn't sure there may be new geometry 
conversions added in JTS in the future (well, i was young). it's now mapped to 
a static items list anyway, so you may as well remove reflection. go ahead.

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

i'm probably not gonna touch it soonish, but feel free to implement as you like.

in case not, you maybe wanna summarize your thought and just add them as a TODO 
header to the class?

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

with some luck i will find some more time to invest into OGC API as sponsored 
by Jukka :)

thanks und sunny regards ..ede


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

Reply via email to