Examples of Coordinate


Examples of com.vividsolutions.jts.geom.Coordinate

    InternalTile tile = (InternalTile) object;
    FeatureStyleInfo bgStyle = labelStyle.getBackgroundStyle();
    document.writeElement("g", asChild);
    document.writeId("labels." + tile.getCode().toString());
    for (InternalFeature feature : tile.getFeatures()) {
      Coordinate pos = geoService.calcDefaultLabelPosition(feature);
      if (null != pos) {
        Point p = factory.createPoint(pos);
        Point labelPos;
        try {
          String labelString = feature.getLabel();
View Full Code Here

Examples of com.vividsolutions.jts.geom.Coordinate

        Bbox bbox = new Bbox(west, south, east - west, north - south);
        location.setEnvelope(dtoConverterService.toInternal(bbox));
      }
    }

    location.setCoordinate(new Coordinate(Double.parseDouble(locationElement.getChildText("longitude")),
        Double.parseDouble(locationElement.getChildText("latitude"))));

    return location;
  }
View Full Code Here

Examples of com.vividsolutions.jts.geom.Coordinate

        GetLocationResult one = new GetLocationResult();
        List<String> prefResult = new ArrayList<String>();
        prefResult.add(toponym.getCountryCode());
        prefResult.add(toponym.getName());
        one.setCanonicalStrings(prefResult);
        Coordinate coordinate = new Coordinate();
        coordinate.x = toponym.getLongitude();
        coordinate.y = toponym.getLatitude();
        one.setCoordinate(coordinate);
        result[i] = one;
      }
View Full Code Here

Examples of com.vividsolutions.jts.geom.Coordinate

    double halfCrsHeight = EXTEND_MAPUNIT_TEST_LENGTH;
    double x = coordinate.x;
    double y = coordinate.y;
    for (int i = EXTEND_MAX_ITERATIONS; i > 0; i--) {
      try {
        Coordinate test;
        test = new Coordinate(x + halfCrsWidth, y);
        double deltaX = JTS.orthodromicDistance(coordinate, test, crs);
        test = new Coordinate(x, y + halfCrsHeight);
        double deltaY = JTS.orthodromicDistance(coordinate, test, crs);
        if (Math.abs(deltaX - width / 2) < DISTANCE_PRECISION &&
            Math.abs(deltaY - height / 2) < DISTANCE_PRECISION) {
          break;
        }
View Full Code Here

Examples of com.vividsolutions.jts.geom.Coordinate

        NumberFormat format = NumberFormat.getInstance(locale);
        try {
          Double x = format.parse(parts[0]).doubleValue();
          Double y = format.parse(parts[1]).doubleValue();

          result.setCoordinate(new Coordinate(x, y));
          List<String> canonical = new ArrayList<String>();
          canonical.add(parts[0] + " " + parts[1]);
          result.setCanonicalStrings(canonical);
          return new GetLocationResult[] { result };
        } catch (ParseException pe) {
View Full Code Here

Examples of com.vividsolutions.jts.geom.Coordinate

  @Test
  public void testMergePolygon() throws Exception {
    MergePolygonRequest request = new MergePolygonRequest();
    GeometryFactory factory = new GeometryFactory();
    request.setPolygons(new Geometry[] {
        dtoConverter.toDto(geoService.createCircle(factory.createPoint(new Coordinate(0, 0)), 10, 10)),
        dtoConverter.toDto(geoService.createCircle(factory.createPoint(new Coordinate(5, 5)), 10, 10))});
    MergePolygonResponse response = (MergePolygonResponse) dispatcher.execute(
        MergePolygonRequest.COMMAND, request, null, "en");
    if (response.isError()) {
      response.getErrors().get(0).printStackTrace();
    }
View Full Code Here

Examples of com.vividsolutions.jts.geom.Coordinate

  @Test
  public void testSplitPolygon() throws Exception {
    SplitPolygonRequest request = new SplitPolygonRequest();
    GeometryFactory factory = new GeometryFactory();
    request.setGeometry(
        dtoConverter.toDto(geoService.createCircle(factory.createPoint(new Coordinate(0, 0)), 10, 10)));
    request.setSplitter(
        dtoConverter.toDto(factory.createLineString(new Coordinate[] {
            new Coordinate(-10, -10), new Coordinate(10, 10)
        })));
    SplitPolygonResponse response = (SplitPolygonResponse) dispatcher.execute(
        SplitPolygonRequest.COMMAND, request, null, "en");
    if (response.isError()) {
      response.getErrors().get(0).printStackTrace();
View Full Code Here

Examples of com.vividsolutions.jts.geom.Coordinate

    FeatureTransaction featureTransaction = new FeatureTransaction();
    featureTransaction.setLayerId(LAYER_ID);
    Feature feature = new Feature();
    GeometryFactory factory = new GeometryFactory();
    Geometry circle =
        dtoConverter.toDto(geoService.createCircle(factory.createPoint(new Coordinate(0, 0)), 10, 10));
    feature.setGeometry(circle);
    featureTransaction.setNewFeatures(new Feature[] {feature});
    request.setFeatureTransaction(featureTransaction);
    PersistTransactionResponse response = (PersistTransactionResponse) dispatcher.execute(
        PersistTransactionRequest.COMMAND, request, null, "en");
View Full Code Here

Examples of com.vividsolutions.jts.geom.Coordinate

    */
  }

  private void verify(Coordinate mercator, Coordinate lonlat, double x, double y, double lon, double lat)
      throws Exception {
    Coordinate projected = new Coordinate();
    projected = JTS.transform(mercator, projected, layerToMap);
    Assert.assertEquals(x, mercator.x, TOLERANCE);
    Assert.assertEquals(lon, projected.x, TOLERANCE);
    Assert.assertEquals(lon, lonlat.x, TOLERANCE);
    Assert.assertEquals(y, mercator.y, TOLERANCE);
View Full Code Here

Examples of com.vividsolutions.jts.geom.Coordinate

  @Test
  public void testCalcDefaultLabelPosition() throws Exception {
    Geometry geometry;
    GeometryFactory factory = new GeometryFactory(new PrecisionModel(), 4326);
    Coordinate coordinate;
    InternalFeature feature = new InternalFeatureImpl();
    feature.setId("x");
    feature.setLabel("Label x");
    coordinate = geoService.calcDefaultLabelPosition(feature);
    Assert.assertNull(coordinate);

    feature.setGeometry(factory.createMultiPolygon(new Polygon[] {}));
    coordinate = geoService.calcDefaultLabelPosition(feature);
    Assert.assertNull(coordinate);

    feature.setGeometry(JTS.toGeometry(new Envelope(10, 20, 30, 40)));
    coordinate = geoService.calcDefaultLabelPosition(feature);
    // this tests current behaviour, without claims that this is the "best" (or even "good") position
    Assert.assertEquals(15.0, coordinate.x, DELTA);
    Assert.assertEquals(35.0, coordinate.y, DELTA);

    geometry = factory.createLineString(new Coordinate[] { new Coordinate(5,4), new Coordinate(30,10) });
    feature.setGeometry(geometry);
    coordinate = geoService.calcDefaultLabelPosition(feature);
    // this tests current behaviour, without claims that this is the "best" (or even "good") position
    Assert.assertEquals(5.0, coordinate.x, DELTA);
    Assert.assertEquals(4.0, coordinate.y, DELTA);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.