Package java.awt

Examples of java.awt.Rectangle


                currentEditable.getStateMachine().setSelected();
                currentEditable.redraw(me, true);

                Shape ces = currentEditable.getGraphic().getShape();
                if (ces != null) {
                    Rectangle rect = ces.getBounds();
                    windowx = (int) rect.getX();
                    windowy = (int) rect.getY() - 50;
                }
            }

            /**
             * Let's see if we should bring up pop-up menu with all sorts of
             * lovely options - if the right mouse key was pressed, or if the
             * ctrl key was pressed with the mouse button being released,
             * display the option menu. Otherwise, just get ready to end.
             */
            doPopup(me.getX(), me.getY(), null);
        } else if (event.shouldDeactivate()) {
            if (DEBUG) {
                Debug.output("OMDrawingTool.eomgChanged(): omdt being told to deactivate");
            }

            if (isMask(USE_POPUP_BEHAVIOR_MASK) && !getUseAsTool()) {
                EditableOMGraphic eomg = getCurrentEditable();
                if (eomg != null) {
                    java.awt.Shape shape = eomg.getGraphic().getShape();
                    Rectangle rect = shape.getBounds();

                    Vector vec = new Vector();
                    vec.add(new JSeparator());

                    JMenuItem done = new JMenuItem("Done");
                    done.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent ae) {
                            deactivate();
                        }
                    });
                    vec.add(done);

                    if (!doPopup((int) (rect.getX() + rect.getWidth()),
                            (int) (rect.getY() + rect.getHeight()),
                            vec)) {
                        deactivate();
                    }
                }
            } else {
View Full Code Here


                BufferedImage bi = BufferedImageHelper.getBufferedImage(fillPatternURL,
                        0,
                        0,
                        -1,
                        -1);
                texture = new TexturePaint(bi, new Rectangle(0, 0, bi.getWidth(), bi.getHeight()));
            }
        } catch (InterruptedException ie) {
            Debug.error("PoliticalArea.setFillPattern(): error getting texture image - \n"
                    + ie);
        }
View Full Code Here

        Point p1 = proj.forward(proj.getUpperLeft());
        Point p2 = proj.forward(proj.getLowerRight());
        int h = (int) (p2.getY() - p1.getY());
        int w = (int) (p2.getX() - p1.getX());

        Rectangle mapRect = new Rectangle((int) p1.getX(), (int) p1.getY(), w, h);

        return mapRect.intersects(shape.getBounds());
    }
View Full Code Here

        setAnchor(loc);
    }

    public void setLocation(GeneralPath gp) {
        if (gp != null) {
            Rectangle rect = gp.getBounds();

            double x = rect.getX();
            double y = rect.getY();

            if (anchor == ANCHOR_TOP || anchor == ANCHOR_CENTER
                    || anchor == ANCHOR_BOTTOM) {
                x += rect.getWidth() / 2;
            } else if (anchor == ANCHOR_TOPRIGHT || anchor == ANCHOR_RIGHT
                    || anchor == ANCHOR_BOTTOMRIGHT) {
                x += rect.getWidth();
            }

            if (anchor == ANCHOR_LEFT || anchor == ANCHOR_CENTER
                    || anchor == ANCHOR_RIGHT) {
                y += rect.getHeight() / 2;
            } else if (anchor == ANCHOR_BOTTOMLEFT || anchor == ANCHOR_BOTTOM
                    || anchor == ANCHOR_BOTTOMRIGHT) {
                y += rect.getHeight();
            }

            setLocation(new Point((int) x, (int) y));
        }
    }
View Full Code Here

            }
            return;
        }

        // Get the projection window rectangle in pix
        Rectangle winRect = new Rectangle(thisProj.getWidth(), thisProj.getHeight());
        // Get image projection rectangle
        Rectangle projRect = new Rectangle();
        projRect.setLocation(point1);
        projRect.setSize(point2.x - point1.x, point2.y - point1.y);

        Rectangle sourceRect = new Rectangle();
        sourceRect.width = sourceImage.getWidth();
        sourceRect.height = sourceImage.getHeight();

        // Now we have everything we need to sort out this new
        // projection.
        // boolean currentVisibility = isVisible();

        // Assume we will not see it, in order to see if any part of
        // the
        // image will appear on map. If so, then reset visibility to
        // what's needed.
        // setVisible(false);
        clipRect = null;

        Rectangle iRect = winRect.intersection(projRect);
        if (!iRect.isEmpty()) {
            // Now we have the visible rectangle of the projected
            // image we need to figure out which pixels from the
            // source image get scaled to produce it.

            // Assume will need whole image, set the clipRect so it's
            // on the map, somewhere.
            clipRect = new Rectangle();
            clipRect.setBounds(sourceRect);

            // If big enough to see
            if ((iRect.width >= 1) && (iRect.height >= 1)) {
View Full Code Here

        Point p1 = proj.forward(lat, lon);
        Point p2 = proj.forward(lat2, lon2);
        int h = (int) Math.abs(p2.getY() - p1.getY());
        int w = (int) Math.abs(p2.getX() - p1.getX());

        Rectangle imageRect = new Rectangle((int) p1.getX(), (int) p1.getY(), w, h);

        proj.forward(proj.getUpperLeft(), p1);
        proj.forward(proj.getLowerRight(), p2);
        h = (int) Math.abs(p2.getY() - p1.getY());
        w = (int) Math.abs(p2.getX() - p1.getX());

        Rectangle mapRect = new Rectangle((int) p1.getX(), (int) p1.getY(), w, h);

        return mapRect.intersects(imageRect);
    }
View Full Code Here

    final MasterReport report = new MasterReport();
    final StaticDataFactory staticDataFactory = new StaticDataFactory();
    report.setDataFactory(staticDataFactory);
    report.setQuery("org.pentaho.reporting.engine.classic.testcases.base.functionality.demohandler.SubReportProcessingCrashTestHandler#createMainTableModel()");

    final Element textElement = TextFieldElementFactory.createStringElement("reportField1", new Rectangle(0, 0, 100, 20), Color.BLACK, ElementAlignment.LEFT, ElementAlignment.TOP, new FontDefinition("Arial", 12), "-", "c1");
    report.getItemBand().addElement(textElement);

    final SubReport subReport = new SubReport();
    subReport.addInputParameter("c1", "c1");

    subReport.setQuery("org.pentaho.reporting.engine.classic.testcases.base.functionality.demohandler.SubReportProcessingCrashTestHandler#createSubReportTableModel(c1)");
    final Element subReportTextElement = TextFieldElementFactory.createStringElement("subreportField1", new Rectangle(20, 0, 100, 20), Color.RED, ElementAlignment.LEFT, ElementAlignment.TOP, new FontDefinition("Arial", 12), "-", "t1");
    subReport.getItemBand().addElement(subReportTextElement);
    report.getItemBand().addSubReport(subReport);

    final Element textElementT1 = TextFieldElementFactory.createStringElement("reportFieldT1", new Rectangle(0, 20, 100, 20), Color.BLACK, ElementAlignment.LEFT, ElementAlignment.TOP, new FontDefinition("Arial", 12), "-", "t2");
    report.getItemBand().addElement(textElementT1);

    final ParameterMapping[] parameterMappings = subReport.getExportMappings();

    for (int i = 0; i < parameterMappings.length; i++)
View Full Code Here

        double rw = 0.0;
        double woffset = 0.0;

        if (g instanceof Graphics2D && rotationAngle != DEFAULT_ROTATIONANGLE) {

            Rectangle rect = polyBounds.getBounds();

            rx = rect.getX();
            rw = rect.getWidth();
            woffset = 0.0;

            switch (justify) {
            case JUSTIFY_LEFT:
                // woffset = 0.0;
View Full Code Here

                // Make sure the shape takes into account the current
                // rotation angle. Code taken from generate() method,
                // so it should match up with the drawn text.
                if (rotationAngle != DEFAULT_ROTATIONANGLE) {

                    Rectangle rect = polyBounds.getBounds();

                    double rx = rect.getX();
                    double rw = rect.getWidth();
                    double woffset = 0.0;

                    switch (justify) {
                    case JUSTIFY_LEFT:
                        // woffset = 0.0;
View Full Code Here

    public OMGraphic getPointIntersectionImage(OMGraphic omg) {
        Shape s = omg.getShape();
        Projection p = getProjection();
        if (s != null && p != null && omg instanceof OMPoly) {
            Rectangle r = s.getBounds();

            double x = r.getX();
            double y = r.getY();
            double h = r.getHeight();
            double w = r.getWidth();
            float[] rawll = ((OMPoly) omg).getLatLonArray();
            LatLonPoint llHolder = new LatLonPoint();
            Geo g = new Geo(0, 0);
            int[] pix = new int[(int) (h * w)];

 
View Full Code Here

TOP

Related Classes of java.awt.Rectangle

Copyright © 2015 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.