0031658: Inspector - using AIS_ViewController in View package
- View: using AIS_ViewController, AIS_ViewCube.
@ -57,7 +57,6 @@
|
|||||||
#include <inspector/View_Displayer.hxx>
|
#include <inspector/View_Displayer.hxx>
|
||||||
#include <inspector/View_ToolBar.hxx>
|
#include <inspector/View_ToolBar.hxx>
|
||||||
#include <inspector/View_Viewer.hxx>
|
#include <inspector/View_Viewer.hxx>
|
||||||
#include <inspector/View_Widget.hxx>
|
|
||||||
#include <inspector/View_Window.hxx>
|
#include <inspector/View_Window.hxx>
|
||||||
|
|
||||||
#include <TDF_Tool.hxx>
|
#include <TDF_Tool.hxx>
|
||||||
@ -194,7 +193,7 @@ DFBrowser_Window::DFBrowser_Window()
|
|||||||
|
|
||||||
// view
|
// view
|
||||||
myViewWindow = new View_Window (myMainWindow);
|
myViewWindow = new View_Window (myMainWindow);
|
||||||
myViewWindow->ViewWidget()->SetPredefinedSize (DFBROWSER_DEFAULT_VIEW_WIDTH, DFBROWSER_DEFAULT_VIEW_HEIGHT);
|
myViewWindow->SetPredefinedSize (DFBROWSER_DEFAULT_VIEW_WIDTH, DFBROWSER_DEFAULT_VIEW_HEIGHT);
|
||||||
|
|
||||||
QDockWidget* aViewDockWidget = new QDockWidget (tr ("View"), myMainWindow);
|
QDockWidget* aViewDockWidget = new QDockWidget (tr ("View"), myMainWindow);
|
||||||
aViewDockWidget->setObjectName (aViewDockWidget->windowTitle());
|
aViewDockWidget->setObjectName (aViewDockWidget->windowTitle());
|
||||||
|
@ -31,7 +31,6 @@
|
|||||||
#include <inspector/View_Displayer.hxx>
|
#include <inspector/View_Displayer.hxx>
|
||||||
#include <inspector/View_PresentationType.hxx>
|
#include <inspector/View_PresentationType.hxx>
|
||||||
#include <inspector/View_ToolBar.hxx>
|
#include <inspector/View_ToolBar.hxx>
|
||||||
#include <inspector/View_Widget.hxx>
|
|
||||||
#include <inspector/View_Window.hxx>
|
#include <inspector/View_Window.hxx>
|
||||||
#include <inspector/View_Viewer.hxx>
|
#include <inspector/View_Viewer.hxx>
|
||||||
|
|
||||||
@ -129,7 +128,7 @@ ShapeView_Window::ShapeView_Window (QWidget* theParent)
|
|||||||
connect (myViewWindow, SIGNAL(eraseAllPerformed()), this, SLOT(onEraseAllPerformed()));
|
connect (myViewWindow, SIGNAL(eraseAllPerformed()), this, SLOT(onEraseAllPerformed()));
|
||||||
aVisibilityState->SetDisplayer (myViewWindow->Displayer());
|
aVisibilityState->SetDisplayer (myViewWindow->Displayer());
|
||||||
aVisibilityState->SetPresentationType (View_PresentationType_Main);
|
aVisibilityState->SetPresentationType (View_PresentationType_Main);
|
||||||
myViewWindow->ViewWidget()->SetPredefinedSize (SHAPEVIEW_DEFAULT_VIEW_WIDTH, SHAPEVIEW_DEFAULT_VIEW_HEIGHT);
|
myViewWindow->SetPredefinedSize (SHAPEVIEW_DEFAULT_VIEW_WIDTH, SHAPEVIEW_DEFAULT_VIEW_HEIGHT);
|
||||||
|
|
||||||
QDockWidget* aViewDockWidget = new QDockWidget (tr ("View"), myMainWindow);
|
QDockWidget* aViewDockWidget = new QDockWidget (tr ("View"), myMainWindow);
|
||||||
aViewDockWidget->setObjectName (aViewDockWidget->windowTitle());
|
aViewDockWidget->setObjectName (aViewDockWidget->windowTitle());
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
#include <AIS_Shape.hxx>
|
#include <AIS_Shape.hxx>
|
||||||
#include <BRepBuilderAPI_MakeVertex.hxx>
|
#include <BRepBuilderAPI_MakeVertex.hxx>
|
||||||
|
#include <V3d_Viewer.hxx>
|
||||||
|
|
||||||
#include <inspector/Convert_Tools.hxx>
|
#include <inspector/Convert_Tools.hxx>
|
||||||
|
|
||||||
@ -48,6 +49,7 @@
|
|||||||
#include <inspector/View_PreviewParameters.hxx>
|
#include <inspector/View_PreviewParameters.hxx>
|
||||||
#include <inspector/View_Widget.hxx>
|
#include <inspector/View_Widget.hxx>
|
||||||
#include <inspector/View_Window.hxx>
|
#include <inspector/View_Window.hxx>
|
||||||
|
#include <inspector/View_Viewer.hxx>
|
||||||
|
|
||||||
#include <Standard_WarningsDisable.hxx>
|
#include <Standard_WarningsDisable.hxx>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
@ -892,7 +894,7 @@ Handle(AIS_InteractiveContext) VInspector_Window::createView()
|
|||||||
Handle(AIS_InteractiveContext) aContext = View_Viewer::CreateStandardViewer();
|
Handle(AIS_InteractiveContext) aContext = View_Viewer::CreateStandardViewer();
|
||||||
|
|
||||||
myViewWindow = new View_Window (0, aContext, false /*for opening several BREP files*/, true);
|
myViewWindow = new View_Window (0, aContext, false /*for opening several BREP files*/, true);
|
||||||
myViewWindow->ViewWidget()->SetPredefinedSize (VINSPECTOR_DEFAULT_VIEW_WIDTH, VINSPECTOR_DEFAULT_VIEW_HEIGHT);
|
myViewWindow->SetPredefinedSize (VINSPECTOR_DEFAULT_VIEW_WIDTH, VINSPECTOR_DEFAULT_VIEW_HEIGHT);
|
||||||
myViewWindow->move (VINSPECTOR_DEFAULT_VIEW_POSITION_X, VINSPECTOR_DEFAULT_VIEW_POSITION_Y);
|
myViewWindow->move (VINSPECTOR_DEFAULT_VIEW_POSITION_X, VINSPECTOR_DEFAULT_VIEW_POSITION_Y);
|
||||||
myViewWindow->show();
|
myViewWindow->show();
|
||||||
|
|
||||||
|
@ -1,18 +1,13 @@
|
|||||||
<!DOCTYPE RCC><RCC version="1.0">
|
<!DOCTYPE RCC><RCC version="1.0">
|
||||||
<qresource>
|
<qresource>
|
||||||
<file>icons/cursor_rotate.png</file>
|
|
||||||
<file>icons/cursor_zoom.png</file>
|
|
||||||
<file>icons/keep_view_off.png</file>
|
<file>icons/keep_view_off.png</file>
|
||||||
<file>icons/keep_view_on.png</file>
|
<file>icons/keep_view_on.png</file>
|
||||||
<file>icons/trihedron.png</file>
|
<file>icons/trihedron.png</file>
|
||||||
<file>icons/view_clear.png</file>
|
<file>icons/view_clear.png</file>
|
||||||
|
<file>icons/view_cube.png</file>
|
||||||
<file>icons/view_dm_shading.png</file>
|
<file>icons/view_dm_shading.png</file>
|
||||||
<file>icons/view_dm_wireframe.png</file>
|
<file>icons/view_dm_wireframe.png</file>
|
||||||
<file>icons/view_fitall.png</file>
|
<file>icons/view_fitall.png</file>
|
||||||
<file>icons/view_fitarea.png</file>
|
|
||||||
<file>icons/view_pan.png</file>
|
|
||||||
<file>icons/view_rotate.png</file>
|
|
||||||
<file>icons/view_zoom.png</file>
|
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#include <AIS_ListIteratorOfListOfInteractive.hxx>
|
#include <AIS_ListIteratorOfListOfInteractive.hxx>
|
||||||
#include <AIS_Shape.hxx>
|
#include <AIS_Shape.hxx>
|
||||||
#include <AIS_Trihedron.hxx>
|
#include <AIS_Trihedron.hxx>
|
||||||
|
#include <AIS_ViewCube.hxx>
|
||||||
#include <Geom_Axis2Placement.hxx>
|
#include <Geom_Axis2Placement.hxx>
|
||||||
#include <Prs3d_PointAspect.hxx>
|
#include <Prs3d_PointAspect.hxx>
|
||||||
#include <V3d_View.hxx>
|
#include <V3d_View.hxx>
|
||||||
@ -230,6 +231,28 @@ void View_Displayer::DisplayDefaultTrihedron (const Standard_Boolean toDisplay,
|
|||||||
GetContext()->Erase (aTrihedron, theToUpdateViewer);
|
GetContext()->Erase (aTrihedron, theToUpdateViewer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// =======================================================================
|
||||||
|
// function : DisplayViewCube
|
||||||
|
// purpose :
|
||||||
|
// =======================================================================
|
||||||
|
void View_Displayer::DisplayViewCube (const Standard_Boolean toDisplay, const bool theToUpdateViewer)
|
||||||
|
{
|
||||||
|
if (myViewCube.IsNull() && toDisplay)
|
||||||
|
{
|
||||||
|
myViewCube = new AIS_ViewCube();
|
||||||
|
myViewCube->SetSize (35.0);
|
||||||
|
myViewCube->SetBoxColor (Quantity_NOC_GRAY50);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (myViewCube.IsNull())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (toDisplay)
|
||||||
|
GetContext()->Display (myViewCube, theToUpdateViewer);
|
||||||
|
else
|
||||||
|
GetContext()->Erase (myViewCube, theToUpdateViewer);
|
||||||
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
// function : SetVisible
|
// function : SetVisible
|
||||||
// purpose :
|
// purpose :
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
#include <inspector/View_DisplayActionType.hxx>
|
#include <inspector/View_DisplayActionType.hxx>
|
||||||
|
|
||||||
class AIS_Trihedron;
|
class AIS_Trihedron;
|
||||||
|
class AIS_ViewCube;
|
||||||
class V3d_View;
|
class V3d_View;
|
||||||
class View_DisplayPreview;
|
class View_DisplayPreview;
|
||||||
|
|
||||||
@ -121,6 +122,11 @@ public:
|
|||||||
//! \param isToUpdateView boolean state if viewer should be updated
|
//! \param isToUpdateView boolean state if viewer should be updated
|
||||||
Standard_EXPORT void DisplayDefaultTrihedron (const Standard_Boolean toDisplay, const bool theToUpdateViewer);
|
Standard_EXPORT void DisplayDefaultTrihedron (const Standard_Boolean toDisplay, const bool theToUpdateViewer);
|
||||||
|
|
||||||
|
//! Displays presentation of view cube, create it by the first call
|
||||||
|
//! \param toDisplay flag to display presentation if true, or erase it
|
||||||
|
//! \param isToUpdateView boolean state if viewer should be updated
|
||||||
|
Standard_EXPORT void DisplayViewCube (const Standard_Boolean toDisplay, const bool theToUpdateViewer);
|
||||||
|
|
||||||
//! Sets shape visible/invisible
|
//! Sets shape visible/invisible
|
||||||
//! \theShape shape instance
|
//! \theShape shape instance
|
||||||
//! \theState visibility state
|
//! \theState visibility state
|
||||||
@ -186,7 +192,8 @@ private:
|
|||||||
View_DisplayPreview* myDisplayPreview; //!< class for preview display
|
View_DisplayPreview* myDisplayPreview; //!< class for preview display
|
||||||
|
|
||||||
Handle(AIS_InteractiveContext) myContext; //!< context, where the displayer works
|
Handle(AIS_InteractiveContext) myContext; //!< context, where the displayer works
|
||||||
Handle(AIS_Trihedron) myDefaultTrihedron; //!< NULL presentation until the first display
|
Handle(AIS_Trihedron) myDefaultTrihedron; //!< trihedron presentation for the current context
|
||||||
|
Handle(AIS_ViewCube) myViewCube; //!< view cube presentation for current context
|
||||||
|
|
||||||
NCollection_DataMap<View_PresentationType, NCollection_Shared<AIS_ListOfInteractive>> myDisplayed; //!< visualized presentations
|
NCollection_DataMap<View_PresentationType, NCollection_Shared<AIS_ListOfInteractive>> myDisplayed; //!< visualized presentations
|
||||||
NCollection_DataMap<View_PresentationType, Quantity_Color> myColorAttributes; //!< color properties of presentations
|
NCollection_DataMap<View_PresentationType, Quantity_Color> myColorAttributes; //!< color properties of presentations
|
||||||
|
@ -22,7 +22,8 @@ enum View_ToolActionType
|
|||||||
View_ToolActionType_KeepViewId, //!< Do not clear previously shown presentations
|
View_ToolActionType_KeepViewId, //!< Do not clear previously shown presentations
|
||||||
View_ToolActionType_KeepViewOffId, //!< Do show only for new displayed presentation
|
View_ToolActionType_KeepViewOffId, //!< Do show only for new displayed presentation
|
||||||
View_ToolActionType_ClearViewId, //!< Erase all displayed presentations
|
View_ToolActionType_ClearViewId, //!< Erase all displayed presentations
|
||||||
View_ToolActionType_Trihedron //!< Display/Erase trihedron presentation
|
View_ToolActionType_Trihedron, //!< Display/Erase trihedron presentation
|
||||||
|
View_ToolActionType_ViewCube //!< Display/Erase view cube presentation
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -69,6 +69,13 @@ View_ToolBar::View_ToolBar (QWidget* theParent, const bool isUseKeepView)
|
|||||||
myActionsMap[View_ToolActionType_Trihedron]->setCheckable (true);
|
myActionsMap[View_ToolActionType_Trihedron]->setCheckable (true);
|
||||||
myActionsMap[View_ToolActionType_Trihedron]->setChecked (false);
|
myActionsMap[View_ToolActionType_Trihedron]->setChecked (false);
|
||||||
|
|
||||||
|
myActionsMap[View_ToolActionType_ViewCube] = new QToolButton (theParent);
|
||||||
|
myActionsMap[View_ToolActionType_ViewCube]->setIcon (QIcon (":/icons/view_cube.png"));
|
||||||
|
myActionsMap[View_ToolActionType_ViewCube]->setToolTip (tr ("View Cube display"));
|
||||||
|
myActionsMap[View_ToolActionType_ViewCube]->setCheckable (true);
|
||||||
|
myActionsMap[View_ToolActionType_ViewCube]->setChecked (false);
|
||||||
|
|
||||||
|
|
||||||
if (isUseKeepView)
|
if (isUseKeepView)
|
||||||
{
|
{
|
||||||
myActionsMap[View_ToolActionType_KeepViewId] = new QToolButton (theParent);
|
myActionsMap[View_ToolActionType_KeepViewId] = new QToolButton (theParent);
|
||||||
|
@ -19,11 +19,7 @@
|
|||||||
//! Actions of view widget
|
//! Actions of view widget
|
||||||
enum View_ViewActionType
|
enum View_ViewActionType
|
||||||
{
|
{
|
||||||
View_ViewActionType_FitAllId, //!< fits the view to wrap the bounding box of displayed objects
|
View_ViewActionType_FitAllId, //!< fits the view to wrap the bounding box of displayed objects
|
||||||
View_ViewActionType_FitAreaId, //!< zoom the view to the given area
|
|
||||||
View_ViewActionType_ZoomId, //!< zoom in/out the view by some delta
|
|
||||||
View_ViewActionType_PanId, //!< move position of the view camera
|
|
||||||
View_ViewActionType_RotationId, //!< rotate the view
|
|
||||||
View_ViewActionType_DisplayModeId //!< change display mode of visualized presentations (to wireframe or shading)
|
View_ViewActionType_DisplayModeId //!< change display mode of visualized presentations (to wireframe or shading)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
#include <inspector/View_Widget.hxx>
|
#include <inspector/View_Widget.hxx>
|
||||||
|
|
||||||
|
#include <AIS_ViewController.hxx>
|
||||||
#include <Geom_Axis2Placement.hxx>
|
#include <Geom_Axis2Placement.hxx>
|
||||||
#include <Graphic3d_GraphicDriver.hxx>
|
#include <Graphic3d_GraphicDriver.hxx>
|
||||||
|
|
||||||
@ -50,13 +51,6 @@
|
|||||||
#include <Xw_Window.hxx>
|
#include <Xw_Window.hxx>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// the key for multi selection :
|
|
||||||
#define MULTISELECTIONKEY Qt::ShiftModifier
|
|
||||||
// the key for shortcut (use to activate dynamic onRotate, panning)
|
|
||||||
#define CASCADESHORTCUTKEY Qt::ControlModifier
|
|
||||||
// for elastic bean selection
|
|
||||||
#define ValZWMin 1
|
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
// function : Constructor
|
// function : Constructor
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -64,18 +58,20 @@
|
|||||||
View_Widget::View_Widget (QWidget* theParent,
|
View_Widget::View_Widget (QWidget* theParent,
|
||||||
const Handle(AIS_InteractiveContext)& theContext,
|
const Handle(AIS_InteractiveContext)& theContext,
|
||||||
const bool isFitAllActive)
|
const bool isFitAllActive)
|
||||||
: QWidget (theParent), myCurrentMode (View_CurrentAction3d_Nothing), myFirst (true), myDefaultWidth (-1),
|
: QWidget (theParent), myFirst (true), myDefaultWidth (-1),
|
||||||
myDefaultHeight (-1), myViewIsEnabled (true), myXmin (0), myYmin (0), myXmax (0), myYmax (0), myDragButtonDownX (0),
|
myDefaultHeight (-1), myViewIsEnabled (true),
|
||||||
myDragButtonDownY (0), myDragMultiButtonDownX (0), myDragMultiButtonDownY (0), myIsRectVisible (false), myRectBand (0),
|
|
||||||
myHasInitProj (Standard_False), myInitVx (0), myInitVy (0), myInitVz (0)
|
myHasInitProj (Standard_False), myInitVx (0), myInitVy (0), myInitVz (0)
|
||||||
{
|
{
|
||||||
myViewer = new View_Viewer (View_Viewer::DefaultColor());
|
myViewer = new View_Viewer (View_Viewer::DefaultColor());
|
||||||
if (!theContext.IsNull())
|
if (!theContext.IsNull())
|
||||||
|
{
|
||||||
myViewer->InitViewer (theContext);
|
myViewer->InitViewer (theContext);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
myViewer->InitViewer (myViewer->CreateStandardViewer());
|
myViewer->InitViewer (myViewer->CreateStandardViewer());
|
||||||
}
|
}
|
||||||
|
myController = new AIS_ViewController();
|
||||||
|
|
||||||
setAttribute (Qt::WA_PaintOnScreen);
|
setAttribute (Qt::WA_PaintOnScreen);
|
||||||
setAttribute (Qt::WA_NoSystemBackground);
|
setAttribute (Qt::WA_NoSystemBackground);
|
||||||
@ -87,7 +83,6 @@ View_Widget::View_Widget (QWidget* theParent,
|
|||||||
|
|
||||||
initViewActions();
|
initViewActions();
|
||||||
((View_ToolButton*)myFitAllAction)->SetButtonChecked (isFitAllActive);
|
((View_ToolButton*)myFitAllAction)->SetButtonChecked (isFitAllActive);
|
||||||
initCursors();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
@ -204,8 +199,7 @@ void View_Widget::SetEnabledView (const bool theIsEnabled)
|
|||||||
if (myViewer->GetView())
|
if (myViewer->GetView())
|
||||||
myViewer->GetView()->SetBackgroundColor (theIsEnabled ? View_Viewer::DefaultColor()
|
myViewer->GetView()->SetBackgroundColor (theIsEnabled ? View_Viewer::DefaultColor()
|
||||||
: View_Viewer::DisabledColor());
|
: View_Viewer::DisabledColor());
|
||||||
for (int anActionId = View_ViewActionType_FitAreaId; anActionId <= View_ViewActionType_DisplayModeId; anActionId++)
|
ViewAction (View_ViewActionType_DisplayModeId)->setEnabled (theIsEnabled);
|
||||||
ViewAction ((View_ViewActionType)anActionId)->setEnabled (theIsEnabled);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
@ -254,53 +248,6 @@ void View_Widget::onCheckedStateChanged (bool isOn)
|
|||||||
emit checkedStateChanged(View_ViewActionType_FitAllId, isOn);
|
emit checkedStateChanged(View_ViewActionType_FitAllId, isOn);
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
|
||||||
// function : OnUpdateToggled
|
|
||||||
// purpose :
|
|
||||||
// =======================================================================
|
|
||||||
void View_Widget::OnUpdateToggled (bool isOn)
|
|
||||||
{
|
|
||||||
QAction* aSentByAction = (QAction*)sender();
|
|
||||||
|
|
||||||
if (aSentByAction == myViewActions[View_ViewActionType_DisplayModeId])
|
|
||||||
{
|
|
||||||
aSentByAction->setIcon (isOn ? QIcon (":/icons/view_dm_wireframe.png")
|
|
||||||
: QIcon (":/icons/view_dm_shading.png"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isOn)
|
|
||||||
return;
|
|
||||||
|
|
||||||
for (int anActionId = View_ViewActionType_FitAreaId; anActionId <= View_ViewActionType_RotationId; anActionId++)
|
|
||||||
{
|
|
||||||
QAction* anAction = myViewActions[(View_ViewActionType)anActionId];
|
|
||||||
if ((anAction == myViewActions[View_ViewActionType_FitAreaId]) ||
|
|
||||||
(anAction == myViewActions[View_ViewActionType_ZoomId]) ||
|
|
||||||
(anAction == myViewActions[View_ViewActionType_PanId]) ||
|
|
||||||
(anAction == myViewActions[View_ViewActionType_RotationId]))
|
|
||||||
{
|
|
||||||
if (anAction && (anAction != aSentByAction))
|
|
||||||
{
|
|
||||||
anAction->setChecked (false);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (aSentByAction == myViewActions[View_ViewActionType_FitAreaId])
|
|
||||||
setActiveCursor (View_CursorMode_HandCursor);
|
|
||||||
else if (aSentByAction == myViewActions[View_ViewActionType_ZoomId])
|
|
||||||
setActiveCursor (View_CursorMode_ZoomCursor);
|
|
||||||
else if (aSentByAction == myViewActions[View_ViewActionType_PanId])
|
|
||||||
setActiveCursor (View_CursorMode_PanCursor);
|
|
||||||
else if (aSentByAction == myViewActions[View_ViewActionType_RotationId])
|
|
||||||
setActiveCursor (View_CursorMode_RotationCursor);
|
|
||||||
else
|
|
||||||
setActiveCursor (View_CursorMode_DefaultCursor);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
// function : initViewActions
|
// function : initViewActions
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -315,31 +262,8 @@ void View_Widget::initViewActions()
|
|||||||
createAction (View_ViewActionType_FitAllId, ":/icons/view_fitall.png", tr ("Fit All"), SLOT (OnFitAll()));
|
createAction (View_ViewActionType_FitAllId, ":/icons/view_fitall.png", tr ("Fit All"), SLOT (OnFitAll()));
|
||||||
myFitAllAction->setDefaultAction (ViewAction (View_ViewActionType_FitAllId));
|
myFitAllAction->setDefaultAction (ViewAction (View_ViewActionType_FitAllId));
|
||||||
|
|
||||||
createAction (View_ViewActionType_FitAreaId, ":/icons/view_fitarea.png", tr ("Fit Area"), SLOT (OnFitArea()), true);
|
|
||||||
createAction (View_ViewActionType_ZoomId, ":/icons/view_zoom.png", tr ("Zoom"), SLOT (OnZoom()), true);
|
|
||||||
createAction (View_ViewActionType_PanId, ":/icons/view_pan.png", tr ("Pan"), SLOT (OnPan()), true);
|
|
||||||
createAction (View_ViewActionType_RotationId, ":/icons/view_rotate.png", tr ("Rotation"), SLOT (OnRotate()), true);
|
|
||||||
createAction (View_ViewActionType_DisplayModeId, ":/icons/view_dm_shading.png", tr ("Display Mode"),
|
createAction (View_ViewActionType_DisplayModeId, ":/icons/view_dm_shading.png", tr ("Display Mode"),
|
||||||
SIGNAL (displayModeClicked()), true);
|
SIGNAL (displayModeClicked()), true);
|
||||||
|
|
||||||
for (int anActionId = View_ViewActionType_FitAreaId; anActionId <= View_ViewActionType_RotationId; anActionId++)
|
|
||||||
connect (myViewActions[(View_ViewActionType)anActionId], SIGNAL (toggled(bool)), this, SLOT (OnUpdateToggled(bool)));
|
|
||||||
}
|
|
||||||
|
|
||||||
// =======================================================================
|
|
||||||
// function : initCursors
|
|
||||||
// purpose :
|
|
||||||
// =======================================================================
|
|
||||||
void View_Widget::initCursors()
|
|
||||||
{
|
|
||||||
if (!myCursors.empty())
|
|
||||||
return;
|
|
||||||
|
|
||||||
myCursors[View_CursorMode_DefaultCursor] = QCursor (Qt::ArrowCursor);
|
|
||||||
myCursors[View_CursorMode_HandCursor] = QCursor (Qt::PointingHandCursor);
|
|
||||||
myCursors[View_CursorMode_PanCursor] = QCursor (Qt::SizeAllCursor);
|
|
||||||
myCursors[View_CursorMode_ZoomCursor] = QCursor(QIcon (":/icons/cursor_zoom.png").pixmap (20, 20));
|
|
||||||
myCursors[View_CursorMode_RotationCursor] = QCursor(QIcon (":/icons/cursor_rotate.png").pixmap (20, 20));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
@ -348,12 +272,13 @@ void View_Widget::initCursors()
|
|||||||
// =======================================================================
|
// =======================================================================
|
||||||
void View_Widget::mousePressEvent (QMouseEvent* theEvent)
|
void View_Widget::mousePressEvent (QMouseEvent* theEvent)
|
||||||
{
|
{
|
||||||
if (theEvent->button() == Qt::LeftButton)
|
if (myController->PressMouseButton (Graphic3d_Vec2i (theEvent->x(), theEvent->y()),
|
||||||
processLeftButtonDown (theEvent->buttons() | theEvent->modifiers(), theEvent->pos());
|
keyMouse (theEvent->button()),
|
||||||
else if (theEvent->button() == Qt::MidButton)
|
keyFlag (theEvent->modifiers()),
|
||||||
processMiddleButtonDown (theEvent->buttons() | theEvent->modifiers(), theEvent->pos());
|
Standard_False))
|
||||||
else if (theEvent->button() == Qt::RightButton)
|
{
|
||||||
processRightButtonDown (theEvent->buttons() | theEvent->modifiers(), theEvent->pos());
|
myController->FlushViewEvents (myViewer->GetContext(), myViewer->GetView(), Standard_True);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
@ -362,12 +287,13 @@ void View_Widget::mousePressEvent (QMouseEvent* theEvent)
|
|||||||
// =======================================================================
|
// =======================================================================
|
||||||
void View_Widget::mouseReleaseEvent (QMouseEvent* theEvent)
|
void View_Widget::mouseReleaseEvent (QMouseEvent* theEvent)
|
||||||
{
|
{
|
||||||
if (theEvent->button() == Qt::LeftButton)
|
if (myController->ReleaseMouseButton (Graphic3d_Vec2i (theEvent->x(), theEvent->y()),
|
||||||
processLeftButtonUp (theEvent->buttons() | theEvent->modifiers(), theEvent->pos());
|
keyMouse (theEvent->button()),
|
||||||
else if (theEvent->button() == Qt::MidButton)
|
keyFlag (theEvent->modifiers()),
|
||||||
processMiddleButtonUp (theEvent->buttons() | theEvent->modifiers(), theEvent->pos());
|
Standard_False))
|
||||||
else if (theEvent->button() == Qt::RightButton)
|
{
|
||||||
processRightButtonUp (theEvent->buttons() | theEvent->modifiers(), theEvent->pos());
|
myController->FlushViewEvents (myViewer->GetContext(), myViewer->GetView(), Standard_True);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
@ -376,411 +302,11 @@ void View_Widget::mouseReleaseEvent (QMouseEvent* theEvent)
|
|||||||
// =======================================================================
|
// =======================================================================
|
||||||
void View_Widget::mouseMoveEvent (QMouseEvent* theEvent)
|
void View_Widget::mouseMoveEvent (QMouseEvent* theEvent)
|
||||||
{
|
{
|
||||||
processMouseMove (theEvent->buttons() | theEvent->modifiers(), theEvent->pos());
|
myController->UpdateMousePosition (Graphic3d_Vec2i (theEvent->x(), theEvent->y()),
|
||||||
}
|
keyMouse (theEvent->button()),
|
||||||
|
keyFlag (theEvent->modifiers()), Standard_False);
|
||||||
|
|
||||||
// =======================================================================
|
myController->FlushViewEvents (myViewer->GetContext(), myViewer->GetView(), Standard_True);
|
||||||
// function : activateCursor
|
|
||||||
// purpose :
|
|
||||||
// =======================================================================
|
|
||||||
void View_Widget::activateCursor (const View_CurrentAction3d theMode)
|
|
||||||
{
|
|
||||||
switch (theMode)
|
|
||||||
{
|
|
||||||
case View_CurrentAction3d_DynamicPanning:
|
|
||||||
{
|
|
||||||
setActiveCursor (View_CursorMode_PanCursor);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case View_CurrentAction3d_DynamicZooming:
|
|
||||||
{
|
|
||||||
setActiveCursor (View_CursorMode_ZoomCursor);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case View_CurrentAction3d_DynamicRotation:
|
|
||||||
{
|
|
||||||
setActiveCursor (View_CursorMode_RotationCursor);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case View_CurrentAction3d_WindowZooming:
|
|
||||||
{
|
|
||||||
setActiveCursor (View_CursorMode_HandCursor);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case View_CurrentAction3d_Nothing:
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
setActiveCursor (View_CursorMode_DefaultCursor);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// =======================================================================
|
|
||||||
// function : processLeftButtonDown
|
|
||||||
// purpose :
|
|
||||||
// =======================================================================
|
|
||||||
void View_Widget::processLeftButtonDown (const int theFlags, const QPoint thePoint)
|
|
||||||
{
|
|
||||||
// save the current mouse coordinate in min
|
|
||||||
myXmin = thePoint.x();
|
|
||||||
myYmin = thePoint.y();
|
|
||||||
myXmax = thePoint.x();
|
|
||||||
myYmax = thePoint.y();
|
|
||||||
|
|
||||||
if (theFlags & CASCADESHORTCUTKEY)
|
|
||||||
{
|
|
||||||
myCurrentMode = View_CurrentAction3d_DynamicZooming;
|
|
||||||
OnUpdateToggled(true);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
switch (myCurrentMode)
|
|
||||||
{
|
|
||||||
case View_CurrentAction3d_Nothing:
|
|
||||||
{
|
|
||||||
if (theFlags & MULTISELECTIONKEY)
|
|
||||||
processDragMultiEvent (myXmax, myYmax, View_DragMode_ButtonDown);
|
|
||||||
else
|
|
||||||
processDragEvent (myXmax, myYmax, View_DragMode_ButtonDown);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case View_CurrentAction3d_DynamicZooming:
|
|
||||||
case View_CurrentAction3d_WindowZooming:
|
|
||||||
case View_CurrentAction3d_DynamicPanning:
|
|
||||||
break;
|
|
||||||
case View_CurrentAction3d_DynamicRotation:
|
|
||||||
{
|
|
||||||
myViewer->GetView()->StartRotation (thePoint.x(), thePoint.y());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
throw Standard_ProgramError ("View_Widget::processLeftButtonDown : Incompatible Current Mode");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
activateCursor (myCurrentMode);
|
|
||||||
emit leftButtonDown(thePoint.x(), thePoint.y());
|
|
||||||
}
|
|
||||||
|
|
||||||
// =======================================================================
|
|
||||||
// function : processMiddleButtonDown
|
|
||||||
// purpose :
|
|
||||||
// =======================================================================
|
|
||||||
void View_Widget::processMiddleButtonDown (const int theFlags, const QPoint /*thePoint*/)
|
|
||||||
{
|
|
||||||
if (theFlags & CASCADESHORTCUTKEY) {
|
|
||||||
myCurrentMode = View_CurrentAction3d_DynamicPanning;
|
|
||||||
OnUpdateToggled(true);
|
|
||||||
}
|
|
||||||
activateCursor (myCurrentMode);
|
|
||||||
}
|
|
||||||
|
|
||||||
// =======================================================================
|
|
||||||
// function : processRightButtonDown
|
|
||||||
// purpose :
|
|
||||||
// =======================================================================
|
|
||||||
void View_Widget::processRightButtonDown (const int theFlags, const QPoint thePoint)
|
|
||||||
{
|
|
||||||
if (theFlags & CASCADESHORTCUTKEY)
|
|
||||||
{
|
|
||||||
myCurrentMode = View_CurrentAction3d_DynamicRotation;
|
|
||||||
myViewer->GetView()->StartRotation (thePoint.x(), thePoint.y());
|
|
||||||
OnUpdateToggled(true);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
popup (thePoint.x(), thePoint.y());
|
|
||||||
}
|
|
||||||
activateCursor (myCurrentMode);
|
|
||||||
}
|
|
||||||
|
|
||||||
// =======================================================================
|
|
||||||
// function : processLeftButtonUp
|
|
||||||
// purpose :
|
|
||||||
// =======================================================================
|
|
||||||
void View_Widget::processLeftButtonUp (const int theFlags, const QPoint thePoint)
|
|
||||||
{
|
|
||||||
switch (myCurrentMode)
|
|
||||||
{
|
|
||||||
case View_CurrentAction3d_Nothing:
|
|
||||||
{
|
|
||||||
if (thePoint.x() == myXmin && thePoint.y() == myYmin)
|
|
||||||
{
|
|
||||||
// no offset between down and up --> selectEvent
|
|
||||||
myXmax = thePoint.x();
|
|
||||||
myYmax = thePoint.y();
|
|
||||||
if (theFlags & MULTISELECTIONKEY)
|
|
||||||
processInputMultiEvent (thePoint.x(), thePoint.y());
|
|
||||||
else
|
|
||||||
processInputEvent (thePoint.x(), thePoint.y());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
drawRectangle (myXmin, myYmin, myXmax, myYmax, Standard_False);
|
|
||||||
myXmax = thePoint.x();
|
|
||||||
myYmax = thePoint.y();
|
|
||||||
if (theFlags & MULTISELECTIONKEY)
|
|
||||||
processDragMultiEvent (thePoint.x(), thePoint.y(), View_DragMode_ButtonUp);
|
|
||||||
else
|
|
||||||
processDragEvent (thePoint.x(), thePoint.y(), View_DragMode_ButtonUp);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case View_CurrentAction3d_DynamicZooming:
|
|
||||||
break;
|
|
||||||
case View_CurrentAction3d_WindowZooming:
|
|
||||||
{
|
|
||||||
drawRectangle (myXmin, myYmin, myXmax, myYmax, Standard_False);
|
|
||||||
myXmax = thePoint.x();
|
|
||||||
myYmax = thePoint.y();
|
|
||||||
if ((abs(myXmin - myXmax) > ValZWMin) ||
|
|
||||||
(abs(myYmin - myYmax) > ValZWMin))
|
|
||||||
myViewer->GetView()->WindowFitAll (myXmin, myYmin, myXmax, myYmax);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case View_CurrentAction3d_DynamicPanning:
|
|
||||||
break;
|
|
||||||
case View_CurrentAction3d_DynamicRotation:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
throw Standard_ProgramError("View_Widget::processLeftButtonUp : Incompatible Current Mode");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
myDragButtonDownX = 0;
|
|
||||||
myDragButtonDownY = 0;
|
|
||||||
myDragMultiButtonDownX = 0;
|
|
||||||
myDragMultiButtonDownY = 0;
|
|
||||||
|
|
||||||
emit selectionChanged();
|
|
||||||
emit leftButtonUp(thePoint.x(), thePoint.y());
|
|
||||||
}
|
|
||||||
|
|
||||||
// =======================================================================
|
|
||||||
// function : processMiddleButtonUp
|
|
||||||
// purpose :
|
|
||||||
// =======================================================================
|
|
||||||
void View_Widget::processMiddleButtonUp (const int /*theFlags*/, const QPoint /*thePoint*/)
|
|
||||||
{
|
|
||||||
myCurrentMode = View_CurrentAction3d_Nothing;
|
|
||||||
activateCursor (myCurrentMode);
|
|
||||||
}
|
|
||||||
|
|
||||||
// =======================================================================
|
|
||||||
// function : processRightButtonUp
|
|
||||||
// purpose :
|
|
||||||
// =======================================================================
|
|
||||||
void View_Widget::processRightButtonUp (const int /*theFlags*/, const QPoint thePoint)
|
|
||||||
{
|
|
||||||
if (myCurrentMode == View_CurrentAction3d_Nothing)
|
|
||||||
{
|
|
||||||
popup (thePoint.x(), thePoint.y());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
myCurrentMode = View_CurrentAction3d_Nothing;
|
|
||||||
activateCursor (myCurrentMode);
|
|
||||||
}
|
|
||||||
|
|
||||||
// =======================================================================
|
|
||||||
// function : processMouseMove
|
|
||||||
// purpose :
|
|
||||||
// =======================================================================
|
|
||||||
void View_Widget::processMouseMove (const int theFlags, const QPoint thePoint)
|
|
||||||
{
|
|
||||||
if (theFlags & Qt::LeftButton || theFlags & Qt::RightButton || theFlags & Qt::MidButton)
|
|
||||||
{
|
|
||||||
switch (myCurrentMode)
|
|
||||||
{
|
|
||||||
case View_CurrentAction3d_Nothing:
|
|
||||||
{
|
|
||||||
myXmax = thePoint.x();
|
|
||||||
myYmax = thePoint.y();
|
|
||||||
drawRectangle (myXmin, myYmin, myXmax, myYmax, Standard_False);
|
|
||||||
if (theFlags & MULTISELECTIONKEY)
|
|
||||||
processDragMultiEvent (myXmax, myYmax, View_DragMode_ButtonMove);
|
|
||||||
else
|
|
||||||
processDragEvent (myXmax, myYmax, View_DragMode_ButtonMove);
|
|
||||||
drawRectangle (myXmin, myYmin, myXmax, myYmax, Standard_True);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case View_CurrentAction3d_DynamicZooming:
|
|
||||||
{
|
|
||||||
myViewer->GetView()->Zoom (myXmax, myYmax, thePoint.x(), thePoint.y());
|
|
||||||
myXmax = thePoint.x();
|
|
||||||
myYmax = thePoint.y();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case View_CurrentAction3d_WindowZooming:
|
|
||||||
{
|
|
||||||
myXmax = thePoint.x();
|
|
||||||
myYmax = thePoint.y();
|
|
||||||
drawRectangle (myXmin, myYmin, myXmax, myYmax, Standard_False);
|
|
||||||
drawRectangle (myXmin, myYmin, myXmax, myYmax, Standard_True);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case View_CurrentAction3d_DynamicPanning:
|
|
||||||
{
|
|
||||||
myViewer->GetView()->Pan (thePoint.x() - myXmax, myYmax - thePoint.y());
|
|
||||||
myXmax = thePoint.x();
|
|
||||||
myYmax = thePoint.y();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case View_CurrentAction3d_DynamicRotation:
|
|
||||||
{
|
|
||||||
myViewer->GetView()->Rotation (thePoint.x(), thePoint.y());
|
|
||||||
myViewer->GetView()->Redraw();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
throw Standard_ProgramError("View_Widget::processMouseMove : Incompatible Current Mode");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
myXmax = thePoint.x();
|
|
||||||
myYmax = thePoint.y();
|
|
||||||
if (theFlags & MULTISELECTIONKEY)
|
|
||||||
processMoveMultiEvent (thePoint.x(), thePoint.y());
|
|
||||||
else
|
|
||||||
processMoveEvent (thePoint.x(), thePoint.y());
|
|
||||||
}
|
|
||||||
emit moveTo (thePoint.x(), thePoint.y());
|
|
||||||
}
|
|
||||||
|
|
||||||
// =======================================================================
|
|
||||||
// function : processDragEvent
|
|
||||||
// purpose :
|
|
||||||
// =======================================================================
|
|
||||||
void View_Widget::processDragEvent (const Standard_Integer theX, const Standard_Integer theY, const View_DragMode& theState)
|
|
||||||
{
|
|
||||||
//myDragButtonDownX = 0;
|
|
||||||
//myDragButtonDownY = 0;
|
|
||||||
|
|
||||||
switch (theState)
|
|
||||||
{
|
|
||||||
case View_DragMode_ButtonDown:
|
|
||||||
{
|
|
||||||
myDragButtonDownX = theX;
|
|
||||||
myDragButtonDownY = theY;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case View_DragMode_ButtonMove:
|
|
||||||
break;
|
|
||||||
case View_DragMode_ButtonUp:
|
|
||||||
{
|
|
||||||
myViewer->GetContext()->Select (myDragButtonDownX, myDragButtonDownY, theX, theY, myViewer->GetView(), Standard_True);
|
|
||||||
emit selectionChanged();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// =======================================================================
|
|
||||||
// function : processInputEvent
|
|
||||||
// purpose :
|
|
||||||
// =======================================================================
|
|
||||||
void View_Widget::processInputEvent (const Standard_Integer/* theX*/, const Standard_Integer/* theY*/)
|
|
||||||
{
|
|
||||||
myViewer->GetContext()->Select (Standard_True);
|
|
||||||
emit selectionChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
// =======================================================================
|
|
||||||
// function : processMoveEvent
|
|
||||||
// purpose :
|
|
||||||
// =======================================================================
|
|
||||||
void View_Widget::processMoveEvent (const Standard_Integer theX, const Standard_Integer theY)
|
|
||||||
{
|
|
||||||
if (myViewer->GetView())
|
|
||||||
myViewer->GetContext()->MoveTo (theX, theY, myViewer->GetView(), Standard_True);
|
|
||||||
}
|
|
||||||
|
|
||||||
// =======================================================================
|
|
||||||
// function : processDragMultiEvent
|
|
||||||
// purpose :
|
|
||||||
// =======================================================================
|
|
||||||
void View_Widget::processDragMultiEvent (const Standard_Integer theX, const Standard_Integer theY,
|
|
||||||
const View_DragMode& theState)
|
|
||||||
{
|
|
||||||
switch (theState)
|
|
||||||
{
|
|
||||||
case View_DragMode_ButtonDown:
|
|
||||||
{
|
|
||||||
myDragMultiButtonDownX = theX;
|
|
||||||
myDragMultiButtonDownY = theY;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case View_DragMode_ButtonMove:
|
|
||||||
{
|
|
||||||
myViewer->GetContext()->ShiftSelect (myDragMultiButtonDownX, myDragMultiButtonDownY, theX, theY,
|
|
||||||
myViewer->GetView(), Standard_True);
|
|
||||||
emit selectionChanged();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case View_DragMode_ButtonUp:
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// =======================================================================
|
|
||||||
// function : processInputMultiEvent
|
|
||||||
// purpose :
|
|
||||||
// =======================================================================
|
|
||||||
void View_Widget::processInputMultiEvent (const Standard_Integer /*theX*/, const Standard_Integer /*theY*/)
|
|
||||||
{
|
|
||||||
myViewer->GetContext()->ShiftSelect (Standard_True);
|
|
||||||
emit selectionChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
// =======================================================================
|
|
||||||
// function : drawRectangle
|
|
||||||
// purpose :
|
|
||||||
// =======================================================================
|
|
||||||
void View_Widget::drawRectangle (const Standard_Integer theMinX, const Standard_Integer MinY,
|
|
||||||
const Standard_Integer MaxX, const Standard_Integer MaxY,
|
|
||||||
const Standard_Boolean theToDraw)
|
|
||||||
{
|
|
||||||
Standard_Integer StoredMinX, StoredMaxX, StoredMinY, StoredMaxY;
|
|
||||||
|
|
||||||
StoredMinX = (theMinX < MaxX) ? theMinX : MaxX;
|
|
||||||
StoredMinY = (MinY < MaxY) ? MinY : MaxY;
|
|
||||||
StoredMaxX = (theMinX > MaxX) ? theMinX : MaxX;
|
|
||||||
StoredMaxY = (MinY > MaxY) ? MinY : MaxY;
|
|
||||||
|
|
||||||
QRect aRect;
|
|
||||||
aRect.setRect(StoredMinX, StoredMinY, abs (StoredMaxX-StoredMinX), abs (StoredMaxY-StoredMinY));
|
|
||||||
|
|
||||||
if (!myRectBand)
|
|
||||||
{
|
|
||||||
myRectBand = new QRubberBand (QRubberBand::Rectangle, this);
|
|
||||||
myRectBand->setStyle (QStyleFactory::create ("windows"));
|
|
||||||
myRectBand->setGeometry (aRect);
|
|
||||||
myRectBand->show();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (myIsRectVisible && !theToDraw) // move or up : erase at the old position
|
|
||||||
{
|
|
||||||
myRectBand->hide();
|
|
||||||
delete myRectBand;
|
|
||||||
myRectBand = 0;
|
|
||||||
myIsRectVisible = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (theToDraw) // move : draw
|
|
||||||
{
|
|
||||||
myIsRectVisible = true;
|
|
||||||
myRectBand->setGeometry (aRect);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
@ -801,11 +327,34 @@ void View_Widget::createAction (const View_ViewActionType theActionId, const QSt
|
|||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
// function : setActiveCursor
|
// function : keyFlag
|
||||||
// purpose :
|
// purpose :
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
void View_Widget::setActiveCursor (const View_CursorMode& theMode)
|
Aspect_VKeyFlags View_Widget::keyFlag (const int theModifierId)
|
||||||
{
|
{
|
||||||
QCursor aCursor = myCursors[theMode];
|
switch (theModifierId)
|
||||||
setCursor (myCursors[theMode]);
|
{
|
||||||
|
case Qt::NoModifier: return Aspect_VKeyFlags_NONE;
|
||||||
|
case Qt::ShiftModifier: return Aspect_VKeyFlags_SHIFT;
|
||||||
|
case Qt::ControlModifier: return Aspect_VKeyFlags_CTRL;
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
return Aspect_VKeyFlags_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// =======================================================================
|
||||||
|
// function : keyMouse
|
||||||
|
// purpose :
|
||||||
|
// =======================================================================
|
||||||
|
Aspect_VKeyMouse View_Widget::keyMouse (const int theButtonId)
|
||||||
|
{
|
||||||
|
switch (theButtonId)
|
||||||
|
{
|
||||||
|
case Qt::NoButton: return Aspect_VKeyMouse_NONE;
|
||||||
|
case Qt::LeftButton: return Aspect_VKeyMouse_LeftButton;
|
||||||
|
case Qt::RightButton: return Aspect_VKeyMouse_RightButton;
|
||||||
|
case Qt::MidButton: return Aspect_VKeyMouse_MiddleButton;
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
return Aspect_VKeyMouse_NONE;
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,8 @@
|
|||||||
#define View_View_H
|
#define View_View_H
|
||||||
|
|
||||||
#include <AIS_InteractiveContext.hxx>
|
#include <AIS_InteractiveContext.hxx>
|
||||||
|
#include <AIS_ViewController.hxx>
|
||||||
|
#include <Aspect_VKeyFlags.hxx>
|
||||||
#include <V3d_View.hxx>
|
#include <V3d_View.hxx>
|
||||||
#include <inspector/View_ViewActionType.hxx>
|
#include <inspector/View_ViewActionType.hxx>
|
||||||
#include <inspector/View_Viewer.hxx>
|
#include <inspector/View_Viewer.hxx>
|
||||||
@ -31,8 +33,6 @@
|
|||||||
|
|
||||||
class View_Viewer;
|
class View_Viewer;
|
||||||
|
|
||||||
class QRubberBand;
|
|
||||||
|
|
||||||
//! \class View_Widget
|
//! \class View_Widget
|
||||||
//! \brief It is a Qt control that visualizes content of OCCT 3D view
|
//! \brief It is a Qt control that visualizes content of OCCT 3D view
|
||||||
//! It creates control and actions of manipulating of this view,
|
//! It creates control and actions of manipulating of this view,
|
||||||
@ -41,38 +41,8 @@ class QRubberBand;
|
|||||||
class View_Widget : public QWidget
|
class View_Widget : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
protected:
|
|
||||||
|
|
||||||
//! Enumeration defines manipulating actions of the widget
|
|
||||||
enum View_CurrentAction3d
|
|
||||||
{
|
|
||||||
View_CurrentAction3d_Nothing, //!< Empty action
|
|
||||||
View_CurrentAction3d_DynamicZooming, //!< Zoom action
|
|
||||||
View_CurrentAction3d_WindowZooming, //!< Zoom action using rectangle
|
|
||||||
View_CurrentAction3d_DynamicPanning, //!< Panning action
|
|
||||||
View_CurrentAction3d_DynamicRotation //!< Rotation action
|
|
||||||
};
|
|
||||||
|
|
||||||
//! Enumeration defines cursor kind
|
|
||||||
enum View_CursorMode
|
|
||||||
{
|
|
||||||
View_CursorMode_DefaultCursor, //!< default Qt cursor
|
|
||||||
View_CursorMode_HandCursor, //!< hand cursor
|
|
||||||
View_CursorMode_PanCursor, //!< panning cursor
|
|
||||||
View_CursorMode_ZoomCursor, //!< zoom cursor
|
|
||||||
View_CursorMode_RotationCursor //!< onRotate cursor
|
|
||||||
};
|
|
||||||
|
|
||||||
//! Enumeration defines drag mode
|
|
||||||
enum View_DragMode
|
|
||||||
{
|
|
||||||
View_DragMode_ButtonDown, //!< theState == -1 button down
|
|
||||||
View_DragMode_ButtonMove, //!< theState == 0 move
|
|
||||||
View_DragMode_ButtonUp //< theState == 1 button up
|
|
||||||
};
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//! Constructor
|
//! Constructor
|
||||||
Standard_EXPORT View_Widget (QWidget* theParent,
|
Standard_EXPORT View_Widget (QWidget* theParent,
|
||||||
const Handle(AIS_InteractiveContext)& theContext,
|
const Handle(AIS_InteractiveContext)& theContext,
|
||||||
@ -154,21 +124,6 @@ signals:
|
|||||||
//! Sends a signal about selection change if the left mouse button is pressed and current action does not process it
|
//! Sends a signal about selection change if the left mouse button is pressed and current action does not process it
|
||||||
void selectionChanged();
|
void selectionChanged();
|
||||||
|
|
||||||
//! Sends a signal about moving to the point in the view
|
|
||||||
//! \param theX X mouse position in pixels
|
|
||||||
//! \param theY Y mouse position in pixels
|
|
||||||
void moveTo (const int theX, const int theY);
|
|
||||||
|
|
||||||
//! Sends a signal about up the left mouse button down
|
|
||||||
//! \param theX X mouse position in pixels
|
|
||||||
//! \param theY Y mouse position in pixels
|
|
||||||
void leftButtonDown (const int theX, const int theY);
|
|
||||||
|
|
||||||
//! Sends a signal about up the left mouse button up
|
|
||||||
//! \param theX X mouse position in pixels
|
|
||||||
//! \param theY Y mouse position in pixels
|
|
||||||
void leftButtonUp (const int theX, const int theY);
|
|
||||||
|
|
||||||
//! Sends a signal about display mode change
|
//! Sends a signal about display mode change
|
||||||
void displayModeClicked();
|
void displayModeClicked();
|
||||||
|
|
||||||
@ -182,29 +137,11 @@ public slots:
|
|||||||
//! Fits all the V3d view and redraw view
|
//! Fits all the V3d view and redraw view
|
||||||
void OnFitAll() { myViewer->GetView()->FitAll(); }
|
void OnFitAll() { myViewer->GetView()->FitAll(); }
|
||||||
|
|
||||||
//! Stores state about fitting all to use it by the mouse move
|
|
||||||
void OnFitArea() { myCurrentMode = View_CurrentAction3d_WindowZooming; }
|
|
||||||
|
|
||||||
//! Stores state about zoom to use it by the mouse move
|
|
||||||
void OnZoom() { myCurrentMode = View_CurrentAction3d_DynamicZooming; }
|
|
||||||
|
|
||||||
//! Stores state about pan to use it by the mouse move
|
|
||||||
void OnPan() { myCurrentMode = View_CurrentAction3d_DynamicPanning; }
|
|
||||||
|
|
||||||
//! Stores state about onRotate to use it by the mouse move
|
|
||||||
void OnRotate() { myCurrentMode = View_CurrentAction3d_DynamicRotation; }
|
|
||||||
|
|
||||||
//! Updates states of widget actions
|
//! Updates states of widget actions
|
||||||
//!
|
//!
|
||||||
//! - if the state is checked, uncheck all other actions
|
//! - if the state is checked, uncheck all other actions
|
||||||
Standard_EXPORT void onCheckedStateChanged (bool isOn);
|
Standard_EXPORT void onCheckedStateChanged (bool isOn);
|
||||||
|
|
||||||
//! Updates states of tool actions:
|
|
||||||
//! - if the action is display mode, it changes an icon for action(wireframe or shading)
|
|
||||||
//! - if the state is checked, uncheck all other actions
|
|
||||||
//! \param isOn boolean value about check
|
|
||||||
Standard_EXPORT void OnUpdateToggled (bool isOn);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
//! Avoids Qt standard execution of this method, redraw V3d view
|
//! Avoids Qt standard execution of this method, redraw V3d view
|
||||||
@ -232,99 +169,11 @@ protected:
|
|||||||
//! Creates view actions and fills an internal map
|
//! Creates view actions and fills an internal map
|
||||||
void initViewActions();
|
void initViewActions();
|
||||||
|
|
||||||
//! Creates cursors and fills an internal map
|
|
||||||
void initCursors();
|
|
||||||
|
|
||||||
//! Sets widget cursor by the action type
|
|
||||||
//! \param theMode an active action mode
|
|
||||||
void activateCursor (const View_CurrentAction3d theMode);
|
|
||||||
|
|
||||||
//! Activates cursor of the active operation, perform drag, onRotate depending on mode,
|
|
||||||
//! stores the point position in xmin/xmax and ymin/ymax
|
|
||||||
//! \param theFlags an event buttons and modifiers
|
|
||||||
//! \param thePoint a clicked point
|
|
||||||
void processLeftButtonDown (const int theFlags, const QPoint thePoint);
|
|
||||||
|
|
||||||
//! Activates cursor of the active operation and performs dynamic pan if it is active
|
|
||||||
//! \param theFlags an event buttons and modifiers
|
|
||||||
//! \param thePoint a clicked point
|
|
||||||
void processMiddleButtonDown (const int theFlags, const QPoint thePoint);
|
|
||||||
|
|
||||||
//! Activates cursor of the active operation, build popup menu
|
|
||||||
//! \param theFlags an event buttons and modifiers
|
|
||||||
//! \param thePoint a clicked point
|
|
||||||
void processRightButtonDown (const int theFlags, const QPoint thePoint);
|
|
||||||
|
|
||||||
//! Performs the active operation or performs Input/Drag event processing, emits selection changed signal
|
|
||||||
//! \param theFlags an event buttons and modifiers
|
|
||||||
//! \param thePoint a clicked point
|
|
||||||
void processLeftButtonUp (const int theFlags, const QPoint thePoint);
|
|
||||||
|
|
||||||
//! Changes the active operation to None
|
|
||||||
//! \param theFlags an event buttons and modifiers
|
|
||||||
//! \param thePoint a clicked point
|
|
||||||
void processMiddleButtonUp (const int theFlags, const QPoint thePoint);
|
|
||||||
|
|
||||||
//! Calls popup menu build and changes the active operation to None
|
|
||||||
//! \param theFlags an event buttons and modifiers
|
|
||||||
//! \param thePoint a clicked point
|
|
||||||
void processRightButtonUp (const int theFlags, const QPoint thePoint);
|
|
||||||
|
|
||||||
//! Performs active operation or draws rectangle of zoom
|
|
||||||
//! \param theFlags an event buttons and modifiers
|
|
||||||
//! \param thePoint a clicked point
|
|
||||||
void processMouseMove (const int theFlags, const QPoint thePoint);
|
|
||||||
|
|
||||||
//! Performs selection: store clicked point by botton down, call Select by button up
|
|
||||||
//! Emits signal about selection changed
|
|
||||||
//! \param theX a horizontal position of mouse event
|
|
||||||
//! \param theX a vertical position of mouse event
|
|
||||||
//! \param theState a mouse button state: down, move or up
|
|
||||||
void processDragEvent (const Standard_Integer theX, const Standard_Integer theY, const View_DragMode& theState);
|
|
||||||
|
|
||||||
//! Performs selection in context without parameter, it means the selection of picked object
|
|
||||||
//! \param theX a horizontal position of mouse event
|
|
||||||
//! \param theX a vertical position of mouse event
|
|
||||||
void processInputEvent (const Standard_Integer theX, const Standard_Integer theY);
|
|
||||||
|
|
||||||
//! Calls MoveTo of the context for the parameter coordinates
|
|
||||||
//! \param theX a horizontal position of mouse event
|
|
||||||
//! \param theX a vertical position of mouse event
|
|
||||||
void processMoveEvent (const Standard_Integer theX, const Standard_Integer theY);
|
|
||||||
|
|
||||||
//! Empty: template to process mouse move with multi selection key pressed
|
|
||||||
//! \param theX a horizontal position of mouse event
|
|
||||||
//! \param theX a vertical position of mouse event
|
|
||||||
void processMoveMultiEvent (const Standard_Integer theX, const Standard_Integer theY)
|
|
||||||
{ (void)theX; (void)theY; }
|
|
||||||
|
|
||||||
//! Performs selection: store clicked point by botton down, call ShiftSelect by button move
|
|
||||||
//! Emits signal about selection changed
|
|
||||||
//! \param theX a horizontal position of mouse event
|
|
||||||
//! \param theX a vertical position of mouse event
|
|
||||||
//! \param theState a mouse button state: down, move or up
|
|
||||||
void processDragMultiEvent (const Standard_Integer theX, const Standard_Integer theY, const View_DragMode& theState);
|
|
||||||
|
|
||||||
//! Performs shift selection in context without parameter, it means the selection of picked object
|
|
||||||
//! \param theX a horizontal position of mouse event
|
|
||||||
//! \param theX a vertical position of mouse event
|
|
||||||
void processInputMultiEvent (const Standard_Integer theX, const Standard_Integer theY);
|
|
||||||
|
|
||||||
//! Empty: template to create popup menu
|
//! Empty: template to create popup menu
|
||||||
//! \param theX a horizontal position of mouse event
|
//! \param theX a horizontal position of mouse event
|
||||||
//! \param theX a vertical position of mouse event
|
//! \param theX a vertical position of mouse event
|
||||||
void popup (const Standard_Integer theX, const Standard_Integer theY) { (void)theX; (void)theY; }
|
void popup (const Standard_Integer theX, const Standard_Integer theY) { (void)theX; (void)theY; }
|
||||||
|
|
||||||
//! Draws Qt rectangle for the given area (e.g. for panning operation)
|
|
||||||
//! \param theMinX a minimal X coordinate
|
|
||||||
//! \param theMinY a minimal Y coordinate
|
|
||||||
//! \param theMinZ a minimal Z coordinate
|
|
||||||
//! \param theMaxX a maximum X coordinate
|
|
||||||
//! \param theMaxY a maximum Y coordinate
|
|
||||||
//! \param theMaxZ a maximum Z coordinate
|
|
||||||
//! \param theToDraw state whether the rectangle should be visualized or hidden
|
|
||||||
void drawRectangle (const Standard_Integer theMinX, const Standard_Integer theMinY, const Standard_Integer theMaxX,
|
|
||||||
const Standard_Integer theMaxY, const Standard_Boolean theToDraw);
|
|
||||||
private:
|
private:
|
||||||
//! Creates action and stores it in a map of actions
|
//! Creates action and stores it in a map of actions
|
||||||
//! \param theActionId an identifier of action in internal map
|
//! \param theActionId an identifier of action in internal map
|
||||||
@ -336,38 +185,32 @@ private:
|
|||||||
const char* theSlot, const bool isCheckable = false,
|
const char* theSlot, const bool isCheckable = false,
|
||||||
const QString& theToolBar = QString(), const QString& theStatusBar = QString());
|
const QString& theToolBar = QString(), const QString& theStatusBar = QString());
|
||||||
|
|
||||||
//! Sets active action cursor for application
|
private:
|
||||||
//! \param theMode a cursor mode
|
//! Converts Qt modifier key to Aspect key flag
|
||||||
void setActiveCursor (const View_CursorMode& theMode);
|
//! \param theModifierId the event modifier
|
||||||
|
static Aspect_VKeyFlags keyFlag (const int theModifierId);
|
||||||
|
|
||||||
|
//! Converts Qt button key to Aspect key mouse
|
||||||
|
//! \param theButtonId the event button
|
||||||
|
static Aspect_VKeyMouse keyMouse (const int theButtonId);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
View_Viewer* myViewer; //!< connector to context, V3d viewer and V3d View
|
View_Viewer* myViewer; //!< connector to context, V3d viewer and V3d View
|
||||||
|
AIS_ViewController* myController; //!< controller to process view actions
|
||||||
|
|
||||||
QToolButton* myFitAllAction; //!< widget for fit all, processed double click to perform action automatically
|
QToolButton* myFitAllAction; //!< widget for fit all, processed double click to perform action automatically
|
||||||
QMap<View_ViewActionType, QAction*> myViewActions; //!< tool bar view actions
|
QMap<View_ViewActionType, QAction*> myViewActions; //!< tool bar view actions
|
||||||
QMap<View_CursorMode, QCursor> myCursors; //!< possible cursors for view actions
|
|
||||||
|
|
||||||
View_CurrentAction3d myCurrentMode; //!< an active action mode for viewer
|
|
||||||
Standard_Boolean myFirst; //!< flag to Init view by the first resize/paint call
|
Standard_Boolean myFirst; //!< flag to Init view by the first resize/paint call
|
||||||
Standard_Integer myDefaultWidth; //!< default width for the first sizeHint
|
Standard_Integer myDefaultWidth; //!< default width for the first sizeHint
|
||||||
Standard_Integer myDefaultHeight; //!< default height for the first sizeHint
|
Standard_Integer myDefaultHeight; //!< default height for the first sizeHint
|
||||||
Standard_Boolean myViewIsEnabled; //!< flag if the view and tool bar view actions are enabled/disabled
|
Standard_Boolean myViewIsEnabled; //!< flag if the view and tool bar view actions are enabled/disabled
|
||||||
Standard_Integer myXmin; //!< cached X minimal position by mouse press event
|
|
||||||
Standard_Integer myYmin; //!< cached Y minimal position by mouse press event
|
|
||||||
Standard_Integer myXmax; //!< cached X maximum position by mouse press event
|
|
||||||
Standard_Integer myYmax; //!< cached Y maximum position by mouse press event
|
|
||||||
Standard_Integer myDragButtonDownX; //!< cached X button down by drag event
|
|
||||||
Standard_Integer myDragButtonDownY; //!< cached Y button down by drag event
|
|
||||||
Standard_Integer myDragMultiButtonDownX; //!< cached X button down by multi drag event
|
|
||||||
Standard_Integer myDragMultiButtonDownY; //!< cached Y button down by multi drag event
|
|
||||||
Standard_Boolean myIsRectVisible; //!< true if rectangle is visible now
|
|
||||||
QRubberBand* myRectBand; //!< selection rectangle rubber band
|
|
||||||
|
|
||||||
Standard_Boolean myHasInitProj; //!< is initial camera position defined
|
Standard_Boolean myHasInitProj; //!< is initial camera position defined
|
||||||
Standard_Real myInitVx; //!< initial camera position on X
|
Standard_Real myInitVx; //!< initial camera position on X
|
||||||
Standard_Real myInitVy; //!< initial camera position on Y
|
Standard_Real myInitVy; //!< initial camera position on Y
|
||||||
Standard_Real myInitVz; //!< initial camera position on Z
|
Standard_Real myInitVz; //!< initial camera position on Z
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -69,8 +69,7 @@ View_Window::View_Window (QWidget* theParent,
|
|||||||
myActionsToolBar->setOrientation (Qt::Vertical);
|
myActionsToolBar->setOrientation (Qt::Vertical);
|
||||||
|
|
||||||
myActionsToolBar->addWidget (myView-> GetWidget (View_ViewActionType_FitAllId));
|
myActionsToolBar->addWidget (myView-> GetWidget (View_ViewActionType_FitAllId));
|
||||||
for (int anActionId = View_ViewActionType_FitAreaId; anActionId <= View_ViewActionType_DisplayModeId; anActionId++)
|
myActionsToolBar->addAction (myView->ViewAction (View_ViewActionType_DisplayModeId));
|
||||||
myActionsToolBar->addAction (myView->ViewAction ((View_ViewActionType)anActionId));
|
|
||||||
|
|
||||||
aViewLayout->addWidget (myActionsToolBar, 1, 0);
|
aViewLayout->addWidget (myActionsToolBar, 1, 0);
|
||||||
aViewLayout->addWidget (myView, 1, 1);
|
aViewLayout->addWidget (myView, 1, 1);
|
||||||
@ -96,6 +95,33 @@ void View_Window::SetContext (View_ContextType /*theType*/, const Handle(AIS_Int
|
|||||||
ViewToolBar()->SetContext (View_ContextType_External, theContext);
|
ViewToolBar()->SetContext (View_ContextType_External, theContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// =======================================================================
|
||||||
|
// function : SetPredefinedSize
|
||||||
|
// purpose :
|
||||||
|
// =======================================================================
|
||||||
|
void View_Window::SetPredefinedSize (int theDefaultWidth, int theDefaultHeight)
|
||||||
|
{
|
||||||
|
myView->SetPredefinedSize (theDefaultWidth, theDefaultHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
// =======================================================================
|
||||||
|
// function : SetInitProj
|
||||||
|
// purpose :
|
||||||
|
// =======================================================================
|
||||||
|
void View_Window::SetInitProj (const Standard_Real theVx, const Standard_Real theVy, const Standard_Real theVz)
|
||||||
|
{
|
||||||
|
myView->SetInitProj (theVx, theVy, theVz);
|
||||||
|
}
|
||||||
|
|
||||||
|
// =======================================================================
|
||||||
|
// function : View
|
||||||
|
// purpose :
|
||||||
|
// =======================================================================
|
||||||
|
Handle(V3d_View) View_Window::View() const
|
||||||
|
{
|
||||||
|
return myView->GetViewer()->GetView();
|
||||||
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
// function : SaveState
|
// function : SaveState
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -105,7 +131,7 @@ void View_Window::SaveState (View_Window* theView, QMap<QString, QString>& theIt
|
|||||||
{
|
{
|
||||||
QStringList aCameraDirection;
|
QStringList aCameraDirection;
|
||||||
Standard_Real aVX, aVY, aVZ;
|
Standard_Real aVX, aVY, aVZ;
|
||||||
Handle(V3d_View) aView = theView->ViewWidget()->GetViewer()->GetView();
|
Handle(V3d_View) aView = theView->View();
|
||||||
if (aView.IsNull())
|
if (aView.IsNull())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -135,7 +161,7 @@ bool View_Window::RestoreState (View_Window* theView, const QString& theKey, con
|
|||||||
Standard_Real aVY = aValues.at (1).toDouble();
|
Standard_Real aVY = aValues.at (1).toDouble();
|
||||||
Standard_Real aVZ = aValues.at (2).toDouble();
|
Standard_Real aVZ = aValues.at (2).toDouble();
|
||||||
|
|
||||||
theView->ViewWidget()->SetInitProj (aVX, aVY, aVZ);
|
theView->SetInitProj (aVX, aVY, aVZ);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -196,6 +222,12 @@ void View_Window::onToolBarActionClicked (const int theActionId)
|
|||||||
myDisplayer->DisplayDefaultTrihedron (myViewToolBar->IsActionChecked (theActionId), Standard_True);
|
myDisplayer->DisplayDefaultTrihedron (myViewToolBar->IsActionChecked (theActionId), Standard_True);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case View_ToolActionType_ViewCube:
|
||||||
|
{
|
||||||
|
myDisplayer->DisplayViewCube (myViewToolBar->IsActionChecked (theActionId), Standard_True);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case View_ToolActionType_KeepViewId:
|
case View_ToolActionType_KeepViewId:
|
||||||
{
|
{
|
||||||
myDisplayer->KeepPresentations (myViewToolBar->IsActionChecked (theActionId));
|
myDisplayer->KeepPresentations (myViewToolBar->IsActionChecked (theActionId));
|
||||||
|
@ -64,6 +64,18 @@ public:
|
|||||||
//! \param theContext an AIS context
|
//! \param theContext an AIS context
|
||||||
Standard_EXPORT void SetContext (View_ContextType theType, const Handle(AIS_InteractiveContext)& theContext);
|
Standard_EXPORT void SetContext (View_ContextType theType, const Handle(AIS_InteractiveContext)& theContext);
|
||||||
|
|
||||||
|
//! Sets default size that is used in sizeHint when the widget is firstly show
|
||||||
|
Standard_EXPORT void SetPredefinedSize (int theDefaultWidth, int theDefaultHeight);
|
||||||
|
|
||||||
|
//! Sets initial camera position
|
||||||
|
//! \param theVx direction on Ox
|
||||||
|
//! \param theVy direction on Oy
|
||||||
|
//! \param theVz direction on Oz
|
||||||
|
Standard_EXPORT void SetInitProj (const Standard_Real theVx, const Standard_Real theVy, const Standard_Real theVz);
|
||||||
|
|
||||||
|
//! Returns an active view
|
||||||
|
Standard_EXPORT Handle(V3d_View) View() const;
|
||||||
|
|
||||||
//! Saves state of view window in a container in form: key, value. It saves:
|
//! Saves state of view window in a container in form: key, value. It saves:
|
||||||
//! - visibility of columns,
|
//! - visibility of columns,
|
||||||
//! - columns width
|
//! - columns width
|
||||||
|
Before Width: | Height: | Size: 291 B |
Before Width: | Height: | Size: 245 B |
BIN
tools/View/icons/view_cube.png
Normal file
After Width: | Height: | Size: 331 B |
Before Width: | Height: | Size: 224 B |
Before Width: | Height: | Size: 395 B |
Before Width: | Height: | Size: 224 B |
Before Width: | Height: | Size: 222 B |