Class RMDoubleStroke
java.lang.Object
com.inductiveautomation.rm.base.RMListenerList
com.inductiveautomation.rm.base.RMObject
com.inductiveautomation.rm.graphics.RMFill
com.inductiveautomation.rm.graphics.RMStroke
com.inductiveautomation.rm.graphics.RMDoubleStroke
- All Implemented Interfaces:
- Archivable,- RMPropertyChanger,- Cloneable
Strokes a path with 2 lines of different widths, with an arbitrary separation (d) between them.
 
 This works by taking the input path and creating 'offset curves'.  The offset
 curve is defined as being parallel to the original curve at every point.
 
 For a given parametric curve C(t)={x(t),y(t)}, the slope of the curve at t
 is given by mC(t)=(dy/dt) / (dx/dt) = y'(t)/x'(t) and
 the the normal is therefore NC(t)=Normalize({-x'(t), y'(t)})
 
 An offset curve for a cubic bezier can not be represented by a single bezier.
 Therefore, we need to find a set of n curves OffC0,OffC1,...OffCn that fits,
 as closely as possible, the following points:
 OffsetPoint(t)=C(t)+d*NC(t)
 
 One possibility is to calculate a million OffsetPoints for the range t->{0,1}
 and run the curve fit code.
 
 In order to preserve continuity of the different bezier segments, it should
 also be required that
 mOffC0(0) = mC(0)
 and
 mOffCn(1) = mC(1)
 That is, the slopes at the beginning and end of the curve should the same in
 the offset curve as it is in the original curve.
 Also, since the offset points are obtained by walking along the normal vector
 for the original curve, the slope of the offset curve at offsetpoint(t) should
 be the same as mC(t).  The curve fit code does not currently take into account
 the slope of the curve at a given input point, but it's something to look
 into.  Knowing this may provide enough additional information to speed up the
 curve fit and/or reduce the number of input points needed for an accurate fit.
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final int
- 
Constructor SummaryConstructorsConstructorDescriptionCreates a new plain double stroke.RMDoubleStroke(RMColor col, float w) Creates a new double stroke.RMDoubleStroke(RMColor col, float outerW, float innerW, float separation, int positions) Creates a new double stroke.
- 
Method SummaryModifier and TypeMethodDescriptionclone()Standard clone implementation.booleanStandard equals implementation.fromXML(RXArchiver anArchiver, RXElement e) XML unarchival.Returns the bounds required to render this fill for this shape.floatReturns the inner rule width.Return the stroke used on the inside of a clockwise pathfloatReturns the outer rule width.Return the stroke used on the outside of a clockwise pathintReturns the double stroke rule positions.floatvoidpaint(RMShapePainter aPntr, RMShape aShape) Override to paint inner and outer strokes.protected voidvoidsetInnerRuleWidth(float _innerRuleWidth) voidsetOuterRuleWidth(float _outerRuleWidth) voidsetRulePositions(int _rulePositions) voidsetRuleSeparation(float _ruleSeparation) toXML(RXArchiver anArchiver) XML archival.Methods inherited from class com.inductiveautomation.rm.graphics.RMStrokegetDashArray, getDashArray, getDashArrayString, getDashArrayString, getDashPhase, getName, getStroke, getStrokePath, getWidth, setColor, setDashArray, setDashArrayString, setDashPhase, setWidthMethods inherited from class com.inductiveautomation.rm.graphics.RMFillderiveFill, getColor, hasAlpha, toStringMethods inherited from class com.inductiveautomation.rm.base.RMObjectaddPropertyChangeListener, animUpdate, firePropertyChange, firePropertyChange, firePropertyChange, getPCEvent, removePropertyChangeListener, sendPropertyChangeMethods inherited from class com.inductiveautomation.rm.base.RMListenerListaddListener, getListener, getListenerCount, getListenerCount, getListenerList, getListeners, hasListeners, removeListener
- 
Field Details- 
OUTER_RULE_ON_PATHpublic static final int OUTER_RULE_ON_PATH- See Also:
 
- 
INNER_RULE_ON_PATHpublic static final int INNER_RULE_ON_PATH- See Also:
 
- 
RULES_CENTERED_ABOUT_PATHpublic static final int RULES_CENTERED_ABOUT_PATH- See Also:
 
- 
RULE_GAP_ON_PATHpublic static final int RULE_GAP_ON_PATH- See Also:
 
 
- 
- 
Constructor Details- 
RMDoubleStrokepublic RMDoubleStroke()Creates a new plain double stroke.
- 
RMDoubleStrokeCreates a new double stroke.
- 
RMDoubleStrokeCreates a new double stroke.
 
- 
- 
Method Details- 
getRulePositionspublic int getRulePositions()Returns the double stroke rule positions.
- 
setRulePositionspublic void setRulePositions(int _rulePositions) 
- 
getInnerRuleWidthpublic float getInnerRuleWidth()Returns the inner rule width.
- 
setInnerRuleWidthpublic void setInnerRuleWidth(float _innerRuleWidth) 
- 
getOuterRuleWidthpublic float getOuterRuleWidth()Returns the outer rule width.
- 
setOuterRuleWidthpublic void setOuterRuleWidth(float _outerRuleWidth) 
- 
getOuterStrokeReturn the stroke used on the outside of a clockwise path
- 
getInnerStrokeReturn the stroke used on the inside of a clockwise path
- 
getRuleSeparationpublic float getRuleSeparation()
- 
setRuleSeparationpublic void setRuleSeparation(float _ruleSeparation) 
- 
getBoundsReturns the bounds required to render this fill for this shape.
- 
paintOverride to paint inner and outer strokes.
- 
equalsStandard equals implementation.
- 
cloneStandard clone implementation.
- 
toXMLXML archival.- Specified by:
- toXMLin interface- Archivable
- Overrides:
- toXMLin class- RMStroke
 
- 
fromXMLXML unarchival.- Specified by:
- fromXMLin interface- Archivable
- Overrides:
- fromXMLin class- RMStroke
 
- 
readAttributes- Overrides:
- readAttributesin class- RMStroke
 
 
-