-// SUPERV SUPERVGUI : GUI for Supervisor component
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-// Copyright (C) 2003 OPEN CASCADE
+// SUPERV SUPERVGUI : GUI for Supervisor component
//
// File : SUPERVGUI_Ganvas.cxx
// Author : Natalia KOPNOVA
// Module : SUPERV
-using namespace std;
+#include "SUPERVGUI.h"
#include "SUPERVGUI_Def.h"
#include "SUPERVGUI_Main.h"
#include "SUPERVGUI_CanvasNode.h"
#include "SUPERVGUI_CanvasPort.h"
#include "SUPERVGUI_CanvasLink.h"
-#include "QAD_Config.h"
+
+#include "SUIT_ResourceMgr.h"
+#include "SUIT_Session.h"
//#define CHECKTIME
ihmList->removeRef(ihmNode); \
ihmNode->merge(); \
ihmNode = getNode(aCNodeEnd); \
- ihmList->removeRef(ihmNode); \
- ihmNode->merge(); \
+ if (ihmNode) { \
+ ihmList->removeRef(ihmNode); \
+ ihmNode->merge(); \
+ } \
} \
}
*/
-SUPERVGUI_Canvas::SUPERVGUI_Canvas(SUPERVGUI_Main* m):
+SUPERVGUI_Canvas::SUPERVGUI_Canvas( SUPERVGUI_Main* m, SUIT_ResourceMgr* mgr ):
QCanvas(),
myMain(m)
{
Trace("SUPERVGUI_Canvas::SUPERVGUI_Canvas");
myIsControlView = false;
// resize(GRAPH_WIDTH, GRAPH_HEIGHT);
- resize(800, 600);
+ resize(1050, 750);
setDoubleBuffering(true);
- QColor aColor(MAIN_COLOR);
- QString aRed = QAD_CONFIG->getSetting("SUPERVGraph:BackgroundColorRed");
- QString aGreen = QAD_CONFIG->getSetting("SUPERVGraph:BackgroundColorGreen");
- QString aBlue = QAD_CONFIG->getSetting("SUPERVGraph:BackgroundColorBlue");
- if( (!aRed.isEmpty()) && (!aGreen.isEmpty()) && (!aBlue.isEmpty()) )
- aColor = QColor(aRed.toInt(), aGreen.toInt(), aBlue.toInt());
+ // mkr : IPAL10825 -->
+ SUPERVGUI* aSupMod = SUPERVGUI::Supervision();
+ if ( !aSupMod ) {
+ MESSAGE("NULL Supervision module!");
+ return;
+ }
+ QColor aColor = aSupMod->getIVFBackgroundColor();
+ if ( !aColor.isValid() )
+ aColor = mgr->colorValue( "SUPERVGraph", "Background", DEF_MAIN_COLOR );
+ // <--
+
+ //aColor = QColor(SUIT_Session::session()->resourceMgr()->integerValue( "SUPERVGraph", "BackgroundColorRed" ),
+ // SUIT_Session::session()->resourceMgr()->integerValue( "SUPERVGraph", "BackgroundColorGreen" ),
+ // SUIT_Session::session()->resourceMgr()->integerValue( "SUPERVGraph", "BackgroundColorBlue" ) );
setBackgroundColor(aColor);
}
*/
void SUPERVGUI_Canvas::merge() {
if (SUPERV_isNull(myMain->getDataflow())) return;
-
+
SUPERVGUI_CanvasNode* ihmNode;
QObjectList* ihmList = queryList("SUPERVGUI_CanvasNode");
SUPERV_Nodes nodes = myMain->getDataflow()->Nodes();
UPDATECONTROLNODES(LNodes);
UPDATECONTROLNODES(SNodes);
+ /*
+ n = nodes->LNodes.length();
+ for (int i=0; i<n; i++) {
+ SUPERV_CNode aCNode = SUPERV::CNode::_narrow(nodes->LNodes[i]);
+ SUPERV_CNode aCNodeEnd = SUPERV::CNode::_narrow(nodes->LNodes[i]->Coupled());
+ ihmNode = getNode(aCNode);
+ SUPERVGUI_CanvasNode* ihmNodeEnd = getNode(aCNodeEnd);
+ if (ihmNode == NULL) {
+ myMain->addControlNode(aCNode, aCNodeEnd, false);
+ } else {
+ if (ihmNodeEnd) {
+ ihmNode->move(aCNode->X(), aCNode->Y());
+ ihmList->removeRef(ihmNode);
+ ihmNode->merge();
+ ihmNode = getNode(aCNodeEnd);
+ ihmList->removeRef(ihmNode);
+ ihmNode->merge();
+ }
+ }
+ }
+ n = nodes->SNodes.length();
+ for (int i=0; i<n; i++) {
+ SUPERV_CNode aCNode = SUPERV::CNode::_narrow(nodes->SNodes[i]);
+ SUPERV_CNode aCNodeEnd = SUPERV::CNode::_narrow(nodes->SNodes[i]->Coupled());
+ ihmNode = getNode(aCNode);
+ if (ihmNode == NULL) {
+ myMain->addControlNode(aCNode, aCNodeEnd, false);
+ } else {
+ ihmNode->move(aCNode->X(), aCNode->Y());
+ ihmList->removeRef(ihmNode);
+ ihmNode->merge();
+ ihmNode = getNode(aCNodeEnd);
+ ihmList->removeRef(ihmNode);
+ ihmNode->merge();
+ }
+ }
+ //*/
QObjectListIt it(*ihmList);
while ((ihmNode=(SUPERVGUI_CanvasNode*)it.current()) != 0) {
delete ihmList;
}
-void SUPERVGUI_Canvas::setAsFromStudy(bool theToStudy)
-{
- if (theToStudy) return;
-
- SUPERVGUI_CanvasPortOut* aPortOut;
- QObjectList* aPortList = queryList("SUPERVGUI_CanvasPortOut");
- QObjectListIt aPortIt(*aPortList);
- while ((aPortOut=(SUPERVGUI_CanvasPortOut*)aPortIt.current()) != 0) {
- ++aPortIt;
- if (aPortOut->isInStudy()) {
- aPortOut->setStudyState(theToStudy);
- aPortOut->sync();
- }
- }
- delete aPortList;
-}
-
SUPERVGUI_CanvasNode* SUPERVGUI_Canvas::getNode(SUPERV::CNode_ptr theNode) const
{
return (SUPERVGUI_CanvasNode*)