List of usage examples for java.awt.geom Point2D getY
public abstract double getY();
From source file:lu.lippmann.cdb.graph.mouse.CadralEditingGraphMousePlugin.java
/** * Function to draw the arrow while drawing * @param down//from ww w . j a v a 2s. c o m * @param out */ private void transformArrowShape(Point2D down, Point2D out) { float x1 = (float) down.getX(); float y1 = (float) down.getY(); float x2 = (float) out.getX(); float y2 = (float) out.getY(); AffineTransform xform = AffineTransform.getTranslateInstance(x2, y2); float dx = x2 - x1; float dy = y2 - y1; float thetaRadians = (float) Math.atan2(dy, dx); xform.rotate(thetaRadians); arrowShape = xform.createTransformedShape(rawArrowShape); }
From source file:lu.lippmann.cdb.graph.mouse.CadralEditingGraphMousePlugin.java
/** * Function to create the edge shape while drawing * @param down/*from w w w. jav a 2s. c o m*/ * @param out */ private void transformEdgeShape(Point2D down, Point2D out) { float x1 = (float) down.getX(); float y1 = (float) down.getY(); float x2 = (float) out.getX(); float y2 = (float) out.getY(); AffineTransform xform = AffineTransform.getTranslateInstance(x1, y1); float dx = x2 - x1; float dy = y2 - y1; float thetaRadians = (float) Math.atan2(dy, dx); xform.rotate(thetaRadians); float dist = (float) Math.sqrt(dx * dx + dy * dy); xform.scale((double) dist / rawEdge.getBounds().getWidth(), 1.0d); edgeShape = xform.createTransformedShape(rawEdge); }
From source file:org.mwc.cmap.grideditor.chart.DataPointsDragTracker.java
public void chartMouseReleased(final ChartMouseEvent event) { if (!myDragSubject.isEmpty() && myDragSubject.getLastDomainPoint() != null) { try {// w w w. j a v a 2 s . c om final Point2D finalPoint = myDragSubject.getLastDomainPoint(); dragCompleted(myDragSubject.getDraggedItem(), finalPoint.getX(), finalPoint.getY()); } catch (final Exception e) { e.printStackTrace(); } } if (!myDragSubject.isEmpty()) { myDragSubject.setSubject(null); myChartPanel.redrawCanvas(); } }
From source file:inflor.core.gates.ui.RectangleGateAnnotation.java
@Override public boolean matchesVertex(Point2D v, double xHandleSize, double yHandleSize) { double xMin = (v.getX() - xHandleSize); double xMax = (v.getX() + xHandleSize); double yMin = (v.getY() - yHandleSize); double yMax = (v.getY() + yHandleSize); boolean xMatches = false; boolean yMatches = false; if ((xMin <= x0 && x0 <= xMax) || (xMin <= x1 && x1 <= xMax)) { xMatches = true;//from ww w . j av a 2s .c om } if ((yMin <= y0 && y0 <= yMax) || (yMin <= y1 && y1 <= yMax)) { yMatches = true; } if (xMatches && yMatches) { return true; } return false; }
From source file:com.projity.pm.graphic.xbs.XbsLayout.java
protected int updateBounds(Point2D origin, Rectangle2D ref) {//cache in current version isn't a tree double x = origin.getX() + ref.getWidth() / 2; double y = origin.getY() + ref.getHeight() / 2; GraphicNode node, previous = null;// w w w. ja v a 2 s .c o m int maxLevel = 0; for (ListIterator i = cache.getIterator(); i.hasNext();) { node = (GraphicNode) i.next(); if (node.getLevel() > maxLevel) maxLevel = node.getLevel(); if (previous != null && node.getLevel() <= previous.getLevel()) { setShape(previous, ref, x, y + (previous.getLevel() - 1) * (ref.getMaxY())); x += ref.getMaxX(); } previous = node; } if (previous != null) { setShape(previous, ref, x, y + (previous.getLevel() - 1) * (ref.getMaxY())); } return maxLevel; }
From source file:org.gvsig.symbology.fmap.symbols.JFreeChartSymbol.java
public void draw(Graphics2D g, AffineTransform affineTransform, FShape shp, Cancellable cancel) { FPoint2D fp = (FPoint2D) shp;/* w w w . j a v a 2s .c o m*/ Point2D p = new Point2D.Double(fp.getX(), fp.getY()); if (renderPlot == null) { renderPlot = getMapPlot(); } double size = getSize(); double halfSize = size * 0.5; double minx = p.getX() - halfSize; double miny = p.getY() - halfSize; renderPlot.draw(g, new Rectangle2D.Double(minx, miny, size, size), p, plotState, plotRenderingInfo); }
From source file:pt.lsts.neptus.plugins.wg.WgCtdLayer.java
private boolean isVisibleInRender(Point2D sPos, StateRenderer2D renderer) { Dimension rendDim = renderer.getSize(); if (sPos.getX() < 0 && sPos.getY() < 0) return false; else if (sPos.getX() > rendDim.getWidth() && sPos.getY() > rendDim.getHeight()) return false; return true;/*from w w w. j ava 2 s . c o m*/ }
From source file:be.ugent.maf.cellmissy.gui.view.renderer.jfreechart.ExtendedBoxAndWhiskerRenderer.java
/** * Creates a dot to represent an outlier. * * @param point the location./*w ww . j av a2 s . c om*/ * @param oRadius the outlier radius. * */ private Shape createEllipse(Point2D point, double oRadius) { return new Ellipse2D.Double(point.getX(), point.getY(), oRadius * 2.0, oRadius * 2.0); }
From source file:org.owasp.benchmark.score.report.ScatterTools.java
private void makeDataLabels(OverallResults or, XYPlot xyplot) { HashMap<Point2D, String> map = makePointList(or); for (Entry<Point2D, String> e : map.entrySet()) { if (e.getValue() != null) { Point2D p = e.getKey(); String label = sort(e.getValue()); XYTextAnnotation annotation = new XYTextAnnotation(label, p.getX(), p.getY()); annotation.setTextAnchor(p.getX() < 3 ? TextAnchor.TOP_LEFT : TextAnchor.TOP_CENTER); annotation.setBackgroundPaint(Color.white); // set color of average to black and everything else to blue if (averageLabel == label.toCharArray()[0]) { annotation.setPaint(Color.magenta); } else { annotation.setPaint(Color.blue); }/*from w w w . j ava2s . co m*/ annotation.setFont(theme.getRegularFont()); xyplot.addAnnotation(annotation); } } }
From source file:views.network.MyRadialTreeLayout.java
private void setRadialLocations() { Point2D max = getMaxXY(); double maxx = max.getX(); double maxy = max.getY(); maxx = Math.max(maxx, size.width); double theta = 2 * Math.PI / maxx; double deltaRadius = Math.min(size.width, size.height) / 2 / maxy; for (Map.Entry<V, Point2D> entry : locations.entrySet()) { V v = entry.getKey();//from ww w.j av a 2 s . c om Point2D p = entry.getValue(); PolarPoint polarPoint = new PolarPoint(p.getX() * theta, (p.getY() - 50) * deltaRadius); polarLocations.put(v, polarPoint); } }