2) Fix for bug PAL11273 : How to set the name of the container in a Factory Node.
3) Modifications concerning to GLViewer based version (ports creation).
#include "SUPERVGUI_ArrayView.h"
#include "SUPERVGUI_Main.h"
#include "SUPERVGUI_CanvasCellNodePrs.h"
+#include "SUPERVGUI_CanvasLink.h"
+#include "SUPERVGUI_CanvasPort.h"
#include <qcolordialog.h>
// compute collision rectangle
QRect aSel(theP.x()-MARGIN, theP.y()-MARGIN, 1+2*MARGIN, 1+2*MARGIN);
- QCanvasItemList l = ((SUPERVGUI_ArrayView*)parentWidget())->canvas()->collisions(aSel);
+ QCanvasItemList l = ((QCanvasView*)parentWidget())->canvas()->collisions(aSel);
for (QCanvasItemList::Iterator it = l.begin(); it != l.end(); ++it) {
+ // tooltip for node
if ((*it)->rtti() == SUPERVGUI_Canvas::Rtti_Node) {
- SUPERVGUI_CanvasCellNodePrs* aNodePrs = (SUPERVGUI_CanvasCellNodePrs*) (*it);
+ SUPERVGUI_CanvasNodePrs* aNodePrs = (SUPERVGUI_CanvasNodePrs*) (*it);
QObject* anObj = aNodePrs->getObject(theP);
- if (anObj->inherits("SUPERVGUI_CanvasCellNode")) {
+ if (anObj->inherits("SUPERVGUI_CanvasNode")) {
QRect aTitleRect = aNodePrs->getTitleRect();
+ QRect aLabelRect = aNodePrs->getLabelRect();
+ QRect aStatusRect = aNodePrs->getStatusRect();
+
+ if (aTitleRect.bottom()+1 == aLabelRect.top() &&
+ aLabelRect.bottom()+1 == aStatusRect.top()) {
+ QRect aTipRect(aTitleRect.left(), aTitleRect.top(), aTitleRect.width(),
+ aTitleRect.height() + aLabelRect.height() + aStatusRect.height());
+ tip(aTipRect, ((SUPERVGUI_CanvasNode*)anObj)->getToolTipText());
+ return;
+ }
+
if (aTitleRect.contains(theP, true)) {
- tip(aTitleRect, ((SUPERVGUI_CanvasCellNode*)anObj)->getEngine()->Name());
+ tip(aTitleRect, ((SUPERVGUI_CanvasNode*)anObj)->getToolTipText());
return;
}
- QRect aLabelRect = aNodePrs->getLabelRect();
if (aLabelRect.contains(theP, true)) {
- tip(aLabelRect, ((SUPERVGUI_CanvasCellNode*)anObj)->getLabelText());
+ tip(aLabelRect, ((SUPERVGUI_CanvasNode*)anObj)->getToolTipText());
return;
}
+
+ if (aStatusRect.contains(theP, true)) {
+ tip(aStatusRect, ((SUPERVGUI_CanvasNode*)anObj)->getToolTipText());
+ return;
+ }
+
}
+ // tooltip for nodes' port
+ if (anObj->inherits("SUPERVGUI_CanvasPort")) {
+ SUPERVGUI_CanvasPort* aPort = (SUPERVGUI_CanvasPort*)anObj;
+ tip(aPort->getPrs()->getPortRect(),
+ aPort->getEngine()->Type() + QString(" ") + aPort->getPrs()->getText());
+ return;
+ }
+ }
+ // tootip for links' point
+ if ((*it)->rtti() == SUPERVGUI_Canvas::Rtti_LinkPoint) {
+ SUPERVGUI_CanvasPointPrs* aPrs = (SUPERVGUI_CanvasPointPrs*) (*it);
+ if (aPrs->getLink()->getMain()->getViewType() == CANVAS)
+ tip(aSel, aPrs->getLink()->getToolTipText());
+ return;
+ }
+ // tooltip for links' edge
+ if ((*it)->rtti() == SUPERVGUI_Canvas::Rtti_LinkEdge) {
+ SUPERVGUI_CanvasEdgePrs* aPrs = (SUPERVGUI_CanvasEdgePrs*) (*it);
+ if (aPrs->getLink()->getMain()->getViewType() == CANVAS)
+ tip(aSel, aPrs->getLink()->getToolTipText());
+ return;
}
}
}
}
}
+QString SUPERVGUI_CanvasLink::getToolTipText() const {
+ QString aTTT;
+ if (myInputPort && myOutputPort)
+ aTTT = myOutputPort->getEngine()->Node()->Name() + QString(" : ") +
+ myOutputPort->getEngine()->Name() + QString(" => ") +
+ myInputPort->getEngine()->Node()->Name() + QString(" : ") +
+ myInputPort->getEngine()->Name();
+ return aTTT;
+}
+
/*
//===============================================================================
// SUPERVGUI_CanvasStreamLink: new link to be created
void setSelectedObject(QCanvasItem* theItem, const QPoint& thePoint);
virtual QPopupMenu* getPopupMenu(QWidget* theParent);
+ QString getToolTipText() const;
+
public slots:
virtual void remove();
void addPoint();
else
SUIT_MessageBox::error1( SUIT_Session::session()->activeApplication()->desktop(), tr( "ERROR" ), tr( "MSG_BAD_INODE" ), tr( "OK" ) );
}
+
+QString SUPERVGUI_CanvasNode::getToolTipText() const {
+ if ( myNode->IsFactory() )
+ return QString("Name : ") + SUPERV::FNode::_narrow(myNode)->Name() +
+ QString("\nContainer : ") + SUPERV::FNode::_narrow(myNode)->GetContainer() +
+ QString("\nComponentName : ") + SUPERV::FNode::_narrow(myNode)->GetComponentName() +
+ QString("\nInterfaceName : ") + SUPERV::FNode::_narrow(myNode)->GetInterfaceName();
+ return QString("Name : ") + myNode->Name() + '\n' + getLabelText();
+}
QString getLabelText() const { return myLabelText; }
+ virtual QString getToolTipText() const;
+
public slots:
void suspendResume();
void kill();
#include <sys/timeb.h>
#endif
-#define PORT_MARGIN 2
+//#define PORT_MARGIN 2
#undef PORT_HEIGHT // to avoid warning message
#define PORT_HEIGHT LABEL_HEIGHT
#define TEXT_MARGIN 5
#include "SUPERVGUI.h"
#include "SUPERVGUI_BrowseNodeDlg.h"
+#include "SUPERVGUI_PrsPort.h"
+
#include "SalomeApp_Study.h"
SUPERVGUI_CanvasPort::SUPERVGUI_CanvasPort(QObject* theParent, SUPERVGUI_Main* theMain, SUPERV::Port_ptr thePort):
QObject(theParent),
myMain(theMain),
myPrs(0),
+ myGLPrs(0),
isIgnore(false)
{
Trace("SUPERVGUI_CanvasPort::SUPERVGUI_CanvasPort");
{
Trace("SUPERVGUI_CanvasPort::~SUPERVGUI_CanvasPort");
if (myPrs) delete myPrs;
+ if (myGLPrs) delete myGLPrs;
isIgnore = true;
QValueList<SUPERVGUI_CanvasLink*>::Iterator it;
return myPrs;
}
+SUPERVGUI_PrsPort* SUPERVGUI_CanvasPort::getGLPrs() const
+{
+ if (myGLPrs == 0) ((SUPERVGUI_CanvasPort*)this)->myGLPrs = createGLPrs();
+ return myGLPrs;
+}
+
SUPERVGUI_CanvasPortPrs* SUPERVGUI_CanvasPort::createPrs() const
{
return new SUPERVGUI_CanvasPortPrs(myMain->getCanvas(), (SUPERVGUI_CanvasPort*)this);
}
+SUPERVGUI_PrsPort* SUPERVGUI_CanvasPort::createGLPrs() const
+{
+ return new SUPERVGUI_PrsPort((SUPERVGUI_CanvasPort*)this);
+}
+
QPopupMenu* SUPERVGUI_CanvasPort::getPopupMenu(QWidget* theParent)
{
QPopupMenu* popup = new QPopupMenu(theParent);
class SUPERVGUI_Main;
class SUPERVGUI_CanvasLink;
class SUPERVGUI_CanvasPortPrs;
+class SUPERVGUI_PrsPort;
class SUPERVGUI_CanvasPort : public QObject {
Q_OBJECT
SUPERV_Port getEngine() const { return myPort; }
SUPERVGUI_Main* getMain() const { return myMain; }
SUPERVGUI_CanvasPortPrs* getPrs() const;
+ SUPERVGUI_PrsPort* getGLPrs() const;
virtual QPopupMenu* getPopupMenu(QWidget* theParent);
protected:
virtual SUPERVGUI_CanvasPortPrs* createPrs() const;
+ virtual SUPERVGUI_PrsPort* createGLPrs() const;
private:
SUPERV_Port myPort;
SUPERVGUI_Main* myMain;
SUPERVGUI_CanvasPortPrs* myPrs;
+ SUPERVGUI_PrsPort* myGLPrs;
QValueList<SUPERVGUI_CanvasLink*> myLinks;
bool isIgnore;
};
#include "SUPERVGUI_CanvasNodePrs.h"
#include "SUPERVGUI_Clipboard.h"
+#include "SUPERVGUI_ArrayView.h" //for tooltip testing
+
#include "SUIT_MessageBox.h"
#include <qpixmap.h>
setHilighted(0);
}
+ // QToolTip for title and label for SUPERVGUI_CanvasNode
+ SUPERVGUI_ToolTip* aTT = new SUPERVGUI_ToolTip(this);
+ aTT->maybeTip(p);
+
busy = false;
}
case SUPERV::FactoryNode :
{
SUPERV::FNode_var aFNode = dataflow->FNode( SUPERV::FNode::_narrow(aNode)->GetComponentName(),
- SUPERV::FNode::_narrow(aNode)->GetInterfaceName(),
- *SUPERV::FNode::_narrow(aNode)->Service() );
+ SUPERV::FNode::_narrow(aNode)->GetInterfaceName(),
+ *SUPERV::FNode::_narrow(aNode)->Service(),
+ SUPERV::FNode::_narrow(aNode)->IsCimpl()); // mkr : PAL11273
if (CORBA::is_nil(aFNode)) {
QMessageBox::warning(SUIT_Session::session()->activeApplication()->desktop(), tr("ERROR"), tr("MSG_CANT_CREATE_NODE"));
return;
// -----
#define PORT_WIDTH 75
-#define PORT_HEIGHT 28
+#define PORT_HEIGHT 20
+#define PORT_MARGIN 2
// Taille des points carres constituant les lignes entre les noeuds
// ----------------------------------------------------------------
#include "GLViewer_Viewer2d.h"
#include "GLViewer_Context.h"
#include "GLViewer_BaseObjects.h"
+#include "GLViewer_Group.h"
#include "SUPERVGUI.h"
#include "SUPERVGUI_Def.h"
// SUPERVGUI_Node* aNode = new SUPERVGUI_ComputeNode( resMgr(), getGLViewer(), this, theNode);
- SUPERVGUI_PrsNode* glNode = new SUPERVGUI_PrsNode( aNode );
- glNode->setFirstPoint( new GLViewer_Pnt( 10, 10 ) );
+
+ GLViewer_Pnt* aFirstPnt = new GLViewer_Pnt( 10, 10 );
+ SUPERVGUI_PrsNode* glNode = new SUPERVGUI_PrsNode( aNode, aFirstPnt );
+ //glNode->setFirstPoint( new GLViewer_Pnt( 10, 10 ) );
glNode->compute();
glNode->update();
+ GLViewer_Group* aNodeGroup = new GLViewer_Group();
+ //aNodeGroup->addObject( glNode );
+ glNode->setGroup( aNodeGroup );
getGLContext()->insertObject( glNode, true /*false*/ );
// glNode->setVisible( true );
+ glNode->insertPorts();
}
break;
}
virtual void resizeView( QResizeEvent* theEvent );
+ GLViewer_Context* getGLContext();
+
signals:
void KillMyThread(bool theValue);
void closeEvent(QCloseEvent*);
GLViewer_Viewer2d* getGLViewer();
- GLViewer_Context* getGLContext();
-
+
SUPERV_Graph dataflow;
QMap<QString, SUIT_ViewWindow*> mySubGraphs;
#include "SUPERVGUI_CanvasNode.h"
#include "SUPERVGUI_CanvasPort.h"
#include "SUPERVGUI_CanvasControlNode.h"
-#include "SUPERVGUI.h"
+#include "SUPERVGUI_CanvasLink.h"
#include <qlayout.h>
#include <qlabel.h>
SUPERVGUI_ManagePortsDlg::~SUPERVGUI_ManagePortsDlg() {
}
+// mkr : PAL8060
+void SUPERVGUI_ManagePortsDlg::createLinkEngine( SUPERV::Port_ptr thePort,
+ QValueList< QPair< QString,QString > >& theOwnList,
+ QValueList< QPair< QString,QString > >& theCorrespList ) {
+ // pair <NodeName, PortName> for the given port
+ QPair<QString, QString> anOwnPair(QString(thePort->Node()->Name()), QString(thePort->Name()));
+ int aNum = theOwnList.contains(anOwnPair);
+ while ( aNum > 0 ) {
+ int anId = theOwnList.findIndex(anOwnPair); // get index in theOwnList
+ QPair<QString, QString> aCorrespPair = theCorrespList[anId]; // corresponding pair in theCorrespList
+
+ theOwnList.remove(theOwnList.at(anId));
+ theCorrespList.remove(theCorrespList.at(anId));
+
+ SUPERV_Port aCorrespPort = myNode->getMain()->getDataflow()->Node(aCorrespPair.first)->Port(aCorrespPair.second);
+ SUPERV_Link aLinkEngine;
+ if ( thePort->IsInput() )
+ aLinkEngine = myNode->getMain()->getDataflow()->Link(aCorrespPort, thePort);
+ else
+ aLinkEngine = myNode->getMain()->getDataflow()->Link(thePort, aCorrespPort);
+ SUPERVGUI_CanvasLink* aLink = new SUPERVGUI_CanvasLink(myNode->getMain()->getCanvas(), myNode->getMain(), aLinkEngine);
+ aLink->show();
+
+ aNum--;
+ }
+}
+
/**
* Set the ports as entered by user (order, name/type, etc.) and close the dialog
*/
// automatically removes the corresponding Output Port. So for Loops the
// oldPorts list should be filtered to include only Input Ports.
// But I'll filter Gate-s as well..
+ bool isAnyLinked = false; // check if any port from old ports is linked
QObjectList portsToRemove;
while ( (obj = it.current()) != 0 ) {
++it;
SUPERV::Port_var aPort = ((SUPERVGUI_CanvasPort*)obj)->getEngine();
- if ( !aPort->IsGate() && ( !isLoop || aPort->IsInput() ) )
+ if ( !aPort->IsGate() && ( !isLoop || aPort->IsInput() ) ) {
portsToRemove.append( obj );
+ }
+ // check if port has a link (output porst of Loop node are also checked)
+ if ( !aPort->IsGate() && aPort->IsLinked() && !isAnyLinked)
+ isAnyLinked = true;
}
delete oldPorts; // delete the list, not the objects
+
+ // mkr : PAL8060 -->
+ QString aNodeName = myNode->getEngine()->Name();
+ QValueList< QPair< QString,QString > > InPortsL, OutPortsL;
+ if ( isAnyLinked ) {
+ // if myNode has linked port(s), create two lists of In/Out ports (InPortsL, OutPortsL) to identify all links for myNode
+ QObjectList* list = myNode->getMain()->getCanvas()->queryList("SUPERVGUI_CanvasLink");
+ QObjectListIt listit( *list );
+ QObject *listobj;
+ while ( (listobj = listit.current()) != 0 ) {
+ ++listit;
+ SUPERV::Link_var aLink = ((SUPERVGUI_CanvasLink*)listobj)->getEngine();
+ if ( aNodeName.compare(aLink->InPort()->Node()->Name()) == 0
+ ||
+ aNodeName.compare(aLink->OutPort()->Node()->Name()) == 0 ) {
+ QPair<QString, QString> InPair(QString(aLink->InPort()->Node()->Name()), QString(aLink->InPort()->Name()));
+ QPair<QString, QString> OutPair(QString(aLink->OutPort()->Node()->Name()), QString(aLink->OutPort()->Name()));
+ InPortsL.append(InPair);
+ OutPortsL.append(OutPair);
+ }
+
+ if ( isLoop ) {
+ // put into In/Out lists all links for corresponding EndLoop node
+ QString aCoupledNodeName = ((SUPERVGUI_CanvasStartNode*)myNode)->getCoupled()->getEngine()->Name();
+ if ( aCoupledNodeName.compare(aLink->InPort()->Node()->Name()) == 0
+ ||
+ aCoupledNodeName.compare(aLink->OutPort()->Node()->Name()) == 0 ) {
+ QPair<QString, QString> InPair(QString(aLink->InPort()->Node()->Name()), QString(aLink->InPort()->Name()));
+ QPair<QString, QString> OutPair(QString(aLink->OutPort()->Node()->Name()), QString(aLink->OutPort()->Name()));
+ InPortsL.append(InPair);
+ OutPortsL.append(OutPair);
+ }
+ }
+ }
+ }
+ // mkr : PAL8060 <--
// portsToRemove list contains:
// for Loop node: all INPUT ports except Gates
item = (PortListItem*)myInList->item( i );
aPort = aINode->InPort( item->PortName.latin1(), item->PortType.latin1() );
myNode->createPort( aPort.in() );
+
+ // mkr : PAL8060
+ if ( !InPortsL.isEmpty() && !OutPortsL.isEmpty() )
+ // create links for those input ports, which had links earlier
+ createLinkEngine( aPort, InPortsL, OutPortsL );
+ }
+
+ if ( isLoop ) {
// asv : 11.01.05 : for Loop nodes do the same as in SUPERVGUI_CanvasStartNode::addInputPort()
- if ( isLoop ) {
- SUPERVGUI_CanvasStartNode* aStartLoopNode = (SUPERVGUI_CanvasStartNode*)myNode;
- aStartLoopNode->merge();
- aStartLoopNode->getCoupled()->merge();
+ SUPERVGUI_CanvasStartNode* aStartLoopNode = (SUPERVGUI_CanvasStartNode*)myNode;
+ aStartLoopNode->merge();
+ aStartLoopNode->getCoupled()->merge();
+
+ // mkr : PAL8060 -->
+ if ( !InPortsL.isEmpty() && !OutPortsL.isEmpty() ) {
+
+ // 1) create old links for output ports of Loop node
+ QObjectList* aPortsOut = aStartLoopNode->queryList("SUPERVGUI_CanvasPortOut");
+ QObjectListIt aPorstOutit( *aPortsOut );
+ QObject *listobj;
+ while ( (listobj = aPorstOutit.current()) != 0 ) {
+ ++aPorstOutit;
+
+ SUPERV::Port_var aPortOut = ((SUPERVGUI_CanvasPort*)listobj)->getEngine();
+ createLinkEngine( aPortOut, OutPortsL, InPortsL );
+ }
+
+ // 2) create old links for input ports of EndLoop node
+ QObjectList* aPortsIn = aStartLoopNode->getCoupled()->queryList("SUPERVGUI_CanvasPortIn");
+ QObjectListIt aPorstInit( *aPortsIn );
+ while ( (listobj = aPorstInit.current()) != 0 ) {
+ ++aPorstInit;
+
+ SUPERV::Port_var aPortIn = ((SUPERVGUI_CanvasPort*)listobj)->getEngine();
+ createLinkEngine( aPortIn, InPortsL, OutPortsL );
+ }
+
+ // 3) create old links for output ports of EndLoop node
+ aPortsOut = aStartLoopNode->getCoupled()->queryList("SUPERVGUI_CanvasPortOut");
+ aPorstOutit = QObjectListIt( *aPortsOut );
+ while ( (listobj = aPorstOutit.current()) != 0 ) {
+ ++aPorstOutit;
+
+ SUPERV::Port_var aPortOut = ((SUPERVGUI_CanvasPort*)listobj)->getEngine();
+ createLinkEngine( aPortOut, OutPortsL, InPortsL );
+ }
}
+ // mkr : PAL8060 <--
}
+
// creating Out-ports, except LoopNode-s
for ( i = 0; i < myOutList->count() && !isLoop; i++ ) {
item = (PortListItem*)myOutList->item( i );
aPort = aINode->OutPort( item->PortName.latin1(), item->PortType.latin1() );
myNode->createPort( aPort.in() );
+
+ // mkr : PAL8060
+ if ( !InPortsL.isEmpty() && !OutPortsL.isEmpty() )
+ // create links for those output ports, which had links earlier
+ createLinkEngine( aPort, OutPortsL, InPortsL );
}
// 2. update the node's presentation
#ifndef SUPERVGUI_ManagePortsDlg_H
#define SUPERVGUI_ManagePortsDlg_H
+#include "SUPERVGUI.h"
+
#include <qdialog.h>
#include <qlistbox.h>
#include <qstringlist.h>
#include <qlineedit.h>
#include <qcombobox.h>
+#include <qpair.h>
class SUPERVGUI_CanvasNode;
void moveUp( QListBox* );
void moveDown( QListBox* );
void moveItem( QListBox* theLB, const int from, const int to );
+ // mkr : PAL8060
+ void createLinkEngine( SUPERV::Port_ptr thePort,
+ QValueList< QPair< QString,QString > >& theOwnList,
+ QValueList< QPair< QString,QString > >& theCorrespList );
private:
void init();
// Module : SUPERV
#include <SUPERVGUI_Prs.h>
+//#include <SUPERVGUI_PrsPort.h>
//=======================================================================
// name : SUPERVGUI_Prs
}
void SUPERVGUI_PrsDrawer::drawPort( GLViewer_Pnt* pnt, GLfloat d,
- const QString& label, GLViewer_Pnt* textPnt )
+ const QString& label, GLViewer_Pnt* textPnt )
{
if( !pnt )
return;
//drawText( label, textX , textY, myNColor, &aTmpFont, 2 );
}
+/*void SUPERVGUI_PrsDrawer::drawPort( SUPERVGUI_PrsPort* thePort )
+{
+ // draw ports' contour
+ drawContour( thePort->getRect(), Qt::black, myLineWidth, 0, false );
+
+ // draw connection point
+ drawVertex( thePort->getPoint()->x(), thePort->getPoint()->y(), Qt::black );
+
+ // draw connection line
+ GLfloat x, y;
+ if ( thePort->getPort()->getEngine()->IsInput() )
+ x = thePort->getRect()->left();
+ else
+ x = thePort->getRect()->right();
+ y = (thePort->getRect()->top() + thePort->getRect()->bottom())/2;
+
+ GLViewer_Pnt aSecPoint( x, y );
+ GLViewer_PntList pnts;
+ pnts.push_back( *(thePort->getPoint()) );
+ pnts.push_back( aSecPoint );
+
+ drawContour( pnts, Qt::black, myLineWidth );
+
+ // draw ports' text
+ GLfloat textX = ( aSecPoint.x() );
+ GLfloat textY = ( aSecPoint.y() );
+
+ drawGLText( thePort->getText(), textX , textY, GLText_Center, GLText_Center );
+}*/
+
+
typedef QMap<int,GLViewer_Pnt*> StreamPointsMap;
+//class SUPERVGUI_PrsPort;
+
/*
Class : SUPERVGUI_Prs
Description : Base class for GLViewer presenataions of Nodes
void drawBoundaryBox( GLViewer_Rect*, GLfloat, GLushort );
void drawPort( GLViewer_Pnt*, GLfloat, const QString& );
void drawPort( GLViewer_Pnt*, GLfloat, const QString&, GLViewer_Pnt* );
+ //void drawPort( SUPERVGUI_PrsPort* );
void setNColor( const QColor& color ) { myNColor = color; }
void setHColor( const QColor& color ) { myHColor = color; }
// Module : SUPERV
#include <SUPERVGUI_PrsNode.h>
+#include <SUPERVGUI_CanvasPort.h>
+#include <SUPERVGUI_Main.h>
#include <GLViewer_Group.h>
+#include <GLViewer_Context.h>
#include <SUIT_ResourceMgr.h>
#include <SUIT_Session.h>
-#include <gp_XY.hxx>
-
-#define PORT_MARGIN 2
+//#define PORT_MARGIN 2
//=======================================================================
// name : SUPERVGUI_PrsNode
// Purpose : Constructor
//=======================================================================
-SUPERVGUI_PrsNode::SUPERVGUI_PrsNode( SUPERVGUI_CanvasNode* theNode ) :
+SUPERVGUI_PrsNode::SUPERVGUI_PrsNode( SUPERVGUI_CanvasNode* theNode, GLViewer_Pnt* theFirstPnt ) :
SUPERVGUI_Prs(),
myNode(theNode)
{
myType = "SUPERVGUI_PrsNode";
+ myName = myNode->getEngine()->Name();
setScalable( true );
myStreamHeight = 0;
myGateHeight = PORT_HEIGHT + 2*PORT_MARGIN;
- myHeight = INST_HEIGHT;// it will be defined when we'll know the number of ports exactly
+ //myHeight = INST_HEIGHT;// it will be defined when we'll know the number of ports exactly
// and it will be different for different types of nodes,
// i.e. for Compute, Loop, Switch, Goto ... nodes
// So, it have to be defined in subclasses
+ // get height by using getHeight() method (it's have to be redefined in subclasses)
SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
QString fileName = aResMgr->path( "resources", "SUPERVGUI", "ICO_NODE_INLINE" );
myIcon = GLViewer_Drawer::loadTexture( fileName );
+
myColor = aResMgr->colorValue( "SUPERVGraph", "NodeBody", DEF_MAIN_BACK );
- // setState(myNode->getEngine()->State());
- setState(SUPERV_Running);
+ setState(myNode->getEngine()->State());
+ //setState(SUPERV_Running);
- //updatePorts(); // method for ports' presentations creation
+ setFirstPoint(theFirstPnt);
+ createPorts(); // method for ports' presentations creation
}
//=======================================================================
{
float x1 = myFirstPoint->x() - myWidth / 2 / myXScale;
float x2 = myFirstPoint->x() + myWidth / 2 / myXScale;
+ //float x1 = myFirstPoint->x();
+ //float x2 = myFirstPoint->x() + myWidth / myXScale;
float y1 = myFirstPoint->y();
- float y2 = myFirstPoint->y() + myHeight / myYScale;
+ float y2 = myFirstPoint->y() + getHeight() / myYScale;
myRect->setLeft( x1 );
myRect->setRight( x2 );
float r = SP_GAP / myXScale;
float w = myWidth / myXScale;
- float h = myHeight / myYScale;
+ float h = getHeight() / myYScale;
switch( type )
{
myTime = QString(hms);
}
+//================================================================
+// Function : getWidth
+// Purpose :
+//================================================================
+float SUPERVGUI_PrsNode::getWidth() const
+{
+ return myWidth;
+}
+
+//================================================================
+// Function : getHeight
+// Purpose :
+//================================================================
+float SUPERVGUI_PrsNode::getHeight() const
+{
+ return getTitleHeight() + getLabelHeight() + getStatusHeight() +
+ getBodyHeight() + getGateHeight();
+}
+
+//================================================================
+// Function : getTitleHeight
+// Purpose :
+//================================================================
+float SUPERVGUI_PrsNode::getTitleHeight() const
+{
+ return myTitleHeight;
+}
+
+//================================================================
+// Function : getLabelHeight
+// Purpose :
+//================================================================
+float SUPERVGUI_PrsNode::getLabelHeight() const
+{
+ if (isLabelVisible())
+ return myLabelHeight;
+ return 0;
+}
+
+//================================================================
+// Function : getStatusHeight
+// Purpose :
+//================================================================
+float SUPERVGUI_PrsNode::getStatusHeight() const
+{
+ return myStatusHeight;
+}
+
+//================================================================
+// Function : getBodyHeight
+// Purpose :
+//================================================================
+float SUPERVGUI_PrsNode::getBodyHeight() const
+{
+ if (isPortVisible())
+ return myPortHeight + myStreamHeight;
+ return 0;
+}
+
+//================================================================
+// Function : getPortHeight
+// Purpose :
+//================================================================
+float SUPERVGUI_PrsNode::getPortHeight() const
+{
+ if (isPortVisible())
+ return myPortHeight;
+ return 0;
+}
+
+//================================================================
+// Function : getStreamHeight
+// Purpose :
+//================================================================
+float SUPERVGUI_PrsNode::getStreamHeight() const
+{
+ if (isPortVisible())
+ return myStreamHeight;
+ return 0;
+}
+
+//================================================================
+// Function : getGateHeight
+// Purpose :
+//================================================================
+float SUPERVGUI_PrsNode::getGateHeight() const
+{
+ if (isPortVisible())
+ return myGateHeight;
+ return 0;
+}
+
+//================================================================
+// Function : createPorts
+// Purpose : create (not draw) presentations for ports' of this node object
+//================================================================
+void SUPERVGUI_PrsNode::createPorts()
+{
+ //bool aDisp = getVisible();
+ //if (aDisp) hide();
+
+ //QRect r = getBodyRect();
+ float w = (int)(myWidth/2) - PORT_MARGIN;
+ if (w < PORT_WIDTH) w = PORT_WIDTH;
+
+ //float ix = myFirstPoint->x() + PORT_MARGIN;
+ float ix = myFirstPoint->x() - myWidth / 2 / myXScale + PORT_MARGIN;
+ float ih = myFirstPoint->y() + PORT_MARGIN;
+ float ox = ix + w;
+ float oh = myFirstPoint->y() + PORT_MARGIN;
+
+ const QObjectList* list = myNode->children();
+
+ cout<<"1 : myPortHeight = "<<myPortHeight<<endl;
+ // input/output ports creation
+ if (list) {
+ QObjectListIt it(*list);
+ SUPERVGUI_CanvasPort* aPort;
+ while (QObject* obj = it.current()) {
+ ++it;
+ if (obj->inherits("SUPERVGUI_CanvasPort")) {
+ aPort = (SUPERVGUI_CanvasPort*) obj;
+ if (!aPort->getEngine()->IsGate() && !aPort->isStream()) {
+ if (aPort->getEngine()->IsInput()) {
+ // create ports' presentation
+ SUPERVGUI_PrsPort* aPrsPort = aPort->getGLPrs();
+ aPrsPort->setRect(ix, ih, w, PORT_HEIGHT);
+ ih += PORT_HEIGHT;
+ }
+ else {
+ SUPERVGUI_PrsPort* aPrsPort = aPort->getGLPrs();
+ aPrsPort->setRect(ox, oh, w, PORT_HEIGHT);
+ oh += PORT_HEIGHT;
+ }
+ }
+ }
+ }
+ }
+
+ myPortHeight = ( ih>oh ? ih : oh ) - myFirstPoint->y() + PORT_MARGIN;
+ cout<<"2 : myPortHeight = "<<myPortHeight<<endl;
+
+ // stream ports creation
+ float sy = myFirstPoint->y() + myPortHeight;
+ cout<<"1 : sy = "<<sy<<endl;
+ ih = sy + PORT_MARGIN;
+ oh = sy + PORT_MARGIN;
+
+ if (list) {
+ QObjectListIt it(*list);
+ SUPERVGUI_CanvasPort* aPort;
+ while (QObject* obj = it.current()) {
+ ++it;
+ if (obj->inherits("SUPERVGUI_CanvasPort")) {
+ aPort = (SUPERVGUI_CanvasPort*) obj;
+ if (!aPort->getEngine()->IsGate() && aPort->isStream()) {
+ if (aPort->getEngine()->IsInput()) {
+ SUPERVGUI_PrsPort* aPrsPort = aPort->getGLPrs();
+ aPrsPort->setRect(ix, ih, w, PORT_HEIGHT);
+ ih += PORT_HEIGHT;
+ }
+ else {
+ SUPERVGUI_PrsPort* aPrsPort = aPort->getGLPrs();
+ aPrsPort->setRect(ox, oh, w, PORT_HEIGHT);
+ oh += PORT_HEIGHT;
+ }
+ }
+ }
+ }
+ }
+
+ cout<<"3 : myStreamHeight = "<<myStreamHeight<<endl;
+ myStreamHeight = ( ih>oh ? ih : oh ) - sy + PORT_MARGIN;
+ if (myStreamHeight == 2*PORT_MARGIN) myStreamHeight = 0;
+ cout<<"4 : myStreamHeight = "<<myStreamHeight<<endl;
+
+ // gate ports creation
+ sy = myFirstPoint->y() + myPortHeight + myStreamHeight;
+ cout<<"2 : sy = "<<sy<<endl;
+ ih = sy + PORT_MARGIN;
+ oh = sy + PORT_MARGIN;
+
+ if (list) {
+ QObjectListIt it(*list);
+ SUPERVGUI_CanvasPort* aPort;
+ while (QObject* obj = it.current()) {
+ ++it;
+ if (obj->inherits("SUPERVGUI_CanvasPort")) {
+ aPort = (SUPERVGUI_CanvasPort*) obj;
+ if (aPort->getEngine()->IsGate()) {
+ if (aPort->getEngine()->IsInput()) {
+ SUPERVGUI_PrsPort* aPrsPort = aPort->getGLPrs();
+ aPrsPort->setRect(ix, ih, w, PORT_HEIGHT);
+ ih += PORT_HEIGHT;
+ }
+ else {
+ SUPERVGUI_PrsPort* aPrsPort = aPort->getGLPrs();
+ aPrsPort->setRect(ox, oh, w, PORT_HEIGHT);
+ oh += PORT_HEIGHT;
+ }
+ }
+ }
+ }
+ }
+
+ cout<<"5 : myGateHeight = "<<myGateHeight<<endl;
+ myGateHeight = ( ih>oh ? ih : oh ) - sy + PORT_MARGIN;
+ cout<<"6 : myGateHeight = "<<myGateHeight<<endl;
+
+ // shift ports
+ if (list) {
+ QObjectListIt it(*list);
+ SUPERVGUI_CanvasPort* aPort;
+ while (QObject* obj = it.current()) {
+ ++it;
+ if (obj->inherits("SUPERVGUI_CanvasPort")) {
+ aPort = (SUPERVGUI_CanvasPort*) obj;
+ SUPERVGUI_PrsPort* aPrsPort = aPort->getGLPrs();
+ aPrsPort->setRectBottom( aPrsPort->getRect()->bottom() + myFirstPoint->y()*2 +
+ getBodyHeight() + getGateHeight());
+ aPrsPort->setRectTop( aPrsPort->getRect()->top() + myFirstPoint->y()*2 +
+ getBodyHeight() + getGateHeight());
+ }
+ }
+ }
+}
+
+//================================================================
+// Function : insertPorts
+// Purpose : insert port objects of this node into the context
+//================================================================
+void SUPERVGUI_PrsNode::insertPorts()
+{
+ const QObjectList* list = myNode->children();
+ if (list) {
+ QObjectListIt it(*list);
+ SUPERVGUI_CanvasPort* aPort;
+ while (QObject* obj = it.current()) {
+ ++it;
+ if (obj->inherits("SUPERVGUI_CanvasPort")) {
+ aPort = (SUPERVGUI_CanvasPort*) obj;
+ SUPERVGUI_PrsPort* aPrsPort = aPort->getGLPrs();
+ aPrsPort->setGroup( getGroup() );
+ myNode->getMain()->getGLContext()->insertObject( aPrsPort, true /*false*/ );
+ }
+ }
+ }
+}
/*
Class : SUPERVGUI_PrsNodeDrawer
{
myXScale = xScale;
myYScale = yScale;
-
- // GLViewer_Group* group = new GLViewer_Group();
QValueList<GLViewer_Object*>::Iterator it;
for( it = myObjects.begin(); it != myObjects.end(); it++ ) {
else if( object->isHighlighted() )
drawBoundaryBox( rect, gap, myStippleHPattern );
- const int fieldHeight = 30;
+ //---------------------
+ GLViewer_PntList pnts;
+ pnts.push_back( GLViewer_Pnt( rect->left(), rect->top() ) );
+ pnts.push_back( GLViewer_Pnt( rect->left(), rect->bottom() ) );
+ pnts.push_back( GLViewer_Pnt( rect->right(), rect->bottom() ) );
+ pnts.push_back( GLViewer_Pnt( rect->right(), rect->top() ) );
+ drawPolygon( pnts, object->nodeColor() );
+
+ QColor primingColor = myPrimingColor;
+
+ primingColor = Qt::white;
+ //drawRectangle( rect, myLineWidth, 0, myNColor, true, primingColor );
+
+ //QString name = "computing node";//object->getName();
+ //if ( textFormat() == DTF_TEXTURE_SCALABLE && name.length() > 15 )
+ // name = name.left( 12 ) + QString( "..." );
+
+ if ( textFormat() == DTF_TEXTURE_SCALABLE && object->getName().length() > 15 )
+ drawGLText( object->getName().left( 12 ) + QString( "..." ),
+ rect->left()+rect->width()/2, rect->top()-5, GLText_Center, GLText_Center );
+ else
+ drawGLText( object->getName(), rect->left()+rect->width()/2, rect->top()-5, GLText_Center, GLText_Center );
+
+ /*QFont* aFont = new QFont( "Helvetica", 12 );
+ aFont->setStyleHint( QFont::Helvetica );
+ aFont->setStyleStrategy( QFont::PreferQuality );
+ drawText( name, (rect->left()-rect->right())/2, rect->top()-25, Qt::black, aFont, 0 );*/
+
+
+ //--------------------------------------------
+ /*const int fieldHeight = 30;
GLViewer_Rect frect( *rect );
frect.setBottom( rect->top() - fieldHeight );
drawRectangle( &frect, 1., 0., Qt::black, true, Qt::cyan );
frect.setBottom( rect->top() - 4*fieldHeight );
drawRectangle( &frect, 1., 0., Qt::black, true, Qt::green );
- drawGLText( "DTF_TEXTURE_SCALABLE text", rect->left()+5, rect->top()-5, GLText_Right, GLText_Center );
+ drawGLText( "DTF_TEXTURE_SCALABLE text", rect->left()+5, rect->top()-5, GLText_Right, GLText_Center );*/
+ //--------------------------------------------
- float iconSize = 16;
- drawTexture( object->getIcon(), (int)iconSize,
- rect->left() + iconSize / 2, rect->top() - iconSize / 2 );
+ //float iconSize = 16;
+ //drawTexture( object->getIcon(), (int)iconSize,
+ // rect->left() + iconSize / 2, rect->top() - iconSize / 2 );
- StreamPointsMap streamPoints = object->getStreamPoints();
+ /*StreamPointsMap streamPoints = object->getStreamPoints();
StreamPointsMap::iterator it = streamPoints.begin();
cout<<"We going to draw stream points . . ."<<endl;
//for ( ; it != streamPoints.end(); ++it ) {
// remove temporary created point
delete textPnt;
//}
+ */
// draw ports of the node
- PortList Ports = object->getPorts();
- PortList::iterator itP = Ports.begin();
- cout<<"We going to draw ports . . ."<<endl;
- for ( ; itP != Ports.end(); ++itP ) {
-
-
- }
+ //PortList Ports = object->getPorts();
+ //PortList::iterator itP = Ports.begin();
+ //cout<<"We going to draw ports . . ."<<endl;
+ //for ( ; itP != Ports.end(); ++itP ) {
+ //}
+
+ /*const QObjectList* list = object->getNode()->children();
+ if (list) {
+ QObjectListIt it(*list);
+ while (QObject* obj = it.current()) {
+ ++it;
+ if (obj->inherits("SUPERVGUI_CanvasPort"))
+ drawPort( ((SUPERVGUI_CanvasPort*)obj)->getGLPrs());
+ }
+ }*/
}
}
Q_OBJECT
public:
- SUPERVGUI_PrsNode( SUPERVGUI_CanvasNode* theNode );
+ SUPERVGUI_PrsNode( SUPERVGUI_CanvasNode* theNode, GLViewer_Pnt* theFirstPnt );
virtual ~SUPERVGUI_PrsNode();
public:
+ SUPERVGUI_CanvasNode* getNode() const { return myNode; }
+
virtual void compute();
virtual void update();
virtual void clear();
GLboolean isCircle = GL_FALSE, GLboolean isShift = GL_FALSE );
virtual GLboolean unselect();
- float getWidth() const { return myWidth; }
- float getHeight() const { return myHeight; }
+ virtual float getWidth() const;
+ virtual float getHeight() const;
+
+ virtual float getTitleHeight() const;
+ virtual float getLabelHeight() const;
+ virtual float getStatusHeight() const;
+ virtual float getBodyHeight() const;
+ virtual float getPortHeight() const;
+ virtual float getStreamHeight() const;
+ virtual float getGateHeight() const;
GLuint getIcon() const;
+
+ virtual void setNodeColor(const QColor& theColor) { myColor = theColor; }
+ virtual QColor nodeColor() const { return myColor; }
+
+ virtual void setLabelVisible(bool b) { myLabelVisible = b; }
+ virtual void setPortVisible(bool b) { myPortVisible = b; }
+ bool isLabelVisible() const { return myLabelVisible; }
+ bool isPortVisible() const { return myPortVisible; }
// connection data
SUPERVGUI_PrsPort* getPort( const int ) const; // don't use
QValueList<SUPERVGUI_PrsPort*>
getConnections( const int ) const;
- virtual void setState(SUPERV::GraphState theState);
+ virtual void setState(SUPERV::GraphState theState);
+
+ void insertPorts();
+
+protected:
+ virtual void createPorts();
private:
- float myWidth;
- float myHeight;
+ float myWidth;
+ //float myHeight;
- GLuint myIcon;
+ GLuint myIcon;
- GLint mySelElement;
+ GLint mySelElement;
//PortMap myPorts;
PortList myPorts;
PortConnectionMap myConnections;
- int myTitleHeight;
- int myLabelHeight;
- int myStatusHeight;
- int myPortHeight;
- int myStreamHeight; //???
- int myGateHeight;
+ float myTitleHeight;
+ float myLabelHeight;
+ float myStatusHeight;
+ float myPortHeight;
+ float myStreamHeight; //???
+ float myGateHeight;
QString myStatus;
QString myTime;
QColor myColor;
QColor myStatusColor;
+ bool myPortVisible;
+ bool myLabelVisible;
+
SUPERVGUI_CanvasNode* myNode;
};
#include "SUPERVGUI_PrsPort.h"
+#include <GLViewer_Group.h>
+
+#include <SUIT_ResourceMgr.h>
+#include <SUIT_Session.h>
+
//=======================================================================
// name : SUPERVGUI_PrsStream
// Purpose : Constructor
//=======================================================================
-SUPERVGUI_PrsPort::SUPERVGUI_PrsPort( int theType, SUPERVGUI_Prs* thePrs )
+SUPERVGUI_PrsPort::SUPERVGUI_PrsPort( SUPERVGUI_CanvasPort* thePort )
+ : GLViewer_Object(),
+ myPort(thePort)
{
- myType = theType;
- myPrs = thePrs;
-
+ myType = "SUPERVGUI_PrsPort";
+
myRect = new GLViewer_Rect();
+ myPoint = new GLViewer_Pnt();
+ myText = getText();
+ SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
+ myColor = aResMgr->colorValue( "SUPERVGraph", "NodeBody", DEF_MAIN_BACK );
+
//cout << myPrs->getName().data() << endl;
//cout << myPoint->x() << " " << myPoint->y() << endl;
}
//=======================================================================
GLViewer_Pnt* SUPERVGUI_PrsPort::getPoint() const
{
- GLViewer_Pnt* point = 0;
- if ( myPrs )
- point = myPrs->getStreamPoint( myType );
- return point;
+ //GLViewer_Pnt* point = 0;
+ //if ( myPrs )
+ // point = myPrs->getStreamPoint( myType );
+ //return point;
+ return myPoint;
+}
+
+GLboolean SUPERVGUI_PrsPort::highlight( GLfloat x, GLfloat y, GLfloat tol, GLboolean isCircle )
+{
+ return GL_TRUE;
+}
+
+GLboolean SUPERVGUI_PrsPort::unhighlight()
+{
+ return GL_TRUE;
+}
+
+GLboolean SUPERVGUI_PrsPort::select( GLfloat x, GLfloat y, GLfloat tol, GLViewer_Rect rect,
+ GLboolean isFull, GLboolean isCircle, GLboolean isShift )
+{
+ return GL_TRUE;
+}
+
+GLboolean SUPERVGUI_PrsPort::unselect()
+{
+ return GL_TRUE;
+}
+
+void SUPERVGUI_PrsPort::moveObject( float theX, float theY, bool fromGroup )
+{
+ if( !fromGroup && myGroup )
+ {
+ myGroup->dragingObjects( theX, theY );
+ return;
+ }
+
+ update( theX, theY );
}
+float SUPERVGUI_PrsPort::getConnectionPointX() const
+{
+ float x;
+ if (myPort->getEngine()->IsInput())
+ x = myRect->left() - PORT_MARGIN - POINT_SIZE;
+ else
+ x = myRect->right() + PORT_MARGIN + POINT_SIZE;
+ return x;
+}
+
+float SUPERVGUI_PrsPort::getConnectionPointY() const
+{
+ return (myRect->top() + myRect->bottom())/2;
+}
+
+void SUPERVGUI_PrsPort::setRect( float theLeft , float theTop, float theWidth, float theHeight )
+{
+ myRect->setCoords( theLeft, theLeft+theWidth, -(theTop+theHeight), -theTop/*+theHeight*/ );
+ myPoint->setXY( getConnectionPointX(), getConnectionPointY() );
+}
+
+void SUPERVGUI_PrsPort::setRectBottom( float b)
+{
+ myRect->setBottom(b);
+ myPoint->setY( getConnectionPointY() );
+}
+
+void SUPERVGUI_PrsPort::setRectTop( float t)
+{
+ myRect->setTop(t);
+ myPoint->setY( getConnectionPointY() );
+}
//================================================================
// Function : updateRect
// Purpose :
//================================================================
-void SUPERVGUI_PrsPort::updateRect( GLfloat xScale, GLfloat yScale )
+/*void SUPERVGUI_PrsPort::updateRect( GLfloat xScale, GLfloat yScale )
{
const GLViewer_Pnt* point = getPoint();
if ( !point )
myRect->setRight( point->x() + SP_GAP / xScale );
myRect->setTop( point->y() + SP_GAP / yScale );
myRect->setBottom( point->y() - SP_GAP / yScale );
+}*/
+
+//================================================================
+// Function : updateRect
+// Purpose :
+//================================================================
+void SUPERVGUI_PrsPort::update( GLfloat theDX, GLfloat theDY )
+{
+ myPoint->move( theDX, theDY );
+ myRect->move( theDX, theDY );
+}
+
+QString SUPERVGUI_PrsPort::getText() const
+{
+ SUPERV_Port aPort = myPort->getEngine();
+ QString aText;
+ if ( !CORBA::is_nil( aPort ) ) {
+ aText = aPort->Name();
+ if (aPort->IsParam() || aPort->IsInLine() || myPort->isStream())
+ aText = aText + "=" + aPort->ToString();
+ }
+ // printf( "--- return text of port : %s ---\n", aText.latin1() );
+ return aText;
}
//================================================================
// return true;
//return false;
}
+
+/*
+ Class : SUPERVGUI_PrsPortDrawer
+ Description : Drawer for SUPERVGUI_PrsPort
+*/
+
+//=======================================================================
+// name : SUPERVGUI_PrsPortDrawer
+// Purpose : Constructor
+//=======================================================================
+SUPERVGUI_PrsPortDrawer::SUPERVGUI_PrsPortDrawer()
+:GLViewer_Drawer()
+{
+ myObjectType = "SUPERVGUI_PrsPort";
+
+ // for text scaling -->
+ //setTextFormat( DTF_TEXTURE_SCALABLE );
+
+ //QFont aFont( "Helvetica", 5 );
+ //aFont.setStyleHint( QFont::Helvetica );
+ //aFont.setStyleStrategy( QFont::PreferQuality );
+ //setFont( aFont );
+ // <--
+
+ myLineWidth = 1.5;
+ myStippleColor = Qt::black;
+ myStippleWidth = 1.0;
+ myStippleHPattern = 0x8888;
+ myStippleSPattern = 0xF0F0;
+}
+
+//=======================================================================
+// name : SUPERVGUI_PrsPortDrawer
+// Purpose : Destructor
+//=======================================================================
+SUPERVGUI_PrsPortDrawer::~SUPERVGUI_PrsPortDrawer()
+{
+}
+
+//================================================================
+// Function : create
+// Purpose :
+//================================================================
+void SUPERVGUI_PrsPortDrawer::create( float xScale, float yScale, bool /*onlyUpdate*/ )
+{
+ myXScale = xScale;
+ myYScale = yScale;
+
+ QValueList<GLViewer_Object*>::Iterator it;
+ for( it = myObjects.begin(); it != myObjects.end(); it++ ) {
+ SUPERVGUI_PrsPort* object = ( SUPERVGUI_PrsPort* )( *it );
+ if( !object->getVisible() )
+ continue;
+
+ float objXScale = object->isScalable() ? 1.0 : myXScale;
+ float objYScale = object->isScalable() ? 1.0 : myYScale;
+
+ object->setScale( objXScale, objYScale );
+ //object->update();
+
+ GLViewer_Rect* rect = object->getRect();
+ GLfloat gap = 15 / myXScale;
+
+ if( object->isSelected() )
+ drawBoundaryBox( rect, gap, myStippleSPattern );
+ else if( object->isHighlighted() )
+ drawBoundaryBox( rect, gap, myStippleHPattern );
+
+ drawPort( object );
+
+ }
+}
+
+//================================================================
+// Function : drawBoundaryBox
+// Purpose :
+//================================================================
+void SUPERVGUI_PrsPortDrawer::drawBoundaryBox( GLViewer_Rect* rect, GLfloat gap, GLushort pattern )
+{
+ if( !rect )
+ return;
+
+ float x1 = rect->left() - gap;
+ float x2 = rect->right() + gap;
+ float y1 = rect->bottom() - gap;
+ float y2 = rect->top() + gap;
+
+ glColor3f( ( GLfloat )myStippleColor.red() / 255,
+ ( GLfloat )myStippleColor.green() / 255,
+ ( GLfloat )myStippleColor.blue() / 255 );
+ glLineWidth( myStippleWidth );
+
+ glEnable( GL_LINE_STIPPLE );
+ glLineStipple( 1, pattern );
+
+ glBegin( GL_LINE_LOOP );
+ glVertex2f( x1, y1 );
+ glVertex2f( x1, y2 );
+ glVertex2f( x2, y2 );
+ glVertex2f( x2, y1 );
+ glEnd();
+
+ glDisable( GL_LINE_STIPPLE );
+}
+
+//================================================================
+// Function : drawPort
+// Purpose :
+//================================================================
+void SUPERVGUI_PrsPortDrawer::drawPort( SUPERVGUI_PrsPort* thePort )
+{
+ // draw ports' contour
+ drawContour( thePort->getRect(), Qt::black, myLineWidth, 0, false );
+
+ // draw connection point
+ drawVertex( thePort->getPoint()->x(), thePort->getPoint()->y(), Qt::black );
+
+ // draw connection line
+ GLfloat x, y;
+ if ( thePort->getPort()->getEngine()->IsInput() )
+ x = thePort->getRect()->left();
+ else
+ x = thePort->getRect()->right();
+ y = (thePort->getRect()->top() + thePort->getRect()->bottom())/2;
+
+ GLViewer_Pnt aSecPoint( x, y );
+ GLViewer_PntList pnts;
+ pnts.push_back( *(thePort->getPoint()) );
+ pnts.push_back( aSecPoint );
+
+ drawContour( pnts, Qt::black, myLineWidth );
+
+ // draw ports' text
+ GLfloat textX = ( aSecPoint.x() );
+ GLfloat textY = ( aSecPoint.y() );
+
+ if ( thePort->getPort()->getEngine()->IsInput() )
+ drawGLText( thePort->getText(), textX, textY, GLText_Right/*Center*/, GLText_Center );
+ else
+ drawGLText( thePort->getText(), textX - thePort->getRect()->width() , textY, GLText_Right/*Center*/, GLText_Center );
+}
#define SUPERVGUI_PrsPort_H
#include "SUPERVGUI_Prs.h"
+#include "SUPERVGUI_CanvasPort.h"
+
+//class SUPERVGUI_PrsPortDrawer;
+
+/*
+ Class : SUPERVGUI_PrsPortDrawer
+ Description : Drawer for SUPERVGUI_PrsPort
+*/
+class SUPERVGUI_PrsPortDrawer : public GLViewer_Drawer
+{
+public:
+ SUPERVGUI_PrsPortDrawer();
+ virtual ~SUPERVGUI_PrsPortDrawer();
+
+public:
+ virtual void create( float, float, bool );
+
+protected:
+ void drawBoundaryBox( GLViewer_Rect*, GLfloat, GLushort );
+ void drawPort( SUPERVGUI_PrsPort* );
+
+ GLfloat myLineWidth;
+ QColor myStippleColor;
+ GLfloat myStippleWidth;
+ GLushort myStippleHPattern;
+ GLushort myStippleSPattern;
+
+};
/*
Class : SUPERVGUI_PrsPortPort
Description : Port of Port Object
*/
-class SUPERVGUI_PrsPort
+class SUPERVGUI_PrsPort : public GLViewer_Object
{
public:
- SUPERVGUI_PrsPort( int, SUPERVGUI_Prs* );
+ SUPERVGUI_PrsPort( SUPERVGUI_CanvasPort* );
virtual ~SUPERVGUI_PrsPort();
public:
- void updateRect( GLfloat xScale, GLfloat yScale );
+ SUPERVGUI_CanvasPort* getPort() const { return myPort; }
- bool locked( GLViewer_Pnt thePoint,
- SUPERVGUI_PrsPort* thePullingPort );
+ virtual void compute() {}
+
+ virtual GLViewer_Drawer* createDrawer() { return myDrawer = new SUPERVGUI_PrsPortDrawer(); }
- int getType() const { return myType; }
- SUPERVGUI_Prs* getPrs() const { return myPrs; }
+ virtual GLboolean highlight( GLfloat x, GLfloat y, GLfloat tol = 15.0, GLboolean isCircle = GL_FALSE );
+ virtual GLboolean unhighlight();
+ virtual GLboolean select( GLfloat x, GLfloat y, GLfloat tol, GLViewer_Rect rect, GLboolean isFull = GL_FALSE,
+ GLboolean isCircle = GL_FALSE, GLboolean isShift = GL_FALSE );
+ virtual GLboolean unselect();
- GLViewer_Pnt* getPoint() const;
- GLViewer_Rect* getRect() const { return myRect; }
+ virtual void moveObject( float, float, bool = false );
-protected:
- int myType;
- SUPERVGUI_Prs* myPrs;
+ virtual bool translateToPS( QFile& hFile, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aPSCS ) { return true; }
+ virtual bool translateToHPGL( QFile& hFile, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aHPGLCS ) { return true; }
+
+ virtual GLViewer_Rect* getUpdateRect() { return new GLViewer_Rect( *myRect ); }
+ //void updateRect( GLfloat xScale, GLfloat yScale );
+ void update( GLfloat theDX, GLfloat theDY );
+
+ bool locked( GLViewer_Pnt thePoint,
+ SUPERVGUI_PrsPort* thePullingPort );
+
+ GLViewer_Pnt* getPoint() const;
+ float getConnectionPointX() const;
+ float getConnectionPointY() const;
+
+ void setRect( float theLeft , float theTop, float theWidth, float theHeight );
+ void setRectBottom( float b);
+ void setRectTop( float t);
+
+ virtual QString getText() const;
+
+ void setPortColor(const QColor& theColor) { myColor = theColor; }
+ QColor portColor() const { return myColor; }
+
+private:
+ SUPERVGUI_CanvasPort* myPort;
+ QString myText; // or myGLText from GLViewer_Object
- GLViewer_Rect* myRect;
+ GLViewer_Pnt* myPoint;
+
+ QColor myColor;
+ //bool myVisible;
};
#endif
}
}
else { // Factory Node
- aNode = aMain->getDataflow()->FNode(component, interface, *myService);
+ aNode = aMain->getDataflow()->FNode(component, interface, *myService, myComponent->implementation_type()); // mkr : PAL11273
if ( CORBA::is_nil( aNode ) ) {
QMessageBox::warning(aDesktop, tr("ERROR"), tr("MSG_CANT_CREATE_NODE"));
return;
return;
}
SUPERV::INode_var aDummyEndNode;
+ // here we have to
+ // 1) parse nodes' python function to find ports names
+ // 2) create ports for engine node with found names and "undefined" types
+ // ( aNode->InPort(name,type), aNode->OutPort(name,type) )
+ // P.S. CanvasNode->createPort(...) for create presentation of port
+ // will be called from addNode(...) (inside CanvasNode constructor)
addNode( aNode, aDummyEndNode, myX, myY );
}
break;