Examples of GeometryFactory


Examples of com.vividsolutions.jts.geom.GeometryFactory

    String key3 = "key3";
    String key4 = "key4";
    PipelineContext pipelineContext = new PipelineContextImpl();
    pipelineContext.put(key1, key1);
    pipelineContext.put(key3, key3);
    GeometryFactory geometryFactory = new GeometryFactory();
    pipelineContext.put(key4, new GeometryCollection(new Geometry[] {}, geometryFactory));

    // a context
    CacheContext cacheContext1 = cacheKeyService.getCacheContext(pipelineContext, new String[] {key1, key2, key4});
    Assert.assertEquals(key1, cacheContext1.get(key1));
View Full Code Here

Examples of com.vividsolutions.jts.geom.GeometryFactory

  public void testOtherContextImpl() {
    CacheContext context = new MyCacheContext();
    String cacheKey1 = cacheKeyService.getCacheKey(context);
    context.put("bla", "bla");
    String cacheKey2 = cacheKeyService.getCacheKey(context);
    GeometryFactory geometryFactory = new GeometryFactory();
    context.put("geom", new GeometryCollection(new Geometry[] {}, geometryFactory));
    String cacheKey3 = cacheKeyService.getCacheKey(context);
    System.out.println("keys " + cacheKey1 + " " + cacheKey2 + " " + cacheKey3);
    Assert.assertFalse(cacheKey1.equals(cacheKey2));
    Assert.assertFalse(cacheKey2.equals(cacheKey3));
View Full Code Here

Examples of com.vividsolutions.jts.geom.GeometryFactory

  @Qualifier("beans")
  private VectorLayer layer;

  @Before
  public void setupBeans() throws LayerException {
    GeometryFactory factory = new GeometryFactory(new PrecisionModel(PrecisionModel.FLOATING), 4329);
    LinearRing shell = factory.createLinearRing(new Coordinate[] { new Coordinate(0, 0), new Coordinate(1, 0),
        new Coordinate(1, 1), new Coordinate(0, 1), new Coordinate(0, 0), });
    Polygon p = factory.createPolygon(shell, null);
    MultiPolygon expected = factory.createMultiPolygon(new Polygon[] { p });
    CustomBean cb = new CustomBean();
    cb.setId(1);
    cb.setGeometry(expected);
    cb.setName("testbean");
    layer.saveOrUpdate(cb);
View Full Code Here

Examples of com.vividsolutions.jts.geom.GeometryFactory

    layer.saveOrUpdate(cb);
  }

  @Test
  public void readGeometry() throws LayerException {
    GeometryFactory factory = new GeometryFactory(new PrecisionModel(), 4326);
    LinearRing shell = factory.createLinearRing(new Coordinate[] { new Coordinate(0, 0), new Coordinate(1, 0),
        new Coordinate(1, 1), new Coordinate(0, 1), new Coordinate(0, 0), });
    Polygon p = factory.createPolygon(shell, null);
    MultiPolygon expected = factory.createMultiPolygon(new Polygon[] { p });
    Assert.assertTrue(((CustomBean) layer.read("1")).getGeometry().equalsExact(expected));
  }
View Full Code Here

Examples of com.vividsolutions.jts.geom.GeometryFactory

  }

  @Test
  public void readGeometry() throws LayerException {
    Object bean = layer.read("1");
    GeometryFactory factory = new GeometryFactory(new PrecisionModel(), 4326);
    LinearRing shell = factory.createLinearRing(new Coordinate[] { new Coordinate(0, 0), new Coordinate(1, 0),
        new Coordinate(1, 1), new Coordinate(0, 1), new Coordinate(0, 0), });
    Polygon p = factory.createPolygon(shell, null);
    MultiPolygon expected =factory.createMultiPolygon(new Polygon[]{p});
    Geometry g = layer.getFeatureModel().getGeometry(bean);
    Assert.assertTrue(expected.equalsExact(g, 0.00001));
  }
View Full Code Here

Examples of com.vividsolutions.jts.geom.GeometryFactory

    if (null == biggestGeometry) {
      // build Geometry which covers biggest possible area
      Envelope maxBounds = new Envelope(-Double.MAX_VALUE, Double.MAX_VALUE,
          -Double.MAX_VALUE, Double.MAX_VALUE);
      PrecisionModel precisionModel = new PrecisionModel(PrecisionModel.FLOATING);
      GeometryFactory geometryFactory = new GeometryFactory(precisionModel, 0);
      biggestGeometry = geometryFactory.toGeometry(maxBounds);
    }
    return biggestGeometry;
  }
View Full Code Here

Examples of com.vividsolutions.jts.geom.GeometryFactory

      for (CrsTransformInfo crsTransformInfo : crsTransformDefinitions.values()) {
        String key = getTransformKey(crsTransformInfo);
        transformCache.put(key, getCrsTransform(key, crsTransformInfo));
      }
    }
    GeometryFactory factory = new GeometryFactory();
    EMPTY_GEOMETRIES.put(Point.class, factory.createPoint((Coordinate) null));
    EMPTY_GEOMETRIES.put(LineString.class, factory.createLineString((Coordinate[]) null));
    EMPTY_GEOMETRIES.put(Polygon.class, factory.createPolygon(null, null));
    EMPTY_GEOMETRIES.put(MultiPoint.class, factory.createMultiPoint((Coordinate[]) null));
    EMPTY_GEOMETRIES.put(MultiLineString.class, factory.createMultiLineString((LineString[]) null)); // cast needed!
    EMPTY_GEOMETRIES.put(MultiPolygon.class, factory.createMultiPolygon((Polygon[]) null)); // cast needed!
    EMPTY_GEOMETRIES.put(Geometry.class, factory.createGeometryCollection(null));
  }
View Full Code Here

Examples of org.geomajas.gwt.client.spatial.geometry.GeometryFactory

  // Constructor:
  // -------------------------------------------------------------------------

  public PointDrawController(MapWidget mapWidget, AbstractFreeDrawingController parent) {
    super(mapWidget, parent);
    factory = new GeometryFactory(mapWidget.getMapModel().getSrid(), mapWidget.getMapModel().getPrecision());
    geometry = factory.createPoint(new Coordinate());
    drawStyle = new ShapeStyle("#FF7F00", 0.3f, "#FF7F00", 1, 2);
    symbolStyle = new SymbolInfo();
    CircleInfo c = new CircleInfo();
    symbolStyle.setCircle(c);
View Full Code Here

Examples of org.geomajas.gwt.client.spatial.geometry.GeometryFactory

  // Constructor:
  // -------------------------------------------------------------------------

  public PolygonDrawController(MapWidget mapWidget, AbstractFreeDrawingController parent) {
    super(mapWidget, parent);
    factory = new GeometryFactory(mapWidget.getMapModel().getSrid(), mapWidget.getMapModel().getPrecision());
    geometry = factory.createPolygon(null, null);
  }
View Full Code Here

Examples of org.geomajas.gwt.client.spatial.geometry.GeometryFactory

    IButton button3 = new IButton(I18nProvider.getSampleMessages().renderingDrawPolygon());
    button3.addClickHandler(new ClickHandler() {

      public void onClick(ClickEvent event) {
        map.getVectorContext().drawGroup(map.getGroup(RenderGroup.SCREEN), group2);
        GeometryFactory factory = map.getMapModel().getGeometryFactory();
        LinearRing shell = factory.createLinearRing(new Coordinate[] { new Coordinate(110, 10),
            new Coordinate(210, 10), new Coordinate(210, 110), new Coordinate(110, 110),
            new Coordinate(110, 10) });
        LinearRing hole = factory.createLinearRing(new Coordinate[] { new Coordinate(140, 40),
            new Coordinate(170, 40), new Coordinate(170, 70), new Coordinate(140, 70),
            new Coordinate(140, 40) });
        Polygon polygon = factory.createPolygon(shell, new LinearRing[] { hole });
        ShapeStyle style = new ShapeStyle("#9933EE", 0.5f, "#9900FF", 1, 2);
        map.getVectorContext().drawPolygon(group2, "Polygon", polygon, style);
      }
    });
    button3.setWidth100();
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.