mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +03:00
0030268: Inspectors - improvements in VInspector plugin
- Convert package creation. It is used to prepare some auxiliary presentations/methods to prepare variables for inspector based on occt classes. - ViewControl package improvement: Classes for property view, table, table model are implemented to visualize view of properties. This view is filled by selection in tree if the selected object has implemented DumpJson functionality. - TreeModel package improvements: Method InitColumn is implemented in TreeModel_TreeModel to fill default columns in base model. The default columns are: Name, Visibility, Rows. Additional columns should be added in successors. Container of root items is moved into the base class - View package imrovements: Store preferences: display mode, fit all checked state and type of external context View_DisplayPreview is added to process preview for selected in tree view objects hide actions Clear, Multi, Single by default (as selection in tree view or Visibility state of item define which presentations should be displayed or erased) - ShapeView plugin improvements: Property View content based on DumpJson (columns in tree view for properties are removed), Properties for TopoDS_Shape are displayed Explode shape action in tree view to see content of shape by selected shape type. Type of displayed shapes is only preview, it is not used in export action. Export shape into BREP. The previous implementation about BREP files in some directory and default view is removed. - VInspector plugin imrovements: Property View content based on DumpJson (columns in tree view for properties are removed), Properties for AIS_InteractiveContext and AIS_InteractiveObject are displayed obsolete classes to provide properties are removed. - DFBrowser plugin improvements: Property View content based on DumpJson is not used yet. But there is the USE_DUMPJSON macro. It's switch off by default. If switch ON, it creates a Property View filled with DumpJson. It's a way of DFBrowser moving on this property view. Init uses static variable CDF_Session::CurrentSession()->CurrentApplication to fill plugin if application in plugin is not set but OCAF application exists - OCC_VERSION_HEX variable used for previous OCCT versions support (before 6.9.0 or 7.2.0) is removed
This commit is contained in:
@@ -19,10 +19,8 @@
|
||||
|
||||
#include <inspector/View_Widget.hxx>
|
||||
|
||||
#include <AIS_Trihedron.hxx>
|
||||
#include <Geom_Axis2Placement.hxx>
|
||||
#include <Graphic3d_GraphicDriver.hxx>
|
||||
#include <Standard_Version.hxx>
|
||||
|
||||
#include <inspector/View_ToolButton.hxx>
|
||||
#include <inspector/View_ViewActionType.hxx>
|
||||
@@ -63,16 +61,21 @@
|
||||
// function : Constructor
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
View_Widget::View_Widget (QWidget* theParent, const bool isFitAllActive)
|
||||
View_Widget::View_Widget (QWidget* theParent,
|
||||
const Handle(AIS_InteractiveContext)& theContext,
|
||||
const bool isFitAllActive)
|
||||
: QWidget (theParent), myCurrentMode (View_CurrentAction3d_Nothing), myFirst (true), myDefaultWidth (-1),
|
||||
myDefaultHeight (-1), myViewIsEnabled (true), myXmin (0), myYmin (0), myXmax (0), myYmax (0), myDragButtonDownX (0),
|
||||
myDragButtonDownY (0), myDragMultiButtonDownX (0), myDragMultiButtonDownY (0), myIsRectVisible (false), myRectBand (0),
|
||||
myHasInitProj (Standard_False), myInitVx (0), myInitVy (0), myInitVz (0)
|
||||
{
|
||||
myViewer = new View_Viewer (View_Viewer::DefaultColor());
|
||||
myViewer->InitStandardViewer();
|
||||
|
||||
myViewer->GetContext()->Display(new AIS_Trihedron (new Geom_Axis2Placement (gp::XOY())), Standard_True);
|
||||
if (!theContext.IsNull())
|
||||
myViewer->InitViewer (theContext);
|
||||
else
|
||||
{
|
||||
myViewer->InitViewer (myViewer->CreateStandardViewer());
|
||||
}
|
||||
|
||||
setAttribute (Qt::WA_PaintOnScreen);
|
||||
setAttribute (Qt::WA_NoSystemBackground);
|
||||
@@ -108,10 +111,6 @@ void View_Widget::Init()
|
||||
#ifdef _WIN32
|
||||
Aspect_Handle aWindowHandle = (Aspect_Handle)winId();
|
||||
Handle(Aspect_Window) aWnd = new WNT_Window (aWindowHandle);
|
||||
#if OCC_VERSION_HEX <= 0x060901
|
||||
myViewer->GetView()->SetZClippingDepth (0.5);
|
||||
myViewer->GetView()->SetZClippingWidth (0.5);
|
||||
#endif
|
||||
#elif defined (__APPLE__) && !defined (MACOSX_USE_GLX)
|
||||
NSView* aViewHandle = (NSView*)winId();
|
||||
Handle(Aspect_Window) aWnd = new Cocoa_Window (aViewHandle);
|
||||
@@ -130,14 +129,23 @@ void View_Widget::Init()
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetDisplayMode
|
||||
// function : DisplayMode
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
int View_Widget::GetDisplayMode() const
|
||||
int View_Widget::DisplayMode() const
|
||||
{
|
||||
return myViewActions[View_ViewActionType_DisplayModeId]->isChecked() ? AIS_Shaded : AIS_WireFrame;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetDisplayMode
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void View_Widget::SetDisplayMode (const int theMode)
|
||||
{
|
||||
myViewActions[View_ViewActionType_DisplayModeId]->setChecked ( theMode ? AIS_Shaded : AIS_WireFrame);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : paintEvent
|
||||
// purpose :
|
||||
@@ -197,7 +205,41 @@ void View_Widget::SetEnabledView (const bool theIsEnabled)
|
||||
myViewer->GetView()->SetBackgroundColor (theIsEnabled ? View_Viewer::DefaultColor()
|
||||
: View_Viewer::DisabledColor());
|
||||
for (int anActionId = View_ViewActionType_FitAreaId; anActionId <= View_ViewActionType_DisplayModeId; anActionId++)
|
||||
GetViewAction ((View_ViewActionType)anActionId)->setEnabled (theIsEnabled);
|
||||
ViewAction ((View_ViewActionType)anActionId)->setEnabled (theIsEnabled);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SaveState
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void View_Widget::SaveState (View_Widget* theWidget,
|
||||
QMap<QString, QString>& theItems,
|
||||
const QString& thePrefix)
|
||||
{
|
||||
theItems[thePrefix + "fitall"] = theWidget->ViewAction (View_ViewActionType_FitAllId)->isChecked();
|
||||
theItems[thePrefix + "dispmode"] = QString::number (theWidget->DisplayMode());
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : RestoreState
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
bool View_Widget::RestoreState (View_Widget* theWidget,
|
||||
const QString& theKey, const QString& theValue,
|
||||
const QString& thePrefix)
|
||||
{
|
||||
if (theKey == thePrefix + "fitall")
|
||||
{
|
||||
theWidget->SetActionChecked (View_ViewActionType_FitAllId, theValue.toInt() > 0);
|
||||
}
|
||||
else if (theKey == thePrefix + "dispmode")
|
||||
{
|
||||
theWidget->SetDisplayMode (theValue.toInt());
|
||||
}
|
||||
else
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -268,10 +310,10 @@ void View_Widget::initViewActions()
|
||||
if (!myViewActions.empty())
|
||||
return;
|
||||
|
||||
myFitAllAction = new View_ToolButton (this); //!< action for automatic fit all
|
||||
myFitAllAction = new View_ToolButton (this); // action for automatic fit all
|
||||
connect (myFitAllAction, SIGNAL (checkedStateChanged(bool)), this, SLOT (onCheckedStateChanged(bool)));
|
||||
createAction (View_ViewActionType_FitAllId, ":/icons/view_fitall.png", tr ("Fit All"), SLOT (OnFitAll()));
|
||||
myFitAllAction->setDefaultAction (GetViewAction (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);
|
||||
@@ -420,6 +462,7 @@ void View_Widget::processLeftButtonDown (const int theFlags, const QPoint thePoi
|
||||
}
|
||||
}
|
||||
activateCursor (myCurrentMode);
|
||||
emit leftButtonDown(thePoint.x(), thePoint.y());
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -513,8 +556,8 @@ void View_Widget::processLeftButtonUp (const int theFlags, const QPoint thePoint
|
||||
myDragMultiButtonDownX = 0;
|
||||
myDragMultiButtonDownY = 0;
|
||||
|
||||
activateCursor (myCurrentMode);
|
||||
emit selectionChanged();
|
||||
emit leftButtonUp(thePoint.x(), thePoint.y());
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -608,6 +651,7 @@ void View_Widget::processMouseMove (const int theFlags, const QPoint thePoint)
|
||||
else
|
||||
processMoveEvent (thePoint.x(), thePoint.y());
|
||||
}
|
||||
emit moveTo (thePoint.x(), thePoint.y());
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
|
Reference in New Issue
Block a user