Package doodlepad
Class Layer
java.lang.Object
doodlepad.Layer
An object representing a drawing layer for the Pad class.
Each Layer maintains its own collection of Shapes.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Add a shape to the shapes listvoid
clear()
Remove all shapes from the DoodlePadvoid
clearPad()
Clear the Pad referencegetPad()
Return the Pad that holds this layerReturn an ArrayList of selected Shape objects currently managed by the Pad instanceReturn an ArrayList of Shape objects currently managed by the Pad instanceClone the Layer's current AffineTransform.iterator()
Return an iterator for loop over Shapesvoid
removeShape
(Shape s) Remove a shape from the shapes listvoid
repaint()
Repaint Layer by delegating to parent Pad object.void
reset()
Resets the Layer to have no transformation.void
rotate
(double angle) Add a rotation angle to Layer transform.void
rotate
(double angle, double cx, double cy) Add a rotation angle to Layer transform.void
scale
(double factor) Add a scale factor to Layer transform.void
scale
(double xFactor, double yFactor) Add a scale factor to Layer transform.void
scale
(double factor, double cx, double cy) Add a scale factor to Layer transform.void
scale
(double xFactor, double yFactor, double cx, double cy) Add a scale factor to Layer transform.void
setTransform
(AffineTransform transform) Set a new AffineTransform for the Layer.void
Move shape to the back of diagramvoid
Move shape to the front of diagramvoid
translate
(double deltaX, double deltaY) Add a translate to Layer transform.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
Layer
Layer constructor- Parameters:
pad
- The Pad that holds this Layer
-
-
Method Details
-
getPad
Return the Pad that holds this layer- Returns:
- Pad
-
clearPad
public void clearPad()Clear the Pad reference -
getShapes
Return an ArrayList of Shape objects currently managed by the Pad instance- Returns:
- An ArrayList<Shape> of all Shapes being managed
-
getSelectedShapes
Return an ArrayList of selected Shape objects currently managed by the Pad instance- Returns:
- An ArrayList<Shape> of all selected Shapes being managed
-
iterator
Return an iterator for loop over Shapes -
addShape
Add a shape to the shapes list- Parameters:
s
- The Shape object to add to the Pad
-
removeShape
Remove a shape from the shapes list- Parameters:
s
- The Shape to remove
-
clear
public void clear()Remove all shapes from the DoodlePad -
toFront
Move shape to the front of diagram- Parameters:
s
- The Shape to bring to the front of the display list.
-
toBack
Move shape to the back of diagram- Parameters:
s
- The Shape to move to the back of the display list.
-
rotate
public void rotate(double angle) Add a rotation angle to Layer transform.- Parameters:
angle
- Adds the rotation angle to the current transform (radians)
-
rotate
public void rotate(double angle, double cx, double cy) Add a rotation angle to Layer transform.- Parameters:
angle
- Adds the rotation angle to the current transform (degrees)cx
- x-coordinate of point about which rotation occurscy
- y-coordinate of point about which rotation occurs
-
translate
public void translate(double deltaX, double deltaY) Add a translate to Layer transform.- Parameters:
deltaX
- Translate shape in the x-direction by deltaXdeltaY
- Translate shape in the y-direction by deltaY
-
scale
public void scale(double factor) Add a scale factor to Layer transform.- Parameters:
factor
- Scale the shape by a scale factor
-
scale
public void scale(double factor, double cx, double cy) Add a scale factor to Layer transform.- Parameters:
factor
- Scale the shape by a scale factorcx
- x-coordinate of point about which scaling occurscy
- y-coordinate of point about which scaling occurs
-
scale
public void scale(double xFactor, double yFactor) Add a scale factor to Layer transform.- Parameters:
xFactor
- Scale the shape in the x-direction by a xFactoryFactor
- Scale the shape in the y-direction by a yFactor
-
scale
public void scale(double xFactor, double yFactor, double cx, double cy) Add a scale factor to Layer transform.- Parameters:
xFactor
- Scale the shape in the x-direction by a xFactoryFactor
- Scale the shape in the y-direction by a yFactorcx
- x-coordinate of point about which scaling occurscy
- y-coordinate of point about which scaling occurs
-
reset
public void reset()Resets the Layer to have no transformation. -
getTransform
Clone the Layer's current AffineTransform.- Returns:
- The cloned AffineTransform.
-
setTransform
Set a new AffineTransform for the Layer.- Parameters:
transform
- The new transform.
-
repaint
public void repaint()Repaint Layer by delegating to parent Pad object.
-