use of com.revolsys.swing.map.layer.Layer in project com.revolsys.open by revolsys.
the class AbstractTiledLayerRenderer method propertyChange.
@Override
public void propertyChange(final PropertyChangeEvent event) {
final Object newValue = event.getNewValue();
if (newValue instanceof BoundingBox) {
final BoundingBox newBoundingBox = (BoundingBox) newValue;
synchronized (this.cachedTiles) {
final List<T> mapTiles = new ArrayList<>(this.cachedTiles.keySet());
final GeometryFactory newGeometryFactory = newBoundingBox.getGeometryFactory();
for (final T mapTile : mapTiles) {
final BoundingBox boundingBox = mapTile.getBoundingBox();
final GeometryFactory geometryFactory = boundingBox.getGeometryFactory();
if (!geometryFactory.equals(newGeometryFactory) || !newBoundingBox.intersects(boundingBox)) {
this.cachedTiles.remove(mapTile);
}
}
}
} else if (!TILES_LOADED.equals(event.getPropertyName())) {
clearCachedTiles();
}
if (!(event.getSource() instanceof Layer)) {
firePropertyChange(event);
}
}
use of com.revolsys.swing.map.layer.Layer in project com.revolsys.open by revolsys.
the class LayerRendererOverlay method setLayer.
public void setLayer(final Layer layer) {
final Layer old = this.layer;
if (old != layer) {
if (old != null) {
if (old.getParent() instanceof BaseMapLayerGroup) {
old.setVisible(false);
}
Property.removeListener(old, this);
}
this.layer = layer;
if (layer != null) {
Property.addListener(layer, this);
if (layer.getParent() instanceof BaseMapLayerGroup) {
layer.setVisible(true);
}
if (layer.isInitialized()) {
layer.refresh();
}
}
this.image = null;
redraw();
firePropertyChange("layer", old, layer);
}
}
use of com.revolsys.swing.map.layer.Layer in project com.revolsys.open by revolsys.
the class ElevationModelLayer method getElevation.
static double getElevation(final LayerGroup layerGroup, final double scale, final Point point) {
if (layerGroup.isVisible(scale)) {
for (final Layer layer : layerGroup) {
if (layer instanceof LayerGroup) {
final LayerGroup childGroup = (LayerGroup) layer;
final double elevation = getElevation(childGroup, scale, point);
if (Double.isFinite(elevation)) {
return elevation;
}
} else if (layer instanceof ElevationModelLayer) {
final ElevationModelLayer elevationModel = (ElevationModelLayer) layer;
if (elevationModel.isUseElevationAtScale(scale)) {
final double elevation = elevationModel.getElevation(point);
if (Double.isFinite(elevation)) {
return elevation;
}
}
}
}
}
return Double.NaN;
}
use of com.revolsys.swing.map.layer.Layer in project com.revolsys.open by revolsys.
the class ElevationModelLayer method getElevationVisible.
static double getElevationVisible(final LayerGroup layerGroup, final double scale, final Point point) {
if (layerGroup.isVisible(scale)) {
for (final Layer layer : layerGroup) {
if (layer instanceof LayerGroup) {
final LayerGroup childGroup = (LayerGroup) layer;
final double elevation = getElevation(childGroup, scale, point);
if (Double.isFinite(elevation)) {
return elevation;
}
} else if (layer instanceof ElevationModelLayer) {
final ElevationModelLayer elevationModel = (ElevationModelLayer) layer;
if (elevationModel.isVisible(scale)) {
final double elevation = elevationModel.getElevation(point);
if (Double.isFinite(elevation)) {
return elevation;
}
}
}
}
}
return Double.NaN;
}
use of com.revolsys.swing.map.layer.Layer in project com.revolsys.open by revolsys.
the class LayerGroupListModel method reorder.
@Override
public void reorder(final int fromIndex, int toIndex) {
if (fromIndex < toIndex) {
toIndex--;
}
final Layer layer = getElementAt(fromIndex);
this.group.removeLayer(fromIndex);
this.group.addLayer(toIndex, layer);
}
Aggregations