SUPERVGUI_Port.cxx \
SUPERVGUI_BrowseNodeDlg.cxx \
SUPERVGUI_Link.cxx \
- SUPERVGUI_CtrlLink.cxx \
SUPERVGUI_Label.cxx
LIB_MOC = SUPERVGUI.h \
}
extern "C" void activeStudyChanged(QAD_Desktop* parent) {
- // Supervision.activeStudyChanged();
+ Supervision.activeStudyChanged();
}
extern "C" int supportedViewType()
}
-QPoint SUPERVGUI_StartControlNode::getOutConnectPnt() {
- return QPoint(pos().x() + width() - LABEL_HEIGHT/2,
- pos().y() + (height()/2));
-}
-
-
//-----------------------------------------------------------
//******************* End Node ******************************
//-----------------------------------------------------------
}
-QPoint SUPERVGUI_EndControlNode::getInConnectPnt() {
- return QPoint(pos().x() + LABEL_HEIGHT/2,
- pos().y() + (height()/2));
-}
-
-
//-----------------------------------------------------------
//******************* GoTo Node *****************************
//-----------------------------------------------------------
void setEndNode(SUPERVGUI_EndControlNode* theEndNode);
- virtual QPoint getOutConnectPnt();
-
public slots:
void switchPorts();
virtual void rename();
virtual void showAll();
virtual void updateShape();
- virtual QPoint getInConnectPnt();
-
public slots:
void switchPorts();
SUPERV_CNode aCNodeEnd = SUPERV::CNode::_narrow(nodes->NodesName[i]->Coupled()); \
ihmNode = (SUPERVGUI_Node *)child(aCNode->Name(), "SUPERVGUI_Node"); \
if (ihmNode == NULL) { \
- main->addControlNode(aCNode, aCNodeEnd, false); \
+ main->addControlNode(aCNode, aCNodeEnd); \
} else { \
ResizeGraph(ihmNode, aCNode->X(), aCNode->Y()); \
moveChild(ihmNode, aCNode->X(), aCNode->Y()); \
myNewLink(0)
{
Trace("SUPERVGUI_Graph::SUPERVGUI_Graph");
- myIsControlView = false;
myLinksList.setAutoDelete(true);
viewport()->setMouseTracking(true);
aPixmap.fill(viewport()->paletteBackgroundColor());
QPainter aPainter(&aPixmap);
+ SUPERVGUI_Link* aLink;
QPoint aPos = viewportToContents(viewport()->pos());
-
- if (myIsControlView) {
- SUPERVGUI_CtrlLink* aLink;
- QMap<QString, SUPERVGUI_CtrlLink>::Iterator it;
- for ( it = myCtrlLinks.begin(); it != myCtrlLinks.end(); ++it ) {
- it.data().paint(&aPainter, false);
+ for (aLink = myLinksList.first(); aLink; aLink = myLinksList.next()) {
+ aLink->isInRect(aPos.x(), aPos.y(), aWidth, aHeight);
+ if (aLink->isInRect(aPos.x(), aPos.y(), aWidth, aHeight)) {
+ aLink->paint(&aPainter, false);
}
- } else {
- SUPERVGUI_Link* aLink;
- for (aLink = myLinksList.first(); aLink; aLink = myLinksList.next()) {
- aLink->isInRect(aPos.x(), aPos.y(), aWidth, aHeight);
- if (aLink->isInRect(aPos.x(), aPos.y(), aWidth, aHeight)) {
- aLink->paint(&aPainter, false);
- }
- }
- }
+ }
bitBlt(viewport(), 0, 0,
&aPixmap, 0, 0, aWidth, aHeight,
Qt::CopyROP, true);
void SUPERVGUI_Graph::deleteLink() {
- QString aName;
- if (mySelectedLink->isESInputPort())
- aName = mySelectedLink->getInputPortES()->getPort()->Name();
- else
- aName = mySelectedLink->getInputPort()->getPort()->Name();
-
- if (aName != "Default") {
- deleteLink(mySelectedLink);
- mySelectedLink = 0;
- repaintContents();
- }
+ deleteLink(mySelectedLink);
+ mySelectedLink = 0;
+ repaintContents();
}
&&
(aKind == SUPERV::InLineParameter || aKind == SUPERV::ServiceParameter))
{
- QString aName(aPort->Name());
- if (aName != "Default")
- myNewLink->setInputPortES(dynamic_cast<SUPERVGUI_PortInESNode*>(thePort));
+ myNewLink->setInputPortES(dynamic_cast<SUPERVGUI_PortInESNode*>(thePort));
}
else{
if (aPort->IsLinked()) return;
&& aPort->Kind() != SUPERV::InLineParameter) {
return;
}
- else { //connection like Gate <--> Gate
+ else //connection like Gate <--> Gate
myNewLink->setInputPort(dynamic_cast<SUPERVGUI_PortIn*>(thePort));
- }
- } else {
+ } else
myNewLink->setInputPort(dynamic_cast<SUPERVGUI_PortIn*>(thePort));
- }
}
} else {
if (aInNode) {
QString aName(theLink->InPort()->Name());
aName += "Input";
- if (theLink->InPort()->Kind() == SUPERV::EndSwitchParameter) {
- //If input port is EndSwitchParameter
- SUPERVGUI_PortInESNode* aInPortES =(SUPERVGUI_PortInESNode*)
- aInNode->child(aName, "SUPERVGUI_PortInESNode"); //returns null
- if (aInPortES)
- aNewLink->setInputPortES(aInPortES);
- else {
- delete aNewLink;
- return false;
- }
- } else {
- SUPERVGUI_PortIn* aInPort =(SUPERVGUI_PortIn*)
- aInNode->child(aName, "SUPERVGUI_PortIn");
- if (aInPort)
- aNewLink->setInputPort(aInPort);
- else {
- delete aNewLink;
- return false;
- }
+ SUPERVGUI_PortIn* aInPort =(SUPERVGUI_PortIn*)
+ aInNode->child(aName, "SUPERVGUI_PortIn");
+ if (aInPort)
+ aNewLink->setInputPort(aInPort);
+ else {
+ delete aNewLink;
+ return false;
}
} else {
delete aNewLink;
return false;
}
- aNewLink->setVisible(!myIsControlView);
myLinksList.append(aNewLink);
return true;
}
aNode->showAll();
}
delete aNodeList;
-
- myCtrlLinks.clear();
- SUPERVGUI_Link* aLink;
- for (aLink = myLinksList.first(); aLink; aLink = myLinksList.next()) {
- aLink->setVisible(true);
- }
draw();
- myIsControlView = false;
}
aNode->hideAll();
}
delete aNodeList;
- myCtrlLinks.clear();
- SUPERVGUI_Link* aLink;
- for (aLink = myLinksList.first(); aLink; aLink = myLinksList.next()) {
- aLink->setVisible(false);
-
- QString aOutName(aLink->getEngineLink()->OutPort()->Node()->Name());
- QString aInName(aLink->getEngineLink()->InPort()->Node()->Name());
- QString aKey = aOutName + aInName;
-
- if (!myCtrlLinks.contains(aKey)) {
- SUPERVGUI_GraphNode* aOutNode = (SUPERVGUI_GraphNode*)
- child(aOutName, "SUPERVGUI_GraphNode");
- if (!aOutNode) continue;
- SUPERVGUI_GraphNode* aInNode = (SUPERVGUI_GraphNode*)
- child(aInName, "SUPERVGUI_GraphNode");
- if (!aInNode) continue;
-
- myCtrlLinks[aKey] = SUPERVGUI_CtrlLink(this, aOutNode, aInNode);
- }
- }
draw();
- myIsControlView = true;
}
#include "SUPERVGUI_View.h"
#include "SUPERVGUI_Node.h"
#include "SUPERVGUI_Link.h"
-#include "SUPERVGUI_CtrlLink.h"
-#include <qmap.h>
-
class SUPERVGUI_Main;
void setFullView();
void setControlView();
- bool isControlView() { return myIsControlView; }
-
void deleteLink(SUPERVGUI_Link* theLink);
void deleteNode(SUPERVGUI_Node* theNode);
int myAddLinkPntItem;
int myDelLinkItem;
- bool myIsControlView;
+
SUPERVGUI_Link* myNewLink;
QPtrList<SUPERVGUI_Link> myLinksList;
- QMap<QString, SUPERVGUI_CtrlLink> myCtrlLinks;
};
#endif
}
delete ihmList;
- //Find PortInESNode
- SUPERVGUI_PortInESNode* piES;
- QObjectList* ihmListES = queryList("SUPERVGUI_PortInESNode");
- QObjectListIt iES(*ihmListES);
- while ((piES=(SUPERVGUI_PortInESNode*)iES.current()) != 0) {
- ++iES;
- if (piES->getPort()->IsLinked()) {
- SUPERV_Links aLinks = piES->getPort()->Links();
- for (int j=0; j<aLinks->length(); j++) {
- if (toCheckExisting) {
- if (aGraph->isLinkPrsExists(aLinks[j]))
- continue;
- }
- aGraph->createLinkPrs(aLinks[j]);
- }
- }
- }
- delete ihmListES;
}
}
}
}
-
-
-/**
- * Returns coordinates of connection point in content coordinates
- */
-QPoint SUPERVGUI_GraphNode::getInConnectPnt() {
- return QPoint(pos().x(),
- pos().y() + (height()/2));
-}
-QPoint SUPERVGUI_GraphNode::getOutConnectPnt() {
- return QPoint(pos().x() + width(),
- pos().y() + (height()/2));
-}
#include "SUPERVGUI_Node.h"
#include <qlayout.h>
-
class SUPERVGUI_GraphNode: public SUPERVGUI_Node {
Q_OBJECT
virtual void deletePort(SUPERVGUI_Port* thePort);
- virtual QPoint getInConnectPnt();
- virtual QPoint getOutConnectPnt();
-
virtual void updateShape() {};
virtual void updatePorts();
myHltPnt = -1;
myPntMovingState = false;
myPainter = 0;
- myIsVisible = true;
myTmpPen.setColor(SKETCH_CLR);
myTmpPen.setWidth(LINE_WIDTH);
myIsSelected = false;
* if toErase = true then it draws link by background color
*/
void SUPERVGUI_Link::paint(bool toErase) {
- if ((!myGraph) || (!myIsVisible)) return;
+ if (!myGraph) return;
if (!myEngine && SUPERV_isNull(myEngine)) return;
// if (!isCreationComplete()) return;
* Defines a pen and draws link using given painter
*/
void SUPERVGUI_Link::paint(QPainter* thePainter, bool toErase) {
- if ((!myGraph) || (!myIsVisible)) return;
+ if (!myGraph) return;
if (!myEngine && SUPERV_isNull(myEngine)) return;
// if (!isCreationComplete()) return;
thePainter->save();
* Draws link using given painter
*/
void SUPERVGUI_Link::drawLink(QPainter* thePainter) {
- if (!myIsVisible) return;
if (!isESInputPort())
thePainter->moveTo(myPortIn->getConnectPnt());
else
}
-//**********************************************************************
-/**
- * Set link non visible
- */
-void SUPERVGUI_Link::setVisible(bool theVisible) {
- myIsVisible = theVisible;
- if (myIsVisible) {
- connectToEvents();
- } else {
- disconnect(myGraph, 0, this, 0);
- }
-}
-
-
//**********************************************************************
/**
* Checks full definition of the link
r = r * r;
s = py - ly;
s = s * s;
- a = (int) sqrt((float)(r + s));
+ a = (int) sqrt(r + s);
r = px - nx;
r = r * r;
s = py - ny;
s = s * s;
- b = (int) sqrt((float)(r + s));
+ b = (int) sqrt(r + s);
r = nx - lx;
r = r * r;
s = ny - ly;
s = s * s;
- c = (int) sqrt((float)(r + s));
+ c = (int) sqrt(r + s);
return (a+b-c);
}
#ifndef SUPERVGUI_Link_H
#define SUPERVGUI_Link_H
-using namespace std;
-
#include "SUPERVGUI_Def.h"
#include "SUPERVGUI_Port.h"
#include <qvaluevector.h>
void removePoint(int thePnt);
- void setVisible(bool theVisible);
-
static void setOrthoMode(bool theIsOrtho)
{ OrthoMode = theIsOrtho; };
// Selection of Link
bool myIsSelected;
-
- bool myIsVisible;
static bool OrthoMode;
static bool LinkIsMoving;
/**
* Add Control node
*/
-void SUPERVGUI_Main::addControlNode(SUPERV_CNode theStartNode, SUPERV_CNode theEndNode, bool Update) {
+void SUPERVGUI_Main::addControlNode(SUPERV_CNode theStartNode, SUPERV_CNode theEndNode) {
switch (myCurrentView) {
case GRAPH:
{
graph->addChild(aStartPrs, theStartNode->X(), theStartNode->Y());
graph->ResizeGraph(aEndPrs, theEndNode->X(), theEndNode->Y());
graph->addChild(aEndPrs, theEndNode->X(), theEndNode->Y());
- if (Update) {
- aStartPrs->updateLinksPrs();
- aEndPrs->updateLinksPrs();
- }
+ aStartPrs->updateLinksPrs();
+ aEndPrs->updateLinksPrs();
aStartPrs->sync();
aEndPrs->sync();
graph->repaintContents();
graph->addChild(aStartPrs, theStartNode->X(), theStartNode->Y());
graph->ResizeGraph(aEndPrs, theEndNode->X(), theEndNode->Y());
graph->addChild(aEndPrs, theEndNode->X(), theEndNode->Y());
- if (Update) {
- aStartPrs->updateLinksPrs();
- aEndPrs->updateLinksPrs();
- }
+ aStartPrs->updateLinksPrs();
+ aEndPrs->updateLinksPrs();
aStartPrs->sync();
aEndPrs->sync();
graph->repaintContents();
aComponent = aBuilder->NewComponent(STUDY_SUPERVISION);
anAttr = aBuilder->FindOrCreateAttribute(aComponent, "AttributeName");
aName = SALOMEDS::AttributeName::_narrow(anAttr);
- aName->SetValue(STUDY_SUPERVISION);
+ //aName->SetValue("Supervision");
+ aName->SetValue( QAD_Application::getDesktop()->getComponentUserName( "SUPERV" ) );
anAttr = aBuilder->FindOrCreateAttribute(aComponent, "AttributePixMap");
aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
void checkIsInStudy();
void addComputeNode(SUPERV_CNode theNode);
- void addControlNode(SUPERV_CNode theStartNode, SUPERV_CNode theEndNode, bool Update);
+ void addControlNode(SUPERV_CNode theStartNode, SUPERV_CNode theEndNode);
void addGOTONode(SUPERV_CNode theNode);
void setPaletteBackgroundColor(const QColor& color);
if (myMain->isEditable() && (getNodeType() != SUPERV::FactoryNode)
&& (getNodeType() != SUPERV::ComputingNode)) {
- if ((getNodeType() != SUPERV::EndLoopNode)) {
+ if ((getNodeType() != SUPERV::EndLoopNode) /*&& (getNodeType() != SUPERV::EndSwitchNode)*/) {
QPopupMenu* aAddPortMnu = new QPopupMenu(this);
aAddPortMnu->insertItem("Input", this, SLOT(addInputPort()));
if (getNodeType() != SUPERV::LoopNode)
aAddPortMnu->insertItem("Output", this, SLOT(addOutputPort()));
myPopup->insertSeparator();
- if ((getNodeType() != SUPERV::EndSwitchNode))
- myPopup->insertItem("Edit Function", this, SLOT(editFunction()));
+ myPopup->insertItem("Edit Function", this, SLOT(editFunction()));
myPopup->insertItem("Add Port", aAddPortMnu);
}
}
}
}
+void SUPERVGUI_PortIn::deletePort() {
+
+ SUPERVGUI_Port::deletePort();
+}
+
//***********************************************************
}
+void SUPERVGUI_PortOut::deletePort() {
+
+ SUPERVGUI_Port::deletePort();
+}
+
//***********************************************************
// Input Port of EndSwitch Node
}
}
+void SUPERVGUI_PortInESNode::deletePort() {
+
+ SUPERVGUI_Port::deletePort();
+}
void onDeleteLink(SUPERVGUI_Link*);
+ protected slots:
+ virtual void deletePort();
+
private:
int psd;
int psc;
void onDeleteLink(SUPERVGUI_Link*);
+ protected slots:
+ virtual void deletePort();
+
+
private:
int pls;
bool study;
void onDeleteLink(SUPERVGUI_Link*);
+ protected slots:
+ virtual void deletePort();
+
private:
// int psd;
int psc;
QPushButton* aComputeCBtn = new QPushButton(tr("TIT_ADDCNODE"), aCorbaPane); //!!
connect(aComputeCBtn, SIGNAL(clicked()), this, SLOT(addComputeNode())); //!!
- aComputeCBtn->setDefault(false);
QPushButton* aComputeBtn = new QPushButton(tr("TIT_ADDFNODE"), aCorbaPane);
connect(aComputeBtn, SIGNAL(clicked()), this, SLOT(addFactoryNode()));
- aComputeBtn->setDefault(true);
aBaseLayout->addWidget(aComputeBtn);
aBaseLayout->addWidget(aComputeCBtn); //!!
aEndNode->Coords(myX + LABEL_WIDTH*2, myY);
myX += NODE_DX;
myY += NODE_DY;
- aMain->addControlNode(SUPERV::CNode::_narrow(aStartNode), SUPERV::CNode::_narrow(aEndNode), true);
+ aMain->addControlNode(SUPERV::CNode::_narrow(aStartNode), SUPERV::CNode::_narrow(aEndNode));
}
break;
aEndNode->Coords(myX + LABEL_WIDTH*2, myY);
myX += NODE_DX;
myY += NODE_DY;
- aMain->addControlNode(SUPERV::CNode::_narrow(aStartNode), SUPERV::CNode::_narrow(aEndNode), true);
+ aMain->addControlNode(SUPERV::CNode::_narrow(aStartNode), SUPERV::CNode::_narrow(aEndNode));
}
break;