Show in Frame No Frame
Up Previous Next Title Page Index Contents Search

8.4.5 Symbols and icons

Symbols are exported as part of their respective object, relationship or role type definitions, and icons as part of object, relationship, role, graph and port type definitions.
<graph>
  <icon>...</icon>
  <object>
    <objectSymbol>...</objectSymbol>
    <icon>...</icon>
  </object>
  <relationship>
    <relationshipSymbol>...</relationshipSymbol>
  </relationship>
  <role>
    <roleSymbol>...</roleSymbol>
</role>
</graph>
The vector graphics information for symbols is represented in the W3C SVG format using the 1.2 Tiny profile, which is more than adequate for our graphics needs. Icons simply wrap this in an icon element in the http://www.metacase.com/icon namespace, with just a simple offset attribute. The extra information needed for representing complete symbols, e.g. connectables, role lines and MetaEdit+ specific extensions to standard SVG elements, is represented in the namespace http://www.metacase.com/symbol. The general structure of an XML document fragment for an object symbol looks like this:
<objectSymbol offset="50,50" scaleFilter="1,1"
    xmlns="http://www.metacase.com/symbol">
  <defaultConnectable></defaultConnectable>
  <connectable>...</connectable>
  <connectable>...</connectable>
  <svg baseProfile="tiny" version="1.2"
       xmlns="http://www.w3.org/2000/svg"
       width="140" height="80" >
  </svg>
</objectSymbol>
The extra attributes and elements required by object symbol are:
*offset that offsets the top-left coordinates of all symbol elements when opened in the Symbol Editor.
*scaleFilter for setting whether or not the symbol is allowed to scale. This can be set separately for the vertical and horizontal axis. For both axes, 1 stands for true and 0 for false, i.e. “1,1” means that it is ok to scale symbol horizontally and vertically, whereas “0,1” allows scaling only vertically and “0,0” forbids any scale operations.
*defaultConnectable that defines the default connectable, obligatory in object and relationship symbols.
*connectable for each additional, optional connectable for a static port in an object symbol.
Both default and optional connectables share the same attribute set:
<defaultConnectable isSticky="true"
    points="70,30 140,30 140,80 70,80 70,30"
    targetPointX="105" targetPointY="55"
    usesGrid="false"></defaultConnectable>
These attributes are:
*isSticky to set the targetpoint’s stickyness (accepted values are true and false). For more information about sticky and non-sticky targetpoints, please see Section 3.2.10.
*points, a collection of X and Y coordinate pairs that define the connectable’s perimeter polyline.
*targetPointX and targetPointY that define the targetpoint’s coordinate.
*usesGrid that defines whether or not the connectable is grid sensitive, i.e. whether or not the grid setting is taken into account while connecting to a connectable with a non-sticky target point (accepted values are true and false).
In addition to these, the non-default connectables also need to define their static port:
<connectable isSticky="true"...>
  <port>...</port>
</connectable>
The structure for relationship symbols is a simplified version of the one for object symbols. The relationship symbols can have only one connectable, the default one, and therefore there is no need for a collection of optional connectables:
<relationshipSymbol offset="50,50" scaleFilter="1,1"
    xmlns="http://www.metacase.com/symbol">
  <defaultConnectable></defaultConnectable>
  <svg>...</svg>
</relationshipSymbol>
The role symbols then follow a completely different pattern:
<roleSymbol xmlns="http://www.metacase.com/symbol">
  <rolelineGOs>...</rolelineGOs>
  <rolelineGOs>...</rolelineGOs>
  <svg>...</svg>
</roleSymbol>
The roleSymbol elements do not have other attributes than the required XML namespace reference. The definitions of each roleline is contained in its own rolelineGOs element (the unfortunate plural is kept for backwards compatibility), whereas normal symbol elements are contained as usual by the <svg> tag. The structure for rolelineGOs is as follows:
<rolelineGOs stroke="rgb(0,0,0)" stroke-width="1"
    stroke-dasharray="1,1">
  <metaInfo shouldRotate="false">
    <displayCondition>...</displayCondition>
  </metaInfo>
</roleLineGOs>
The attributes of rolelineGOs define the line style:
*stroke sets the color of the line (as RGB values).
*stroke-width sets the width of the line (as integer values).
*stroke-dasharray defines the dash pattern for dashed lines (as a pattern of sequential dash and interval lengths in pixels, i.e. “1,1” reads “1px dash followed by 1px interval” and “4,2” reads “4px dash followed by 2px interval”).
In addition to the attributes, a rolelineGOs contains a metaInfo element with shouldRotate="false" (which has no effect) and possibly a displayCondition. For more information about metaInfo elements, please see the section about common SVG extensions in chapter 8.4.6.

Show in Frame No Frame
Up Previous Next Title Page Index Contents Search