Package org.locationtech.udig.project.render

Examples of org.locationtech.udig.project.render.IViewportModel


  public ScreenAOIStrategy() {
      listenToViewport();
  }
 
    private void listenToViewport() {
        IViewportModel viewportModel = ApplicationGIS.getActiveMap().getViewportModel();
      viewportModel.addViewportModelListener(watcher);
    }
View Full Code Here


            ProjectPlugin.getPlugin().turnOffEvents();
        }
        if (currentMap != null) {
            currentMap.removeDeepAdapter(checkboxContextListener);

            IViewportModel viewportModel = currentMap.getViewportModel();   
            if (viewportModel != null) {
                viewportModel.removeViewportModelListener(zoomListener);
            }
        }

        labelProvider.dispose();
        labelProvider.removeListener(labelProviderListener);
View Full Code Here

   * @param map
   * @return the current map's CRS or null if current map is null
   */
  private CoordinateReferenceSystem getCurrentMapCrs(IMap map) {
   
        IViewportModel viewportModel = map.getViewportModel();
        CoordinateReferenceSystem mapCrs = viewportModel.getCRS();
    return mapCrs;
  }
View Full Code Here

        final ILayer layer = (ILayer) target;
        SimpleFeatureSource source = (SimpleFeatureSource) layer.getResource(FeatureSource.class, new NullProgressMonitor());

        SimpleFeatureType schema = source.getSchema();
        GeometryDescriptor geometryDescriptor = schema.getGeometryDescriptor();
        IViewportModel viewportModel = ApplicationGIS.getActiveMap().getViewportModel();
        ReferencedEnvelope bounds = viewportModel.getBounds();
        CoordinateReferenceSystem dataCrs = schema.getCoordinateReferenceSystem();
       
        ReferencedEnvelope newBounds = bounds.transform(dataCrs, true);
       
        String name = geometryDescriptor.getLocalName();
View Full Code Here

        String name = geometryDescriptor.getLocalName();
        Filter bboxFilter = getBboxFilter(name, tBounds);
        SimpleFeatureCollection featureCollection = featureSource.getFeatures(bboxFilter);

        FeatureIterator<SimpleFeature> featureIterator = featureCollection.features();
        IViewportModel viewPort = ApplicationGIS.getActiveMap().getViewportModel();
        List<AbstractDrawCommand> commands = new ArrayList<AbstractDrawCommand>();
        while( featureIterator.hasNext() ) {
            SimpleFeature feature = featureIterator.next();
            Geometry fGeom = (Geometry) feature.getDefaultGeometry();
            if (!crsEqual) {
                fGeom = JTS.transform(fGeom, mathTransform);
            }
            Coordinate[] coords = fGeom.getCoordinates();
            java.awt.Point start = viewPort.worldToPixel(coords[0]);
            java.awt.Point end = viewPort.worldToPixel(coords[coords.length - 1]);
            commands.add(new ArrowDrawCommand(new Coordinate(start.x, start.y), new Coordinate(end.x, end.y)));
        }

        IToolContext toolContext = ApplicationGIS.createContext(ApplicationGIS.getActiveMap());
        IDrawCommand compositeCommand = toolContext.getDrawFactory().createCompositeDrawCommand(commands);
View Full Code Here

        if (e.button == MapMouseEvent.BUTTON3  && showContextOnRightClick) {
            ((ViewportPane) e.source).getMapEditor().openContextMenu();
          return;
      }
        if (zooming) {
            IViewportModel m = getContext().getViewportModel();
            if ((Math.abs(start.x - e.x)<5) && (Math.abs(start.y - e.y)<5)) {
                switch (e.button) {
                    case MapMouseEvent.BUTTON1: {
                      if( e.isControlDown() ){
                        zoomout(m);
View Full Code Here

 
  private Point end;
  private double theta;
 
  public void draw(MapGraphicContext context) {
    IViewportModel viewport = context.getViewportModel();

    Point here = start( context );
    if( here== null ) return; // bye!
   
    Envelope bounds = viewport.getBounds();
    if( !here.equals( start ) || !bounds.equals( look )){
      start = here;
      look = bounds;
      end = null;
     
View Full Code Here

                Bookmark bookmark = (Bookmark) selection.getFirstElement();
                gotoBookmark(bookmark);
            } else if (ADD_BOOKMARK_ACTION_ID.equals(action.getId())) {
                IMap map = ApplicationGIS.getActiveMap();
                if (map != ApplicationGIS.NO_MAP) {
                    IViewportModel v = map.getViewportModel();
                    Envelope env = v.getBounds();
                    ReferencedEnvelope bounds;
                    if (env instanceof ReferencedEnvelope) {
                        bounds = (ReferencedEnvelope) env;
                    } else {
                        bounds = new ReferencedEnvelope(env, v.getCRS());
                    }
                    MapReference ref = bmManager.getMapReference(map);
                    Bookmark bookmark = new Bookmark(bounds, ref, null);
                    InputDialog dialog = new InputDialog(
                            Display.getCurrent().getActiveShell(),
View Full Code Here

    protected void runImpl( IProgressMonitor monitor ) throws Exception {
         URI mapID = target.getMap().getMapID();
         IMap map = (IMap) (ProjectPlugin.getPlugin().getProjectRegistry().eResource()
                 .getResourceSet().getResource(mapID, true).getContents().get(0));
         ApplicationGIS.openMap(map);
         IViewportModel v = map.getViewportModel();
        
         final ReferencedEnvelope bookmarkEnvelope = target.getEnvelope();
         final Envelope viewportBounds = v.getBounds();

         final CoordinateReferenceSystem viewportCrs = v.getCRS();
         final CoordinateReferenceSystem bookmarkCrs = bookmarkEnvelope.getCoordinateReferenceSystem();

         final ReferencedEnvelope bookmarkedEnvelopeInVieportCRS;
        
         if(bookmarkCrs.equals(viewportCrs)){
View Full Code Here

                if( srs.startsWith( "EPSG" ) ) return srs;             //$NON-NLS-1$
            }
        return "EPSG:4326"; //$NON-NLS-1$
    }
    private static void writeGeneral( IMap map, BufferedWriter out ) throws IOException  {
        IViewportModel view = map.getViewportModel();
        int w = 640;
        int h = (int) ( ((double)w) * view.getAspectRatio() );
        Envelope bbox = view.getBounds();
        CoordinateReferenceSystem crs = view.getCRS();
        String user = System.getenv("user.name"); //$NON-NLS-1$
       
        append( 2, out, "<General>"); //$NON-NLS-1$
        append( 4, out,   "<Window height=\""+h+"\" width=\""+w+"\"/>"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        append( 4, out,   "<ows:BoundingBox crs=\""+srs( view.getCRS() )+ "\">" ); //$NON-NLS-1$ //$NON-NLS-2$
        append( 6, out,      "<ows:LowerCorner>"+bbox.getMinX()+" "+bbox.getMinY()+"</ows:LowerCorner>"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        append( 6, out,      "<ows:UpperCorner>"+bbox.getMaxX()+" "+bbox.getMaxY()+"</ows:UpperCorner>"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        append( 4, out,   "</ows:BoundingBox>"); //$NON-NLS-1$
        append( 4, out,   "<Title>"+map.getName()+"</Title>"); //$NON-NLS-1$ //$NON-NLS-2$
        append( 4, out,   "<ows:ServiceProvider>");         //$NON-NLS-1$
View Full Code Here

TOP

Related Classes of org.locationtech.udig.project.render.IViewportModel

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.