Search in sources :

Example 1 with BufferParameters

use of com.revolsys.geometry.operation.buffer.BufferParameters in project com.revolsys.open by revolsys.

the class JTSFunctions method logoBuffer.

public static Geometry logoBuffer(final Geometry g, final double distance) {
    final Geometry lines = logoLines(g);
    final BufferParameters bufParams = new BufferParameters();
    bufParams.setEndCapStyle(LineCap.SQUARE);
    return lines.buffer(distance, bufParams);
}
Also used : Geometry(com.revolsys.geometry.model.Geometry) BufferParameters(com.revolsys.geometry.operation.buffer.BufferParameters)

Example 2 with BufferParameters

use of com.revolsys.geometry.operation.buffer.BufferParameters in project com.revolsys.open by revolsys.

the class BufferFunctions method singleSidedBuffer.

public static Geometry singleSidedBuffer(final Geometry geom, final double distance) {
    final BufferParameters bufParams = new BufferParameters();
    bufParams.setSingleSided(true);
    return geom.buffer(distance, bufParams);
}
Also used : BufferParameters(com.revolsys.geometry.operation.buffer.BufferParameters)

Example 3 with BufferParameters

use of com.revolsys.geometry.operation.buffer.BufferParameters in project com.revolsys.open by revolsys.

the class BufferFunctions method bufferCurveWithParams.

public static Geometry bufferCurveWithParams(final Geometry g, final Double distance, final Integer quadrantSegments, final Integer capStyle, final Integer joinStyle, final Double mitreLimit) {
    double dist = 0;
    if (distance != null) {
        dist = distance.doubleValue();
    }
    final BufferParameters bufParams = new BufferParameters();
    if (quadrantSegments != null) {
        bufParams.setQuadrantSegments(quadrantSegments.intValue());
    }
    if (capStyle != null) {
        bufParams.setEndCapStyle(LineCap.fromGeometryValue(capStyle));
    }
    if (joinStyle != null) {
        bufParams.setJoinStyle(LineJoin.fromGeometryValue(joinStyle));
    }
    if (mitreLimit != null) {
        bufParams.setMitreLimit(mitreLimit.doubleValue());
    }
    return buildCurveSet(g, dist, bufParams);
}
Also used : BufferParameters(com.revolsys.geometry.operation.buffer.BufferParameters)

Example 4 with BufferParameters

use of com.revolsys.geometry.operation.buffer.BufferParameters in project com.revolsys.open by revolsys.

the class BufferCorrectnessTest method run4.

void run4() throws Exception {
    // String wkt =
    // "LINESTRING (1872699.676 530329.155, 1872712.232 530255.793, 1872724.601
    // 530183.526, 1872737.157 530110.164, 1872749.713 530036.802, 1872762.082
    // 529964.535, 1872774.638 529891.173, 1872787.194 529817.811, 1872799.563
    // 529745.545, 1872812.119 529672.183, 1872824.675 529598.821, 1872837.044
    // 529526.555, 1872849.6 529453.194, 1872862.156 529379.832, 1872874.524
    // 529307.566, 1872887.08 529234.205, 1872899.636 529160.844, 1872912.005
    // 529088.578, 1872924.561 529015.217, 1872937.117 528941.856, 1872949.486
    // 528869.59, 1872962.042 528796.23)";
    // String wkt =
    // "LINESTRING(1872762.082 529964.535, 1872774.638 529891.173, 1872787.194
    // 529817.811)";
    final String wkt = "LINESTRING (1872612.157 530840.503, 1872624.713 530767.14, 1872637.269 530693.777)";
    final Geometry g = this.geometryFactory.geometry(wkt);
    final BufferParameters params = new BufferParameters(10, LineCap.SQUARE, LineJoin.MITER, 10);
    final Geometry buf = g.buffer(200, params);
// System.out.println(buf);
}
Also used : Geometry(com.revolsys.geometry.model.Geometry) BufferParameters(com.revolsys.geometry.operation.buffer.BufferParameters)

Example 5 with BufferParameters

use of com.revolsys.geometry.operation.buffer.BufferParameters in project com.revolsys.open by revolsys.

the class BufferCorrectnessTest method run6.

void run6() throws Exception {
    // polygon with two vertices very close - mitred negative buffer lies
    // outside input
    final String wkt = "POLYGON ((589081.1515112884 4518509.334764771, 589103.7370954598 4518497.015419995, 589099.8017397423 4518490.719003885, 589097.1198886324 4518486.20858194, 589090.9424687021 4518475.819013388, 589081.1515112884 4518509.334764771))";
    final Geometry g = this.geometryFactory.geometry(wkt);
    final BufferParameters params = new BufferParameters(8, LineCap.ROUND, LineJoin.MITER, 5);
    final Geometry buf = g.buffer(-5, params);
// System.out.println(buf);
}
Also used : Geometry(com.revolsys.geometry.model.Geometry) BufferParameters(com.revolsys.geometry.operation.buffer.BufferParameters)

Aggregations

BufferParameters (com.revolsys.geometry.operation.buffer.BufferParameters)9 Geometry (com.revolsys.geometry.model.Geometry)5 GeometryFactory (com.revolsys.geometry.model.GeometryFactory)1 LineCap (com.revolsys.geometry.model.LineCap)1 LineJoin (com.revolsys.geometry.model.LineJoin)1 MapReader (com.revolsys.io.map.MapReader)1 ClassPathResource (com.revolsys.spring.resource.ClassPathResource)1 TestSuite (junit.framework.TestSuite)1