Examples of PrecisionModel


Examples of com.vividsolutions.jts.geom.PrecisionModel

  }

  private void putBasics(JSONObject jso, Geometry geometry) {
    jso.put(ATTRIBUTE_TYPE, getType(geometry));
    jso.put(ATTRIBUTE_SRID, geometry.getSRID());
    PrecisionModel precisionmodel = geometry.getPrecisionModel();
    // floating or fixed, if floating put -1, if fixed the number of
    // decimals
    if (precisionmodel.isFloating()) {
      jso.put(ATTRIBUTE_PRECISION, -1);
    } else {
      int precision = (int) Math.log10(precisionmodel.getScale());
      jso.put(ATTRIBUTE_PRECISION, precision);
    }
  }
View Full Code Here

Examples of com.vividsolutions.jts.geom.PrecisionModel

  }

  private JSONObject fromPoint(Point p) {
    JSONObject jso = new JSONObject();
    JSONArray coordinates = new JSONArray();
    PrecisionModel precisionmodel = p.getPrecisionModel();
    coordinates.put(precisionmodel.makePrecise(p.getX()));
    coordinates.put(precisionmodel.makePrecise(p.getY()));
    putBasics(jso, p);
    jso.put(ATTRIBUTE_COORDINATES, coordinates);
    return jso;
  }
View Full Code Here

Examples of com.vividsolutions.jts.geom.PrecisionModel

    putBasics(jso, mp);
    return jso;
  }

  private JSONObject fromLineString(LineString ls) {
    PrecisionModel precisionmodel = ls.getPrecisionModel();
    JSONObject jso = new JSONObject();
    JSONArray coordinates = new JSONArray();
    for (int i = 0; i < ls.getCoordinates().length; i++) {
      coordinates.put(precisionmodel.makePrecise(ls.getCoordinates()[i].x));
      coordinates.put(precisionmodel.makePrecise(ls.getCoordinates()[i].y));
    }
    putBasics(jso, ls);
    jso.put(ATTRIBUTE_COORDINATES, coordinates);
    return jso;
  }
View Full Code Here

Examples of com.vividsolutions.jts.geom.PrecisionModel

      } catch (Exception e) {
        throw new GeomajasException(e, ExceptionCode.MERGE_NO_POLYGON);
      }
    }
    int precision = polygons[0].getPrecisionModel().getMaximumSignificantDigits() - 1;
    PrecisionModel precisionModel = new PrecisionModel(Math.pow(10.0, precision));
    GeometryFactory factory = new GeometryFactory(precisionModel, polygons[0].getSRID());

    Geometry temp = factory.createGeometry(polygons[0]);
    for (int i = 1; i < polygons.length; i++) {
      Geometry polygon = factory.createGeometry(polygons[i]);
View Full Code Here

Examples of com.vividsolutions.jts.geom.PrecisionModel

  public void init() {
    gwtFactory = new GeometryFactory(SRID, PRECISION);
    gwt = gwtFactory.createLinearRing(new Coordinate[] {new Coordinate(10.0, 10.0), new Coordinate(20.0, 10.0),
        new Coordinate(20.0, 20.0), new Coordinate(10.0, 10.0)});

    jtsFactory = new com.vividsolutions.jts.geom.GeometryFactory(new PrecisionModel(), SRID);
    jts = jtsFactory.createLinearRing(new com.vividsolutions.jts.geom.Coordinate[] {
        new com.vividsolutions.jts.geom.Coordinate(10.0, 10.0),
        new com.vividsolutions.jts.geom.Coordinate(20.0, 10.0),
        new com.vividsolutions.jts.geom.Coordinate(20.0, 20.0),
        new com.vividsolutions.jts.geom.Coordinate(10.0, 10.0)});
View Full Code Here

Examples of com.vividsolutions.jts.geom.PrecisionModel

        new Coordinate(20.0, 10.0), new Coordinate(20.0, 20.0)});
    LineString gwtLine2 = gwtFactory.createLineString(new Coordinate[] {new Coordinate(10.0, 20.0),
        new Coordinate(30.0, 10.0), new Coordinate(40.0, 10.0)});
    gwt = gwtFactory.createMultiLineString(new LineString[] {gwtLine1, gwtLine2});

    jtsFactory = new com.vividsolutions.jts.geom.GeometryFactory(new PrecisionModel(), SRID);
    com.vividsolutions.jts.geom.LineString jtsLine1 = jtsFactory
        .createLineString(new com.vividsolutions.jts.geom.Coordinate[] {
            new com.vividsolutions.jts.geom.Coordinate(10.0, 10.0),
            new com.vividsolutions.jts.geom.Coordinate(20.0, 10.0),
            new com.vividsolutions.jts.geom.Coordinate(20.0, 20.0)});
View Full Code Here

Examples of com.vividsolutions.jts.geom.PrecisionModel

        new Coordinate(20.0, 10.0), new Coordinate(20.0, 20.0), new Coordinate(10.0, 10.0)});
    LinearRing gwtHole = gwtFactory.createLinearRing(new Coordinate[] {new Coordinate(12.0, 12.0),
        new Coordinate(18.0, 12.0), new Coordinate(18.0, 18.0), new Coordinate(12.0, 12.0)});
    gwt = gwtFactory.createPolygon(gwtShell, new LinearRing[] {gwtHole});

    jtsFactory = new com.vividsolutions.jts.geom.GeometryFactory(new PrecisionModel(), SRID);
    com.vividsolutions.jts.geom.LinearRing jtsShell = jtsFactory
        .createLinearRing(new com.vividsolutions.jts.geom.Coordinate[] {
            new com.vividsolutions.jts.geom.Coordinate(10.0, 10.0),
            new com.vividsolutions.jts.geom.Coordinate(20.0, 10.0),
            new com.vividsolutions.jts.geom.Coordinate(20.0, 20.0),
View Full Code Here

Examples of com.vividsolutions.jts.geom.PrecisionModel

  public GwtPointTest() {
    gwtFactory = new GeometryFactory(SRID, PRECISION);
    gwt = gwtFactory.createPoint(new Coordinate(10.0, 10.0));
    empty = gwtFactory.createPoint(null);

    jtsFactory = new com.vividsolutions.jts.geom.GeometryFactory(new PrecisionModel(), SRID);
    jts = jtsFactory.createPoint(new com.vividsolutions.jts.geom.Coordinate(10.0, 10.0));
  }
View Full Code Here

Examples of com.vividsolutions.jts.geom.PrecisionModel

    gwtFactory = new GeometryFactory(SRID, PRECISION);
    gwt = gwtFactory.createLineString(new Coordinate[] {new Coordinate(10.0, 10.0), new Coordinate(20.0, 10.0),
        new Coordinate(20.0, 20.0)});
    empty = gwtFactory.createLineString(null);

    jtsFactory = new com.vividsolutions.jts.geom.GeometryFactory(new PrecisionModel(), SRID);
    jts = jtsFactory.createLineString(new com.vividsolutions.jts.geom.Coordinate[] {
        new com.vividsolutions.jts.geom.Coordinate(10.0, 10.0),
        new com.vividsolutions.jts.geom.Coordinate(20.0, 10.0),
        new com.vividsolutions.jts.geom.Coordinate(20.0, 20.0)});
  }
View Full Code Here

Examples of com.vividsolutions.jts.geom.PrecisionModel

        new Coordinate(20.0, 10.0), new Coordinate(20.0, 20.0), new Coordinate(10.0, 10.0) });
    LinearRing gwtHole = gwtFactory.createLinearRing(new Coordinate[] { new Coordinate(12.0, 12.0),
        new Coordinate(18.0, 12.0), new Coordinate(18.0, 18.0), new Coordinate(12.0, 12.0) });
    gwt = gwtFactory.createPolygon(gwtShell, new LinearRing[] { gwtHole });

    jtsFactory = new com.vividsolutions.jts.geom.GeometryFactory(new PrecisionModel(), SRID);
    com.vividsolutions.jts.geom.LinearRing jtsShell = jtsFactory
        .createLinearRing(new com.vividsolutions.jts.geom.Coordinate[] {
            new com.vividsolutions.jts.geom.Coordinate(10.0, 10.0),
            new com.vividsolutions.jts.geom.Coordinate(20.0, 10.0),
            new com.vividsolutions.jts.geom.Coordinate(20.0, 20.0),
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.