Encoding Symbols in Strings
It can be useful to let an indirect attribute variable return a Symbol. But a problem is that the referred attribute value must be of type AttributeValue, which can only represent simple types like strings and numbers, not the Symbol type. Therefore, it is possible to represent a Symbol by text that can be used as a string attribute.
The following table lists the ways a symbol can be represented by a string.
Format | Example |
---|---|
Inlined SVG code | <svg><circle cx='0' cy='0' r='6' /></svg> |
Path to an image file | C:/temp/diamond.png |
Using relative paths is not recommended because they will be evaluated from the current directory of the application (which might change during the lifetime of an application or between runs depending on how the application is launched).
The image file must be either SVG or in one of the supported image formats. If the symbol is formed from a raster image, the hotspot will be the center of the image.
Error handling
If an indirect attribute variable fails to interpret its string attribute as a symbol, no exception will be thrown, but an error message will be sent to the Log. The indirect attribute variable will then fall back to its default symbol, if it has one, or return the null symbol.