Examples of Rectangle2D


Examples of java.awt.geom.Rectangle2D

      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

Examples of java.awt.geom.Rectangle2D

   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

Examples of java.awt.geom.Rectangle2D

                                        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

Examples of java.awt.geom.Rectangle2D

         * 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

Examples of java.awt.geom.Rectangle2D

        double displayHeight = availableImageHeight;

        double ratioX = 1f;
        double ratioY = 1f;
       
        Rectangle2D clip = null;

        Dimension2D dimension = renderer.getDimension();
        if (dimension != null)
        {
          normalWidth = dimension.getWidth();
          normalHeight = dimension.getHeight();
          displayWidth = normalWidth;
          displayHeight = normalHeight;
         
          float xalignFactor = getXAlignFactor(printImage);
          float yalignFactor = getYAlignFactor(printImage);

          switch (printImage.getScaleImageValue())
          {
            case CLIP:
            {
              xoffset = (int) (xalignFactor * (availableImageWidth - normalWidth));
              yoffset = (int) (yalignFactor * (availableImageHeight - normalHeight));
              clip =
                new Rectangle2D.Double(
                  - xoffset,
                  - yoffset,
                  availableImageWidth,
                  availableImageHeight
                  );
              break;
            }
            case FILL_FRAME:
            {
              ratioX = availableImageWidth / normalWidth;
              ratioY = availableImageHeight / normalHeight;
              normalWidth *= ratioX;
              normalHeight *= ratioY;
              xoffset = 0;
              yoffset = 0;
              break;
            }
            case RETAIN_SHAPE:
            default:
            {
              ratioX = availableImageWidth / normalWidth;
              ratioY = availableImageHeight / normalHeight;
              ratioX = ratioX < ratioY ? ratioX : ratioY;
              ratioY = ratioX;
              normalWidth *= ratioX;
              normalHeight *= ratioY;
              xoffset = (int) (xalignFactor * (availableImageWidth - normalWidth));
              yoffset = (int) (yalignFactor * (availableImageHeight - normalHeight));
              break;
            }
          }
        }

        PdfTemplate template = pdfContentByte.createTemplate((float)displayWidth, (float)displayHeight);

        Graphics2D g = forceSvgShapes
          ? template.createGraphicsShapes((float)displayWidth, (float)displayHeight)
          : template.createGraphics(availableImageWidth, availableImageHeight, new LocalFontMapper());

        if (clip != null)
        {
          g.setClip(clip);
        }
       
        if (printImage.getModeValue() == ModeEnum.OPAQUE)
        {
          g.setColor(printImage.getBackcolor());
          g.fillRect(0, 0, (int)displayWidth, (int)displayHeight);
        }

        Rectangle2D rectangle = new Rectangle2D.Double(0, 0, displayWidth, displayHeight);

        renderer.render(g, rectangle);
        g.dispose();

        pdfContentByte.saveState();
View Full Code Here

Examples of javafx.geometry.Rectangle2D

    maxBtn.setOnMouseClicked(new EventHandler<MouseEvent>() {
      @Override
      public void handle(MouseEvent event) {
                final double stageY = Utils.isMac() ? stage.getY() - 22 : stage.getY(); // TODO Workaround for RT-13980
                final Screen screen = Screen.getScreensForRectangle(stage.getX(), stageY, 1, 1).get(0);
                Rectangle2D bounds = screen.getVisualBounds();
                if (bounds.getMinX() == stage.getX() && bounds.getMinY() == stageY &&
                        bounds.getWidth() == stage.getWidth() && bounds.getHeight() == stage.getHeight()) {
                    if (backupWindowBounds != null) {
                        stage.setX(backupWindowBounds.getMinX());
                        stage.setY(backupWindowBounds.getMinY());
                        stage.setWidth(backupWindowBounds.getWidth());
                        stage.setHeight(backupWindowBounds.getHeight());
                        maxBtn.setImage(maxImage);
                    }
                } else {
                    backupWindowBounds = new Rectangle2D(stage.getX(), stage.getY(), stage.getWidth(), stage.getHeight());
                    final double newStageY = Utils.isMac() ? screen.getVisualBounds().getMinY() + 22 : screen.getVisualBounds().getMinY(); // TODO Workaround for RT-13980
                    stage.setX(screen.getVisualBounds().getMinX());
                    stage.setY(newStageY);
                    stage.setWidth(screen.getVisualBounds().getWidth());
                    stage.setHeight(screen.getVisualBounds().getHeight());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.