Package org.locationtech.udig.project.internal.render

Examples of org.locationtech.udig.project.internal.render.ViewportModel


     * <!-- begin-user-doc --> <!-- end-user-doc -->
     * @generated
     */
    public NotificationChain basicSetViewportModelInternal(ViewportModel newViewportModelInternal,
            NotificationChain msgs) {
        ViewportModel oldViewportModelInternal = viewportModelInternal;
        viewportModelInternal = newViewportModelInternal;
        if (eNotificationRequired()) {
            ENotificationImpl notification = new ENotificationImpl(this, Notification.SET,
                    RenderPackage.RENDER_MANAGER__VIEWPORT_MODEL_INTERNAL,
                    oldViewportModelInternal, newViewportModelInternal);
View Full Code Here


        if( layer==null )
            layer=(Layer) provider.get();
        old=layer.getCRS(monitor);
        monitor.setTaskName(NAME);
        layer.setCRS(crs);
        ViewportModel viewportModel = layer.getMapInternal().getViewportModelInternal();
            ReferencedEnvelope bounds = (ReferencedEnvelope) layer.getMapInternal().getViewportModel().getBounds();
            if( layer.getMapInternal().getMapLayers().size()==1
                    && !bounds.intersects( (Envelope) layer.getBounds(monitor, viewportModel.getCRS()))){
                oldBounds=bounds;
               
                viewportModel.zoomToExtent();
            }
        monitor.done();
    }
View Full Code Here

        String name=Messages.SetLayerCRSCommand_undoTask;
        monitor.beginTask(name, 1);
        Layer layer=(Layer) provider.get();
        layer.setCRS(old);
        if( oldBounds!=null ){
            ViewportModel viewportModel = layer.getMapInternal().getViewportModelInternal();
            viewportModel.setBounds(oldBounds);
        }
        monitor.done();
    }
View Full Code Here

            if (result == null)
                result = defaultCase(theEObject);
            return result;
        }
        case RenderPackage.VIEWPORT_MODEL: {
            ViewportModel viewportModel = (ViewportModel) theEObject;
            T result = caseViewportModel(viewportModel);
            if (result == null)
                result = caseIMapDisplayListener(viewportModel);
            if (result == null)
                result = caseIViewportModel(viewportModel);
View Full Code Here

            public int getDPI() {
                return dpi;
            }
        });

        ViewportModel model = map.getViewportModelInternal();

        manager.setViewportModelInternal(model);

        model.setCRS(map.getViewportModel().getCRS());
        model.zoomToBox(map.getViewportModel().getBounds());

        ProjectUIPlugin.trace(ApplicationGIS.class,
                "Using bounds: " + map.getViewportModel().getBounds(), null); //$NON-NLS-1$

        model.setMapInternal(map);

        model
                .sizeChanged(new MapDisplayEvent(null, new java.awt.Dimension(0, 0),
                        new java.awt.Dimension(destinationSize.width,
                                destinationSize.height)));

        boundsStrategy.setBounds(model, baseMapBounds);
View Full Code Here

                new Coordinate(-128.6889, 59.0493), new Coordinate(-128.6898, 59.0493)};
        GeometryFactory fac=new GeometryFactory();
        Polygon lake = fac.createPolygon(fac.createLinearRing(coords), new LinearRing[0]);
        Envelope env = lake.getEnvelopeInternal();
       
        ViewportModel model = ((ViewportModel) handler.getContext().getMap().getViewportModel());
        model.setBounds(env);
        model.setWidth(env.getWidth()*200);
       
        handler.setEditBlackboard(new EditBlackboard(10, 10, model.worldToScreenTransform(),
                TestEditBlackboard.IDENTITY));

        EditBlackboard editBlackboard = handler.getEditBlackboard();
        editBlackboard.setGeometries(lake, "lake"); //$NON-NLS-1$
       
View Full Code Here

        if( resolutions == null ){
            return;
        }
        Display.getCurrent().asyncExec( new Runnable() {
            public void run() {
                ViewportModel model = map.getViewportModelInternal();

                double nextresolution = resolutions[ level ];

                // find the center of the screen
                double centerx = model.getCenter().x;
                double centery = model.getCenter().y;

                // using the next resolution, screen size, and center of the
                // screen
                // compute a bounding box
                double pixelwidth = viewport.getWidth();
                double newunitwidth = nextresolution * pixelwidth;
                double xmin = centerx - (newunitwidth / 2.0);
                double xmax = centerx + (newunitwidth / 2.0);
               
                double newunitheight = nextresolution * viewport.getHeight();
                double ymin = centery - (newunitheight / 2.0);
                double ymax = centery + (newunitheight / 2.0);

                // new bounding box
                ReferencedEnvelope re = new ReferencedEnvelope( xmin, xmax, ymin, ymax, model.getCRS() );

                // create a navigation command to update the viewport
                map.sendCommandSync( new SetViewportBBoxCommand(re) );
            }
        } );
View Full Code Here

                || tooSmallOnScreen(env)) {

            double d = env.getHeight() / 2;
            double e = env.getWidth() / 2;
           
            ViewportModel viewportModel = getMap().getViewportModelInternal();
      viewportModel.eSetDeliver(false);
            try {
        viewportModel.setBounds(
            env.getMinX() - e, env.getMaxX() + e,
            env.getMinY() - d, env.getMaxY() + d);
        return true;
      }finally{
              viewportModel.eSetDeliver(true);
            }
        } else {
          return false;
        }
      
View Full Code Here

                Rectangle imageBounds = worldImage.getBounds();
                int h = (int) ((float) canvasBounds.width * (float) imageBounds.height / (float) imageBounds.width);
                e.gc.drawImage(worldImage, 0, 0, imageBounds.width, imageBounds.height, 0, 0, canvasBounds.width, h);

                IMap activeMap = ApplicationGIS.getActiveMap();
                ViewportModel viewportModel = (ViewportModel) activeMap.getViewportModel();
                ReferencedEnvelope bounds = viewportModel.getBounds();

                CoordinateReferenceSystem mapCrs = viewportModel.getCRS();
                CoordinateReferenceSystem imageCrs = DefaultGeographicCRS.WGS84;
                try {
                    MathTransform transform = CRS.findMathTransform(mapCrs, imageCrs);
                    Envelope targetEnv = JTS.transform(bounds, transform);
                    double west = targetEnv.getMinX();
View Full Code Here

    private void updateData() {
        Display.getDefault().asyncExec(new Runnable(){
            public void run() {
                IMap activeMap = ApplicationGIS.getActiveMap();
                ViewportModel viewportModel = (ViewportModel) activeMap.getViewportModel();
                activeMap.addMapListener(NavigationView.this);
                activeMap.addMapCompositionListener(NavigationView.this);

                ReferencedEnvelope bounds = viewportModel.getBounds();

                double west = bounds.getMinX();
                double east = bounds.getMaxX();
                double north = bounds.getMaxY();
                double south = bounds.getMinY();

                if (lowerLeftText.isDisposed()) {
                    return;
                }
                lowerLeftText.setText(numFormatter.format(west) + ", " + numFormatter.format(south));
                upperRightText.setText(numFormatter.format(east) + ", " + numFormatter.format(north));

                canvas.redraw();

                SortedSet<Double> preferredScaleDenominators = viewportModel.getPreferredScaleDenominators();
                Double[] scalesArray = (Double[]) preferredScaleDenominators.toArray(new Double[preferredScaleDenominators.size()]);
                String[] scales = new String[scalesArray.length];
                for( int i = 0; i < scales.length; i++ ) {
                    scales[i] = "1:" + String.valueOf(scalesArray[i]);
                }
                int itemCount = scaleCombo.getItemCount();
                int selectionIndex = scaleCombo.getSelectionIndex();
                scaleCombo.setItems(scales);
                if (scales.length == itemCount) {
                    scaleCombo.select(selectionIndex);
                }

                List<DateTime> availableTimesteps = viewportModel.getAvailableTimesteps();
                if (availableTimesteps != null) {
                    dateTimeCombo.setEnabled(true);
                    dtDownButton.setEnabled(true);
                    dtUpButton.setEnabled(true);
                    String[] dates = new String[availableTimesteps.size()];
                    for( int i = 0; i < dates.length; i++ ) {
                        dates[i] = ISO_DATE_TIME_FORMATTER.print(availableTimesteps.get(i));
                    }
                    itemCount = dateTimeCombo.getItemCount();
                    selectionIndex = dateTimeCombo.getSelectionIndex();
                    dateTimeCombo.setItems(dates);
                    if (dates.length == itemCount) {
                        dateTimeCombo.select(selectionIndex);
                    }
                } else {
                    dateTimeCombo.setEnabled(false);
                    dtDownButton.setEnabled(false);
                    dtUpButton.setEnabled(false);
                }

                List<Double> availableElevation = viewportModel.getAvailableElevation();
                if (availableElevation != null) {
                    verticalCombo.setEnabled(true);
                    verticalDownButton.setEnabled(true);
                    verticalUpButton.setEnabled(true);
                    String[] elev = new String[availableElevation.size()];
View Full Code Here

TOP

Related Classes of org.locationtech.udig.project.internal.render.ViewportModel

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.