Currently the best method I've found is the one explained here 
http://stackoverflow.com/questions/4129241/split-a-polygon-with-a-linestring-in-jts

To that algorithm I added a for-loop to remove the annulus "hole" geometry 
appearing together with slices in the result.
Here an excerpt of the code:

ArrayList<LineString> slices = new ArrayList<LineString>();

/* ...
    evaluating slices
    ... */


Geometry collection = Utils.createGeometryCollection(new Geometry[]{annulus, 
Utils.createMultiLineString(slices)});
LineMerger lineMerger = new LineMerger();
lineMerger.add(collection);

UnaryUnionOp op = new UnaryUnionOp(lineMerger.getMergedLineStrings());
Geometry geom1 = op.union();

Polygonizer polygonizer = new Polygonizer();
polygonizer.add(geom1);
Collection<Geometry> resultCollection = polygonizer.getPolygons();

Iterator<Geometry> iterator = resultCollection.iterator();
while(iterator.hasNext())
{
     Geometry g = (Geometry)iterator.next();
     if(g.contains(centroid))
         iterator.remove();
}
Geometry[] result = (Geometry[])resultCollection.toArray(new Geometry[0]);

Bye

Sandro

Nella citazione in data Thu Mar 20 09:31:36 2014, Sandro Zacchino ha scritto:
>
> Hi,
>
> I'm looking for an efficient way to cut an 2D annulus (that is a polygon with 
> an hole, a donut) in slices. In particular I have a collection of segments 
> that represents all the cuts I have to do on the annulus and, as a result, I 
> need a collection of closed polygons, one for each portion of the annulus I 
> obtain from the cutting operation.
>
> Thank you in advance
>
> Sandro
>
> ------------------------------------------------------------------------------
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and their
> applications. Written by three acclaimed leaders in the field,
> this first edition is now available. Download your free book today!
> http://p.sf.net/sfu/13534_NeoTech
> _______________________________________________
> Jts-topo-suite-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/jts-topo-suite-user

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
Jts-topo-suite-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jts-topo-suite-user

Reply via email to