Ejemplo n.º 1
0
 private void setFieldValueInIndex(int rowIndex, int fieldId, Value oldValue, Value value)
     throws DriverException {
   if (indexEditionManager != null) {
     try {
       for (DataSourceIndex index : indexEditionManager.getDataSourceIndexes()) {
         String[] idxFields = index.getFieldNames();
         if (idxFields.length == 1) {
           if (idxFields[0].equals(getMetadata().getFieldName(fieldId))) {
             index.setFieldValue(oldValue, value, rowIndex);
           }
         } else {
           Value[] oldSet = new Value[idxFields.length];
           Value[] newSet = new Value[idxFields.length];
           String fieldName = getFieldName(fieldId);
           for (int i = 0; i < idxFields.length; i++) {
             if (idxFields[i].equals(fieldName)) {
               oldSet[i] = oldValue;
               newSet[i] = value;
             } else {
               oldSet[i] = getFieldValue(rowIndex, getFieldIndexByName(idxFields[i]));
               newSet[i] = oldSet[i];
             }
           }
           index.setFieldValue(
               ValueFactory.createValue(oldSet), ValueFactory.createValue(newSet), rowIndex);
         }
       }
     } catch (IndexException e) {
       throw new DriverException(e);
     }
   }
 }
 private EXGeographicBoundingBox getGeographicBoundingBox(Envelope env, String epsgCode) {
   Envelope newEnvelope;
   if ("EPSG:4326".equals(epsgCode)) {
     newEnvelope = env;
   } else {
     try {
       GeometryFactory gf = new GeometryFactory();
       Polygon poly = (Polygon) gf.toGeometry(env);
       ST_Transform transformFunction = new ST_Transform();
       CoordinateReferenceSystem inputCRS = DataSourceFactory.getCRSFactory().getCRS(epsgCode);
       Value val =
           transformFunction.evaluate(
               null,
               ValueFactory.createValue(poly, inputCRS),
               ValueFactory.createValue("EPSG:4326"));
       newEnvelope = val.getAsGeometry().getEnvelopeInternal();
     } catch (FunctionException fe) {
       return getDummyGeographic();
     } catch (CRSException ex) {
       return getDummyGeographic();
     }
   }
   EXGeographicBoundingBox ret = new EXGeographicBoundingBox();
   ret.setEastBoundLongitude(newEnvelope.getMaxX());
   ret.setWestBoundLongitude(newEnvelope.getMinX());
   ret.setNorthBoundLatitude(newEnvelope.getMaxY());
   ret.setSouthBoundLatitude(newEnvelope.getMinY());
   return ret;
 }
Ejemplo n.º 3
0
 private void failedCommit(DataSource ds, IndexQuery query)
     throws DriverException, NonEditableDataSourceException {
   ds.deleteRow(2);
   ds.setFieldValue(0, 1, ValueFactory.createValue("nouveau"));
   Value[] row = ds.getRow(0);
   row[1] = ValueFactory.createValue("aaaaa");
   ds.insertFilledRow(row);
   Value[][] table = super.getDataSourceContents(ds);
   Iterator<Integer> it = ds.queryIndex(query);
   try {
     ReadDriver.failOnWrite = true;
     ds.commit();
     ds.close();
   } catch (DriverException e) {
     assertTrue(equals(table, super.getDataSourceContents(ds)));
     if (it != null) {
       assertTrue(ds.queryIndex(query) != null);
     } else {
       assertTrue(ds.queryIndex(query) == null);
     }
     ReadDriver.failOnWrite = false;
     ds.commit();
     ds.close();
   }
   ds.open();
   assertTrue(equals(table, super.getDataSourceContents(ds)));
   ds.close();
 }
Ejemplo n.º 4
0
 private void insertInIndex(Value[] values, int rowIndex) throws DriverException {
   if (indexEditionManager != null) {
     try {
       for (DataSourceIndex index : indexEditionManager.getDataSourceIndexes()) {
         Metadata metadata = getMetadata();
         String[] idxFields = index.getFieldNames();
         if (idxFields.length == 1) {
           for (int i = 0; i < metadata.getFieldCount(); i++) {
             if (metadata.getFieldName(i).equals(idxFields[0])) {
               index.insertRow(values[i], rowIndex);
             }
           }
         } else {
           Value[] toInsert = new Value[idxFields.length];
           for (int i = 0; i < metadata.getFieldCount(); i++) {
             for (int j = 0; j < idxFields.length; j++) {
               if (metadata.getFieldName(i).equals(idxFields[j])) {
                 toInsert[j] = values[i];
               }
             }
             index.insertRow(ValueFactory.createValue(values), rowIndex);
           }
         }
       }
     } catch (IndexException e) {
       throw new DriverException("Cannot update index", e);
     }
   }
 }
Ejemplo n.º 5
0
 private void deleteInIndex(int rowIndex) throws DriverException {
   if (indexEditionManager != null) {
     try {
       for (DataSourceIndex index : indexEditionManager.getDataSourceIndexes()) {
         Metadata metadata = getMetadata();
         String[] idxFields = index.getFieldNames();
         if (idxFields.length == 1) {
           for (int i = 0; i < metadata.getFieldCount(); i++) {
             if (metadata.getFieldName(i).equals(idxFields[0])) {
               Value v = getFieldValue(rowIndex, i);
               index.deleteRow(v, rowIndex);
             }
           }
         } else {
           Value[] toInsert = new Value[idxFields.length];
           for (int i = 0; i < metadata.getFieldCount(); i++) {
             for (int j = 0; j < idxFields.length; j++) {
               if (metadata.getFieldName(i).equals(idxFields[j])) {
                 toInsert[j] = getFieldValue(rowIndex, i);
               }
             }
             index.deleteRow(ValueFactory.createValue(toInsert), rowIndex);
           }
         }
       }
     } catch (IndexException e) {
       throw new DriverException(e);
     }
   }
 }
Ejemplo n.º 6
0
 @Override
 public Value evaluate(DataSourceFactory dsf, Value... args) throws FunctionException {
   if (args[0].isNull()) {
     return ValueFactory.createNullValue();
   } else {
     return ValueFactory.createValue(Math.atan(args[0].getAsDouble()));
   }
 }
Ejemplo n.º 7
0
 @Override
 public Value evaluate(DataSourceFactory dsf, Value[] args) throws FunctionException {
   if (args[0].isNull()) {
     return ValueFactory.createNullValue();
   } else {
     final Geometry geom = args[0].getAsGeometry();
     return ValueFactory.createValue(GeometryConvert.toMultiPoint(geom));
   }
 }
Ejemplo n.º 8
0
  @Override
  public Value evaluateResult(DataSourceFactory dsf, Value[] args) throws FunctionException {
    Geometry value = args[0].getAsGeometry();
    if (value instanceof Point) {
      final Point geometry = (Point) args[0].getAsGeometry();
      double y = geometry.getCoordinate().y;
      return ValueFactory.createValue(y);

    } else {
      return ValueFactory.createNullValue();
    }
  }
Ejemplo n.º 9
0
  public void setUp() throws Exception {
    byte[] rasterData = new byte[4];
    RasterMetadata rasterMetadata = new RasterMetadata(0, 0, 1, 1, 2, 2);
    GeoRaster gr = GeoRasterFactory.createGeoRaster(rasterData, rasterMetadata);

    dsf = new DataSourceFactory();
    dsf.setTempDir("src/test/resources/backup");
    DefaultMetadata metadata =
        new DefaultMetadata(
            new Type[] {TypeFactory.createType(Type.RASTER)}, new String[] {"raster"});
    ObjectMemoryDriver omd = new ObjectMemoryDriver(metadata);
    omd.addValues(new Value[] {ValueFactory.createValue(gr)});
    dsf.getSourceManager().register("raster", omd);
  }
Ejemplo n.º 10
0
  @Override
  public Value evaluate(DataSourceFactory dsf, Value[] args) throws FunctionException {

    Geometry g = args[0].getAsGeometry();

    if (g instanceof Polygon) {
      Polygon polygon = (Polygon) g;
      LineString ring = polygon.getInteriorRingN(args[1].getAsInt());
      if (ring != null) {
        return ValueFactory.createValue(ring);
      }
    }
    return ValueFactory.createNullValue();
  }
Ejemplo n.º 11
0
 @Test
 public void testEditionWithFieldAdded() throws Exception {
   sm.register("toto", getTempCopyOf(super.getAnyNonSpatialResource()));
   DataSource d = dsf.getDataSource("toto", DataSourceFactory.EDITABLE);
   d.open();
   d.addField("extra", TypeFactory.createType(Type.STRING));
   int fi = d.getFieldIndexByName("extra");
   new UndoRedoTest().testAlphanumericEditionUndoRedo(d);
   Value newValue = ValueFactory.createValue("hi");
   d.setFieldValue(0, fi, newValue);
   d.undo();
   d.redo();
   d.commit();
   d.close();
   d.open();
   assertTrue(equals(d.getFieldValue(0, d.getFieldIndexByName("extra")), newValue));
   d.close();
 }
Ejemplo n.º 12
0
  @Override
  protected void polygonDone(com.vividsolutions.jts.geom.Polygon pol, MapContext mc, ToolManager tm)
      throws TransitionException {
    Geometry g = pol;
    if (ToolUtilities.geometryTypeIs(mc, GeometryConstraint.MULTI_POLYGON)) {
      g = ToolManager.toolsGeometryFactory.createMultiPolygon(new Polygon[] {pol});
    }

    SpatialDataSourceDecorator sds = mc.getActiveLayer().getDataSource();
    try {
      Value[] row = new Value[sds.getMetadata().getFieldCount()];
      row[sds.getSpatialFieldIndex()] = ValueFactory.createValue(g);
      row = ToolUtilities.populateNotNullFields(sds, row);
      sds.insertFilledRow(row);
    } catch (DriverException e) {
      throw new TransitionException("Cannot insert polygon", e);
    }
  }
Ejemplo n.º 13
0
 @Override
 public String getFromLower(Double d) {
   if (d == null) {
     throw new NullPointerException("The input threshold must not be null");
   }
   if (parameter instanceof StringLiteral) {
     return ((StringLiteral) parameter).getValue(null);
   } else {
     String col = get(d);
     if (col == null) {
       Categorize2String c2s = (Categorize2String) parameter;
       Map<String, Value> inp = new HashMap<String, Value>();
       inp.put(getField(), ValueFactory.createValue(d));
       return c2s.getValue(inp);
     } else {
       return col;
     }
   }
 }
Ejemplo n.º 14
0
  @Test
  public void testFieldInsertionEditionWhileEdition() throws Exception {
    sm.register("toto", getTempCopyOf(super.getAnyNonSpatialResource()));
    DataSource d = dsf.getDataSource("toto");
    d.open();
    String nouveau = "nouveau";
    Value newValue = ValueFactory.createValue(nouveau);
    Value testValue = d.getFieldValue(2, 1);
    int lastField = d.getMetadata().getFieldCount();
    d.deleteRow(0);
    d.setFieldValue(0, 1, d.getFieldValue(1, 1));
    d.addField(nouveau, TypeFactory.createType(Type.STRING));
    d.setFieldValue(0, lastField, newValue);
    assertTrue(equals(d.getFieldValue(0, lastField), newValue));
    d.commit();
    d.close();

    d.open();
    assertEquals(d.getMetadata().getFieldName(lastField).toLowerCase(), nouveau);
    assertTrue(equals(d.getFieldValue(0, lastField), newValue));
    assertTrue(equals(d.getFieldValue(0, 1), testValue));
    d.close();
  }
Ejemplo n.º 15
0
  protected Value testSpatialFunction(
      ScalarFunction function, int[] valueType, int parameterCount, Value... normalValue)
      throws Exception {
    // Test null input
    ColumnValue[] vals = new ColumnValue[parameterCount];
    for (int i = 0; i < parameterCount; i++) {
      vals[i] = new ColumnValue(valueType[i], ValueFactory.createNullValue());
    }
    Value res = evaluate(function, vals);
    assertTrue(res.isNull());

    // Test too many parameters
    Value[] args = new Value[parameterCount + 1];
    for (int i = 0; i < args.length; i++) {
      args[i] = normalValue[0];
    }
    try {
      res = evaluate(function, args);
      fail();
    } catch (IncompatibleTypesException e) {
    }

    // Test wrong parameter type
    try {
      args = new Value[parameterCount];
      for (int i = 0; i < args.length; i++) {
        args[i] = ValueFactory.createValue(new Value[0]);
      }
      res = evaluate(function, args);
      fail();
    } catch (IncompatibleTypesException e) {
    }

    // Test normal input value and type
    res = evaluate(function, normalValue);
    return res;
  }
Ejemplo n.º 16
0
  @Before
  public void setUp() throws Exception {
    super.setUpTestsWithoutEdition();
    wktReader = new WKTReader();
    JTSMultiPolygon2D = wktReader.read("MULTIPOLYGON (((0 0, 1 1, 0 1, 0 0)))");
    JTSMultiLineString2D = wktReader.read("MULTILINESTRING ((0 0, 1 1, 0 1, 0 0))");
    JTSMultiPoint2D = wktReader.read("MULTIPOINT (0 0, 1 1, 0 1, 0 0)");
    JTSPolygon2D =
        wktReader.read(
            "POLYGON ((181 124, 87 162, 76 256, 166 315, 286 325, 373 255, 387 213, 377 159, 351 121, 298 101, 234 56, 181 124), (165 244, 227 219, 234 300, 168 288, 165 244), (244 130, 305 135, 324 186, 306 210, 272 206, 206 174, 244 130))");

    JTSLineString2D = wktReader.read("LINESTRING (1 1, 2 1, 2 2, 1 2, 1 1)");
    JTSLineString3D = wktReader.read("LINESTRING (1 1 1, 2 1 2, 2 2 3, 1 2 4, 1 1 5)");
    JTSPoint3D = wktReader.read("POINT(0 10 20)");
    JTSPoint2D = wktReader.read("POINT(0 10)");

    JTSPolygonWith2Holes =
        wktReader.read(
            "POLYGON ((85 55, 85 306, 366 306, 366 55, 85 55), (153 205, 212 173, 241 190, 251 253, 235 278, 147 254, 153 205), (262 88, 321 97, 324 153, 303 177, 240 138, 262 88))");

    GeometryFactory gf = new GeometryFactory();
    JTSGeometryCollection =
        gf.createGeometryCollection(
            new Geometry[] {JTSMultiPolygon2D, JTSMultiLineString2D, JTSPolygon2D});
    JTS3DCollection =
        gf.createGeometryCollection(new Geometry[] {JTSMultiPolygon2D, JTSLineString3D});

    // first datasource
    final MemoryDataSetDriver driver1 =
        new MemoryDataSetDriver(
            new String[] {"pk", "geom"},
            new Type[] {
              TypeFactory.createType(Type.INT, new PrimaryKeyConstraint()),
              TypeFactory.createType(Type.GEOMETRY)
            });

    // insert all filled rows...
    driver1.addValues(
        new Value[] {ValueFactory.createValue(1), ValueFactory.createValue(JTSMultiPolygon2D)});
    driver1.addValues(
        new Value[] {ValueFactory.createValue(2), ValueFactory.createValue(JTSMultiLineString2D)});
    driver1.addValues(
        new Value[] {ValueFactory.createValue(3), ValueFactory.createValue(JTSLineString2D)});
    driver1.addValues(
        new Value[] {ValueFactory.createValue(4), ValueFactory.createValue(JTSPolygon2D)});
    // and register this new driver...

    dsf.getSourceManager().register("ds1", driver1);

    // second datasource
    final MemoryDataSetDriver driver2 =
        new MemoryDataSetDriver(
            new String[] {"pk", "geom"},
            new Type[] {
              TypeFactory.createType(Type.INT, new PrimaryKeyConstraint()),
              TypeFactory.createType(Type.GEOMETRY)
            });

    driver1.addValues(
        new Value[] {ValueFactory.createValue(1), ValueFactory.createValue(JTSMultiPolygon2D)});
    // and register this new driver...
    dsf.getSourceManager().register("ds2", driver2);
  }
Ejemplo n.º 17
0
 protected Value testSpatialFunction(
     ScalarFunction function, Geometry normalValue, int parameterCount) throws Exception {
   return testSpatialFunction(
       function, new int[] {Type.GEOMETRY}, parameterCount, ValueFactory.createValue(normalValue));
 }
Ejemplo n.º 18
0
  @Override
  public void actionPerformed(ActionEvent e) {
    if ("modify".equals(e.getActionCommand())) {
      try {
        File globals = new File(configPath);

        // Table creation
        GdmsWriter globalsGW = new GdmsWriter(globals);
        String[] fieldNames1 = {
          "bufferSize",
          "amenitiesWeighting",
          "constructibilityWeighting",
          "idealhousingWeighting",
          "gaussDeviation",
          "segregationThreshold",
          "segregationTolerance",
          "householdMemory",
          "movingThreshold",
          "immigrantNumber",
          "numberOfTurns",
          "year",
          "threshold_1",
          "threshold_2",
          "threshold_3",
          "threshold_4"
        };

        org.gdms.data.types.Type integ = TypeFactory.createType(64);
        org.gdms.data.types.Type doubl = TypeFactory.createType(16);
        org.gdms.data.types.Type[] fieldTypes1 = {
          doubl, doubl, doubl, doubl, doubl, doubl, doubl, integ, doubl, integ, integ, integ, doubl,
          doubl, doubl, doubl
        };
        Metadata m1 = new DefaultMetadata(fieldTypes1, fieldNames1);
        globalsGW.writeMetadata(0, m1);

        // Table filling
        Map<String, JSpinner> sp = spp.getSpinners();
        Double hM = (Double) sp.get("householdMemory").getValue();
        Integer hMi = hM.intValue();
        Double iN = (Double) sp.get("immigrantNumber").getValue();
        Integer iNi = iN.intValue();
        Double nOT = (Double) sp.get("numberOfTurns").getValue();
        Integer nOTi = nOT.intValue();
        Double y = (Double) sp.get("year").getValue();
        Integer yi = y.intValue();
        globalsGW.addValues(
            new Value[] {
              ValueFactory.createValue((Double) sp.get("bufferSize").getValue()),
              ValueFactory.createValue((Double) sp.get("amenitiesWeighting").getValue()),
              ValueFactory.createValue((Double) sp.get("constructibilityWeighting").getValue()),
              ValueFactory.createValue((Double) sp.get("idealhousingWeighting").getValue()),
              ValueFactory.createValue((Double) sp.get("gaussDeviation").getValue()),
              ValueFactory.createValue((Double) sp.get("segregationThreshold").getValue()),
              ValueFactory.createValue((Double) sp.get("segregationTolerance").getValue()),
              ValueFactory.createValue(hMi),
              ValueFactory.createValue((Double) sp.get("movingThreshold").getValue()),
              ValueFactory.createValue(iNi),
              ValueFactory.createValue(nOTi),
              ValueFactory.createValue(yi),
              ValueFactory.createValue((Double) sp.get("threshold_1").getValue()),
              ValueFactory.createValue((Double) sp.get("threshold_2").getValue()),
              ValueFactory.createValue((Double) sp.get("threshold_3").getValue()),
              ValueFactory.createValue((Double) sp.get("threshold_4").getValue()),
            });

        // Table closing
        globalsGW.writeRowIndexes();
        globalsGW.writeExtent();
        globalsGW.writeWritenRowCount();
        globalsGW.close();

        try {
          if (spp.getSelections().get("statistical").isSelected()) {
            new LaunchFrame(configPath, "statistical");
          } else if (spp.getSelections().get("schelling").isSelected()) {
            new LaunchFrame(configPath, "schelling");
          }
        } catch (DriverException ex) {
          Services.getErrorManager().error("Driver Exception", ex);
          JOptionPane.showMessageDialog(
              this, "Some driver error has occurred.", "Driver Error", JOptionPane.WARNING_MESSAGE);
          return;
        } catch (DataSourceCreationException ex) {
          Services.getErrorManager().error("DataSourceCreation Exception", ex);
          JOptionPane.showMessageDialog(
              this,
              "Some DataSource creation error has occurred.",
              "DataSource Creation Error",
              JOptionPane.WARNING_MESSAGE);
          return;
        }
        dispose();
      } catch (IOException ex) {
        Services.getErrorManager().error("I/O Exception", ex);
        JOptionPane.showMessageDialog(
            this, "Some I/O error has occurred.", "I/O Error", JOptionPane.WARNING_MESSAGE);
        return;
      } catch (DriverException ex) {
        Services.getErrorManager().error("Driver Exception", ex);
        JOptionPane.showMessageDialog(
            this, "Some driver error has occurred.", "Driver Error", JOptionPane.WARNING_MESSAGE);
        return;
      }

    } else {
      try {
        new LaunchFrame(configPath, oldChoice);
      } catch (DriverException ex) {
        Services.getErrorManager().error("Driver Exception", ex);
        JOptionPane.showMessageDialog(
            this, "Some driver error has occurred.", "Driver Error", JOptionPane.WARNING_MESSAGE);
        return;
      } catch (DataSourceCreationException ex) {
        Services.getErrorManager().error("DataSourceCreation Exception", ex);
        JOptionPane.showMessageDialog(
            this,
            "Some DataSource creation error has occurred.",
            "DataSource Creation Error",
            JOptionPane.WARNING_MESSAGE);
        return;
      }
      dispose();
    }
  }
Ejemplo n.º 19
0
 @Override
 public Value evaluateResult(DataSourceFactory dsf, Value[] args) throws FunctionException {
   return ValueFactory.createValue(args[0].getAsGeometry().getLength());
 }
Ejemplo n.º 20
0
 public Value getFieldValue(long rowIndex, int fieldId) throws DriverException {
   return ValueFactory.createValue(sum);
 }
Ejemplo n.º 21
0
 @Override
 public Value evaluateResult(DataSourceFactory dsf, Value[] args) throws FunctionException {
   final Geometry gv = args[0].getAsGeometry();
   return ValueFactory.createValue(gv.getArea());
 }
 @Test
 public void testAllGeters() throws Exception {
   AllTypesObjectDriver testD = new AllTypesObjectDriver();
   DataSet test = testD.getTable("main");
   DataSource d = dsf.getDataSource("alltypes");
   d.open();
   assertTrue(
       ValueFactory.createValue(d.getBinary(0, 0))
           .equals(test.getFieldValue(0, 0))
           .getAsBoolean());
   assertTrue(
       ValueFactory.createValue(d.getBinary(0, "binary"))
           .equals(test.getFieldValue(0, 0))
           .getAsBoolean());
   assertTrue(
       ValueFactory.createValue(d.getBoolean(0, 1))
           .equals(test.getFieldValue(0, 1))
           .getAsBoolean());
   assertTrue(
       ValueFactory.createValue(d.getBoolean(0, "boolean"))
           .equals(test.getFieldValue(0, 1))
           .getAsBoolean());
   assertTrue(
       ValueFactory.createValue(d.getByte(0, 2)).equals(test.getFieldValue(0, 2)).getAsBoolean());
   assertTrue(
       ValueFactory.createValue(d.getByte(0, "byte"))
           .equals(test.getFieldValue(0, 2))
           .getAsBoolean());
   assertTrue(
       ValueFactory.createValue(d.getDate(0, 3)).equals(test.getFieldValue(0, 3)).getAsBoolean());
   assertTrue(
       ValueFactory.createValue(d.getDate(0, "date"))
           .equals(test.getFieldValue(0, 3))
           .getAsBoolean());
   assertTrue(
       ValueFactory.createValue(d.getDouble(0, 4))
           .equals(test.getFieldValue(0, 4))
           .getAsBoolean());
   assertTrue(
       ValueFactory.createValue(d.getDouble(0, "double"))
           .equals(test.getFieldValue(0, 4))
           .getAsBoolean());
   assertTrue(
       ValueFactory.createValue(d.getFloat(0, 5)).equals(test.getFieldValue(0, 5)).getAsBoolean());
   assertTrue(
       ValueFactory.createValue(d.getFloat(0, "float"))
           .equals(test.getFieldValue(0, 5))
           .getAsBoolean());
   assertTrue(
       ValueFactory.createValue(d.getInt(0, 6)).equals(test.getFieldValue(0, 6)).getAsBoolean());
   assertTrue(
       ValueFactory.createValue(d.getInt(0, "int"))
           .equals(test.getFieldValue(0, 6))
           .getAsBoolean());
   assertTrue(
       ValueFactory.createValue(d.getLong(0, 7)).equals(test.getFieldValue(0, 7)).getAsBoolean());
   assertTrue(
       ValueFactory.createValue(d.getLong(0, "long"))
           .equals(test.getFieldValue(0, 7))
           .getAsBoolean());
   assertTrue(
       ValueFactory.createValue(d.getShort(0, 8)).equals(test.getFieldValue(0, 8)).getAsBoolean());
   assertTrue(
       ValueFactory.createValue(d.getShort(0, "short"))
           .equals(test.getFieldValue(0, 8))
           .getAsBoolean());
   assertTrue(
       ValueFactory.createValue(d.getString(0, 9))
           .equals(test.getFieldValue(0, 9))
           .getAsBoolean());
   assertTrue(
       ValueFactory.createValue(d.getString(0, "string"))
           .equals(test.getFieldValue(0, 9))
           .getAsBoolean());
   assertTrue(
       ValueFactory.createValue(d.getTimestamp(0, 10))
           .equals(test.getFieldValue(0, 10))
           .getAsBoolean());
   assertTrue(
       ValueFactory.createValue(d.getTimestamp(0, "timestamp"))
           .equals(test.getFieldValue(0, 10))
           .getAsBoolean());
   assertTrue(
       ValueFactory.createValue(d.getTime(0, 11))
           .equals(test.getFieldValue(0, 11))
           .getAsBoolean());
   assertTrue(
       ValueFactory.createValue(d.getTime(0, "time"))
           .equals(test.getFieldValue(0, 11))
           .getAsBoolean());
   d.close();
 }
Ejemplo n.º 23
0
 @Override
 public Value getAggregateResult() {
   return ValueFactory.createValue(UnaryUnionOp.union(toUnite), crs);
 }
Ejemplo n.º 24
0
 @Override
 protected Value evaluateResult(DataSourceFactory dsf, Value[] args) throws FunctionException {
   final Geometry g = args[0].getAsGeometry();
   final int n = args[1].getAsInt();
   return ValueFactory.createValue(g.getGeometryN(n), args[0].getCRS());
 }