Search in sources :

Example 16 with Layer

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

the class SelectRecordsOverlay method unSelectRecords.

private void unSelectRecords(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;
            unSelectRecords(childGroup, boundingBox);
        } else if (layer instanceof AbstractRecordLayer) {
            final AbstractRecordLayer recordLayer = (AbstractRecordLayer) layer;
            if (recordLayer.isSelectable(scale)) {
                recordLayer.unSelectRecords(boundingBox);
            }
        }
    }
}
Also used : AbstractRecordLayer(com.revolsys.swing.map.layer.record.AbstractRecordLayer) LayerGroup(com.revolsys.swing.map.layer.LayerGroup) Layer(com.revolsys.swing.map.layer.Layer) AbstractRecordLayer(com.revolsys.swing.map.layer.record.AbstractRecordLayer) AbstractLayer(com.revolsys.swing.map.layer.AbstractLayer)

Example 17 with Layer

use of com.revolsys.swing.map.layer.Layer 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);
            }
        }
    }
}
Also used : AbstractRecordLayer(com.revolsys.swing.map.layer.record.AbstractRecordLayer) LayerGroup(com.revolsys.swing.map.layer.LayerGroup) Layer(com.revolsys.swing.map.layer.Layer) AbstractRecordLayer(com.revolsys.swing.map.layer.record.AbstractRecordLayer) AbstractLayer(com.revolsys.swing.map.layer.AbstractLayer)

Example 18 with Layer

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

the class SinglePage method print.

@Override
public int print(final Graphics graphics, final PageFormat pageFormat, final int pageIndex) throws PrinterException {
    if (pageIndex == 0) {
        setGraphics((Graphics2D) graphics);
        final int translateX = (int) pageFormat.getImageableX();
        final int translateY = (int) pageFormat.getImageableY();
        graphics.translate(translateX - 1, translateY - 1);
        final Project project = getProject();
        final MapPanel mapPanel = project.getMapPanel();
        final Layer baseMapLayer = mapPanel.getBaseMapLayer();
        render(baseMapLayer);
        render(project);
        return PAGE_EXISTS;
    } else {
        return NO_SUCH_PAGE;
    }
}
Also used : Project(com.revolsys.swing.map.layer.Project) MapPanel(com.revolsys.swing.map.MapPanel) AbstractRecordLayer(com.revolsys.swing.map.layer.record.AbstractRecordLayer) Layer(com.revolsys.swing.map.layer.Layer)

Example 19 with Layer

use of com.revolsys.swing.map.layer.Layer 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);
                        }
                    }
                }
            }
        }
    }
}
Also used : AbstractRecordLayerRenderer(com.revolsys.swing.map.layer.record.renderer.AbstractRecordLayerRenderer) AbstractRecordLayer(com.revolsys.swing.map.layer.record.AbstractRecordLayer) List(java.util.List) ArrayList(java.util.ArrayList) LayerGroup(com.revolsys.swing.map.layer.LayerGroup) LayerRecord(com.revolsys.swing.map.layer.record.LayerRecord) Layer(com.revolsys.swing.map.layer.Layer) AbstractRecordLayer(com.revolsys.swing.map.layer.record.AbstractRecordLayer) AbstractLayer(com.revolsys.swing.map.layer.AbstractLayer)

Example 20 with Layer

use of com.revolsys.swing.map.layer.Layer 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();
            }
        }
    }
}
Also used : AbstractRecordLayer(com.revolsys.swing.map.layer.record.AbstractRecordLayer) LayerGroup(com.revolsys.swing.map.layer.LayerGroup) Layer(com.revolsys.swing.map.layer.Layer) AbstractRecordLayer(com.revolsys.swing.map.layer.record.AbstractRecordLayer) AbstractLayer(com.revolsys.swing.map.layer.AbstractLayer)

Aggregations

Layer (com.revolsys.swing.map.layer.Layer)33 AbstractLayer (com.revolsys.swing.map.layer.AbstractLayer)18 LayerGroup (com.revolsys.swing.map.layer.LayerGroup)16 AbstractRecordLayer (com.revolsys.swing.map.layer.record.AbstractRecordLayer)10 ArrayList (java.util.ArrayList)8 NullLayer (com.revolsys.swing.map.layer.NullLayer)5 LayerRecord (com.revolsys.swing.map.layer.record.LayerRecord)4 BaseTreeNode (com.revolsys.swing.tree.BaseTreeNode)4 List (java.util.List)4 BoundingBox (com.revolsys.geometry.model.BoundingBox)3 Geometry (com.revolsys.geometry.model.Geometry)3 GeometryFactory (com.revolsys.geometry.model.GeometryFactory)3 TreePath (javax.swing.tree.TreePath)3 MapPanel (com.revolsys.swing.map.MapPanel)2 BaseMapLayerGroup (com.revolsys.swing.map.layer.BaseMapLayerGroup)2 Project (com.revolsys.swing.map.layer.Project)2 ElevationModelLayer (com.revolsys.swing.map.layer.elevation.ElevationModelLayer)2 Rectangle (java.awt.Rectangle)2 JTree (javax.swing.JTree)2 TreeUI (javax.swing.plaf.TreeUI)2