Search in sources :

Example 16 with AbstractRecordLayer

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

the class RecordLayerHighlightedListSelectionModel method removeSelectionInterval.

@Override
public void removeSelectionInterval(final int index0, final int index1) {
    super.removeSelectionInterval(convertRowIndexToModel(index0), convertRowIndexToModel(index1));
    final List<LayerRecord> records = getObjects(index0, index1);
    final AbstractRecordLayer layer = this.model.getLayer();
    layer.unHighlightRecords(records);
}
Also used : AbstractRecordLayer(com.revolsys.swing.map.layer.record.AbstractRecordLayer) LayerRecord(com.revolsys.swing.map.layer.record.LayerRecord)

Example 17 with AbstractRecordLayer

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

the class RecordLayerHighlightedListSelectionModel method isSelectedIndex.

@Override
public boolean isSelectedIndex(final int index) {
    final int rowIndex = convertRowIndexToModel(index);
    final LayerRecord record = this.model.getRecord(rowIndex);
    if (record != null) {
        final AbstractRecordLayer layer = this.model.getLayer();
        return layer.isHighlighted(record);
    }
    return false;
}
Also used : AbstractRecordLayer(com.revolsys.swing.map.layer.record.AbstractRecordLayer) LayerRecord(com.revolsys.swing.map.layer.record.LayerRecord)

Example 18 with AbstractRecordLayer

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

the class RecordLayerHighlightedListSelectionModel method setSelectionInterval.

@Override
public void setSelectionInterval(final int index0, final int index1) {
    final List<LayerRecord> records = getObjects(index0, index1);
    final AbstractRecordLayer layer = this.model.getLayer();
    layer.setHighlightedRecords(records);
    super.setSelectionInterval(convertRowIndexToModel(index0), convertRowIndexToModel(index1));
}
Also used : AbstractRecordLayer(com.revolsys.swing.map.layer.record.AbstractRecordLayer) LayerRecord(com.revolsys.swing.map.layer.record.LayerRecord)

Example 19 with AbstractRecordLayer

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

the class OsmProxyLayerRecord method getRecordProxied.

@Override
protected LayerRecord getRecordProxied() {
    final Identifier identifier = getIdentifier();
    final OsmElement record = this.document.getRecord(identifier);
    final AbstractRecordLayer layer = getLayer();
    return new ArrayLayerRecord(layer, record);
}
Also used : OsmElement(com.revolsys.record.io.format.openstreetmap.model.OsmElement) ArrayLayerRecord(com.revolsys.swing.map.layer.record.ArrayLayerRecord) Identifier(com.revolsys.identifier.Identifier) AbstractRecordLayer(com.revolsys.swing.map.layer.record.AbstractRecordLayer)

Example 20 with AbstractRecordLayer

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

the class AbstractOverlay method hasSnapPoint.

protected boolean hasSnapPoint() {
    this.snapPoint = null;
    this.snapEventX = MouseOverlay.getEventX();
    this.snapEventY = MouseOverlay.getEventY();
    this.snapCentre = MouseOverlay.getEventPoint();
    final double snapCentreX = this.snapCentre.getX();
    final double snapCentreY = this.snapCentre.getY();
    final double maxDistance = this.viewport.getHotspotMapUnits();
    final BoundingBox boundingBox = this.snapCentre.getBoundingBox().expand(maxDistance);
    final GeometryFactory geometryFactory = getViewportGeometryFactory2d();
    final Map<Point, Set<CloseLocation>> snapLocations = new HashMap<>();
    final List<AbstractRecordLayer> layers = getSnapLayers();
    for (final AbstractRecordLayer layer : layers) {
        final List<LayerRecord> records = layer.getRecordsBackground(boundingBox);
        for (final LayerRecord record : records) {
            if (layer.isVisible(record)) {
                final Geometry recordGeometry = record.getGeometry();
                final CloseLocation closeLocation = this.map.findCloseLocation(geometryFactory, layer, record, recordGeometry, snapCentreX, snapCentreY, maxDistance);
                if (closeLocation != null) {
                    final Point closePoint = closeLocation.getViewportPoint();
                    Maps.addToSet(snapLocations, closePoint, closeLocation);
                }
            }
        }
    }
    return setSnapLocations(snapLocations);
}
Also used : GeometryFactory(com.revolsys.geometry.model.GeometryFactory) Set(java.util.Set) HashMap(java.util.HashMap) Point(com.revolsys.geometry.model.Point) Geometry(com.revolsys.geometry.model.Geometry) BoundingBox(com.revolsys.geometry.model.BoundingBox) AbstractRecordLayer(com.revolsys.swing.map.layer.record.AbstractRecordLayer) LayerRecord(com.revolsys.swing.map.layer.record.LayerRecord)

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