use of com.revolsys.swing.map.layer.record.AbstractRecordLayer in project com.revolsys.open by revolsys.
the class SelectRecordsOverlay method addSelectedRecords.
private void addSelectedRecords(final LayerGroup group, final BoundingBox 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;
addSelectedRecords(childGroup, boundingBox);
} else if (layer instanceof AbstractRecordLayer) {
final AbstractRecordLayer recordLayer = (AbstractRecordLayer) layer;
if (recordLayer.isSelectable(scale)) {
recordLayer.addSelectedRecords(boundingBox);
}
}
}
}
use of com.revolsys.swing.map.layer.record.AbstractRecordLayer in project com.revolsys.open by revolsys.
the class GeometryCoordinatesTableModel method setGeometry.
public void setGeometry(final Geometry geometry) {
final LayerRecordForm form = this.geometryCoordinatesPanel.getForm();
final LayerRecord record = form.getRecord();
final Geometry oldGeometry = record.getGeometry();
if (oldGeometry != geometry) {
final AbstractRecordLayer layer = record.getLayer();
final String geometryFieldName = record.getGeometryFieldName();
final UndoableEdit setGeometryUndo = layer.newSetFieldUndo(record, geometryFieldName, oldGeometry, geometry);
final UndoManager undoManager = form.getUndoManager();
undoManager.addEdit(setGeometryUndo);
}
if (this.geometry != geometry) {
this.geometry = geometry;
if (geometry == null) {
this.geometryFactory = GeometryFactory.DEFAULT_3D;
this.vertexIndexMap = Collections.emptyMap();
this.vertexIndices = Collections.emptyList();
} else {
this.geometryFactory = geometry.getGeometryFactory();
this.vertexIndexMap = getIndexOfVertices(geometry);
this.vertexIndices = new ArrayList<>(this.vertexIndexMap.keySet());
}
this.axisCount = this.geometryFactory.getAxisCount();
this.axisNames = new ArrayList<>();
if (geometry.isGeometryCollection()) {
this.axisNames.add("P");
}
if (geometry instanceof Polygonal) {
this.axisNames.add("R");
}
this.vertexIndexColumn = this.axisNames.size();
this.axisNames.add("#");
this.segmentIndexColumn = this.axisNames.size();
this.axisNames.add("S #");
this.numIndexItems = this.axisNames.size();
this.axisNames.add("X");
this.axisNames.add("Y");
if (this.axisCount > 2) {
this.axisNames.add("Z");
}
if (this.axisCount > 3) {
this.axisNames.add("M");
}
this.columnCount = this.axisNames.size();
fireTableStructureChanged();
}
}
use of com.revolsys.swing.map.layer.record.AbstractRecordLayer in project com.revolsys.open by revolsys.
the class SelectRecordsOverlay method refreshImageRenderer.
private void refreshImageRenderer(final ImageViewport viewport, final LayerGroup layerGroup) {
for (final Layer layer : layerGroup.getLayers()) {
if (layer instanceof LayerGroup) {
final LayerGroup childGroup = (LayerGroup) layer;
refreshImageRenderer(viewport, childGroup);
} else if (layer instanceof AbstractRecordLayer) {
final AbstractRecordLayer recordLayer = (AbstractRecordLayer) layer;
final AbstractRecordLayerRenderer layerRenderer = layer.getRenderer();
if (recordLayer.isSelectable()) {
final List<LayerRecord> selectedRecords = recordLayer.getSelectedRecords();
for (final LayerRecord record : selectedRecords) {
if (record != null && recordLayer.isVisible(record)) {
if (!recordLayer.isDeleted(record)) {
layerRenderer.renderSelectedRecord(viewport, recordLayer, record);
}
}
}
}
}
}
}
use of com.revolsys.swing.map.layer.record.AbstractRecordLayer in project com.revolsys.open by revolsys.
the class SelectRecordsOverlay method selectRecords.
private void selectRecords(final LayerGroup group, final BoundingBox 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;
selectRecords(childGroup, boundingBox);
} else if (layer instanceof AbstractRecordLayer) {
final AbstractRecordLayer recordLayer = (AbstractRecordLayer) layer;
if (recordLayer.isSelectable(scale)) {
recordLayer.setSelectedRecords(boundingBox);
} else {
recordLayer.clearSelectedRecords();
}
}
}
}
use of com.revolsys.swing.map.layer.record.AbstractRecordLayer in project com.revolsys.open by revolsys.
the class SelectRecordsOverlay method refreshImageSelectedAndHighlighted.
private void refreshImageSelectedAndHighlighted(final ImageViewport viewport, final Graphics2D graphics, final LayerGroup layerGroup) {
graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
final GeometryFactory viewportGeometryFactory = getViewportGeometryFactory2d();
final List<Geometry> highlightedGeometries = new ArrayList<>();
for (final Layer layer : layerGroup.getLayers()) {
if (layer instanceof LayerGroup) {
final LayerGroup childGroup = (LayerGroup) layer;
refreshImageSelectedAndHighlighted(viewport, graphics, childGroup);
} else if (layer instanceof AbstractRecordLayer) {
final AbstractRecordLayer recordLayer = (AbstractRecordLayer) layer;
if (recordLayer.isSelectable()) {
final List<LayerRecord> selectedRecords = recordLayer.getSelectedRecords();
for (final LayerRecord record : selectedRecords) {
if (record != null && recordLayer.isVisible(record)) {
if (!recordLayer.isDeleted(record)) {
final Geometry geometry = record.getGeometry();
if (recordLayer.isHighlighted(record)) {
highlightedGeometries.add(geometry);
} else {
this.selectRenderer.paintSelected(viewport, graphics, viewportGeometryFactory, geometry);
}
}
}
}
}
}
}
for (final Geometry geometry : highlightedGeometries) {
this.highlightRenderer.paintSelected(viewport, graphics, viewportGeometryFactory, geometry);
}
}
Aggregations