Customizing the metamodel > Symbols: Creating and modifying > Depicting a symbol with an image
  
Depicting a symbol with an image
You can depict a symbol with an image. This is a bitmap (.BMP) or Windows Metafile (.WMF/.EMF) or Scalable Vector Graphic (SVG) that you supply. You can specify how a symbol is depicted on the diagram workspace and also how it is depicted in the toolbox and Draw menu, by adding a depictions clause to the symbols declaration, as follows:
SYMBOL symbol-type-name
{ ...
DEPICTIONS { DIAGRAM depiction-file }
DEPICTIONS { MENU depiction-file }
...
}
The DIAGRAM command specifies the depiction file to be drawn on the diagram workspace. You can use a Windows Metafile (.WMF/EMF) or Scalable Vector Graphic (.SVG) for the DIAGRAM command because it is a vector image that scales properly if you drag on its handlebars to increase or decrease it in size. You can also use .BMP files for the DIAGRAM command, but they do not scale well.
The MENU command specifies the depiction file to appear on the toolbars, menus, and other areas. It is this graphic that you click to select a symbol to draw. For the toolbar, using bitmap images is best, since there is no need for them to scale. Usually, it is best to create a 16x16 pixel bitmap for each symbol that you want to represent in the toolbar.
BMP files are raster files, which means that they store information about each pixel on an image. Although bitmaps can render rich, photo-quality images, they become jumbled when you zoom in or jagged when you zoom out.
depiction-file is the name and full path of a bitmap or a metafile. You can specify a directory outside your encyclopedia’s path, but it is advised to add the bitmaps and metafiles directly to the Files table of an encyclopedia’s database.
Note A symbol's 'Symbol Depiction' value overrides its definition's 'Definition Depiction' value. These override all other depictions. A symbol's list property depiction overrides a symbol's body depiction and that overrides the definition body depiction which overrides any supertype definition body depiction.
To retain the style of the image
For WMF/EMF files, you have the option to retain the style of the image that you are using. This maintains the original coloring and style of the symbol in the tool. Also add the RETAIN STYLE keyword to the syntax of the depictions clause. SVG images will always retain their styles.
To add your own depiction files to an encyclopedia
1 Make the necessary changes to USRPROPS.TXT. An example for such code is:
RENAME DIAGRAM "User 1" TO "Wireless Communications"
RENAME SYMBOL "User 1" TO "Satellite"
SYMBOL "Satellite"
{ASSIGN To "Wireless Network"
DEPICTIONS { DIAGRAM satellite.wmf }
DEPICTIONS { MENU satellite_toolbar.bmp }
}
2 Import the .BMP and .WMF files into the encyclopedia’s FILES table.
You can either use System Architect's Encyclopedia File Manager (Tools > Encyclopedia File Manager), SAEM, or Microsoft Enterprise Manager. Encyclopedia File Manager can import one file at a time. If you have multiple graphics files, you can use SAEM to import the files into the FILES table.
The names of the files that you import should be consistent with your USRPROPS.TXT code. The above example uses a relative path by not specifying any path at all: just listing satellite.wmf and satellite.bmp. This means that the depiction files should be imported directly into the Files table of the database.
An convention is to append the name of your depiction files with images/ to specify that each depiction file is in an images subdirectory of the FILES table. If you use SAEM to import multiple files at a time, make sure that they are in a directory that is named images/, anywhere on your computer. SAEM appends the name of all files imported from a directory named images with images/ at the front of each graphic’s file name. You can specify the images/ before the name of each depiction file in your USRPROPS.TXT, which makes the above example:
RENAME DIAGRAM "User 1" TO "Wireless Communications"
RENAME SYMBOL "User 1" TO "Satellite"
SYMBOL "Satellite"
{ASSIGN To "Wireless Network"
DEPICTIONS { DIAGRAM images\satellite.wmf }
DEPICTIONS { MENU images\satellite_toolbar.bmp }
}
There are two advantages to using this strategy:
It provides a name independence and logical grouping strategy for user-specified images
It is consistent with the way that images are handled when new encyclopedias are created: System Architect takes all graphics in the ..\System Architect\images directory, puts them in the FILES table of the new encyclopedia, and gives them a name that is appended with images/.
The figure below shows the Files table of an encyclopedia’s database, on how the images/ prefix to depiction files provides a logical grouping of images.
This graphic is described in the surrounding text.
3 Reopen the Encyclopedia for the changes to take effect.
See also
Syntax of the depictions clause
Depicting symbols like other symbols
User-defined symbol presentation based on property value
WMF/EMF/SVG vs. BMP files
Displayable properties for symbols depicted by a bitmap or metafile
Depicting line symbols
Symbols: Creating and modifying