|| | |||Browse by category|
How can I retrieve the graphic representation of the
IltNetworkElement.Type to use it in an independant Java object?
You can access the network element type renderer factory using global settings
When the network element is rendered using an image, its default renderer factory is an
IltNEImageBaseRendererFactory object, and using the
getSourceImageName() method of this class will give you the image location. You can then use this location to retrieve the image from the
IltDefaultImageRepository object accessible from your
IltNEImageBaseRendererFactory, which will give you the location of the image source that is being used for the network element type.
Now, this methodology works fine for network element types that use an image for rendering.
For other types that are rendering themselves directly through graphic primitives (for example,
IltNEImageBaseRendererFactory is not used.
To overcome this, you can use the
BufferedImage class together with the
paint method of your graphic object, and dump to a graphic file the representation of each Network Element types that you want to use.
BufferedImage image = new BufferedImage(50, 50, BufferedImage.TYPE_INT_RGB); Graphics g = image.getGraphics(); networkView.paint(g); ImageIO.write(image, "jpg", new File("ne_type.jpg"));
This source code fragment demontrates the first methodology, using the
IltSettings.GetValue() together with the