Commit a0080fb5 authored by Nico Mack's avatar Nico Mack

Added euclidianDistance method to PolarCoordinateHelper.

Added LayerColourScale node to Templating. This should be properly
refactored into the Tulip-GIS extension
parent 24dbdd0a
NUMBER_OF_LAYERS_PROPERTY=NumberOfLayers
LAYER_NAME_PROPERTY=LayerName
LAYER_COLOUR_SCALE_PROPERTY=LayerColourScale
HANDLE_ID_PROPERTY=HandleId
LAYER_ID_PROPERTY=LayerId
PERSISTENT_PROPERTY=Persistent
......
......@@ -53,6 +53,17 @@ public class PolarCoordinateHelper {
// ***************************************************************************
// * Class Body *
// ***************************************************************************
/**
* @param deltaX
* @param deltaY
* @return
*/
public static final double euclideanDistance(double deltaX, double deltaY) {
return Math.sqrt((deltaX * deltaX) + (deltaY * deltaY));
}
// ---------------------------------------------------------------------------
/**
* @param pole
......@@ -62,7 +73,7 @@ public class PolarCoordinateHelper {
public static final double getRadius(Point pole, Point coordinate) {
double lengthX = coordinate.x - pole.x;
double lengthY = coordinate.y - pole.y;
double radius = Math.sqrt(lengthX * lengthX + lengthY * lengthY);
double radius = euclideanDistance(lengthX, lengthY);
return radius;
}
......@@ -78,7 +89,7 @@ public class PolarCoordinateHelper {
public static final double getEllipticRadius(double angle, double width, double height) {
double lengthX = width * Math.cos(angle);
double lengthY = height * Math.sin(angle);
double radius = Math.sqrt(lengthX * lengthX + lengthY * lengthY);
double radius = euclideanDistance(lengthX, lengthY);
return radius;
}
......@@ -108,7 +119,7 @@ public class PolarCoordinateHelper {
public static final Point rotate(Point origin, double angle) {
double x = origin.x;
double y = origin.y;
float distance = (float) Math.sqrt((x * x) + (y * y));
float distance = (float) euclideanDistance(x, y);
double rotatedX = distance * Math.cos(angle);
double rotatedY = distance * Math.sin(angle);
......@@ -132,7 +143,7 @@ public class PolarCoordinateHelper {
public static final Point carthesianToPolar(Point carthesian) {
double x = carthesian.x;
double y = carthesian.y;
float distance = (float) Math.sqrt((x * x) + (y * y));
float distance = (float) euclideanDistance(x, y);
float angle = (float) Math.atan2(y, x);
if (angle < 0)
angle += TWO_PI;
......@@ -161,7 +172,7 @@ public class PolarCoordinateHelper {
double x = clone.x - origin.x;
double y = clone.y - origin.y;
float distance = (float) Math.sqrt((x * x) + (y * y));
float distance = (float) euclideanDistance(x, y);
float angle = (float) Math.atan2(y, x);
if (angle < 0)
angle += TWO_PI;
......
......@@ -10,6 +10,7 @@ public class Templating extends NLS {
public static String NUMBER_OF_LAYERS_PROPERTY;
public static String LAYER_NAME_PROPERTY;
public static String LAYER_COLOUR_SCALE_PROPERTY;
public static String LAYER_ID_PROPERTY;
public static String PERSISTENT_PROPERTY;
public static String PRESELECT_ID_PROPERTY;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment