Revision: 4937 http://sourceforge.net/p/jump-pilot/code/4937 Author: michaudm Date: 2016-06-17 06:09:52 +0000 (Fri, 17 Jun 2016) Log Message: ----------- Fix a problem with z interoplation in Noder plugin
Modified Paths: -------------- core/trunk/ChangeLog core/trunk/src/com/vividsolutions/jump/plugin/edit/NoderPlugIn.java core/trunk/src/com/vividsolutions/jump/plugin/edit/SegmentStringsWithData2Features.java Removed Paths: ------------- core/trunk/lib/plus/topology-0.8.1.jar Modified: core/trunk/ChangeLog =================================================================== --- core/trunk/ChangeLog 2016-06-16 13:57:09 UTC (rev 4936) +++ core/trunk/ChangeLog 2016-06-17 06:09:52 UTC (rev 4937) @@ -3,6 +3,10 @@ # 2. make sure that lines break at 80 chars for constricted display situations #<-------------------------------- 80 chars ----------------------------------># +2016-06-17 mmichaud <m.michael.mich...@orange.fr> + * Fix a problem with z interoplation in Noder plugin (note : there is still + a bug related to JTS when using a PrecisionModel of 0 decimal - scale=1) + 2016-06-12 mmichaud <m.michael.mich...@orange.fr> * update TopologyExtension to 0.8.2. Deleted: core/trunk/lib/plus/topology-0.8.1.jar =================================================================== (Binary files differ) Modified: core/trunk/src/com/vividsolutions/jump/plugin/edit/NoderPlugIn.java =================================================================== --- core/trunk/src/com/vividsolutions/jump/plugin/edit/NoderPlugIn.java 2016-06-16 13:57:09 UTC (rev 4936) +++ core/trunk/src/com/vividsolutions/jump/plugin/edit/NoderPlugIn.java 2016-06-17 06:09:52 UTC (rev 4937) @@ -292,7 +292,7 @@ if ((dim == 1 && line_processor == Processor.SPLIT) || (dim == 2 && polygon_processor == Processor.SPLIT)) { SegmentStringsWithData2Features.buildGeometry(g, - entry.getValue(), true, interpolated_z_dp); + entry.getValue(), true, interpolated_z_dp, gf); } } } @@ -340,8 +340,8 @@ } private Noder getScaledNoder() { - return new ScaledNoder(new MCIndexSnapRounder(new PrecisionModel(1.0)), - Math.pow(10.0, (double)snap_rounding_dp)); + PrecisionModel pm = gf.getPrecisionModel(); + return new ScaledNoder(new MCIndexSnapRounder(pm), pm.getScale()); } private Noder getMCIndexNoder(SegmentIntersector intersector) { @@ -448,7 +448,7 @@ if (map == null) return null; Geometry g = SegmentStringsWithData2Features .buildGeometry(feature.getGeometry(), map, - interpolate_z, interpolated_z_dp); + interpolate_z, interpolated_z_dp, gf); Feature newFeature = feature.clone(false); newFeature.setGeometry(g); return newFeature; Modified: core/trunk/src/com/vividsolutions/jump/plugin/edit/SegmentStringsWithData2Features.java =================================================================== --- core/trunk/src/com/vividsolutions/jump/plugin/edit/SegmentStringsWithData2Features.java 2016-06-16 13:57:09 UTC (rev 4936) +++ core/trunk/src/com/vividsolutions/jump/plugin/edit/SegmentStringsWithData2Features.java 2016-06-17 06:09:52 UTC (rev 4937) @@ -71,9 +71,8 @@ */ public static Geometry buildGeometry(Geometry source, Map<Integer,Map<Integer,List<SegmentString>>> nodedSegmentStrings, - boolean interpolate_z, int interpolated_z_dp) { + boolean interpolate_z, int interpolated_z_dp, GeometryFactory gf) { // Use the same factory as source - GeometryFactory gf = source.getFactory(); Geometry[] finalComponents = new Geometry[nodedSegmentStrings.size()]; // For each component for (int i = 0 ; i < finalComponents.length ; i++) { @@ -85,7 +84,7 @@ // Merge SegmentStrings to create the new noded Geometry finalComponents[i] = merge(lines.get(0), gf, false); // Restore z values from the source geometry where possible - restoreZ(lines.get(0), (LineString)sourceComponent); + restoreZ(lines.get(0), (LineString)sourceComponent, gf); // Interpolate z values for new nodes if (interpolate_z) { interpolate(lines.get(0), (LineString)finalComponents[i], interpolated_z_dp); @@ -97,7 +96,7 @@ // Merge SegmentStrings to create the new noded exterior ring LinearRing exteriorRing = (LinearRing)merge(lines.get(0), gf, true); // Restore z from source geometry where possible - restoreZ(lines.get(0), ((Polygon)sourceComponent).getExteriorRing()); + restoreZ(lines.get(0), ((Polygon)sourceComponent).getExteriorRing(), gf); // Interpolate z values for new nodes if (interpolate_z) { interpolate(lines.get(0), exteriorRing, interpolated_z_dp); @@ -107,7 +106,7 @@ List<LinearRing> holes = new ArrayList<>(); for (int j = 0 ; j < lines.size()-1 ; j++) { LinearRing hole = (LinearRing)merge(lines.get(j+1), gf, true); - restoreZ(lines.get(j+1), ((Polygon)sourceComponent).getInteriorRingN(j)); + restoreZ(lines.get(j+1), ((Polygon)sourceComponent).getInteriorRingN(j), gf); if (hole.isEmpty()) continue; holes.add(hole); if (interpolate_z) { @@ -157,9 +156,11 @@ * Otherwise, set it to NaN (this second operation is important to avoid * transferring a z from a feature to the other). */ - private static void restoreZ(List<SegmentString> list, LineString g) { + private static void restoreZ(List<SegmentString> list, LineString g, GeometryFactory gf) { Map<Coordinate,Coordinate> map = new HashMap<>(); for (Coordinate c : g.getCoordinates()) { + c = (Coordinate)c.clone(); + gf.getPrecisionModel().makePrecise(c); map.put(c,c); } for (SegmentString ss : list) { ------------------------------------------------------------------------------ What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic patterns at an interface-level. Reveals which users, apps, and protocols are consuming the most bandwidth. Provides multi-vendor support for NetFlow, J-Flow, sFlow and other flows. Make informed decisions using capacity planning reports. http://sdm.link/zohomanageengine _______________________________________________ Jump-pilot-devel mailing list Jump-pilot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel