From: mkr Date: Wed, 14 Mar 2007 08:51:44 +0000 (+0000) Subject: Create QxGraph_Prs, QxGraph_ActiveItem. X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=9f2bea258ceadf62dce9b19aef890d7de2a0603f;p=modules%2Fgui.git Create QxGraph_Prs, QxGraph_ActiveItem. --- diff --git a/src/QxGraph/Makefile.in b/src/QxGraph/Makefile.in index e8aca9abc..3a2a4c635 100755 --- a/src/QxGraph/Makefile.in +++ b/src/QxGraph/Makefile.in @@ -25,7 +25,9 @@ VPATH=.:@srcdir@:@top_srcdir@/idl:@srcdir@/resources @COMMENCE@ -EXPORT_HEADERS = QxGraph_Canvas.h \ +EXPORT_HEADERS = QxGraph_ActiveItem.h \ + QxGraph_Prs.h \ + QxGraph_Canvas.h \ QxGraph_CanvasView.h \ QxGraph_ViewWindow.h \ QxGraph_ViewManager.h \ @@ -40,11 +42,12 @@ PO_FILES = QxGraph_images.po \ # Libraries targets LIB = libQxGraph.la -LIB_SRC = QxGraph_Canvas.cxx \ +LIB_SRC = QxGraph_Prs.cxx \ + QxGraph_Canvas.cxx \ QxGraph_CanvasView.cxx \ QxGraph_ViewWindow.cxx \ QxGraph_ViewManager.cxx \ - QxGraph_ViewModel.cxx + QxGraph_ViewModel.cxx LIB_MOC = QxGraph_Canvas_moc.cxx \ QxGraph_CanvasView_moc.cxx \ diff --git a/src/QxGraph/QxGraph_ActiveItem.h b/src/QxGraph/QxGraph_ActiveItem.h new file mode 100644 index 000000000..293dfb9dd --- /dev/null +++ b/src/QxGraph/QxGraph_ActiveItem.h @@ -0,0 +1,35 @@ +// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D +// +// 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 +// +#ifndef QXGRAPH_ACTIVEITEM_H +#define QXGRAPH_ACTIVEITEM_H + +#include "QxGraph.h" + +class QXGRAPH_EXPORT QxGraph_ActiveItem +{ + public: + QxGraph_ActiveItem() {} + ~QxGraph_ActiveItem() {} + + virtual void hilight() = 0; + virtual void select() = 0; + virtual void showPopup() = 0; +}; + +#endif diff --git a/src/QxGraph/QxGraph_Canvas.cxx b/src/QxGraph/QxGraph_Canvas.cxx index 76f7b4117..935d0506e 100644 --- a/src/QxGraph/QxGraph_Canvas.cxx +++ b/src/QxGraph/QxGraph_Canvas.cxx @@ -22,6 +22,7 @@ #include "QxGraph_Canvas.h" #include "QxGraph_Def.h" +#include "QxGraph_Prs.h" #include @@ -55,3 +56,14 @@ void QxGraph_Canvas::addView(QCanvasView* theView) QCanvas::addView(theView); theView->setPaletteBackgroundColor(backgroundColor().light(120)); } + +/*! + Get Prs object with index theIndex +*/ +QxGraph_Prs* QxGraph_Canvas::getPrs(int theIndex) +{ + QxGraph_Prs* aRetPrs = 0; + if ( theIndex >= 0 && theIndex < myPrsList.count() ) + aRetPrs = myPrsList.at(theIndex); + return aRetPrs; +} diff --git a/src/QxGraph/QxGraph_Canvas.h b/src/QxGraph/QxGraph_Canvas.h index 9bbf80ca0..a41ea829e 100644 --- a/src/QxGraph/QxGraph_Canvas.h +++ b/src/QxGraph/QxGraph_Canvas.h @@ -26,8 +26,10 @@ #include "QxGraph.h" #include +#include class SUIT_ResourceMgr; +class QxGraph_Prs; class QXGRAPH_EXPORT QxGraph_Canvas : public QCanvas { Q_OBJECT @@ -38,7 +40,12 @@ class QXGRAPH_EXPORT QxGraph_Canvas : public QCanvas { void addView(QCanvasView* theView); + QPtrList getPrsList() const { return myPrsList; } + QxGraph_Prs* getPrs(int theIndex = 0); + void addPrs(QxGraph_Prs* thePrs) { myPrsList.append(thePrs); } + private: + QPtrList myPrsList; }; diff --git a/src/QxGraph/QxGraph_Prs.cxx b/src/QxGraph/QxGraph_Prs.cxx new file mode 100644 index 000000000..81ff0ebb7 --- /dev/null +++ b/src/QxGraph/QxGraph_Prs.cxx @@ -0,0 +1,168 @@ +// SALOME QxGraph : build Supervisor viewer into desktop +// +// 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 +// + +#include "QxGraph_Prs.h" + +#include "QxGraph_Canvas.h" +#include "QxGraph_Def.h" // for debug only + +#include "SUIT_Session.h" // for debug only + +/*! + Constructor +*/ +QxGraph_Prs::QxGraph_Prs(QxGraph_Canvas* theCanvas): + myCanvas(theCanvas), + myDMode(0) +{ + myCanvas->addPrs(this); +} + +/*! + Destructor +*/ +QxGraph_Prs::~QxGraph_Prs() +{ + +} + +/*! + Add item to display in the view with index theDMode +*/ +void QxGraph_Prs::addItem(QCanvasItem* theItem, int theDMode) +{ + if ( theDMode == -1 ) // add item for the current display mode + myDisplayMap[myDMode].append(theItem); + else + myDisplayMap[theDMode].append(theItem); +} + +/*! + Add a QCanvasRectangle item for display mode DMode +*/ +QCanvasItem* QxGraph_Prs::addRectangleItem(QRect theRect, int theDMode) +{ + QCanvasRectangle* aRectItem; + if ( myCanvas ) + { + QCanvasRectangle* aRectItem = new QCanvasRectangle(theRect, myCanvas); + aRectItem->setZ(0); + aRectItem->show(); + myCanvas->update(); + + // test drawing features: brush, pen ... + QBrush aBr(SUIT_Session::session()->resourceMgr()->colorValue( "QxGraph", "NodeBody", RECTANGLE_BODY )); + aRectItem->setBrush(aBr); + } + addItem(aRectItem); + return aRectItem; +} + +/*! + Add a QCanvasPolygon item for display mode DMode +*/ +QCanvasItem* QxGraph_Prs::addPolygonItem(QPointArray thePA, int theDMode) +{ + QCanvasPolygon* aPolyItem; + if ( myCanvas ) + { + aPolyItem = new QCanvasPolygon(myCanvas); + aPolyItem->setZ(0); + aPolyItem->setPoints(thePA); + aPolyItem->show(); + myCanvas->update(); + + // test drawing features: brush, pen ... + QBrush aBr(SUIT_Session::session()->resourceMgr()->colorValue( "QxGraph", "NodeBody", RECTANGLE_BODY )); + aPolyItem->setBrush(aBr); + QPen aPen(Qt::black,2); + aPolyItem->setPen(aPen); + } + addItem(aPolyItem); + return aPolyItem; +} + +/*! + Add a QCanvasLine item for display mode DMode +*/ +QCanvasItem* QxGraph_Prs::addLineItem(QPoint theStart, QPoint theEnd, int theDMode) +{ + QCanvasLine* aLineItem; + if ( myCanvas ) + { + aLineItem = new QCanvasLine(myCanvas); + aLineItem->setZ(0); + aLineItem->setPoints(theStart.x(), theStart.y(), theEnd.x(), theEnd.y()); + aLineItem->show(); + myCanvas->update(); + + // test drawing features: brush, pen ... + QPen aPen(Qt::black,2); + aLineItem->setPen(aPen); + } + addItem(aLineItem); + return aLineItem; +} + +/*! + Add a QCanvasEllipse item for display mode DMode +*/ +QCanvasItem* QxGraph_Prs::addEllipseItem(int theW, int theH, int theStartAngle, int theAngle, int theDMode) +{ + QCanvasEllipse* aEllipseItem; + if ( myCanvas ) + { + aEllipseItem = new QCanvasEllipse(theW, theH, theStartAngle, theAngle, myCanvas); + aEllipseItem->setZ(0); + aEllipseItem->show(); + myCanvas->update(); + + // test drawing features: brush, pen ... + QBrush aBr(SUIT_Session::session()->resourceMgr()->colorValue( "QxGraph", "NodeBody", RECTANGLE_BODY )); + aEllipseItem->setBrush(aBr); + QPen aPen(Qt::black,2); + aEllipseItem->setPen(aPen); + } + addItem(aEllipseItem); + return aEllipseItem; +} + +/*! + Add a QCanvasText item for display mode DMode +*/ +QCanvasItem* QxGraph_Prs::addTextItem(QString theText, int theDMode) +{ + QCanvasText* aTextItem; + if ( myCanvas ) + { + aTextItem = new QCanvasText(theText, myCanvas); + aTextItem->setZ(0); + aTextItem->show(); + myCanvas->update(); + + // test drawing features: font, color, text flags ... + aTextItem->setColor(Qt::darkBlue); + //aTextItem->setFont(QFont("Times"/*"Helvetica"*/, 14, QFont::Normal, true)); + } + addItem(aTextItem); + return aTextItem; +} diff --git a/src/QxGraph/QxGraph_Prs.h b/src/QxGraph/QxGraph_Prs.h new file mode 100644 index 000000000..44c204260 --- /dev/null +++ b/src/QxGraph/QxGraph_Prs.h @@ -0,0 +1,62 @@ +// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D +// +// 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 +// +#ifndef QXGRAPH_PRS_H +#define QXGRAPH_PRS_H + +#include "QxGraph.h" + +#include +#include +#include + +class QxGraph_Canvas; + +class QXGRAPH_EXPORT QxGraph_Prs +{ + public: + QxGraph_Prs(QxGraph_Canvas*); + ~QxGraph_Prs(); + + void addItem(QCanvasItem* theItem, int theDMode = -1); + + /* add items for display mode theDMode + if theDMode is equal to -1 add item for the current (active) display mode */ + QCanvasItem* addRectangleItem(QRect theRect, int theDMode = -1); + QCanvasItem* addPolygonItem(QPointArray thePA, int theDMode = -1); + QCanvasItem* addLineItem(QPoint theStart, QPoint theEnd, int theDMode = -1); + QCanvasItem* addEllipseItem(int theW, int theH, int theStartAngle, int theAngle, int theDMode = -1); + QCanvasItem* addTextItem(QString theText, int theDMode = -1); + + typedef QMap< int, QPtrList > DMode2ItemList; + + const DMode2ItemList& getDisplayMap() const { return myDisplayMap; } + const QPtrList& getItems(int theDMode) { return myDisplayMap[theDMode]; } + + void setDMode(int theDMode) { myDMode = theDMode; } + int getDMode() const { return myDMode; } + + private: + QxGraph_Canvas* myCanvas; + DMode2ItemList myDisplayMap; + + int myDMode; + +}; + +#endif diff --git a/src/QxGraph/QxGraph_ViewModel.cxx b/src/QxGraph/QxGraph_ViewModel.cxx index 2dd37cbcc..8a85cf55d 100644 --- a/src/QxGraph/QxGraph_ViewModel.cxx +++ b/src/QxGraph/QxGraph_ViewModel.cxx @@ -21,6 +21,7 @@ #include "QxGraph_Canvas.h" #include "QxGraph_CanvasView.h" #include "QxGraph_Def.h" +#include "QxGraph_Prs.h" #include "SUIT_Desktop.h" #include "SUIT_ViewWindow.h" @@ -35,11 +36,11 @@ */ QxGraph_Viewer::QxGraph_Viewer() :SUIT_ViewModel(), - // myCanvas(0), + myCanvas(0), myCurrentView(0) { printf("Construct QxGraph_Viewer\n"); - myCanvases.setAutoDelete(true); + //myCanvases.setAutoDelete(true); myCanvasViews.setAutoDelete(true); } @@ -48,8 +49,8 @@ QxGraph_Viewer::QxGraph_Viewer() */ QxGraph_Viewer::~QxGraph_Viewer() { - //if ( myCanvas ) delete myCanvas; - if ( !myCanvases.isEmpty() ) myCanvases.clear(); + if ( myCanvas ) delete myCanvas; + //if ( !myCanvases.isEmpty() ) myCanvases.clear(); if ( !myCanvasViews.isEmpty() ) myCanvasViews.clear(); myCurrentView = 0; } @@ -64,29 +65,35 @@ void QxGraph_Viewer::initView( QxGraph_ViewWindow* view ) { view->initLayout(); + // for debug only (CreatePrs() must be called from YACSGui_Displayer) ---> + QxGraph_Prs* aPrs = CreatePrs(); + //aPrs->setDMode(YACSGui_Displayer::Full); from enumeration in Displayer + + /* // test add items into the current canvas view QRect aRect(100,200,200,100); - QCanvasItem* aRectItem = addRectangleItem(aRect); + QCanvasItem* aRectItem = aPrs->addRectangleItem(aRect); //delete aRectItem; QPointArray aPA(6); aPA.putPoints(0, 6, 400,100, 500,70, 600,100, 600,200, 500,230, 400,200); - QCanvasItem* aPolyItem = addPolygonItem(aPA); + QCanvasItem* aPolyItem = aPrs->addPolygonItem(aPA); //delete aPolyItem; QPoint aStart(500,300), aEnd(700,250); - QCanvasItem* aLineItem = addLineItem(aStart, aEnd); + QCanvasItem* aLineItem = aPrs->addLineItem(aStart, aEnd); //delete aLineItem; - QCanvasItem* aEllipseItem = addEllipseItem(200, 100, 30*16, 120*16); + QCanvasItem* aEllipseItem = aPrs->addEllipseItem(200, 100, 30*16, 120*16); aEllipseItem->setX(400); aEllipseItem->setY(400); //delete aEllipseItem; - QCanvasItem* aTextItem = addTextItem("This is a QCanvasText item"); + QCanvasItem* aTextItem = aPrs->addTextItem("This is a QCanvasText item"); aTextItem->setX(100); - aTextItem->setY(100); + aTextItem->setY(500); //delete aTextItem; + */ } } @@ -154,147 +161,9 @@ void QxGraph_Viewer::onShowToolbar() { } /*! - Add a QCanvasRectangle item into canvas (canvas view) with index theIndex -*/ -QCanvasItem* QxGraph_Viewer::addRectangleItem(QRect theRect, int theIndex) -{ - QCanvasRectangle* aRectItem; - - QCanvas* aCanvas = 0; - if ( theIndex == -1 ) // add item into the current canvas (canvas view) - aCanvas = myCurrentView->canvas(); - else if ( theIndex >= 0 & theIndex < myCanvasViews.count() ) - aCanvas = myCanvases.at(theIndex); - - if ( aCanvas ) - { - QCanvasRectangle* aRectItem = new QCanvasRectangle(theRect, aCanvas); - aRectItem->setZ(0); - aRectItem->show(); - aCanvas->update(); - - // test drawing features: brush, pen ... - QBrush aBr(SUIT_Session::session()->resourceMgr()->colorValue( "SUPERVGraph", "NodeBody", RECTANGLE_BODY )); - aRectItem->setBrush(aBr); - } - - return aRectItem; -} - -/*! - Add a QCanvasPolygon item into canvas (canvas view) with index theIndex -*/ -QCanvasItem* QxGraph_Viewer::addPolygonItem(QPointArray thePA, int theIndex) -{ - QCanvasPolygon* aPolyItem; - - QCanvas* aCanvas = 0; - if ( theIndex == -1 ) // add item into the current canvas (canvas view) - aCanvas = myCurrentView->canvas(); - else if ( theIndex >= 0 & theIndex < myCanvasViews.count() ) - aCanvas = myCanvases.at(theIndex); - - if ( aCanvas ) - { - aPolyItem = new QCanvasPolygon(aCanvas); - aPolyItem->setZ(0); - aPolyItem->setPoints(thePA); - aPolyItem->show(); - aCanvas->update(); - - // test drawing features: brush, pen ... - QBrush aBr(SUIT_Session::session()->resourceMgr()->colorValue( "SUPERVGraph", "NodeBody", RECTANGLE_BODY )); - aPolyItem->setBrush(aBr); - QPen aPen(Qt::black,2); - aPolyItem->setPen(aPen); - } - - return aPolyItem; -} - -/*! - Add a QCanvasLine item into canvas (canvas view) with index theIndex -*/ -QCanvasItem* QxGraph_Viewer::addLineItem(QPoint theStart, QPoint theEnd, int theIndex) -{ - QCanvasLine* aLineItem; - - QCanvas* aCanvas = 0; - if ( theIndex == -1 ) // add item into the current canvas (canvas view) - aCanvas = myCurrentView->canvas(); - else if ( theIndex >= 0 & theIndex < myCanvasViews.count() ) - aCanvas = myCanvases.at(theIndex); - - if ( aCanvas ) - { - aLineItem = new QCanvasLine(aCanvas); - aLineItem->setZ(0); - aLineItem->setPoints(theStart.x(), theStart.y(), theEnd.x(), theEnd.y()); - aLineItem->show(); - aCanvas->update(); - - // test drawing features: brush, pen ... - QPen aPen(Qt::black,2); - aLineItem->setPen(aPen); - } - - return aLineItem; -} - -/*! - Add a QCanvasEllipse item into canvas (canvas view) with index theIndex + Create QxGraph_Prs object for the myCanvas */ -QCanvasItem* QxGraph_Viewer::addEllipseItem(int theW, int theH, int theStartAngle, int theAngle, int theIndex) +QxGraph_Prs* QxGraph_Viewer::CreatePrs() { - QCanvasEllipse* aEllipseItem; - - QCanvas* aCanvas = 0; - if ( theIndex == -1 ) // add item into the current canvas (canvas view) - aCanvas = myCurrentView->canvas(); - else if ( theIndex >= 0 & theIndex < myCanvasViews.count() ) - aCanvas = myCanvases.at(theIndex); - - if ( aCanvas ) - { - aEllipseItem = new QCanvasEllipse(theW, theH, theStartAngle, theAngle, aCanvas); - aEllipseItem->setZ(0); - aEllipseItem->show(); - aCanvas->update(); - - // test drawing features: brush, pen ... - QBrush aBr(SUIT_Session::session()->resourceMgr()->colorValue( "SUPERVGraph", "NodeBody", RECTANGLE_BODY )); - aEllipseItem->setBrush(aBr); - QPen aPen(Qt::black,2); - aEllipseItem->setPen(aPen); - } - - return aEllipseItem; -} - -/*! - Add a QCanvasText item into canvas (canvas view) with index theIndex -*/ -QCanvasItem* QxGraph_Viewer::addTextItem(QString theText, int theIndex) -{ - QCanvasText* aTextItem; - - QCanvas* aCanvas = 0; - if ( theIndex == -1 ) // add item into the current canvas (canvas view) - aCanvas = myCurrentView->canvas(); - else if ( theIndex >= 0 & theIndex < myCanvasViews.count() ) - aCanvas = myCanvases.at(theIndex); - - if ( aCanvas ) - { - aTextItem = new QCanvasText(theText, aCanvas); - aTextItem->setZ(0); - aTextItem->show(); - aCanvas->update(); - - // test drawing features: font, color, text flags ... - aTextItem->setColor(Qt::darkBlue); - aTextItem->setFont(QFont("Times"/*"Helvetica"*/, 14, QFont::Normal, true)); - } - - return aTextItem; + return new QxGraph_Prs(myCanvas); } diff --git a/src/QxGraph/QxGraph_ViewModel.h b/src/QxGraph/QxGraph_ViewModel.h index d3c893f4c..fab15d582 100644 --- a/src/QxGraph/QxGraph_ViewModel.h +++ b/src/QxGraph/QxGraph_ViewModel.h @@ -28,6 +28,7 @@ class QCanvasItem; // for addRectangleItem(...) method (can be removed in the fu class QxGraph_Canvas; class QxGraph_CanvasView; class QxGraph_ViewWindow; +class QxGraph_Prs; class QXGRAPH_EXPORT QxGraph_Viewer: public SUIT_ViewModel { @@ -44,13 +45,13 @@ class QXGRAPH_EXPORT QxGraph_Viewer: public SUIT_ViewModel virtual void contextMenuPopup(QPopupMenu*); - //QxGraph_Canvas* getCanvas() { return myCanvas; } - //void setCanvas(QxGraph_Canvas* theCanvas) { myCanvas = theCanvas; } - QPtrList getCanvases() { return myCanvases; } - void setCanvases(QPtrList theCanvases) { myCanvases = theCanvases; } + QxGraph_Canvas* getCanvas() const { return myCanvas; } + void setCanvas(QxGraph_Canvas* theCanvas) { myCanvas = theCanvas; } + //QPtrList getCanvases() { return myCanvases; } + //void setCanvases(QPtrList theCanvases) { myCanvases = theCanvases; } - void addCanvas(QxGraph_Canvas* theCanvas) { myCanvases.append(theCanvas); } - void removeCanvas(QxGraph_Canvas* theCanvas) { myCanvases.remove(theCanvas); } + //void addCanvas(QxGraph_Canvas* theCanvas) { myCanvases.append(theCanvas); } + //void removeCanvas(QxGraph_Canvas* theCanvas) { myCanvases.remove(theCanvas); } QPtrList getCanvasViews() { return myCanvasViews; } void setCanvasViews(QPtrList theViews) { myCanvasViews = theViews; } @@ -58,17 +59,11 @@ class QXGRAPH_EXPORT QxGraph_Viewer: public SUIT_ViewModel void addView(QxGraph_CanvasView* theView) { myCanvasViews.append(theView); } void removeView(QxGraph_CanvasView* theView) { myCanvasViews.remove(theView); } - QxGraph_CanvasView* getCurrentView() { return myCurrentView; } + QxGraph_CanvasView* getCurrentView() const { return myCurrentView; } void setCurrentView(QxGraph_CanvasView* theView) { myCurrentView = theView; } void setCurrentView(int theIndex); - /* add items into canvas (canvas view) with index theIndex - if theIndex is equal to -1 add item into current (active) canvas (canvas view) */ - QCanvasItem* addRectangleItem(QRect theRect, int theIndex = -1); - QCanvasItem* addPolygonItem(QPointArray thePA, int theIndex = -1); - QCanvasItem* addLineItem(QPoint theStart, QPoint theEnd, int theIndex = -1); - QCanvasItem* addEllipseItem(int theW, int theH, int theStartAngle, int theAngle, int theIndex = -1); - QCanvasItem* addTextItem(QString theText, int theIndex = -1); + QxGraph_Prs* CreatePrs(); protected: void initView(QxGraph_ViewWindow* view); @@ -78,11 +73,12 @@ class QXGRAPH_EXPORT QxGraph_Viewer: public SUIT_ViewModel void onChangeBgColor(); private: - //QxGraph_Canvas* myCanvas; - QPtrList myCanvases; + QxGraph_Canvas* myCanvas; + //QPtrList myCanvases; QPtrList myCanvasViews; QxGraph_CanvasView* myCurrentView; + }; #endif diff --git a/src/QxGraph/QxGraph_ViewWindow.cxx b/src/QxGraph/QxGraph_ViewWindow.cxx index e94f40203..1e64a8b06 100644 --- a/src/QxGraph/QxGraph_ViewWindow.cxx +++ b/src/QxGraph/QxGraph_ViewWindow.cxx @@ -51,7 +51,7 @@ QxGraph_ViewWindow::QxGraph_ViewWindow( SUIT_Desktop* theDesktop, QxGraph_Viewer */ void QxGraph_ViewWindow::initLayout() { - //initCanvas(); + initCanvas(); initCanvasViews(); myToolBar = new QToolBar(this); @@ -67,8 +67,8 @@ void QxGraph_ViewWindow::initLayout() void QxGraph_ViewWindow::initCanvas() { if ( myViewModel ) - //myViewModel->setCanvas( new QxGraph_Canvas(resMgr()) ); - myViewModel->addCanvas( new QxGraph_Canvas(resMgr()) ); + myViewModel->setCanvas( new QxGraph_Canvas(resMgr()) ); + //myViewModel->addCanvas( new QxGraph_Canvas(resMgr()) ); } /*! @@ -80,11 +80,11 @@ void QxGraph_ViewWindow::initCanvasViews() { for (int i = 0; i < 2; i++) { - QxGraph_Canvas* aCanvas = new QxGraph_Canvas(resMgr()); - myViewModel->addCanvas( aCanvas ); + //QxGraph_Canvas* aCanvas = new QxGraph_Canvas(resMgr()); + //myViewModel->addCanvas( aCanvas ); - //QxGraph_CanvasView* aCanvasView = new QxGraph_CanvasView( myViewModel->getCanvas(), this ); - QxGraph_CanvasView* aCanvasView = new QxGraph_CanvasView( aCanvas, this ); + QxGraph_CanvasView* aCanvasView = new QxGraph_CanvasView( myViewModel->getCanvas(), this ); + //QxGraph_CanvasView* aCanvasView = new QxGraph_CanvasView( aCanvas, this ); myViewModel->addView(aCanvasView); aCanvasView->hide();