skip to main content
Programmer's documentation > Programming with JViews Maps for Defense > Symbology > Managing groups of symbols automatically
 
Managing groups of symbols automatically
Describes how groups of symbols can be managed automatically.
*Overview
*Describes how to automatically manage the visibility of symbol groups according to the scale level and their level in the hierarchy.
*Automatic expansion and collapse of symbol groups
*Describes and illustrates how the expansion and collapse of symbol groups can be specified.
*Automatic displacement of groups and their children
*Describes how group location is set and the consequent effect of moving groups or children.
Overview
You can automatically manage the visibility of symbol groups according to the scale level and their level in the hierarchy through the use of an IlvSDMHierarchyExpandManager.
You first need to create the manager, and specify which SDM engine is impacted:
 
IlvSDMHierarchyExpandManager em=new IlvSDMHierarchyExpandManager(engine);
This acts on specific node properties such as longitude, latitude, and visible, and pseudo classes such as expanded or collapsed.
Automatic expansion and collapse of symbol groups
Once the manager is created, you can specify at which scale the expansion will trigger for each level in the hierarchy. For example, use the following line to specify that root level groups will be expanded below the scale 1/2 000 000:
 
em.addHierarchyLevelExpansionScale(0,2000000);
Or to specify that level 1 groups will be expanded below the scale 1/1 000 000:
 
em.addHierarchyLevelExpansionScale(1,1000000);
You then need to use the manager to listen to view changes in scale, in order to trigger the automatic collapse:
 
view.addTransformerListener(em);
Once this is done, the groups are collapsed (their children are recursively hidden and the group itself is shown) or expanded (the group is hidden, but the child nodes are shown) automatically.
This is illustrated in the following figures.
The following figure shows a map with a scale of 1/20 000 000 in which only the root level groups are visible:
Root level groups visible
The following figure shows a map with a scale of 1/10 000 000 in which the level 1 groups are visible:
Level 1 groups visible
The following figure shows a map with a scale of 1/5 000 000 in which the level 2 groups are visible:
Level 2 groups visible
This manager manages the collapsed and expanded SDM pseudo classes, if you need to set up specific styling rules using the Diagrammer designer.
In contrast to the SDM IlvExpandCollapseRenderer class, the manager does not provide additional decoration when a group is collapsed, and does not use subgraphs to manage children.
Note that using this automatic expansion and collapse will change the visibility of the groups and nodes, and will dynamically change any element visibility settings defined by your users.
Automatic displacement of groups and their children
In addition, the manager provides features that compute and enforce group/child location relationships when one or the other is moved:
 
em.setAutoComputeGroupLocation(true);
Moving a group
When the user interactively moves a group, the children belonging to that group are all moved using the same offsets.
The following figure shows how the children are moved when the group is moved.
Moving a group
Moving children
When the user interactively moves the children of a group to a new position, the corresponding group is moved accordingly.
The following figure shows how the group is moved when the children are moved.
Moving children

Copyright © 2018, Rogue Wave Software, Inc. All Rights Reserved.