Package java.awt.geom

Examples of java.awt.geom.Rectangle2D


            }
        }

        if (mapBean != null) {
            if (selectedTiles != null && selectedTiles.length > 0) {
                Rectangle2D rec = null;
                for (int i = selectedTiles2.length - 1; i >= 0; i--) {
                    ImageTile tile = selectedTiles2[i];

                    if (rec == null) {
                        rec = new Rectangle2D.Float(tile.getLRLon(), tile.getLRLat(), 0f, 0f);
                        rec.add(tile.getULLon(), tile.getULLat());
                    } else {
                        rec.add(tile.getULLon(), tile.getULLat());
                        rec.add(tile.getLRLon(), tile.getLRLat());
                    }
                }

                if (rec != null) {
                    LatLonPoint center = new LatLonPoint(rec.getCenterY(), rec.getCenterX());
                    LatLonPoint anchor1 = new LatLonPoint(rec.getMaxY(), rec.getMinX());
                    LatLonPoint anchor2 = new LatLonPoint(rec.getMinY(), rec.getMaxX());

                    Proj proj = (Proj) mapBean.getProjection();

                    float scale = com.bbn.openmap.proj.ProjMath.getScale(anchor1,
                            anchor2,
View Full Code Here


    catch (JRException e)
    {
      throw new JRRuntimeException(e);
    }
   
    Rectangle2D rectangle = new Rectangle2D.Double(0, 0, chart.getWidth(), chart.getHeight());

    return
      ChartUtil.getChartRendererFactory(renderType).getRenderer(
        jfreeChart,
        null,
View Full Code Here

        legend.setPosition(getEdge(chartSettings.getLegendPosition(), RectangleEdge.BOTTOM));
      }
    }

    String renderType = chartSettings.getRenderType() == null ? defaultRenderType : chartSettings.getRenderType();
    Rectangle2D rectangle = new Rectangle2D.Double(0,0,element.getWidth(),element.getHeight());
   
    if (chartCustomizer != null)
    {
      chartCustomizer.customize(jfreechart, chartComponent);
    }
View Full Code Here

        if (_selectedElements.size() == 1) {
            ElementSelection ss=(ElementSelection) _selectedElements.get(0);
           
            if ( (! (ss instanceof ShapePointsSelection) ) && ss.element!=null && ss.element instanceof Resizable) {
               
                Rectangle2D b=ss.element.getBounds2D();
                b.setFrame(b.getX()+5.,b.getY()+5.,b.getWidth()-10.,b.getHeight()-10.);

                // look for the closest corner
                int oc=b.outcode(x,y);
                switch(oc){
                case Rectangle2D.OUT_TOP:
                    res = 1;
                    break;
                case Rectangle2D.OUT_TOP|Rectangle2D.OUT_RIGHT:
View Full Code Here

    /**
     * Draw shape bounds when the shape is selected
     * @param g2
     */
    public void drawBounds(Graphics2D g2) {
        Rectangle2D b=element.getBounds2D();

        int ox,oy,x,xb,y,w,h;
        ox=(int)b.getX();
        oy=(int)b.getY();
        w=(int)b.getWidth();
        h=(int)b.getHeight();

        //      draw a rectangle one pixel inside
        //      because fillRect goes to w-1, h-1 according to doc => it matchs at resolution 100%
        //      and also because g2.draw(b) does apply a Stroke, and then some garbage remains when
        //      the selected shape size change
View Full Code Here

     * @see simtools.diagram.gate.ConnectionPath#contains(double, double)
     */
    public boolean contains(double ox, double oy){
        boolean res = false;

        Rectangle2D area;
        Point p = new Point(firstPoint);
        for(int i=0;i< getSegmentNumber() && !res;i++){
            Segment s = getSegment(i);
            if (s instanceof HorizontalSegment){

                area = new Rectangle2D.Double(
                        p.x + (s.length<0? s.length : 0) - MAX_DISTANCE_FROM_SEGMENT,
                        p.y - MAX_DISTANCE_FROM_SEGMENT,
                        Math.abs(s.length) + 2* MAX_DISTANCE_FROM_SEGMENT,
                        2 * MAX_DISTANCE_FROM_SEGMENT
                );

                p.x += s.length;

            } else {
                area = new Rectangle2D.Double(
                        p.x - MAX_DISTANCE_FROM_SEGMENT,
                        p.y + (s.length<0? s.length : 0) - MAX_DISTANCE_FROM_SEGMENT,
                        2 * MAX_DISTANCE_FROM_SEGMENT,
                        Math.abs(s.length) + 2* MAX_DISTANCE_FROM_SEGMENT
                );

                p.y += s.length;
            }
            if (area.contains(ox, oy)){
                res = true;
            }
        }
        return res;
    }
View Full Code Here

      if (chartRenderingInfo==null) return false;

      XYPlot plot = (XYPlot)chart.getXYPlot();
     
      PlotRenderingInfo info = chartRenderingInfo.getPlotInfo();
      Rectangle2D dataArea = info.getDataArea();
      if (dataArea.contains(x, y)) {
        plot.setRangeCrosshairVisible(true);
        plot.setDomainCrosshairVisible(true);
       
        String msg = "";

        // set the crosshair value for the horizontal axis...
        ValueAxis da = plot.getDomainAxis();
        if (da != null) {
          double hvalue = da.translateJava2DToValue(x, info.getDataArea(),plot.getDomainAxisEdge());
          plot.setDomainCrosshairValue(hvalue,false);
          String label = da.getLabel();
          if ((label!=null) && (!label.equals(""))) msg += label;
          else msg+= resources.getString("X");
          msg += "=" + AxisLabelFormatter.labelFormat(hvalue);
        }

        // set the crosshair value for the vertical axis...
        ValueAxis ra = plot.getRangeAxis();
        if (ra != null) {
          double vvalue = ra.translateJava2DToValue(y, info.getDataArea(),plot.getRangeAxisEdge());
          plot.setRangeCrosshairValue(vvalue,false);
          if (!msg.equals("")) msg+="   ";
          String label = ra.getLabel();
          if ((label!=null) && (!label.equals(""))) msg += label;
          else msg+= resources.getString("Y");
          msg += "=" + AxisLabelFormatter.labelFormat(vvalue);
        }
        notifyChange(dataArea.getBounds());
        if (!msg.equals("")) JSynoptic.setStatus(msg);
      } else {
        plot.setRangeCrosshairVisible(false);
        plot.setDomainCrosshairVisible(false);
      }
View Full Code Here

   public void mousePressed (MouseEvent evt)
   {
      log.fine(".mousePressed");
      // this.graphicsNode.getGlobalTransform().deltaTransform(p0, p1);
      this.lastMousePosition = evt.getPoint();
      Rectangle2D rect = graphicsNode.getBounds();
//      double width  = rect.getX() * point.getX() / canvas.getWidth();
//      double height = rect.getY() * point.getY() / canvas.getHeight();
      Point2D point2D = new Point2D.Double();
//      point2D.setLocation(width, height);
      point2D.setLocation(this.lastMousePosition.getX(),
View Full Code Here

                                        null);
        
        FontRenderContext columnTopfrc = null;
        LineMetrics lm = null;
        DecimalFormat df = null;
        Rectangle2D fontRec = null;
        String columnTop = null;
        if (barTopFormat != null) {
            g.setFont(barTopFont);
            columnTopfrc = new FontRenderContext(null, false, false);
        }
        /* We paint the values starting at x-value "0".
         * As we only render BarCharts for ChartDataModels with
         * non-numeric x-axis values we don't have to read those
         * values from the data model. You can look in
         * ObjectChartDataModel to see, how the x-axis bounds
         * are defined: the minimum value is always 0, the maximum
         * value is the amount of non-numeric x-axis values.
         */
        for(int i = 0; i < datasetcount; i++) {
            //System.out.println("** DataSet "+i);
           
            for(int j = 0; j < m.getDataSetLength(i); j++) {
                yaxis1.transform(new Point2D.Float((float)j, m.getValueAt(i, j).floatValue()),
                                 value);
               
                Rectangle2D box =
                    new Rectangle2D.Float((float)(value.getX() + margin + i*boxwidth),
                                          (float)Math.min(value.getY(), pointzero.getY()),
                                          (float)boxwidth,
                                          (float)Math.abs(pointzero.getY() - value.getY()));
                   
View Full Code Here

         * ObjectChartDataModel to see, how the x-axis bounds
         * are defined: the minimum value is always 0, the maximum
         * value is the amount of non-numeric x-axis values.
         */
        double currentvalue = 0.0;
        Rectangle2D box = null;
        Point2D oldmaxvalue;
        Point2D oldminvalue;
       
        for(int j = 0; j < maximumDataSetLength; j++) {
            double minvalue = 0.0;
View Full Code Here

TOP

Related Classes of java.awt.geom.Rectangle2D

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.