Package jpicedt.graphic.model
Class PicGroup
- java.lang.Object
-
- jpicedt.graphic.model.AbstractElement
-
- jpicedt.graphic.model.BranchElement
-
- jpicedt.graphic.model.PicGroup
-
- All Implemented Interfaces:
java.lang.Iterable,java.util.Collection,Element,PicObjectConstants,ActionFactory,CustomizerFactory
- Direct Known Subclasses:
DefaultSelectionHandler
public class PicGroup extends BranchElement implements CustomizerFactory, ActionFactory
A concrete implementation of BranchElement that is suited for building groups of elements. It allows easy global resize/translate transformation by providing 8 control points that can be used by mouse operation.- Since:
- PicEdt 1.0
- Author:
- Sylvain Reynal
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classPicGroup.GroupPointIteratorAn iterator over PicPoint's that can serve as anchors for grid alignment.
-
Field Summary
Fields Modifier and Type Field Description static intFIRST_PTstatic intLAST_PTstatic intLLstatic intLMstatic intLRstatic intMLstatic intMRstatic intULstatic intUMstatic intUR-
Fields inherited from class jpicedt.graphic.model.BranchElement
changeLock, children, ptsX, ptsY
-
Fields inherited from class jpicedt.graphic.model.AbstractElement
attributeSet, parent, view
-
Fields inherited from interface jpicedt.graphic.model.PicObjectConstants
ARROW_GLOBAL_SCALE_LENGTH, ARROW_GLOBAL_SCALE_WIDTH, ARROW_INSET_SCALE, ARROW_LENGTH_SCALE, ARROW_WIDTH_LINEWIDTH_SCALE, ARROW_WIDTH_MINIMUM_MM, BRACKET_LENGTH_SCALE, CROSSHATCH, CROSSHATCH_FILLED, DASH_OPAQUE, DASH_TRANSPARENT, DASH1, DASH2, DASH3, DASHED, DIMEN, DOT_SEP, DOT_SEP1, DOT_SEP2, DOT_SEP3, DOTTED, DOUBLE_COLOR, DOUBLE_LINE, DOUBLE_SEP, FILL_COLOR, FILL_STYLE, HATCH_ANGLE, HATCH_COLOR, HATCH_SEP, HATCH_WIDTH, HLINES, HLINES_FILLED, INNER, LEFT_ARROW, LINE_COLOR, LINE_STYLE, LINE_WIDTH, MIDDLE, NONE, OUTER, OVER_STRIKE, OVER_STRIKE_COLOR, OVER_STRIKE_WIDTH, POLYDOTS_ANGLE, POLYDOTS_CIRCLE, POLYDOTS_DISK, POLYDOTS_PENTAGON, POLYDOTS_PENTAGON_FILLED, POLYDOTS_PLUS, POLYDOTS_SCALE_H, POLYDOTS_SCALE_V, POLYDOTS_SIZE_LINEWIDTH_SCALE, POLYDOTS_SIZE_MINIMUM_MM, POLYDOTS_SQUARE, POLYDOTS_SQUARE_FILLED, POLYDOTS_STYLE, POLYDOTS_SUPERIMPOSE, POLYDOTS_TRIANGLE, POLYDOTS_TRIANGLE_FILLED, PS_POINT, PST_CUSTOM, RBRACKET_LENGTH_SCALE, RIGHT_ARROW, SHADOW, SHADOW_ANGLE, SHADOW_COLOR, SHADOW_SIZE, SOLID, TBAR_WIDTH_LINEWIDTH_SCALE, TBAR_WIDTH_MINIMUM_MM, TEXT_BOX_CIRCLE, TEXT_BOX_NO_FRAME, TEXT_BOX_OVAL, TEXT_BOX_RECTANGLE, TEXT_FRAME, TEXT_HALIGN_CENTER, TEXT_HALIGN_LEFT, TEXT_HALIGN_RIGHT, TEXT_HOR_ALIGN, TEXT_ROTATION, TEXT_VALIGN_BASELINE, TEXT_VALIGN_BOTTOM, TEXT_VALIGN_CENTER, TEXT_VALIGN_TOP, TEXT_VERT_ALIGN, VLINES, VLINES_FILLED
-
-
Constructor Summary
Constructors Constructor Description PicGroup()construct a PicGroup with no parent and a default PicAttributeSetPicGroup(java.util.Collection c)Simply call superclass's constructor.PicGroup(BranchElement src)Cloning constructor.PicGroup(PicAttributeSet attributeSet)construct a PicGroup with no parent and the given PicAttributeSet
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PointIndexIteratoranchorPointsIterator()Create an Iterator over points that can serve as anchor points for grid alignment.java.lang.Objectclone()Return a deep copy of this PicGroupPEAction[]createActions(ActionDispatcher actionDispatcher, ActionLocalizer localizer, HitInfo hi)Creates an array of Action's related to this objectAbstractCustomizercreateCustomizer()Returns a customizer (Swing) componentintgetFirstPointIndex()Return the index of the first user-controlled point that can be retrieved by getPoint()intgetLastPointIndex()Return the index of the last user-controlled point that can be retrieved by getPoint()java.lang.StringgetName()Return a non-localised string representing this element's name.doublegetPointX(int numPoint)Same asgetPoint(), yet return the x-coordinate only.doublegetPointY(int numPoint)This default implementation returnsptsY[numPoint].This might be a valid implementation as long as subclasses don't have other control points.voidsetPoint(int numPoint, PicPoint ptNew, EditPointConstraint constraint)Set the point numbered by "numPoint" to the "pt" value, and scales inward object accordinglyjava.lang.StringtoString()Returns a String representing the group for debugging use only.-
Methods inherited from class jpicedt.graphic.model.BranchElement
add, addAll, addChild, addChild, bringBackward, bringForward, bringToBack, bringToFront, children, clear, contains, contains, containsAll, containsClass, createFilteredCollection, equals, forwardChangedUpdate, getAllowsChildren, getBoundingBox, getChildAt, getChildCount, getChildIndex, getPoint, isEmpty, isToBack, isToFront, iterator, remove, removeAll, removeAllChildren, removeChild, removeView, replaceChild, retainAll, rotate, scale, scale, setAttribute, setAttributeSet, setPoint, setViewFromFactory, shear, size, toArray, toArray, translate, updateBoundingBox
-
Methods inherited from class jpicedt.graphic.model.AbstractElement
fireChangedUpdate, getAttribute, getAttributeSet, getDrawing, getParent, getView, setParent
-
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
-
-
-
Field Detail
-
FIRST_PT
public static final int FIRST_PT
- See Also:
- Constant Field Values
-
UL
public static final int UL
- See Also:
- Constant Field Values
-
UM
public static final int UM
- See Also:
- Constant Field Values
-
UR
public static final int UR
- See Also:
- Constant Field Values
-
ML
public static final int ML
- See Also:
- Constant Field Values
-
MR
public static final int MR
- See Also:
- Constant Field Values
-
LL
public static final int LL
- See Also:
- Constant Field Values
-
LM
public static final int LM
- See Also:
- Constant Field Values
-
LR
public static final int LR
- See Also:
- Constant Field Values
-
LAST_PT
public static final int LAST_PT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
PicGroup
public PicGroup()
construct a PicGroup with no parent and a default PicAttributeSet
-
PicGroup
public PicGroup(PicAttributeSet attributeSet)
construct a PicGroup with no parent and the given PicAttributeSet
-
PicGroup
public PicGroup(BranchElement src)
Cloning constructor. Simply call superclass's constructor.
-
PicGroup
public PicGroup(java.util.Collection c)
Simply call superclass's constructor.
-
-
Method Detail
-
clone
public java.lang.Object clone()
Return a deep copy of this PicGroup- Specified by:
clonein interfaceElement- Specified by:
clonein classBranchElement- Returns:
- a clone of this element
- Since:
- PicEdt 1.0
-
getName
public java.lang.String getName()
Description copied from interface:ElementReturn a non-localised string representing this element's name. This may be used by a UI to display some information related to this element, or by a localizer to fetch a i18n'd string.
-
getFirstPointIndex
public int getFirstPointIndex()
Description copied from interface:ElementReturn the index of the first user-controlled point that can be retrieved by getPoint()- Specified by:
getFirstPointIndexin interfaceElement- Overrides:
getFirstPointIndexin classBranchElement- Returns:
- the index of the first point that can be retrieved by getPoint This default implementation returns 0.
-
getLastPointIndex
public int getLastPointIndex()
Description copied from interface:ElementReturn the index of the last user-controlled point that can be retrieved by getPoint()- Specified by:
getLastPointIndexin interfaceElement- Overrides:
getLastPointIndexin classBranchElement- Returns:
- the index of the last point that can be retrieved by getPoint This default implementation returns the greater index allowed in ptsX (or ptsY).
-
getPointX
public double getPointX(int numPoint)
Description copied from interface:ElementSame asgetPoint(), yet return the x-coordinate only.- Specified by:
getPointXin interfaceElement- Overrides:
getPointXin classBranchElement- Parameters:
numPoint- the point index, should be greater or equal to the value returned bygetFirstPointIndex, and lower or equal togetLastPointIndex.- Returns:
- the X-coord of the point indexed by
numPoint. - Since:
- PicEdt 1.0
-
getPointY
public double getPointY(int numPoint)
Description copied from class:BranchElementThis default implementation returnsptsY[numPoint].This might be a valid implementation as long as subclasses don't have other control points.- Specified by:
getPointYin interfaceElement- Overrides:
getPointYin classBranchElement- Parameters:
numPoint- the point index, should be greater or equal to the value returned bygetFirstPointIndex, and lower or equal togetLastPointIndex.- Returns:
- the Y-coord of the point indexed by
numPoint. - Since:
- PicEdt 1.0
-
setPoint
public void setPoint(int numPoint, PicPoint ptNew, EditPointConstraint constraint)Set the point numbered by "numPoint" to the "pt" value, and scales inward object accordingly- Specified by:
setPointin interfaceElement- Overrides:
setPointin classBranchElement- Parameters:
constraint- not used here, may be safely set to null- Since:
- PicEdt 1.0
-
anchorPointsIterator
public PointIndexIterator anchorPointsIterator()
Description copied from class:AbstractElementCreate an Iterator over points that can serve as anchor points for grid alignment. This implementation returns a DefaultPointIndexIterator which simply iterates through all user-controlled points in ascending order.- Specified by:
anchorPointsIteratorin interfaceElement- Overrides:
anchorPointsIteratorin classAbstractElement- Returns:
- an Iterator over points that can serve as anchor points for grid alignment. This implementation returns a default PointIterator which simply iterates through control points.
-
toString
public java.lang.String toString()
Returns a String representing the group for debugging use only.- Overrides:
toStringin classBranchElement
-
createActions
public PEAction[] createActions(ActionDispatcher actionDispatcher, ActionLocalizer localizer, HitInfo hi)
Creates an array of Action's related to this object- Specified by:
createActionsin interfaceActionFactory- Parameters:
actionDispatcher- dispatcher used to create a PEActionlocalizer- used to localizer action parametershi- a HitInfo containing information related to the mouse-event which triggered the popup menu.
-
createCustomizer
public AbstractCustomizer createCustomizer()
Description copied from interface:CustomizerFactoryReturns a customizer (Swing) component- Specified by:
createCustomizerin interfaceCustomizerFactory- Returns:
- a Customizer for geometry editing
-
-