Package com.mxgraph.shape
Class mxCurveLabelShape
java.lang.Object
com.mxgraph.shape.mxCurveLabelShape
- All Implemented Interfaces:
mxITextShape
Draws the edge label along a curve derived from the curve describing
the edge's path
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassUtility class to describe the characteristics of each glyph of a branch branch label.classUtility class that stores details of how the label is positioned on the curve -
Field Summary
FieldsModifier and TypeFieldDescriptionintThe index of the central glyph of the label that is visibleprotected mxCurveCache of the points between which drawing straight lines views as a curvestatic doubleFactor by which text on the inside of curve is stretchedstatic ObjectSpecifies if image aspect should be preserved in drawImage.static FontRenderContextShared FRC for font size calculationsstatic mxRectangleIndicates that a glyph does not have valid drawing bounds, usually because it is not visiblestatic doubleBuffer at both ends of the labelprotected mxRectangleCache of the bounds of the labelprotected mxCurveLabelShape.LabelGlyphCache[]Cache of information describing characteristics relating to drawing each glyph of this labelprotected mxCurveLabelShape.LabelPositionADT to encapsulate label positioning informationprotected doubleCache of the total length of the branch labelprotected FontCache of the label fontCache of the last set of guide points that this label was calculated forprotected StringCache of the label textprotected booleanCache of BIDI glyph vectorsprotected mxCellStateCache the state associated with this shape -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcalculationLabelPosition(Map<String, Object> style, String label) Hook method to override how the label is positioned on the curveReturns the drawing bounds of the central indexed visible glyphgetCurve()booleanbooleanintersectsRect(Rectangle rect) Returns whether or not the rectangle passed in hits any part of this curve.voidpaintShape(mxGraphics2DCanvas canvas, String text, mxCellState state, Map<String, Object> style) protected voidpostprocessGlyph(mxCurve curve, String label, int j, double currentPos) Hook for sub-classers to perform additional processing on each glyphvoidvoidsetRotationEnabled(boolean value) updateLabelBounds(String label, Map<String, Object> style) Updates the cached position and size of each glyph in the edge label.
-
Field Details
-
lastValue
Cache of the label text -
lastFont
Cache of the label font -
lastPoints
Cache of the last set of guide points that this label was calculated for -
curve
Cache of the points between which drawing straight lines views as a curve -
state
Cache the state associated with this shape -
labelGlyphs
Cache of information describing characteristics relating to drawing each glyph of this label -
labelSize
protected double labelSizeCache of the total length of the branch label -
labelBounds
Cache of the bounds of the label -
labelPosition
ADT to encapsulate label positioning information -
LABEL_BUFFER
public static double LABEL_BUFFERBuffer at both ends of the label -
CURVE_TEXT_STRETCH_FACTOR
public static double CURVE_TEXT_STRETCH_FACTORFactor by which text on the inside of curve is stretched -
INVALID_GLYPH_BOUNDS
Indicates that a glyph does not have valid drawing bounds, usually because it is not visible -
centerVisibleIndex
public int centerVisibleIndexThe index of the central glyph of the label that is visible -
FONT_FRACTIONALMETRICS
Specifies if image aspect should be preserved in drawImage. Default is true. -
rtlGlyphVectors
Cache of BIDI glyph vectors -
frc
Shared FRC for font size calculations -
rotationEnabled
protected boolean rotationEnabled
-
-
Constructor Details
-
mxCurveLabelShape
-
-
Method Details
-
getRotationEnabled
public boolean getRotationEnabled() -
setRotationEnabled
public void setRotationEnabled(boolean value) -
paintShape
public void paintShape(mxGraphics2DCanvas canvas, String text, mxCellState state, Map<String, Object> style) - Specified by:
paintShapein interfacemxITextShape
-
updateLabelBounds
Updates the cached position and size of each glyph in the edge label.- Parameters:
label- the entire string of the label.style- the edge style
-
postprocessGlyph
Hook for sub-classers to perform additional processing on each glyph- Parameters:
curve- The curve object holding the label curvelabel- the text label of the curvej- the index of the labelcurrentPos- the distance along the label curve the glyph is
-
intersectsRect
Returns whether or not the rectangle passed in hits any part of this curve.- Parameters:
rect- the rectangle to detect for a hit- Returns:
- whether or not the rectangle hits this curve
-
calculationLabelPosition
Hook method to override how the label is positioned on the curve- Parameters:
style- the style of the curvelabel- the string label to be displayed on the curve
-
getCurve
- Returns:
- the curve
-
setCurve
- Parameters:
curve- the curve to set
-
getLabelBounds
-
getCenterVisiblePosition
Returns the drawing bounds of the central indexed visible glyph- Returns:
- the centerVisibleIndex
-