Package org.gdbms.engine.spatial

Examples of org.gdbms.engine.spatial.Geometry


    gpx.moveTo(2433.98567845422, 177.104836185899);
    gpx.lineTo(2448.71148490583, 176.999651854102);
    gpx.lineTo(2449.44777522841, 152.70207120894);
    gpx.lineTo(2434.9323374404, 152.807255540738);
    gpx.closePath();
    Geometry g = GeometryFactory.createPolygon2D(gpx);

    d.beginTrans();
    int sfi = d.getSpatialFieldIndex();
    Value gid = ValueFactory.createValue(1);
    for (int i = 0; i < d.getRowCount(); i++) {
      if (((BooleanValue) gid.equals(d.getFieldValue(i, 0))).getValue()) {
        d.setFieldValue(i, sfi, g);
      }
    }
    d.commitTrans();

    d.start();
    Geometry g2 = null;
    for (int i = 0; i < d.getRowCount(); i++) {
      if (((BooleanValue) gid.equals(d.getFieldValue(i, 0))).getValue()) {
        g2 = (Geometry) d.getFieldValue(i, sfi);
      }
    }
    d.stop();

    assertTrue(g.getBounds2D().equals(g2.getBounds2D()));
  }
View Full Code Here


    d.beginTrans();
    GeneralPathX gpx = new GeneralPathX();
    gpx.moveTo(0, 0);
    gpx.lineTo(10, 10);
    gpx.lineTo(10, 15);
    Geometry geom = GeometryFactory.createPolyline2D(gpx);
    Value nv2 = ValueFactory.createValue(3.0);
    int n = 10000;
    for (int i = 0; i < n; i++) {
      d.insertEmptyRow();
      d.setFieldValue(d.getRowCount() - 1, 0, geom);
      d.setFieldValue(d.getRowCount() - 1, 1, nv2);
    }
    d.commitTrans();

    d = ds.getDataSource("big");
    d.start();
    assertTrue(d.getRowCount() == n);
    for (int i = 0; i < n; i++) {
      Geometry readGeom = (Geometry) d.getFieldValue(i, 0);
      assertTrue(readGeom.getGeometryType() == FShape.LINE);
      assertTrue(((BooleanValue) readGeom.equals(geom)).getValue());
      assertTrue(((BooleanValue) d.getFieldValue(i, 1).equals(nv2))
          .getValue());
    }
    d.stop();
  }
View Full Code Here

TOP

Related Classes of org.gdbms.engine.spatial.Geometry

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.