]> OCCT Git - occt-copy.git/commitdiff
0030268: Inspectors - improvements in VInspector plugin - Graphic3d_Group properties...
authornds <nds@opencascade.com>
Wed, 31 Oct 2018 07:52:23 +0000 (10:52 +0300)
committernds <nds@opencascade.com>
Wed, 31 Oct 2018 07:52:23 +0000 (10:52 +0300)
tools/VInspector/VInspector_ItemGraphic3dGroup.cxx
tools/VInspector/VInspector_ItemPrs3dAspect.cxx
tools/ViewControl/ViewControl_Tools.cxx

index 526c7650357602542ef70fb894062daab8cb1450..2e59f080b5314f06809041ebce9e6fe61c1fb518 100644 (file)
@@ -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();
 }
 
index 7f2e1fd2379a583bc6f3e607c75b0bd13b353701..7c54f7dd9e780391b3a6b8dc5ff0ddde2d332a57 100644 (file)
@@ -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<QVariant> 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;
     }
   }
index 36b2401a4167a8cfee7a210e7ad0aa9de522e159..633ca0b987a37d8c3a097259e7d130acd1bf4ae5 100644 (file)
@@ -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);
 }