Package com.mxgraph.shape
Class mxCurveLabelShape
- java.lang.Object
-
- com.mxgraph.shape.mxCurveLabelShape
-
- All Implemented Interfaces:
mxITextShape
public class mxCurveLabelShape extends java.lang.Object implements mxITextShape
Draws the edge label along a curve derived from the curve describing the edge's path
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classmxCurveLabelShape.LabelGlyphCacheUtility class to describe the characteristics of each glyph of a branch branch label.classmxCurveLabelShape.LabelPositionUtility class that stores details of how the label is positioned on the curve
-
Field Summary
Fields Modifier and Type Field Description intcenterVisibleIndexThe index of the central glyph of the label that is visibleprotected mxCurvecurveCache of the points between which drawing straight lines views as a curvestatic doubleCURVE_TEXT_STRETCH_FACTORFactor by which text on the inside of curve is stretchedstatic java.lang.ObjectFONT_FRACTIONALMETRICSSpecifies if image aspect should be preserved in drawImage.static java.awt.font.FontRenderContextfrcShared FRC for font size calculationsstatic mxRectangleINVALID_GLYPH_BOUNDSIndicates that a glyph does not have valid drawing bounds, usually because it is not visiblestatic doubleLABEL_BUFFERBuffer at both ends of the labelprotected mxRectanglelabelBoundsCache of the bounds of the labelprotected mxCurveLabelShape.LabelGlyphCache[]labelGlyphsCache of information describing characteristics relating to drawing each glyph of this labelprotected mxCurveLabelShape.LabelPositionlabelPositionADT to encapsulate label positioning informationprotected doublelabelSizeCache of the total length of the branch labelprotected java.awt.FontlastFontCache of the label fontprotected java.util.List<mxPoint>lastPointsCache of the last set of guide points that this label was calculated forprotected java.lang.StringlastValueCache of the label textprotected booleanrotationEnabledjava.awt.font.GlyphVector[]rtlGlyphVectorsCache of BIDI glyph vectorsprotected mxCellStatestateCache the state associated with this shape
-
Constructor Summary
Constructors Constructor Description mxCurveLabelShape(mxCellState state, mxCurve value)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcalculationLabelPosition(java.util.Map<java.lang.String,java.lang.Object> style, java.lang.String label)Hook method to override how the label is positioned on the curvemxRectanglegetCenterVisiblePosition()Returns the drawing bounds of the central indexed visible glyphmxCurvegetCurve()mxRectanglegetLabelBounds()booleangetRotationEnabled()booleanintersectsRect(java.awt.Rectangle rect)Returns whether or not the rectangle passed in hits any part of this curve.voidpaintShape(mxGraphics2DCanvas canvas, java.lang.String text, mxCellState state, java.util.Map<java.lang.String,java.lang.Object> style)protected voidpostprocessGlyph(mxCurve curve, java.lang.String label, int j, double currentPos)Hook for sub-classers to perform additional processing on each glyphvoidsetCurve(mxCurve curve)voidsetRotationEnabled(boolean value)mxRectangleupdateLabelBounds(java.lang.String label, java.util.Map<java.lang.String,java.lang.Object> style)Updates the cached position and size of each glyph in the edge label.
-
-
-
Field Detail
-
lastValue
protected java.lang.String lastValue
Cache of the label text
-
lastFont
protected java.awt.Font lastFont
Cache of the label font
-
lastPoints
protected java.util.List<mxPoint> lastPoints
Cache of the last set of guide points that this label was calculated for
-
curve
protected mxCurve curve
Cache of the points between which drawing straight lines views as a curve
-
state
protected mxCellState state
Cache the state associated with this shape
-
labelGlyphs
protected mxCurveLabelShape.LabelGlyphCache[] labelGlyphs
Cache of information describing characteristics relating to drawing each glyph of this label
-
labelSize
protected double labelSize
Cache of the total length of the branch label
-
labelBounds
protected mxRectangle labelBounds
Cache of the bounds of the label
-
labelPosition
protected mxCurveLabelShape.LabelPosition labelPosition
ADT to encapsulate label positioning information
-
LABEL_BUFFER
public static double LABEL_BUFFER
Buffer at both ends of the label
-
CURVE_TEXT_STRETCH_FACTOR
public static double CURVE_TEXT_STRETCH_FACTOR
Factor by which text on the inside of curve is stretched
-
INVALID_GLYPH_BOUNDS
public static mxRectangle INVALID_GLYPH_BOUNDS
Indicates that a glyph does not have valid drawing bounds, usually because it is not visible
-
centerVisibleIndex
public int centerVisibleIndex
The index of the central glyph of the label that is visible
-
FONT_FRACTIONALMETRICS
public static java.lang.Object FONT_FRACTIONALMETRICS
Specifies if image aspect should be preserved in drawImage. Default is true.
-
rtlGlyphVectors
public java.awt.font.GlyphVector[] rtlGlyphVectors
Cache of BIDI glyph vectors
-
frc
public static java.awt.font.FontRenderContext frc
Shared FRC for font size calculations
-
rotationEnabled
protected boolean rotationEnabled
-
-
Constructor Detail
-
mxCurveLabelShape
public mxCurveLabelShape(mxCellState state, mxCurve value)
-
-
Method Detail
-
getRotationEnabled
public boolean getRotationEnabled()
-
setRotationEnabled
public void setRotationEnabled(boolean value)
-
paintShape
public void paintShape(mxGraphics2DCanvas canvas, java.lang.String text, mxCellState state, java.util.Map<java.lang.String,java.lang.Object> style)
- Specified by:
paintShapein interfacemxITextShape
-
updateLabelBounds
public mxRectangle updateLabelBounds(java.lang.String label, java.util.Map<java.lang.String,java.lang.Object> style)
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
protected void postprocessGlyph(mxCurve curve, java.lang.String label, int j, double currentPos)
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
public boolean intersectsRect(java.awt.Rectangle rect)
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
protected void calculationLabelPosition(java.util.Map<java.lang.String,java.lang.Object> style, java.lang.String label)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
public mxCurve getCurve()
- Returns:
- the curve
-
setCurve
public void setCurve(mxCurve curve)
- Parameters:
curve- the curve to set
-
getLabelBounds
public mxRectangle getLabelBounds()
-
getCenterVisiblePosition
public mxRectangle getCenterVisiblePosition()
Returns the drawing bounds of the central indexed visible glyph- Returns:
- the centerVisibleIndex
-
-