Commit 2c9b0d87 authored by Mathieu Westphal's avatar Mathieu Westphal

Improve pqRenderView inheritability

Some custom applications uses their own inherited
version of pqRenderView, this improves the ease to do that
parent 83547f91
......@@ -81,44 +81,44 @@ public:
/**
* Resets the center of rotation to the focal point.
*/
void resetCenterOfRotation();
virtual void resetCenterOfRotation();
/**
* Resets the parallel scale which is used for a parallel
* projection
*/
void resetParallelScale();
virtual void resetParallelScale();
/**
* Get if the orientation axes is visible.
*/
bool getOrientationAxesVisibility() const;
virtual bool getOrientationAxesVisibility() const;
/**
* Get if the orientation axes is interactive.
*/
bool getOrientationAxesInteractivity() const;
virtual bool getOrientationAxesInteractivity() const;
/**
* Get orientation axes label color.
*/
QColor getOrientationAxesLabelColor() const;
virtual QColor getOrientationAxesLabelColor() const;
/**
* Get orientation axes outline color.
*/
QColor getOrientationAxesOutlineColor() const;
virtual QColor getOrientationAxesOutlineColor() const;
/**
* Get whether resetCamera() resets the
* 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.
*/
bool getUseMultipleRepresentationSelection() const
virtual bool getUseMultipleRepresentationSelection() const
{
return this->UseMultipleRepresentationSelection;
}
......@@ -126,12 +126,12 @@ public:
/**
* Get center axes visibility.
*/
bool getCenterAxesVisibility() const;
virtual bool getCenterAxesVisibility() const;
/**
* 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
......@@ -152,19 +152,19 @@ public:
* This method is used by pqLinksModel to link
* interaction undo stack for linked render views.
*/
void linkUndoStack(pqRenderView* other);
void unlinkUndoStack(pqRenderView* other);
virtual void linkUndoStack(pqRenderView* other);
virtual void unlinkUndoStack(pqRenderView* other);
/**
* Clears interaction undo stack of this view
* (and all linked views, if any).
*/
void clearUndoStack();
virtual void clearUndoStack();
/**
* 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);
/**
......@@ -175,13 +175,13 @@ public:
*/
virtual void setCursor(const QCursor&);
public:
/**
* Creates a new surface selection given the rectangle in display
* coordinates.
*/
void selectOnSurface(int rectangle[4], int selectionModifier = pqView::PV_SELECTION_DEFAULT);
void selectPointsOnSurface(
virtual void selectOnSurface(
int rectangle[4], int selectionModifier = pqView::PV_SELECTION_DEFAULT);
virtual void selectPointsOnSurface(
int rectangle[4], int selectionModifier = pqView::PV_SELECTION_DEFAULT);
/**
......@@ -189,40 +189,40 @@ public:
* This will result in firing the picked(pqOutputPort*) signal on successful
* pick.
*/
pqDataRepresentation* pick(int pos[2]);
virtual pqDataRepresentation* pick(int pos[2]);
/**
* Picks the representation at the given position. Furthermore, if the
* picked representation is a multi-block data set the picked block will
* 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
* coordinates.
*/
void selectFrustum(int rectangle[4]);
void selectFrustumPoints(int rectangle[4]);
virtual void selectFrustum(int rectangle[4]);
virtual void selectFrustumPoints(int rectangle[4]);
/**
* Creates a "block" selection given the rectangle in display coordinates.
* 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
* coordinates.
*/
void selectPolygonPoints(
virtual void selectPolygonPoints(
vtkIntArray* polygon, int selectionModifier = pqView::PV_SELECTION_DEFAULT);
/**
* Creates a new surface cells selection given the polygon in display
* coordinates.
*/
void selectPolygonCells(
virtual void selectPolygonCells(
vtkIntArray* polygon, int selectionModifier = pqView::PV_SELECTION_DEFAULT);
signals:
......@@ -231,40 +231,43 @@ signals:
public slots:
// Toggle the orientation axes visibility.
void setOrientationAxesVisibility(bool visible);
virtual void setOrientationAxesVisibility(bool visible);
// Toggle orientation axes interactivity.
void setOrientationAxesInteractivity(bool interactive);
virtual void setOrientationAxesInteractivity(bool interactive);
// Set orientation axes label color.
void setOrientationAxesLabelColor(const QColor&);
virtual void setOrientationAxesLabelColor(const QColor&);
// Set orientation axes outline color.
void setOrientationAxesOutlineColor(const QColor&);
virtual void setOrientationAxesOutlineColor(const QColor&);
// Set the center of rotation. For this to work,
// one should have appropriate interaction style (vtkPVInteractorStyle subclass)
// and camera manipulators that use the center of rotation.
// They are setup correctly by default.
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 x, double y, double z);
virtual void setCenterOfRotation(double xyz[3])
{
this->setCenterOfRotation(xyz[0], xyz[1], xyz[2]);
}
// Set the parallel scale
void setParallelScale(double scale);
virtual void setParallelScale(double scale);
// Toggle center axes visibility.
void setCenterAxesVisibility(bool visible);
virtual void setCenterAxesVisibility(bool visible);
/**
* Get/Set whether resetCamera() resets the
* 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.
*/
void setUseMultipleRepresentationSelection(bool b)
virtual void setUseMultipleRepresentationSelection(bool b)
{
this->UseMultipleRepresentationSelection = b;
}
......@@ -272,65 +275,58 @@ public slots:
/**
* start the link to other view process
*/
void linkToOtherView();
virtual void linkToOtherView();
/**
* Called to undo interaction.
* View modules supporting interaction undo must override this method.
*/
void undo() override;
virtual void undo() override;
/**
* Called to redo interaction.
* 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.
*/
void resetCenterOfRotationIfNeeded() { this->onResetCameraEvent(); }
virtual void resetCenterOfRotationIfNeeded() { this->onResetCameraEvent(); }
/**
* 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
// ResetCameraEvent.
void onResetCameraEvent();
virtual void onResetCameraEvent();
/**
* Called when undo stack changes. We fires appropriate
* undo signals as required by pqView.
*/
void onUndoStackChanged();
/**
* Called when VTK event get trigger to notify that the interaction mode has changed
*/
void onInteractionModeChange();
virtual void onUndoStackChanged();
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.
*/
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
* in camera as a interaction. Must be called with start=true before the
* 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
......@@ -343,20 +339,30 @@ protected:
*/
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:
class pqInternal;
pqInternal* Internal;
void selectOnSurfaceInternal(int rect[4], QList<pqOutputPort*>&, bool select_points,
int selectionModifier, bool select_blocks);
void selectPolygonInternal(vtkIntArray* polygon, QList<pqOutputPort*>&, bool select_points,
int selectionModifier, bool select_blocks);
void emitSelectionSignal(QList<pqOutputPort*>);
void collectSelectionPorts(vtkCollection* selectedRepresentations,
vtkCollection* selectionSources, QList<pqOutputPort*>& pqPorts, int selectionModifier,
bool select_blocks);
void InternalConstructor(vtkSMViewProxy* renModule);
class pqInternal;
pqInternal* Internal;
};
#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