mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-24 13:50:49 +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:
@@ -32,7 +32,7 @@ const int DEFAULT_SPACING = 3;
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
View_ToolBar::View_ToolBar (QWidget* theParent, const bool isUseKeepView)
|
||||
: QObject (theParent)
|
||||
: QObject (theParent), myDefaultContextType (-1)
|
||||
{
|
||||
myMainWindow = new QWidget (theParent);
|
||||
|
||||
@@ -63,6 +63,12 @@ View_ToolBar::View_ToolBar (QWidget* theParent, const bool isUseKeepView)
|
||||
myViewContexts[View_ContextType_Own] = Handle(AIS_InteractiveContext)();
|
||||
myViewContexts[View_ContextType_External] = Handle(AIS_InteractiveContext)();
|
||||
|
||||
myActionsMap[View_ToolActionType_Trihedron] = new QToolButton (theParent);
|
||||
myActionsMap[View_ToolActionType_Trihedron]->setIcon (QIcon (":/icons/trihedron.png"));
|
||||
myActionsMap[View_ToolActionType_Trihedron]->setToolTip (tr ("Trihedron display"));
|
||||
myActionsMap[View_ToolActionType_Trihedron]->setCheckable (true);
|
||||
myActionsMap[View_ToolActionType_Trihedron]->setChecked (false);
|
||||
|
||||
if (isUseKeepView)
|
||||
{
|
||||
myActionsMap[View_ToolActionType_KeepViewId] = new QToolButton (theParent);
|
||||
@@ -80,12 +86,12 @@ View_ToolBar::View_ToolBar (QWidget* theParent, const bool isUseKeepView)
|
||||
myActionsMap[View_ToolActionType_KeepViewOffId]->setToolTip (tr ("Keep View Off: clear previously shown presentation"));
|
||||
myActionsMap[View_ToolActionType_KeepViewOffId]->setCheckable (true);
|
||||
myActionsMap[View_ToolActionType_KeepViewOffId]->setChecked (true);
|
||||
}
|
||||
|
||||
myActionsMap[View_ToolActionType_ClearViewId] = new QToolButton (theParent);
|
||||
myActionsMap[View_ToolActionType_ClearViewId]->setIcon (QIcon (":/icons/view_clear.png"));
|
||||
myActionsMap[View_ToolActionType_ClearViewId]->setText (tr ( "Clear View"));
|
||||
myActionsMap[View_ToolActionType_ClearViewId]->setToolTip (tr ("Remove all visualized presentations from view context"));
|
||||
myActionsMap[View_ToolActionType_ClearViewId] = new QToolButton (theParent);
|
||||
myActionsMap[View_ToolActionType_ClearViewId]->setIcon (QIcon (":/icons/view_clear.png"));
|
||||
myActionsMap[View_ToolActionType_ClearViewId]->setText (tr ( "Clear View"));
|
||||
myActionsMap[View_ToolActionType_ClearViewId]->setToolTip (tr ("Remove all visualized presentations from view context"));
|
||||
}
|
||||
|
||||
for (QMap<View_ToolActionType, QToolButton*>::ConstIterator anActionsIt = myActionsMap.begin(),
|
||||
anActionsLast = myActionsMap.end(); anActionsIt != anActionsLast; anActionsIt++)
|
||||
@@ -97,26 +103,6 @@ View_ToolBar::View_ToolBar (QWidget* theParent, const bool isUseKeepView)
|
||||
aLay->addStretch (1);
|
||||
}
|
||||
|
||||
TCollection_AsciiString getPointerInfo (const Handle(Standard_Transient)& thePointer, const bool isShortInfo)
|
||||
{
|
||||
std::ostringstream aPtrStr;
|
||||
aPtrStr << thePointer.operator->();
|
||||
if (!isShortInfo)
|
||||
return aPtrStr.str().c_str();
|
||||
|
||||
TCollection_AsciiString anInfoPtr (aPtrStr.str().c_str());
|
||||
for (int aSymbolId = 1; aSymbolId < anInfoPtr.Length(); aSymbolId++)
|
||||
{
|
||||
if (anInfoPtr.Value(aSymbolId) != '0')
|
||||
{
|
||||
anInfoPtr = anInfoPtr.SubString(aSymbolId, anInfoPtr.Length());
|
||||
anInfoPtr.Prepend("0x");
|
||||
return anInfoPtr;
|
||||
}
|
||||
}
|
||||
return aPtrStr.str().c_str();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetContext
|
||||
// purpose :
|
||||
@@ -128,28 +114,45 @@ void View_ToolBar::SetContext (View_ContextType theType, const Handle(AIS_Intera
|
||||
QString aViewContextName = myViewContextNames[theType];
|
||||
if (!theContext.IsNull())
|
||||
aViewContextName = QString ("%1 : [%2]").arg (myViewContextNames[theType])
|
||||
.arg (getPointerInfo (theContext, true).ToCString());
|
||||
.arg (Standard_Dump::GetPointerInfo (theContext, true).ToCString());
|
||||
// there are only "Own" and "None" items
|
||||
if (!theContext.IsNull() && theType == View_ContextType_External && myViewSelector->count() == 2)
|
||||
myViewSelector->insertItem (View_ContextType_External, aViewContextName);
|
||||
else
|
||||
myViewSelector->setItemText (theType, aViewContextName);
|
||||
|
||||
if (myDefaultContextType >= 0 && myViewSelector->count() > myDefaultContextType)
|
||||
{
|
||||
// using default type during the first setting the external context
|
||||
myViewSelector->setCurrentIndex (myDefaultContextType);
|
||||
myDefaultContextType = -1;
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : getCurrentContextType
|
||||
// function : CurrentContextType
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
View_ContextType View_ToolBar::GetCurrentContextType() const
|
||||
View_ContextType View_ToolBar::CurrentContextType() const
|
||||
{
|
||||
return (View_ContextType)myViewSelector->currentIndex();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetCurrentContext
|
||||
// function : SetCurrentContext
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Handle(AIS_InteractiveContext) View_ToolBar::GetCurrentContext() const
|
||||
void View_ToolBar::SetCurrentContextType (View_ContextType theType)
|
||||
{
|
||||
myViewSelector->setCurrentIndex ((int)theType);
|
||||
emit contextChanged();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : CurrentContext
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Handle(AIS_InteractiveContext) View_ToolBar::CurrentContext() const
|
||||
{
|
||||
View_ContextType aCurrentType = (View_ContextType)myViewSelector->currentIndex();
|
||||
return myViewContexts[aCurrentType];
|
||||
@@ -165,6 +168,35 @@ bool View_ToolBar::IsActionChecked (const int theActionId) const
|
||||
return myActionsMap.contains (anActionId) ? myActionsMap[anActionId]->isChecked() : false;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SaveState
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void View_ToolBar::SaveState (View_ToolBar* theToolBar,
|
||||
QMap<QString, QString>& theItems,
|
||||
const QString& thePrefix)
|
||||
{
|
||||
theItems[thePrefix + "context_type"] = QString::number (theToolBar->CurrentContextType());
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : RestoreState
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
bool View_ToolBar::RestoreState (View_ToolBar* theToolBar,
|
||||
const QString& theKey, const QString& theValue,
|
||||
const QString& thePrefix)
|
||||
{
|
||||
if (theKey == thePrefix + "context_type")
|
||||
{
|
||||
theToolBar->SetDefaultContextType ((View_ContextType)theValue.toInt());
|
||||
}
|
||||
else
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : onActionClicked
|
||||
// purpose :
|
||||
|
Reference in New Issue
Block a user