public String toString() { String description = "UNKNOWN"; if (modelType == FLOATING) { description = "Floating"; } else if (modelType == FLOATING_SINGLE) { description = "Floating-Single"; } else if (modelType == FIXED) { description = "Fixed (Scale=" + getScale() + ")"; } return description; }
maxSigDigits = 6; } else if (modelType == FIXED) { maxSigDigits = 1 + (int) Math.ceil(Math.log(getScale()) / Math.log(10));
public MCIndexSnapRounder(PrecisionModel pm) { this.pm = pm; li = new RobustLineIntersector(); li.setPrecisionModel(pm); scaleFactor = pm.getScale(); }
public SimpleSnapRounder(PrecisionModel pm) { this.pm = pm; li = new RobustLineIntersector(); li.setPrecisionModel(pm); scaleFactor = pm.getScale(); }
/** * Estimates the snap tolerance for a Geometry, taking into account its precision model. * * @param g a Geometry * @return the estimated snap tolerance */ public static double computeOverlaySnapTolerance(Geometry g) { double snapTolerance = computeSizeBasedSnapTolerance(g); /** * Overlay is carried out in the precision model * of the two inputs. * If this precision model is of type FIXED, then the snap tolerance * must reflect the precision grid size. * Specifically, the snap tolerance should be at least * the distance from a corner of a precision grid cell * to the centre point of the cell. */ PrecisionModel pm = g.getPrecisionModel(); if (pm.getType() == PrecisionModel.FIXED) { double fixedSnapTol = (1 / pm.getScale()) * 2 / 1.415; if (fixedSnapTol > snapTolerance) snapTolerance = fixedSnapTol; } return snapTolerance; }
public String toString() { String description = "UNKNOWN"; if (modelType == FLOATING) { description = "Floating"; } else if (modelType == FLOATING_SINGLE) { description = "Floating-Single"; } else if (modelType == FIXED) { description = "Fixed (Scale=" + getScale() + ")"; } return description; }
private void bufferFixedPrecision(PrecisionModel fixedPM) { Noder noder = new ScaledNoder(new MCIndexSnapRounder(new PrecisionModel(1.0)), fixedPM.getScale()); BufferBuilder bufBuilder = new BufferBuilder(bufParams); bufBuilder.setWorkingPrecisionModel(fixedPM); bufBuilder.setNoder(noder); // this may throw an exception, if robustness errors are encountered resultGeometry = bufBuilder.buffer(argGeom, distance); } }
maxSigDigits = 6; } else if (modelType == FIXED) { maxSigDigits = 1 + (int) Math.ceil(Math.log(getScale()) / Math.log(10));
public SimpleSnapRounder(PrecisionModel pm) { this.pm = pm; li = new RobustLineIntersector(); li.setPrecisionModel(pm); scaleFactor = pm.getScale(); }
public MCIndexSnapRounder(PrecisionModel pm) { this.pm = pm; li = new RobustLineIntersector(); li.setPrecisionModel(pm); scaleFactor = pm.getScale(); }
/** * Estimates the snap tolerance for a Geometry, taking into account its precision model. * * @param g a Geometry * @return the estimated snap tolerance */ public static double computeOverlaySnapTolerance(Geometry g) { double snapTolerance = computeSizeBasedSnapTolerance(g); /** * Overlay is carried out in the precision model * of the two inputs. * If this precision model is of type FIXED, then the snap tolerance * must reflect the precision grid size. * Specifically, the snap tolerance should be at least * the distance from a corner of a precision grid cell * to the centre point of the cell. */ PrecisionModel pm = g.getPrecisionModel(); if (pm.getType() == PrecisionModel.FIXED) { double fixedSnapTol = (1 / pm.getScale()) * 2 / 1.415; if (fixedSnapTol > snapTolerance) snapTolerance = fixedSnapTol; } return snapTolerance; }
private void bufferFixedPrecision(PrecisionModel fixedPM) { Noder noder = new ScaledNoder(new MCIndexSnapRounder(new PrecisionModel(1.0)), fixedPM.getScale()); BufferBuilder bufBuilder = new BufferBuilder(bufParams); bufBuilder.setWorkingPrecisionModel(fixedPM); bufBuilder.setNoder(noder); // this may throw an exception, if robustness errors are encountered resultGeometry = bufBuilder.buffer(argGeom, distance); } }
/** * Convert the supplied {@code PrecisionModel}. * * @param precisionModel the precision model * * @return the converted precision model */ private org.locationtech.jts.geom.PrecisionModel convertPrecisionModel( com.vividsolutions.jts.geom.PrecisionModel precisionModel) { if (precisionModel.getType() == com.vividsolutions.jts.geom.PrecisionModel.FIXED) { return new org.locationtech.jts.geom.PrecisionModel(precisionModel.getScale()); } else if (precisionModel.getType() == com.vividsolutions.jts.geom.PrecisionModel.FLOATING) { return new org.locationtech.jts.geom.PrecisionModel( org.locationtech.jts.geom.PrecisionModel.FLOATING); } else if (precisionModel.getType() == com.vividsolutions.jts.geom.PrecisionModel.FLOATING_SINGLE) { return new org.locationtech.jts.geom.PrecisionModel( org.locationtech.jts.geom.PrecisionModel.FLOATING_SINGLE); } else { return new org.locationtech.jts.geom.PrecisionModel( new org.locationtech.jts.geom.PrecisionModel.Type( precisionModel.getType().toString())); } }
/** * Convert the supplied {@code PrecisionModel}. * * @param precisionModel the precision model * * @return the converted precision model */ private org.locationtech.jts.geom.PrecisionModel convertPrecisionModel( com.vividsolutions.jts.geom.PrecisionModel precisionModel) { if (precisionModel.getType() == com.vividsolutions.jts.geom.PrecisionModel.FIXED) { return new org.locationtech.jts.geom.PrecisionModel(precisionModel.getScale()); } else if (precisionModel.getType() == com.vividsolutions.jts.geom.PrecisionModel.FLOATING) { return new org.locationtech.jts.geom.PrecisionModel( org.locationtech.jts.geom.PrecisionModel.FLOATING); } else if (precisionModel.getType() == com.vividsolutions.jts.geom.PrecisionModel.FLOATING_SINGLE) { return new org.locationtech.jts.geom.PrecisionModel( org.locationtech.jts.geom.PrecisionModel.FLOATING_SINGLE); } else { return new org.locationtech.jts.geom.PrecisionModel( new org.locationtech.jts.geom.PrecisionModel.Type( precisionModel.getType().toString())); } }
/** * Convert the supplied {@code PrecisionModel}. * * @param precisionModel the precision model * * @return the converted precision model */ private org.locationtech.jts.geom.PrecisionModel convertPrecisionModel( com.vividsolutions.jts.geom.PrecisionModel precisionModel) { if (precisionModel.getType() == com.vividsolutions.jts.geom.PrecisionModel.FIXED) { return new org.locationtech.jts.geom.PrecisionModel(precisionModel.getScale()); } else if (precisionModel.getType() == com.vividsolutions.jts.geom.PrecisionModel.FLOATING) { return new org.locationtech.jts.geom.PrecisionModel( org.locationtech.jts.geom.PrecisionModel.FLOATING); } else if (precisionModel.getType() == com.vividsolutions.jts.geom.PrecisionModel.FLOATING_SINGLE) { return new org.locationtech.jts.geom.PrecisionModel( org.locationtech.jts.geom.PrecisionModel.FLOATING_SINGLE); } else { return new org.locationtech.jts.geom.PrecisionModel( new org.locationtech.jts.geom.PrecisionModel.Type( precisionModel.getType().toString())); } }
PrecisionModel precisionmodel = geometry.getPrecisionModel(); if (!precisionmodel.isFloating()) { precision = (int) Math.log10(precisionmodel.getScale());