Search in sources :

Example 1 with HopInfo

use of org.netxms.client.topology.HopInfo in project netxms by netxms.

the class IPRouteMap method getRoute.

/**
 * Get route between objects and build map page
 *
 * @throws Exception
 */
private void getRoute(Display display) throws Exception {
    final NetworkPath path = session.getNetworkPath(rootObject.getObjectId(), targetObject.getObjectId());
    // $NON-NLS-1$ //$NON-NLS-2$
    final NetworkMapPage page = new NetworkMapPage(ID + "@" + rootObject.getObjectName() + "@" + targetObject.getObjectName());
    long prevElementId = 0;
    HopInfo prevHop = null;
    for (final HopInfo h : path.getPath()) {
        final long elementId = page.createElementId();
        page.addElement(new NetworkMapObject(elementId, h.getNodeId()));
        if (prevElementId != 0) {
            NetworkMapLink link = new NetworkMapLink(prevHop.isVpn() ? NetworkMapLink.VPN : NetworkMapLink.NORMAL, prevElementId, elementId);
            if (!prevHop.getName().isEmpty())
                link.setName(prevHop.getName());
            page.addLink(link);
        }
        prevElementId = elementId;
        prevHop = h;
    }
    replaceMapPage(page, display);
}
Also used : HopInfo(org.netxms.client.topology.HopInfo) NetworkMapPage(org.netxms.client.maps.NetworkMapPage) NetworkMapObject(org.netxms.client.maps.elements.NetworkMapObject) NetworkMapLink(org.netxms.client.maps.NetworkMapLink) NetworkPath(org.netxms.client.topology.NetworkPath)

Aggregations

NetworkMapLink (org.netxms.client.maps.NetworkMapLink)1 NetworkMapPage (org.netxms.client.maps.NetworkMapPage)1 NetworkMapObject (org.netxms.client.maps.elements.NetworkMapObject)1 HopInfo (org.netxms.client.topology.HopInfo)1 NetworkPath (org.netxms.client.topology.NetworkPath)1