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;
}
}
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);
}
}
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;
}
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);
}
}
}
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();
}
Aggregations