Author: jm
Date: 2012-01-04 08:36:40 -0800 (Wed, 04 Jan 2012)
New Revision: 27908
Modified:
core3/impl/trunk/core-task-impl/src/main/java/org/cytoscape/task/internal/layout/LayoutEdit.java
Log:
Fixes #547: Fixed LayoutEdit to save/restore network view state properly
Modified:
core3/impl/trunk/core-task-impl/src/main/java/org/cytoscape/task/internal/layout/LayoutEdit.java
===================================================================
---
core3/impl/trunk/core-task-impl/src/main/java/org/cytoscape/task/internal/layout/LayoutEdit.java
2012-01-04 03:45:28 UTC (rev 27907)
+++
core3/impl/trunk/core-task-impl/src/main/java/org/cytoscape/task/internal/layout/LayoutEdit.java
2012-01-04 16:36:40 UTC (rev 27908)
@@ -7,6 +7,7 @@
import static
org.cytoscape.view.presentation.property.MinimalVisualLexicon.NETWORK_CENTER_X_LOCATION;
import static
org.cytoscape.view.presentation.property.MinimalVisualLexicon.NETWORK_CENTER_Y_LOCATION;
import static
org.cytoscape.view.presentation.property.RichVisualLexicon.NETWORK_CENTER_Z_LOCATION;
+import static
org.cytoscape.view.presentation.property.MinimalVisualLexicon.NETWORK_SCALE_FACTOR;
import java.util.ArrayList;
import java.util.Collection;
@@ -24,6 +25,7 @@
private final CyEventHelper eventHelper;
private final CyNetworkView view;
private List<NodeViewAndLocations> nodeViewsAndLocations;
+ private double networkScale;
private double networkCenterX;
private double networkCenterY;
private double networkCenterZ;
@@ -51,19 +53,25 @@
private void saveAndRestore() {
final List<NodeViewAndLocations> oldNodeViewsAndLocations =
nodeViewsAndLocations;
+ final double oldNetworkScale = networkScale;
+ final double oldNetworkCenterX = networkCenterX;
+ final double oldNetworkCenterY = networkCenterY;
+ final double oldNetworkCenterZ = networkCenterZ;
saveNodeViewsAndLocations();
for (final NodeViewAndLocations nodeViewAndLocation :
oldNodeViewsAndLocations)
nodeViewAndLocation.restoreLocations();
- view.setVisualProperty(NETWORK_CENTER_X_LOCATION,
networkCenterX);
- view.setVisualProperty(NETWORK_CENTER_Y_LOCATION,
networkCenterY);
- view.setVisualProperty(NETWORK_CENTER_Z_LOCATION,
networkCenterZ);
+ view.setVisualProperty(NETWORK_SCALE_FACTOR, oldNetworkScale);
+ view.setVisualProperty(NETWORK_CENTER_X_LOCATION,
oldNetworkCenterX);
+ view.setVisualProperty(NETWORK_CENTER_Y_LOCATION,
oldNetworkCenterY);
+ view.setVisualProperty(NETWORK_CENTER_Z_LOCATION,
oldNetworkCenterZ);
eventHelper.flushPayloadEvents();
view.updateView();
}
private void saveNodeViewsAndLocations() {
+ networkScale = view.getVisualProperty(NETWORK_SCALE_FACTOR);
networkCenterX =
view.getVisualProperty(NETWORK_CENTER_X_LOCATION);
networkCenterY =
view.getVisualProperty(NETWORK_CENTER_Y_LOCATION);
networkCenterZ =
view.getVisualProperty(NETWORK_CENTER_Z_LOCATION);
--
You received this message because you are subscribed to the Google Groups
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/cytoscape-cvs?hl=en.