Package org.apache.batik.apps.svgbrowser
Class ElementOverlayManager
- java.lang.Object
-
- org.apache.batik.apps.svgbrowser.ElementOverlayManager
-
public class ElementOverlayManager extends java.lang.ObjectManages element overlay on the canvas.- Version:
- $Id: ElementOverlayManager.java 1804130 2017-08-04 14:41:11Z ssteiner $
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classElementOverlayManager.ElementOverlayThe element overlay.
-
Field Summary
Fields Modifier and Type Field Description protected JSVGCanvascanvasThe canvas.protected ElementOverlayControllercontrollerThe controller for the element overlay.protected OverlayelementOverlayThe element overlay.protected java.awt.ColorelementOverlayColorThe color of the element overlay.protected java.awt.ColorelementOverlayStrokeColorThe color of the outline of the element overlay.protected java.util.ArrayListelementsElements to paint.protected booleanisOverlayEnabledWhether the ElementOverlay is enabled.protected booleanxorModeThe xor mode.
-
Constructor Summary
Constructors Constructor Description ElementOverlayManager(JSVGCanvas canvas)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddElement(org.w3c.dom.Element elem)Adds an element to the element selection.protected java.awt.RectanglegetAllElementsBounds()Get the current selection bounds.protected java.awt.RectanglegetElementBounds(GraphicsNode node)The bounds of a given graphics node.protected java.awt.RectanglegetElementBounds(org.w3c.dom.Element elem)The bounds of a given element.OverlaygetElementOverlay()Gets the elementOverlay.java.awt.ColorgetElementOverlayColor()Gets the elementOverlayColor.java.awt.ColorgetElementOverlayStrokeColor()Gets the elementOverlayStrokeColor.booleanisOverlayEnabled()If the element overlay is enabled.booleanisXorMode()Gets the xorMode.protected java.awt.Rectangleoutset(java.awt.Rectangle r, int amount)Increases the given rectangle area for a given amount of units in a rectangle increasement manner.voidremoveElement(org.w3c.dom.Element elem)Removes the element from the element selection and adds its bound to the 'dirty' region.voidremoveElements()Removes all elements from the element selection list.voidremoveOverlay()Removes the elementOverlay.voidrepaint()Repaints the canvas.voidsetController(ElementOverlayController controller)Sets the element overlay controller.voidsetElementOverlayColor(java.awt.Color selectionOverlayColor)Sets the color to use for the element overlay.voidsetElementOverlayStrokeColor(java.awt.Color selectionOverlayStrokeColor)Sets the color to use for stroking the element overlay.voidsetOverlayEnabled(boolean isOverlayEnabled)Enables / disables the Element overlay.voidsetXorMode(boolean xorMode)Sets the xor mode.
-
-
-
Field Detail
-
elementOverlayStrokeColor
protected java.awt.Color elementOverlayStrokeColor
The color of the outline of the element overlay.
-
elementOverlayColor
protected java.awt.Color elementOverlayColor
The color of the element overlay.
-
xorMode
protected boolean xorMode
The xor mode.
-
canvas
protected JSVGCanvas canvas
The canvas.
-
elementOverlay
protected Overlay elementOverlay
The element overlay.
-
elements
protected java.util.ArrayList elements
Elements to paint.
-
controller
protected ElementOverlayController controller
The controller for the element overlay.
-
isOverlayEnabled
protected boolean isOverlayEnabled
Whether the ElementOverlay is enabled.
-
-
Constructor Detail
-
ElementOverlayManager
public ElementOverlayManager(JSVGCanvas canvas)
Constructor.- Parameters:
canvas- The parent canvas
-
-
Method Detail
-
addElement
public void addElement(org.w3c.dom.Element elem)
Adds an element to the element selection.- Parameters:
elem- The element to add
-
removeElement
public void removeElement(org.w3c.dom.Element elem)
Removes the element from the element selection and adds its bound to the 'dirty' region.- Parameters:
elem- The element to remove
-
removeElements
public void removeElements()
Removes all elements from the element selection list.
-
getAllElementsBounds
protected java.awt.Rectangle getAllElementsBounds()
Get the current selection bounds.- Returns:
- the current selection bounds
-
getElementBounds
protected java.awt.Rectangle getElementBounds(org.w3c.dom.Element elem)
The bounds of a given element.- Parameters:
elem- The given element- Returns:
- Rectangle bounds
-
getElementBounds
protected java.awt.Rectangle getElementBounds(GraphicsNode node)
The bounds of a given graphics node.- Parameters:
node- The given graphics node- Returns:
- the bounds
-
outset
protected java.awt.Rectangle outset(java.awt.Rectangle r, int amount)Increases the given rectangle area for a given amount of units in a rectangle increasement manner.- Parameters:
r- The given rectangleamount- The given amount of units- Returns:
r
-
repaint
public void repaint()
Repaints the canvas.
-
getElementOverlayColor
public java.awt.Color getElementOverlayColor()
Gets the elementOverlayColor.- Returns:
- the elementOverlayColor
-
setElementOverlayColor
public void setElementOverlayColor(java.awt.Color selectionOverlayColor)
Sets the color to use for the element overlay.- Parameters:
selectionOverlayColor- The new element overlay color.
-
getElementOverlayStrokeColor
public java.awt.Color getElementOverlayStrokeColor()
Gets the elementOverlayStrokeColor.- Returns:
- the elementOverlayStrokeColor
-
setElementOverlayStrokeColor
public void setElementOverlayStrokeColor(java.awt.Color selectionOverlayStrokeColor)
Sets the color to use for stroking the element overlay.- Parameters:
selectionOverlayStrokeColor- The new element overlay stroking color.
-
isXorMode
public boolean isXorMode()
Gets the xorMode.- Returns:
- the xorMode
-
setXorMode
public void setXorMode(boolean xorMode)
Sets the xor mode.- Parameters:
xorMode- the xorMode to set
-
getElementOverlay
public Overlay getElementOverlay()
Gets the elementOverlay.- Returns:
- the elementOverlay
-
removeOverlay
public void removeOverlay()
Removes the elementOverlay.
-
setController
public void setController(ElementOverlayController controller)
Sets the element overlay controller.- Parameters:
controller- The element overlay controller
-
isOverlayEnabled
public boolean isOverlayEnabled()
If the element overlay is enabled.- Returns:
- isOverlayEnabled
-
setOverlayEnabled
public void setOverlayEnabled(boolean isOverlayEnabled)
Enables / disables the Element overlay.
-
-