Search in sources :

Example 41 with AbstractRecordLayer

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

the class MapPanel method mouseMovedCloseSelected.

public boolean mouseMovedCloseSelected(final MouseEvent event) {
    if (isOverlayAction(SelectRecordsOverlay.ACTION_SELECT_RECORDS) || isOverlayAction(ZoomOverlay.ACTION_ZOOM_BOX) || isOverlayAction(ZoomOverlay.ACTION_PAN)) {
        clearCloseSelected();
        return false;
    } else {
        final double scale = getViewport().getScale();
        final Point point = MouseOverlay.getEventPoint();
        final double x = point.getX();
        final double y = point.getY();
        final double maxDistance = this.viewport.getHotspotMapUnits();
        final GeometryFactory geometryFactory = this.viewport.getGeometryFactory2dFloating();
        final BoundingBox boundingBox = point.newBoundingBox().expand(maxDistance);
        final List<LayerRecord> closeRecords = new ArrayList<>();
        final List<CloseLocation> closeLocations = new ArrayList<>();
        for (final LayerRecord closeRecord : getSelectedRecords(boundingBox)) {
            final AbstractRecordLayer layer = closeRecord.getLayer();
            if (layer.isVisible(scale) && layer.isVisible(closeRecord)) {
                final Geometry geometry = closeRecord.getGeometry();
                final CloseLocation closeLocation = findCloseLocation(geometryFactory, layer, closeRecord, geometry, x, y, maxDistance);
                if (closeLocation != null) {
                    closeRecords.add(closeRecord);
                    closeLocations.add(closeLocation);
                }
            }
        }
        this.closeSelectedRecords = closeRecords;
        this.closeSelectedLocations = closeLocations;
        repaint();
        return true;
    }
}
Also used : CloseLocation(com.revolsys.swing.map.overlay.CloseLocation) Geometry(com.revolsys.geometry.model.Geometry) GeometryFactory(com.revolsys.geometry.model.GeometryFactory) BoundingBox(com.revolsys.geometry.model.BoundingBox) ArrayList(java.util.ArrayList) AbstractRecordLayer(com.revolsys.swing.map.layer.record.AbstractRecordLayer) Point(com.revolsys.geometry.model.Point) LayerRecord(com.revolsys.swing.map.layer.record.LayerRecord)

Example 42 with AbstractRecordLayer

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

the class LayerRecordForm method pasteValues.

public void pasteValues(final Map<String, Object> map) {
    final AbstractRecordLayer layer = getLayer();
    if (layer != null) {
        final Map<String, Object> newValues = new LinkedHashMap<>(map);
        final Collection<String> ignorePasteFieldNames = layer.getIgnorePasteFieldNames();
        final Set<String> keySet = newValues.keySet();
        if (ignorePasteFieldNames != null) {
            keySet.removeAll(ignorePasteFieldNames);
        }
        keySet.removeAll(getReadOnlyFieldNames());
        final Map<String, Object> values = getValues();
        values.putAll(newValues);
        setValues(values);
    }
}
Also used : AbstractRecordLayer(com.revolsys.swing.map.layer.record.AbstractRecordLayer) LinkedHashMap(java.util.LinkedHashMap)

Example 43 with AbstractRecordLayer

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

the class LayerRecordForm method getLabel.

protected JLabel getLabel(final String fieldName) {
    final AbstractRecordLayer layer = getLayer();
    String title = layer.getFieldTitle(fieldName);
    title = title.replaceAll(" Code$", "");
    title = title.replaceAll(" Ind$", "");
    final JLabel label = new JLabel(title);
    label.setFont(SwingUtil.BOLD_FONT);
    label.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));
    return label;
}
Also used : AbstractRecordLayer(com.revolsys.swing.map.layer.record.AbstractRecordLayer) JLabel(javax.swing.JLabel)

Example 44 with AbstractRecordLayer

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

the class LayerRecordForm method pasteGeometry.

public void pasteGeometry() {
    final LayerRecord record = getRecord();
    final AbstractRecordLayer layer = getLayer();
    if (layer != null) {
        if (record != null) {
            layer.pasteRecordGeometry(record);
        }
    }
}
Also used : AbstractRecordLayer(com.revolsys.swing.map.layer.record.AbstractRecordLayer) LayerRecord(com.revolsys.swing.map.layer.record.LayerRecord)

Example 45 with AbstractRecordLayer

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

the class LayerRecordForm method destroy.

public void destroy() {
    this.addOkButton = null;
    this.fieldsTableModel = null;
    this.recordStore = null;
    this.fieldInValidMessage.clear();
    for (final Field field : this.fields.values()) {
        Property.removeAllListeners(field);
    }
    this.fields.clear();
    this.fieldTabIndex.clear();
    this.fieldToNameMap.clear();
    this.invalidFieldNames.clear();
    this.geometryCoordinatesPanel = null;
    this.recordDefinition = null;
    this.record = null;
    this.propertyChangeSupport = null;
    this.readOnlyFieldNames.clear();
    this.tabInvalidFieldMap.clear();
    this.tabs = null;
    this.toolBar = null;
    this.undoManager = null;
    final Container parent = getParent();
    if (parent != null) {
        parent.remove(this);
    }
    final AbstractRecordLayer layer = getLayer();
    if (layer != null) {
        this.layer = null;
        if (this.fieldsTableModel != null) {
            Property.removeListener(layer, this.fieldsTableModel);
            this.fieldsTableModel = null;
        }
        Property.removeListener(layer, this);
    }
    final Window window = SwingUtil.getWindowAncestor(this);
    if (window != null) {
        window.removeWindowListener(this);
    }
    removeAll();
}
Also used : Window(java.awt.Window) NumberTextField(com.revolsys.swing.field.NumberTextField) Field(com.revolsys.swing.field.Field) ObjectLabelField(com.revolsys.swing.field.ObjectLabelField) Container(java.awt.Container) 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