Dealing with GoLayer


#1

Why is GoLayer a sealed class?
Would it be then a good idea to write a wrapper for it,
like:

cMyGoLayer
{
protected GoLayer layer;

public bool AllowVisible
{
get
{
return layer.AllowVisible;
}
set
{
layer.AllowVisible = value;
}
}
}

And are there any samples dealing with layers in deep?
Didn’t find something too useful in the applied samples.

I want to Create different layers with different settings.
Though there might be a need to derive them from the standard implementation of GoLayer.

The application should be capable then of moving objects from one layer to another.

But at the moment I’m stuck at the point just creating the Links on the LinkLayer of the document.

I’ve tried to modify the applied FlowCharter-samples. There, it works perfectly. But can’t get it to work in my application by now.

Any hints?

I use the same RelationShipTool from the sample (unmodified).
I gave the LinksLayer an identifier to be sure using the right one.
But that didn’t help, too.
!?


#2

Im a bit confused on the last part, what worked in the flowcharter sample, that you cant get to work in your application. What specific feature?


#3

I just wanted to draw my links on a different layer from the default one. So I could get the links to be drawn in front of the other nodes
or in the background.

But I guess I’ve solved this problem in between.
I just didn’t add new nodes to a specific layer.
In my test project I did this from the very beginning on.
Didn’t notice at first.

Now I’ve created a layer manager setting always one layer to active.

But in deed I’ve got to special questions left:

Why did you prevent the user form deriving of GoLayer?
I wrote a wrapper to get this done. Maybe I’ve “raped” your design now!?

Another question would be, how to exchange to layers?
Bring the first in front of the second or the other way round,

That way if node1 overlaps node2 after this node2 overlaps node1.
Do I really have to copy all objects into a buffer, than delete them
and recreate them again by using CreateNewLayerAfter or CreateNewLayerBefore?


#4

GoLayer is sealed because we thought there wasn’t anything particularly needing overriding, so no methods or properties are virtual. Furthermore, there are a lot of internal implementation details that require careful interaction with the implementation of GoDocument and GoLayerCollection and GoObject. In fact there have been a lot of changes that are latent in 2.1. These changes would have been harder to implement compatibly if you folks had been able to override various things.
If you want to re-order the layers, just call GoLayerCollection.MoveBefore or MoveAfter. You can do this either in the GoDocument’s Layers collection, or in the GoView’s.


#5

In my opinion I actually thought something like this. ;-)

That’s a remarkable Tip. Thanks.

So I guess it’s ok to write a wrapper.