[gme-users] connections between inherited ports
Jeff Parsons
parsons at isis.vanderbilt.edu
Fri Sep 17 19:00:47 CDT 2004
Hi,
We have a metamodel that includes a Model called Component.
In a model, the modeler can create Component types in a
certain folder. In another folder, the modeler can
special-paste instances of these types from the Tree Browser.
Here are a few relevant properties of Components as defined
in the metamodel.
A Component may optionally inherit from
a single Component. It may also "support" other Models
called Objects. We wanted to make clear both the similarities
and the differences of these relationships to the modeler,
so we have put them in the metamodel as contained elements -
a Component may contain 0 or more "Inherits" elements, each
of which is a GME Reference to another Component, and 0 or more
"Supports" elements, each of which is a GME Reference to
an Object.
A Component may also contain metamodel elements called "Ports".
A Port can be a reference
to an Object or to another metamodel element called "Event".
These Ports are displayed in GME as ports in the usual manner.
We wanted the modeler to see inherited Ports in each Component,
so there is a custom decorator which (among other things irrelevant
to the question) handles this by recursively adding the Ports
from the Component's ancestors to its port vectors. Inherited
Ports are thus displayed both for Component "types" and Component
"instances" in the model.
In the model, Components are connected by creating GME Connections
between the Ports in the Component "instances".
Here's the problem:
Connections where one or both ports are
inherited are not displayed. There is no error message or GME
constaint violation - they simply don't appear, even though
the cursor changes its appearance as it should when clicking
on the source and destination of the connection.
I've traced the problem (I think) to these methods in GUIObject.cpp:
CRect CGuiPort::GetLocation()
{
long sx, sy, ex, ey;
if (!IsRealPort()) {
CSize size = parent->GetLocation().Size();
sx = sy = 0;
ex = size.cx;
ey = size.cy;
}
else {
COMTHROW((parent->GetDecorator())->GetPortLocation(mgaFco, &sx, &sy,
&ex, &ey));
}
return CRect(sx, sy, ex, ey);
}
bool CGuiPort::IsRealPort() {
return !mgaFco.IsEqualObject(parent->GetParent()->mgaFco);
}
which (it would seem) are not calling GetPortLocation() on the
decorator for any inherited port, so it doesn't look like it can be
fixed by making changes to the custom decorator - it is getting
bypassed altogether.
We'd rather not rip the metamodel apart and redesign things at this
stage. Does anyone know of a way to work around this GME feature?
It would be acceptable (and doable in the decorator) to eliminate
the display of inherited ports in Component "types" as long as they
are displayed in Component "instances".
thanks,
Jeff Parsons
More information about the gme-users
mailing list