From: nds Date: Wed, 31 Oct 2018 07:52:23 +0000 (+0300) Subject: 0030268: Inspectors - improvements in VInspector plugin - Graphic3d_Group properties... X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=d2a12b2806331ad1e336afde952ea88f0d953bdf;p=occt-copy.git 0030268: Inspectors - improvements in VInspector plugin - Graphic3d_Group properties, Line->Aspect() pointer --- diff --git a/tools/VInspector/VInspector_ItemGraphic3dGroup.cxx b/tools/VInspector/VInspector_ItemGraphic3dGroup.cxx index 526c765035..2e59f080b5 100644 --- a/tools/VInspector/VInspector_ItemGraphic3dGroup.cxx +++ b/tools/VInspector/VInspector_ItemGraphic3dGroup.cxx @@ -146,7 +146,7 @@ OpenGl_Element* VInspector_ItemGraphic3dGroup::GetElementNode (const int theRowI // ======================================================================= int VInspector_ItemGraphic3dGroup::GetTableRowCount() const { - return 40; + return 10; } // ======================================================================= @@ -163,38 +163,41 @@ QVariant VInspector_ItemGraphic3dGroup::GetTableData (const int theRow, const in return QVariant(); bool isFirstColumn = theColumn == 0; - //switch (theRow) - //{ - // case 0: return isFirstColumn ? QVariant ("PixelTolerance") : QVariant (myContext->PixelTolerance()); - // case 1: return isFirstColumn ? QVariant ("PickingStrategy") : QVariant (SelectMgr::PickingStrategyToString (myContext->PickingStrategy())); - // case 2: return isFirstColumn ? QVariant ("AutomaticHilight") : QVariant (myContext->AutomaticHilight()); - // case 3: return isFirstColumn ? QVariant ("ToHilightSelected") : QVariant (myContext->ToHilightSelected()); - // case 4: return isFirstColumn ? QVariant ("AutoActivateSelection") : QVariant (myContext->GetAutoActivateSelection()); - // case 5: - // case 6: - // case 7: - // { - // AIS_DisplayStatus aDisplayStatus = (AIS_DisplayStatus)(theRow - 5); - // if (isFirstColumn) - // return QString ("ObjectsByDisplayStatus: %1").arg (AIS::DisplayStatusToString (aDisplayStatus)); - // AIS_ListOfInteractive anObjects; - // myContext->ObjectsByDisplayStatus(aDisplayStatus, anObjects); - // return QVariant (anObjects.Extent()); - // } - // break; - // case 8: return isFirstColumn ? QVariant ("DetectedOwner") : QVariant (VInspector_Tools::GetPointerInfo (myContext->DetectedOwner()).ToCString()); - // case 9: - // { - // if (isFirstColumn) - // return QVariant ("DetectedOwners"); - // int aNbOfDetected = 0; - // for (myContext->InitDetected(); myContext->MoreDetected(); myContext->NextDetected()) - // aNbOfDetected++; - // return aNbOfDetected; - // } - // case 10: return isFirstColumn ? QVariant ("NbSelected") : QVariant (myContext->NbSelected()); - // default: return QVariant(); - //} + switch (theRow) + { + case 0: return isFirstColumn ? QVariant ("LineAspect") : QVariant (ViewControl_Tools::GetPointerInfo (aGroup->LineAspect()).ToCString()); + case 1: return isFirstColumn ? QVariant ("FillAreaAspect") : QVariant (ViewControl_Tools::GetPointerInfo (aGroup->FillAreaAspect()).ToCString()); + case 2: return isFirstColumn ? QVariant ("TextAspect") : QVariant (ViewControl_Tools::GetPointerInfo (aGroup->TextAspect()).ToCString()); + case 3: return isFirstColumn ? QVariant ("MarkerAspect") : QVariant (ViewControl_Tools::GetPointerInfo (aGroup->MarkerAspect()).ToCString()); + case 4: return isFirstColumn ? QVariant ("ContainsFacet") : QVariant (aGroup->ContainsFacet()); + case 5: return isFirstColumn ? QVariant ("IsDeleted") : QVariant (aGroup->IsDeleted()); + case 6: return isFirstColumn ? QVariant ("IsEmpty") : QVariant (aGroup->IsEmpty()); + case 7: return isFirstColumn ? QVariant ("IsClosed") : QVariant (aGroup->IsClosed()); + case 8: + { + if (isFirstColumn) + return QVariant ("MinMaxValues"); + Standard_Real aXMin, anYMin, aZMin, aXMax, anYMax, aZMax; + aGroup->MinMaxValues (aXMin, anYMin, aZMin, aXMax, anYMax, aZMax); + Bnd_Box aBox; + aBox.Update(aXMin, anYMin, aZMin, aXMax, anYMax, aZMax); + return QVariant (ViewControl_Tools::ToString (aBox).ToCString()); + } + case 9: + { + if (isFirstColumn) + return QVariant ("BoundingBox"); + const Graphic3d_BndBox4f& aBndBox = aGroup->BoundingBox(); + Bnd_Box aBox; + aBox.Update((Standard_Real )aBndBox.CornerMin().x(), + (Standard_Real )aBndBox.CornerMin().y(), + (Standard_Real )aBndBox.CornerMin().z(), + (Standard_Real )aBndBox.CornerMax().x(), + (Standard_Real )aBndBox.CornerMax().y(), + (Standard_Real )aBndBox.CornerMax().z()); + return QVariant (ViewControl_Tools::ToString (aBox).ToCString()); + } + } return QVariant(); } diff --git a/tools/VInspector/VInspector_ItemPrs3dAspect.cxx b/tools/VInspector/VInspector_ItemPrs3dAspect.cxx index 7f2e1fd237..7c54f7dd9e 100644 --- a/tools/VInspector/VInspector_ItemPrs3dAspect.cxx +++ b/tools/VInspector/VInspector_ItemPrs3dAspect.cxx @@ -342,7 +342,7 @@ int VInspector_ItemPrs3dAspect::getTableRowCount (const TCollection_AsciiString& else if (theAspectKind == STANDARD_TYPE (Prs3d_IsoAspect)->Name()) return 1 + getTableRowCount (STANDARD_TYPE (Prs3d_LineAspect)->Name()); else if (theAspectKind == STANDARD_TYPE (Prs3d_LineAspect)->Name()) - return 3; // TODO: add Graphic3d_ShaderProgram + return 4; // TODO: add Graphic3d_ShaderProgram else if (theAspectKind == STANDARD_TYPE (Prs3d_PointAspect)->Name()) return 3; // TODO: add Graphic3d_ShaderProgram, Graphic3d_MarkerImage else if (theAspectKind == STANDARD_TYPE (Prs3d_TextAspect)->Name()) @@ -399,9 +399,10 @@ ViewControl_EditType VInspector_ItemPrs3dAspect::getTableEditType (const int the { switch (aRow) { - case 0: return ViewControl_EditType_Color; - case 1: return ViewControl_EditType_Combo; - case 2: return ViewControl_EditType_Double; + case 0: return ViewControl_EditType_None; + case 1: return ViewControl_EditType_Color; + case 2: return ViewControl_EditType_Combo; + case 3: return ViewControl_EditType_Double; default: break; } } @@ -536,7 +537,7 @@ QList VInspector_ItemPrs3dAspect::getTableEnumValues (const int theRow } else if (theAspectKind == STANDARD_TYPE (Prs3d_LineAspect)->Name()) { - if (aRow == 1) + if (aRow == 2) { for (int i = 0; i <= Aspect_TOL_USERDEFINED; i++) aValues.append (Aspect::TypeOfLineToString ((Aspect_TypeOfLine)i)); @@ -714,16 +715,18 @@ QVariant VInspector_ItemPrs3dAspect::getTableData (const int theRow, else if (theAspectKind == STANDARD_TYPE (Prs3d_LineAspect)->Name()) { if (theRole != Qt::DisplayRole && theRole != Qt::BackgroundRole || - (theRole == Qt::BackgroundRole && (isFirstColumn || aRow != 0))) + (theRole == Qt::BackgroundRole && (isFirstColumn || aRow != 1))) return QVariant(); Handle(Prs3d_LineAspect) aCustomAspect = Handle(Prs3d_LineAspect)::DownCast (anAspect); switch (aRow) { - case 0: return getColorData("ColorRGBA", aCustomAspect->Aspect()->ColorRGBA(), isFirstColumn, theRole); - case 1: return isFirstColumn ? QVariant ("Type") - : QVariant (Aspect::TypeOfLineToString (aCustomAspect->Aspect()->Type())); - case 2: return isFirstColumn ? QVariant ("Width") : ViewControl_Tools::ToVariant (aCustomAspect->Aspect()->Width()); + case 0: return isFirstColumn ? QVariant ("Aspect") : + QVariant (ViewControl_Tools::GetPointerInfo (aCustomAspect->Aspect()).ToCString()); + case 1: return getColorData("ColorRGBA", aCustomAspect->Aspect()->ColorRGBA(), isFirstColumn, theRole); + case 2: return isFirstColumn ? QVariant ("Type") + : QVariant (Aspect::TypeOfLineToString (aCustomAspect->Aspect()->Type())); + case 3: return isFirstColumn ? QVariant ("Width") : ViewControl_Tools::ToVariant (aCustomAspect->Aspect()->Width()); default: break; } } @@ -936,9 +939,10 @@ bool VInspector_ItemPrs3dAspect::setTableData (const int theRow, Handle(Graphic3d_AspectLine3d) anAspect = aCustomAspect->Aspect(); switch (aRow) { - case 0: anAspect->SetColor (ViewControl_ColorSelector::StringToColor (theValue.toString())); break; - case 1: anAspect->SetType (Aspect::TypeOfLineFromString (theValue.toString().toStdString().c_str())); break; - case 2: anAspect->SetWidth (ViewControl_Tools::ToShortRealValue (theValue)); break; + case 0: break; + case 1: anAspect->SetColor (ViewControl_ColorSelector::StringToColor (theValue.toString())); break; + case 2: anAspect->SetType (Aspect::TypeOfLineFromString (theValue.toString().toStdString().c_str())); break; + case 3: anAspect->SetWidth (ViewControl_Tools::ToShortRealValue (theValue)); break; default: break; } } diff --git a/tools/ViewControl/ViewControl_Tools.cxx b/tools/ViewControl/ViewControl_Tools.cxx index 36b2401a41..633ca0b987 100644 --- a/tools/ViewControl/ViewControl_Tools.cxx +++ b/tools/ViewControl/ViewControl_Tools.cxx @@ -91,6 +91,9 @@ void ViewControl_Tools::SetDefaultHeaderSections(QTableView* theTableView, const // ======================================================================= TCollection_AsciiString ViewControl_Tools::GetPointerInfo (const Handle(Standard_Transient)& thePointer, const bool isShortInfo) { + if (thePointer.IsNull()) + return TCollection_AsciiString(); + return GetPointerInfo(thePointer.operator->(), isShortInfo); }