Package org.locationtech.udig.project.render.displayAdapter

Examples of org.locationtech.udig.project.render.displayAdapter.IMapDisplay


    }

    protected void finalizeLabelPainter( IRenderContext context2 ) {
        String layerId = getLayerId(context2);

        IMapDisplay mapDisplay = context2.getMapDisplay();
        if( mapDisplay==null ){
          return;
        }
    Dimension displaySize = context2.getImageSize();
        Graphics2D graphics=context2.getImage().createGraphics();
View Full Code Here


    /**
     * <!-- begin-user-doc --> <!-- end-user-doc -->
     * @generated
     */
    public void setMapDisplay(IMapDisplay newMapDisplay) {
        IMapDisplay oldMapDisplay = mapDisplay;
        mapDisplay = newMapDisplay;
        if (eNotificationRequired())
            eNotify(new ENotificationImpl(this, Notification.SET,
                    RenderPackage.RENDER_MANAGER__MAP_DISPLAY, oldMapDisplay, mapDisplay));
    }
View Full Code Here

    public void setBoundsInternal(Envelope newBounds, boolean forceContainBBoxZoom) {
        Envelope finalBounds = newBounds;
        if (getDefaultPreferredScaleDenominators() != getPreferredScaleDenominators()
                && validState()) {
            IMapDisplay mapDisplay = getRenderManagerInternal().getMapDisplay();
            ReferencedEnvelope referenced;
            if (newBounds instanceof ReferencedEnvelope) {
                referenced = (ReferencedEnvelope) newBounds;
            } else {
                referenced = new ReferencedEnvelope(newBounds, getCRS());
            }
            double scale = ScaleUtils.calculateScaleDenominator(referenced,
                    mapDisplay.getDisplaySize(), mapDisplay.getDPI());
            scale = ScaleUtils.calculateClosestScale(getPreferredScaleDenominators(), scale,
                    ScaleUtils.zoomClosenessPreference());

            finalBounds = ScaleUtils.calculateBoundsFromScale(scale, mapDisplay.getDisplaySize(),
                    mapDisplay.getDPI(), referenced);
            if (forceContainBBoxZoom && !finalBounds.contains(newBounds)) {
                Iterator<Double> tail = getPreferredScaleDenominators().tailSet(scale).iterator();
                // the tail will include scale because scale is one of the elements in the set.  So drop that
                tail.next();
                Double nextLargest = tail.next();
                if (nextLargest != null) {
                    finalBounds = ScaleUtils.calculateBoundsFromScale(nextLargest,
                            mapDisplay.getDisplaySize(), mapDisplay.getDPI(), referenced);
                }
            }
        }

        Envelope oldBounds = bounds == null ? new Envelope() : bounds;
View Full Code Here

     * @see org.locationtech.udig.project.internal.render.ViewportModel#zoomToBox(com.vividsolutions.jts.geom.Envelope)
     */
    public void zoomToBox(Envelope newbbox) {
        setInitialized(true);
        if (Math.abs(newbbox.getWidth() / newbbox.getHeight() - this.getAspectRatio()) > ACCURACY) {
            IMapDisplay display = this.getRenderManagerInternal().getMapDisplay();
            double scaley = newbbox.getHeight() / display.getHeight();
            double scalex = newbbox.getWidth() / display.getWidth();
            double scale;
            if (scalex > scaley)
                scale = scalex;
            else
                scale = scaley;

            double height = display.getHeight() * scale;
            double width = display.getWidth() * scale;

            double dw = width / 2, dh = height / 2;
            Envelope mapBounds = newbbox;
            double x = (mapBounds.getMaxX() + mapBounds.getMinX()) / 2;
            double y = (mapBounds.getMaxY() + mapBounds.getMinY()) / 2;
View Full Code Here

     *
     * @return
     */
    public Dimension getImageSize(){
        if (imagesize == null){
            IMapDisplay mapDisplay = getMapDisplay();
            if( mapDisplay == null ){
                return null;
            }
            return mapDisplay.getDisplaySize();
        }else{
            return imagesize;
        }
    }
View Full Code Here

        RenderManager renderManager = getRenderManagerInternal();
        ReferencedEnvelope bounds2 = getBounds();
        if (renderManager == null || renderManager.getMapDisplay() == null)
            return -1;

        IMapDisplay display = renderManager.getMapDisplay();
        return ScaleUtils.calculateScaleDenominator(bounds2, display.getDisplaySize(),
                display.getDPI());

    }
View Full Code Here

     * This method will calculate the current width based on ScaleUtils and
     * the current RenderManager.
     */
    public void setScale(double scaleDenominator) {
        RenderManager rm = getRenderManagerInternal();
        IMapDisplay display = rm.getMapDisplay();
        ReferencedEnvelope newExtents = ScaleUtils.calculateBoundsFromScale(scaleDenominator,
                display.getDisplaySize(), display.getDPI(), getBounds());
        setWidth(newExtents.getWidth());
    }
View Full Code Here

        IRenderManager renderManager = layer.getMap().getRenderManager();
        if( renderManager==null ){
            // no render manager and therefore no scale to calculate.
            return requestedBounds;
        }
        IMapDisplay mapDisplay = renderManager.getMapDisplay();

        return ScaleUtils.calculateBoundsFromScale(scaleDenominator, mapDisplay
                .getDisplaySize(), mapDisplay.getDPI(), requestedBounds);
    }
View Full Code Here

   * <!-- begin-user-doc --> <!-- end-user-doc -->
   *
   * @generated
   */
  public void setDisplayGen(IMapDisplay newDisplay) {
    IMapDisplay oldDisplay = mapDisplay;
    mapDisplay = newDisplay;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET,
          RenderPackage.RENDER_MANAGER__MAP_DISPLAY, oldDisplay,
          mapDisplay));
View Full Code Here

                .trace(
                        ApplicationGIS.class,
                        "Firing size changed event. Changing to size: " + destinationSize.width + " by " + destinationSize.height, null); //$NON-NLS-1$ //$NON-NLS-2$

        manager.setMapInternal(map);
        manager.setMapDisplay(new IMapDisplay(){
            public java.awt.Dimension getDisplaySize() {
                return new java.awt.Dimension(destinationSize.width,
                        destinationSize.height);
            }
View Full Code Here

TOP

Related Classes of org.locationtech.udig.project.render.displayAdapter.IMapDisplay

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.