Search in sources :

Example 61 with AbstractRecordLayer

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

the class ModeAllPaged method recordUpdated.

@Override
protected void recordUpdated(final LayerRecord record) {
    Invoke.later(() -> {
        final Condition filter = getFilter();
        final AbstractRecordLayer layer = getLayer();
        if (layer.isNew(record)) {
            if (filter.test(record)) {
                addCachedRecord(record);
            } else {
                removeCachedRecord(record);
            }
        } else if (!filter.isEmpty()) {
            if (layer.isModified(record)) {
                if (filterTestModified(filter, record)) {
                    addCachedRecord(record);
                } else {
                    removeCachedRecord(record);
                }
            }
        }
    });
}
Also used : Condition(com.revolsys.record.query.Condition) AbstractRecordLayer(com.revolsys.swing.map.layer.record.AbstractRecordLayer)

Example 62 with AbstractRecordLayer

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

the class ModeAllPaged method exportRecords.

@Override
public void exportRecords(final Query query, final Object target) {
    final AbstractRecordLayer layer = getLayer();
    layer.exportRecords(query, target);
}
Also used : AbstractRecordLayer(com.revolsys.swing.map.layer.record.AbstractRecordLayer)

Example 63 with AbstractRecordLayer

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

the class ModeAllPaged method getRecordCount.

@Override
public int getRecordCount() {
    synchronized (this) {
        if (this.persistedRecordCount < 0) {
            if (this.recordCountWorker == null) {
                final long refreshIndex = getRefreshIndexNext();
                final AbstractRecordLayer layer = getLayer();
                this.recordCountWorker = Invoke.background("Query row count " + layer.getName(), this::getRecordCountPersisted, (rowCount) -> {
                    if (canRefreshFinish(refreshIndex)) {
                        this.persistedRecordCount = rowCount;
                        this.recordCountWorker = null;
                        fireTableDataChanged();
                    }
                });
            }
            return 0;
        } else {
            int count = super.getRecordCount();
            count += this.persistedRecordCount;
            return count;
        }
    }
}
Also used : AbstractRecordLayer(com.revolsys.swing.map.layer.record.AbstractRecordLayer) LruMap(com.revolsys.collection.map.LruMap) Icons(com.revolsys.swing.Icons) Condition(com.revolsys.record.query.Condition) Set(java.util.Set) Property(com.revolsys.util.Property) Icon(javax.swing.Icon) Record(com.revolsys.record.Record) Logs(com.revolsys.logging.Logs) Invoke(com.revolsys.swing.parallel.Invoke) Consumer(java.util.function.Consumer) List(java.util.List) LayerRecord(com.revolsys.swing.map.layer.record.LayerRecord) Predicates(com.revolsys.predicate.Predicates) Map(java.util.Map) SwingWorker(javax.swing.SwingWorker) Comparator(java.util.Comparator) Collections(java.util.Collections) LinkedHashSet(java.util.LinkedHashSet) Query(com.revolsys.record.query.Query) AbstractRecordLayer(com.revolsys.swing.map.layer.record.AbstractRecordLayer)

Example 64 with AbstractRecordLayer

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

the class EditRecordGeometryOverlay method addRecords.

private void addRecords(final List<LayerRecord> results, final LayerGroup group, final Geometry boundingBox) {
    final double scale = getViewportScale();
    final List<Layer> layers = group.getLayers();
    Collections.reverse(layers);
    for (final Layer layer : layers) {
        if (layer instanceof LayerGroup) {
            final LayerGroup childGroup = (LayerGroup) layer;
            addRecords(results, childGroup, boundingBox);
        } else if (layer instanceof AbstractRecordLayer) {
            final AbstractRecordLayer recordLayer = (AbstractRecordLayer) layer;
            if (recordLayer.isSelectable(scale)) {
                final List<LayerRecord> selectedRecords = recordLayer.getSelectedRecords();
                for (final LayerRecord selectedRecord : selectedRecords) {
                    final Geometry geometry = selectedRecord.getGeometry();
                    if (boundingBox.intersects(geometry)) {
                        results.add(selectedRecord);
                    }
                }
            }
        }
    }
}
Also used : Geometry(com.revolsys.geometry.model.Geometry) AbstractRecordLayer(com.revolsys.swing.map.layer.record.AbstractRecordLayer) List(java.util.List) ArrayList(java.util.ArrayList) LayerGroup(com.revolsys.swing.map.layer.LayerGroup) LayerRecord(com.revolsys.swing.map.layer.record.LayerRecord) ElevationModelLayer(com.revolsys.swing.map.layer.elevation.ElevationModelLayer) Layer(com.revolsys.swing.map.layer.Layer) AbstractRecordLayer(com.revolsys.swing.map.layer.record.AbstractRecordLayer) AbstractLayer(com.revolsys.swing.map.layer.AbstractLayer)

Example 65 with AbstractRecordLayer

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

the class EditRecordGeometryOverlay method modeEditGeometryVerticesMove.

protected boolean modeEditGeometryVerticesMove(final MouseEvent event) {
    if (canOverrideOverlayAction(ACTION_EDIT_GEOMETRY_VERTICES) || isOverlayAction(ACTION_MOVE_GEOMETRY)) {
        final double scale = getViewportScale();
        final List<CloseLocation> closeLocations = new ArrayList<>();
        final MapPanel map = getMap();
        for (final CloseLocation location : map.getCloseSelectedLocations()) {
            final AbstractRecordLayer layer = location.getLayer();
            if (layer.isEditable(scale)) {
                closeLocations.add(location);
            }
        }
        if (closeLocations.isEmpty()) {
            modeMoveGeometryClear();
            modeEditGeometryVerticesClear();
        } else if (event.isAltDown()) {
            setOverlayAction(ACTION_MOVE_GEOMETRY);
        } else {
            setOverlayAction(ACTION_EDIT_GEOMETRY_VERTICES);
        }
        return setMouseOverLocations(closeLocations);
    }
    return false;
}
Also used : CloseLocation(com.revolsys.swing.map.overlay.CloseLocation) MapPanel(com.revolsys.swing.map.MapPanel) ArrayList(java.util.ArrayList) AbstractRecordLayer(com.revolsys.swing.map.layer.record.AbstractRecordLayer)

Aggregations

AbstractRecordLayer (com.revolsys.swing.map.layer.record.AbstractRecordLayer)71 LayerRecord (com.revolsys.swing.map.layer.record.LayerRecord)35 Geometry (com.revolsys.geometry.model.Geometry)9 ArrayList (java.util.ArrayList)8 AbstractLayer (com.revolsys.swing.map.layer.AbstractLayer)7 Layer (com.revolsys.swing.map.layer.Layer)7 List (java.util.List)7 Record (com.revolsys.record.Record)6 Condition (com.revolsys.record.query.Condition)6 LayerGroup (com.revolsys.swing.map.layer.LayerGroup)6 CloseLocation (com.revolsys.swing.map.overlay.CloseLocation)4 Color (java.awt.Color)4 BoundingBox (com.revolsys.geometry.model.BoundingBox)3 Point (com.revolsys.geometry.model.Point)3 Field (com.revolsys.swing.field.Field)3 LayerRecordMenu (com.revolsys.swing.map.layer.record.LayerRecordMenu)3 WebColors (com.revolsys.awt.WebColors)2 GeometryFactory (com.revolsys.geometry.model.GeometryFactory)2 Identifier (com.revolsys.identifier.Identifier)2 FieldDefinition (com.revolsys.record.schema.FieldDefinition)2