public class IlvSDMHierarchyExpandManager extends Object implements TransformerListener
IlvSDMHierarchyExpandManager em=new IlvSDMHierarchyExpandManager(engine); // Root groups are expanded below scale 1/2 000 000. em.addHierarchyLevelExpansionScale(0,2000000); // Level 1 groups are expanded below scale 1/1 000 000. em.addHierarchyLevelExpansionScale(1,1000000); // Enforce that moving children updates a group location, and moving groups nudges children in the same direction. em.setAutoComputeGroupLocation(true); // Listen to view changes in scale. view.addTransformerListener(em);This class acts on specific node properties such as "longitude", "latitude" and "visible".
Constructor and Description |
---|
IlvSDMHierarchyExpandManager(IlvSDMEngine engine)
Creates a new
IlvSDMHierarchyExpandManager . |
Modifier and Type | Method and Description |
---|---|
void |
addHierarchyLevelExpansionScale(int hierarchyLevel,
double mapScale)
Adds a scale limit at which the selected hierarchy level is expanded.
|
protected void |
expandGroup(IlvSDMNode group,
boolean expand)
Expands or collapses a group.
|
IlvSDMEngine |
getEngine()
Returns the engine the
IlvSDMHierarchyExpandManager acts upon. |
double |
getHierarchyLevelExpansionScale(int hierarchyLevel)
Retrieves the first scale limit for which the groups are expanded.
|
protected boolean |
isCollapsed(IlvSDMNode node)
Checks if a group is collapsed by checking the presence of the "collapsed"
pseudo class.
|
protected boolean |
isExpanded(IlvSDMNode node)
Checks if a group is expanded by checking the presence of the "expanded"
pseudo class.
|
protected boolean |
isGroup(IlvSDMNode node)
Method used throughout the class to check if an SDM node is a group or not.
|
protected void |
moveGroupAtBarycenter(IlvSDMNode group)
Computes the longitude and latitude to use for a group of nodes.
|
protected void |
nudgeNode(IlvSDMNode node,
String property,
double offset)
Changes the node property by adding the offset.
|
void |
removeHierarchyLevelExpansionScale(int hierarchyLevel)
Removes a scale limit for a hierarchy level.
|
void |
setAutoComputeGroupLocation(boolean computeGroupLocation)
Makes sure the location of groups (longitude and latitude) is correct
relative to their children.
|
void |
transformerChanged(TransformerChangedEvent event)
When the view transformer is changed, this method checks the expansion
scales set through
addHierarchyLevelExpansionScale(int, double)
and expands or collapses the relevant groups, according to their
hierarchy level. |
public IlvSDMHierarchyExpandManager(IlvSDMEngine engine)
IlvSDMHierarchyExpandManager
.engine
- The engine the expand/collapse manager acts on.public IlvSDMEngine getEngine()
IlvSDMHierarchyExpandManager
acts upon.IlvSDMHierarchyExpandManager
acts upon.public void addHierarchyLevelExpansionScale(int hierarchyLevel, double mapScale)
em.setHierarchyLevelExpansionScale(1,10000);
expands the first level of hierarchy when the scale becomes smaller than
1/10000.hierarchyLevel
- The level of the groups in the SDM model hierarchy (0 means a root
group).mapScale
- The inverse of the scale for which the group will be first expanded.public double getHierarchyLevelExpansionScale(int hierarchyLevel)
hierarchyLevel
- The level of the groups in the SDM model hierarchy (0 means a root
group).addHierarchyLevelExpansionScale(int, double)
public void removeHierarchyLevelExpansionScale(int hierarchyLevel)
hierarchyLevel
- The level of the groups in the SDM model hierarchy (0 means a root
group).addHierarchyLevelExpansionScale(int, double)
public void setAutoComputeGroupLocation(boolean computeGroupLocation)
computeGroupLocation
- If true
, enforces group location.setAutoComputeGroupLocation(boolean)
,
moveGroupAtBarycenter(IlvSDMNode)
,
nudgeNode(IlvSDMNode, String, double)
protected void nudgeNode(IlvSDMNode node, String property, double offset)
node
- The node to move.property
- The property changed (latitude or longitude).offset
- The offset to apply relative to the current value.setAutoComputeGroupLocation(boolean)
protected boolean isGroup(IlvSDMNode node)
node
- The node to check.true
, the node is a group.protected void moveGroupAtBarycenter(IlvSDMNode group)
group
- The group of nodes to compute the location for.public void transformerChanged(TransformerChangedEvent event)
addHierarchyLevelExpansionScale(int, double)
and expands or collapses the relevant groups, according to their
hierarchy level.transformerChanged
in interface TransformerListener
event
- The modification event.protected boolean isExpanded(IlvSDMNode node)
node
- The node to check.true
, the pseudo class is present.protected boolean isCollapsed(IlvSDMNode node)
node
- The node to check.true
, the pseudo class is present.protected void expandGroup(IlvSDMNode group, boolean expand)
group
- The group to expand or collapse.expand
- Set to true
for expanding and false
for collapsing.© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.