ADD_SUBDIRECTORY(ImageComposer)
ADD_SUBDIRECTORY(GUI_PY)
-# The standalone CADViewer framework
-ADD_SUBDIRECTORY(CADViewer)
-
##
# SALOME object
##
}
#endif
-// //MBS:
-// #ifndef DISABLE_PV3DVIEWER
-// if( vmType == PV3DViewer_ViewModel::Type() )
-// {
-// // if (( viewMgr = dynamic_cast<PV3DViewer_ViewManager*>( getViewManager( vmType, false )))) {
-// // viewMgr->getActiveView()->setFocus();
-// // return 0;
-// // } else {
-// // viewMgr = new PV3DViewer_ViewManager( activeStudy(), desktop() );
-// // }
-//
-// viewMgr = new SPV3D_ViewManager( activeStudy(), desktop() );
-// SPV3D_ViewModel* vm = dynamic_cast<SPV3D_ViewModel*>( viewMgr->getViewModel() );
-// if (vm)
-// {
-// // Initalize all view parameters
-// //vm->setXXX(); // NYI
-//
-// //new LightApp_PV3DSelector(vm, mySelMgr);
-// }
-// }
-// #endif
-
//MBS:
#ifndef DISABLE_PV3DVIEWER
# ifndef DISABLE_SALOMEOBJECT
SALOME_View* theViewFrame )
{
DBG_FUN();
+ SHOW(list);
SALOME_View* vf = theViewFrame ? theViewFrame : GetActiveView();
QStringList::const_iterator it = list.constBegin();
for ( ; it != list.constEnd(); ++it)
if ( vf )
{
- myLastEntry = *it;
+ myLastEntry = *it;
vf->BeforeDisplay( this, prs );
vf->Display( this, prs );
vf->AfterDisplay( this, prs );
#include <set>\r
#include <vector>\r
#ifndef MB_IGNORE_QT\r
-# include <qstring.h>\r
+# include <QString>\r
+# include <QStringList>\r
#endif\r
\r
//---------------------------------------------------------------\r
{\r
DLOG << "[QStr]: " << szName << "=\"" << value.toStdString() << "\"" << std::endl;\r
}\r
+\r
+inline void DumpVar(const char *szName, const QStringList &value)\r
+{\r
+ DLOG << "[QStrLst]: " << szName << "=[len=" << value.length() << "] {";\r
+ bool first = true;\r
+ QStringList::const_iterator it = value.constBegin();\r
+ for ( ; it != value.constEnd(); ++it)\r
+ {\r
+ DLOG << (first ? "" : ",") << "\"" << (*it).toStdString() << "\"";\r
+ first = false;\r
+ }\r
+ DLOG << "}" << std::endl;\r
+}\r
#endif\r
\r
inline void DumpVar(const char *szName, const void* value)\r
virtual void Update( SALOME_Prs2d* );//!< Update SALOME_Prs2d presentation.
// Add new Update() methods here...
- // Axiluary methods called before and after displaying of objects
+ // Auxiliary methods called before and after displaying of objects
virtual void BeforeDisplay( SALOME_View*, const SALOME_OCCPrs* ) {} //! Null body here
virtual void AfterDisplay ( SALOME_View*, const SALOME_OCCPrs* ) {} //! Null body here
virtual void BeforeDisplay( SALOME_View*, const SALOME_VTKPrs* ) {} //! Null body here
virtual void BeforeDisplay( SALOME_View*, const SALOME_Prs2d* ) {} //! Null body here
virtual void AfterDisplay ( SALOME_View*, const SALOME_Prs2d* ) {} //! Null body here
- // Axiluary methods called before and after erasing of objects
+ // Auxiliary methods called before and after erasing of objects
virtual void BeforeErase( SALOME_View*, const SALOME_OCCPrs* ) {} //! Null body here
virtual void AfterErase ( SALOME_View*, const SALOME_OCCPrs* ) {} //! Null body here
virtual void BeforeErase( SALOME_View*, const SALOME_VTKPrs* ) {} //! Null body here
virtual void BeforeErase( SALOME_View*, const SALOME_Prs2d* ) {} //! Null body here
virtual void AfterErase ( SALOME_View*, const SALOME_Prs2d* ) {} //! Null body here
- // Axiluary method called to update visibility state of presentation
+ // Auxiliary method called to update visibility state of presentation
virtual void UpdateVisibility( SALOME_View*, const SALOME_Prs*, bool );
};
INCLUDE(UseQtExt)
+#add_subdirectory(plugins)
+
# --- options ---
# additional include directories
${PTHREAD_INCLUDE_DIR}
${PROJECT_SOURCE_DIR}/src/Qtx
${PROJECT_SOURCE_DIR}/src/SUIT
- # ${PROJECT_SOURCE_DIR}/src/ViewerTools
${PROJECT_SOURCE_DIR}/src/OBJECT
${PROJECT_SOURCE_DIR}/src/Prs
${PROJECT_SOURCE_DIR}/src/PV3DViewer
${PROJECT_SOURCE_DIR}/src/PVViewer
${PROJECT_SOURCE_DIR}/src/PVServerService
)
- # ${PROJECT_SOURCE_DIR}/src/OpenGLUtils
# additional preprocessor / compiler flags
ADD_DEFINITIONS(${QT_DEFINITIONS} ${OpenCASCADE_DEFINITIONS} ${BOOST_DEFINITIONS})
${OpenCASCADE_FoundationClasses_LIBRARIES} ${OpenCASCADE_Visualization_LIBRARIES}
${KERNEL_OpUtil}
qtx suit
- #ViewerTools
SalomeObject SalomePrs PV3DViewer PVViewer PVServerService
ParaView::pqApplicationComponents
ParaView::pqPython
)
- #OpenGLUtils
- # VTK::RenderingAnnotation
- # VTK::ImagingCore
- # VTK::CommonSystem
- # VTK::IOExportGL2PS
# --- headers ---
SPV3D_ViewManager.h
SPV3D_ViewModel.h
SPV3D_ViewWindow.h
- #SPV3D_View.h
)
- # SPV3D_ComboAction.h
- # SPV3D_FontWidget.h
- # SPV3D_GenericRenderWindowInteractor.h
- # SPV3D_RecorderDlg.h
- # SPV3D_PsOptionsDlg.h
- # SPV3D_RenderWindowInteractor.h
- # SPV3D_SetRotationPointDlg.h
- # SPV3D_ViewModelBase.h
- # SPV3D_ViewParameterDlg.h
-
-# header files / to be processed by moc / internal
-# TODO: check for MSVS project
-# SET(_moc_internal_HEADERS
-# )
- # SPV3D_CubeAxesDlg.h
- # SPV3D_NonIsometricDlg.h
- # SPV3D_UpdateRateDlg.h
# header files / no moc processing
SET(_other_HEADERS
SPV3D.h
SPV3D_Prs.h
- #SALOME_Actor.h
)
- # SPV3D_Actor.h
- # SPV3D_AreaPicker.h
- # SPV3D_CubeAxesActor2D.h
- # SPV3D_DeviceActor.h
- # SPV3D_Event.h
- # SPV3D_Functor.h
- # SPV3D_ImageWriter.h
- # SPV3D_ImageWriterMgr.h
- # SPV3D_InteractorStyle.h
- # SPV3D_KeyFreeInteractorStyle.h
- # SPV3D_Recorder.h
- # SPV3D_Renderer.h
- # SPV3D_Selection.h
- # SPV3D_SelectionEvent.h
- # SPV3D_Selector.h
- # SPV3D_SpaceMouse.h
- # SPV3D_Utils.h
- # SPV3D_Hash.h
-
-# header files / no moc processing / internal
-# no processing currently: TODO: check for MSVS project
-# SET(_internal_HEADERS
-# # SPV3D_SelectorDef.h
-# # SPV3D_Trihedron.h
-# # SPV3D_AxesActor.h
-# # SPV3D_AxesWidget.h
-# )
# header files / to install
SET(SPV3D_HEADERS ${_moc_HEADERS} ${_other_HEADERS})
-# --- resources ---
-
-# resource files / to be processed by lrelease
-# SET(_ts_RESOURCES
-# resources/SPV3D_msg_en.ts
-# resources/SPV3D_msg_fr.ts
-# resources/SPV3D_msg_ja.ts
-# resources/SPV3D_images.ts
-# )
-
-# resource files / static
-# SET(_other_RESOURCES
-# # resources/vtk_view_graduated_axes.png
-# # resources/vtk_view_highlight.png
-# # resources/vtk_view_highlight_dyn.png
-# # resources/vtk_view_highlight_off.png
-# # resources/vtk_view_highlight_std.png
-# # resources/vtk_view_parallel.png
-# # resources/vtk_view_parameters.png
-# # resources/vtk_view_perspective.png
-# # resources/vtk_view_recording_pause.png
-# # resources/vtk_view_recording_play.png
-# # resources/vtk_view_recording_start.png
-# # resources/vtk_view_recording_stop.png
-# # resources/vtk_view_rotation_point.png
-# # resources/vtk_view_scaling.png
-# # resources/vtk_view_selection.png
-# # resources/vtk_view_stereo.png
-# # resources/vtk_view_style_switch.png
-# # resources/vtk_view_update_rate.png
-# # resources/vtk_view_zooming_style_switch.png
-# )
-
# --- sources ---
# sources / moc wrappings
SPV3D_ViewManager.cxx
SPV3D_ViewModel.cxx
SPV3D_ViewWindow.cxx
- #SPV3D_View.cxx
- #SALOME_Actor.cxx
)
- #SPV3D_Actor.cxx
- # SPV3D_AreaPicker.cxx
- # SPV3D_ComboAction.cxx
- # SPV3D_CubeAxesActor2D.cxx
- # SPV3D_CubeAxesDlg.cxx
- # SPV3D_DeviceActor.cxx
- # SPV3D_FontWidget.cxx
- # SPV3D_GenericRenderWindowInteractor.cxx
- # SPV3D_ImageWriter.cxx
- # SPV3D_ImageWriterMgr.cxx
- # SPV3D_InteractorStyle.cxx
- # SPV3D_KeyFreeInteractorStyle.cxx
- # SPV3D_NonIsometricDlg.cxx
- # SPV3D_Recorder.cxx
- # SPV3D_RecorderDlg.cxx
- # SPV3D_PsOptionsDlg.cxx
- # SPV3D_RenderWindowInteractor.cxx
- #SPV3D_Renderer.cxx
- #SPV3D_Selector.cxx
- # SPV3D_SetRotationPointDlg.cxx
- # SPV3D_SpaceMouse.cxx
- # SPV3D_Trihedron.cxx
- # SPV3D_UpdateRateDlg.cxx
- # SPV3D_Utils.cxx
- #SPV3D_ViewParameterDlg.cxx
- # SPV3D_AxesActor.cxx
- # SPV3D_AxesWidget.cxx
# sources / to compile
SET(SPV3D_SOURCES ${_other_SOURCES} ${_moc_SOURCES})
connect( theDesktop, SIGNAL( windowActivated( SUIT_ViewWindow* ) ),
this, SLOT( onWindowActivated( SUIT_ViewWindow* ) ) );
+
+ SPV3D_ViewModel *vm = dynamic_cast<SPV3D_ViewModel*>(getViewModel());
+ if (vm)
+ vm->initialize();
}
/*!
#define SPV3D_VIEWMANAGER_H
#include "SUIT_ViewManager.h"
-//#include "PV3DViewer_ViewManager.h"
#include "SPV3D.h"
class SUIT_Desktop;
// #include "PV3DViewer_Algorithm.h"
//#include "PV3DViewer_ViewModel.h"
+#include <pqActiveObjects.h>
+#include <pqApplicationCore.h>
+//#include <pqDoubleRangeDialog.h>
+//#include <pqHeaderView.h>
+#include <pqObjectBuilder.h>
+#include <pqPipelineSource.h>
+#include <pqRenderView.h>
+
+#include <vtkSMPropertyHelper.h>
+#include <vtkSMParaViewPipelineControllerWithRendering.h>
+#include <vtkSMRenderViewProxy.h>
+#include <vtkSMRepresentationProxy.h>
+#include <vtkSMSourceProxy.h>
+
#include "SUIT_ViewModel.h"
#include "SUIT_ViewManager.h"
DBG_FUN();
}
+
+void SPV3D_ViewModel::initialize()
+{
+ DBG_FUN();
+
+ const auto* builder = pqApplicationCore::instance()->getObjectBuilder();
+ QObject::connect(builder, &pqObjectBuilder::sourceCreated, this, &SPV3D_ViewModel::onSourceCreated);
+}
+
+
#if 0
/*! Get data for supported background modes: gradient types, identifiers and supported image formats */
QString SPV3D_ViewModel::backgroundData( QStringList& gradList, QIntList& idList, QIntList& txtList )
void SPV3D_ViewModel::Erase( const SALOME_PV3DPrs* prs, const bool forced )
{
DBG_FUN();
+
+ // NYI - hide a source
+ if(const SPV3D_Prs* aPrs = dynamic_cast<const SPV3D_Prs*>( prs )){
+ if(aPrs->IsNull())
+ return;
+
+ pqObjectBuilder* builder = pqApplicationCore::instance()->getObjectBuilder();
+ pqServer* activeServer = pqActiveObjects::instance().activeServer();
+
+ builder->destroySources(activeServer);
+ }
+
// try do downcast object
// if(const SPV3D_Prs* aPrs = dynamic_cast<const SPV3D_Prs*>( prs )){
// if(aPrs->IsNull())
QTimer::singleShot(500, [svw] () { svw->Repaint(); } );
#endif
}
+
+
+
+//-----------------------------------------------------------------------------
+void SPV3D_ViewModel::onSourceCreated(pqPipelineSource* source)
+{
+ MSGEL("-----> SLOT(onSourceCreated)");
+ DBG_FUN();
+
+ std::string sourceXMLName(source->getSourceProxy()->GetXMLName());
+ SHOW(sourceXMLName);
+ SHOW((sourceXMLName=="CubeSource"));
+ pqObjectBuilder* builder = pqApplicationCore::instance()->getObjectBuilder();
+ if (sourceXMLName == "XMLPolyDataReader" || sourceXMLName == "GeometryGenerator" || sourceXMLName == "ShapeSource" || sourceXMLName == "CubeSource")
+ {
+ if (this->GeometrySource)
+ {
+ if (this->GeometrySource == source) {
+ MSGEL("ERROR: onSourceCreated called more than once for same source!!");
+ }
+ else
+ builder->destroy(this->GeometrySource);
+ }
+ this->GeometrySource = source;
+ }
+ else
+ {
+ qWarning("Unsupported Source");
+ return;
+ }
+ this->showSelectedMode();
+}
+
+//-----------------------------------------------------------------------------
+void SPV3D_ViewModel::showSelectedMode()
+{
+ MSGEL("-----> SLOT(showSelectedMode)");
+ DBG_FUN();
+
+ // Only allow to enter group mode in geometry mode
+ //this->Ui->groupModeCheckBox->setEnabled(this->Ui->modeComboBox->currentIndex() == 0);
+
+ vtkNew<vtkSMParaViewPipelineControllerWithRendering> controller;
+ pqView* activeView = pqActiveObjects::instance().activeView();
+ if (activeView)
+ {
+ if (this->GeometrySource)
+ {
+#if PARAVIEW_VERSION_MINOR <= 10
+ this->GeometrySource->updatePipeline();
+ this->GeometrySource->setModifiedState(pqProxy::UNMODIFIED);
+#endif
+
+ //if (this->Ui->modeComboBox->currentIndex() == 0)
+ {
+ vtkSMSourceProxy *sourceProxy = this->GeometrySource->getSourceProxy();
+ vtkSMViewProxy *viewProxy = activeView->getViewProxy();
+ //const char *representationType = "CADRepresentation";
+ controller->Show(sourceProxy, 0, viewProxy);//, representationType);
+ // controller->Show(
+ // this->GeometrySource->getSourceProxy(), 0, activeView->getViewProxy(), "CADRepresentation");
+ }
+ // else
+ // {
+ // if (!this->MeshSource)
+ // {
+ // this->generateMesh();
+ // }
+ // controller->SetVisibility(this->GeometrySource->getSourceProxy(), 0, activeView->getViewProxy(), false);
+ // }
+
+ }
+// if (this->MeshSource)
+// {
+// #if PARAVIEW_VERSION_MINOR <= 10
+// this->MeshSource->updatePipeline();
+// this->MeshSource->setModifiedState(pqProxy::UNMODIFIED);
+// #endif
+// controller->SetVisibility(this->MeshSource->getSourceProxy(), 0, activeView->getViewProxy(), this->Ui->modeComboBox->currentIndex() == 1);
+// }
+ }
+ activeView->render();
+ activeView->resetDisplay();
+}
class SPV3D_ViewWindow;
class PV3DViewer_Actor;
+class pqPipelineSource;
+class pqCADSelection;
+class pqCADGroupModel;
+
+
//! Extends two interfaces #SPV3D_ViewModelBase and #SALOME_View
class SPV3D_EXPORT SPV3D_ViewModel : public PV3DViewer_ViewModel, public SALOME_View
{
Q_OBJECT
public:
- /*! supported gradient types */
- // enum {
- // HorizontalGradient,
- // VerticalGradient,
- // FirstDiagonalGradient,
- // SecondDiagonalGradient,
- // FirstCornerGradient,
- // SecondCornerGradient,
- // ThirdCornerGradient,
- // FourthCornerGradient,
- // LastGradient = FourthCornerGradient,
- // };
-
- // enum {
- // CrystalEyesType, RedBlueType,
- // InterlacedType, LeftType,
- // RightType, DresdenType,
- // AnaglyphType, CheckerboardType,
- // SplitViewPortHorizontalType
- // };
- // typedef SPV3D_ViewWindow TViewWindow;
-
//! Define string representation of the viewer type
static QString Type() { return "ParaView3D"; }
// static QString backgroundData( QStringList&, QIntList&, QIntList& );
SPV3D_ViewModel();
virtual ~SPV3D_ViewModel();
+ virtual void initialize();
+
//! See #SUIT_ViewModel::createView
virtual SUIT_ViewWindow* createView(SUIT_Desktop*);
//! See #SUIT_ViewModel::getType
virtual QString getType() const { return Type(); }
- // //! Get background color of the viewer [obsolete]
- // QColor backgroundColor() const;
-
- // //! Set background color to the viewer [obsolete]
- // void setBackgroundColor( const QColor& );
-
- // //! Get background color of the viewer
- // Qtx::BackgroundData background() const;
-
- // //! Set background color to the viewer
- // void setBackground( const Qtx::BackgroundData& );
-
- // //! Get size of trihedron of the viewer (see #SPV3D_Renderer::SetTrihedronSize)
- // double trihedronSize() const;
-
- // //! Shows if the size of trihedron relative (see #SPV3D_Renderer::SetTrihedronSize)
- // bool trihedronRelative() const;
-
- // //! Set size of trihedron of the viewer (see #SPV3D_Renderer::SetTrihedronSize)
- // void setTrihedronSize( const double, const bool = true );
-
- // //! Get visibility status of the static trihedron
- // bool isStaticTrihedronVisible() const;
-
- // //! Set visibility status of the static trihedron
- // void setStaticTrihedronVisible( const bool );
-
- // //! Gets projection mode
- // int projectionMode() const;
-
- // //! Sets projection mode
- // void setProjectionMode( const int );
-
- // //! Gets stereo type
- // int stereoType() const;
-
- // //! Sets stereo type
- // void setStereoType( const int );
-
- // //! Gets anaglyph filter
- // int anaglyphFilter() const;
-
- // //! Sets anaglyph filter
- // void setAnaglyphFilter( const int );
-
- // //! Get support quad-buffered stereo
- // bool isQuadBufferSupport() const;
-
- // //! Set support quad-buffered stereo
- // void setQuadBufferSupport( const bool );
-
- // //! Gets interaction style
- // int interactionStyle() const;
-
- // //! Sets interaction style
- // void setInteractionStyle( const int );
-
- // //! Gets zooming style
- // int zoomingStyle() const;
-
- // //! Sets zooming style
- // void setZoomingStyle( const int );
-
- // //! Gets current preselection mode (standard, dynamic or disabled)
- // Preselection_Mode preSelectionMode() const;
-
- // //! Sets new preselection mode
- // void setPreSelectionMode( Preselection_Mode );
-
- // //! Get incremental speed (see #SPV3D_InteractorStyle::ControllerIncrement)
- // int incrementalSpeed() const;
-
- // //! Returns modification mode of incremental speed (see #SPV3D_InteractorStyle::ControllerIncrement)
- // int incrementalSpeedMode() const;
-
- // //! Set the incremental speed for view operation (see #SPV3D_InteractorStyle::ControllerIncrement)
- // void setIncrementalSpeed( const int, const int = 0 );
-
- // //! Gets spacemouse button for specified function
- // int spacemouseBtn( const int ) const;
-
- // //! Sets spacemouse buttons
- // void setSpacemouseButtons( const int, const int, const int );
-
public:
void enableSelection(bool isEnabled);
bool isSelectionEnabled() const { return mySelectionEnabled; }
- // void enableMultiselection(bool isEnable);
- // bool isMultiSelectionEnabled() const { return myMultiSelectionEnabled; }
-
- // int getSelectionCount() const;
-
/* Reimplemented from SALOME_View */
//! See #SALOME_View::Display( const SALOME_Prs* )
//! See #SALOME_View::Repaint()
virtual void Repaint();
-// signals:
-// void actorAdded(SPV3D_ViewWindow*, PV3DViewer_Actor*);
-// void actorRemoved(SPV3D_ViewWindow*, PV3DViewer_Actor*);
-
protected slots:
void onMousePress(SUIT_ViewWindow*, QMouseEvent*);
void onMouseMove(SUIT_ViewWindow*, QMouseEvent*);
void onMouseRelease(SUIT_ViewWindow*, QMouseEvent*);
- // void onDumpView();
- // void onChangeBackground();
+ void onViewCreated( SUIT_ViewWindow* );
- // void onActorAdded(PV3DViewer_Actor*);
- // void onActorRemoved(PV3DViewer_Actor*);
+ void onSourceCreated(pqPipelineSource* source);
+ void showSelectedMode();
- void onViewCreated( SUIT_ViewWindow* );
+protected:
+ pqPipelineSource* GeometrySource = nullptr;
+ pqPipelineSource* MeshSource = nullptr;
private:
- // void updateToolBars();
+ pqCADSelection* selection;
+ pqCADGroupModel* GroupModel;
+ int GroupCounter = 0;
- // Qtx::BackgroundData myDefaultBackground;
- // double myTrihedronSize;
- // bool myTrihedronRelative;
- // bool myIsStaticTrihedronVisible;
+private:
bool mySelectionEnabled;
- // bool myMultiSelectionEnabled;
- // int myIncrementSpeed;
- // int myIncrementMode;
- // int myProjMode;
- // int myStereoType;
- // int myAnaglyphFilter;
- // bool myQuadBufferSupport;
- // int myStyle;
- // int myZoomingStyle;
- // Preselection_Mode myPreSelectionMode;
- // int mySpaceBtn[3];
};
#endif