[gme-users] About Port Location
Kevin Smyth
kevin.m.smyth at gmail.com
Mon Mar 6 13:59:14 CST 2017
Hi Somesh,
The decorator is responsible for determining where the ports are.
The default decorator has this code:
if ((*ii)->portPart->GetInnerPosition().x <= WIDTH_MODELSIDE ||
(*ii)->portPart->GetInnerPosition().x < lMax / 2)
{
mapPrefs[PREF_LABELLOCATION] = PreferenceVariant(m_bPortLabelInside ?
L_EAST : L_WEST);
m_LeftPorts.push_back((*ii)->portPart);
} else {
mapPrefs[PREF_LABELLOCATION] = PreferenceVariant(m_bPortLabelInside?
L_WEST: L_EAST);
m_RightPorts.push_back((*ii)->portPart);
}
lMax is the maximum x location of the ports. WIDTH_MODELSIDE is 100.
You could also ask the decorator. The basic procedure.
Query your model's registry for "/decorator". If it doesn't exist, use
"MGA.BoxDecorator" (the default decorator)
CoCreateInstance the decorator
Call decorator.Initialize
Call decorator.GetPorts (the decorator may choose to not display all ports)
Call decorator.GetPortLocation for each port
Hope that helps.
Kevin
On Mon, Mar 6, 2017 at 7:36 AM, Somesh Das <somesh_au at yahoo.com> wrote:
> Hi,
> I am developing an interpreter using BON2Component which will create
> connections between two selected Object's ports.
> For this I need to get port location. I can get location of an object
> using method mentioned below
>
> BON::Point pt = BON::FCOExRegistryNode( fco ->getRegistry())->getLocation(
> "");
>
> However, I need to determine which port is in left side and which is in
> right side of the model. It must be implemented somewhere in GME.
> Please can anybody give me any suggestion how can I separate ports as left
> hand side and right hand side based on location ?
>
>
> Thanks & Regards
> Somesh Das
>
>
> _______________________________________________
> gme-users mailing list
> gme-users at list.isis.vanderbilt.edu
> http://list.isis.vanderbilt.edu/cgi-bin/mailman/listinfo/gme-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.isis.vanderbilt.edu/pipermail/gme-users/attachments/20170306/72673eb6/attachment.html>
More information about the gme-users
mailing list