java.lang.Object
eu.hansolo.tilesfx.tools.Helper
Created by hansolo on 11.12.15.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String[]static final String[]static final Stringstatic final String[]static final String[]static final doublestatic final doublestatic final doublestatic final doublestatic final doublestatic final String[]static final Stringstatic final longstatic final longstatic final longstatic final longstatic final String[]static final String[]static final String[]static final String[]static final String[]static final String[]static final String[]static final String[]static final String[]static final Durationstatic final Durationstatic final Durationstatic final Durationstatic final Durationstatic final Durationstatic final Durationstatic final Duration -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic final voidadjustTextSize(javafx.scene.control.Label TEXT, double MAX_WIDTH, double FONT_SIZE) static final doubleadjustTextSize(javafx.scene.text.Text TEXT, double MAX_WIDTH, double FONT_SIZE) static final booleanbiggerThan(double A, double B) static final double[]calcAutoScale(double MIN_VALUE, double MAX_VALUE) static final doublecalcNiceNumber(double RANGE, boolean ROUND) Returns a "niceScaling" number approximately equal to the range.static final intcalcNumberOfDatapointsForPeriod(Duration TIME_PERIOD, TimeUnit RESOLUTION) static final intcalcNumberOfVerticalTickLinesForPeriod(Duration TIME_PERIOD, TimeUnit RESOLUTION) static intcheckCollision(double a, double b, double c, double centerX, double centerY, double radius) static intcheckLineCircleCollision(double P1_X, double P1_Y, double P2_X, double P2_Y, double CENTER_X, double CENTER_Y, double RADIUS) static intcheckLineCircleCollision(eu.hansolo.toolboxfx.geom.Point P1, eu.hansolo.toolboxfx.geom.Point P2, double CENTER_X, double CENTER_Y, double RADIUS) static final doubleclamp(double MIN, double MAX, double VALUE) static final intclamp(int MIN, int MAX, int VALUE) static final longclamp(long MIN, long MAX, long VALUE) static final <T extends Number>
Tclamp(T MIN, T MAX, T VALUE) static final doubleclampMax(double MAX, double VALUE) static final doubleclampMin(double MIN, double VALUE) static final doublecolorDistance(javafx.scene.paint.Color COLOR_1, javafx.scene.paint.Color COLOR_2) static final StringcolorToCss(javafx.scene.paint.Color COLOR) static double[]colorToYUV(javafx.scene.paint.Color COLOR) static final List<javafx.scene.paint.Color> createColorPalette(javafx.scene.paint.Color FROM_COLOR, javafx.scene.paint.Color TO_COLOR, int NO_OF_COLORS) static final javafx.scene.paint.Color[]createColorVariations(javafx.scene.paint.Color COLOR, int NO_OF_COLORS) static final <T extends eu.hansolo.toolboxfx.geom.Point>
List<T> createConvexHull(List<T> POINTS) static final javafx.scene.NodecreateDataNode(javafx.beans.binding.ObjectExpression<Number> VALUE, double RADIUS) static final javafx.scene.NodecreateDataNode(javafx.beans.binding.ObjectExpression<Number> VALUE, String FORMAT_STRING, double RADIUS, javafx.scene.paint.Color TEXT_COLOR) static final List<eu.hansolo.toolboxfx.geom.Point> createSmoothedConvexHull(List<eu.hansolo.toolboxfx.geom.Point> POINTS, int SUB_DIVISIONS) static final doubledistance(double P1_X, double P1_Y, double P2_X, double P2_Y) static final doubledistance(eu.hansolo.toolboxfx.geom.Point P1, eu.hansolo.toolboxfx.geom.Point P2) static final voiddrawRoundedRect(javafx.scene.canvas.GraphicsContext CTX, eu.hansolo.toolboxfx.geom.Bounds BOUNDS, eu.hansolo.toolboxfx.geom.CornerRadii RADII) static final voidenableNode(javafx.scene.Node NODE, boolean ENABLE) static final booleanequals(double A, double B) static doubleeuclideanDistance(double X1, double Y1, double X2, double Y2) static doubleeuclideanDistance(eu.hansolo.toolboxfx.geom.Point P1, eu.hansolo.toolboxfx.geom.Point P2) static final voidfitNodeWidth(javafx.scene.Node NODE, double MAX_WIDTH) static final doublegetAngleFromXY(double X, double Y, double CENTER_X, double CENTER_Y) static final doublegetAngleFromXY(double X, double Y, double CENTER_X, double CENTER_Y, double ANGLE_OFFSET) static final javafx.scene.paint.ColorgetColorAt(List<javafx.scene.paint.Stop> STOP_LIST, double POSITION_OF_COLOR) static final javafx.scene.paint.ColorgetColorOfSection(List<Section> SECTIONS, double VALUE, javafx.scene.paint.Color DEFAULT_COLOR) static final javafx.scene.paint.ColorgetColorWithOpacity(javafx.scene.paint.Color COLOR, double OPACITY) static final javafx.scene.paint.ColorgetContrastColor(javafx.scene.paint.Color COLOR) static final DateTimeFormattergetDateFormat(Locale LOCALE) static doublegetDecimalDeg(int DEGREES, int MINUTES, double SECONDS) static intgetDegrees(double DEC_DEG) static final Map<String, List<CountryPath>> static final DateTimeFormattergetLocalizedDateFormat(Locale LOCALE) static final Map<String, List<CountryPath>> static intgetMinutes(double DEC_DEG) static final double[]getNiceScale(double MIN, double MAX) Calculates nice minValue, maxValue and stepSize for given MIN and MAX valuesstatic final double[]getNiceScale(double MIN, double MAX, int MAX_NO_OF_TICKS) Calculates nice minValue, maxValue and stepSize for given MIN and MAX valuesstatic final double[]getPointBetweenP1AndP2(double P1_X, double P1_Y, double P2_X, double P2_Y) static final eu.hansolo.toolboxfx.geom.PointgetPointBetweenP1AndP2(eu.hansolo.toolboxfx.geom.Point P1, eu.hansolo.toolboxfx.geom.Point P2) static doublegetSeconds(double DEC_DEG) static final ThreadFactorygetThreadFactory(String THREAD_NAME, boolean IS_DAEMON) static final javafx.scene.paint.ColorinterpolateColor(javafx.scene.paint.Stop LOWER_BOUND, javafx.scene.paint.Stop UPPER_BOUND, double POSITION) static final booleanisBright(javafx.scene.paint.Color COLOR) static final booleanisDark(javafx.scene.paint.Color COLOR) static final booleanisInEllipse(double X, double Y, double ELLIPSE_CENTER_X, double ELLIPSE_CENTER_Y, double ELLIPSE_RADIUS_X, double ELLIPSE_RADIUS_Y) static final booleanisInPolygon(double X, double Y, int NO_OF_POINTS_IN_POLYGON, double[] POINTS_X, double[] POINTS_Y) static final booleanisInPolygon(double X, double Y, javafx.scene.shape.Polygon POLYGON) static final booleanisInRectangle(double X, double Y, double MIN_X, double MIN_Y, double MAX_X, double MAX_Y) static final booleanisInRingSegment(double X, double Y, double CENTER_X, double CENTER_Y, double OUTER_RADIUS, double INNER_RADIUS, double START_ANGLE, double SEGMENT_ANGLE) static final booleanisMonochrome(javafx.scene.paint.Color COLOR) lastN(int n) static final double[]latLonToXY(double LATITUDE, double LONGITUDE) static final double[]latLonToXY(double LATITUDE, double LONGITUDE, double MAP_OFFSET_X, double MAP_OFFSET_Y) static final booleanlessThan(double A, double B) static final doublenearest(double SMALLER, double VALUE, double LARGER) static final Stringstatic final <T> Predicate<T> static final Stringstatic final Stringstatic final eu.hansolo.toolboxfx.geom.PointpointOnLine(double P1_X, double P1_Y, double P2_X, double P2_Y, double DISTAINCE_TOP_2) static final double[]rotatePointAroundRotationCenter(double X, double Y, double RX, double RY, double ANGLE) static final eu.hansolo.toolboxfx.geom.PointrotatePointAroundRotationCenter(eu.hansolo.toolboxfx.geom.Point POINT, eu.hansolo.toolboxfx.geom.Point ROTATION_CENTER, double ANGLE) static final doubleround(double VALUE, int PRECISION) static introundDoubleToInt(double VALUE) static final doubleroundTo(double VALUE, double TARGET) static final doubleroundToHalf(double VALUE) static final voidscaleNodeTo(javafx.scene.Node NODE, double TARGET_WIDTH, double TARGET_HEIGHT) static final StringshortenNumber(long value) static final StringshortenNumber(long value, Locale locale) static final javafx.scene.shape.PathsmoothPath(javafx.collections.ObservableList<javafx.scene.shape.PathElement> ELEMENTS, boolean FILLED) static final voidsmoothPath(javafx.scene.shape.Path PATH, boolean FILLED) static final eu.hansolo.toolboxfx.geom.Point[]smoothSparkLine(List<Double> DATA_LIST, double MIN_VALUE, double MAX_VALUE, javafx.scene.shape.Rectangle GRAPH_BOUNDS, int NO_OF_DATAPOINTS) static doublesnapToTicks(double MIN_VALUE, double MAX_VALUE, double VALUE, int MINOR_TICK_COUNT, double MAJOR_TICK_UNIT) Can be used to implement discrete steps e.g.splitNumberInDigits(double number) static final voidstopTask(ScheduledFuture<?> task) static final eu.hansolo.toolboxfx.geom.Point[]subdividePoints(eu.hansolo.toolboxfx.geom.Point[] POINTS, int SUB_DEVISIONS) static final List<eu.hansolo.toolboxfx.geom.Point> subdividePoints(List<eu.hansolo.toolboxfx.geom.Point> POINTS, int SUB_DEVISIONS)
-
Field Details
-
MAP_WIDTH
public static final double MAP_WIDTH- See Also:
-
MAP_HEIGHT
public static final double MAP_HEIGHT- See Also:
-
MAP_OFFSET_X
public static final double MAP_OFFSET_X- See Also:
-
MAP_OFFSET_Y
public static final double MAP_OFFSET_Y- See Also:
-
MIN_FONT_SIZE
public static final double MIN_FONT_SIZE- See Also:
-
TIME_0_TO_5
-
TIME_5_TO_0
-
TIME_0_TO_9
-
TIME_9_TO_0
-
TIME_0_TO_12
-
TIME_0_TO_24
-
TIME_24_TO_0
-
TIME_00_TO_59
-
TIME_59_TO_00
-
NUMERIC
-
ALPHANUMERIC
-
ALPHA
-
EXTENDED
-
EXTENDED_UMLAUTE
-
PERCENTAGE
- See Also:
-
DEGREE
- See Also:
-
SECONDS_PER_MINUTE
public static final long SECONDS_PER_MINUTE- See Also:
-
SECONDS_PER_HOUR
public static final long SECONDS_PER_HOUR- See Also:
-
SECONDS_PER_DAY
public static final long SECONDS_PER_DAY- See Also:
-
SECONDS_PER_MONTH
public static final long SECONDS_PER_MONTH- See Also:
-
TIME_PERIOD_24_HOURS
-
TIME_PERIOD_3_DAYS
-
TIME_PERIOD_5_DAYS
-
TIME_PERIOD_7_DAYS
-
TIME_PERIOD_1_MONTH
-
TIME_PERIOD_3_MONTH
-
TIME_PERIOD_6_MONTH
-
TIME_PERIOD_12_MONTH
-
-
Constructor Details
-
Helper
public Helper()
-
-
Method Details
-
clamp
-
clamp
public static final int clamp(int MIN, int MAX, int VALUE) -
clamp
public static final long clamp(long MIN, long MAX, long VALUE) -
clamp
public static final double clamp(double MIN, double MAX, double VALUE) -
clampMin
public static final double clampMin(double MIN, double VALUE) -
clampMax
public static final double clampMax(double MAX, double VALUE) -
round
public static final double round(double VALUE, int PRECISION) -
roundTo
public static final double roundTo(double VALUE, double TARGET) -
roundToHalf
public static final double roundToHalf(double VALUE) -
nearest
public static final double nearest(double SMALLER, double VALUE, double LARGER) -
roundDoubleToInt
public static int roundDoubleToInt(double VALUE) -
calcAutoScale
public static final double[] calcAutoScale(double MIN_VALUE, double MAX_VALUE) -
getNiceScale
public static final double[] getNiceScale(double MIN, double MAX) Calculates nice minValue, maxValue and stepSize for given MIN and MAX values- Parameters:
MIN-MAX-- Returns:
- array of doubles with [niceMin, niceMax, niceRange, niceStep]
-
getNiceScale
public static final double[] getNiceScale(double MIN, double MAX, int MAX_NO_OF_TICKS) Calculates nice minValue, maxValue and stepSize for given MIN and MAX values- Parameters:
MIN-MAX-MAX_NO_OF_TICKS-- Returns:
- array of doubles with [niceMin, niceMax, niceRange, niceStep]
-
snapToTicks
public static double snapToTicks(double MIN_VALUE, double MAX_VALUE, double VALUE, int MINOR_TICK_COUNT, double MAJOR_TICK_UNIT) Can be used to implement discrete steps e.g. on a slider.- Parameters:
MIN_VALUE- The min value of the rangeMAX_VALUE- The max value of the rangeVALUE- The value to snapMINOR_TICK_COUNT- The number of ticks between 2 major tick marksMAJOR_TICK_UNIT- The distance between 2 major tick marks- Returns:
- The value snapped to the next tick mark defined by the given parameters
-
calcNiceNumber
public static final double calcNiceNumber(double RANGE, boolean ROUND) Returns a "niceScaling" number approximately equal to the range. Rounds the number if ROUND == true. Takes the ceiling if ROUND = false.- Parameters:
RANGE- the value range (maxValue - minValue)ROUND- whether to round the result or ceil- Returns:
- a "niceScaling" number to be used for the value range
-
getColorOfSection
-
adjustTextSize
public static final double adjustTextSize(javafx.scene.text.Text TEXT, double MAX_WIDTH, double FONT_SIZE) -
adjustTextSize
public static final void adjustTextSize(javafx.scene.control.Label TEXT, double MAX_WIDTH, double FONT_SIZE) -
fitNodeWidth
public static final void fitNodeWidth(javafx.scene.Node NODE, double MAX_WIDTH) -
getDateFormat
-
getLocalizedDateFormat
-
enableNode
public static final void enableNode(javafx.scene.Node NODE, boolean ENABLE) -
colorToCss
-
getThreadFactory
-
stopTask
-
isMonochrome
public static final boolean isMonochrome(javafx.scene.paint.Color COLOR) -
colorDistance
public static final double colorDistance(javafx.scene.paint.Color COLOR_1, javafx.scene.paint.Color COLOR_2) -
colorToYUV
public static double[] colorToYUV(javafx.scene.paint.Color COLOR) -
isBright
public static final boolean isBright(javafx.scene.paint.Color COLOR) -
isDark
public static final boolean isDark(javafx.scene.paint.Color COLOR) -
getContrastColor
public static final javafx.scene.paint.Color getContrastColor(javafx.scene.paint.Color COLOR) -
getColorWithOpacity
public static final javafx.scene.paint.Color getColorWithOpacity(javafx.scene.paint.Color COLOR, double OPACITY) -
createColorPalette
public static final List<javafx.scene.paint.Color> createColorPalette(javafx.scene.paint.Color FROM_COLOR, javafx.scene.paint.Color TO_COLOR, int NO_OF_COLORS) -
createColorVariations
public static final javafx.scene.paint.Color[] createColorVariations(javafx.scene.paint.Color COLOR, int NO_OF_COLORS) -
getColorAt
public static final javafx.scene.paint.Color getColorAt(List<javafx.scene.paint.Stop> STOP_LIST, double POSITION_OF_COLOR) -
interpolateColor
public static final javafx.scene.paint.Color interpolateColor(javafx.scene.paint.Stop LOWER_BOUND, javafx.scene.paint.Stop UPPER_BOUND, double POSITION) -
scaleNodeTo
public static final void scaleNodeTo(javafx.scene.Node NODE, double TARGET_WIDTH, double TARGET_HEIGHT) -
normalize
-
equals
public static final boolean equals(double A, double B) -
biggerThan
public static final boolean biggerThan(double A, double B) -
lessThan
public static final boolean lessThan(double A, double B) -
subdividePoints
-
subdividePoints
public static final eu.hansolo.toolboxfx.geom.Point[] subdividePoints(eu.hansolo.toolboxfx.geom.Point[] POINTS, int SUB_DEVISIONS) -
smoothSparkLine
-
getHiresCountryPaths
-
getLoresCountryPaths
-
drawRoundedRect
public static final void drawRoundedRect(javafx.scene.canvas.GraphicsContext CTX, eu.hansolo.toolboxfx.geom.Bounds BOUNDS, eu.hansolo.toolboxfx.geom.CornerRadii RADII) -
smoothPath
public static final void smoothPath(javafx.scene.shape.Path PATH, boolean FILLED) -
smoothPath
public static final javafx.scene.shape.Path smoothPath(javafx.collections.ObservableList<javafx.scene.shape.PathElement> ELEMENTS, boolean FILLED) -
isInRectangle
public static final boolean isInRectangle(double X, double Y, double MIN_X, double MIN_Y, double MAX_X, double MAX_Y) -
isInEllipse
public static final boolean isInEllipse(double X, double Y, double ELLIPSE_CENTER_X, double ELLIPSE_CENTER_Y, double ELLIPSE_RADIUS_X, double ELLIPSE_RADIUS_Y) -
isInPolygon
public static final boolean isInPolygon(double X, double Y, javafx.scene.shape.Polygon POLYGON) -
isInPolygon
public static final boolean isInPolygon(double X, double Y, int NO_OF_POINTS_IN_POLYGON, double[] POINTS_X, double[] POINTS_Y) -
isInRingSegment
public static final boolean isInRingSegment(double X, double Y, double CENTER_X, double CENTER_Y, double OUTER_RADIUS, double INNER_RADIUS, double START_ANGLE, double SEGMENT_ANGLE) -
distance
public static final double distance(eu.hansolo.toolboxfx.geom.Point P1, eu.hansolo.toolboxfx.geom.Point P2) -
distance
public static final double distance(double P1_X, double P1_Y, double P2_X, double P2_Y) -
euclideanDistance
public static double euclideanDistance(eu.hansolo.toolboxfx.geom.Point P1, eu.hansolo.toolboxfx.geom.Point P2) -
euclideanDistance
public static double euclideanDistance(double X1, double Y1, double X2, double Y2) -
pointOnLine
public static final eu.hansolo.toolboxfx.geom.Point pointOnLine(double P1_X, double P1_Y, double P2_X, double P2_Y, double DISTAINCE_TOP_2) -
checkLineCircleCollision
public static int checkLineCircleCollision(eu.hansolo.toolboxfx.geom.Point P1, eu.hansolo.toolboxfx.geom.Point P2, double CENTER_X, double CENTER_Y, double RADIUS) -
checkLineCircleCollision
public static int checkLineCircleCollision(double P1_X, double P1_Y, double P2_X, double P2_Y, double CENTER_X, double CENTER_Y, double RADIUS) -
checkCollision
public static int checkCollision(double a, double b, double c, double centerX, double centerY, double radius) -
getAngleFromXY
public static final double getAngleFromXY(double X, double Y, double CENTER_X, double CENTER_Y) -
getAngleFromXY
public static final double getAngleFromXY(double X, double Y, double CENTER_X, double CENTER_Y, double ANGLE_OFFSET) -
rotatePointAroundRotationCenter
public static final eu.hansolo.toolboxfx.geom.Point rotatePointAroundRotationCenter(eu.hansolo.toolboxfx.geom.Point POINT, eu.hansolo.toolboxfx.geom.Point ROTATION_CENTER, double ANGLE) -
rotatePointAroundRotationCenter
public static final double[] rotatePointAroundRotationCenter(double X, double Y, double RX, double RY, double ANGLE) -
getPointBetweenP1AndP2
public static final eu.hansolo.toolboxfx.geom.Point getPointBetweenP1AndP2(eu.hansolo.toolboxfx.geom.Point P1, eu.hansolo.toolboxfx.geom.Point P2) -
getPointBetweenP1AndP2
public static final double[] getPointBetweenP1AndP2(double P1_X, double P1_Y, double P2_X, double P2_Y) -
getDegrees
public static int getDegrees(double DEC_DEG) -
getMinutes
public static int getMinutes(double DEC_DEG) -
getSeconds
public static double getSeconds(double DEC_DEG) -
getDecimalDeg
public static double getDecimalDeg(int DEGREES, int MINUTES, double SECONDS) -
latLonToXY
public static final double[] latLonToXY(double LATITUDE, double LONGITUDE) -
latLonToXY
public static final double[] latLonToXY(double LATITUDE, double LONGITUDE, double MAP_OFFSET_X, double MAP_OFFSET_Y) -
not
-
createSmoothedConvexHull
-
createConvexHull
-
splitStringInCharacters
-
splitNumberInDigits
-
padLeft
-
padRight
-
lastN
-
calcNumberOfDatapointsForPeriod
-
calcNumberOfVerticalTickLinesForPeriod
-
shortenNumber
-
shortenNumber
-
createDataNode
public static final javafx.scene.Node createDataNode(javafx.beans.binding.ObjectExpression<Number> VALUE, double RADIUS) -
createDataNode
-