|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.mindfusion.diagramming.Shape
public class Shape
A Shape object describes a shape consisting of a series of straight lines, arcs and Bezier curves. The main component of a shape definition is its outline, which describes the shape region that will be filled in color, and used for hit-testing and aligning arrows to the shape. A shape can also contain decorations - lines, arcs or Bezier curves that are drawn with the shape but do not influence the fill or hit testing.
A shape is used by applying it to a ShapeNode
instance by calling the
ShapeNode.setShape(com.mindfusion.diagramming.Shape)
method.
Constructor Summary | |
---|---|
Shape(ElementTemplate[] outline,
ElementTemplate[] decorations,
ElementTemplate[] textArea,
int windingRule,
java.lang.String id)
Initializes a new Shape instance by setting its outline,
decorations, text area, fill rule and shape identifier. |
|
Shape(ElementTemplate[] elements,
ElementTemplate[] decorations,
ElementTemplate[] textArea,
int windingRule,
java.lang.String id,
ShapeDecoration[] closedDecorations)
|
|
Shape(ElementTemplate[] outline,
int windingRule,
java.lang.String id)
Initializes a new Shape instance by setting its outline,
fill rule and shape identifier. |
|
Shape(short[] outline,
java.lang.String id)
Initializes a new instance of the Shape class with the specified outline and id. |
Method Summary | |
---|---|
void |
draw(java.awt.Graphics2D drawingContext,
Brush brush,
Pen pen,
boolean shadow)
Draws this shape on the specified DrawingContext surface. |
static Shape |
fromId(java.lang.String id)
Returns the shape that has the specified identifier. |
static Shape |
fromXmlElement(org.w3c.dom.Element e)
Creates a ShapeTemplate from xml shape element |
static Shape[] |
fromXmlElements(org.w3c.dom.Element shapes)
|
java.lang.String |
getDisplayName()
|
java.lang.String |
getId()
Return the shape identifier. |
java.awt.Image |
getImage()
Gets an image that is displayed by default in all instances of this shape. |
java.lang.String |
getImageLocation()
Get the image location. |
java.awt.geom.Rectangle2D.Float |
getImageRectangle()
Gets the location of the shape image relatively to the bounding rectangles of boxes of this shape. |
boolean |
getIsArrowhead()
Gets a value indicating if this shape is used as arrowhead. |
ElementTemplate[] |
getOutline()
|
static ShapeList |
getShapes()
Returns a list of all shapes definitions. |
ElementTemplate[] |
getTextArea()
|
void |
setDisplayName(java.lang.String displayName)
|
void |
setId(java.lang.String value)
|
void |
setImage(java.awt.Image image)
Sets an image that should be displayed by default in all instances of this shape. |
void |
setImageLocation(java.lang.String url)
Accepted are absolute URLs, and relative paths with both back and forward slashes .NET ShapeEditor may produce absolute filesystem image paths when the images are on different drive than the shape library xml, and they will not work on java. |
void |
setImageRectangle(java.awt.geom.Rectangle2D.Float imageRectangle)
Sets the location of the shape image relatively to the bounding rectangles of boxes of this shape. |
org.w3c.dom.Element |
toDOM(org.w3c.dom.Document owner)
|
static org.w3c.dom.Element[] |
toDOM(Shape[] shapes,
org.w3c.dom.Document owner)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Shape(ElementTemplate[] outline, int windingRule, java.lang.String id)
Shape
instance by setting its outline,
fill rule and shape identifier.
outline
- An array of ElementTemplate
objects representing
the shape outline, which specifies what region of a box is filled,
used for hit-testing and for aligning arrow end point to the box.windingRule
- GeneralPath.WIND_EVEN_ODD or GeneralPath.WIND_NON_ZERO.id
- An unique String
identifier of this shape.public Shape(ElementTemplate[] outline, ElementTemplate[] decorations, ElementTemplate[] textArea, int windingRule, java.lang.String id)
Shape
instance by setting its outline,
decorations, text area, fill rule and shape identifier.
outline
- An array of ElementTemplate
objects representing
the shape outline, which specifies what region of a box is filled,
used for hit-testing and for aligning arrow end point to the box.decorations
- An array of ElementTemplate
objects representing
the shape decoration lines.textArea
- An array of ElementTemplate
objects representing
the region of the shape where box' text is laid out.windingRule
- GeneralPath.WIND_EVEN_ODD or GeneralPath.WIND_NON_ZERO.id
- An unique String
identifier of this shape.public Shape(ElementTemplate[] elements, ElementTemplate[] decorations, ElementTemplate[] textArea, int windingRule, java.lang.String id, ShapeDecoration[] closedDecorations)
public Shape(short[] outline, java.lang.String id)
outline
- An array containing even number of coordinate values,
which define the points of the shape outline.id
- The string identifier of the new shape.Method Detail |
---|
public java.lang.String getId()
String
object containing the shape identifier.public void setId(java.lang.String value)
public static ShapeList getShapes()
ShapeList
that contains all shape definitions.public static Shape fromId(java.lang.String id)
id
- The identifier of the looked-for shape.
Shape
identified by the specified string.public static Shape[] fromXmlElements(org.w3c.dom.Element shapes) throws javax.xml.transform.TransformerException, XmlException
javax.xml.transform.TransformerException
XmlException
public static Shape fromXmlElement(org.w3c.dom.Element e) throws javax.xml.transform.TransformerException, XmlException
javax.xml.transform.TransformerException
XmlException
public java.lang.String getImageLocation()
public void setImageLocation(java.lang.String url)
url
- public static org.w3c.dom.Element[] toDOM(Shape[] shapes, org.w3c.dom.Document owner)
public org.w3c.dom.Element toDOM(org.w3c.dom.Document owner)
public java.awt.Image getImage()
Image
displayed inside boxes of this shape.public void setImage(java.awt.Image image)
image
- An Image
that should be displayed inside boxes of this shape.public java.awt.geom.Rectangle2D.Float getImageRectangle()
public void setImageRectangle(java.awt.geom.Rectangle2D.Float imageRectangle)
imageRectangle
- A Rectangle2D object specifying the image
coordinates as percents of the box bounds.public void setDisplayName(java.lang.String displayName)
displayName
- The name that should be displayed for this shape
in user interface, e.g. in the ShapeListBox.public java.lang.String getDisplayName()
public boolean getIsArrowhead()
public ElementTemplate[] getOutline()
public ElementTemplate[] getTextArea()
public void draw(java.awt.Graphics2D drawingContext, Brush brush, Pen pen, boolean shadow)
drawingContext
- The DrawingContext surface to draw the shape on.brush
- A Brush used to fill the shape.pen
- A Pen used to draw the shape outline.shadow
- When shadow is true the brush and pen parameters have higher priority over shape's brush and pen.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |