Examples of Geometry


Examples of com.vividsolutions.jts.geom.Geometry

    Assert.assertEquals(4.0, coordinate.y, DELTA);
  }

  @Test
  public void testCreateCircle() throws Exception {
    Geometry geometry;
    GeometryFactory factory = new GeometryFactory(new PrecisionModel(), 4326);
    Point point = factory.createPoint(new Coordinate(0, 0));
    Point inside = factory.createPoint(new Coordinate(9.5, 0));
    Point insideFine = factory.createPoint(new Coordinate(6.8, 6.8));
    Point outsideAll = factory.createPoint(new Coordinate(9, 5));

    geometry = geoService.createCircle(point, 10, 4);
    Assert.assertEquals(5, geometry.getCoordinates().length);
    Assert.assertTrue(geometry.contains(inside));
    Assert.assertFalse(geometry.contains(insideFine));
    Assert.assertFalse(geometry.contains(outsideAll));

    geometry = geoService.createCircle(point, 10, 16);
    Assert.assertEquals(17, geometry.getCoordinates().length);
    Assert.assertTrue(geometry.contains(inside));
    Assert.assertTrue(geometry.contains(insideFine));
    Assert.assertFalse(geometry.contains(outsideAll));
  }
View Full Code Here

Examples of com.vividsolutions.jts.geom.Geometry

    Assert.assertFalse(geometry.contains(outsideAll));
  }

  @Test
  public void transformGeometryString() throws Exception {
    Geometry geometry = getLineString();

    Assert.assertEquals(geometry, geoService.transform(geometry, LONLAT, LONLAT));

    geometry = geoService.transform(geometry, LONLAT, LAMBERT72);
    assertTransformedLineString(geometry);
View Full Code Here

Examples of com.vividsolutions.jts.geom.Geometry

    assertTransformedLineString(geometry);
  }

  @Test
  public void transformGeometryCrs() throws Exception {
    Geometry geometry = getLineString();
    Crs source = geoService.getCrs2(LONLAT);
    Crs target = geoService.getCrs2(LAMBERT72);

    Assert.assertEquals(geometry, geoService.transform(geometry, source, source));
View Full Code Here

Examples of com.vividsolutions.jts.geom.Geometry

    assertTransformedLineString(geometry);
  }

  @Test
  public void transformGeometryCrsTransform() throws Exception {
    Geometry geometry = getLineString();
    CrsTransform transform = geoService.getCrsTransform(LONLAT, LAMBERT72);
    geometry = geoService.transform(geometry, transform);
    assertTransformedLineString(geometry);
  }
View Full Code Here

Examples of com.vividsolutions.jts.geom.Geometry

    assertTransformedLineString(geometry);
  }

  @Test
  public void transformGeometryJtsCrs() throws Exception {
    Geometry geometry = getLineString();
    CoordinateReferenceSystem source = CRS.decode(LONLAT);
    CoordinateReferenceSystem target = CRS.decode(LAMBERT72);

    Assert.assertEquals(geometry, geoService.transform(geometry, source, source));
View Full Code Here

Examples of com.vividsolutions.jts.geom.Geometry

  public void transformGeometryEmptyResultOnException() throws Exception {
    GeometryFactory geometryFactory = new GeometryFactory();
    WKTReader reader = new WKTReader( geometryFactory );
   
    Point point = (Point) reader.read("POINT (1 1)");
    Geometry geometry = geoService.transform(point, new ThrowingTransform());
    Assert.assertEquals(Point.class, geometry.getClass());
    Assert.assertTrue(geometry.isEmpty());
   
    LineString lineString = (LineString) reader.read("LINESTRING (0 1,1 1)");
    geometry = geoService.transform(lineString, new ThrowingTransform());
    Assert.assertEquals(LineString.class, geometry.getClass());
    Assert.assertTrue(geometry.isEmpty());
   
    Polygon polygon = (Polygon) reader.read("POLYGON ((0 0,1 1,0 1,0 0))");
    geometry = geoService.transform(polygon, new ThrowingTransform());
    Assert.assertEquals(Polygon.class, geometry.getClass());
    Assert.assertTrue(geometry.isEmpty());

    MultiPoint multipoint = (MultiPoint) reader.read("MULTIPOINT ((1 1),(2 1))");
    geometry = geoService.transform(multipoint, new ThrowingTransform());
    Assert.assertEquals(MultiPoint.class, geometry.getClass());
    Assert.assertTrue(geometry.isEmpty());
   
    MultiLineString multilineString = (MultiLineString) reader.read("MULTILINESTRING ((0 1,1 1),(0 2,2 2))");
    geometry = geoService.transform(multilineString, new ThrowingTransform());
    Assert.assertEquals(MultiLineString.class, geometry.getClass());
    Assert.assertTrue(geometry.isEmpty());
   
    MultiPolygon multipolygon = (MultiPolygon) reader.read("MULTIPOLYGON (((0 0,1 1,0 1,0 0)),((0 0,2 2,0 2,0 0)))");
    geometry = geoService.transform(multipolygon, new ThrowingTransform());
    Assert.assertEquals(MultiPolygon.class, geometry.getClass());
    Assert.assertTrue(geometry.isEmpty());
   
    Geometry collection = (GeometryCollection) reader.read("GEOMETRYCOLLECTION(POINT(4 6),LINESTRING(4 6,7 10)) ");
    geometry = geoService.transform(collection, new ThrowingTransform());
    Assert.assertEquals(GeometryCollection.class, geometry.getClass());
    Assert.assertTrue(geometry.isEmpty());
  }
View Full Code Here

Examples of com.vividsolutions.jts.geom.Geometry

    Assert.assertTrue(geometry.isEmpty());
  }

  @Test
  public void transformGeometryCrsNoTransform() throws Exception {
    Geometry geometry = getLineString();
    CrsTransform transform = geoService.getCrsTransform(LONLAT, LONLAT);
    geometry = geoService.transform(geometry, transform);
    Coordinate[] coordinates = geometry.getCoordinates();
    Assert.assertEquals(4, coordinates.length);
    Assert.assertEquals(5, coordinates[0].x, DELTA);
    Assert.assertEquals(4, coordinates[0].y, DELTA);
    Assert.assertEquals(30, coordinates[1].x, DELTA);
    Assert.assertEquals(10, coordinates[1].y, DELTA);
View Full Code Here

Examples of de.ailis.jollada.model.Geometry

    @Test
    public void testDefaultConstructor()
    {
        final Vertices vertices = new Vertices("ID");
        final Mesh mesh = new Mesh(vertices);
        final Geometry geometry = new Geometry(mesh);
        assertNull(geometry.getId());
        assertNull(geometry.getAsset());
        assertNull(geometry.getName());
        assertSame(mesh, geometry.getGeometric());
    }
View Full Code Here

Examples of gov.nasa.worldwind.render.airspaces.Geometry

    @Override
    protected void doDrawOutline(DrawContext dc)
    {
        for (int i = 0; i < getFaceCount(); i++)
        {
            Geometry mesh = this.getCurrentShapeData().getMesh(i);

            // set to draw using GL_LINES
            mesh.setMode(Geometry.ELEMENT, GL.GL_LINES);

            // set up MODELVIEW matrix to properly position, orient and scale this shape
            setModelViewMatrix(dc);

            this.drawGeometry(dc, this.getCurrentShapeData(), i);

            // return render mode to GL_TRIANGLE
            mesh.setMode(Geometry.ELEMENT, GL.GL_TRIANGLES);
        }
    }
View Full Code Here

Examples of javax.media.j3d.Geometry

    // Allow background color and texture to change
    backgroundAppearance.setCapability(Appearance.ALLOW_TEXTURE_WRITE);
    backgroundAppearance.setCapability(Appearance.ALLOW_COLORING_ATTRIBUTES_READ);
    backgroundColoringAttributes.setCapability(ColoringAttributes.ALLOW_COLOR_WRITE);
   
    Geometry halfSphereGeometry = createHalfSphereGeometry();  
    final Shape3D halfSphere = new Shape3D(halfSphereGeometry, backgroundAppearance);
    BranchGroup backgroundBranch = new BranchGroup();
    backgroundBranch.addChild(halfSphere);
   
    final Background background = new Background(backgroundBranch);
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.