| | | | Browse by category |
Question
How to create a network component with BTS element?
Answer
This sample shows a network containing one IltBTS equipment with three IltBTSAntenna objects attached.
import ilog.cpl.IlpNetwork;
import ilog.cpl.datasource.IlpDataSource;
import ilog.cpl.graphic.IlpPoint;
import ilog.tgo.datasource.IltDefaultDataSource;
import ilog.tgo.model.IltBTS;
import ilog.tgo.model.IltBTSAntenna;
import ilog.tgo.model.IltBellcoreObjectState;
import ilog.tgo.model.IltNetworkElement;
import javax.swing.JFrame;
public class Main {
{
// This sample uses JViews TGO features. When deploying an
// application that includes this code, you need to be in possession
// of an IBM ILOG JViews TGO Deployment license.
// Comment the following line of code if using JViews TGO 8.6 or earlier.
IlvProductUtil.DeploymentLicenseRequired(IlvProductUtil.IBM_ILOG_JViews_TGO_Deployment);
}
public static void main(String[] args) {
IlpNetwork network = new IlpNetwork();
network.setDataSource(createDataSource());
createFrame("JTGO BTS Antenna Sample", network);
}
static IlpDataSource createDataSource() {
// Create the objects to be put in the data source
IltBTS bts = new IltBTS("myBTS");
bts.setPosition(new IlpPoint(100, 100));
IltNetworkElement btsEquipment =
new IltNetworkElement("BTS Equipment", IltNetworkElement.Type.BTSEquipment,
new IltBellcoreObjectState());
IltBTSAntenna antenna1 = new IltBTSAntenna("A1", new IltBellcoreObjectState(), 0, 100, 60);
IltBTSAntenna antenna2 = new IltBTSAntenna("A2", new IltBellcoreObjectState(), 120, 50, 60);
IltBTSAntenna antenna3 = new IltBTSAntenna("A3", new IltBellcoreObjectState(), 240, 80, 60);
// Create the data source and add the objects
IltDefaultDataSource dataSource = new IltDefaultDataSource();
dataSource.setParent(btsEquipment, bts);
dataSource.setParent(antenna1, bts);
dataSource.setParent(antenna2, bts);
dataSource.setParent(antenna3, bts);
dataSource.addObject(bts);
dataSource.addObject(btsEquipment);
dataSource.addObject(antenna1);
dataSource.addObject(antenna2);
dataSource.addObject(antenna3);
return dataSource;
}
static JFrame createFrame(String title, IlpNetwork network) {
JFrame frame = new JFrame(title);
frame.getContentPane().add(network);
frame.setLocation(50, 50);
frame.setSize(400, 400);
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
return frame;
}
}