Multiple GoViews in a single GoDocument

Hi,
Is there any way to have multiple views in a single document. If it is possible means , how to assign multiple views in a single document ?
Scenario : I have 3 saved Document’s views. I want to organize those three documents’ views into a single document one by one.
Is it possible…Please help me…
Thanks and Regards,
Natraj.

Certainly, you can create as many GoViews as you want, all viewing the same GoDocument. All of the MDI sample applications support having multiple windows looking at the same document. And the ObjectBrowser sample application shows two views on the same document–one showing links and one not.

But i need to do that dynamically…
Here is my scenario…
I’ve stored three documents as named doc1.xml, dco2.xml and doc3.xml…
I will show that document’s name in seperate window as List… when dragging the document’s name into GraphDoc window , i need to show all the three document’s diagram in the same existing window…
Then i need to connect the three diagrams…
Here i need to have all the three diagrams in a existing doc’s view.
Is it possible ?

I don’t understand what you are trying to do.
A GoView can only view one GoDocument at a time. However, you can have all kinds of things in a GoDocument, perhaps stored in multiple files. Perhaps you could have each “application document” represented by GoObjects in a separate GoLayer, or perhaps each “app doc” would use two GoLayers, all present simultaneously in one GoDocument.
Instead of using GoLayers to separate the objects for different “app docs”, you could just associate other information with each GoObject so that you know which “app doc” they belong to.

I too have similar requirement, but in a different fashion.

I am working on a tab based GUI where when user opens a file with many nodes and links grouped by a category.For this each category have to show a specfic tab.
For this I got GUI placed with thrid party multtabs. In each tab I have single Custom GoView class.
So all tabs will have csame ustomGoview control refering to a same document. I planning to have a seperate golayer for each category in the same document.
My question is how we are going to show only a specfic Document's golayer to in a tabs goview

<?:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

<?:namespace prefix = v ns = "urn:schemas-microsoft-com:vml" />

GoFileDocument

ChildViewClass

GoCategoryLayer1[ TabPage with ChildViewClass.obj1]

GoCategoryLayer2[ TabPage with ChildViewClass.obj2]

GoCategoryLayer3[ TabPage with ChildViewClass.obj3]

GoCategoryLayer5[ TabPage with ChildViewClass.obj5]

GoCategoryLayer10[ TabPage with ChildViewClass.obj10]

GoDocument has a Layers collection. By default, each GoView picks up that same collection of GoLayers. But… you can set the Layers collection for each GoView.

This sample isn't in 3.0. Here's the code that sets up the views.
[code]
private void Form1_Load(object sender, EventArgs e) {
GoDocument doc = goView1.Document;
GoLink protolink = new GoLink();
protolink.ToArrow = true;
protolink.PenColor = Color.Red;
protolink.BrushColor = Color.Red;
protolink.PenWidth = 3;
goView1.NewLinkPrototype = protolink;
doc.LinksLayer = doc.Layers.CreateNewLayerBefore(doc.Layers.Default);
myLayer1 = doc.Layers.Default;
myLayer2 = doc.Layers.CreateNewLayerAfter(myLayer1);

goViewLayer1.Document = doc;
goViewLayer2.Document = doc;
goViewLinksLayer.Document = doc;
goViewLayer1.Layers.Remove(myLayer2);
goViewLayer1.Layers.Remove(doc.LinksLayer);
goViewLayer2.Layers.Remove(myLayer1);
goViewLayer2.Layers.Remove(doc.LinksLayer);
goViewLinksLayer.Layers.Remove(myLayer1);
goViewLinksLayer.Layers.Remove(myLayer2);
GoText l1 = new GoText();
l1.Text = "Layer 1";
l1.TextColor = Color.Red;
l1.Selectable = false;
l1.Location = new PointF(10, 10);
myLayer1.Add(l1);
GoText l2 = new GoText();
l2.Text = "Layer 2";
l2.TextColor = Color.Red;
l2.Selectable = false;
PointF loc = l1.GetSpotLocation(GoObject.BottomRight);
loc.X += 10;
l2.Location = loc;
myLayer2.Add(l2);
GoText l3 = new GoText();
l3.Text = "Links Layer";
l3.TextColor = Color.Red;
l3.Selectable = false;
loc = l2.GetSpotLocation(GoObject.BottomRight);
loc.X += 10;
l3.Location = loc;
doc.LinksLayer.Add(l3);
}
[/code]

Thanks Jake, This is what I am looking for.

Can you please share the sample application code.

The given code will suffice for me.

Thankyou

Hi,

With the above implementation,it is also required to show the different views in a single overview control.
Till now I was able to show exact layer to specfic view, but I was not able to do that for a single overview window, display either layer1, layer2 etc.
Any suggestions.
Thanks

When you set “Observed” property in GoOverview, it calls the virtual InitializeLayersFromDocument.

I need copy/paste a set of selected nodes and connections from one layer to another layer with location of each node and links has to be offset to new location.

Both the layers are from same document.
The problem with CopyFromColleection is it is pasting in same layer. How to paste in new layer.

Golayer.Add will move an object to a new layer if it already in a different layer in the same document.