Search in sources :

Example 66 with LayerRecord

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

the class EditRecordGeometryOverlay method modePopupMenu.

private boolean modePopupMenu(final MouseEvent event) {
    if (event.isPopupTrigger()) {
        for (final CloseLocation location : getMouseOverLocations()) {
            final LayerRecord record = location.getRecord();
            if (record != null) {
                final LayerRecordMenu menu = record.getMenu();
                menu.showMenu(record, event);
            }
            return true;
        }
    }
    return false;
}
Also used : CloseLocation(com.revolsys.swing.map.overlay.CloseLocation) LayerRecordMenu(com.revolsys.swing.map.layer.record.LayerRecordMenu) LayerRecord(com.revolsys.swing.map.layer.record.LayerRecord)

Example 67 with LayerRecord

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

the class EditRecordGeometryOverlay method setGeometry.

protected UndoableEdit setGeometry(final CloseLocation location, final Geometry newGeometry) {
    if (isOverlayAction(ACTION_ADD_GEOMETRY) || isOverlayAction(ACTION_ADD_GEOMETRY_EDIT_VERTICES)) {
        if (DataTypes.GEOMETRY.equals(newGeometry, this.addGeometryEditor)) {
            return null;
        } else {
            // TODO
            return null;
        }
    } else {
        final LayerRecord record = location.getRecord();
        final String geometryFieldName = record.getGeometryFieldName();
        final Geometry oldValue = record.getGeometry();
        if (newGeometry == oldValue || newGeometry != null && newGeometry.equalsExact(oldValue)) {
            return null;
        } else {
            final AbstractRecordLayer layer = location.getLayer();
            return layer.newSetFieldUndo(record, geometryFieldName, oldValue, newGeometry);
        }
    }
}
Also used : Geometry(com.revolsys.geometry.model.Geometry) AbstractRecordLayer(com.revolsys.swing.map.layer.record.AbstractRecordLayer) LayerRecord(com.revolsys.swing.map.layer.record.LayerRecord) LineString(com.revolsys.geometry.model.LineString)

Example 68 with LayerRecord

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

the class EditRecordGeometryOverlay method propertyChange.

@Override
public void propertyChange(final PropertyChangeEvent event) {
    super.propertyChange(event);
    final Object source = event.getSource();
    final String propertyName = event.getPropertyName();
    if ("preEditable".equals(propertyName)) {
        if (isOverlayAction(ACTION_ADD_GEOMETRY)) {
            if (this.addGeometryEditor.isValid()) {
                try {
                    setXorGeometry(null);
                    if (this.addCompleteAction != null) {
                        final Geometry geometry = this.addGeometryEditor.newGeometry();
                        this.addCompleteAction.addComplete(this, geometry);
                        modeAddGeometryClear();
                    }
                } finally {
                    clearMapCursor();
                }
            }
        }
    } else if ("editable".equals(propertyName)) {
        repaint();
        if (source == this.addLayer) {
        // if (!isEditable(addLayer)) {
        // setEditingObject(null, null);
        // }
        }
    } else if (source instanceof LayerRecord) {
        if (event.getNewValue() instanceof Geometry) {
        // TODO update mouse over locations
        // clearMouseOverLocations();
        }
    }
}
Also used : Geometry(com.revolsys.geometry.model.Geometry) LineString(com.revolsys.geometry.model.LineString) LayerRecord(com.revolsys.swing.map.layer.record.LayerRecord)

Example 69 with LayerRecord

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

the class RecordLayerListSelectionModel method addSelectionInterval.

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

Example 70 with LayerRecord

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

the class RecordLayerListSelectionModel 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();
        final boolean selected = layer.isSelected(record);
        return selected;
    }
    return false;
}
Also used : AbstractRecordLayer(com.revolsys.swing.map.layer.record.AbstractRecordLayer) LayerRecord(com.revolsys.swing.map.layer.record.LayerRecord)

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