/** * 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 computeGeometry() { bufferOriginalPrecision(); if (resultGeometry != null) return; PrecisionModel argPM = argGeom.getFactory().getPrecisionModel(); if (argPM.getType() == PrecisionModel.FIXED) bufferFixedPrecision(argPM); else bufferReducedPrecision(); }
public JtsBinaryCodec(JtsSpatialContext ctx, JtsSpatialContextFactory factory) { super(ctx, factory); //note: ctx.geometryFactory hasn't been set yet useFloat = (factory.precisionModel.getType() == PrecisionModel.FLOATING_SINGLE); }
public JtsBinaryCodec(JtsSpatialContext ctx, JtsSpatialContextFactory factory) { super(ctx, factory); //note: ctx.geometryFactory hasn't been set yet useFloat = (factory.precisionModel.getType() == PrecisionModel.FLOATING_SINGLE); }
/** * 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())); } }
/** * 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 computeGeometry() { bufferOriginalPrecision(); if (resultGeometry != null) return; PrecisionModel argPM = argGeom.getFactory().getPrecisionModel(); if (argPM.getType() == PrecisionModel.FIXED) bufferFixedPrecision(argPM); else bufferReducedPrecision(); }