IlpNetworkView
can be connected to several node algorithms and one link algorithm.
IlpNetworkView
. If the
perform
parameter is set to
true
, the layout is applied to the objects immediately. With this
method the layout is executed every time the network content
changes.
setLinkLayout (IlvGraphLayout layout,
boolean perform)
. This method sets the given layout as the default link layout
for this instance of
IlpNetworkView
. If the
perform
parameter is set to
true
, the layout is applied to the links immediately. With this
method the layout is executed every time the network content
changes.
public void
performLayoutOnce(IlvGraphLayout layout)
. This method executes the layout algorithm once on the manager
content.
void startDelayingUpdates()
. This method suspends temporarily the layout operations. This
mechanism avoids unnecessary computation when you intend to
perform a sequence of operations that affect the network layout.
void endDelayingUpdates()
. This method resumes the layout operations suspended by a call
to the method
startDelayingUpdates
. Any operation that requests a layout recalculation is
suspended when it is executed between
startDelayingUpdates
and
endDelayingUpdates
calls.
void setGraphLayouts(IlvGraphLayout[]
layouts)
. This method sets the given graph layouts for this IlpNetworkView. Several graph layouts can
be set to position nodes in the view. One of them can be
configured to be executed every time the network contents
changes. This method does not apply the layout to the nodes
immediately. All the graph layouts given as argument to the
method are attached to the view.
void setGraphLayouts(int index,
IlvGraphLayout layout)
. This method sets a new graph layout for the
IlpNetworkView
or replaces an existing graph layout. This method does not apply
the layout to the nodes immediately.
IlvGraphLayout[] getGraphLayouts()
. This method returns the graph layouts that have been
configured for the view.
IlvGraphLayout getGraphLayouts(int
index)
. This method returns the graph layout that is configured for
the view at the given index.
void setAutoLayoutIndex (int index)
. This method indicates, from the list of graph layouts that
have been configured using method
setGraphLayouts
, which one is executed automatically when the contents of the
view changes.
int getAutoLayoutIndex()
. This method returns the index of the graph layout that is
executed automatically when the contents of the view changes.
void
setGraphLayouts(IlpRepresentationObject ro, IlvGraphLayout[]
layouts)
. This method allows you to set graph layouts that can be used
to position nodes in the subnetwork corresponding to the given
representation object. One of the graph layouts can be
configured to be executed automatically when the contents of the
subnetwork changes. The other graph layouts are attached to the
view and can be performed on demand.
void
setGraphLayouts(IlpRepresentationObject ro, int index,
IlvGraphLayout layout)
. This method allows you to set or replace a graph layout used
to position nodes in a subnetwork.
IlvGraphLayout[]
getGraphLayouts(IlpRepresentationObject ro)
. This method returns the graph layouts that have been
configured for the given subnetwork.
IlvGraphLayout
getGraphLayouts(IlpRepresentationObject ro, int index)
. This method returns the graph layout that has been configured
for the given subnetwork at the given index.
void
setAutoLayoutIndex(IlpRepresentationObject)
. This method defines which graph layout configured using
setGraphLayouts(IlpRepresentationObject)
will execute automatically when the contents of the subnetwork
changes.
int
getAutoLayoutIndex(IlpRepresentationObject)
. This method returns the graph layout that has been configured
to execute automatically when the contents of the subnetwork
changes.
void
setLinkLayout(IlpRepresentationObject)
. This method defines a link layout for the given subnetwork.
void performAttachedLayout(int index)
. This method executes the layout that has been configured for
the given index, recursively in the object tree. The layout has
been already attached to the view and keeps the configuration
whenever it is performed.
IlvGraphic
getLayoutProxy(IlpRepresentationObject)
. This method returns the graphic object corresponding to the
given representation object for layout purposes. This method
should be used if you need to set per-object layout properties
to configure the layout algorithms.
network.getView().getCompositeGrapher().getZoomTransformer()
network.getManagerView().getTransformer()
) before passing them to the graph layout.
Network { graphLayout: true; } GraphLayout { class: 'ilog.views.graphlayout.hierarchical.IlvHierarchicalLayout'; flowDirection: Bottom; levelJustification: Top; globalLinkStyle: 'ilog.views.graphlayout.hierarchical.IlvHierarchicalLayout.POLYLINE_STYLE'; connectorStyle: 'ilog.views.graphlayout.hierarchical.IlvHierarchicalLayout.EVENLY_SPACED_PINS'; }
globalLinkStyle
and
connectorStyle
for the type converter to locate and convert the constants.
IlvHierarchicalLayout layout = new IlvHierarchicalLayout(); layout.setFlowDirection (IlvDirection.Bottom); layout.setLevelJustification (IlvDirection.Top); layout.setGlobalLinkStyle (IlvHierarchicalLayout.POLYLINE_STYLE); layout.setConnectorStyle (IlvHierarchicalLayout.EVENLY_SPACED_PINS); network.setNodeLayout(layout);
layout.setCoordinatesMode(IlvGraphLayout.VIEW_COORDINATES);
IlvGraphLayout
:
setPreserveFixedLinks (boolean
preserve)
. This method determines whether or not the layout will
preserve the position of the registered links.
setPreserveFixedNodes (boolean
preserve)
. This method determines whether or not the layout will
preserve the position of the registered nodes.
void setFixed (Object obj /* link or
node */, boolean fix)
. This method determines whether or not the given object will
be fixed in the network.
boolean isFixed (Object obj)
. The return value indicates whether or not the given object
is marked to be fixed. The object to be passed is an IlvGraphic belonging to the IlpGraphic that represents the object
and not the
IlpGraphic
or IlpRepresentationObject itself.
void unfixAllLinks()
void unfixAllNodes()
Network { graphLayout: true; linkLayout: true; } LinkLayout { class: 'ilog.views.graphlayout.link.IlvLinkLayout'; } GraphLayout { layouts[0]: @+treeLayout; } Subobject#treeLayout { class: 'ilog.views.graphlayout.tree.IlvTreeLayout'; } #Link:linkLayoutRenderer { fixed: true; } #NE1:graphLayoutRenderer:tree { fixed: true; }
IlvGraphLayout layout = networkView.getLinkLayout(); layout.setPreserveFixedLinks (true); IlpRepresentationObject linkRO = networkAdapter.getRepresentationObject(link); layout.setFixed(networkView.getLayoutProxy(linkRO)); layout = networkView.getNodeLayout(); layout.setPreserveFixedNodes (true); IlpRepresentationObject neRO = networkAdapter.getRepresentationObject(ne); layout.setFixed(networkView.getLayoutProxy(neRO));
IlpNetworkView.setPosition
).
IlvShortLinkLayout
to shape and position links. This default layout sets all objects
without an attached position to
(0,0)
.
Network { graphLayout: true; } GraphLayout { layouts[0]: @+hierarchicalLayout; layouts[1]: @+treeLayout; autoLayoutIndex: 0; } Subobject#hierarchicalLayout { class: 'ilog.views.graphlayout.hierarchical.IlvHierarchicalLayout'; flowDirection: Bottom; levelJustification: Top; globalLinkStyle: POLYLINE_STYLE; connectorStyle: EVENLY_SPACED_PINS; } Subobject#treeLayout { class: 'ilog.views.graphlayout.tree.IlvTreeLayout'; flowDirection: Bottom; }
IlvHierarchicalLayout layout = new IlvHierarchicalLayout(); layout.setFlowDirection (IlvDirection.Bottom); layout.setLevelJustification (IlvDirection.Top); layout.setGlobalLinkStyle (IlvHierarchicalLayout.POLYLINE_STYLE); layout.setConnectorStyle (IlvHierarchicalLayout.EVENLY_SPACED_PINS); IlvTreeLayout treeLayout = new IlvTreeLayout(); layout.setFlowDirection(IlvDirection.Bottom); network.setGraphLayouts(new IlvGraphLayout[] { layout, treeLayout }); network.getView().optimizeLayout();
performAttachedLayout
, where the index is the one defined in the CSS configuration, as
illustrated below:
network.getView().performAttachedLayout(1);
SubNetwork1
' positions its nodes using a tree layout algorithm, while the
nodes in the main view are positioned using a grid layout.
Network { graphLayout: true; linkLayout: true; } LinkLayout { class: 'ilog.views.graphlayout.link.IlvLinkLayout'; } GraphLayout { layouts[0]: @+gridLayout; } Subobject#gridLayout { class: 'ilog.views.graphlayout.grid.IlvGridLayout'; } #SubNetwork1:graphLayoutRenderer { layouts[0]: @+treeLayout; } Subobject#treeLayout { class: 'ilog.views.graphlayout.tree.IlvTreeLayout'; }
IlvGridLayout gridLayout = new IlvGridLayout(); network.setGraphLayouts(new IlvGraphLayout[] { gridLayout }); IlvTreeLayout treeLayout = new IlvTreeLayout(); layout.setFlowDirection(IlvDirection.Bottom); IlpRepresentationObject ro = network.getAdapter().getRepresentationObject("SubNetwork1"); network.getView().setGraphLayouts(ro, new IlvGraphLayout[] { treeLayout }); network.getView().optimizeLayout();
Network { graphLayout: true; } GraphLayout { layouts[0]: @+busLayout } Subobject#busLayout { class: 'ilog.views.graphlayout.bus.IlvBusLayout'; horizontalOffset: 50; verticalOffsetToLevel: 50; verticalOffsetToPreviousLevel: 40; margin: 30; marginOnBus: 50; } // Configure the bus object as the bus in the layout // All layout configuration uses the 'graphLayoutRenderer' // and the graph layout name pseudoclasses #BUS:graphLayoutRenderer:bus { bus: true; } // Configure the bus to route the links that connect the // bus to the nodes #BUS { linksConnectToBase: true; }
IlvBusLayout busLayout = new IlvBusLayout(); network.setGraphLayouts(new IlvGraphLayout[] { busLayout }); IlpRepresentationObject ro = network.getAdapter().getRepresentationObject("BUS"); IlvGraphic layoutProxy = network.getView().getLayoutProxy(ro); busLayout.setBus((IlvPolyPointsInterface)layoutProxy);
usePerObjectParamenters
in the graph layout renderer and link layout renderer. Disabling
the per-object layout properties configuration speeds up
significantly the rendering process.
Network { graphLayout: true; linkLayout: true; } LinkLayout { class: 'ilog.views.graphlayout.link.IlvLinkLayout'; usePerObjectParameters: false; } GraphLayout { layouts[0]: @+treeLayout; usePerObjectParameters: false; }