2 // File : SUPERVGraph_ViewFrame.cxx
3 // Created : Wed Mar 20 14:03:31 2002
4 // Author : Nicolas REJNERI
6 // Module : SUPERVGraph
7 // Copyright : Open CASCADE 2002
11 #include "SUPERVGraph_ViewFrame.h"
13 #include "QAD_Settings.h"
14 #include "QAD_Config.h"
15 #include "QAD_Application.h"
16 #include "QAD_Desktop.h"
17 #include "SALOME_Selection.h"
19 #include "utilities.h"
23 #include <qcolordialog.h>
25 SUPERVGraph_View::SUPERVGraph_View(QWidget* theParent): QWidget(theParent){
28 SUPERVGraph_View::SUPERVGraph_View(SUPERVGraph_View* theParent): QWidget(theParent){
29 setPopupServer(theParent->getPopupServer());
32 void SUPERVGraph_View::init(QWidget* theParent){
33 if ( theParent->inherits( "QMainWindow" ) ) {
34 ( ( QMainWindow* )theParent )->setCentralWidget( this );
37 QBoxLayout* layout = new QVBoxLayout( theParent );
38 layout->addWidget( this );
42 void SUPERVGraph_View::onCreatePopup(){
45 QAD_Desktop* Desktop = (QAD_Desktop*) QAD_Application::getDesktop();
46 QAD_Study* ActiveStudy = Desktop->getActiveStudy();
47 SALOME_Selection* Sel = SALOME_Selection::Selection( ActiveStudy->getSelection() );
50 QString theParent("Viewer");
53 Desktop->definePopup( theContext, theParent, theObject );
54 Desktop->createPopup( myPopup, theContext, theParent, theObject);
55 Desktop->customPopup( myPopup, theContext, theParent, theObject );
56 if (Sel->IObjectCount() == 0 && myPopup->count()<1) {
58 myIDs.append ( id = myPopup->insertItem (tr ("MEN_VP3D_CHANGEBGR")) );
59 QAD_ASSERT ( myPopup->connectItem ( id, this, SLOT(onChangeBackgroundColor())) );
67 SUPERVGraph_ViewFrame::SUPERVGraph_ViewFrame(QWidget* parent, const char* name)
68 : QAD_ViewFrame(parent, name)
71 //myView = new SUPERVGraph_View(this);
72 // Set BackgroundColor
74 int R = QAD_CONFIG->getSetting("SUPERVGraph:BackgroundColorRed").toInt();
75 int G = QAD_CONFIG->getSetting("SUPERVGraph:BackgroundColorGreen").toInt();
76 int B = QAD_CONFIG->getSetting("SUPERVGraph:BackgroundColorBlue").toInt();
77 setBackgroundColor(QColor(R,G,B));*/
79 SUPERVGraph_ViewFrame::~SUPERVGraph_ViewFrame(){}
82 Returns widget containing 3D-Viewer
84 SUPERVGraph_View* SUPERVGraph_ViewFrame::getViewWidget(){
89 void SUPERVGraph_ViewFrame::setViewWidget(SUPERVGraph_View* theView) {
92 myView->setPopupServer(myApp);
98 Display/hide Trihedron
100 void SUPERVGraph_ViewFrame::onViewTrihedron()
102 MESSAGE ( "SUPERVGraph_ViewFrame::onViewTrihedron" )
106 Provides top projection of the active view
108 void SUPERVGraph_ViewFrame::onViewTop()
110 MESSAGE ( "SUPERVGraph_ViewFrame::onViewTop" )
114 Provides bottom projection of the active view
116 void SUPERVGraph_ViewFrame::onViewBottom()
118 MESSAGE ( "SUPERVGraph_ViewFrame::onViewBottom" )
122 Provides left projection of the active view
124 void SUPERVGraph_ViewFrame::onViewLeft()
126 MESSAGE ( "SUPERVGraph_ViewFrame::onViewLeft" )
130 Provides right projection of the active view
132 void SUPERVGraph_ViewFrame::onViewRight()
134 MESSAGE ( "SUPERVGraph_ViewFrame::onViewRight" )
138 Provides back projection of the active view
140 void SUPERVGraph_ViewFrame::onViewBack()
142 MESSAGE ( "SUPERVGraph_ViewFrame::onViewBack" )
146 Provides front projection of the active view
148 void SUPERVGraph_ViewFrame::onViewFront()
150 MESSAGE ( "SUPERVGraph_ViewFrame::onViewFront" )
154 Reset the active view
156 void SUPERVGraph_ViewFrame::onViewReset()
158 MESSAGE ( "SUPERVGraph_ViewFrame::onViewReset" )
164 Rotates the active view
166 void SUPERVGraph_ViewFrame::onViewRotate()
168 MESSAGE ( "SUPERVGraph_ViewFrame::onViewRotate" )
172 Sets a new center of the active view
174 void SUPERVGraph_ViewFrame::onViewGlobalPan()
176 MESSAGE ( "SUPERVGraph_ViewFrame::onViewGlobalPan" )
180 Zooms the active view
182 void SUPERVGraph_ViewFrame::onViewZoom()
184 MESSAGE ( "SUPERVGraph_ViewFrame::onViewZoom" )
188 Moves the active view
190 void SUPERVGraph_ViewFrame::onViewPan()
192 MESSAGE ( "SUPERVGraph_ViewFrame::onViewPan" )
194 myView->ActivatePanning();
198 Fits all obejcts within a rectangular area of the active view
200 void SUPERVGraph_ViewFrame::onViewFitArea()
202 MESSAGE ( "SUPERVGraph_ViewFrame::onViewFitArea" )
206 Fits all objects in the active view
208 void SUPERVGraph_ViewFrame::onViewFitAll()
210 MESSAGE ( "SUPERVGraph_ViewFrame::onViewFitAll" )
214 Set background of the viewport
216 void SUPERVGraph_ViewFrame::setBackgroundColor( const QColor& color)
219 myView->setPaletteBackgroundColor(color);
223 Returns background of the viewport
225 QColor SUPERVGraph_ViewFrame::backgroundColor() const
228 return myView->paletteBackgroundColor();
229 return QMainWindow::backgroundColor();
233 void SUPERVGraph_ViewFrame::SetSelectionMode( int mode )
235 MESSAGE ( "SUPERVGraph_ViewFrame::SetSelectionMode" )
238 void SUPERVGraph_ViewFrame::SetTrihedronSize( int dim )
240 MESSAGE ( "SUPERVGraph_ViewFrame::SetTrihedronSize" )
243 void SUPERVGraph_ViewFrame::rename( const Handle(SALOME_InteractiveObject)& IObject,
246 MESSAGE ( "SUPERVGraph_ViewFrame::rename" )
249 void SUPERVGraph_ViewFrame::unHighlightAll()
251 MESSAGE ( "SUPERVGraph_ViewFrame::unHighlightAll" )
254 void SUPERVGraph_ViewFrame::highlight( const Handle(SALOME_InteractiveObject)& IObject,
255 bool highlight, bool immediatly )
257 MESSAGE ( "SUPERVGraph_ViewFrame::highlight" )
260 bool SUPERVGraph_ViewFrame::isInViewer( const Handle(SALOME_InteractiveObject)& IObject )
262 MESSAGE ( "SUPERVGraph_ViewFrame::isInViewer" )
266 bool SUPERVGraph_ViewFrame::isVisible( const Handle(SALOME_InteractiveObject)& IObject )
268 MESSAGE ( "SUPERVGraph_ViewFrame::isVisible" )
272 void SUPERVGraph_ViewFrame::setPopupServer( QAD_Application* App )
276 myView->setPopupServer(myApp);
280 void SUPERVGraph_ViewFrame::undo(SALOMEDS::Study_var aStudy,
281 const char* StudyFrameEntry)
283 MESSAGE ( "SUPERVGraph_ViewFrame::undo" )
286 void SUPERVGraph_ViewFrame::redo(SALOMEDS::Study_var aStudy,
287 const char* StudyFrameEntry)
289 MESSAGE ( "SUPERVGraph_ViewFrame::redo" )