GoOverView and GoView


Does anyone knows how to map what user had selected nodes from GoOverView and display those node on GoView?
Many thanks

Normally the user cannot select anything in a GoOverview, so I’m not sure what you mean.

However, if you are asking how to make a particular existing node visible in a view, when it might be scrolled off somewhere unseen, you can call GoView.ScrollRectangleToVisible with the selected node's Bounds, or set GoView.DocExtentCenter to be the node's Center.
But clicking in a GoOverview does that automatically, so perhaps that isn't what you are asking for.

what I want to do was to have two views, one display a bunch of nodes, other will monitors the other view. If user selected any node/nodes then those node/nodes will be display on the monitoring view.

That happens automatically already. The GoOverview will automatically scroll around to make sure the rectangle representing the observed view’s DocExtent is visible.

Or are you saying that the user-selected node(s) are not going to be in the area shown by the view that the user is selecting in?

I will have view1 and view2

view1 will display node1,2,3,4,5
when you select node1and 2 from view1
view2 will display node1 and node2
I can do this with 2 GoViews and a little programing passing function calls back and forth. I just want to know if we can have something from go that do this automatically

Are both views showing the same document?

Perhaps you can have selection cause selected nodes to be placed in a separate GoLayer, and view2 could display only that layer.
The Classier example demonstrates doing the former task.
The ObjectBrowser example demonstrates how to have two views showing different layers of the same document. ObjectBrowser also shows the data structures in memory for the document and the two views.

yes, the ObjectBrowser is partially what I want to implement. But how do you remove unselected nodes instead of removing the links. what kind of layer that would be?

The Classier example has a layer that just contains selected nodes. That’s the layer you want to include in view2, and (presumably) not the other document layers.

I don't know your application, so you might still want to show some other objects (other than unselected nodes) in view2, like maybe a background layer, to give some more context to what users see in view2.
For that matter, you can easily have other layers showing arbitrary objects that are only shown by view2. Perhaps in your application you could show more details for the selected node(s) in this manner.

Yes, I want to display other layers in view2 other than what selected in view1. The Classier example is very confusing. Do you have a better one that suite my purpose
However, I have the following code makes what selected in goViewDiscovery and display on goView. But my problem is the link got copied to goView but doesn’t connected to the node. In other word, if I drag the node in goView out of the link then the link disconected from that node. I want the link to link the node/nodes after they’re being copy over.
GoObject[] m_newLayers = new GoObject [goViewDiscovery.Selection.Count];

for (int i = 0; i < m_newLayers.Length; i++)
GoObject mobj = m_newLayers.Copy();


Here’s the relevant code from the Classier sample. When initializing, create a layer:

// create a layer in front to hold selected nodes doc.Layers.CreateNewLayerAfter(doc.Layers.Default).Identifier = "selected";
When an object is selected, you add it (i.e. "move" it) to that top layer; when it is unselected, you move it back:
// Move the object to the top layer, so it is visible to the user. public override void OnGotSelection(GoSelection selection) { this.Document.Layers.Top.Add(this); base.OnGotSelection(selection); }
// Move the object to the regular layer, where it can be obscured by selected nodes, // unless this node is being deleted. public override void OnLostSelection(GoSelection selection) { if (!this.BeingRemoved) this.Document.DefaultLayer.Add(this); base.OnLostSelection(selection); }
Regarding your code, I don't think you should be copying. That is particularly true if you are going to be changing what layer each object is in, and showing certain layers in different views.
But if you really wanted to do the copying, the following might be equivalent to your code:


is exactly what I want, thanks WalterBig%20smile