Search in sources :

Example 96 with GeometryFactory

use of com.revolsys.geometry.model.GeometryFactory in project com.revolsys.open by revolsys.

the class BoundingBoxTaskSplitter method run.

@Override
public void run() {
    preRun();
    try {
        if (this.boundingBox != null) {
            final GeometryFactory geometryFactory = this.boundingBox.getGeometryFactory();
            final double xInc = this.boundingBox.getWidth() / this.numX;
            final double yInc = this.boundingBox.getHeight() / this.numY;
            double y = this.boundingBox.getMinY();
            for (int j = 0; j < this.numX; j++) {
                double x = this.boundingBox.getMinX();
                for (int i = 0; i < this.numX; i++) {
                    final BoundingBox cellBoundingBox = geometryFactory.newBoundingBox(x, y, x + xInc, y + yInc);
                    if (this.preparedBoundary == null || this.preparedBoundary.intersects(cellBoundingBox.toPolygon(50))) {
                        if (this.logScriptInfo) {
                            Logs.info(this, "Processing bounding box " + cellBoundingBox.toPolygon(1));
                        }
                        execute(cellBoundingBox);
                    }
                    x += xInc;
                }
                y += yInc;
            }
        }
    } finally {
        postRun();
    }
}
Also used : GeometryFactory(com.revolsys.geometry.model.GeometryFactory) BoundingBox(com.revolsys.geometry.model.BoundingBox)

Example 97 with GeometryFactory

use of com.revolsys.geometry.model.GeometryFactory in project com.revolsys.open by revolsys.

the class WmsClient method getGeometryFactory.

public static GeometryFactory getGeometryFactory(final String srs) {
    final int coordinateSystemId = getCoordinateSystemId(srs);
    final GeometryFactory geometryFactory = GeometryFactory.floating2d(coordinateSystemId);
    return geometryFactory;
}
Also used : GeometryFactory(com.revolsys.geometry.model.GeometryFactory)

Example 98 with GeometryFactory

use of com.revolsys.geometry.model.GeometryFactory in project com.revolsys.open by revolsys.

the class AbstractGeoreferencedImage method setTiePoints.

@Override
public void setTiePoints(final List<MappedLocation> tiePoints) {
    if (!DataType.equal(tiePoints, this.tiePoints)) {
        for (final MappedLocation mappedLocation : this.tiePoints) {
            mappedLocation.removePropertyChangeListener(this);
        }
        this.tiePoints.clear();
        this.tiePoints.addAll(tiePoints);
        final GeometryFactory geometryFactory = getGeometryFactory();
        for (final MappedLocation mappedLocation : tiePoints) {
            mappedLocation.setGeometryFactory(geometryFactory);
            mappedLocation.addPropertyChangeListener(this);
        }
        setHasChanges(true);
    }
}
Also used : GeometryFactory(com.revolsys.geometry.model.GeometryFactory)

Example 99 with GeometryFactory

use of com.revolsys.geometry.model.GeometryFactory in project com.revolsys.open by revolsys.

the class AbstractGeoreferencedImage method loadProjectionFile.

protected void loadProjectionFile() {
    final Resource resource = getImageResource();
    final GeometryFactory geometryFactory = GeometryFactory.floating2d(resource);
    setGeometryFactory(geometryFactory);
}
Also used : GeometryFactory(com.revolsys.geometry.model.GeometryFactory) Resource(com.revolsys.spring.resource.Resource)

Example 100 with GeometryFactory

use of com.revolsys.geometry.model.GeometryFactory in project com.revolsys.open by revolsys.

the class GeoreferencedImage method setBoundingBox.

default void setBoundingBox(final double minX, final double maxY, final double pixelWidth, final double pixelHeight) {
    final GeometryFactory geometryFactory = getGeometryFactory();
    final int imageWidth = getImageWidth();
    final double maxX = minX + pixelWidth * imageWidth;
    final int imageHeight = getImageHeight();
    final double minY = maxY + pixelHeight * imageHeight;
    final BoundingBox boundingBox = geometryFactory.newBoundingBox(minX, maxY, maxX, minY);
    setBoundingBox(boundingBox);
}
Also used : GeometryFactory(com.revolsys.geometry.model.GeometryFactory) BoundingBox(com.revolsys.geometry.model.BoundingBox) Point(com.revolsys.geometry.model.Point)

Aggregations

GeometryFactory (com.revolsys.geometry.model.GeometryFactory)360 Point (com.revolsys.geometry.model.Point)142 Geometry (com.revolsys.geometry.model.Geometry)72 BoundingBox (com.revolsys.geometry.model.BoundingBox)70 LineString (com.revolsys.geometry.model.LineString)61 ArrayList (java.util.ArrayList)45 DataType (com.revolsys.datatype.DataType)25 FieldDefinition (com.revolsys.record.schema.FieldDefinition)24 Polygon (com.revolsys.geometry.model.Polygon)22 List (java.util.List)18 RecordDefinition (com.revolsys.record.schema.RecordDefinition)17 Test (org.junit.Test)16 CoordinateSystem (com.revolsys.geometry.cs.CoordinateSystem)15 Vertex (com.revolsys.geometry.model.vertex.Vertex)14 Record (com.revolsys.record.Record)14 IOException (java.io.IOException)13 PathName (com.revolsys.io.PathName)12 LinearRing (com.revolsys.geometry.model.LinearRing)10 PointDoubleXY (com.revolsys.geometry.model.impl.PointDoubleXY)10 QuadEdgeDelaunayTinBuilder (com.revolsys.elevation.tin.quadedge.QuadEdgeDelaunayTinBuilder)8