1 // SUPERV SUPERVGUI : GUI for Supervisor component
3 // Copyright (C) 2003 OPEN CASCADE
5 // File : SUPERVGUI_GanvasNodePrs.cxx
6 // Author : Natalia KOPNOVA
10 #include "SUPERVGUI_CanvasNodePrs.h"
11 #include "SUPERVGUI_CanvasNode.h"
12 #include "SUPERVGUI_CanvasPort.h"
13 #include "SUPERVGUI_Canvas.h"
18 #include <sys/timeb.h>
22 #undef PORT_HEIGHT // to avoid warning message
23 #define PORT_HEIGHT LABEL_HEIGHT
27 //=====================================================================
29 //=====================================================================
30 SUPERVGUI_CanvasNodePrs::SUPERVGUI_CanvasNodePrs(QCanvas* theCanvas,
31 SUPERVGUI_CanvasNode* theNode):
32 QCanvasPolygonalItem(theCanvas),
35 Trace("SUPERVGUI_CanvasNodePrs::SUPERVGUI_CanvasNodePrs");
36 myWidth = LABEL_WIDTH;
37 if (2*(PORT_WIDTH+PORT_MARGIN) > myWidth)
38 myWidth = 2*(PORT_WIDTH+PORT_MARGIN);
40 myTitleHeight = LABEL_HEIGHT;
41 myLabelHeight = LABEL_HEIGHT;
42 myStatusHeight = LABEL_HEIGHT;
43 myPortHeight = 2*PORT_MARGIN;
45 myGateHeight = PORT_HEIGHT + 2*PORT_MARGIN;
47 myLabelVisible = true;
52 // create in/out connection points prs
53 myPointIn = new SUPERVGUI_CanvasHookPrs(theCanvas, this, true);
54 myPointOut = new SUPERVGUI_CanvasHookPrs(theCanvas, this, false);
57 setState(myNode->getEngine()->State());
62 SUPERVGUI_CanvasNodePrs::~SUPERVGUI_CanvasNodePrs()
64 Trace("SUPERVGUI_CanvasNodePrs::~SUPERVGUI_CanvasNodePrs");
65 if (myPointIn) delete myPointIn;
66 if (myPointOut) delete myPointOut;
70 int SUPERVGUI_CanvasNodePrs::rtti() const
72 return SUPERVGUI_Canvas::Rtti_Node;
75 int SUPERVGUI_CanvasNodePrs::width() const
80 int SUPERVGUI_CanvasNodePrs::height() const
82 return getTitleHeight() + getLabelHeight() + getStatusHeight() +
83 getBodyHeight() + getGateHeight();
86 int SUPERVGUI_CanvasNodePrs::getTitleHeight() const
91 int SUPERVGUI_CanvasNodePrs::getLabelHeight() const
98 int SUPERVGUI_CanvasNodePrs::getStatusHeight() const
100 return myStatusHeight;
103 int SUPERVGUI_CanvasNodePrs::getBodyHeight() const
106 return myPortHeight + myStreamHeight;
110 int SUPERVGUI_CanvasNodePrs::getPortHeight() const
117 int SUPERVGUI_CanvasNodePrs::getStreamHeight() const
120 return myStreamHeight;
124 int SUPERVGUI_CanvasNodePrs::getGateHeight() const
131 QPointArray SUPERVGUI_CanvasNodePrs::areaPoints() const
136 QPointArray aPnts(4);
137 aPnts[0] = QPoint((int)x(), (int)y());
138 aPnts[1] = aPnts[0] + QPoint(w, 0);
139 aPnts[2] = aPnts[1] + QPoint(0, h);
140 aPnts[3] = aPnts[0] + QPoint(0, h);
144 QObject* SUPERVGUI_CanvasNodePrs::getObject(const QPoint& thePos) const
146 QObject* anObj = myNode;
148 // check if it's a port
149 const QObjectList* list = myNode->children();
151 QObjectListIt it(*list);
152 SUPERVGUI_CanvasPort* aPort;
153 while (QObject* obj = it.current()) {
155 if (obj->inherits("SUPERVGUI_CanvasPort")) {
156 aPort = (SUPERVGUI_CanvasPort*) obj;
157 if (aPort->getPrs()->getPortRect().contains(thePos, true)) {
167 void SUPERVGUI_CanvasNodePrs::moveBy(double dx, double dy)
169 int aX = (int) (x()+dx);
170 int aY = (int) (y()+dy);
171 int xx = aX - (int)x();
172 int yy = aY - (int)y();
174 int w = aX + width() + GRAPH_MARGIN;
175 int h = aY + height() + GRAPH_MARGIN;
176 if (canvas()->width() > w) w = canvas()->width();
177 if (canvas()->height() > h) h = canvas()->height();
178 if (canvas()->width() < w || canvas()->height() < h)
179 canvas()->resize(w, h);
181 // save new coordinates only if node is really moving...
183 myNode->getEngine()->Coords(aX, aY);
186 QCanvasPolygonalItem::moveBy(dx, dy);
188 // update port's rectangle
189 const QObjectList* list = myNode->children();
191 QObjectListIt it(*list);
192 SUPERVGUI_CanvasPort* aPort;
193 while (QObject* obj = it.current()) {
195 if (obj->inherits("SUPERVGUI_CanvasPort")) {
196 aPort = (SUPERVGUI_CanvasPort*) obj;
197 aPort->moveBy(xx, yy);
202 myPointIn->moveBy(dx, dy);
203 myPointOut->moveBy(dx, dy);
206 void SUPERVGUI_CanvasNodePrs::setZ(double z)
208 QCanvasItem::setZ(z);
211 const QObjectList* list = myNode->children();
213 QObjectListIt it(*list);
214 SUPERVGUI_CanvasPort* aPort;
215 while (QObject* obj = it.current()) {
217 if (obj->inherits("SUPERVGUI_CanvasPort")) {
218 aPort = (SUPERVGUI_CanvasPort*) obj;
219 aPort->getPrs()->setZ(z);
225 void SUPERVGUI_CanvasNodePrs::hideAll()
227 bool aDisp = isVisible();
230 setLabelVisible(false);
231 setPortVisible(false);
235 // canvas()->update();
239 void SUPERVGUI_CanvasNodePrs::showAll()
241 bool aDisp = isVisible();
244 setLabelVisible(true);
245 setPortVisible(true);
249 // canvas()->update();
253 void SUPERVGUI_CanvasNodePrs::setLabelVisible(bool b)
255 bool aDisp = isVisible();
260 if (!isPortVisible()) updatePoints();
268 void SUPERVGUI_CanvasNodePrs::setPortVisible(bool b)
270 bool aDisp = isVisible();
287 const QObjectList* list = myNode->children();
289 QObjectListIt it(*list);
290 SUPERVGUI_CanvasPort* aPort;
291 while (QObject* obj = it.current()) {
293 if (obj->inherits("SUPERVGUI_CanvasPort")) {
294 aPort = (SUPERVGUI_CanvasPort*) obj;
295 aPort->getPrs()->setVisible(b);
306 void SUPERVGUI_CanvasNodePrs::setNodeColor(const QColor& theColor)
309 canvas()->setChanged(getRect());
313 void SUPERVGUI_CanvasNodePrs::updateInfo()
315 canvas()->setChanged(getTitleRect());
316 canvas()->setChanged(getLabelRect()); //node's comment is saved in engine (we can see it only
317 //with help of ChangeInformation dialog),
318 //node's label isn't change
322 void SUPERVGUI_CanvasNodePrs::updatePoints()
324 QPoint in = getInConnectionPoint();
325 myPointIn->setCoords(in.x(), in.y());
327 QPoint out = getOutConnectionPoint();
328 myPointOut->setCoords(out.x(), out.y());
331 void SUPERVGUI_CanvasNodePrs::updatePorts()
333 bool aDisp = isVisible();
336 QRect r = getBodyRect();
337 int w = (int)(r.width()/2) - PORT_MARGIN;
338 if (w < PORT_WIDTH) w = PORT_WIDTH;
340 int ix = r.x() + PORT_MARGIN;
341 int ih = r.y() + PORT_MARGIN;
343 int oh = r.y() + PORT_MARGIN;
345 const QObjectList* list = myNode->children();
347 QObjectListIt it(*list);
348 SUPERVGUI_CanvasPort* aPort;
349 while (QObject* obj = it.current()) {
351 if (obj->inherits("SUPERVGUI_CanvasPort")) {
352 aPort = (SUPERVGUI_CanvasPort*) obj;
353 if (!aPort->getEngine()->IsGate() && !aPort->isStream()) {
354 if (aPort->getEngine()->IsInput()) {
355 aPort->getPrs()->setPortRect(QRect(ix, ih, w, PORT_HEIGHT));
359 aPort->getPrs()->setPortRect(QRect(ox, oh, w, PORT_HEIGHT));
367 myPortHeight = (ih>oh?ih:oh) - r.y() + PORT_MARGIN;
369 // update stream ports
370 int sy = r.y() + myPortHeight;
371 ih = sy + PORT_MARGIN;
372 oh = sy + PORT_MARGIN;
375 QObjectListIt it(*list);
376 SUPERVGUI_CanvasPort* aPort;
377 while (QObject* obj = it.current()) {
379 if (obj->inherits("SUPERVGUI_CanvasPort")) {
380 aPort = (SUPERVGUI_CanvasPort*) obj;
381 if (!aPort->getEngine()->IsGate() && aPort->isStream()) {
382 if (aPort->getEngine()->IsInput()) {
383 aPort->getPrs()->setPortRect(QRect(ix, ih, w, PORT_HEIGHT));
387 aPort->getPrs()->setPortRect(QRect(ox, oh, w, PORT_HEIGHT));
395 myStreamHeight = (ih>oh?ih:oh) - sy + PORT_MARGIN;
396 if (myStreamHeight == 2*PORT_MARGIN) myStreamHeight = 0;
398 // can update gates only after body height will be defined
407 void SUPERVGUI_CanvasNodePrs::updateGates()
409 bool aDisp = isVisible();
412 QRect r = getGateRect();
413 int w = (int)(r.width()/2) - PORT_MARGIN;
414 if (w < PORT_WIDTH) w = PORT_WIDTH;
416 int ix = r.x() + PORT_MARGIN;
417 int ih = r.y() + PORT_MARGIN;
419 int oh = r.y() + PORT_MARGIN;
421 const QObjectList* list = myNode->children();
423 QObjectListIt it(*list);
424 SUPERVGUI_CanvasPort* aPort;
425 while (QObject* obj = it.current()) {
427 if (obj->inherits("SUPERVGUI_CanvasPort")) {
428 aPort = (SUPERVGUI_CanvasPort*) obj;
429 if (aPort->getEngine()->IsGate()) {
430 if (aPort->getEngine()->IsInput()) {
431 aPort->getPrs()->setPortRect(QRect(ix, ih, w, PORT_HEIGHT));
435 aPort->getPrs()->setPortRect(QRect(ox, oh, w, PORT_HEIGHT));
443 myGateHeight = (ih>oh?ih:oh) - r.y() + PORT_MARGIN;
448 QRect SUPERVGUI_CanvasNodePrs::getRect() const
450 return QRect((int)x(), (int)y(), width(), height());
453 QRect SUPERVGUI_CanvasNodePrs::getTitleRect() const
455 return QRect((int)x(), (int)y(), width(), getTitleHeight());
458 QRect SUPERVGUI_CanvasNodePrs::getLabelRect() const
460 return QRect((int)x(), ((int)y())+getTitleHeight(), width(), getLabelHeight());
463 QRect SUPERVGUI_CanvasNodePrs::getStatusRect() const
465 return QRect((int)x(), ((int)y())+getTitleHeight()+getLabelHeight(),
466 width(), getStatusHeight());
469 QRect SUPERVGUI_CanvasNodePrs::getBodyRect() const
471 return QRect((int)x(), ((int)y())+getTitleHeight()+getLabelHeight()+getStatusHeight(),
472 width(), getBodyHeight());
475 QRect SUPERVGUI_CanvasNodePrs::getGateRect() const
477 return QRect((int)x(), ((int)y())+getTitleHeight()+getLabelHeight()+
478 getStatusHeight()+getBodyHeight(),
479 width(), getGateHeight());
482 QPoint SUPERVGUI_CanvasNodePrs::getInConnectionPoint() const
484 QRect r = getGateRect();
486 if (isPortVisible()) {
487 h = (int)((r.top()+r.bottom())/2);
490 h = (int)(y()+height()/2);
492 return QPoint(r.left()-POINT_SIZE, h);
495 QPoint SUPERVGUI_CanvasNodePrs::getOutConnectionPoint() const
497 QRect r = getGateRect();
499 if (isPortVisible()) {
500 h = (int)((r.top()+r.bottom())/2);
503 h = (int)y() + (int)(height()/2);
505 return QPoint(r.right()+POINT_SIZE, h);
508 void drawText(QPainter& thePainter, const QString& theText,
509 const QRect& theRect, int theHAlign = Qt::AlignAuto)
511 int flags = theHAlign | Qt::AlignVCenter;
512 QRect r(theRect.x() + TEXT_MARGIN, theRect.y(),
513 theRect.width() - 2*TEXT_MARGIN, theRect.height());
515 QWMatrix aMat = thePainter.worldMatrix();
516 if (aMat.m11() != 1.0) {
517 // for scaled picture only
518 QRect r1 = aMat.mapRect(r);
519 QFont saved = thePainter.font();
521 if (f.pointSize() == -1) {
522 f.setPixelSize(f.pixelSize()*aMat.m11());
525 f.setPointSize(f.pointSize()*aMat.m11());
529 thePainter.setWorldMatrix(m);
530 thePainter.setFont(f);
531 thePainter.drawText(r1, flags, theText);
532 thePainter.setFont(saved);
533 thePainter.restore();
536 thePainter.drawText(r, flags, theText);
540 void SUPERVGUI_CanvasNodePrs::draw(QPainter& thePainter)
542 thePainter.setPen(pen());
543 thePainter.setBrush(nodeColor());
544 drawShape(thePainter);
547 void SUPERVGUI_CanvasNodePrs::drawShape(QPainter& thePainter)
549 drawTitle(thePainter);
550 if (isLabelVisible()) {
551 drawLabel(thePainter);
553 if (isPortVisible()) {
554 drawPort(thePainter);
555 drawGate(thePainter);
557 drawStatus(thePainter);
558 drawFrame(thePainter);
561 void SUPERVGUI_CanvasNodePrs::drawFrame(QPainter& thePainter)
563 /* it was a good idea, but...
564 drawed polyline is out of item boundaries :-(
565 QPointArray pnts = areaPoints();
569 thePainter.drawPolyline(pnts);
572 QBrush saved = thePainter.brush();
573 thePainter.setBrush(NoBrush);
574 thePainter.drawRect(getRect());
575 thePainter.setBrush(saved);
578 void SUPERVGUI_CanvasNodePrs::drawTitle(QPainter& thePainter)
580 QBrush saved = thePainter.brush();
581 QBrush br(MAIN_TITLE);
582 thePainter.setBrush(br);
583 drawTitleShape(thePainter);
584 thePainter.setBrush(saved);
586 drawText(thePainter, myNode->getEngine()->Name(), getTitleRect(), Qt::AlignHCenter);
589 void SUPERVGUI_CanvasNodePrs::drawTitleShape(QPainter& thePainter)
591 thePainter.drawRect(getTitleRect());
594 void SUPERVGUI_CanvasNodePrs::drawLabel(QPainter& thePainter)
596 QRect r = getLabelRect();
598 QPen saved = thePainter.pen();
599 thePainter.setPen(NoPen);
600 thePainter.drawRect(r);
601 thePainter.setPen(saved);
603 // drawText(thePainter, myNode->getEngine()->Comment(), r);
604 drawText(thePainter, myNode->getLabelText(), r);
607 void SUPERVGUI_CanvasNodePrs::drawStatus(QPainter& thePainter)
609 QRect r = getStatusRect();
611 r.setHeight(r.height()+1);
613 QBrush savedB = thePainter.brush();
614 thePainter.setBrush(myStatusColor);
615 drawStatusShape(thePainter);
616 thePainter.setBrush(savedB);
618 QRect r1(r.x(), r.y(), (int)r.width()/2, r.height());
619 drawText(thePainter, myStatus, r1, Qt::AlignHCenter);
621 QRect r2(r.x()+r.width()-r1.width(), r.y(), r1.width(), r.height());
622 drawText(thePainter, myTime, r2, Qt::AlignHCenter);
625 void SUPERVGUI_CanvasNodePrs::drawStatusShape(QPainter& thePainter)
627 QRect r = getStatusRect();
629 r.setHeight(r.height()+1);
630 thePainter.drawRect(r);
633 void SUPERVGUI_CanvasNodePrs::drawPort(QPainter& thePainter)
635 QRect r = getBodyRect();
636 r.setHeight(r.height()+1);
638 thePainter.drawRect(r);
639 int x0 = (r.left() + r.right())/2;
640 thePainter.drawLine(x0, r.top(), x0, r.bottom());
641 if (getStreamHeight() > 0) {
642 int y0 = r.top() + getPortHeight();
643 thePainter.drawLine(r.left(), y0, r.right(), y0);
646 const QObjectList* list = myNode->children();
648 QObjectListIt it(*list);
649 SUPERVGUI_CanvasPort* aPort;
650 while (QObject* obj = it.current()) {
652 if (obj->inherits("SUPERVGUI_CanvasPort")) {
653 aPort = (SUPERVGUI_CanvasPort*) obj;
654 if (!aPort->getEngine()->IsGate()) {
655 aPort->getPrs()->draw(thePainter);
662 void SUPERVGUI_CanvasNodePrs::drawGate(QPainter& thePainter)
664 QBrush saved = thePainter.brush();
665 thePainter.setBrush(green.light(170));
667 QRect r = getGateRect();
668 // r.setHeight(r.height()+1);
669 thePainter.drawRect(r);
670 int x0 = (r.left() + r.right())/2;
671 // thePainter.drawLine(x0, r.top(), x0, r.bottom());
673 const QObjectList* list = myNode->children();
675 QObjectListIt it(*list);
676 SUPERVGUI_CanvasPort* aPort;
677 while (QObject* obj = it.current()) {
679 if (obj->inherits("SUPERVGUI_CanvasPort")) {
680 aPort = (SUPERVGUI_CanvasPort*) obj;
681 if (aPort->getEngine()->IsGate()) {
682 aPort->getPrs()->draw(thePainter);
688 thePainter.setBrush(saved);
691 void SUPERVGUI_CanvasNodePrs::setState(SUPERV::GraphState theState)
695 myStatus = "Waiting";
696 myStatusColor = QColor(35, 192, 255);
700 case SUPERV::ReadyState:
701 myStatus = "Running";
702 myStatusColor = QColor(32,210,32);
706 case SUPERV::SuspendReadyState:
707 myStatus = "Suspended";
708 myStatusColor = QColor(255,180, 0);
712 myStatus = "Finished";
713 myStatusColor = QColor(255, 158, 255);
717 myStatus = "Aborted";
727 myStatus = "No Status";
728 myStatusColor = MAIN_BACK;
732 long sec = myNode->getEngine()->CpuUsed();
735 hms[0]=(char)(((s/10)%10)+48);
736 hms[1]=(char)((s%10)+48);
740 hms[3]=(char)((s/10)+48);
741 hms[4]=(char)((s%10)+48);
744 hms[6]=(char)((sec/10)+48);
745 hms[7]=(char)((sec%10)+48);
747 myTime = QString(hms);
749 canvas()->setChanged(getStatusRect());
754 //=====================================================================
756 //=====================================================================
757 SUPERVGUI_CanvasPortPrs::SUPERVGUI_CanvasPortPrs(QCanvas* theCanvas,
758 SUPERVGUI_CanvasPort* thePort):
759 myCanvas(theCanvas), myPort(thePort)
763 myPoint = new SUPERVGUI_CanvasHookPrs(theCanvas, this, myPort->getEngine()->IsInput());
766 SUPERVGUI_CanvasPortPrs::~SUPERVGUI_CanvasPortPrs()
768 if (myPoint) delete myPoint;
771 void SUPERVGUI_CanvasPortPrs::setVisible(bool b)
773 if (myPoint) myPoint->setVisible(b);
775 myPort->updateLinks();
778 void SUPERVGUI_CanvasPortPrs::setPortRect(const QRect& theRect)
781 QPoint aPnt = getConnectionPoint();
783 // if (myPort->getEngine()->IsInput())
786 // dx = - POINT_SIZE;
787 // QPoint aPnt2(aPnt.x()+dx, aPnt.y());
790 // myLine->move(0, 0);
791 // myLine->setPoints(aPnt2.x(), aPnt2.y(), aPnt.x(), aPnt.y());
792 // if (myVisible) myLine->show();
795 myPoint->setCoords(aPnt.x(), aPnt.y());
796 // myPoint->move(aPnt.x(), aPnt.y());
797 if (myVisible) myPoint->show();
799 myPort->updateLinks();
802 void SUPERVGUI_CanvasPortPrs::moveBy(int dx, int dy)
804 myRect.moveBy(dx, dy);
805 if (myPoint) myPoint->moveBy(dx, dy);
806 // if (myLine) myLine->moveBy(dx, dy);
809 void SUPERVGUI_CanvasPortPrs::setZ(double z)
811 if (myPoint) myPoint->setZ(z);
812 // if (myLine) myLine->setZ(z);
815 void SUPERVGUI_CanvasPortPrs::update(bool theForce)
817 QString aNewText = getText();
818 if (theForce || myText.compare(aNewText) != 0) {
820 myCanvas->setChanged(myRect);
824 bool SUPERVGUI_CanvasPortPrs::isHilight() const
826 SUPERV_Port aPort = myPort->getEngine();
828 if (!aPort->IsGate()) {
829 if (aPort->IsInput()) {
830 if (aPort->HasInput() && !aPort->IsLinked())
833 else if (myPort->inherits("SUPERVGUI_CanvasPortOut")) {
834 SUPERVGUI_CanvasPortOut* aPortOut = (SUPERVGUI_CanvasPortOut*) myPort;
835 if (aPortOut->isInStudy())
842 bool SUPERVGUI_CanvasPortPrs::isAlert() const
845 SUPERV_Port aPort = myPort->getEngine();
846 if (!aPort->IsGate()) {
847 if (aPort->IsInput() && !aPort->HasInput() && !aPort->IsLinked())
853 QString SUPERVGUI_CanvasPortPrs::getText() const
855 SUPERV_Port aPort = myPort->getEngine();
856 QString aText = aPort->Name();
857 if (aPort->IsParam() || aPort->IsInLine() || myPort->isStream())
858 aText = aText + "=" + aPort->ToString();
862 int SUPERVGUI_CanvasPortPrs::getAlignment() const
864 int a = Qt::AlignAuto;
865 SUPERV_Port aPort = myPort->getEngine();
866 /* Merge to Ecole_Ete
867 if (QString(aPort->Name()).compare(OUTVOID) == 0)
870 if (aPort->IsGate()) {
871 if (aPort->IsInput())
879 QPoint SUPERVGUI_CanvasPortPrs::getConnectionPoint() const
882 if (myPort->getEngine()->IsInput())
883 x = myRect.left() - PORT_MARGIN - POINT_SIZE;
885 x = myRect.right() + PORT_MARGIN + POINT_SIZE;
886 y = (int)(myRect.top() + myRect.bottom())/2;
890 void SUPERVGUI_CanvasPortPrs::draw(QPainter& thePainter)
893 QPen savedP = thePainter.pen();
894 QBrush savedB = thePainter.brush();
896 QPen aPen(savedP.color(), getLineWidth());
897 thePainter.setPen(aPen);
898 thePainter.setBrush(Qt::NoBrush);
899 thePainter.drawRect(myRect);
900 thePainter.setPen(savedP);
901 thePainter.setBrush(savedB);
903 QFont saved = thePainter.font();
905 f.setBold(isHilight());
906 thePainter.setFont(f);
908 QPen savedP = thePainter.pen();
909 if (myPort->isStream())
910 thePainter.setPen(QColor(128, 64, 0));// Qt::darkCyan);
911 else if (isHilight())
912 thePainter.setPen(Qt::blue);
914 thePainter.setPen(Qt::red.dark(120));
916 drawText(thePainter, myText, myRect, getAlignment());
918 thePainter.setPen(savedP);
919 thePainter.setFont(saved);
923 //=====================================================================
925 //=====================================================================
926 SUPERVGUI_CanvasHookPrs::SUPERVGUI_CanvasHookPrs(QCanvas* theCanvas,
927 SUPERVGUI_CanvasNodePrs* theNode,
929 QCanvasEllipse(POINT_SIZE, POINT_SIZE, theCanvas),
930 myNodePrs(theNode), myPortPrs(0), myIn(theIn), myLine(0)
935 SUPERVGUI_CanvasHookPrs::SUPERVGUI_CanvasHookPrs(QCanvas* theCanvas,
936 SUPERVGUI_CanvasPortPrs* thePort,
938 QCanvasEllipse(POINT_SIZE, POINT_SIZE, theCanvas),
939 myNodePrs(0), myPortPrs(thePort), myIn(theIn), myLine(0)
944 void SUPERVGUI_CanvasHookPrs::init(QCanvas* theCanvas)
946 myLine = new QCanvasLine(theCanvas);
949 myLine->setPen(QPen(Qt::black, 1));
954 SUPERVGUI_CanvasHookPrs::~SUPERVGUI_CanvasHookPrs()
963 QObject* SUPERVGUI_CanvasHookPrs::getObject() const
967 anObj = myNodePrs->getNode();
969 anObj = myPortPrs->getPort();
973 void SUPERVGUI_CanvasHookPrs::setCoords(int x, int y)
978 myLine->setPoints(x+(myIn?POINT_SIZE:-POINT_SIZE), y, x, y);
982 void SUPERVGUI_CanvasHookPrs::setVisible(bool b)
984 QCanvasEllipse::setVisible(b);
985 if (myLine) myLine->setVisible(b);
988 void SUPERVGUI_CanvasHookPrs::moveBy(double dx, double dy)
990 QCanvasEllipse::moveBy(dx, dy);
991 if (myLine) myLine->moveBy(dx, dy);
994 void SUPERVGUI_CanvasHookPrs::setZ(double z)
996 QCanvasEllipse::setZ(z);
997 if (myLine) myLine->setZ(z);
1000 int SUPERVGUI_CanvasHookPrs::rtti() const
1002 return SUPERVGUI_Canvas::Rtti_Hook;