1 // SALOME SUPERVGraph : build Supervisor viewer into desktop
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : SUPERVGraph_ViewFrame.cxx
25 // Author : Nicolas REJNERI
29 #include "SUPERVGraph_ViewFrame.h"
33 #include <qcolordialog.h>
38 SUPERVGraph_View::SUPERVGraph_View( QWidget* theParent ): QWidget( theParent )
43 SUPERVGraph_View::SUPERVGraph_View( SUPERVGraph_View* theParent ): QWidget( theParent )
48 void SUPERVGraph_View::contextMenuPopup( QPopupMenu* )
53 void SUPERVGraph_View::init( QWidget* theParent )
55 if ( theParent->inherits( "QMainWindow" ) ) {
56 ( ( QMainWindow* )theParent )->setCentralWidget( this );
59 QBoxLayout* layout = new QVBoxLayout( theParent );
60 layout->addWidget( this );
68 SUPERVGraph_ViewFrame::SUPERVGraph_ViewFrame( SUIT_Desktop* theDesktop )
69 : SUIT_ViewWindow( theDesktop )
73 //myView = new SUPERVGraph_View(this);
74 // Set BackgroundColor
76 int R = QAD_CONFIG->getSetting("SUPERVGraph:BackgroundColorRed").toInt();
77 int G = QAD_CONFIG->getSetting("SUPERVGraph:BackgroundColorGreen").toInt();
78 int B = QAD_CONFIG->getSetting("SUPERVGraph:BackgroundColorBlue").toInt();
79 setBackgroundColor(QColor(R,G,B));*/
82 SUPERVGraph_ViewFrame::~SUPERVGraph_ViewFrame() {}
85 Returns widget containing 3D-Viewer
87 SUPERVGraph_View* SUPERVGraph_ViewFrame::getViewWidget()
93 void SUPERVGraph_ViewFrame::setViewWidget( SUPERVGraph_View* theView )
100 Display/hide Trihedron
102 void SUPERVGraph_ViewFrame::onViewTrihedron()
104 // MESSAGE ( "SUPERVGraph_ViewFrame::onViewTrihedron" )
108 Provides top projection of the active view
110 void SUPERVGraph_ViewFrame::onViewTop()
112 // MESSAGE ( "SUPERVGraph_ViewFrame::onViewTop" )
116 Provides bottom projection of the active view
118 void SUPERVGraph_ViewFrame::onViewBottom()
120 // MESSAGE ( "SUPERVGraph_ViewFrame::onViewBottom" )
124 Provides left projection of the active view
126 void SUPERVGraph_ViewFrame::onViewLeft()
128 // MESSAGE ( "SUPERVGraph_ViewFrame::onViewLeft" )
132 Provides right projection of the active view
134 void SUPERVGraph_ViewFrame::onViewRight()
136 // MESSAGE ( "SUPERVGraph_ViewFrame::onViewRight" )
140 Provides back projection of the active view
142 void SUPERVGraph_ViewFrame::onViewBack()
144 // MESSAGE ( "SUPERVGraph_ViewFrame::onViewBack" )
148 Provides front projection of the active view
150 void SUPERVGraph_ViewFrame::onViewFront()
152 // MESSAGE ( "SUPERVGraph_ViewFrame::onViewFront" )
156 Reset the active view
158 void SUPERVGraph_ViewFrame::onViewReset()
160 // MESSAGE ( "SUPERVGraph_ViewFrame::onViewReset" )
166 Rotates the active view
168 void SUPERVGraph_ViewFrame::onViewRotate()
170 // MESSAGE ( "SUPERVGraph_ViewFrame::onViewRotate" )
174 Sets a new center of the active view
176 void SUPERVGraph_ViewFrame::onViewGlobalPan()
178 // MESSAGE ( "SUPERVGraph_ViewFrame::onViewGlobalPan" )
182 Zooms the active view
184 void SUPERVGraph_ViewFrame::onViewZoom()
186 // MESSAGE ( "SUPERVGraph_ViewFrame::onViewZoom" )
190 Moves the active view
192 void SUPERVGraph_ViewFrame::onViewPan()
194 // MESSAGE ( "SUPERVGraph_ViewFrame::onViewPan" )
196 myView->ActivatePanning();
200 Fits all obejcts within a rectangular area of the active view
202 void SUPERVGraph_ViewFrame::onViewFitArea()
204 // MESSAGE ( "SUPERVGraph_ViewFrame::onViewFitArea" )
208 Fits all objects in the active view
210 void SUPERVGraph_ViewFrame::onViewFitAll()
212 // MESSAGE ( "SUPERVGraph_ViewFrame::onViewFitAll" )
216 Set background of the viewport
218 void SUPERVGraph_ViewFrame::setBackgroundColor( const QColor& color )
221 myView->setPaletteBackgroundColor(color);
225 Returns background of the viewport
227 QColor SUPERVGraph_ViewFrame::backgroundColor() const
230 return myView->paletteBackgroundColor();
231 return QMainWindow::backgroundColor();
234 void SUPERVGraph_ViewFrame::onAdjustTrihedron()
236 // MESSAGE ( "SUPERVGraph_ViewFrame::onAdjustTrihedron" )
239 void SUPERVGraph_ViewFrame::rename( const Handle(SALOME_InteractiveObject)& IObject,
242 // MESSAGE ( "SUPERVGraph_ViewFrame::rename" )
245 void SUPERVGraph_ViewFrame::unHighlightAll()
247 // MESSAGE ( "SUPERVGraph_ViewFrame::unHighlightAll" )
250 void SUPERVGraph_ViewFrame::highlight( const Handle(SALOME_InteractiveObject)& IObject,
251 bool highlight, bool immediatly )
253 // MESSAGE ( "SUPERVGraph_ViewFrame::highlight" )
256 bool SUPERVGraph_ViewFrame::isInViewer( const Handle(SALOME_InteractiveObject)& IObject )
258 // MESSAGE ( "SUPERVGraph_ViewFrame::isInViewer" )
262 bool SUPERVGraph_ViewFrame::isVisible( const Handle(SALOME_InteractiveObject)& IObject )
264 // MESSAGE ( "SUPERVGraph_ViewFrame::isVisible" )
268 void SUPERVGraph_ViewFrame::resizeEvent( QResizeEvent* theEvent )
270 QMainWindow::resizeEvent( theEvent );
271 if ( myView ) myView->resizeView( theEvent );