aView3d->SetEye( anItem.eyeX, anItem.eyeY, anItem.eyeZ );
aView3d->SetProj( anItem.projX, anItem.projY, anItem.projZ );
aView3d->SetAxialScale( anItem.scaleX, anItem.scaleY, anItem.scaleZ );
+ myModel->setTrihedronShown( anItem.isVisible );
+ myModel->setTrihedronSize( anItem.size );
myRestoreFlag = 0;
}
aView3d->AxialScale(aScaleX,aScaleY,aScaleZ);
+ bool isShown = myModel->isTrihedronVisible();
+ double size = myModel->trihedronSize();
+
QString aName = QTime::currentTime().toString() + QString::fromLatin1( " h:m:s" );
viewAspect params;
params.scaleY = aScaleY;
params.scaleZ = aScaleZ;
params.name = aName;
+ params.isVisible= isShown;
+ params.size = size;
return params;
}
params.centerX, params.centerY, params.projX, params.projY, params.projZ, params.twist,
params.atX, params.atY, params.atZ, params.eyeX, params.eyeY, params.eyeZ,
params.scaleX, params.scaleY, params.scaleZ );
+ retStr += QString().sprintf("*%u*%.2f", params.isVisible, params.size );
return retStr;
}
void OCCViewer_ViewWindow::setVisualParameters( const QString& parameters )
{
QStringList paramsLst = parameters.split( '*' );
- if ( paramsLst.size() >= 13 ) {
+ if ( paramsLst.size() >= 15 ) {
viewAspect params;
params.scale = paramsLst[0].toDouble();
params.centerX = paramsLst[1].toDouble();
params.eyeX = paramsLst[10].toDouble();
params.eyeY = paramsLst[11].toDouble();
params.eyeZ = paramsLst[12].toDouble();
- if ( paramsLst.size() == 16 ) {
+ if ( paramsLst.size() == 18 ) {
params.scaleX = paramsLst[13].toDouble();
params.scaleY = paramsLst[14].toDouble();
params.scaleZ = paramsLst[15].toDouble();
params.scaleY = 1.;
params.scaleZ = 1.;
}
+ params.isVisible = paramsLst[16].toDouble();
+ params.size = paramsLst[17].toDouble();
performRestoring( params );
}
#include "QtxMultiAction.h"
#include "VTKViewer_Utilities.h"
+#include "VTKViewer_Trihedron.h"
#include "SVTK_View.h"
//#include "SVTK_MainWindow.h"
*/
SVTK_ViewWindow::SVTK_ViewWindow(SUIT_Desktop* theDesktop):
SUIT_ViewWindow(theDesktop),
- //myMainWindow(0),
myView(NULL),
myDumpImage(QImage()),
myKeyFreeInteractorStyle(SVTK_KeyFreeInteractorStyle::New())
*/
void SVTK_ViewWindow::Initialize(SVTK_ViewModelBase* theModel)
{
- // if(SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr()){
- //myMainWindow = new SVTK_MainWindow(this,"SVTK_MainWindow",aResourceMgr,this);
-
- //SVTK_RenderWindowInteractor* anIteractor =
- // new SVTK_RenderWindowInteractor(myMainWindow,"SVTK_RenderWindowInteractor");
myInteractor = new SVTK_RenderWindowInteractor(this,"SVTK_RenderWindowInteractor");
SVTK_Selector* aSelector = SVTK_Selector::New();
aRenderer->Delete();
aSelector->Delete();
- //myMainWindow->Initialize(anIteractor);
myToolBar = toolMgr()->createToolBar( tr("LBL_TOOLBAR_LABEL"), -1, this );
myRecordingToolBar = toolMgr()->createToolBar( tr("LBL_TOOLBAR_RECORD_LABEL"), -1, this );
myRecorder->SetUseSkippedFrames( true );
myRecorder->SetRenderWindow( myInteractor->getRenderWindow() );
- //setCentralWidget(myMainWindow);
setCentralWidget(myInteractor);
- //myView = new SVTK_View(myMainWindow);
myView = new SVTK_View(this);
Initialize(myView,theModel);
myInteractor->getRenderWindow()->Render();
onResetView();
- //}
}
/*!
return myView;
}
-/*!
- \return corresponding vtk main window
-*/
-// SVTK_MainWindow* SVTK_ViewWindow::getMainWindow()
-// {
-// return myMainWindow;
-// }
-
/*!
\return corresponding vtk render window
*/
*/
void SVTK_ViewWindow::onFrontView()
{
- //myMainWindow->onFrontView();
GetRenderer()->OnFrontView();
Repaint();
}
*/
void SVTK_ViewWindow::onBackView()
{
- //myMainWindow->onBackView();
GetRenderer()->OnBackView();
Repaint();
}
*/
void SVTK_ViewWindow::onTopView()
{
- //myMainWindow->onTopView();
GetRenderer()->OnTopView();
Repaint();
}
*/
void SVTK_ViewWindow::onBottomView()
{
- //myMainWindow->onBottomView();
GetRenderer()->OnBottomView();
Repaint();
}
*/
void SVTK_ViewWindow::onLeftView()
{
- //myMainWindow->onLeftView();
GetRenderer()->OnLeftView();
Repaint();
}
*/
void SVTK_ViewWindow::onRightView()
{
- //myMainWindow->onRightView();
GetRenderer()->OnRightView();
Repaint();
}
*/
void SVTK_ViewWindow::onResetView()
{
- //myMainWindow->onResetView();
GetRenderer()->OnResetView();
Repaint();
}
*/
void SVTK_ViewWindow::onFitAll()
{
- //myMainWindow->onFitAll();
GetRenderer()->OnFitAll();
Repaint();
}
*/
void SVTK_ViewWindow::SetSelectionMode(Selection_Mode theMode)
{
- //myMainWindow->SetSelectionMode( theMode );
GetSelector()->SetSelectionMode(theMode);
}
*/
Selection_Mode SVTK_ViewWindow::SelectionMode() const
{
- //return myMainWindow->SelectionMode();
return GetSelector()->SelectionMode();
}
*/
void SVTK_ViewWindow::setBackgroundColor( const QColor& theColor )
{
- //myMainWindow->SetBackgroundColor( color );
getRenderer()->SetBackground(theColor.red()/255.0,
theColor.green()/255.0,
theColor.blue()/255.0);
*/
QColor SVTK_ViewWindow::backgroundColor() const
{
- //return myMainWindow->BackgroundColor();
vtkFloatingPointType aBackgroundColor[3];
getRenderer()->GetBackground(aBackgroundColor);
return QColor(int(aBackgroundColor[0]*255),
*/
void SVTK_ViewWindow::Repaint(bool theUpdateTrihedron)
{
- //myMainWindow->Repaint( theUpdateTrihedron );
if(theUpdateTrihedron)
GetRenderer()->OnAdjustTrihedron();
*/
void SVTK_ViewWindow::GetScale( double theScale[3] )
{
- //myMainWindow->GetScale( theScale );
GetRenderer()->GetScale( theScale );
}
*/
void SVTK_ViewWindow::SetScale( double theScale[3] )
{
- //myMainWindow->SetScale( theScale );
GetRenderer()->SetScale( theScale );
Repaint();
}
bool SVTK_ViewWindow::isTrihedronDisplayed()
{
return GetRenderer()->IsTrihedronDisplayed();
- // return myMainWindow->IsTrihedronDisplayed();
}
/*!
*/
bool SVTK_ViewWindow::isCubeAxesDisplayed()
{
- //return myMainWindow->IsCubeAxesDisplayed();
return GetRenderer()->IsCubeAxesDisplayed();
}
*/
void SVTK_ViewWindow::onViewTrihedron()
{
- //myMainWindow->onViewTrihedron();
GetRenderer()->OnViewTrihedron();
Repaint();
}
*/
void SVTK_ViewWindow::onViewCubeAxes()
{
- //myMainWindow->onViewCubeAxes();
GetRenderer()->OnViewCubeAxes();
Repaint();
}
*/
VTKViewer_Trihedron* SVTK_ViewWindow::GetTrihedron()
{
- //return myMainWindow->GetTrihedron();
return GetRenderer()->GetTrihedron();
}
*/
SVTK_CubeAxesActor2D* SVTK_ViewWindow::GetCubeAxes()
{
- //return myMainWindow->GetCubeAxes();
return GetRenderer()->GetCubeAxes();
}
*/
vtkFloatingPointType SVTK_ViewWindow::GetTrihedronSize() const
{
- //return myMainWindow->GetTrihedronSize();
return GetRenderer()->GetTrihedronSize();
}
*/
void SVTK_ViewWindow::SetIncrementalSpeed(const int theValue, const int theMode)
{
- //myMainWindow->SetIncrementalSpeed(theValue, theMode);
if ( (SVTK_InteractorStyle*)GetInteractorStyle() )
((SVTK_InteractorStyle*)GetInteractorStyle())->SetIncrementSpeed(theValue, theMode);
}
const int theBtn2,
const int theBtn3)
{
- //myMainWindow->SetSMButtons(theBtn1, theBtn2, theBtn3);
int val = theBtn1;
myEventDispatcher->InvokeEvent(SVTK::SetSMDecreaseSpeedEvent, &val);
val = theBtn2;
*/
void SVTK_ViewWindow::SetTrihedronSize(const vtkFloatingPointType theSize, const bool theRelative)
{
- //myMainWindow->SetTrihedronSize(theSize, theRelative);
GetRenderer()->SetTrihedronSize(theSize, theRelative);
Repaint();
}
*/
void SVTK_ViewWindow::AdjustTrihedrons(const bool theIsForcedUpdate)
{
- //myMainWindow->AdjustActors();
GetRenderer()->AdjustActors();
Repaint();
}
*/
void SVTK_ViewWindow::onAdjustTrihedron()
{
- //myMainWindow->onAdjustTrihedron();
GetRenderer()->OnAdjustTrihedron();
}
*/
void SVTK_ViewWindow::onAdjustCubeAxes()
{
- //myMainWindow->onAdjustCubeAxes();
GetRenderer()->OnAdjustCubeAxes();
}
void SVTK_ViewWindow::AddActor( VTKViewer_Actor* theActor,
bool theUpdate )
{
- //myMainWindow->AddActor( theActor, theUpdate );
GetRenderer()->AddActor(theActor);
if(theUpdate)
Repaint();
void SVTK_ViewWindow::RemoveActor( VTKViewer_Actor* theActor,
bool theUpdate )
{
- //myMainWindow->RemoveActor( theActor, theUpdate );
GetRenderer()->RemoveActor(theActor);
if(theUpdate)
Repaint();
*/
QImage SVTK_ViewWindow::dumpView()
{
-// if ( myMainWindow->getToolBar()->testAttribute(Qt::WA_UnderMouse) || myDumpImage.isNull() )
-// return myMainWindow->dumpView();
-
-// return myDumpImage;
QPixmap px = QPixmap::grabWindow( GetInteractor()->winId() );
return px.toImage();
}
*/
void SVTK_ViewWindow::RefreshDumpImage()
{
- //myDumpImage = myMainWindow->dumpView();
QPixmap px = QPixmap::grabWindow( GetInteractor()->winId() );
myDumpImage = px.toImage();
}
*/
bool SVTK_ViewWindow::action( const int accelAction )
{
- // if ( !myMainWindow->hasFocus() )
- // return false;
if ( accelAction == SUIT_Accel::ZoomFit )
onFitAll();
else {
int anEvent = SVTK::convertAction( accelAction );
- //myMainWindow->InvokeEvent( anEvent, 0 );
GetInteractor()->InvokeEvent(anEvent, 0);
}
return true;
getGradAxisVisualParams(aWriter, gradAxesActor->GetZAxisActor2D(), "Z");
}
+ aWriter.writeStartElement("Trihedron");
+ aWriter.writeAttribute("isShown", QString( "%1" ).arg( isTrihedronDisplayed()));
+ aWriter.writeAttribute("Size", QString::number(GetTrihedronSize()));
aWriter.writeEndElement();
- aWriter.writeEndDocument();
-
-// retStr.sprintf( "%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e",
-// pos[0], pos[1], pos[2], focalPnt[0], focalPnt[1], focalPnt[2],
-// viewUp[0], viewUp[1], viewUp[2], parScale, scale[0], scale[1], scale[2] );
-// // save graduated axes parameters
-// if ( SVTK_CubeAxesActor2D* gradAxesActor = GetCubeAxes() ) {
-// retStr += QString( "*%1" ).arg( GetRenderer()->IsCubeAxesDisplayed() );
-// retStr += ::getGradAxisVisualParams( gradAxesActor->GetXAxisActor2D() );
-// retStr += ::getGradAxisVisualParams( gradAxesActor->GetYAxisActor2D() );
-// retStr += ::getGradAxisVisualParams( gradAxesActor->GetZAxisActor2D() );
-// }
+ aWriter.writeEndElement();
+ aWriter.writeEndDocument();
return retStr;
}
setGradAxisVisualParams(aReader, gradAxesActor->GetYAxisActor2D());
else if(aAttr.value("Axis") == "Z")
setGradAxisVisualParams(aReader, gradAxesActor->GetZAxisActor2D());
+ } else if (aReader.name() == "Trihedron") {
+ if (aAttr.value("isShown") == "0")
+ GetTrihedron()->VisibilityOff();
+ else
+ GetTrihedron()->VisibilityOn();
+ SetTrihedronSize(aAttr.value("Size").toString().toDouble());
}
}
}
gradAxesActor->VisibilityOn();
else
gradAxesActor->VisibilityOff();
+
+ if ( paramsLst[14].toUShort() )
+ GetTrihedron()->VisibilityOn();
+ else
+ GetTrihedron()->VisibilityOff();
+
+ SetTrihedronSize(paramsLst[15].toDouble());
}
}
}