http://www.jpicedt.org

jpicedt.graphic.model
Class PicGroup

java.lang.Object
  extended by jpicedt.graphic.model.AbstractElement
      extended by jpicedt.graphic.model.BranchElement
          extended by jpicedt.graphic.model.PicGroup
All Implemented Interfaces:
Iterable<Element>, Collection<Element>, List<Element>, Element, 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
 class PicGroup.GroupPointIterator
          An iterator over PicPoint's that can serve as anchors for grid alignment.
 
Nested classes/interfaces inherited from class jpicedt.graphic.model.BranchElement
BranchElement.CompoundMode
 
Field Summary
static int FIRST_PT
           
static int LAST_PT
           
static int LL
           
static int LM
           
static int LR
           
static int ML
           
static int MR
           
static int UL
           
static int UM
           
static int UR
           
 
Fields inherited from class jpicedt.graphic.model.BranchElement
changeLock, children, compoundMode, DEFAULT_LIFTPEN, isPathClosed, liftPen, ptsX, ptsY, shape
 
Fields inherited from class jpicedt.graphic.model.AbstractElement
attributeSet, name, parent, view
 
Constructor Summary
PicGroup()
          construct a PicGroup with no parent and a default PicAttributeSet
PicGroup(BranchElement src)
          Cloning constructor.
PicGroup(Collection<? extends Element> c)
          Simply call superclass's constructor.
PicGroup(PicAttributeSet attributeSet)
          construct a PicGroup with no parent and the given PicAttributeSet
 
Method Summary
 PointIndexIterator anchorPointsIterator()
          Create an Iterator over points that can serve as anchor points for grid alignment.
 PicGroup clone()
          Return a deep copy of this PicGroup
 ArrayList<PEAction> createActions(ActionDispatcher actionDispatcher, ActionLocalizer localizer, HitInfo hi)
          Creates an array of Action's related to this object.
 AbstractCustomizer createCustomizer()
          Returns a customizer (Swing) component
 double getCtrlPtX(int numPoint)
           
 double getCtrlPtY(int numPoint)
          This default implementation returns ptsY[numPoint].This might be a valid implementation as long as subclasses don't have other control points.
 String getDefaultName()
           
 int getFirstPointIndex()
          Return the index of the first user-controlled point that can be retrieved by getCtrlPt()
 CompositeHighlighter.HighlightingMode getHighlightingMode()
          Return the current highlighting mode
 int getLastPointIndex()
          Return the index of the last user-controlled point that can be retrieved by getCtrlPt()
 void setCtrlPt(int numPoint, PicPoint ptNew, EditPointConstraint constraint)
          Set the point numbered by numPoint to the pt value, and scales inward object accordingly.
 void setHighlightingMode(CompositeHighlighter.HighlightingMode mode)
          set the current highlighting mode ; this influences the way the Highligther is painted, but also the result returned by HitTest.
 void toggleHighlightingMode()
          Toggle the current highlighting mode
 String toString()
          Returns a String representing the group for debugging use only.
 void unGroup()
          Fetch all Element's belonging to the given PicGroup and add them to its parent, removing the given PicGroup from its parent afterward.
 
Methods inherited from class jpicedt.graphic.model.BranchElement
add, add, addAll, addAll, bringBackward, bringForward, bringToBack, bringToFront, clear, closePath, contains, containsAll, containsClass, createFilteredCollection, createShape, equals, forwardChangedUpdate, get, getBoundingBox, getCompoundMode, getCtrlPt, getCtrlPtSubset, getLiftPen, hashCode, indexOf, isEmpty, isPathClosed, isToBack, isToFront, iterator, lastIndexOf, listIterator, listIterator, mirror, openPath, remove, remove, removeAll, removeView, replace, retainAll, rotate, scale, set, setAttribute, setAttributeSet, setCompoundMode, setCtrlPt, setLiftPen, setViewFromFactory, shear, shear, size, subList, syncArrowGeometry, toArray, toArray, toggleCompoundMode, togglePathClosure, translate, updateBoundingBox
 
Methods inherited from class jpicedt.graphic.model.AbstractElement
fireChangedUpdate, getAttribute, getAttributeSet, getDrawing, getName, getParent, getView, pullOutOfGroup, replaceBy, scale, scale, scale, setName, setParent
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface jpicedt.graphic.model.Element
createShape, getAttribute, getAttributeSet, getBoundingBox, getCtrlPt, getCtrlPtSubset, getDrawing, getName, getParent, getView, mirror, removeView, replaceBy, rotate, scale, scale, scale, scale, setAttribute, setAttributeSet, setCtrlPt, setParent, setViewFromFactory, shear, shear, syncArrowGeometry, translate
 

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(Collection<? extends Element> c)
Simply call superclass's constructor.

Method Detail

clone

public PicGroup clone()
Return a deep copy of this PicGroup

Specified by:
clone in interface Element
Overrides:
clone in class BranchElement
Returns:
A clone of this element.
Since:
PicEdt 1.0

getDefaultName

public String getDefaultName()
Overrides:
getDefaultName in class BranchElement
Returns:
a localised string that represents this object's name

unGroup

public void unGroup()
Fetch all Element's belonging to the given PicGroup and add them to its parent, removing the given PicGroup from its parent afterward.


getFirstPointIndex

public int getFirstPointIndex()
Description copied from interface: Element
Return the index of the first user-controlled point that can be retrieved by getCtrlPt()

Specified by:
getFirstPointIndex in interface Element
Overrides:
getFirstPointIndex in class BranchElement
Returns:
the index of the first point that can be retrieved by getCtrlPt This default implementation returns 0.

getLastPointIndex

public int getLastPointIndex()
Description copied from interface: Element
Return the index of the last user-controlled point that can be retrieved by getCtrlPt()

Specified by:
getLastPointIndex in interface Element
Overrides:
getLastPointIndex in class BranchElement
Returns:
the index of the last point that can be retrieved by getCtrlPt This default implementation returns the greater index allowed in ptsX (or ptsY).

getCtrlPtX

public double getCtrlPtX(int numPoint)
Overrides:
getCtrlPtX in class BranchElement
Parameters:
numPoint - the point index, should be greater or equal to the value returned by getFirstPointIndex, and lower or equal to getLastPointIndex.
Returns:
the X-coord of the point indexed by numPoint.
Since:
PicEdt 1.0

getCtrlPtY

public double getCtrlPtY(int numPoint)
Description copied from class: BranchElement
This default implementation returns ptsY[numPoint].This might be a valid implementation as long as subclasses don't have other control points.

Overrides:
getCtrlPtY in class BranchElement
Parameters:
numPoint - the point index, should be greater or equal to the value returned by getFirstPointIndex, and lower or equal to getLastPointIndex.
Returns:
the Y-coord of the point indexed by numPoint.
Since:
PicEdt 1.0

setCtrlPt

public void setCtrlPt(int numPoint,
                      PicPoint ptNew,
                      EditPointConstraint constraint)
Set the point numbered by numPoint to the pt value, and scales inward object accordingly.

Specified by:
setCtrlPt in interface Element
Overrides:
setCtrlPt in class BranchElement
Parameters:
constraint - not used here, may be safely set to null
Since:
PicEdt 1.0

anchorPointsIterator

public PointIndexIterator anchorPointsIterator()
Description copied from class: AbstractElement
Create 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:
anchorPointsIterator in interface Element
Overrides:
anchorPointsIterator in class AbstractElement
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 String toString()
Returns a String representing the group for debugging use only.

Overrides:
toString in class BranchElement

setHighlightingMode

public void setHighlightingMode(CompositeHighlighter.HighlightingMode mode)
set the current highlighting mode ; this influences the way the Highligther is painted, but also the result returned by HitTest.

Parameters:
mode - or LOCAL_MODE or GLOBAL_MODE

getHighlightingMode

public CompositeHighlighter.HighlightingMode getHighlightingMode()
Return the current highlighting mode


toggleHighlightingMode

public void toggleHighlightingMode()
Toggle the current highlighting mode


createActions

public ArrayList<PEAction> createActions(ActionDispatcher actionDispatcher,
                                         ActionLocalizer localizer,
                                         HitInfo hi)
Creates an array of Action's related to this object.

Specified by:
createActions in interface ActionFactory
Overrides:
createActions in class AbstractElement
Parameters:
actionDispatcher - répartiteur utilisé pour créer unePEAction
localizer - utilisé pour localiser les paramètre des actions
hi - une HitInfo contenant les informations relatives à l'évènement-souris qui a déclencher le menu contextuel.

createCustomizer

public AbstractCustomizer createCustomizer()
Description copied from interface: CustomizerFactory
Returns a customizer (Swing) component

Specified by:
createCustomizer in interface CustomizerFactory
Returns:
A Customizer for geometry editing.

http://www.jpicedt.org

Submit a bug : syd@jpicedt.org