#include "OCCViewer_ViewModel.h"
#include "OCCViewer_ViewPort3d.h"
#include "OCCViewer_CreateRestoreViewDlg.h"
+#include "OCCViewer_ClippingDlg.h"
#include "SUIT_Desktop.h"
#include "SUIT_Session.h"
#include "SUIT_ResourceMgr.h"
#include "SUIT_MessageBox.h"
-#include "LightApp_ClippingDlg.h"
-
#include <qptrlist.h>
#include <qhbox.h>
#include <qlabel.h>
"................................",
"................................",
"................................"};
-
-
-QPixmap zoomPixmap(imageZoomCursor);
-QPixmap rotatePixmap(imageRotateCursor);
-QPixmap globalPanPixmap(imageCrossCursor);
-
-QCursor defCursor(Qt::ArrowCursor);
-QCursor handCursor(Qt::PointingHandCursor);
-QCursor panCursor(Qt::SizeAllCursor);
-QCursor zoomCursor(zoomPixmap);
-QCursor rotCursor(rotatePixmap);
-QCursor glPanCursor(globalPanPixmap);
-
//////////////////////////////////////////////////////////////////////
myCursor = cursor(); /* save old cursor */
if ( myOperation != ZOOMVIEW ) {
+ QPixmap zoomPixmap (imageZoomCursor);
+ QCursor zoomCursor (zoomPixmap);
setTransformRequested ( ZOOMVIEW );
setCursor( zoomCursor );
}
myCursor = cursor(); // save old cursor
if ( myOperation != PANVIEW ) {
+ QCursor panCursor (Qt::SizeAllCursor);
setTransformRequested ( PANVIEW );
setCursor( panCursor );
}
myCursor = cursor(); // save old cursor
if ( myOperation != ROTATE ) {
+ QPixmap rotatePixmap (imageRotateCursor);
+ QCursor rotCursor (rotatePixmap);
setTransformRequested ( ROTATE );
setCursor( rotCursor );
}
{
Handle(V3d_View) aView3d = myViewPort->getView();
if ( !aView3d.IsNull() ) {
+ QPixmap globalPanPixmap (imageCrossCursor);
+ QCursor glPanCursor (globalPanPixmap);
myCurScale = aView3d->Scale();
aView3d->FitAll(0.01, false);
myCursor = cursor(); // save old cursor
myCursor = cursor(); /* save old cursor */
if ( myOperation != WINDOWFIT ) {
+ QCursor handCursor (Qt::PointingHandCursor);
setTransformRequested ( WINDOWFIT );
setCursor ( handCursor );
myCursorIsHand = true;
if ( myDrawRect ) {
drawRect();
if ( !myCursorIsHand ) { // we are going to sketch a rectangle
+ QCursor handCursor (Qt::PointingHandCursor);
myCursorIsHand = true;
myCursor = cursor();
setCursor( handCursor );
if ( on )
{
if ( !myClippingDlg )
- myClippingDlg = new LightApp_ClippingDlg( this, myDesktop );
+ myClippingDlg = new OCCViewer_ClippingDlg( this, myDesktop );
if ( !myClippingDlg->isShown() )
myClippingDlg->show();
//****************************************************************
void OCCViewer_ViewWindow::onMemorizeView()
{
- double centerX, centerY, projX, projY, projZ, twist;
- double atX, atY, atZ, eyeX, eyeY, eyeZ;
-
- Handle(V3d_View) aView3d = myViewPort->getView();
-
- aView3d->Center( centerX, centerY );
- aView3d->Proj( projX, projY, projZ );
- aView3d->At( atX, atY, atZ );
- aView3d->Eye( eyeX, eyeY, eyeZ );
- twist = aView3d->Twist();
-
- viewAspect params;
- QString aName = QTime::currentTime().toString() + QString::fromLatin1( " h:m:s" );
-
- params.scale = aView3d->Scale();
- params.centerX = centerX;
- params.centerY = centerY;
- params.projX = projX;
- params.projY = projY;
- params.projZ = projZ;
- params.twist = twist;
- params.atX = atX;
- params.atY = atY;
- params.atZ = atZ;
- params.eyeX = eyeX;
- params.eyeY = eyeY;
- params.eyeZ = eyeZ;
- params.name = aName;
-
- myModel->appendViewAspect( params );
-
+ myModel->appendViewAspect( getViewParams() );
}
//****************************************************************
Standard_Boolean prev = aView3d->SetImmediateUpdate( Standard_False );
aView3d->SetScale( anItem.scale );
aView3d->SetCenter( anItem.centerX, anItem.centerY );
- aView3d->SetProj( anItem.projX, anItem.projY, anItem.projZ );
aView3d->SetTwist( anItem.twist );
aView3d->SetAt( anItem.atX, anItem.atY, anItem.atZ );
aView3d->SetImmediateUpdate( prev );
aView3d->SetEye( anItem.eyeX, anItem.eyeY, anItem.eyeZ );
+ aView3d->SetProj( anItem.projX, anItem.projY, anItem.projZ );
myRestoreFlag = 0;
}
v->Update();
v->Redraw();
}
+
+/*! The method returns the visual parameters of this view as a viewAspect object
+ */
+viewAspect OCCViewer_ViewWindow::getViewParams() const
+{
+ double centerX, centerY, projX, projY, projZ, twist;
+ double atX, atY, atZ, eyeX, eyeY, eyeZ;
+
+ Handle(V3d_View) aView3d = myViewPort->getView();
+
+ aView3d->Center( centerX, centerY );
+ aView3d->Proj( projX, projY, projZ );
+ aView3d->At( atX, atY, atZ );
+ aView3d->Eye( eyeX, eyeY, eyeZ );
+ twist = aView3d->Twist();
+
+ QString aName = QTime::currentTime().toString() + QString::fromLatin1( " h:m:s" );
+
+ viewAspect params;
+ params.scale = aView3d->Scale();
+ params.centerX = centerX;
+ params.centerY = centerY;
+ params.projX = projX;
+ params.projY = projY;
+ params.projZ = projZ;
+ params.twist = twist;
+ params.atX = atX;
+ params.atY = atY;
+ params.atZ = atZ;
+ params.eyeX = eyeX;
+ params.eyeY = eyeY;
+ params.eyeZ = eyeZ;
+ params.name = aName;
+
+ return params;
+}
+
+
+/*! The method returns the visual parameters of this view as a formated string
+ */
+QString OCCViewer_ViewWindow::getVisualParameters()
+{
+ viewAspect params = getViewParams();
+ QString retStr;
+ retStr.sprintf( "%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e", params.scale,
+ params.centerX, params.centerY, params.projX, params.projY, params.projZ, params.twist,
+ params.atX, params.atY, params.atZ, params.eyeX, params.eyeY, params.eyeZ );
+ return retStr;
+}
+
+/* The method restors visual parameters of this view from a formated string
+ */
+void OCCViewer_ViewWindow::setVisualParameters( const QString& parameters )
+{
+ QStringList paramsLst = QStringList::split( '*', parameters, true );
+ if ( paramsLst.size() == 13 ) {
+ viewAspect params;
+ params.scale = paramsLst[0].toDouble();
+ params.centerX = paramsLst[1].toDouble();
+ params.centerY = paramsLst[2].toDouble();
+ params.projX = paramsLst[3].toDouble();
+ params.projY = paramsLst[4].toDouble();
+ params.projZ = paramsLst[5].toDouble();
+ params.twist = paramsLst[6].toDouble();
+ params.atX = paramsLst[7].toDouble();
+ params.atY = paramsLst[8].toDouble();
+ params.atZ = paramsLst[9].toDouble();
+ params.eyeX = paramsLst[10].toDouble();
+ params.eyeY = paramsLst[11].toDouble();
+ params.eyeZ = paramsLst[12].toDouble();
+
+ performRestoring( params );
+ }
+}