Java 类com.vividsolutions.jts.geom.util.GeometryEditor 实例源码

项目:Earth    文件:GeometryPrecisionReducer.java   
private GeometryEditor createEditor(GeometryFactory geomFactory, PrecisionModel newPM) {
    // no need to change if precision model is the same
    if (geomFactory.getPrecisionModel() == newPM) {
        return new GeometryEditor();
    }
    // otherwise create a geometry editor which changes PrecisionModel
    GeometryFactory newFactory = this.createFactory(geomFactory, newPM);
    GeometryEditor geomEdit = new GeometryEditor(newFactory);
    return geomEdit;
}
项目:jts    文件:GeometryPrecisionReducer.java   
private GeometryEditor createEditor(GeometryFactory geomFactory, PrecisionModel newPM) {
    // no need to change if precision model is the same
    if (geomFactory.getPrecisionModel() == newPM)
        return new GeometryEditor();
    // otherwise create a geometry editor which changes PrecisionModel
    GeometryFactory newFactory = createFactory(geomFactory, newPM);
    GeometryEditor geomEdit = new GeometryEditor(newFactory);
    return geomEdit;
}
项目:Earth    文件:GeometryFactory.java   
/**
 * Creates a deep copy of the input {@link Geometry}.
 * The {@link CoordinateSequenceFactory} defined for this factory
 * is used to copy the {@link CoordinateSequence}s
 * of the input geometry.
 * <p>
 * This is a convenient way to change the <tt>CoordinateSequence</tt>
 * used to represent a geometry, or to change the
 * factory used for a geometry.
 * <p>
 * {@link Geometry#clone()} can also be used to make a deep copy,
 * but it does not allow changing the CoordinateSequence type.
 *
 * @return a deep copy of the input geometry, using the CoordinateSequence type of this factory
 * @see Geometry#clone()
 */
public Geometry createGeometry(Geometry g) {
    GeometryEditor editor = new GeometryEditor(this);
    return editor.edit(g, new GeometryEditor.CoordinateSequenceOperation() {
        @Override
        public CoordinateSequence edit(CoordinateSequence coordSeq, Geometry geometry) {
            return GeometryFactory.this.coordinateSequenceFactory.create(coordSeq);
        }
    });
}
项目:jts    文件:GeometryFactory.java   
/**
 * Creates a deep copy of the input {@link Geometry}.
 * The {@link CoordinateSequenceFactory} defined for this factory
 * is used to copy the {@link CoordinateSequence}s
 * of the input geometry.
 * <p/>
 * This is a convenient way to change the <tt>CoordinateSequence</tt>
 * used to represent a geometry, or to change the
 * factory used for a geometry.
 * <p/>
 * {@link Geometry#clone()} can also be used to make a deep copy,
 * but it does not allow changing the CoordinateSequence type.
 *
 * @return a deep copy of the input geometry, using the CoordinateSequence type of this factory
 * @see Geometry#clone()
 */
public Geometry createGeometry(Geometry g) {
    GeometryEditor editor = new GeometryEditor(this);
    return editor.edit(g, new GeometryEditor.CoordinateSequenceOperation() {
        public CoordinateSequence edit(CoordinateSequence coordSeq, Geometry geometry) {
            return coordinateSequenceFactory.create(coordSeq);
        }
    });
}
项目:Earth    文件:GeometryPrecisionReducer.java   
/**
 * Duplicates a geometry to one that uses a different PrecisionModel,
 * without changing any coordinate values.
 *
 * @param geom the geometry to duplicate
 * @param newPM the precision model to use
 * @return the geometry value with a new precision model
 */
private Geometry changePM(Geometry geom, PrecisionModel newPM) {
    GeometryEditor geomEditor = this.createEditor(geom.getFactory(), newPM);
    // this operation changes the PM for the entire geometry tree
    return geomEditor.edit(geom, new GeometryEditor.NoOpGeometryOperation());
}
项目:jts    文件:GeometryPrecisionReducer.java   
/**
 * Duplicates a geometry to one that uses a different PrecisionModel,
 * without changing any coordinate values.
 *
 * @param geom  the geometry to duplicate
 * @param newPM the precision model to use
 * @return the geometry value with a new precision model
 */
private Geometry changePM(Geometry geom, PrecisionModel newPM) {
    GeometryEditor geomEditor = createEditor(geom.getFactory(), newPM);
    // this operation changes the PM for the entire geometry tree
    return geomEditor.edit(geom, new GeometryEditor.NoOpGeometryOperation());
}