This class is used to store the SVG library used to draw sprites in a DiagramView.
The class is a singleton. Only one SVGAssetLibrary can be created and this singleton is used by all DiagramView.
SVGAssertLibrary supports a subset of SVG 1.1. Most of the features needed for sprite definitions are supported :
Full support of drawing paths with: line, elliptic arcs, cubic Bezier curves, quadratic Bezier curves commands.
SVG text features are partially implemented and match the text rendering capabilities of the flash player (<text>, <tspan>).
Full support of transformations: translate, scale, rotate, skewX, skewY, matrix.
Styling using simple and complex CSS selectors is supported.
Gradients and gradients linking definitions are supported.
Sprite definition
To define sprites, Diagrammer uses extensions to standard SVG. They are defined in the namespace http://schemas.kapit.fr/svg/2007/. You must add to the
Each sprite must be defined as a group (<g> tag), with the followings attributes :
k:spriteid defines the identifier of the sprite. It is used in Diagrammer as a unique identifier for a specific shape.
k:groupid defines the group of the sprite. Diagrammer provides a method to retrieve all sprite of a given group. This functionality can used by components (drop down menu, panels) that enable user to select any sprite from a given group.
Actions and anchor point definition
Using css styling, you can define how user can interact with each sprite.
To enable input links to a part of a sprite, you must add the style action-accept:link to this part (it can be a group or any basic drawing instruction).
To enable output links for a part of a sprite, you must add the style action-click:link to this part.
To enable annotation for a part of a sprite, you must add the action-accept:annotation to this part. We usually put this in the group that defines the sprite.
As a basic rule, it is better to add a dedicated transparent path to define the link anchors, but depending on the sprite we can use part of sprite.
SVG Extensions
This library implements SVG extensions to provide rendering and manipulation indications to applications.
These extensions use the namespace k, URI: http://schemas.kapit.fr/svg/2007/.
Their main purpose is to :
implement multiline text fields on top of single line text fields as described by SVG 1.1 specification.
provide pretty resizing of SVG elements (ie how does a child element resize itself when its parent is resized).
Attributes :
k:wordwrap (true | false) : used with tag to provide automatic line breaking on word boundaries
k:lock (left|right|top|bottom|all|none): for pretty resizing of elements in relation to their parent position
Tags :
<k:textfield> : generated tag, used internally to manage multiline textfields which are not provided by SVG specification.
Example This sample show how to create the SVGAssetLibary during application preinitialization
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
preinitialize="init();"
...
...
<mx:XML xmlns="" id="svglib">
<svg ....
...
</svg>
</mx:XML>
...
...
public function init():void
{
var lib:SVGAssetLibrary=new SVGAssetLibrary(svglib);
}
...
librarystylesheet:String [read-write]Implementation public function get librarystylesheet():String public function set librarystylesheet(value:String):void
sysgroupnames
property
sysgroupnames:Array [read-only]Implementation public function get sysgroupnames():Array
_syslib
property
protected static var _syslib:XSVGLibrary = null
systemstylesheet
property
systemstylesheet:String [read-write]Implementation public function get systemstylesheet():String public function set systemstylesheet(value:String):void
Constructor detail
SVGAssetLibrary
()
constructor
public function SVGAssetLibrary(svg:XML)
Creates a new SVGAssetLibrary instance from an svg object.
Parameters
svg:XML — An svg object from which the SVGAssetLibrary will be created.
Method detail
_getSVGAsset
()
method
protected function _getSVGAsset(lib:XSVGLibrary, spriteid:String, w:Boolean, h:*, keepAspectRatio:* = true):SVGAssetParameters