A common use case of a diagram is to place a graph on a map. The nodes of the diagram are usually georeferenced, which means that their location can be specified as latitude and longitude to match a point of interest on the map. This post will describe how to use an IBM ILOG Elixir Maps as the background of an IBM ILOG Elixir Enterprise diagram.
The code shown here is derived from an IBM ILOG Elixir Enterprise diagram sample demo called mapSample which uses an image of the US as a background of a diagram. Note that the code shown here is only a part of the working application. Full sources will be found with the application via the 'view sources' menu entry. The running demo can be found here.
At this stage, we simply replace the image by a Spark map in the skin of the diagram.
Assign the map component as diagram background:
......In the main application, the skin is referenced as follow :
The diagramCreated function is here to place the nodes on the map. At initialization time, the map component is not ready to compute coordinates because the map is not fully loaded and the map data is necessary to perform coordinate conversion. We defer the node location computation by setting the xLocationFunction and yLocationFunction when the creation of the component is complete. xLocationFunction and yLocationFunction are the functions used by the diagram to get the location of a particular node. Node location is computed from the specified longitude and latitude and converted to pixel coordinate using the Map conversion functions. A small optimization is used here: when the diagram calls either for the x or y coordinate, the other coordinate is also computed and stored because the map component is computing x and y at the same time.
Computing node coordinates:
....In the component, we specified that we want to freely zoom and pan the diagram without pressing any modifier key by setting panModifierKey and the whee
And that's it.
The source files are available by right clicking in the application and selecting 'view source'.
Live demo can be run from here.
Elixir Enterprise 3.0
Go to IBM FixCentral
In the drop down lists select
Elixir Standard 3.0
If you are a customer, contact supp
ComponentSource will verify your credentials and will then send you instructions for downloading the patch.
Patch2 release notes
IBM ILOG Elixir Enterprise 3.0 specifics
Common to Elixir Enterprise 3.0 and Elixir Standard 3.0