@@ -0,0 +1,1914 @@
+package org.csstudio.sds.components.ui.internal.figureparts;%0A%0Aimport org.eclipse.draw2d.geometry.Point;%0Aimport org.eclipse.draw2d.geometry.Rectangle;%0A%0Apublic class PolarPoint %7B%0A%09%0A%09/**%0A%09 * The radial coordinate %0A%09 */%0A%09public int r;%0A%09%0A%09%0A%09/**%0A%09 * The angular coordinate in radians%0A%09 */%0A%09public double theta;%09%0A%09%0A%09/**%0A%09 * @param r%0A%09 * @param theta%0A%09 */%0A%09public PolarPoint(int r, double theta) %7B%0A%09%09this.r = r;%0A%09%09this.theta = theta;%0A%09%7D%0A%09%0A%09@Override%0A%09public boolean equals(Object obj) %7B%0A%09%09if(obj instanceof PolarPoint) %7B%0A%09%09%09PolarPoint p = (PolarPoint)obj;%0A%09%09%09return p.r == r && p.theta == theta;%0A%09%09%7D%0A%09%09return false;%0A%09%7D%0A%09%0A%09/**%0A%09 * Transform the polar point to the %7B@link Point%7D in rectangular coordinates. %0A%09 * The rectangular coordinates has the same origin as the polar coordinates.%0A%09 * @return the point in rectangular coordinates%0A%09 */%0A%09public Point toPoint() %7B%0A%09%09int x = (int) (r * Math.cos(theta));%0A%09%09int y = (int) (-r * Math.sin(theta));%0A%09%09return new Point(x, y);%09%09%0A%09%7D%09%0A%09%0A%09/**%0A%09 * Transform the polar point to the %7B@link Point%7D in the absolute coordinate system.%0A%09 * It is assumed that the origin of the polar coordinate system is the central point of %0A%09 * the rectangle. %0A%09 * @param rect the paint area of the figure %0A%09 * @return the point in absolute coordinate system.%0A%09 */%0A%09public Point toAbsolutePoint(Rectangle rect) %7B%0A%09%09Point p = this.toPoint();%0A%09%09return p.translate(rect.width/2, rect.height/2).translate(%0A%09%09%09%09rect.x, rect.y);%0A%09%7D%0A%09%0A%09/**Transform the polar point to the %7B@link Point%7D in the relative coordinate system, %0A%09 * whose origin is (rect.x, rect.y). %0A%09 * It is assumed that the origin of the polar coordinate system is the central point of %0A%09 * the rectangle. %0A%09 * @param rect the paint area of the figure%0A%09 * @return the point in relative coordinate system.%0A%09 */%0A%09public Point toRelativePoint(Rectangle rect) %7B%0A%09%09Point p = this.toPoint();%0A%09%09return p.translate(rect.width/2, rect.height/2);%09%09%0A%09%7D%0A%09%0A%09%0A%7D%0A

add this which is usable for round scale