use of com.revolsys.swing.map.layer.LayerGroup 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.LayerGroup 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);
}
}
use of com.revolsys.swing.map.layer.LayerGroup in project com.revolsys.open by revolsys.
the class SelectRecordsOverlay method addSelectedRecords.
public void addSelectedRecords(final BoundingBox boundingBox) {
final LayerGroup project = getProject();
addSelectedRecords(project, boundingBox);
final LayerRendererOverlay overlay = getMap().getLayerOverlay();
overlay.redraw();
}
use of com.revolsys.swing.map.layer.LayerGroup in project com.revolsys.open by revolsys.
the class SelectRecordsOverlay method selectRecords.
public void selectRecords(final BoundingBox boundingBox) {
try (BaseCloseable closeable = this.selectingRecords.closeable(true)) {
final LayerGroup project = getProject();
selectRecords(project, boundingBox);
final LayerRendererOverlay overlay = getMap().getLayerOverlay();
overlay.redraw();
redrawAndRepaint();
}
}
use of com.revolsys.swing.map.layer.LayerGroup in project com.revolsys.open by revolsys.
the class ComponentViewport2D method updateCachedFields.
private void updateCachedFields() {
final LayerGroup project = getProject();
final GeometryFactory geometryFactory = project.getGeometryFactory();
if (geometryFactory != null) {
if (geometryFactory != getGeometryFactory()) {
setGeometryFactory(geometryFactory);
}
final Insets insets = this.component.getInsets();
final int viewWidth = this.component.getWidth() - insets.left - insets.right;
final int viewHeight = this.component.getHeight() - insets.top - insets.bottom;
setViewWidth(viewWidth);
setViewHeight(viewHeight);
setBoundingBox(getBoundingBox());
this.component.repaint();
}
}
Aggregations