Search in sources :

Example 41 with LayerRecord

use of com.revolsys.swing.map.layer.record.LayerRecord in project com.revolsys.open by revolsys.

the class RecordStoreLayerTest method assertGetRecords.

private List<LayerRecord> assertGetRecords(final Query query, final int expectedRecordCount) {
    final List<LayerRecord> records = this.layer.getRecords(query);
    Assert.assertEquals("Size", expectedRecordCount, records.size());
    final int actualRecordCount = this.layer.getRecordCount(query);
    Assert.assertEquals("Count", expectedRecordCount, actualRecordCount);
    return records;
}
Also used : NewProxyLayerRecord(com.revolsys.swing.map.layer.record.NewProxyLayerRecord) IdentifierProxyLayerRecord(com.revolsys.swing.map.layer.record.IdentifierProxyLayerRecord) LayerRecord(com.revolsys.swing.map.layer.record.LayerRecord) Point(com.revolsys.geometry.model.Point)

Example 42 with LayerRecord

use of com.revolsys.swing.map.layer.record.LayerRecord in project com.revolsys.open by revolsys.

the class RecordStoreLayerTest method testFilterRecordModifiedMatches.

@Test
public void testFilterRecordModifiedMatches() {
    final LayerRecord testRecord = testNewRecord();
    this.layer.saveChanges();
    assertRecordCounts(0, 1, 0, 0);
    testRecord.setValue("NAME", CHANGED_NAME);
    assertRecordState(testRecord, RecordState.MODIFIED);
    assertRecordCounts(0, 1, 1, 0);
    assertGetRecords(new Query(TEST).and(Q.equal("NAME", CHANGED_NAME)), 1);
    assertGetRecords(new Query(TEST).and(Q.equal("NAME", DEFAULT_NAME)), 0);
}
Also used : Query(com.revolsys.record.query.Query) NewProxyLayerRecord(com.revolsys.swing.map.layer.record.NewProxyLayerRecord) IdentifierProxyLayerRecord(com.revolsys.swing.map.layer.record.IdentifierProxyLayerRecord) LayerRecord(com.revolsys.swing.map.layer.record.LayerRecord) Test(org.junit.Test)

Example 43 with LayerRecord

use of com.revolsys.swing.map.layer.record.LayerRecord in project com.revolsys.open by revolsys.

the class RecordStoreLayerTest method testNewRecord.

private LayerRecord testNewRecord() {
    assertRecordCounts(0, 0, 0, 0);
    final LayerRecord testRecord = newTestRecord(DEFAULT_NAME, 10, GEOMETRY_FACTORY.point(12222000.001, 467000.999));
    assertRecordState(testRecord, RecordState.NEW);
    assertRecordCounts(1, 0, 0, 0);
    final List<LayerRecord> records = assertGetRecords(1);
    final LayerRecord actualRecord = assertRecordAtIndex(1, records, 0, testRecord, NewProxyLayerRecord.class);
    assertRecordState(actualRecord, RecordState.NEW);
    Assert.assertTrue("Has Changes", this.layer.isHasChanges());
    return testRecord;
}
Also used : NewProxyLayerRecord(com.revolsys.swing.map.layer.record.NewProxyLayerRecord) IdentifierProxyLayerRecord(com.revolsys.swing.map.layer.record.IdentifierProxyLayerRecord) LayerRecord(com.revolsys.swing.map.layer.record.LayerRecord)

Example 44 with LayerRecord

use of com.revolsys.swing.map.layer.record.LayerRecord in project com.revolsys.open by revolsys.

the class LayerFormRecordPropertyEnableCheck method isEnabled.

@Override
public boolean isEnabled() {
    final LayerRecord record = getRecord();
    final Object value = Property.getSimple(record, this.propertyName);
    final boolean equal = DataType.equal(value, this.value);
    if (equal == !this.inverse) {
        return enabled();
    } else {
        return disabled();
    }
}
Also used : LayerRecord(com.revolsys.swing.map.layer.record.LayerRecord)

Example 45 with LayerRecord

use of com.revolsys.swing.map.layer.record.LayerRecord in project com.revolsys.open by revolsys.

the class GeoNamesBoundingBoxLayerWorker method handleBackground.

@Override
protected List<LayerRecord> handleBackground() {
    BoundingBox boundingBox = this.boundingBox;
    GeometryFactory geometryFactory = this.geometryFactory;
    final CoordinateSystem coordinateSystem = geometryFactory.getCoordinateSystem();
    if (coordinateSystem instanceof ProjectedCoordinateSystem) {
        final ProjectedCoordinateSystem projCs = (ProjectedCoordinateSystem) coordinateSystem;
        final GeographicCoordinateSystem geoCs = projCs.getGeographicCoordinateSystem();
        geometryFactory = geoCs.getGeometryFactory();
        boundingBox = boundingBox.convert(geometryFactory);
    }
    final List<LayerRecord> results = (List) this.geoNamesService.getNames(boundingBox);
    for (final Record record : results) {
        final String name = record.getValue("name");
        final Point point = record.getGeometry();
        final String text = "<html><b>" + name + "</b><br /></html>";
    // if (viewport instanceof ComponentViewport2D) {
    // final ComponentViewport2D componentViewport =
    // (ComponentViewport2D)viewport;
    // componentViewport.addHotSpot(geometryFactory, point, text, null);
    // }
    }
    return results;
}
Also used : GeometryFactory(com.revolsys.geometry.model.GeometryFactory) ProjectedCoordinateSystem(com.revolsys.geometry.cs.ProjectedCoordinateSystem) CoordinateSystem(com.revolsys.geometry.cs.CoordinateSystem) GeographicCoordinateSystem(com.revolsys.geometry.cs.GeographicCoordinateSystem) BoundingBox(com.revolsys.geometry.model.BoundingBox) ProjectedCoordinateSystem(com.revolsys.geometry.cs.ProjectedCoordinateSystem) List(java.util.List) Record(com.revolsys.record.Record) LayerRecord(com.revolsys.swing.map.layer.record.LayerRecord) GeographicCoordinateSystem(com.revolsys.geometry.cs.GeographicCoordinateSystem) LayerRecord(com.revolsys.swing.map.layer.record.LayerRecord) Point(com.revolsys.geometry.model.Point)

Aggregations

LayerRecord (com.revolsys.swing.map.layer.record.LayerRecord)79 AbstractRecordLayer (com.revolsys.swing.map.layer.record.AbstractRecordLayer)34 Geometry (com.revolsys.geometry.model.Geometry)15 IdentifierProxyLayerRecord (com.revolsys.swing.map.layer.record.IdentifierProxyLayerRecord)15 NewProxyLayerRecord (com.revolsys.swing.map.layer.record.NewProxyLayerRecord)15 BoundingBox (com.revolsys.geometry.model.BoundingBox)11 Record (com.revolsys.record.Record)11 ArrayList (java.util.ArrayList)11 List (java.util.List)10 Test (org.junit.Test)10 GeometryFactory (com.revolsys.geometry.model.GeometryFactory)7 Point (com.revolsys.geometry.model.Point)6 Condition (com.revolsys.record.query.Condition)4 LayerRecordMenu (com.revolsys.swing.map.layer.record.LayerRecordMenu)4 CloseLocation (com.revolsys.swing.map.overlay.CloseLocation)4 RecordRowTable (com.revolsys.swing.table.record.RecordRowTable)4 LineString (com.revolsys.geometry.model.LineString)3 RecordDefinition (com.revolsys.record.schema.RecordDefinition)3 AbstractLayer (com.revolsys.swing.map.layer.AbstractLayer)3 Layer (com.revolsys.swing.map.layer.Layer)3