use of com.revolsys.swing.map.layer.Layer in project com.revolsys.open by revolsys.
the class LayerStylePanel method propertyChange.
@SuppressWarnings("unchecked")
@Override
public void propertyChange(final PropertyChangeEvent event) {
final String propertyName = event.getPropertyName();
if ("replaceRenderer".equals(propertyName)) {
saveStylePanel();
final LayerRenderer<? extends Layer> oldRenderer = (LayerRenderer<? extends Layer>) event.getOldValue();
final LayerRenderer<? extends Layer> newRenderer = (LayerRenderer<? extends Layer>) event.getNewValue();
if (oldRenderer == this.rootRenderer && newRenderer != null && newRenderer != oldRenderer) {
Property.removeListener(oldRenderer, this);
this.rootNode.removeNode(0);
Property.addListener(newRenderer, this);
final LayerRendererTreeNode newNode = new LayerRendererTreeNode(newRenderer);
this.rootNode.addNode(newNode);
this.tree.expandAllNodes();
this.rootRenderer = newRenderer;
// setVisible(newRenderer,true);
setSelectedRenderer(newRenderer);
}
} else if ("renderers".equals(propertyName)) {
this.tree.expandAllNodes();
}
}
use of com.revolsys.swing.map.layer.Layer in project com.revolsys.open by revolsys.
the class EditRecordGeometryOverlay method addRecords.
private void addRecords(final List<LayerRecord> results, final LayerGroup group, final Geometry 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;
addRecords(results, childGroup, boundingBox);
} else if (layer instanceof AbstractRecordLayer) {
final AbstractRecordLayer recordLayer = (AbstractRecordLayer) layer;
if (recordLayer.isSelectable(scale)) {
final List<LayerRecord> selectedRecords = recordLayer.getSelectedRecords();
for (final LayerRecord selectedRecord : selectedRecords) {
final Geometry geometry = selectedRecord.getGeometry();
if (boundingBox.intersects(geometry)) {
results.add(selectedRecord);
}
}
}
}
}
}
use of com.revolsys.swing.map.layer.Layer in project com.revolsys.open by revolsys.
the class AbstractLayerTreeNode method setOpen.
@Override
public void setOpen(final boolean open) {
final Layer layer = getLayer();
layer.setOpen(open);
}
use of com.revolsys.swing.map.layer.Layer in project com.revolsys.open by revolsys.
the class LayerGroupTreeNode method propertyChangeDo.
@Override
public void propertyChangeDo(final PropertyChangeEvent e) {
super.propertyChangeDo(e);
final Object source = e.getSource();
final LayerGroup layerGroup = getGroup();
if (source == layerGroup) {
final String propertyName = e.getPropertyName();
if ("layers".equals(propertyName)) {
if (e instanceof IndexedPropertyChangeEvent) {
final IndexedPropertyChangeEvent indexedEvent = (IndexedPropertyChangeEvent) e;
final int index = indexedEvent.getIndex();
final Layer oldLayer = (Layer) e.getOldValue();
final Layer newLayer = (Layer) e.getNewValue();
final List<BaseTreeNode> children = new ArrayList<>(getChildren());
if (newLayer == null) {
if (oldLayer != null) {
children.remove(index);
}
} else if (oldLayer == null) {
final BaseTreeNode newTreeNode = newTreeNode(newLayer);
children.add(index, newTreeNode);
}
setChildren(children);
}
} else if ("visible".equals(propertyName)) {
if (isChildrenInitialized()) {
for (final BaseTreeNode childNode : getChildren()) {
if (childNode instanceof LayerTreeNode) {
final LayerTreeNode childLayerNode = (LayerTreeNode) childNode;
childLayerNode.refreshIcon();
}
}
}
}
}
}
use of com.revolsys.swing.map.layer.Layer in project com.revolsys.open by revolsys.
the class LayerGroupTreeNode method addChild.
@Override
public int addChild(final Object object) {
if (object instanceof Layer) {
final Layer layer = (Layer) object;
final LayerGroup group = getGroup();
group.addLayer(layer);
return getChildCount();
} else {
return -1;
}
}
Aggregations