/** * Sets the angle and radius of this point to those of {@code p}. * @param p the point whose location is copied into this instance */ public void setLocation(PolarPoint p) { this.theta = p.getTheta(); this.radius = p.getRadius(); } }
/** * Sets the angle and radius of this point to those of {@code p}. */ public void setLocation(PolarPoint p) { this.theta = p.getTheta(); this.radius = p.getRadius(); } }
private Collection<Double> getDepths() { Set<Double> depths = new HashSet<Double>(); Map<String,PolarPoint> polarLocations = radialLayout.getPolarLocations(); for(String v : graph.getVertices()) { PolarPoint pp = polarLocations.get(v); depths.add(pp.getRadius()); } return depths; }
private Collection<Double> getDepths() { Set<Double> depths = new HashSet<Double>(); Map<String,PolarPoint> polarLocations = radialLayout.getPolarLocations(); for(String v : graph.getVertices()) { PolarPoint pp = polarLocations.get(v); depths.add(pp.getRadius()); } return depths; }
private Collection<Double> getDepths() { Set<Double> depths = new HashSet<Double>(); Map<String,PolarPoint> polarLocations = radialLayout.getPolarLocations(); for(String v : graph.getVertices()) { PolarPoint pp = polarLocations.get(v); depths.add(pp.getRadius()); } return depths; }
private Collection<Double> getDepths() { Set<Double> depths = new HashSet<Double>(); Map<String,PolarPoint> polarLocations = radialLayout.getPolarLocations(); for(String v : graph.getVertices()) { PolarPoint pp = polarLocations.get(v); depths.add(pp.getRadius()); } return depths; }
/** * Returns the result of converting <code>polar</code> to Cartesian coordinates. */ public static Point2D polarToCartesian(PolarPoint polar) { return polarToCartesian(polar.getTheta(), polar.getRadius()); }
/** * @param polar the input location to convert * @return the result of converting <code>polar</code> to Cartesian coordinates. */ public static Point2D polarToCartesian(PolarPoint polar) { return polarToCartesian(polar.getTheta(), polar.getRadius()); }
private Point2D _transform(Point2D graphPoint) { if(graphPoint == null) return null; Point2D viewCenter = getViewCenter(); double viewRadius = getViewRadius(); double ratio = getRatio(); // transform the point from the graph to the view Point2D viewPoint = graphPoint; // calculate point from center double dx = viewPoint.getX() - viewCenter.getX(); double dy = viewPoint.getY() - viewCenter.getY(); // factor out ellipse dx *= ratio; Point2D pointFromCenter = new Point2D.Double(dx, dy); PolarPoint polar = PolarPoint.cartesianToPolar(pointFromCenter); double theta = polar.getTheta(); double radius = polar.getRadius(); if(radius > viewRadius) return viewPoint; double mag = magnification; radius *= mag; radius = Math.min(radius, viewRadius); Point2D projectedPoint = PolarPoint.polarToCartesian(theta, radius); projectedPoint.setLocation(projectedPoint.getX()/ratio, projectedPoint.getY()); Point2D translatedBack = new Point2D.Double(projectedPoint.getX()+viewCenter.getX(), projectedPoint.getY()+viewCenter.getY()); return translatedBack; }
double radius = polar.getRadius();
double radius = polar.getRadius(); if(radius > viewRadius) return delegate.inverseTransform(viewPoint);
double radius = polar.getRadius(); if(radius > viewRadius) return viewPoint;
/** * override base class to un-project the fisheye effect */ private Point2D _inverseTransform(Point2D viewPoint) { viewPoint = delegate.inverseTransform(viewPoint); Point2D viewCenter = getViewCenter(); double viewRadius = getViewRadius(); double ratio = getRatio(); double dx = viewPoint.getX() - viewCenter.getX(); double dy = viewPoint.getY() - viewCenter.getY(); // factor out ellipse dx *= ratio; Point2D pointFromCenter = new Point2D.Double(dx, dy); PolarPoint polar = PolarPoint.cartesianToPolar(pointFromCenter); double radius = polar.getRadius(); if(radius > viewRadius) return viewPoint; double mag = magnification; radius /= mag; polar.setRadius(radius); Point2D projectedPoint = PolarPoint.polarToCartesian(polar); projectedPoint.setLocation(projectedPoint.getX()/ratio, projectedPoint.getY()); Point2D translatedBack = new Point2D.Double(projectedPoint.getX()+viewCenter.getX(), projectedPoint.getY()+viewCenter.getY()); return translatedBack; }
double radius = polar.getRadius(); if(radius > viewRadius) return viewPoint;//elegate.inverseTransform(viewPoint);
double radius = polar.getRadius(); if(radius > viewRadius) return viewPoint;
double radius = polar.getRadius(); if(radius > viewRadius) return viewPoint;
/** * override base class to un-project the fisheye effect */ public Point2D inverseTransform(Point2D viewPoint) { Point2D viewCenter = getViewCenter(); double viewRadius = getViewRadius(); double ratio = getRatio(); double dx = viewPoint.getX() - viewCenter.getX(); double dy = viewPoint.getY() - viewCenter.getY(); // factor out ellipse dx *= ratio; Point2D pointFromCenter = new Point2D.Double(dx, dy); PolarPoint polar = PolarPoint.cartesianToPolar(pointFromCenter); double radius = polar.getRadius(); if(radius > viewRadius) return delegate.inverseTransform(viewPoint); double mag = magnification; radius /= mag; polar.setRadius(radius); Point2D projectedPoint = PolarPoint.polarToCartesian(polar); projectedPoint.setLocation(projectedPoint.getX()/ratio, projectedPoint.getY()); Point2D translatedBack = new Point2D.Double(projectedPoint.getX()+viewCenter.getX(), projectedPoint.getY()+viewCenter.getY()); return delegate.inverseTransform(translatedBack); }