Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

You can use an ActiveImage to represent each state of a runtime object whose Classifier is represented by the ImageSwitcher that owns the ActiveImage. The FlashingLight.mdzip sample is used throughout this page. You can open the sample by downloading it from the attached link.


To use the ImageSwitcher and ActiveImage to represent a state


  1. Create an ImageSwitcher element, and set its represent tag definition with a Classifier whose state will be represented by an active image owned by the ImageSwitcher.
  2. Create an ActiveImage in the ImageSwitcher for each State of the Classifier represented by the ImageSwitcher.
  3. Specify the image that will be the image attribute of each created ActiveImage and set the State, which will be represented by the ActiveImage, as the tagged value of the activeElement tag definition. 


The following figure illustrates an example of how to use ImageSwitcher and ActiveImage to represent the States of a runtime object (see the FlashingLight.mdzip sample)


Using ImageSwitcher in the FlashingLight.mdzip sample with internal simulation clock.

The image that appears on the web UI through ImageSwitcher is the same image that represents the current State of simulation UI. If the image on the simulation UI is changed, the image on the Web UI will change accordingly and vice versa. Either image is able to accept a signal by clicking the mouse.


Setting startWebServer to true in the Simulation Config to show the web UI.

Sample model

The model used in the figures of this page is the FlashingLight.mdzip sample model that comes with MagicDraw. To open this sample, do either of the following


  • Download FlashingLight.mdzip.
  • Find it in the modeling tool <install_root>\samples\simulation\FlashingLight.mdzip.