Package com.vividsolutions.jts.geom

Examples of com.vividsolutions.jts.geom.Coordinate


public class CentroidTest {

  @Test
  public void testSinglePointString() {
    GeometryFactory factory = new GeometryFactory();
    LineString ls = factory.createLineString(new Coordinate[] {new Coordinate(0, 0),
        new Coordinate(0, 0)});
    com.vividsolutions.jts.geom.Point p = ls.getCentroid();
    assertTrue(Double.isNaN(p.getX()));
  }
View Full Code Here


    request.setQueryType(SearchByLocationRequest.QUERY_INTERSECTS);
    request.setSearchType(SearchByLocationRequest.SEARCH_ALL_LAYERS);
    request.setLayerIds(new String[] {LAYER_ID});

    GeometryFactory factory = new GeometryFactory();
    LineString equator = factory.createLineString(new Coordinate[] {new Coordinate(0, 0),
        new Coordinate(-180, 180)});
    request.setLocation(converter.toDto(equator));

    // execute
    SearchByLocationResponse response = (SearchByLocationResponse) dispatcher.execute(
        SearchByLocationRequest.COMMAND, request, null, "en");
View Full Code Here

    //note that setting a global filter on the SearchByLocationRequest will only work if the filter is applicable
    //to all layers! In this test case there is only one layer.
    request.setFilter("region='Region 1'");

    GeometryFactory factory = new GeometryFactory();
    LineString equator = factory.createLineString(new Coordinate[] {new Coordinate(0, 0),
        new Coordinate(-180, 180)});
    request.setLocation(converter.toDto(equator));

    // execute
    SearchByLocationResponse response = (SearchByLocationResponse) dispatcher.execute(
        SearchByLocationRequest.COMMAND, request, null, "en");
View Full Code Here

    request.setSearchType(SearchByLocationRequest.SEARCH_ALL_LAYERS);
    request.setLayerIds(new String[] {LAYER_ID});
    request.setFilter(LAYER_ID, "region='Region 1'");

    GeometryFactory factory = new GeometryFactory();
    LineString equator = factory.createLineString(new Coordinate[] {new Coordinate(0, 0),
        new Coordinate(-180, 180)});
    request.setLocation(converter.toDto(equator));

    // execute
    SearchByLocationResponse response = (SearchByLocationResponse) dispatcher.execute(
        SearchByLocationRequest.COMMAND, request, null, "en");
View Full Code Here

    request.setRatio(0.5f);
    request.setLayerIds(new String[] {LAYER_ID});

    // create a rectangle that overlaps 50 %
    GeometryFactory factory = new GeometryFactory();
    LinearRing half1 = factory.createLinearRing(new Coordinate[] {new Coordinate(0, 0), new Coordinate(1, 0),
        new Coordinate(1, 0.5), new Coordinate(0, 0.5), new Coordinate(0, 0)});
    Polygon polygon = factory.createPolygon(half1, null);
    request.setLocation(converter.toDto(polygon));

    // execute
    SearchByLocationResponse response = (SearchByLocationResponse) dispatcher.execute(
View Full Code Here

    request.setRatio(0.5f);
    request.setLayerIds(new String[] {LAYER_ID});

    // create a rectangle that overlaps 49 %
    GeometryFactory factory = new GeometryFactory();
    LinearRing half1 = factory.createLinearRing(new Coordinate[] {new Coordinate(0, 0), new Coordinate(1, 0),
        new Coordinate(1, 0.49), new Coordinate(0, 0.49), new Coordinate(0, 0)});
    Polygon polygon = factory.createPolygon(half1, null);
    request.setLocation(converter.toDto(polygon));

    // execute
    SearchByLocationResponse response = (SearchByLocationResponse) dispatcher.execute(
View Full Code Here

    private static final long serialVersionUID = 180L;

    public UnserializableException() {
      super("Oops. I guess the server encountered some 'unexpected' exception.");
      GeometryFactory factory = new GeometryFactory();
      geometry = factory.createLineString(new Coordinate[] { new Coordinate(0, 0), new Coordinate(10, 0) });
    }
View Full Code Here

    int xmin = (int) Math.floor((bounds.getMinX() - bbox.getX()) / realWidth);
    int xmax = (int) Math.ceil((bounds.getMaxX() - bbox.getX()) / realWidth);
    // same adjustment for corner
    double realXmin = ((int) (bbox.getX() * scale)) / scale;
    double realYmin = ((int) (bbox.getY() * scale)) / scale;
    Coordinate lowerLeft = new Coordinate(realXmin + xmin * realWidth, realYmin + ymin * realHeight);
    return new RasterGrid(lowerLeft, xmin, ymin, xmax, ymax, realWidth, realHeight);
  }
View Full Code Here

      }
    }
  }

  private void renderViewPort(ViewPortComponentImpl viewPort, PdfContext context) {
    Coordinate portOrigin = viewPort.getLocation();
    float x = (float) (portOrigin.x - location.x) * getPpUnit();
    float y = (float) (portOrigin.y - location.y) * getPpUnit();
    Rectangle shadowRect = new Rectangle(x, y, x + viewPort.getBounds().getWidth()
        / viewPort.getZoomScale(), y + viewPort.getBounds().getHeight() / viewPort.getZoomScale());
    context.fillRectangle(shadowRect, context.makeTransparent(Color.lightGray, 0.5f));
View Full Code Here

    setPpUnit(mapInfo.getPpUnit());
    setRasterResolution(mapInfo.getRasterResolution());
  }

  private Coordinate createCoordinate(org.geomajas.geometry.Coordinate coordinate) {
    return new Coordinate(coordinate.getX(), coordinate.getY());
  }
View Full Code Here

TOP

Related Classes of com.vividsolutions.jts.geom.Coordinate

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.