]> OCCT Git - occt-copy.git/commitdiff
Remarks from KGV
authorvpa <vpa@opencascade.com>
Mon, 23 Nov 2015 15:55:03 +0000 (18:55 +0300)
committervpa <vpa@opencascade.com>
Wed, 25 Nov 2015 18:09:23 +0000 (21:09 +0300)
13 files changed:
src/Graphic3d/Graphic3d_CStructure.hxx
src/Graphic3d/Graphic3d_LOD.cxx
src/Graphic3d/Graphic3d_LOD.hxx
src/Graphic3d/Graphic3d_Structure.cxx
src/Graphic3d/Graphic3d_Structure.hxx
src/MeshVS/MeshVS_LODDataSource.cxx
src/OpenGl/OpenGl_LOD.cxx
src/OpenGl/OpenGl_LOD.hxx
src/OpenGl/OpenGl_Structure.cxx
src/OpenGl/OpenGl_Structure.hxx
src/Prs3d/Prs3d_Root.cxx
src/Prs3d/Prs3d_Root.hxx
src/XSDRAWSTLVRML/XSDRAWSTLVRML.cxx

index b9cadc537682017288bfae664c16a4719500de5e..5a075b7f5d5b1762b59dd5b1e1a500bafb27e044 100644 (file)
@@ -114,12 +114,12 @@ public:
   virtual Handle(Graphic3d_Group) NewGroup (const Handle(Graphic3d_Structure)& theStruct) = 0;
 
   //! Create new LOD within this structure
-  virtual Handle(Graphic3d_LOD) NewLOD (const Handle(Graphic3d_Structure)& theStruct) = 0;
+  virtual Handle(Graphic3d_LOD) NewLOD() = 0;
 
   //! Remove group from this structure
   virtual void RemoveGroup (const Handle(Graphic3d_Group)& theGroup) = 0;
 
-  virtual Standard_Integer GetDetailLevelsNb() const = 0;
+  virtual Standard_Integer NbDetailLevels() const = 0;
 
   virtual void SetDetailLevelRange (const Standard_Integer theIdOfLOD, const Standard_Real theFrom, const Standard_Real theTo) = 0;
 
index 1871d17c6c734ba5f354aaf7156ee4e29a7a18c5..060b093630e5cec916b9ec8ccec9d5715771a69e 100644 (file)
 Graphic3d_LOD::~Graphic3d_LOD()
 {
   myGroups.Clear();
-  myParent.Nullify();
-}
-
-//=======================================================================
-// function : SetParent
-// purpose  :
-//=======================================================================
-void Graphic3d_LOD::SetParent (const Handle(Graphic3d_Structure)& theParent)
-{
-  myParent = theParent;
 }
 
 //=======================================================================
@@ -47,7 +37,7 @@ void Graphic3d_LOD::SetRange (const Standard_Real /*theFrom*/, const Standard_Re
 // function : NewGroup
 // purpose  :
 //=======================================================================
-Handle(Graphic3d_Group) Graphic3d_LOD::NewGroup()
+Handle(Graphic3d_Group) Graphic3d_LOD::NewGroup (const Handle(Graphic3d_Structure)& /*theParentStruct*/)
 {
   return NULL;
 }
@@ -56,12 +46,13 @@ Handle(Graphic3d_Group) Graphic3d_LOD::NewGroup()
 // function : ComputeMetrics
 // purpose  :
 //=======================================================================
-Standard_Real Graphic3d_LOD::ComputeMetrics (const Handle(Graphic3d_Camera)& theCamera) const
+Standard_Real Graphic3d_LOD::ComputeMetrics (const Handle(Graphic3d_Camera)& theCamera,
+                                             const Handle(Graphic3d_CStructure)& theParentStruct) const
 {
-  if (myParent.IsNull())
+  if (theParentStruct.IsNull())
     return std::numeric_limits<Standard_Real>::max();
 
-  Graphic3d_BndBox4f aBndBox = myParent->CStructure()->BoundingBox();
+  Graphic3d_BndBox4f aBndBox = theParentStruct->BoundingBox();
   const Graphic3d_Vec4 aCenter = aBndBox.Center();
   const gp_Pnt aGpCenter = gp_Pnt (aCenter.x(), aCenter.y(), aCenter.z());
   return (theCamera->Eye().Distance (aGpCenter)) / theCamera->Scale();
index 3882cf32403da9952706826378e6f422484d2590..a3e41d184cde4376750adc6cb95403889a90ad1b 100644 (file)
@@ -30,16 +30,15 @@ public:
   Standard_EXPORT virtual ~Graphic3d_LOD();
 
   Standard_EXPORT virtual void SetRange (const Standard_Real theFrom, const Standard_Real theTo);
-  Standard_EXPORT virtual Handle(Graphic3d_Group) NewGroup();
+  Standard_EXPORT virtual Handle(Graphic3d_Group) NewGroup (const Handle(Graphic3d_Structure)& theParentStruct);
 
-  Standard_EXPORT Standard_Real ComputeMetrics (const Handle(Graphic3d_Camera)& theCamera) const;
-  Standard_EXPORT void SetParent (const Handle(Graphic3d_Structure)& theParent);
+  Standard_EXPORT Standard_Real ComputeMetrics (const Handle(Graphic3d_Camera)& theCamera,
+                                                const Handle(Graphic3d_CStructure)& theParentStruct) const;
 
   DEFINE_STANDARD_RTTI (Graphic3d_LOD, Standard_Transient)
 
 protected:
-  Graphic3d_SequenceOfGroup   myGroups;
-  Handle(Graphic3d_Structure) myParent;
+  Graphic3d_SequenceOfGroup myGroups;
 };
 
 DEFINE_STANDARD_HANDLE (Graphic3d_LOD, Standard_Transient)
index 05e481a6cc69f7de3f0dcdd4867e6aabe3c49c67..cc6a629e1a548e27b011c99b4885f269e8ea0b8b 100644 (file)
@@ -1749,16 +1749,16 @@ Handle(Graphic3d_Group) Graphic3d_Structure::NewGroup()
 //=============================================================================
 Handle(Graphic3d_LOD) Graphic3d_Structure::NewLOD()
 {
-  return myCStructure->NewLOD (this);
+  return myCStructure->NewLOD();
 }
 
 //=============================================================================
-//function : GetDetailLevelsNb
+//function : NbDetailLevels
 //purpose  :
 //=============================================================================
-Standard_Integer Graphic3d_Structure::GetDetailLevelsNb() const
+Standard_Integer Graphic3d_Structure::NbDetailLevels() const
 {
-  return myCStructure->GetDetailLevelsNb();
+  return myCStructure->NbDetailLevels();
 }
 
 //=============================================================================
index 088126f4f2f2b2a344aa035313d0906c15ac8188..94a1fe03a5863e94f5d7992d73007cfbbd902e20 100644 (file)
@@ -497,7 +497,7 @@ public:
   //! Returns the low-level structure
     const Handle(Graphic3d_CStructure)& CStructure() const;
 
-  Standard_EXPORT Standard_Integer GetDetailLevelsNb() const;
+  Standard_EXPORT Standard_Integer NbDetailLevels() const;
 
   Standard_EXPORT void SetDetailLevelRange (const Standard_Integer theIdOfLOD, const Standard_Real theFrom, const Standard_Real theTo);
 
index 36bb712124ec93ee42115a8925f4f4a389dcf91e..932a3f8a40b09048c2aef708d993e6e5044d1df9 100644 (file)
@@ -186,7 +186,7 @@ void MeshVS_LODDataSource::ComputePrs (const Handle(AIS_InteractiveObject) theMe
   if (aMesh.IsNull())
     return;
 
-  Standard_Boolean hasNodes = !myNodeIdxs.IsEmpty();
+  // Standard_Boolean hasNodes = !myNodeIdxs.IsEmpty();
   Standard_Boolean hasTrgs  = !myTriangleIdxs.IsEmpty();
   Handle(Prs3d_Presentation) aMainPrs = theMesh->Presentation();
   const Standard_Integer aDispMode = theMesh->DisplayMode();
@@ -591,12 +591,12 @@ void MeshVS_LODDataSource::drawArrays (const Handle(Prs3d_Presentation)& theBase
   Aspect_TypeOfLine aType;
   Standard_Real aWidth;
 
-  Handle(Graphic3d_LOD) aNewLod = Prs3d_Root::NewLOD (theBasePrs);
+  Handle(Graphic3d_LOD) aNewLod = theBasePrs->NewLOD();
   theFillAsp->Values (aStyle, anIntColor, aBackColor, anEdgeColor, aType, aWidth);
 
   if (isPolygons && theFillAsp->FrontMaterial().Transparency() < 0.01)
   {
-    Handle (Graphic3d_Group) aGroup = aNewLod->NewGroup();
+    Handle (Graphic3d_Group) aGroup = aNewLod->NewGroup (theBasePrs);
 
     theFillAsp->SetEdgeOff();
 
@@ -626,7 +626,7 @@ void MeshVS_LODDataSource::drawArrays (const Handle(Prs3d_Presentation)& theBase
 
   if (isPolylines && !theIsPolygonsEdgesOff)
   {
-    Handle (Graphic3d_Group) aLGroup = aNewLod->NewGroup();
+    Handle (Graphic3d_Group) aLGroup = aNewLod->NewGroup (theBasePrs);
 
     theFillAsp->SetEdgeOff();
     if (theIsSelected)
@@ -642,7 +642,7 @@ void MeshVS_LODDataSource::drawArrays (const Handle(Prs3d_Presentation)& theBase
 
   if (isLinkPolylines)
   {
-    Handle (Graphic3d_Group) aBeamGroup = aNewLod->NewGroup();
+    Handle (Graphic3d_Group) aBeamGroup = aNewLod->NewGroup (theBasePrs);
 
     theFillAsp->SetEdgeOff();
     if (!theIsSelected)
@@ -654,7 +654,7 @@ void MeshVS_LODDataSource::drawArrays (const Handle(Prs3d_Presentation)& theBase
 
   if (isPolygons && theFillAsp->FrontMaterial().Transparency() >= 0.01)
   {
-    Handle (Graphic3d_Group) aGroup = aNewLod->NewGroup();
+    Handle (Graphic3d_Group) aGroup = aNewLod->NewGroup (theBasePrs);
 
     theFillAsp->SetEdgeOff();
 
index 5016d3086abdb9e9d438474dd2d34eb2840f4946..6fcbf98d6e7718344337b55ee324b0d6d34065eb 100644 (file)
@@ -39,9 +39,9 @@ void OpenGl_LOD::SetRange (const Standard_Real theFrom, const Standard_Real theT
 // function : NewGroup
 // purpose  :
 //=======================================================================
-Handle(Graphic3d_Group) OpenGl_LOD::NewGroup()
+Handle(Graphic3d_Group) OpenGl_LOD::NewGroup (const Handle(Graphic3d_Structure)& theParentStruct)
 {
-  Handle(OpenGl_Group) aGroup = new OpenGl_Group (myParent);
+  Handle(OpenGl_Group) aGroup = new OpenGl_Group (theParentStruct);
   myGroups.Append (aGroup);
   return aGroup;
 }
index cf410e8b1c93f08202bf22be6c29b00c7414ab60..925d0b9a9895fc22fbd2346a4f036ff77c8a17a4 100644 (file)
@@ -25,12 +25,11 @@ struct OpenGl_RangeOfLOD
 {
 public:
   OpenGl_RangeOfLOD (const Standard_Real theFrom, const Standard_Real theTo)
+    : myTo (theTo),
+      myFrom (theFrom)
   {
     Standard_ASSERT_RAISE (theFrom < theTo,
       "The upper boundary of the interval must be greater than lower one!");
-
-    myTo = theTo;
-    myFrom = theFrom;
   }
 
   Standard_Boolean IsIn (const Standard_Real theVal) const
@@ -72,7 +71,7 @@ public:
     return myRange;
   }
 
-  Standard_EXPORT virtual Handle(Graphic3d_Group) NewGroup() Standard_OVERRIDE;
+  Standard_EXPORT virtual Handle(Graphic3d_Group) NewGroup (const Handle(Graphic3d_Structure)& theParentStruct) Standard_OVERRIDE;
 
   const Graphic3d_SequenceOfGroup& DrawGroups() const
   {
@@ -82,7 +81,7 @@ public:
   DEFINE_STANDARD_RTTI (OpenGl_LOD, Graphic3d_LOD)
 
 private:
-  OpenGl_RangeOfLOD  myRange;
+  OpenGl_RangeOfLOD myRange;
 };
 
 DEFINE_STANDARD_HANDLE (OpenGl_LOD, Graphic3d_LOD)
index 686009e75a90898bfe60b322048ed49b1287b960..9430ec32e6ab146ad08645b866dbd5f0ec586d82 100644 (file)
@@ -437,10 +437,9 @@ Handle(Graphic3d_Group) OpenGl_Structure::NewGroup (const Handle(Graphic3d_Struc
 // function : NewLOD
 // purpose  :
 // =======================================================================
-Handle(Graphic3d_LOD) OpenGl_Structure::NewLOD (const Handle(Graphic3d_Structure)& theStruct)
+Handle(Graphic3d_LOD) OpenGl_Structure::NewLOD()
 {
   Handle(OpenGl_LOD) aLOD = new OpenGl_LOD();
-  aLOD->SetParent (theStruct);
   myLODVec.Append (aLOD);
   return aLOD;
 }
@@ -539,7 +538,7 @@ void OpenGl_Structure::Render (const Handle(OpenGl_Workspace) &theWorkspace) con
     return;
   }
 
-  Handle(OpenGl_LOD) aLODToRender = NULL;
+  Handle(OpenGl_LOD) aLODToRender;
   if (myLODVec.Size() > 0)
   {
     findCurrentLOD (theWorkspace);
@@ -818,7 +817,7 @@ Standard_Integer OpenGl_Structure::binSearchLOD (const Standard_Integer theFirst
 //=======================================================================
 void OpenGl_Structure::findCurrentLOD (const Handle(OpenGl_Workspace)& theWorkspace) const
 {
-  Standard_Real aMetric = myLODVec.Value (0)->ComputeMetrics (theWorkspace->View()->Camera());
+  Standard_Real aMetric = myLODVec.Value (0)->ComputeMetrics (theWorkspace->View()->Camera(), this);
   std::cout << aMetric << std::endl;
   if (myCurrentLodId != -1 && myLODVec.Value (myCurrentLodId)->GetRange().IsIn (aMetric))
     return;
index 78dedba7df68f523c6798a67b5e0842bb8905100..1485ec60f62d9c378e1549445b4861613b291881 100644 (file)
@@ -101,7 +101,7 @@ public:
   Standard_EXPORT virtual Handle(Graphic3d_Group) NewGroup (const Handle(Graphic3d_Structure)& theStruct);
 
   //! Create new LOD within this structure
-  Standard_EXPORT virtual Handle(Graphic3d_LOD) NewLOD (const Handle(Graphic3d_Structure)& theStruct) Standard_OVERRIDE;
+  Standard_EXPORT virtual Handle(Graphic3d_LOD) NewLOD() Standard_OVERRIDE;
 
   //! Remove group from this structure
   Standard_EXPORT virtual void RemoveGroup (const Handle(Graphic3d_Group)& theGroup);
@@ -201,7 +201,7 @@ public:
   //! Is the structure ray-tracable (contains ray-tracable elements)?
   Standard_Boolean IsRaytracable() const;
 
-  Standard_EXPORT virtual Standard_Integer GetDetailLevelsNb() const Standard_OVERRIDE
+  Standard_EXPORT virtual Standard_Integer NbDetailLevels() const Standard_OVERRIDE
   {
     return (Standard_Integer)myLODVec.Size();
   }
index a9530394b4e5ae5ed945a8b4d214f1b8adeb278f..516705011bc5568201ddef72c0c66d26b31ccdf9 100644 (file)
@@ -25,12 +25,3 @@ Handle (Graphic3d_Group) Prs3d_Root::NewGroup (const Handle (Prs3d_Presentation)
 {
   return Prs3d->NewGroup();
 }
-
-//=======================================================================
-//function : CreateLOD
-//purpose  :
-//=======================================================================
-Handle(Graphic3d_LOD) Prs3d_Root::NewLOD (const Handle (Prs3d_Presentation)& theParentPrs)
-{
-  return theParentPrs->NewLOD();
-}
index ed35e2c5481c27476d1edcdd223c4b45445c5a30..c7c5d05c2e42c0dee5ef43f32af444e9353408b6 100644 (file)
@@ -45,8 +45,6 @@ public:
   //! objects in the display.
   //! A group also contains the attributes whose ranges are limited to the primitives in it.
   Standard_EXPORT static Handle(Graphic3d_Group) NewGroup (const Handle(Prs3d_Presentation)& Prs3d);
-
-  Standard_EXPORT static Handle(Graphic3d_LOD) NewLOD (const Handle (Prs3d_Presentation)& theParentPrs);
 };
 
 
index 25aabbc93110b98323ac85c7c170314457784215..1123970390538d79cd3c3ac94f4a5e02deec1f87 100644 (file)
@@ -1488,7 +1488,7 @@ static int MeshLod (Draw_Interpretor& theDI,
 
   Handle(MeshVS_LODDataSource) aLod = new MeshVS_LODDataSource (aSTLMesh);
   aLod->ComputePrs (aMesh);
-  Standard_Integer aIdOfLod = aMesh->Presentation()->GetDetailLevelsNb();
+  Standard_Integer aIdOfLod = aMesh->Presentation()->NbDetailLevels();
   aMesh->Presentation()->SetDetailLevelRange (aIdOfLod - 1, aFromRange, aToRange);
 
   return 0;