Search in sources :

Example 1 with ProjectFrame

use of com.revolsys.swing.map.ProjectFrame in project com.revolsys.open by revolsys.

the class AbstractLayer method delete.

@Override
public void delete() {
    this.deleted = true;
    setExists(false);
    this.beanPropertyListener = null;
    final ProjectFrame projectFrame = ProjectFrame.get(this);
    if (projectFrame != null) {
        projectFrame.removeBottomTab(this);
    }
    firePropertyChange("deleted", false, true);
    final LayerGroup layerGroup = getLayerGroup();
    if (layerGroup != null) {
        layerGroup.removeLayer(this);
        this.layerGroup = new EmptyReference<>();
    }
    this.eventsEnabled.closeable(false);
    final PropertyChangeSupport propertyChangeSupport = this.propertyChangeSupport;
    if (propertyChangeSupport != null) {
        Property.removeAllListeners(propertyChangeSupport);
        this.propertyChangeSupport = null;
    }
    if (this.renderer != null) {
        this.renderer.setLayer(null);
    }
}
Also used : PropertyChangeSupport(com.revolsys.beans.PropertyChangeSupport) ProjectFrame(com.revolsys.swing.map.ProjectFrame)

Example 2 with ProjectFrame

use of com.revolsys.swing.map.ProjectFrame in project com.revolsys.open by revolsys.

the class Project method toMap.

@Override
public MapEx toMap() {
    final MapEx map = super.toMap();
    BoundingBox boundingBox = getViewBoundingBox();
    if (!RectangleUtil.isEmpty(boundingBox)) {
        BoundingBox defaultBoundingBox = null;
        final GeometryFactory geometryFactory = getGeometryFactory();
        if (geometryFactory != null) {
            final CoordinateSystem coordinateSystem = geometryFactory.getCoordinateSystem();
            if (coordinateSystem != null) {
                defaultBoundingBox = coordinateSystem.getAreaBoundingBox();
            }
            boundingBox = boundingBox.convert(geometryFactory);
        }
        addToMap(map, "viewBoundingBox", boundingBox, defaultBoundingBox);
        final Map<String, BoundingBox> zoomBookmarks = getZoomBookmarks();
        addToMap(map, "zoomBookmarks", zoomBookmarks);
    }
    final ProjectFrame projectFrame = ProjectFrame.get(this);
    if (projectFrame != null) {
        final Rectangle frameBounds = projectFrame.getBounds();
        if (frameBounds != null) {
            map.put("frameBounds", Arrays.asList(frameBounds.x, frameBounds.y, frameBounds.width, frameBounds.height));
        }
    }
    return map;
}
Also used : GeometryFactory(com.revolsys.geometry.model.GeometryFactory) MapEx(com.revolsys.collection.map.MapEx) CoordinateSystem(com.revolsys.geometry.cs.CoordinateSystem) GeographicCoordinateSystem(com.revolsys.geometry.cs.GeographicCoordinateSystem) BoundingBox(com.revolsys.geometry.model.BoundingBox) Rectangle(java.awt.Rectangle) ProjectFrame(com.revolsys.swing.map.ProjectFrame)

Aggregations

ProjectFrame (com.revolsys.swing.map.ProjectFrame)2 PropertyChangeSupport (com.revolsys.beans.PropertyChangeSupport)1 MapEx (com.revolsys.collection.map.MapEx)1 CoordinateSystem (com.revolsys.geometry.cs.CoordinateSystem)1 GeographicCoordinateSystem (com.revolsys.geometry.cs.GeographicCoordinateSystem)1 BoundingBox (com.revolsys.geometry.model.BoundingBox)1 GeometryFactory (com.revolsys.geometry.model.GeometryFactory)1 Rectangle (java.awt.Rectangle)1