Package org.locationtech.udig.project

Examples of org.locationtech.udig.project.IMap


        Geometry newAOI = unionGeometry(featureCollection);
       
        updateAOIService(selectedLayer,newAOI );

        if (isNavigate) {
            IMap map = selectedLayer.getMap();
            ViewportModelImpl vmi = (ViewportModelImpl) map.getViewportModel();
            vmi.zoomToBox(bounds);
        }
    }
View Full Code Here


                blackboard.remove(AOI_GEOMETRY);
            }
            mapBlackboard = victim.getMap().getBlackboard();
        }
        else {
            IMap activeMap = ApplicationGIS.getActiveMap();
            if( activeMap == null){
                return;
            }
            mapBlackboard = activeMap.getBlackboard();
        }
        if( geometry != null ){
            // record a WKT note in the mapblackboard for a rainy day
            String wkt = geometry.toText();
            mapBlackboard.put(AOI_GEOMETRY, wkt );
View Full Code Here

   
    /**
     * @return the activeLayer
     */
    public ILayer getActiveLayer() {
        IMap map = ApplicationGIS.getActiveMap();
       
        // check if this map has a AOI layer marked already
        ILayer layer = restoreFromMapBlackboard(map);
        if( layer != null ){
            return layer;
View Full Code Here

    /**
     * Sets the active layer and notifies listeners
     * @param activeLayer the activeLayer to set
     */
    public void setActiveLayer( ILayer activeLayer ) {
        IMap map;
        if( activeLayer != null ){
            map = activeLayer.getMap();
            String layerId = activeLayer.getID().toExternalForm();
            // mark this one as the "AOILayer" for the map
            map.getBlackboard().put(AOI_LAYER, layerId );
        }
        else {
            map = ApplicationGIS.getActiveMap();
            if( map == null){
                return;
            }
            map.getBlackboard().remove(AOI_LAYER);
        }       
        AOIListener.Event aoiEvent = new AOIListener.Event( AOILayerStrategy.this);
        notifyListeners(aoiEvent);
    }
View Full Code Here

        // selection should be an Feture (of some sort)
        SimpleFeature feature = (SimpleFeature) selection;
        Geometry geom = (Geometry) feature.getDefaultGeometry();
        Point point = geom.getCentroid();
       
        IMap imap = ApplicationGIS.getActiveMap();
        if( imap == ApplicationGIS.NO_MAP ) return;
       
        CoordinateReferenceSystem world = imap.getViewportModel().getCRS();
        CoordinateReferenceSystem wsg84 = DefaultGeographicCRS.WGS84;
       
        double buffer = 0.01; // how much of the wgs84 world to see
        Envelope view = point.buffer( buffer ).getEnvelopeInternal();
       
        MathTransform transform;
        try {
            transform = CRS.findMathTransform( wsg84, world, true ); // relaxed
        } catch (FactoryException e) {
            return; // no go
        }
        Envelope areaOfInterest;
        try {
            areaOfInterest = JTS.transform( view, null, transform, 10 );
        } catch (TransformException e) {
            return; // no go
        }
       
        //NavigationCommandFactory navigate = NavigationCommandFactory.getInstance();

        NavCommand show = new SetViewportBBoxCommand(areaOfInterest, world);
        imap.sendCommandASync( show );
    }
View Full Code Here

    public void interactionExample(ILayer layer) {
        if (layer.getInteraction(Interaction.BACKGROUND)) {
            // layer is intended as a background layer
           
            // We can clear the background setting using a custom command
            IMap map = layer.getMap();
            final Layer modifyLayer = (Layer) layer;
            map.sendCommandASync( new AbstractCommand(){
                public void run(IProgressMonitor monitor) throws Exception {
                    modifyLayer.setInteraction( Interaction.BACKGROUND, false );
                }
                public String getName() {
                    return "Clear Interaction";
View Full Code Here

            public void partActivated(IWorkbenchPart part) {
                if (part == currentPart)
                    return;
               
                final IMap map = getMapFromPart(part);
               
                if (map != null) {
                    currentPart = part;
                   
                    if (parentControl == null || parentControl.isDisposed()) return;
                   
                    parentControl.getDisplay().asyncExec(new Runnable() {
                        public void run(){
                            setUpMapListeners(map);
                        }
                    });
                }
               
            }

            public void partBroughtToTop(IWorkbenchPart part) {
                partActivated(part);
            }

            public void partClosed(IWorkbenchPart part) {               
                if (part == WMTZoomLevelSwitcher.this) {
                    if (parentControl == null || parentControl.isDisposed()) return;
                   
                    // if the tool itself is closed
                    parentControl.getDisplay().asyncExec(new Runnable() {
                        public void run(){
                            removeAllListeners();
                           
                            currentPart = null;
                        }
                    });
                   
                    return;
                }
               
                if (part != currentPart)
                    return;

                final IMap map = getMapFromPart(part);
               
                if(map != null) {
                    if (parentControl == null || parentControl.isDisposed()) return;
                   
                    // remove
View Full Code Here

    return null;
  }
 
  @Override
  public CoordinateReferenceSystem getCrs() {
    IMap currentMap = ApplicationGIS.getActiveMap();
    if (!currentMap.equals(ApplicationGIS.NO_MAP)) {
      return currentMap.getViewportModel().getCRS();
    }
    return null;
  }
View Full Code Here

  private static String name = "Map CRS";
 
  @Override
  public ReferencedEnvelope getExtent() {
    final IMap currentMap = ApplicationGIS.getActiveMap();
    return calcualteExtent(currentMap);
  }
View Full Code Here

    return null;
  }

  @Override
  public CoordinateReferenceSystem getCrs() {
    final IMap currentMap = ApplicationGIS.getActiveMap();
    if (!currentMap.equals(ApplicationGIS.NO_MAP)) {
        return currentMap.getViewportModel().getCRS();
    }
    return null;
  }
View Full Code Here

TOP

Related Classes of org.locationtech.udig.project.IMap

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.