Package g3.project.elements
Class ShapeElement
- java.lang.Object
-
- nu.xom.Node
-
- nu.xom.ParentNode
-
- nu.xom.Element
-
- g3.project.elements.VisualElement
-
- g3.project.elements.ShapeElement
-
- All Implemented Interfaces:
Scriptable
public class ShapeElement extends VisualElement
- Author:
- Group 3
-
-
Constructor Summary
Constructors Constructor Description ShapeElement(java.lang.String name)
Constructor.ShapeElement(java.lang.String name, java.lang.String uri)
Constructor.ShapeElement(nu.xom.Element element)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
delete(DocIO resIO)
Delete the element and sub-elements.java.util.ArrayList<java.lang.Double>
getSegPoints()
Get a list of points if the element is a line or polygon.java.util.Optional<java.util.ArrayList<StyledTextSeg>>
getText()
Gets text for shape element - optional as won't necessarily exist.java.util.Optional<javafx.scene.paint.Color>
getTextColour()
Get Text Colour.java.lang.String
getTextString()
Get my text string.java.lang.String
getType()
Get the Shape's type.void
setAlignment(java.lang.String hAlign, java.lang.String vAlign)
Set text alignment.void
setFont(java.lang.String font, java.lang.String colour, java.lang.Double size, java.lang.Boolean underscore, java.lang.Boolean italic, java.lang.Boolean bold)
Set my font.void
setSegPoints(java.util.ArrayList<java.lang.Double> points)
Set segment points for polygon or alt-line.void
setStroke(java.lang.String colour, java.lang.String style, java.lang.Double width)
Set a shape's stroke.void
setText(java.lang.String text)
Set a text string, preserving properties of the first segment.void
setText(java.util.ArrayList<StyledTextSeg> text)
Sets text of the shape element.void
setTextAlpha(java.lang.Double alpha)
Set alpha of contained text.void
setTextColour(java.lang.String colour)
Set text Colour.void
setTextProperties(java.util.HashMap<java.lang.String,java.lang.Object> props)
Set my text properties via map.java.lang.String
setType(java.lang.String type)
Set the shape's type.-
Methods inherited from class g3.project.elements.VisualElement
addScriptFile, derefAttribute, getAllProps, getAlpha, getByID, getDelaySecs, getDurationSecs, getEvalRequired, getFillColour, getID, getOrigin, getPage, getParentElementScriptingBindings, getParentScriptable, getRealType, getScriptEl, getScriptingBindings, getSize, getStateVariable, getStroke, getVisibility, getVisualProps, getZInd, hasUpdated, makeAttrWithNS, putStateVariable, setAlpha, setDelaySecs, setDurationSecs, setEvalRequired, setFillColour, setID, setOriginXY, setOriginXY, setProps, setSize, setSize, setVisibility, setZInd
-
Methods inherited from class nu.xom.Element
addAttribute, addNamespaceDeclaration, appendChild, copy, getAttribute, getAttribute, getAttribute, getAttributeCount, getAttributeValue, getAttributeValue, getBaseURI, getChildElements, getChildElements, getChildElements, getFirstChildElement, getFirstChildElement, getLocalName, getNamespaceDeclarationCount, getNamespacePrefix, getNamespacePrefix, getNamespaceURI, getNamespaceURI, getQualifiedName, getValue, insertChild, removeAttribute, removeChildren, removeNamespaceDeclaration, setBaseURI, setLocalName, setNamespacePrefix, setNamespaceURI, shallowCopy, toString, toXML
-
Methods inherited from class nu.xom.ParentNode
appendChild, getChild, getChildCount, indexOf, insertChild, removeChild, removeChild, replaceChild
-
-
-
-
Constructor Detail
-
ShapeElement
public ShapeElement(java.lang.String name)
Constructor.- Parameters:
name
- Element Name.
-
ShapeElement
public ShapeElement(java.lang.String name, java.lang.String uri)
Constructor.- Parameters:
name
- Element Name.uri
- Element URI.
-
ShapeElement
public ShapeElement(nu.xom.Element element)
Constructor- Parameters:
element
- Element.
-
-
Method Detail
-
getType
public java.lang.String getType()
Get the Shape's type.- Returns:
- Shape's Type.
-
setType
public java.lang.String setType(java.lang.String type)
Set the shape's type.- Parameters:
type
- Shape Type.- Returns:
- Maybe set type.
-
delete
public void delete(DocIO resIO)
Description copied from class:VisualElement
Delete the element and sub-elements.- Specified by:
delete
in classVisualElement
- Parameters:
resIO
- Resource handler to remove resources on delete.
-
setStroke
public void setStroke(java.lang.String colour, java.lang.String style, java.lang.Double width)
Set a shape's stroke.- Parameters:
colour
- Colour to set.style
- Stroke Style.width
- Stroke Width.
-
setSegPoints
public final void setSegPoints(java.util.ArrayList<java.lang.Double> points) throws java.lang.Exception
Set segment points for polygon or alt-line.- Parameters:
points
- Segment points.- Throws:
java.lang.Exception
- Something odd happened.
-
getSegPoints
public final java.util.ArrayList<java.lang.Double> getSegPoints()
Get a list of points if the element is a line or polygon.- Returns:
- List of points if line or polygon, else returns an empty list.
-
getText
public java.util.Optional<java.util.ArrayList<StyledTextSeg>> getText()
Gets text for shape element - optional as won't necessarily exist.- Returns:
- Maybe text array.
-
getTextString
public java.lang.String getTextString()
Get my text string.- Returns:
- String of text contained.
-
setText
public final void setText(java.util.ArrayList<StyledTextSeg> text)
Sets text of the shape element.- Parameters:
text
- Text segments to set.
-
setText
public void setText(java.lang.String text)
Set a text string, preserving properties of the first segment.- Parameters:
text
- Text string to set.
-
setTextProperties
public void setTextProperties(java.util.HashMap<java.lang.String,java.lang.Object> props)
Set my text properties via map.- Parameters:
props
- Properties to set.
-
setTextAlpha
public void setTextAlpha(java.lang.Double alpha)
Set alpha of contained text.- Parameters:
alpha
- Opacity/Alpha value.
-
setTextColour
public void setTextColour(java.lang.String colour)
Set text Colour.- Parameters:
colour
- Colour String.
-
getTextColour
public java.util.Optional<javafx.scene.paint.Color> getTextColour()
Get Text Colour.- Returns:
- Text Colour.
-
setAlignment
public void setAlignment(java.lang.String hAlign, java.lang.String vAlign)
Set text alignment.- Parameters:
hAlign
- Horizontal.vAlign
- Vertical.
-
setFont
public void setFont(java.lang.String font, java.lang.String colour, java.lang.Double size, java.lang.Boolean underscore, java.lang.Boolean italic, java.lang.Boolean bold)
Set my font.- Parameters:
font
- Font Name.colour
- Font Colour.size
- Font Size.underscore
- Underscore?italic
- Italicise?bold
- Bold?
-
-