public class GeometryUtils
extends java.lang.Object
| Constructor and Description |
|---|
GeometryUtils() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
checkInRange(double firstValue,
double secondValue,
double position)
Checks if the given position is between two values.
|
static boolean |
checkIntersection(javafx.geometry.Point2D a,
javafx.geometry.Point2D b,
javafx.geometry.Point2D c,
javafx.geometry.Point2D d)
Checks if a horizontal line segment AB intersects with a vertical line segment CD.
|
static javafx.geometry.Point2D |
getConnectorPosition(de.tesis.dynaware.grapheditor.model.GConnector connector,
SkinLookup skinLookup)
Gets the position of the center of a connector in the coordinate system of the view.
|
static javafx.geometry.Point2D |
getCursorPosition(de.tesis.dynaware.grapheditor.model.GConnector connector,
double x,
double y,
SkinLookup skinLookup)
Gets the position of the cursor relative to the coordinate system of the view.
|
static java.util.List<javafx.geometry.Point2D> |
getJointPositions(de.tesis.dynaware.grapheditor.model.GConnection connection)
Gets the x and y values from all joints within a connection.
|
static java.util.List<javafx.geometry.Point2D> |
getJointPositions(de.tesis.dynaware.grapheditor.model.GConnection connection,
SkinLookup skinLookup)
Gets the layout x and y values from all joints within a connection.
|
static java.util.List<javafx.geometry.Point2D> |
getJointPositions(java.util.List<GJointSkin> jointSkins)
Gets the layout x and y values from all joints in a list of joint skins.
|
static java.util.List<GJointSkin> |
getJointSkins(de.tesis.dynaware.grapheditor.model.GConnection connection,
SkinLookup skinLookup)
Gets all joint skins for a connection.
|
static double |
moveOffPixel(double position)
Moves an x or y position value off-pixel.
|
static double |
moveOnPixel(double position)
Moves an x or y position value on-pixel.
|
public static javafx.geometry.Point2D getConnectorPosition(de.tesis.dynaware.grapheditor.model.GConnector connector,
SkinLookup skinLookup)
Only works for connectors that are attached to nodes.
connector - the GConnector whose position is desiredskinLookup - the SkinLookup instance for this graph editornull if the connector isn't attached to a nodepublic static javafx.geometry.Point2D getCursorPosition(de.tesis.dynaware.grapheditor.model.GConnector connector,
double x,
double y,
SkinLookup skinLookup)
connector - a GConnector instancex - the x position of the cursor relative to the given connector's regiony - the y position of the cursor relative to the given connector's regionskinLookup - the SkinLookup instance for this graph editorpublic static java.util.List<javafx.geometry.Point2D> getJointPositions(java.util.List<GJointSkin> jointSkins)
jointSkins - a list of joint skin instancesList of Point2D objects containing joint x and y valuespublic static java.util.List<javafx.geometry.Point2D> getJointPositions(de.tesis.dynaware.grapheditor.model.GConnection connection,
SkinLookup skinLookup)
Uses the JavaFX properties of the skins, not the model values. Is therefore always up-to-date, even during a drag gesture where the model is not necessarily updated.
connection - the GConnection for which the positions are desiredskinLookup - the SkinLookup instance for this graph editorList of Point2D objects containing joint x and y valuespublic static java.util.List<javafx.geometry.Point2D> getJointPositions(de.tesis.dynaware.grapheditor.model.GConnection connection)
connection - a GConnection instanceList of Point2D objects containing joint x and y valuespublic static java.util.List<GJointSkin> getJointSkins(de.tesis.dynaware.grapheditor.model.GConnection connection, SkinLookup skinLookup)
connection - the GConnection for which the joint skinsskinLookup - the SkinLookup instance for this graph editorList of GJointSkin objects for this connectionpublic static double moveOnPixel(double position)
Lines drawn off-pixel look blurry. They should therefore have integer x and y values.
position - the position to move on-pixelpublic static double moveOffPixel(double position)
This is for example useful for a 1-pixel-wide stroke with a stroke-type of centered. The x and y positions need to be off-pixel so that the stroke is on-pixel.
position - the position to move off-pixelpublic static boolean checkInRange(double firstValue,
double secondValue,
double position)
Also returns true if the given position is equal to either of the values.
firstValue - an x or y position valuesecondValue - another x or y position valueposition - the cursor's position valuetrue if the cursor position is between the two pointspublic static boolean checkIntersection(javafx.geometry.Point2D a,
javafx.geometry.Point2D b,
javafx.geometry.Point2D c,
javafx.geometry.Point2D d)
a - start of line segment ABb - end of line segment ABc - start of line segment CDd - end of line segment CDtrue if AB and CD intersect, false otherwiseCopyright © 2014 TESIS DYNAware. All Rights Reserved.