public class Shape
extends java.lang.Object
A shape is used by applying it to a ShapeNode
instance by calling the
ShapeNode.setShape(com.mindfusion.diagramming.Shape)
method.
Constructor and Description |
---|
Shape(ElementTemplate[] outline,
ElementTemplate[] decorations,
ElementTemplate[] textArea,
android.graphics.Path.FillType 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,
android.graphics.Path.FillType windingRule,
java.lang.String id,
ShapeDecoration[] closedDecorations) |
Shape(ElementTemplate[] outline,
android.graphics.Path.FillType 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.
|
Modifier and Type | Method and Description |
---|---|
void |
draw(android.graphics.Canvas canvas,
Brush brush,
Pen pen,
boolean shadow)
Draws this shape on the specified Canvas drawing 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) |
AnchorPattern |
getAnchorPattern()
Gets the default anchor pattern for nodes that use this shape.
|
ElementTemplate[] |
getDecorations()
Gets a list of all decorations of this shape.
|
java.lang.String |
getDisplayName() |
android.graphics.Path |
getHitPath(android.graphics.RectF rect,
boolean flipX,
boolean flipY,
double rotationAngle) |
java.lang.String |
getId()
Return the shape identifier.
|
android.graphics.Bitmap |
getImage()
Gets an image that is displayed by default in all instances of this shape.
|
java.lang.String |
getImageLocation()
Get the image location.
|
android.graphics.RectF |
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.
|
float |
getLinkSegmentInset()
Gets what length of link's line segment is drawn inside the arrowhead shape, expressed as percents of arrowhead size.
|
ElementTemplate[] |
getOutline()
Gets the outline of this shape.
|
android.graphics.Path |
getRenderPath(ShapeData data,
boolean flipX,
boolean flipY,
double rotationAngle) |
static ShapeList |
getShapes()
Returns a list of all shapes definitions.
|
ElementTemplate[] |
getTextArea()
Gets the outline of the text area of this shape.
|
ShapeData |
initData(android.graphics.RectF rc,
double rotation) |
boolean |
isEllipse()
Gets a value indicating whether this shape is elliptic.
|
void |
setAnchorPattern(AnchorPattern value)
Sets the default anchor pattern for nodes that use this shape.
|
void |
setDisplayName(java.lang.String displayName) |
void |
setId(java.lang.String value) |
void |
setImage(android.graphics.Bitmap 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(android.graphics.RectF imageRectangle)
Sets the location of the shape image relatively to the bounding rectangles of boxes of this shape.
|
void |
setLinkSegmentInset(float value)
Sets what length of link's line segment is drawn inside the arrowhead shape, expressed as percents of arrowhead size.
|
void |
setTextArea(ElementTemplate[] value)
Sets the outline of the text area 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) |
public Shape(ElementTemplate[] outline, android.graphics.Path.FillType 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 link end point to the box.windingRule
- Path.FillType.WINDING or Path.FillType.WINDING.id
- An unique String
identifier of this shape.public Shape(ElementTemplate[] outline, ElementTemplate[] decorations, ElementTemplate[] textArea, android.graphics.Path.FillType 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 link 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
- Path.FillType.WINDING or Path.FillType.WINDING.id
- An unique String
identifier of this shape.public Shape(ElementTemplate[] elements, ElementTemplate[] decorations, ElementTemplate[] textArea, android.graphics.Path.FillType 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.public ShapeData initData(android.graphics.RectF rc, double rotation)
public android.graphics.Path getHitPath(android.graphics.RectF rect, boolean flipX, boolean flipY, double rotationAngle)
public android.graphics.Path getRenderPath(ShapeData data, boolean flipX, boolean flipY, double rotationAngle)
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 android.graphics.Bitmap getImage()
Bitmap
displayed inside boxes of this shape.public void setImage(android.graphics.Bitmap image)
image
- An Bitmap
that should be displayed inside boxes of this shape.public android.graphics.RectF getImageRectangle()
public void setImageRectangle(android.graphics.RectF imageRectangle)
imageRectangle
- A RectF object specifying the image
coordinates as percents of the box bounds.public AnchorPattern getAnchorPattern()
AnchorPattern
instance.public void setAnchorPattern(AnchorPattern value)
value
- An AnchorPattern
instance.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()
ElementTemplate
objects specifying the outline of the shape.public ElementTemplate[] getDecorations()
ElementTemplate
objects specifying the decorations of this shape.public ElementTemplate[] getTextArea()
ElementTemplate
objects specifying the text area of this shape.public void setTextArea(ElementTemplate[] value)
value
- An array of ElementTemplate
objects specifying the text area of this shape.public boolean isEllipse()
public void draw(android.graphics.Canvas canvas, Brush brush, Pen pen, boolean shadow)
canvas
- The Canvas on which to draw this shape.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.public float getLinkSegmentInset()
public void setLinkSegmentInset(float value)
value
- A float value specifying percentage of arrowhead size.