List of usage examples for java.awt.geom Rectangle2D getMinY
public double getMinY()
From source file:org.gumtree.vis.mask.ChartMaskingUtilities.java
private static void drawMaskBoarder(Graphics2D g2, Abstract2DMask mask) { g2.setPaint(Color.orange);//from w ww. j a va 2 s. c om g2.setStroke(new BasicStroke(1)); Rectangle2D frame = mask.getRectangleFrame(); g2.draw(frame); Rectangle2D dragPoint = new Rectangle2D.Double(frame.getMinX() - maskDragPointHalfWidth, frame.getMinY() - maskDragPointHalfWidth, maskDragPointWidth, maskDragPointWidth); g2.fill(dragPoint); dragPoint.setRect(frame.getCenterX() - maskDragPointHalfWidth, frame.getMinY() - maskDragPointHalfWidth, maskDragPointWidth, maskDragPointWidth); g2.fill(dragPoint); dragPoint.setRect(frame.getMaxX() - maskDragPointHalfWidth, frame.getMinY() - maskDragPointHalfWidth, maskDragPointWidth, maskDragPointWidth); g2.fill(dragPoint); dragPoint.setRect(frame.getMaxX() - maskDragPointHalfWidth, frame.getCenterY() - maskDragPointHalfWidth, maskDragPointWidth, maskDragPointWidth); g2.fill(dragPoint); dragPoint.setRect(frame.getMinX() - maskDragPointHalfWidth, frame.getCenterY() - maskDragPointHalfWidth, maskDragPointWidth, maskDragPointWidth); g2.fill(dragPoint); dragPoint.setRect(frame.getMinX() - maskDragPointHalfWidth, frame.getMaxY() - maskDragPointHalfWidth, maskDragPointWidth, maskDragPointWidth); g2.fill(dragPoint); dragPoint.setRect(frame.getCenterX() - maskDragPointHalfWidth, frame.getMaxY() - maskDragPointHalfWidth, maskDragPointWidth, maskDragPointWidth); g2.fill(dragPoint); dragPoint.setRect(frame.getMaxX() - maskDragPointHalfWidth, frame.getMaxY() - maskDragPointHalfWidth, maskDragPointWidth, maskDragPointWidth); g2.fill(dragPoint); Color fillColor = new Color(250, 250, 50, 10); g2.setPaint(fillColor); g2.fill(mask.getShape()); }
From source file:org.gumtree.vis.mask.ChartMaskingUtilities.java
public static void drawMaskBoarder(Graphics2D g2, Rectangle2D frame) { g2.setPaint(Color.orange);/*from w w w . ja v a 2 s . c o m*/ g2.setStroke(new BasicStroke(1)); g2.draw(frame); Rectangle2D dragPoint = new Rectangle2D.Double(frame.getMinX() - maskDragPointHalfWidth, frame.getMinY() - maskDragPointHalfWidth, maskDragPointWidth, maskDragPointWidth); g2.fill(dragPoint); dragPoint.setRect(frame.getCenterX() - maskDragPointHalfWidth, frame.getMinY() - maskDragPointHalfWidth, maskDragPointWidth, maskDragPointWidth); g2.fill(dragPoint); dragPoint.setRect(frame.getMaxX() - maskDragPointHalfWidth, frame.getMinY() - maskDragPointHalfWidth, maskDragPointWidth, maskDragPointWidth); g2.fill(dragPoint); dragPoint.setRect(frame.getMaxX() - maskDragPointHalfWidth, frame.getCenterY() - maskDragPointHalfWidth, maskDragPointWidth, maskDragPointWidth); g2.fill(dragPoint); dragPoint.setRect(frame.getMinX() - maskDragPointHalfWidth, frame.getCenterY() - maskDragPointHalfWidth, maskDragPointWidth, maskDragPointWidth); g2.fill(dragPoint); dragPoint.setRect(frame.getMinX() - maskDragPointHalfWidth, frame.getMaxY() - maskDragPointHalfWidth, maskDragPointWidth, maskDragPointWidth); g2.fill(dragPoint); dragPoint.setRect(frame.getCenterX() - maskDragPointHalfWidth, frame.getMaxY() - maskDragPointHalfWidth, maskDragPointWidth, maskDragPointWidth); g2.fill(dragPoint); dragPoint.setRect(frame.getMaxX() - maskDragPointHalfWidth, frame.getMaxY() - maskDragPointHalfWidth, maskDragPointWidth, maskDragPointWidth); g2.fill(dragPoint); Color fillColor = new Color(250, 250, 50, 30); g2.setPaint(fillColor); g2.fill(frame); }
From source file:org.gumtree.vis.mask.ChartMaskingUtilities.java
public static double translateChartY(double chartY, Rectangle2D imageArea, JFreeChart chart) { XYPlot plot = chart.getXYPlot();/* ww w. jav a2s . c o m*/ boolean isRangeInverted = plot.getRangeAxis().isInverted(); Range rangeSection = plot.getRangeAxis().getRange(); if (!isRangeInverted) { return imageArea.getMinY() + (rangeSection.getUpperBound() - chartY) / rangeSection.getLength() * imageArea.getHeight(); } else { return imageArea.getMinY() + (chartY - rangeSection.getLowerBound()) / rangeSection.getLength() * imageArea.getHeight(); } }
From source file:de.hs.mannheim.modUro.controller.diagram.fx.interaction.ZoomHandlerFX.java
private double percentH(double y, Rectangle2D r) { return (y - r.getMinY()) / r.getHeight(); }
From source file:org.gumtree.vis.mask.ChartMaskingUtilities.java
public static Rectangle2D getDomainMaskFrame(RangeMask mask, Rectangle2D imageArea, JFreeChart chart) { XYPlot plot = chart.getXYPlot();/*from ww w.j a v a 2s .co m*/ // boolean isDomainInverted = plot.getDomainAxis().isInverted(); // Range domainRange = plot.getDomainAxis().getRange(); // Range imageRange = new Range(imageArea.getMinX(), imageArea.getMaxX()); // Range dataRange = translateDomainRange(mask.getRange(), // imageRange, domainRange, isDomainInverted); double lowerData = plot.getDomainAxis().valueToJava2D(mask.getMin(), imageArea, RectangleEdge.BOTTOM); double upperData = plot.getDomainAxis().valueToJava2D(mask.getMax(), imageArea, RectangleEdge.BOTTOM); return new Rectangle2D.Double(Math.min(lowerData, upperData), imageArea.getMinY(), Math.abs(upperData - lowerData), imageArea.getHeight()); }
From source file:com.rapidminer.gui.new_plotter.engine.jfreechart.legend.CustomLegendGraphic.java
@Override public void draw(Graphics2D g2, Rectangle2D area) { area = trimMargin(area);/*from www.j ava2 s . com*/ drawBorder(g2, area); area = trimBorder(area); area = trimPadding(area); if (isLineVisible()) { Point2D location = RectangleAnchor.coordinates(area, getShapeLocation()); Shape aLine = ShapeUtilities.createTranslatedShape(getLine(), getShapeAnchor(), location.getX(), location.getY()); g2.setPaint(getLinePaint()); g2.setStroke(getLineStroke()); g2.draw(aLine); } if (isShapeVisible()) { Point2D location = RectangleAnchor.coordinates(area, getShapeLocation()); Shape s = ShapeUtilities.createTranslatedShape(getShape(), getShapeAnchor(), location.getX(), location.getY()); if (isShapeFilled()) { Paint p = getFillPaint(); if (p instanceof GradientPaint) { GradientPaint gp = (GradientPaint) getFillPaint(); p = getFillPaintTransformer().transform(gp, s); } else if (p instanceof LinearGradientPaint) { LinearGradientPaint gradient = (LinearGradientPaint) p; Rectangle2D bounds = s.getBounds2D(); p = getTranslatedLinearGradientPaint(gradient, new Point2D.Double(bounds.getMinX(), bounds.getMinY()), new Point2D.Double(bounds.getMaxX(), bounds.getMaxY()), false); } g2.setPaint(p); g2.fill(s); } if (isShapeOutlineVisible()) { g2.setPaint(getOutlinePaint()); g2.setStroke(getOutlineStroke()); g2.draw(s); } } }
From source file:org.fhcrc.cpl.toolbox.gui.chart.ChartMouseAndMotionListener.java
/** * Draw a box to the left of the selected region, and one to the right, that together * encompass everything but the selection * * * @param selectedRegion//from w w w . j a va 2 s .c om * @param stroke * @param color */ protected void drawAllButSelectedRegionHoriz(Rectangle2D selectedRegion, Stroke stroke, Color color, boolean xorMode, Graphics2D g2) { Rectangle2D scaledDataArea = _chartPanel.getScreenDataArea(); Rectangle2D firstBox = new Rectangle((int) scaledDataArea.getMinX(), (int) scaledDataArea.getMinY(), (int) (selectedRegion.getMinX() - scaledDataArea.getMinX()), (int) scaledDataArea.getMaxY()); Rectangle2D secondBox = new Rectangle((int) selectedRegion.getMaxX(), (int) scaledDataArea.getMinY(), (int) (scaledDataArea.getMaxX() - selectedRegion.getMaxX()), (int) scaledDataArea.getMaxY()); drawSelectedRegion(firstBox, stroke, color, xorMode, g2); drawSelectedRegion(secondBox, stroke, color, xorMode, g2); }
From source file:org.fhcrc.cpl.toolbox.gui.chart.ChartMouseAndMotionListener.java
/** * Returns a point based on (x, y) but constrained to be within the bounds * of the given rectangle. This method could be moved to JCommon. * * @param x the x-coordinate.//from w w w. j a v a 2 s. com * @param y the y-coordinate. * @param area the rectangle (<code>null</code> not permitted). * * @return A point within the rectangle. */ protected Point getPointInRectangle(int x, int y, Rectangle2D area) { x = (int) Math.max(Math.ceil(area.getMinX()), Math.min(x, Math.floor(area.getMaxX()))); y = (int) Math.max(Math.ceil(area.getMinY()), Math.min(y, Math.floor(area.getMaxY()))); return new Point(x, y); }
From source file:it.unibo.alchemist.model.implementations.linkingrules.ConnectionBeam.java
@Override public Neighborhood<T> computeNeighborhood(final Node<T> center, final Environment<T> env) { final Neighborhood<T> normal = super.computeNeighborhood(center, env); if (oenv == null) { if (!(env instanceof Environment2DWithObstacles<?, ?>)) { return normal; }// ww w . j a v a2s.co m oenv = (Environment2DWithObstacles<?, ?>) env; obstacles.reset(); oenv.getObstacles().forEach((obs) -> { /* * Doubles are prone to approximation errors. Use nextAfter to get rid of them */ final Rectangle2D bounds = obs.getBounds2D(); final double mx = nextAfter(bounds.getMinX(), java.lang.Double.NEGATIVE_INFINITY); final double my = nextAfter(bounds.getMinY(), java.lang.Double.NEGATIVE_INFINITY); final double ex = nextUp(bounds.getMaxX()); final double ey = nextUp(bounds.getMaxY()); obstacles.add(new Area(new Rectangle2D.Double(mx, my, ex - mx, ey - my))); }); } if (!normal.isEmpty()) { final Position cp = env.getPosition(center); final List<Node<T>> neighs = normal.getNeighbors().stream().filter((neigh) -> { final Position np = env.getPosition(neigh); return !oenv.intersectsObstacle(cp, np) || projectedBeamOvercomesObstacle(cp, np); }).collect(ArrayList::new, (l, el) -> l.add(el), (l1, l2) -> l1.addAll(l2)); return Neighborhoods.make(env, center, neighs); } return normal; }
From source file:org.n52.server.sos.generator.EESGenerator.java
@Override public RepresentationResponse producePresentation(DesignOptions options) throws Exception { ChartRenderingInfo renderingInfo = new ChartRenderingInfo(new StandardEntityCollection()); String chartUrl = createChart(options, renderingInfo); Rectangle2D plotArea = renderingInfo.getPlotInfo().getDataArea(); for (Axis axis : renderer.getAxisMapping().values()) { axis.setMaxY(plotArea.getMaxY()); axis.setMinY(plotArea.getMinY()); }// w w w .j a va2 s.co m ImageEntity[] entities = {}; if (!this.isOverview) { LOGGER.debug("Produced EES diagram " + chartUrl); entities = createImageEntities(renderingInfo.getEntityCollection()); } else { LOGGER.debug("Produced EES Overview diagram " + chartUrl); } Bounds chartArea = new Bounds(plotArea.getMinX(), plotArea.getMaxX(), plotArea.getMinY(), plotArea.getMaxY()); return new EESDataResponse(chartUrl, options, chartArea, entities, renderer.getAxisMapping()); }