I have a data structure which is basically a list of records that contain
coordinates and labeling/coloring data. I would like to convert these records
to a FeaturedGeometry object which contains the Thiessen polygon and
labeling/coloring data.
Consider these classes (simplified for the purpose of this demonstration).
public class Record {
String label;
Coordinate coordinate;
int color;
}
public class FeaturedGeometry{
String label;
Geometry geometry;
int color;
}
To produce that Voronoi diagram, I loop through all records and add the
Coordinate to a list of points.
List<Coordinate> points = new ArrayList<Coordinate>(listRecords.size());
for (Record record : listRecords) {
points.add(record.coordinate);
//label???
//color???
}
DelaunayTriangulationBuilder builder = new DelaunayTriangulationBuilder();
builder.setTolerance(0.001);
builder.setSites(points);
List<Geometry> subdivisions =
builder.getSubdivision().getVoronoiCellPolygons(geometryFactory);
for (Geometry polygon : subdivisions) {
FeaturedGeometry f = new FeaturedGeometry();
f.geometry = polygon;
f.label = "???";
f.color = 0;
}
What is the best way to associate the geometry with the original point? I would
hate to have to check every combination of Record and subdivision Geometry to
test for intersection. Is there any chance I could use the "setUserData" method
to import and export the metadata?
Thanks,
Dan
------------------------------------------------------------------------------
Shape the Mobile Experience: Free Subscription
Software experts and developers: Be at the forefront of tech innovation.
Intel(R) Software Adrenaline delivers strategic insight and game-changing
conversations that shape the rapidly evolving mobile landscape. Sign up now.
http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk
_______________________________________________
Jts-topo-suite-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jts-topo-suite-user