Commit bd787e51 authored by Mathieu Westphal's avatar Mathieu Westphal Committed by Kitware Robot

Merge topic 'ImprovepqRenderViewInheritability'

2c9b0d87 Improve pqRenderView inheritability
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Acked-by: Michael Migliore's avatarMichael Migliore <michael.migliore@kitware.com>
Acked-by: Nicolas Vuaille's avatarNicolas Vuaille <nicolas.vuaille@kitware.com>
Acked-by: Joachim Pouderoux's avatarJoachim Pouderoux <joachim.pouderoux@kitware.com>
Merge-request: !2578
parents abafa451 2c9b0d87
Pipeline #109400 failed with stage
in 0 seconds
...@@ -81,44 +81,44 @@ public: ...@@ -81,44 +81,44 @@ public:
/** /**
* Resets the center of rotation to the focal point. * Resets the center of rotation to the focal point.
*/ */
void resetCenterOfRotation(); virtual void resetCenterOfRotation();
/** /**
* Resets the parallel scale which is used for a parallel * Resets the parallel scale which is used for a parallel
* projection * projection
*/ */
void resetParallelScale(); virtual void resetParallelScale();
/** /**
* Get if the orientation axes is visible. * Get if the orientation axes is visible.
*/ */
bool getOrientationAxesVisibility() const; virtual bool getOrientationAxesVisibility() const;
/** /**
* Get if the orientation axes is interactive. * Get if the orientation axes is interactive.
*/ */
bool getOrientationAxesInteractivity() const; virtual bool getOrientationAxesInteractivity() const;
/** /**
* Get orientation axes label color. * Get orientation axes label color.
*/ */
QColor getOrientationAxesLabelColor() const; virtual QColor getOrientationAxesLabelColor() const;
/** /**
* Get orientation axes outline color. * Get orientation axes outline color.
*/ */
QColor getOrientationAxesOutlineColor() const; virtual QColor getOrientationAxesOutlineColor() const;
/** /**
* Get whether resetCamera() resets the * Get whether resetCamera() resets the
* center of rotation as well. * center of rotation as well.
*/ */
bool getResetCenterWithCamera() const { return this->ResetCenterWithCamera; } virtual bool getResetCenterWithCamera() const { return this->ResetCenterWithCamera; }
/** /**
* Get whether selection will be done on multiple representations. * Get whether selection will be done on multiple representations.
*/ */
bool getUseMultipleRepresentationSelection() const virtual bool getUseMultipleRepresentationSelection() const
{ {
return this->UseMultipleRepresentationSelection; return this->UseMultipleRepresentationSelection;
} }
...@@ -126,12 +126,12 @@ public: ...@@ -126,12 +126,12 @@ public:
/** /**
* Get center axes visibility. * Get center axes visibility.
*/ */
bool getCenterAxesVisibility() const; virtual bool getCenterAxesVisibility() const;
/** /**
* Get the current center of rotation. * Get the current center of rotation.
*/ */
void getCenterOfRotation(double center[3]) const; virtual void getCenterOfRotation(double center[3]) const;
/** /**
* Returns if this view module can support * Returns if this view module can support
...@@ -152,19 +152,19 @@ public: ...@@ -152,19 +152,19 @@ public:
* This method is used by pqLinksModel to link * This method is used by pqLinksModel to link
* interaction undo stack for linked render views. * interaction undo stack for linked render views.
*/ */
void linkUndoStack(pqRenderView* other); virtual void linkUndoStack(pqRenderView* other);
void unlinkUndoStack(pqRenderView* other); virtual void unlinkUndoStack(pqRenderView* other);
/** /**
* Clears interaction undo stack of this view * Clears interaction undo stack of this view
* (and all linked views, if any). * (and all linked views, if any).
*/ */
void clearUndoStack(); virtual void clearUndoStack();
/** /**
* Reset camera view direction * Reset camera view direction
*/ */
void resetViewDirection( virtual void resetViewDirection(
double look_x, double look_y, double look_z, double up_x, double up_y, double up_z); double look_x, double look_y, double look_z, double up_x, double up_y, double up_z);
/** /**
...@@ -175,13 +175,13 @@ public: ...@@ -175,13 +175,13 @@ public:
*/ */
virtual void setCursor(const QCursor&); virtual void setCursor(const QCursor&);
public:
/** /**
* Creates a new surface selection given the rectangle in display * Creates a new surface selection given the rectangle in display
* coordinates. * coordinates.
*/ */
void selectOnSurface(int rectangle[4], int selectionModifier = pqView::PV_SELECTION_DEFAULT); virtual void selectOnSurface(
void selectPointsOnSurface( int rectangle[4], int selectionModifier = pqView::PV_SELECTION_DEFAULT);
virtual void selectPointsOnSurface(
int rectangle[4], int selectionModifier = pqView::PV_SELECTION_DEFAULT); int rectangle[4], int selectionModifier = pqView::PV_SELECTION_DEFAULT);
/** /**
...@@ -189,40 +189,40 @@ public: ...@@ -189,40 +189,40 @@ public:
* This will result in firing the picked(pqOutputPort*) signal on successful * This will result in firing the picked(pqOutputPort*) signal on successful
* pick. * pick.
*/ */
pqDataRepresentation* pick(int pos[2]); virtual pqDataRepresentation* pick(int pos[2]);
/** /**
* Picks the representation at the given position. Furthermore, if the * Picks the representation at the given position. Furthermore, if the
* picked representation is a multi-block data set the picked block will * picked representation is a multi-block data set the picked block will
* be returned in the flatIndex variable. * be returned in the flatIndex variable.
*/ */
pqDataRepresentation* pickBlock(int pos[2], unsigned int& flatIndex); virtual pqDataRepresentation* pickBlock(int pos[2], unsigned int& flatIndex);
/** /**
* Creates a new frustum selection given the rectangle in display * Creates a new frustum selection given the rectangle in display
* coordinates. * coordinates.
*/ */
void selectFrustum(int rectangle[4]); virtual void selectFrustum(int rectangle[4]);
void selectFrustumPoints(int rectangle[4]); virtual void selectFrustumPoints(int rectangle[4]);
/** /**
* Creates a "block" selection given the rectangle in display coordinates. * Creates a "block" selection given the rectangle in display coordinates.
* block selection is selection of a block in a composite dataset. * block selection is selection of a block in a composite dataset.
*/ */
void selectBlock(int rectangle[4], int selectionModifier = pqView::PV_SELECTION_DEFAULT); virtual void selectBlock(int rectangle[4], int selectionModifier = pqView::PV_SELECTION_DEFAULT);
/** /**
* Creates a new surface points selection given the polygon in display * Creates a new surface points selection given the polygon in display
* coordinates. * coordinates.
*/ */
void selectPolygonPoints( virtual void selectPolygonPoints(
vtkIntArray* polygon, int selectionModifier = pqView::PV_SELECTION_DEFAULT); vtkIntArray* polygon, int selectionModifier = pqView::PV_SELECTION_DEFAULT);
/** /**
* Creates a new surface cells selection given the polygon in display * Creates a new surface cells selection given the polygon in display
* coordinates. * coordinates.
*/ */
void selectPolygonCells( virtual void selectPolygonCells(
vtkIntArray* polygon, int selectionModifier = pqView::PV_SELECTION_DEFAULT); vtkIntArray* polygon, int selectionModifier = pqView::PV_SELECTION_DEFAULT);
signals: signals:
...@@ -231,40 +231,43 @@ signals: ...@@ -231,40 +231,43 @@ signals:
public slots: public slots:
// Toggle the orientation axes visibility. // Toggle the orientation axes visibility.
void setOrientationAxesVisibility(bool visible); virtual void setOrientationAxesVisibility(bool visible);
// Toggle orientation axes interactivity. // Toggle orientation axes interactivity.
void setOrientationAxesInteractivity(bool interactive); virtual void setOrientationAxesInteractivity(bool interactive);
// Set orientation axes label color. // Set orientation axes label color.
void setOrientationAxesLabelColor(const QColor&); virtual void setOrientationAxesLabelColor(const QColor&);
// Set orientation axes outline color. // Set orientation axes outline color.
void setOrientationAxesOutlineColor(const QColor&); virtual void setOrientationAxesOutlineColor(const QColor&);
// Set the center of rotation. For this to work, // Set the center of rotation. For this to work,
// one should have appropriate interaction style (vtkPVInteractorStyle subclass) // one should have appropriate interaction style (vtkPVInteractorStyle subclass)
// and camera manipulators that use the center of rotation. // and camera manipulators that use the center of rotation.
// They are setup correctly by default. // They are setup correctly by default.
void setCenterOfRotation(double x, double y, double z); virtual void setCenterOfRotation(double x, double y, double z);
void setCenterOfRotation(double xyz[3]) { this->setCenterOfRotation(xyz[0], xyz[1], xyz[2]); } virtual void setCenterOfRotation(double xyz[3])
{
this->setCenterOfRotation(xyz[0], xyz[1], xyz[2]);
}
// Set the parallel scale // Set the parallel scale
void setParallelScale(double scale); virtual void setParallelScale(double scale);
// Toggle center axes visibility. // Toggle center axes visibility.
void setCenterAxesVisibility(bool visible); virtual void setCenterAxesVisibility(bool visible);
/** /**
* Get/Set whether resetCamera() resets the * Get/Set whether resetCamera() resets the
* center of rotation as well. * center of rotation as well.
*/ */
void setResetCenterWithCamera(bool b) { this->ResetCenterWithCamera = b; } virtual void setResetCenterWithCamera(bool b) { this->ResetCenterWithCamera = b; }
/** /**
* Set whether selection will be done on multiple representations. * Set whether selection will be done on multiple representations.
*/ */
void setUseMultipleRepresentationSelection(bool b) virtual void setUseMultipleRepresentationSelection(bool b)
{ {
this->UseMultipleRepresentationSelection = b; this->UseMultipleRepresentationSelection = b;
} }
...@@ -272,65 +275,58 @@ public slots: ...@@ -272,65 +275,58 @@ public slots:
/** /**
* start the link to other view process * start the link to other view process
*/ */
void linkToOtherView(); virtual void linkToOtherView();
/** /**
* Called to undo interaction. * Called to undo interaction.
* View modules supporting interaction undo must override this method. * View modules supporting interaction undo must override this method.
*/ */
void undo() override; virtual void undo() override;
/** /**
* Called to redo interaction. * Called to redo interaction.
* View modules supporting interaction undo must override this method. * View modules supporting interaction undo must override this method.
*/ */
void redo() override; virtual void redo() override;
/** /**
* Resets center of rotation if this->ResetCenterWithCamera is true. * Resets center of rotation if this->ResetCenterWithCamera is true.
*/ */
void resetCenterOfRotationIfNeeded() { this->onResetCameraEvent(); } virtual void resetCenterOfRotationIfNeeded() { this->onResetCameraEvent(); }
/** /**
* Try to provide the best view orientation and interaction mode * Try to provide the best view orientation and interaction mode
*/ */
void updateInteractionMode(pqOutputPort* opPort); virtual void updateInteractionMode(pqOutputPort* opPort);
protected slots:
/**
* Called when VTK event get trigger to notify that the interaction mode has changed
*/
virtual void onInteractionModeChange();
private slots:
// Called when vtkSMRenderViewProxy fires // Called when vtkSMRenderViewProxy fires
// ResetCameraEvent. // ResetCameraEvent.
void onResetCameraEvent(); virtual void onResetCameraEvent();
/** /**
* Called when undo stack changes. We fires appropriate * Called when undo stack changes. We fires appropriate
* undo signals as required by pqView. * undo signals as required by pqView.
*/ */
void onUndoStackChanged(); virtual void onUndoStackChanged();
/**
* Called when VTK event get trigger to notify that the interaction mode has changed
*/
void onInteractionModeChange();
protected: protected:
// When true, the camera center of rotation will be reset when the
// user reset the camera.
bool ResetCenterWithCamera;
// When true, the selection will be performed on all representations.
bool UseMultipleRepresentationSelection;
/** /**
* Updates undo stack without actually performing the undo/redo actions. * Updates undo stack without actually performing the undo/redo actions.
*/ */
void fakeUndoRedo(bool redo, bool self); virtual void fakeUndoRedo(bool redo, bool self);
/** /**
* Updates undo stack of all linked views to record a programmatic change * Updates undo stack of all linked views to record a programmatic change
* in camera as a interaction. Must be called with start=true before the * in camera as a interaction. Must be called with start=true before the
* change and with start=false after the change. * change and with start=false after the change.
*/ */
void fakeInteraction(bool start); virtual void fakeInteraction(bool start);
/** /**
* Creates a new instance of the QWidget subclass to be used to show this * Creates a new instance of the QWidget subclass to be used to show this
...@@ -343,20 +339,30 @@ protected: ...@@ -343,20 +339,30 @@ protected:
*/ */
void initialize() override; void initialize() override;
// When true, the camera center of rotation will be reset when the
// user reset the camera.
bool ResetCenterWithCamera;
// When true, the selection will be performed on all representations.
bool UseMultipleRepresentationSelection;
private: private:
class pqInternal;
pqInternal* Internal;
void selectOnSurfaceInternal(int rect[4], QList<pqOutputPort*>&, bool select_points, void selectOnSurfaceInternal(int rect[4], QList<pqOutputPort*>&, bool select_points,
int selectionModifier, bool select_blocks); int selectionModifier, bool select_blocks);
void selectPolygonInternal(vtkIntArray* polygon, QList<pqOutputPort*>&, bool select_points, void selectPolygonInternal(vtkIntArray* polygon, QList<pqOutputPort*>&, bool select_points,
int selectionModifier, bool select_blocks); int selectionModifier, bool select_blocks);
void emitSelectionSignal(QList<pqOutputPort*>); void emitSelectionSignal(QList<pqOutputPort*>);
void collectSelectionPorts(vtkCollection* selectedRepresentations, void collectSelectionPorts(vtkCollection* selectedRepresentations,
vtkCollection* selectionSources, QList<pqOutputPort*>& pqPorts, int selectionModifier, vtkCollection* selectionSources, QList<pqOutputPort*>& pqPorts, int selectionModifier,
bool select_blocks); bool select_blocks);
void InternalConstructor(vtkSMViewProxy* renModule); void InternalConstructor(vtkSMViewProxy* renModule);
class pqInternal;
pqInternal* Internal;
}; };
#endif #endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment