Package cn.mapway.ui.client.mvc
Class Size
java.lang.Object
cn.mapway.ui.client.mvc.Size
Size 该size可以被javascript使用
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Size[]calculateArrowheadSizes(Size startSize, Size endSize, double arrowLength, double arrowHalfWidth) Calculates the two base coordinates of an arrowhead given a line segment.clone()static Sizecreate(double x, double y) doubledistanceTo(double tx, double ty) doubledistanceTo(Size target) doublegetX()intdoublegetY()intoffset(double offsetX, double offsetY) scale(double scaleX, double scaleY) set(double x, double y) toString()SVG representation Sizes="50,0 21,90 98,35 2,35 79,90" x,y format
-
Field Details
-
x
public double x -
y
public double y
-
-
Constructor Details
-
Size
protected Size() -
Size
@JsConstructor public Size(double x, double y)
-
-
Method Details
-
distanceTo
@JsMethod(name="distanceToXY") public double distanceTo(double tx, double ty) -
distanceTo
-
create
-
toString
-
toSVGString
SVG representation Sizes="50,0 21,90 98,35 2,35 79,90" x,y format- Returns:
-
offset
-
set
-
getX
public double getX() -
getY
public double getY() -
getXAsInt
public int getXAsInt() -
getYAsInt
public int getYAsInt() -
copyFrom
-
clone
-
copyTo
-
scale
-
calculateArrowheadSizes
public static Size[] calculateArrowheadSizes(Size startSize, Size endSize, double arrowLength, double arrowHalfWidth) Calculates the two base coordinates of an arrowhead given a line segment. The arrowhead tip is at 'endSize'.- Parameters:
startSize- The starting Size of the line segment.endSize- The ending Size of the line segment (arrowhead tip).arrowLength- The length of the arrowhead (distance from tip to base).arrowHalfWidth- The half-width of the arrowhead at its base.- Returns:
- An array of two Size objects representing the base corners of the arrowhead. Returns null if the line segment has zero length (start and end Sizes are the same).
-