Changing the Equipment component layers policy

Article ID: 2366
Last updated: 30 May, 2018
Article ID: 2366
Last updated: 30 May, 2018
Revision: 3
Views: 716
Posted: 08 Sep, 2010
by Dean J.
Updated: 30 May, 2018
by Gargani A.

Question

How can I show a LED on Port?

Answer

This feature is possible using a dedicated layer policy (ilog.tgo.graphic.IltCompositeGrapher.LayerPolicy) installed on the equipment component view . In the usual layer policy that is set on the equipment component, leds and ports are located on the same layer and as a consequence, any selection made on a port would raise it over "its" leds in the case the leds are overlapping the port. To avoid that, this layer policy would affect any led equipment graphic with a layer that would have a higher position than the ports resulting in the leds to be always drawn over the ports.

In the following dedicated layer policy, the leds are attached to the alarm balloons layer with has the highest layer z order (this layer appears on top of the view because it is the last to be drawn), resulting for the leds to be drawn over the ports:

package customClasses;
import ilog.tgo.composite.IltcCompositeGraphic;
import ilog.tgo.composite.IltcCompositeManager;
import ilog.tgo.composite.IltcLayer;
import ilog.tgo.graphic.IltCompositeGrapher.LayerPolicy;
import ilog.tgo.model.IltLed;

public class RaiseLedsZorderLayerPolicy
extends LayerPolicy {

  public RaiseLedsZorderLayerPolicy() {
    }
  public RaiseLedsZorderLayerPolicy(IltcCompositeManager cm) {
    super(cm);
  }

  public IltcLayer getDefaultLayer(IltcCompositeGraphic graphic) {
    if (graphic.getRepresentationObject().getIlpObject() instanceof IltLed)
      return getAlarmBalloonLayer();

    IltcLayer rtn = super.getDefaultLayer(graphic);
    return rtn;
  }
}

You also need to install this layer policy on the equipment component view before the datasource is installed on the component such as (in the customClasses sample Main.java class)

protected void doSample (Container container) {
  try {
    // Initialize JTGO
    // Read a deployment descriptor file to initialize JTGO services
    if (isApplet())
      IltSystem.Init(this, "deploy.xml");
    else
      IltSystem.Init("deploy.xml");
    // Initialize the context and resources
    initContext(IltSystem.GetDefaultContext());
    // Initialize the telecom performance state system
    initTelecom();

    // ------------------------
    // Set up the JTGO data source and the equipment component
    // ------------------------
    // Create an equipment component, and load a configuration
    // file for it.
    // Since the configuration file should be applied on top of the
    // default equipment configuration, we do not pass the file into
    // the constructor but load it separately
    dataSource = new IltDefaultDataSource();

    // Read an XML file into the datasource
    dataSource.parse(sampleDataSourceFile);

    // Create an equipment component
    equipmentComponent = new IlpEquipment(sampleConfigurationFile)
    equipmentComponent.getView().getCompositeGrapher()
      .setLayerPolicy(new 
RaiseLedsZorderLayerPolicy(equipmentComponent.getView()
                                                                       .getCompositeGrap
her()));

This article was:   Helpful | Not helpful
Report an issue
Article ID: 2366
Last updated: 30 May, 2018
Revision: 3
Views: 716
Posted: 08 Sep, 2010 by Dean J.
Updated: 30 May, 2018 by Gargani A.
Also listed in


Others in this category