Search in sources :

Example 16 with Project

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

the class MapPanel method zoomToBoundingBox.

public static void zoomToBoundingBox(final String baseName, final BoundingBoxProxy boundingBoxProxy) {
    promptCoordinateSystem(baseName, boundingBoxProxy, geometryFactory -> {
        final Project project = Project.get();
        final MapPanel mapPanel = project.getMapPanel();
        BoundingBox boundingBox = boundingBoxProxy.getBoundingBox();
        boundingBox = boundingBox.convert(geometryFactory);
        mapPanel.zoomToBoundingBox(boundingBox);
    });
}
Also used : Project(com.revolsys.swing.map.layer.Project) BoundingBox(com.revolsys.geometry.model.BoundingBox)

Example 17 with Project

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

the class MapPanel method promptCoordinateSystem.

/**
 * Prompt for a coordinate system if the geometry factory does not have a coordinate system.
 * @author Paul Austin <paul.austin@revolsys.com>
 * @param geometryFactoryProxy
 * @param action
 */
public static <GFP extends GeometryFactoryProxy> void promptCoordinateSystem(final String title, final GFP geometryFactoryProxy, final Consumer<GeometryFactory> action) {
    if (geometryFactoryProxy.isHasCoordinateSystem()) {
        final GeometryFactory geometryFactory = geometryFactoryProxy.getGeometryFactory();
        action.accept(geometryFactory);
    } else {
        Invoke.later(() -> {
            final Project project = Project.get();
            final MapPanel mapPanel = project.getMapPanel();
            final int mapCoordinateSystemId = mapPanel.getCoordinateSystemId();
            final CoordinateSystemField coordinateSystemField = new CoordinateSystemField("coordinateSystem");
            coordinateSystemField.setSelectedItem(mapCoordinateSystemId);
            final JPanel fieldPanel = new BasePanel(new JLabel("Coordinate System"), coordinateSystemField);
            GroupLayouts.makeColumns(fieldPanel, 2, true);
            final ValueField valueField = new ValueField(fieldPanel);
            valueField.add(fieldPanel);
            valueField.showDialog();
            if (valueField.isSaved()) {
                final GeometryFactory geometryFactory = coordinateSystemField.getGeometryFactory();
                if (geometryFactory.isHasCoordinateSystem()) {
                    Invoke.background(title, () -> action.accept(geometryFactory));
                }
            }
        });
    }
}
Also used : Project(com.revolsys.swing.map.layer.Project) JPanel(javax.swing.JPanel) BasePanel(com.revolsys.swing.component.BasePanel) GeometryFactory(com.revolsys.geometry.model.GeometryFactory) CoordinateSystemField(com.revolsys.swing.map.component.CoordinateSystemField) JLabel(javax.swing.JLabel) Point(com.revolsys.geometry.model.Point) ValueField(com.revolsys.swing.component.ValueField)

Example 18 with Project

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

the class ProjectFrame method newTabLeftTableOfContents.

protected void newTabLeftTableOfContents() {
    final Project project = getProject();
    this.tocTree = ProjectTreeNode.newTree(project);
    this.leftTabs.addTabIcon("tree_layers", "TOC", this.tocTree, true);
}
Also used : Project(com.revolsys.swing.map.layer.Project)

Example 19 with Project

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

the class ProjectFrame method exit.

public void exit() {
    final Project project = getProject();
    if (project != null && project.saveWithPrompt()) {
        final Window[] windows = Window.getOwnerlessWindows();
        for (final Window window : windows) {
            SwingUtil.dispose(window);
        }
        System.exit(0);
    }
}
Also used : Window(java.awt.Window) Project(com.revolsys.swing.map.layer.Project)

Example 20 with Project

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

the class TriangulatedIrregularNetworkLayer method zoomToLayer.

@Override
public void zoomToLayer() {
    final Project project = getProject();
    final GeometryFactory geometryFactory = project.getGeometryFactory();
    final BoundingBox layerBoundingBox = getBoundingBox();
    BoundingBox boundingBox = layerBoundingBox;
    boundingBox = boundingBox.convert(geometryFactory).expandPercent(0.1).clipToCoordinateSystem();
    project.setViewBoundingBox(boundingBox);
}
Also used : Project(com.revolsys.swing.map.layer.Project) GeometryFactory(com.revolsys.geometry.model.GeometryFactory) BoundingBox(com.revolsys.geometry.model.BoundingBox)

Aggregations

Project (com.revolsys.swing.map.layer.Project)28 BoundingBox (com.revolsys.geometry.model.BoundingBox)14 GeometryFactory (com.revolsys.geometry.model.GeometryFactory)6 Viewport2D (com.revolsys.swing.map.Viewport2D)4 MapPanel (com.revolsys.swing.map.MapPanel)3 Point (com.revolsys.geometry.model.Point)2 GeoreferencedImage (com.revolsys.raster.GeoreferencedImage)2 ImageViewport (com.revolsys.swing.map.ImageViewport)2 Layer (com.revolsys.swing.map.layer.Layer)2 LayerGroup (com.revolsys.swing.map.layer.LayerGroup)2 AbstractRecordLayer (com.revolsys.swing.map.layer.record.AbstractRecordLayer)2 PageFormat (java.awt.print.PageFormat)2 PrinterException (java.awt.print.PrinterException)2 PrinterJob (java.awt.print.PrinterJob)2 File (java.io.File)2 ArrayList (java.util.ArrayList)2 Geometry (com.revolsys.geometry.model.Geometry)1 LineString (com.revolsys.geometry.model.LineString)1 RectangularMapGrid (com.revolsys.gis.grid.RectangularMapGrid)1 RectangularMapTile (com.revolsys.gis.grid.RectangularMapTile)1