Package org.eclipse.draw2d.geometry

Examples of org.eclipse.draw2d.geometry.Dimension


        }
        setDirty(false);
    }

    private void drawErrorMessage( Graphics2D g, String message ) {
        Dimension size = getBox().getSize();
        g.setColor(Color.YELLOW);
        Rectangle2D bounds = g.getFontMetrics().getStringBounds(message, g);
        g.fillRect((int) (size.width / 2 - bounds.getWidth() / 2) - 2,
                (int) (size.height / 2 - bounds.getHeight() / 2) + 2, (int) bounds.getWidth() + 4,
                (int) bounds.getHeight() + 4);
View Full Code Here


        Envelope bounds;
        CoordinateReferenceSystem crs;
    }

    public boolean isNewPreviewNeeded() {
        final Dimension size = getBox().getSize();
        double aspectRatio = (double) size.height / (double) size.width;
        return super.isNewPreviewNeeded() || preview == null || current == null
                || !current.bounds.equals(map.getViewportModel().getBounds())
                || current.crs != map.getViewportModel().getCRS()
                || Math.abs(current.aspectRatio - aspectRatio) > 0.00001;
View Full Code Here

     *
     * @generated NOT
     */
    public Dimension createDimensionFromString( EDataType eDataType, String initialValue ) {
        String[] parts = initialValue.split(","); //$NON-NLS-1$
        Dimension dim;
        try {
            dim = new Dimension(Integer.parseInt(parts[0]), Integer.parseInt(parts[1]));
        } catch (Exception e) {
            PrintingModelPlugin.log("", e); //$NON-NLS-1$
            dim = new Dimension(0, 0);
        }
        return dim;
    }
View Full Code Here

     * <!-- begin-user-doc --> <!-- end-user-doc -->
     *
     * @generated NOT
     */
    public String convertDimensionToString( EDataType eDataType, Object instanceValue ) {
        Dimension dim = (Dimension) instanceValue;
        return dim.width + "," + dim.height; //$NON-NLS-1$
    }
View Full Code Here

     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public void setSize(Dimension newSize) {
        Dimension oldSize = size;
        size = newSize;
        if (eNotificationRequired())
            eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.ELEMENT__SIZE, oldSize, size));
    }
View Full Code Here

     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public void setPaperSize(Dimension newPaperSize) {
        Dimension oldPaperSize = paperSize;
        paperSize = newPaperSize;
        if (eNotificationRequired())
            eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.ELEMENT__PAPER_SIZE, oldPaperSize, paperSize));
    }
View Full Code Here

        return getBoxes();
    }

    @Override
    public void setSize( Dimension newSize ) {
        Dimension previousSize = getSize();
        if (previousSize != null) {
            int newW = newSize.width;
            int newH = newSize.height;
            int prevW = previousSize.width;
            int prevH = previousSize.height;

            float xScale = (float) prevW / (float) newW;
            float yScale = (float) prevH / (float) newH;

            List<Box> myboxes = getBoxes();
            for( Box box : myboxes ) {
                box.eSetDeliver(false);
                try {
                    Dimension boxSize = box.getSize();
                    int boxH = boxSize.height;
                    int boxW = boxSize.width;

                    float newBoxW = (float) boxW / xScale;
                    float newBoxH = (float) boxH / yScale;

                    box.setSize(new Dimension((int) newBoxW, (int) newBoxH));
                } finally {
                    box.eSetDeliver(true);
                }
            }
        }
View Full Code Here

        MapGraphicBoxPrinter scale = new MapGraphicBoxPrinter(null);
        scale.setMapGraphic(MapGraphicChooserDialog.findResource(ScalebarMapGraphic.class));
        scaleBox.setBoxPrinter(scale);
        scaleBox.setID("Scalebar Box"); //$NON-NLS-1$
        scaleBox.setLocation(new Point(MARGIN, height - MARGIN - scaleHeight));
        scaleBox.setSize(new Dimension(scaleWidth, scaleHeight));
        boxes.add(scaleBox);
    }
View Full Code Here

        }
        labelBox.setBoxPrinter(labelBoxPrinter);
        labelBox.setID("Standard Label"); //$NON-NLS-1$
        // TODO base it on the font
        int labelHeight = 30+LabelBoxPrinter.INSET*2;
        labelBox.setSize(new Dimension(labelWidth, labelHeight));
        labelBox.setLocation(new Point((width - labelWidth) / 2, MARGIN));
        boxes.add(labelBox);
        return labelHeight;
    }
View Full Code Here

        Rectangle mapBounds = new Rectangle(
                mapX,
                mapY,
                mapWidth,
                mapHeight);
        mapBox.setSize(new Dimension(mapBounds.width, mapBounds.height));

        mapBox.setLocation(new Point(mapBounds.x, mapBounds.y));
        boxes.add(mapBox);
        return mapBounds;
    }
View Full Code Here

TOP

Related Classes of org.eclipse.draw2d.geometry.Dimension

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.