+ if (SUPERV_isNull(aLinkEngine))
+ return;
+
+ // here, in fact, aLinkEngine may NOT be a newly created link. If a link already existed between the
+ // the 2 given ports - it will be return (NOT created again).
+ // this should be checked and new presentation should NOT be created for existing link.
+ // Solution 1: NOT to allow creation of a link if it already exists between the ports in
+ // myLinkBuilder->canCreateEngine()
+ // Solution 2: check here if aLinkEngine is "new" or "old"
+ // Implement 2nd solution, because canCreateEngine() checks for types of ports, etc.. - it's another thing
+ // THE CHECK:
+ QObjectList* canvasLinks = canvas()->queryList("SUPERVGUI_CanvasLink");
+ SUPERVGUI_CanvasLink* canvasLink = 0;
+ QObjectListIt it(*canvasLinks);
+ bool prsAlreadyExists = false;
+ while ( (canvasLink=(SUPERVGUI_CanvasLink*)it.current()) ) {
+ ++it;
+ SUPERV_Link existingLinkWithPrs = canvasLink->getEngine();
+ if ( !SUPERV_isNull( existingLinkWithPrs ) ) {
+ if ( existingLinkWithPrs->IsEqual( aLinkEngine ) ) {
+ prsAlreadyExists = true;
+ break;
+ }
+ }
+ }
+ delete canvasLinks;
+ if ( prsAlreadyExists ) { // aLinkEngine is already bound with a SUPERVGUI_CanvasLink object
+ //return; // -> if return here, than the old CanvasLink is kept
+
+ // we want to delete old and create a new CanvasLink for this Link
+ delete canvasLink;
+ canvasLink = 0;
+ // clear old corrdinates in Engine link
+ for ( int i = 1; i <= aLinkEngine->CoordsSize(); i++ )
+ aLinkEngine->RemoveCoord( i );
+ // now we are ready to set coords for a link and create a new CanvasLink presentation that will use them.
+ }