]> OCCT Git - occt-copy.git/commitdiff
0029367: Visualization - simplify interface of V3d_View and V3d_Viewer
authorosa <osa@opencascade.com>
Wed, 30 Oct 2019 13:33:01 +0000 (16:33 +0300)
committerapn <apn@opencascade.com>
Fri, 1 Nov 2019 15:27:06 +0000 (18:27 +0300)
The interface of V3d_View and V3d_Viewer has been simplified.
For the fields myDefinedViews, myActiveViews, myDefinedLights, myActiveLights were added appropriate methods returning the internal raw data.
Make the next methods deprecated:
IfMoreLights(), InitActiveLights(), MoreActiveLights(), NextActiveLights(), ActiveLight() and
InitActiveViews(), MoreActiveViews(), NextActiveViews(), ActiveView(), InitDefinedViews(), MoreDefinedViews(), NextDefinedViews(), DefinedView(),
InitActiveLights(), MoreActiveLights(), NextActiveLights(), ActiveLight(), InitDefinedLights(), MoreDefinedLights(), NextDefinedLights(), DefinedLight().

Remove deprecated methods added in scope of tasks 0029290 and 0028987 (Target Version 7.3.0):
SelectMgr_SelectableObject: Init(), More(), Next(), CurrentSelection().
SelectMgr_Selection: Init(), More(), Next(), Sensitive().
V3d_AmbientLight: one constructor.
V3d_DirectionalLight: two constructors.
V3d_PositionalLight: one constructor.
V3d_SpotLight: two constructors.

26 files changed:
samples/mfc/standard/01_Geometry/src/GeomSources.cpp
samples/mfc/standard/04_Viewer3d/src/TexturesExt_Presentation.cpp
samples/mfc/standard/04_Viewer3d/src/Viewer3dDoc.cpp
samples/mfc/standard/04_Viewer3d/src/Viewer3dView.cpp
samples/mfc/standard/07_Triangulation/src/TriangulationDoc.cpp
samples/mfc/standard/10_Convert/src/WNT/OCCDemoDoc.cpp
samples/mfc/standard/Common/OCC_3dBaseDoc.cpp
src/AIS/AIS_ColorScale.cxx
src/SelectMgr/SelectMgr_SelectableObject.cxx
src/SelectMgr/SelectMgr_SelectableObject.hxx
src/SelectMgr/SelectMgr_Selection.cxx
src/SelectMgr/SelectMgr_Selection.hxx
src/V3d/V3d_AmbientLight.cxx
src/V3d/V3d_AmbientLight.hxx
src/V3d/V3d_DirectionalLight.cxx
src/V3d/V3d_DirectionalLight.hxx
src/V3d/V3d_PositionLight.cxx
src/V3d/V3d_PositionLight.hxx
src/V3d/V3d_PositionalLight.cxx
src/V3d/V3d_PositionalLight.hxx
src/V3d/V3d_SpotLight.cxx
src/V3d/V3d_SpotLight.hxx
src/V3d/V3d_View.hxx
src/V3d/V3d_Viewer.hxx
src/ViewerTest/ViewerTest_ViewerCommands.cxx
tools/View/View_Displayer.cxx

index 562812f08a7ccb0e36c9132683790993febd3456..91557132809affb159a2f2ab601cad7b654357c6 100755 (executable)
@@ -216,8 +216,7 @@ void GeomSources::DisplaySurface(CGeometryDoc* aDoc,
 
 void GeomSources::ResetView(CGeometryDoc* aDoc)
 {
-  aDoc->GetAISContext()->CurrentViewer()->InitActiveViews();
-  Handle(V3d_View) aView = aDoc->GetAISContext()->CurrentViewer()->ActiveView();
+  Handle(V3d_View) aView = aDoc->GetAISContext()->CurrentViewer()->ActiveViews().First();
   aView->Reset();
 }
 
index c0badccdd9413f1bf56a95e466ed418583a99a28..27048c1c0bb2dc6199ddee29466133e7a9068588 100755 (executable)
@@ -68,8 +68,7 @@ void TexturesExt_Presentation::DoSample()
 void TexturesExt_Presentation::Init()
 {
   // initialize v3d_view so it displays TexturesExt well
-  getViewer()->InitActiveViews();
-  Handle(V3d_View) aView = getViewer()->ActiveView();
+  Handle(V3d_View) aView = getViewer()->ActiveViews().First();
   aView->SetSize(ZVIEW_SIZE);
 
 //  getDocument()->UpdateResultMessageDlg("Textured Shape", 
index 03b667f934e0a290a6c5e96ca5651c49adf9ba39..7e36e17153736988cd6ed1dcf9402021269ecf18 100755 (executable)
@@ -1020,8 +1020,7 @@ void CViewer3dDoc::OnDumpView()
     pView->UpdateWindow();
   }
 
-  myViewer->InitActiveViews();
-  Handle(V3d_View) aView = myViewer->ActiveView();
+  Handle(V3d_View) aView = myViewer->ActiveViews().First();
   ExportView (aView);
 }
 
index fcdeb4598c5c450830ef58d9a2a65219d1c08e9f..62f5df33161636b72a0a7470e1f214b169b88f00 100755 (executable)
@@ -1012,65 +1012,61 @@ aParams.NbMsaaSamples = aParams.NbMsaaSamples == 0 ? 8 : 0;\n\
 GetDocument()->UpdateResultMessageDlg("SetAntialiasingOn/SetAntialiasingOff",Message);
 }
 
-void CViewer3dView::OnClearLights() 
+void CViewer3dView::OnClearLights()
 {
-//     Setting Off all viewer active lights
-    TColStd_ListOfTransient lights;
-       for(myView->Viewer()->InitActiveLights(); myView->Viewer()->MoreActiveLights(); myView->Viewer()->NextActiveLights())
+// Setting Off all viewer active lights
+    V3d_ListOfLight lights;
+    for (V3d_ListOfLightIterator anIter = myView->Viewer()->ActiveLightIterator(); anIter.More(); anIter.Next())
     {
-        lights.Append(myView->Viewer()->ActiveLight());
+        lights.Append (anIter.Value());
     }
-    TColStd_ListIteratorOfListOfTransient itrLights(lights);
+    V3d_ListOfLightIterator itrLights(lights);
     for (; itrLights.More(); itrLights.Next())
     {
-        Handle(V3d_Light) light = Handle(V3d_Light)::DownCast(itrLights.Value());
-        myView->Viewer()->SetLightOff(light);
+        myView->Viewer()->SetLightOff (itrLights.Value());
     }
 
-//     Setting Off all view active lights
+// Setting Off all view active lights
     lights.Clear();
-    for(myView->InitActiveLights(); myView->MoreActiveLights(); myView->NextActiveLights())
+    for (V3d_ListOfLightIterator anIter = myView->ActiveLightIterator(); anIter.More(); anIter.Next())
     {
-        lights.Append(myView->ActiveLight());
+        lights.Append (anIter.Value());
     }
-    itrLights.Initialize(lights);
+    itrLights.Initialize (lights);
     for (; itrLights.More(); itrLights.Next())
     {
-        Handle(V3d_Light) light = Handle(V3d_Light)::DownCast(itrLights.Value());
-        myView->SetLightOff(light);
+        myView->SetLightOff (itrLights.Value());
     }
 
-       myView->Viewer()->SetDefaultLights();// Setting the default lights on
+    myView->Viewer()->SetDefaultLights(); // Setting the default lights on
 
-       NbActiveLights = 2;// There are 2 default active lights
+    NbActiveLights = 2; // There are 2 default active lights
 
-       myView->Update();
+    myView->Update();
 
 TCollection_AsciiString Message("\
-//     Setting Off all viewer active lights\n\
-TColStd_ListOfTransient lights;\n\
-for(myView->Viewer()->InitActiveLights(); myView->Viewer()->MoreActiveLights(); myView->Viewer()->NextActiveLights())\n\
+// Setting Off all viewer active lights\n\
+V3d_ListOfLight lights;\n\
+for (V3d_ListOfLightIterator anIter = myView->Viewer()->ActiveLightIterator(); anIter.More(); anIter.Next())\n\
 {\n\
-    lights.Append(myView->Viewer()->ActiveLight());\n\
+    lights.Append (anIter.Value());\n\
 }\n\
-TColStd_ListIteratorOfListOfTransient itrLights(lights);\n\
+V3d_ListOfLightIterator itrLights(lights);\n\
 for (; itrLights.More(); itrLights.Next())\n\
 {\n\
-    Handle(V3d_Light) light = Handle(V3d_Light)::DownCast(itrLights.Value());\n\
-    myView->Viewer()->SetLightOff(light);\n\
+    myView->Viewer()->SetLightOff (itrLights.Value())\n\
 }\n\
 \n\
-//     Setting Off all view active lights\n\
+// Setting Off all view active lights\n\
 lights.Clear();\n\
-for(myView->InitActiveLights(); myView->MoreActiveLights(); myView->NextActiveLights())\n\
+for (V3d_ListOfLightIterator anIter = myView->ActiveLightIterator(); anIter.More(); anIter.Next())\n\
 {\n\
-    lights.Append(myView->ActiveLight());\n\
+    lights.Append (anIter.Value());\n\
 }\n\
 itrLights.Initialize(lights);\n\
 for (; itrLights.More(); itrLights.Next())\n\
 {\n\
-    Handle(V3d_Light) light = Handle(V3d_Light)::DownCast(itrLights.Value());\n\
-    myView->SetLightOff(light);\n\
+    myView->SetLightOff (itrLights.Value());\n\
 }\n\
 \n\
 myView->Viewer()->SetDefaultLights();// Setting the default lights on\n\
index 4b7f5342b0952c1c2d46d338b20387239d2b6b27..d25bf8924d3fb7e75bdfbc9a963e84e2245da2c5 100755 (executable)
@@ -413,8 +413,7 @@ void CTriangulationDoc::OnDumpView()
     pView->UpdateWindow();
   }
 
-  myViewer->InitActiveViews();
-  Handle(V3d_View) aView = myViewer->ActiveView();
+  Handle(V3d_View) aView = myViewer->ActiveViews().First();
   ExportView (aView);
 }
 
index 6aa31decc9723f5d30bae9cf3934617a21636482..ae16d934282ef3095922d5bc3fde9bfc33f4a2c3 100755 (executable)
@@ -230,8 +230,7 @@ void COCCDemoDoc::OnDumpView()
     pView->UpdateWindow();
   }
 
-  myViewer->InitActiveViews();
-  Handle(V3d_View) aView = myViewer->ActiveView();
+  Handle(V3d_View) aView = myViewer->ActiveViews().First();
   ExportView (aView);
 }
 
index 7578112cb0ff55a3aaf59643ad3f4a0655a4fe82..19ab71b7d7c3047ee428f605f2093d332a913b6f 100755 (executable)
@@ -489,8 +489,7 @@ void OCC_3dBaseDoc::OnUpdateV3dButtons (CCmdUI* pCmdUI)
 // Common function to change raytracing params and redraw view
 void OCC_3dBaseDoc::OnObjectRayTracingAction()
 {
-  myAISContext->CurrentViewer()->InitActiveViews();
-  Handle(V3d_View) aView = myAISContext->CurrentViewer()->ActiveView();
+  Handle(V3d_View) aView = myAISContext->CurrentViewer()->ActiveViews().First();
   Graphic3d_RenderingParams& aParams = aView->ChangeRenderingParams();
   if (myRayTracingIsOn)
     aParams.Method = Graphic3d_RM_RAYTRACING;
index c69883328b4d43a399f75c09c4576ef75e493872..ebc618b81d4a809963e7480ece9caea09d65abb6 100644 (file)
@@ -415,11 +415,6 @@ Standard_Boolean AIS_ColorScale::FindColor (const Standard_Real theValue,
 //=======================================================================
 Standard_Integer AIS_ColorScale::computeMaxLabelWidth (const TColStd_SequenceOfExtendedString& theLabels) const
 {
-  {
-    Handle(V3d_Viewer) aViewer = GetContext()->CurrentViewer();
-    aViewer->InitActiveViews(); // for AIS_ColorScale::TextSize()
-  }
-
   Standard_Integer aWidthMax = 0;
   for (TColStd_SequenceOfExtendedString::Iterator aLabIter (theLabels); aLabIter.More(); aLabIter.Next())
   {
index cedd1c00d3c6f056ed42f1722b9a96104a4efdb5..992f8143298363f687e21e5162a7a045847e47f5 100644 (file)
@@ -49,7 +49,6 @@ namespace
 SelectMgr_SelectableObject::SelectMgr_SelectableObject (const PrsMgr_TypeOfPresentation3d aTypeOfPresentation3d)
 : PrsMgr_PresentableObject (aTypeOfPresentation3d),
   myGlobalSelMode          (0),
-  mycurrent                (0),
   myAutoHilight            (Standard_True)
 {
   //
index 73885090a2d4d6b0916698f8cc4010e32ddd8cc3..1d3566b15eecbd4471817679afb3f74d0cf5e0ff 100644 (file)
@@ -172,24 +172,6 @@ public:
   //! Dumps the content of me into the stream
   Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const Standard_OVERRIDE;
 
-public:
-
-  //! Begins the iteration scanning for sensitive primitives.
-  Standard_DEPRECATED("Deprecated method, Selections() should be used instead")
-  void Init() { mycurrent = 1; }
-
-  //! Continues the iteration scanning for sensitive primitives.
-  Standard_DEPRECATED("Deprecated method, Selections() should be used instead")
-  Standard_Boolean More() const { return mycurrent <= myselections.Length(); }
-
-  //! Continues the iteration scanning for sensitive primitives.
-  Standard_DEPRECATED("Deprecated method, Selections() should be used instead")
-  void Next() { ++mycurrent; }
-
-  //! Returns the current selection in this framework.
-  Standard_DEPRECATED("Deprecated method, Selections() should be used instead")
-  const Handle(SelectMgr_Selection)& CurrentSelection() const { return myselections (mycurrent); }
-
 protected:
 
   //! Protected empty constructor.
@@ -214,7 +196,6 @@ protected:
   Handle(Prs3d_Presentation)    mySelectionPrs;  //!< optional presentation for highlighting selected object
   Handle(Prs3d_Presentation)    myHilightPrs;    //!< optional presentation for highlighting detected object
   Standard_Integer              myGlobalSelMode; //!< global selection mode
-  Standard_Integer              mycurrent;       //!< [deprecated] iterator value
   Standard_Boolean              myAutoHilight;   //!< auto-highlighting flag defining
 
 };
index b42881df730cacab862407868f44a43a9604d0ff..8109a3dbd93afc847826e28989d81d056e473b50 100644 (file)
@@ -26,8 +26,7 @@ IMPLEMENT_STANDARD_RTTIEXT(SelectMgr_Selection,Standard_Transient)
 // Purpose :
 //==================================================
 SelectMgr_Selection::SelectMgr_Selection (const Standard_Integer theModeIdx)
-: myEntityIter (0),
-  myMode (theModeIdx),
+: myMode (theModeIdx),
   mySelectionState (SelectMgr_SOS_Unknown),
   myBVHUpdateStatus (SelectMgr_TBU_None),
   mySensFactor (2),
index 1287306fb04d020f82e9bf35e84c755132a0d149..500b2d6f14008c6b6f297c6aa37740464895f0ef 100644 (file)
@@ -92,25 +92,6 @@ public:
   //! Return entities.
   NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>& ChangeEntities() { return myEntities; }
 
-  //! Begins an iteration scanning for sensitive primitives.
-  Standard_DEPRECATED("Deprecated method, Entities() should be used instead")
-  void Init() { myEntityIter = myEntities.Lower(); }
-
-  //! Continues the iteration scanning for sensitive
-  //! primitives with the mode defined in this framework.
-  Standard_DEPRECATED("Deprecated method, Entities() should be used instead")
-  Standard_Boolean More() const { return myEntityIter <= myEntities.Upper(); }
-
-  //! Returns the next sensitive primitive found in the
-  //! iteration. This is a scan for entities with the mode
-  //! defined in this framework.
-  Standard_DEPRECATED("Deprecated method, Entities() should be used instead")
-  void Next() { ++myEntityIter; }
-
-  //! Returns any sensitive primitive in this framework.
-  Standard_DEPRECATED("Deprecated method, Entities() should be used instead")
-  const Handle(SelectMgr_SensitiveEntity)& Sensitive() const { return myEntities.Value (myEntityIter); }
-
   //! Returns the flag UpdateFlag.
   //! This flage gives the update status of this framework
   //! in a ViewerSelector object:
@@ -142,7 +123,6 @@ public:
 private:
 
   NCollection_Vector<Handle(SelectMgr_SensitiveEntity)> myEntities;
-  Standard_Integer                                      myEntityIter;
   Standard_Integer                                      myMode;
   SelectMgr_TypeOfUpdate                                myUpdateStatus;
   mutable SelectMgr_StateOfSelection                    mySelectionState;
index 3dc99869febf241b58445524cbda9ddaff7779bc..a64ee21861943341d64ae5be57a3be2e4d87195d 100644 (file)
@@ -28,18 +28,3 @@ V3d_AmbientLight::V3d_AmbientLight (const Quantity_Color& theColor)
 {
   SetColor (theColor);
 }
-
-// =======================================================================
-// function : V3d_AmbientLight
-// purpose  :
-// =======================================================================
-V3d_AmbientLight::V3d_AmbientLight (const Handle(V3d_Viewer)& theViewer,
-                                    const Quantity_Color& theColor)
-: Graphic3d_CLight (Graphic3d_TOLS_AMBIENT)
-{
-  SetColor (theColor);
-  if (!theViewer.IsNull())
-  {
-    theViewer->AddLight (this);
-  }
-}
index eccc5a012444fe6e3a6a8c56d8e90b3b67adb51e..8a19d9df2082d30c113dd43036d997beaf79a2c1 100644 (file)
@@ -31,12 +31,6 @@ public:
   //! The default Color of this light source is WHITE.
   Standard_EXPORT V3d_AmbientLight (const Quantity_Color& theColor = Quantity_NOC_WHITE);
 
-  //! Constructs an ambient light source in the viewer.
-  //! The default Color of this light source is WHITE.
-  Standard_DEPRECATED("This constructor is deprecated - the light source should be added to V3d_Viewer explicitly by method V3d_Viewer::AddLight()")
-  Standard_EXPORT V3d_AmbientLight (const Handle(V3d_Viewer)& theViewer,
-                                    const Quantity_Color& theColor = Quantity_NOC_WHITE);
-
 //! @name hidden properties not applicable to ambient light
 private:
 
index 69aac382fad4cea9bd0282649577f4fd6a8b64a9..ab4aa39a1f18932ac07dd848c7ce9876de7493f1 100644 (file)
@@ -24,7 +24,7 @@ IMPLEMENT_STANDARD_RTTIEXT(V3d_DirectionalLight,V3d_PositionLight)
 V3d_DirectionalLight::V3d_DirectionalLight (const V3d_TypeOfOrientation theDirection,
                                             const Quantity_Color& theColor,
                                             const Standard_Boolean theIsHeadlight)
-: V3d_PositionLight (Graphic3d_TOLS_DIRECTIONAL, Handle(V3d_Viewer)())
+: V3d_PositionLight (Graphic3d_TOLS_DIRECTIONAL)
 {
   SetColor (theColor);
   SetHeadlight (theIsHeadlight);
@@ -38,48 +38,13 @@ V3d_DirectionalLight::V3d_DirectionalLight (const V3d_TypeOfOrientation theDirec
 V3d_DirectionalLight::V3d_DirectionalLight (const gp_Dir& theDirection,
                                             const Quantity_Color& theColor,
                                             const Standard_Boolean theIsHeadlight)
-: V3d_PositionLight (Graphic3d_TOLS_DIRECTIONAL, Handle(V3d_Viewer)())
+: V3d_PositionLight (Graphic3d_TOLS_DIRECTIONAL)
 {
   SetColor (theColor);
   SetHeadlight (theIsHeadlight);
   SetDirection (theDirection);
 }
 
-// =======================================================================
-// function : V3d_DirectionalLight
-// purpose  :
-// =======================================================================
-V3d_DirectionalLight::V3d_DirectionalLight (const Handle(V3d_Viewer)& theViewer,
-                                            const V3d_TypeOfOrientation theDirection,
-                                            const Quantity_Color& theColor,
-                                            const Standard_Boolean theIsHeadlight)
-: V3d_PositionLight (Graphic3d_TOLS_DIRECTIONAL, theViewer)
-{
-  SetColor (theColor);
-  SetHeadlight (theIsHeadlight);
-  SetDirection (V3d::GetProjAxis (theDirection));
-}
-
-// =======================================================================
-// function : V3d_DirectionalLight
-// purpose  :
-// =======================================================================
-V3d_DirectionalLight::V3d_DirectionalLight (const Handle(V3d_Viewer)& theViewer,
-                                            const Standard_Real theXt,
-                                            const Standard_Real theYt,
-                                            const Standard_Real theZt,
-                                            const Standard_Real theXp,
-                                            const Standard_Real theYp,
-                                            const Standard_Real theZp,
-                                            const Quantity_Color& theColor,
-                                            const Standard_Boolean theIsHeadlight)
-: V3d_PositionLight (Graphic3d_TOLS_DIRECTIONAL, theViewer)
-{
-  SetColor (theColor);
-  SetHeadlight (theIsHeadlight);
-  SetDirection (gp_Dir (gp_XYZ (theXt, theYt, theZt) - gp_XYZ(theXp, theYp, theZp)));
-}
-
 // =======================================================================
 // function : SetDirection
 // purpose  :
index 30215cc9c3ebefb1036d7a4a08ed45957a6bf5c5..73cb5b174d744602a82348cce6be0ea236ed1463 100644 (file)
@@ -40,29 +40,6 @@ public:
   Standard_EXPORT void SetDirection (V3d_TypeOfOrientation theDirection);
   using Graphic3d_CLight::SetDirection;
 
-public:
-
-  Standard_DEPRECATED("This constructor is deprecated - the light source should be added to V3d_Viewer explicitly by method V3d_Viewer::AddLight()")
-  Standard_EXPORT V3d_DirectionalLight (const Handle(V3d_Viewer)& theViewer,
-                                        const V3d_TypeOfOrientation theDirection = V3d_XposYposZpos,
-                                        const Quantity_Color& theColor = Quantity_NOC_WHITE,
-                                        const Standard_Boolean theIsHeadlight = Standard_False);
-
-  //! Creates a directional light source in the viewer.
-  //! theXt, theYt, theZt : Coordinate of light source Target.
-  //! theXp, theYp, theZp : Coordinate of light source Position.
-  //! The others parameters describe before.
-  Standard_DEPRECATED("This constructor is deprecated - the light source should be added to V3d_Viewer explicitly by method V3d_Viewer::AddLight()")
-  Standard_EXPORT V3d_DirectionalLight (const Handle(V3d_Viewer)& theViewer,
-                                        const Standard_Real theXt,
-                                        const Standard_Real theYt,
-                                        const Standard_Real theZt,
-                                        const Standard_Real theXp,
-                                        const Standard_Real theYp,
-                                        const Standard_Real theZp,
-                                        const Quantity_Color& theColor = Quantity_NOC_WHITE,
-                                        const Standard_Boolean theIsHeadlight = Standard_False);
-
 //! @name hidden properties not applicable to directional light
 private:
 
index fae04322347cd43c611456d6694e32e5121b2a22..8f2a6170ca55a7b3f6fe60645ee5d8cfc15a57f2 100644 (file)
 
 #include <V3d_PositionLight.hxx>
 
-#include <V3d_Viewer.hxx>
-
 IMPLEMENT_STANDARD_RTTIEXT(V3d_PositionLight, Graphic3d_CLight)
 
 // =======================================================================
 // function : V3d_PositionLight
 // purpose  :
 // =======================================================================
-V3d_PositionLight::V3d_PositionLight (Graphic3d_TypeOfLightSource theType,
-                                      const Handle(V3d_Viewer)& theViewer)
+V3d_PositionLight::V3d_PositionLight (Graphic3d_TypeOfLightSource theType)
 : Graphic3d_CLight (theType)
 {
-  if (!theViewer.IsNull())
-  {
-    theViewer->AddLight (this);
-  }
 }
index f1a656c8b0987ef65388b2c9e6ccb272d0d6dea5..b0b781f010096b7ef480dd66e0b7ec69df864be5 100644 (file)
@@ -22,8 +22,6 @@
 #include <V3d_TypeOfPickLight.hxx>
 #include <V3d_TypeOfRepresentation.hxx>
 
-class V3d_Viewer;
-
 //! Base class for Positional, Spot and Directional Light classes.
 class V3d_PositionLight : public Graphic3d_CLight
 {
@@ -31,8 +29,7 @@ class V3d_PositionLight : public Graphic3d_CLight
 protected:
 
   //! Protected constructor.
-  Standard_EXPORT V3d_PositionLight (Graphic3d_TypeOfLightSource theType,
-                                     const Handle(V3d_Viewer)& theViewer);
+  Standard_EXPORT V3d_PositionLight (Graphic3d_TypeOfLightSource theType);
 
 //! @name hidden properties not applicable to positional light
 protected:
index 9cc8660b156e4cb8b1eb2f78357e533cb4b2998f..7613a824ee92f0251199facf69643e585bc47441 100644 (file)
@@ -21,26 +21,8 @@ IMPLEMENT_STANDARD_RTTIEXT(V3d_PositionalLight,V3d_PositionLight)
 // =======================================================================
 V3d_PositionalLight::V3d_PositionalLight (const gp_Pnt& thePos,
                                           const Quantity_Color& theColor)
-: V3d_PositionLight (Graphic3d_TOLS_POSITIONAL, Handle(V3d_Viewer)())
+: V3d_PositionLight (Graphic3d_TOLS_POSITIONAL)
 {
   SetColor (theColor);
   SetPosition (thePos);
 }
-
-// =======================================================================
-// function : V3d_PositionalLight
-// purpose  :
-// =======================================================================
-V3d_PositionalLight::V3d_PositionalLight (const Handle(V3d_Viewer)& theViewer,
-                                          const Standard_Real theX,
-                                          const Standard_Real theY,
-                                          const Standard_Real theZ,
-                                          const Quantity_Color& theColor,
-                                          const Standard_Real theConstAttenuation,
-                                          const Standard_Real theLinearAttenuation)
-: V3d_PositionLight (Graphic3d_TOLS_POSITIONAL, theViewer)
-{
-  SetColor (theColor);
-  SetPosition (theX, theY, theZ);
-  SetAttenuation ((float )theConstAttenuation, (float )theLinearAttenuation);
-}
index 33905e5edfbc2b3168b72708985af126fe3d11af..5e34b370ab12445c6d76021a8a0cffc2f6887864 100644 (file)
@@ -38,17 +38,6 @@ public:
   using Graphic3d_CLight::Position;
   using Graphic3d_CLight::SetPosition;
 
-public:
-
-  Standard_DEPRECATED("This constructor is deprecated - the light source should be added to V3d_Viewer explicitly by method V3d_Viewer::AddLight()")
-  Standard_EXPORT V3d_PositionalLight (const Handle(V3d_Viewer)& theViewer,
-                                       const Standard_Real theX,
-                                       const Standard_Real theY,
-                                       const Standard_Real theZ,
-                                       const Quantity_Color& theColor = Quantity_NOC_WHITE,
-                                       const Standard_Real theConstAttenuation = 1.0,
-                                       const Standard_Real theLinearAttenuation = 0.0);
-
 //! @name hidden properties not applicable to positional light
 private:
 
index 1329ec3cf1bdaad3a1d20fdf9479fffa1fed775f..faae6f9b0f413bd383e0e925745799e193fa1da5 100644 (file)
@@ -24,7 +24,7 @@ IMPLEMENT_STANDARD_RTTIEXT(V3d_SpotLight,V3d_PositionLight)
 V3d_SpotLight::V3d_SpotLight (const gp_Pnt& thePos,
                               const V3d_TypeOfOrientation theDirection,
                               const Quantity_Color& theColor)
-: V3d_PositionLight (Graphic3d_TOLS_SPOT, Handle(V3d_Viewer)())
+: V3d_PositionLight (Graphic3d_TOLS_SPOT)
 {
   SetColor (theColor);
   SetPosition (thePos);
@@ -38,63 +38,13 @@ V3d_SpotLight::V3d_SpotLight (const gp_Pnt& thePos,
 V3d_SpotLight::V3d_SpotLight (const gp_Pnt& thePos,
                               const gp_Dir& theDirection,
                               const Quantity_Color& theColor)
-: V3d_PositionLight (Graphic3d_TOLS_SPOT, Handle(V3d_Viewer)())
+: V3d_PositionLight (Graphic3d_TOLS_SPOT)
 {
   SetColor (theColor);
   SetPosition (thePos);
   SetDirection (theDirection);
 }
 
-// =======================================================================
-// function : V3d_SpotLight
-// purpose  :
-// =======================================================================
-V3d_SpotLight::V3d_SpotLight (const Handle(V3d_Viewer)& theViewer,
-                              const Standard_Real theX,
-                              const Standard_Real theY,
-                              const Standard_Real theZ,
-                              const V3d_TypeOfOrientation theDirection,
-                              const Quantity_Color& theColor,
-                              const Standard_Real theConstAttenuation,
-                              const Standard_Real theLinearAttenuation,
-                              const Standard_Real theConcentration,
-                              const Standard_Real theAngle)
-: V3d_PositionLight (Graphic3d_TOLS_SPOT, theViewer)
-{
-  SetColor (theColor);
-  SetPosition (theX, theY, theZ);
-  SetDirection (V3d::GetProjAxis (theDirection));
-  SetAttenuation ((float )theConstAttenuation, (float )theLinearAttenuation);
-  SetConcentration ((float )theConcentration);
-  SetAngle ((float )theAngle);
-}
-
-// =======================================================================
-// function : V3d_SpotLight
-// purpose  :
-// =======================================================================
-V3d_SpotLight::V3d_SpotLight (const Handle(V3d_Viewer)& theViewer,
-                              const Standard_Real theXt,
-                              const Standard_Real theYt,
-                              const Standard_Real theZt,
-                              const Standard_Real theXp,
-                              const Standard_Real theYp,
-                              const Standard_Real theZp,
-                              const Quantity_Color& theColor,
-                              const Standard_Real theConstAttenuation,
-                              const Standard_Real theLinearAttenuation,
-                              const Standard_Real theConcentration,
-                              const Standard_Real theAngle)
-: V3d_PositionLight (Graphic3d_TOLS_SPOT, theViewer)
-{
-  SetColor (theColor);
-  SetPosition (theXp, theYp, theZp);
-  SetDirection (theXt - theXp, theYt - theYp, theZt - theZp);
-  SetAttenuation ((float )theConstAttenuation, (float )theLinearAttenuation);
-  SetConcentration ((float )theConcentration);
-  SetAngle ((float )theAngle);
-}
-
 // =======================================================================
 // function : SetDirection
 // purpose  :
index 8d1de065514e77077ab5887c29c95e869dd573fe..1bdccbde983bf8f34f3c8d006fce8b8f56efa48d 100644 (file)
@@ -52,36 +52,6 @@ public:
   using Graphic3d_CLight::Position;
   using Graphic3d_CLight::SetPosition;
 
-public:
-
-  Standard_DEPRECATED("This constructor is deprecated - the light source should be added to V3d_Viewer explicitly by method V3d_Viewer::AddLight()")
-  Standard_EXPORT V3d_SpotLight (const Handle(V3d_Viewer)& theViewer,
-                                 const Standard_Real theX,
-                                 const Standard_Real theY,
-                                 const Standard_Real theZ,
-                                 const V3d_TypeOfOrientation theDirection = V3d_XnegYnegZpos,
-                                 const Quantity_Color& theColor = Quantity_NOC_WHITE,
-                                 const Standard_Real theConstAttenuation = 1.0,
-                                 const Standard_Real theLinearAttenuation = 0.0,
-                                 const Standard_Real theConcentration = 1.0,
-                                 const Standard_Real theAngle = 0.523599);
-  
-  //! theXt, theYt, theZt : Coordinate of light source Target.
-  //! theXp, theYp, theZp : Coordinate of light source Position.
-  Standard_DEPRECATED("This constructor is deprecated - the light source should be added to V3d_Viewer explicitly by method V3d_Viewer::AddLight()")
-  Standard_EXPORT V3d_SpotLight (const Handle(V3d_Viewer)& theViewer,
-                                 const Standard_Real theXt,
-                                 const Standard_Real theYt,
-                                 const Standard_Real theZt,
-                                 const Standard_Real theXp,
-                                 const Standard_Real theYp,
-                                 const Standard_Real theZp,
-                                 const Quantity_Color& theColor = Quantity_NOC_WHITE,
-                                 const Standard_Real theConstAttenuation = 1.0,
-                                 const Standard_Real theLinearAttenuation = 0.0,
-                                 const Standard_Real theConcentration = 1.0,
-                                 const Standard_Real theAngle = 0.523599);
-
 };
 
 DEFINE_STANDARD_HANDLE(V3d_SpotLight, V3d_PositionLight)
index 9f162ac9de736cb68697a8c1d1fa49f8b348ecf1..98af39c189d545a58c96017e733fc539e5a024ca 100644 (file)
@@ -707,24 +707,12 @@ public:
   //! Returns the current visualisation mode.
   Standard_EXPORT V3d_TypeOfVisualization Visualization() const;
 
-  //! Returns True if One light more can be
-  //! activated in this View.
-  Standard_EXPORT Standard_Boolean IfMoreLights() const;
+  //! Returns a list of active lights.
+  const V3d_ListOfLight& ActiveLights() const { return myActiveLights; }
 
   //! Return iterator for defined lights.
   V3d_ListOfLightIterator ActiveLightIterator() const { return V3d_ListOfLightIterator (myActiveLights); }
 
-  //! initializes an iteration on the active Lights.
-  void InitActiveLights() { myActiveLightsIterator.Initialize (myActiveLights); }
-
-  //! returns true if there are more active Light(s) to return.
-  Standard_Boolean MoreActiveLights() const { return myActiveLightsIterator.More(); }
-
-  //! Go to the next active Light (if there is not, ActiveLight will raise an exception)
-  void NextActiveLights() { myActiveLightsIterator.Next(); }
-
-  const Handle(V3d_Light)& ActiveLight() const { return myActiveLightsIterator.Value(); }
-
   //! Returns the MAX number of light associated to the view.
   Standard_EXPORT Standard_Integer LightLimit() const;
 
@@ -969,6 +957,28 @@ public:
 
   DEFINE_STANDARD_RTTIEXT(V3d_View,Standard_Transient)
 
+public: //! @name deprecated methods
+
+  //! Returns True if One light more can be
+  //! activated in this View.
+  Standard_DEPRECATED ("Deprecated method - ActiveLights() should be used instead")
+  Standard_EXPORT Standard_Boolean IfMoreLights() const;
+
+  //! initializes an iteration on the active Lights.
+  Standard_DEPRECATED ("Deprecated method - ActiveLights() should be used instead")
+  void InitActiveLights() { myActiveLightsIterator.Initialize (myActiveLights); }
+
+  //! returns true if there are more active Light(s) to return.
+  Standard_DEPRECATED ("Deprecated method - ActiveLights() should be used instead")
+  Standard_Boolean MoreActiveLights() const { return myActiveLightsIterator.More(); }
+
+  //! Go to the next active Light (if there is not, ActiveLight will raise an exception)
+  Standard_DEPRECATED ("Deprecated method - ActiveLights() should be used instead")
+  void NextActiveLights() { myActiveLightsIterator.Next(); }
+
+  Standard_DEPRECATED ("Deprecated method - ActiveLights() should be used instead")
+  const Handle(V3d_Light)& ActiveLight() const { return myActiveLightsIterator.Value(); }
+
 protected:
 
   Standard_EXPORT void ImmediateUpdate() const;
index 51e2db182f4310e58572dd32bbe189d5b912f1a5..306c74c98b06ef54a317fd9fa0899bdeddf0d27f 100644 (file)
@@ -237,39 +237,23 @@ public:
 
 public:
 
+  //! Return a list of active views.
+  const V3d_ListOfView& ActiveViews() const { return myActiveViews; }
+
   //! Return an iterator for active views.
   V3d_ListOfViewIterator ActiveViewIterator() const { return V3d_ListOfViewIterator (myActiveViews); }
 
-  //! Initializes an internal iterator on the active views.
-  void InitActiveViews() { myActiveViewsIterator.Initialize (myActiveViews); }
-
-  //! Returns true if there are more active view(s) to return.
-  Standard_Boolean MoreActiveViews() const { return myActiveViewsIterator.More(); }
-
-  //! Go to the next active view (if there is not, ActiveView will raise an exception)
-  void NextActiveViews() { if (!myActiveViews.IsEmpty()) myActiveViewsIterator.Next(); }
-  
-  const Handle(V3d_View)& ActiveView() const { return myActiveViewsIterator.Value(); }
-  
   //! returns true if there is only one active view.
   Standard_Boolean LastActiveView() const { return myActiveViews.Extent() == 1; }
 
 public:
 
+  //! Return a list of defined views.
+  const V3d_ListOfView& DefinedViews() const { return myDefinedViews; }
+
   //! Return an iterator for defined views.
   V3d_ListOfViewIterator DefinedViewIterator() const { return V3d_ListOfViewIterator (myDefinedViews); }
 
-  //! Initializes an internal iterator on the Defined views.
-  void InitDefinedViews() { myDefinedViewsIterator.Initialize (myDefinedViews); }
-
-  //! returns true if there are more Defined view(s) to return.
-  Standard_Boolean MoreDefinedViews() const { return myDefinedViewsIterator.More(); }
-
-  //! Go to the next Defined view (if there is not, DefinedView will raise an exception)
-  void NextDefinedViews() { if (!myDefinedViews.IsEmpty()) myDefinedViewsIterator.Next(); }
-
-  const Handle(V3d_View)& DefinedView() const { return myDefinedViewsIterator.Value(); }
-
 public: //! @name lights management
 
   //! Defines default lights:
@@ -302,36 +286,20 @@ public: //! @name lights management
 
   Standard_EXPORT Standard_Boolean IsGlobalLight (const Handle(V3d_Light)& TheLight) const;
 
+  //! Return a list of active lights.
+  const V3d_ListOfLight& ActiveLights() const { return myActiveLights; }
+
   //! Return an iterator for defined lights.
   V3d_ListOfLightIterator ActiveLightIterator() const { return V3d_ListOfLightIterator (myActiveLights); }
 
-  //! Initializes an internal iteratator on the active Lights.
-  void InitActiveLights() { myActiveLightsIterator.Initialize (myActiveLights); }
-
-  //! returns true if there are more active Light(s) to return.
-  Standard_Boolean MoreActiveLights() const { return myActiveLightsIterator.More(); }
-
-  //! Go to the next active Light (if there is not, ActiveLight() will raise an exception)
-  void NextActiveLights() { myActiveLightsIterator.Next(); }
-
-  const Handle(V3d_Light)& ActiveLight() const { return myActiveLightsIterator.Value(); }
-
 public:
 
+  //! Return a list of defined lights.
+  const V3d_ListOfLight& DefinedLights() const { return myDefinedLights; }
+
   //! Return an iterator for defined lights.
   V3d_ListOfLightIterator DefinedLightIterator() const { return V3d_ListOfLightIterator (myDefinedLights); }
 
-  //! Initializes an internal iterattor on the Defined Lights.
-  void InitDefinedLights() { myDefinedLightsIterator.Initialize (myDefinedLights); }
-  
-  //! Returns true if there are more Defined Light(s) to return.
-  Standard_Boolean MoreDefinedLights() const { return myDefinedLightsIterator.More(); }
-
-  //! Go to the next Defined Light (if there is not, DefinedLight() will raise an exception)
-  void NextDefinedLights() { if (!myDefinedLights.IsEmpty()) myDefinedLightsIterator.Next(); }
-
-  const Handle(V3d_Light)& DefinedLight() const { return myDefinedLightsIterator.Value(); }
-
 public: //! @name objects management
 
   //! Erase all Objects in All the views.
@@ -480,6 +448,66 @@ public: //! @name deprecated methods
     aColor.Values (theV1, theV2, theV3, theType) ;
   }
 
+  //! Initializes an internal iterator on the active views.
+  Standard_DEPRECATED ("Deprecated method - ActiveViews() should be used instead")
+  void InitActiveViews() { myActiveViewsIterator.Initialize (myActiveViews); }
+
+  //! Returns true if there are more active view(s) to return.
+  Standard_DEPRECATED ("Deprecated method - ActiveViews() should be used instead")
+  Standard_Boolean MoreActiveViews() const { return myActiveViewsIterator.More(); }
+
+  //! Go to the next active view (if there is not, ActiveView will raise an exception)
+  Standard_DEPRECATED ("Deprecated method - ActiveViews() should be used instead")
+  void NextActiveViews() { if (!myActiveViews.IsEmpty()) myActiveViewsIterator.Next(); }
+
+  Standard_DEPRECATED ("Deprecated method - ActiveViews() should be used instead")
+  const Handle(V3d_View)& ActiveView() const { return myActiveViewsIterator.Value(); }
+
+  //! Initializes an internal iterator on the Defined views.
+  Standard_DEPRECATED ("Deprecated method - DefinedViews() should be used instead")
+  void InitDefinedViews() { myDefinedViewsIterator.Initialize (myDefinedViews); }
+
+  //! returns true if there are more Defined view(s) to return.
+  Standard_DEPRECATED ("Deprecated method - DefinedViews() should be used instead")
+  Standard_Boolean MoreDefinedViews() const { return myDefinedViewsIterator.More(); }
+
+  //! Go to the next Defined view (if there is not, DefinedView will raise an exception)
+  Standard_DEPRECATED ("Deprecated method - DefinedViews() should be used instead")
+  void NextDefinedViews() { if (!myDefinedViews.IsEmpty()) myDefinedViewsIterator.Next(); }
+
+  Standard_DEPRECATED ("Deprecated method - DefinedViews() should be used instead")
+  const Handle(V3d_View)& DefinedView() const { return myDefinedViewsIterator.Value(); }
+
+  //! Initializes an internal iteratator on the active Lights.
+  Standard_DEPRECATED ("Deprecated method - ActiveLights() should be used instead")
+  void InitActiveLights() { myActiveLightsIterator.Initialize (myActiveLights); }
+
+  //! returns true if there are more active Light(s) to return.
+  Standard_DEPRECATED ("Deprecated method - ActiveLights() should be used instead")
+  Standard_Boolean MoreActiveLights() const { return myActiveLightsIterator.More(); }
+
+  //! Go to the next active Light (if there is not, ActiveLight() will raise an exception)
+  Standard_DEPRECATED ("Deprecated method - ActiveLights() should be used instead")
+  void NextActiveLights() { myActiveLightsIterator.Next(); }
+
+  Standard_DEPRECATED ("Deprecated method - ActiveLights() should be used instead")
+  const Handle(V3d_Light)& ActiveLight() const { return myActiveLightsIterator.Value(); }
+
+  //! Initializes an internal iterattor on the Defined Lights.
+  Standard_DEPRECATED ("Deprecated method - DefinedLights() should be used instead")
+  void InitDefinedLights() { myDefinedLightsIterator.Initialize (myDefinedLights); }
+
+  //! Returns true if there are more Defined Light(s) to return.
+  Standard_DEPRECATED ("Deprecated method - DefinedLights() should be used instead")
+  Standard_Boolean MoreDefinedLights() const { return myDefinedLightsIterator.More(); }
+
+  //! Go to the next Defined Light (if there is not, DefinedLight() will raise an exception)
+  Standard_DEPRECATED ("Deprecated method - DefinedLights() should be used instead")
+  void NextDefinedLights() { if (!myDefinedLights.IsEmpty()) myDefinedLightsIterator.Next(); }
+
+  Standard_DEPRECATED ("Deprecated method - DefinedLights() should be used instead")
+  const Handle(V3d_Light)& DefinedLight() const { return myDefinedLightsIterator.Value(); }
+
 private:
 
   //! Returns the default background colour.
index dad8389bf27a69cf2824c93f3370f1852e0c3cfc..1022ba9d35af131d202fe2342d616154d00731c8 100644 (file)
@@ -2564,8 +2564,8 @@ void ViewerTest::RemoveView (const TCollection_AsciiString& theViewName, const S
   if (!aCurrentContext.IsNull())
   {
     // Check if there are more difined views in the viewer
-    aCurrentContext->CurrentViewer()->InitDefinedViews();
-    if ((isContextRemoved || ViewerTest_myContexts.Size() != 1) && !aCurrentContext->CurrentViewer()->MoreDefinedViews())
+    if ((isContextRemoved || ViewerTest_myContexts.Size() != 1)
+     && aCurrentContext->CurrentViewer()->DefinedViews().IsEmpty())
     {
       // Remove driver if there is no viewers that use it
       Standard_Boolean isRemoveDriver = Standard_True;
index e218cae80e52a414de70a28dbf5ba1da46f54b9a..50d41a989c6d3c7d15cb8c6c77b839a730d89857 100644 (file)
@@ -284,9 +284,10 @@ Handle(V3d_View) View_Displayer::GetView() const
   const Handle(V3d_Viewer)& aViewer = GetContext()->CurrentViewer();
   if (!aViewer.IsNull())
   {
-    aViewer->InitActiveViews();
-    if (aViewer->MoreActiveViews())
-      aView = aViewer->ActiveView();
+    if (!aViewer->ActiveViews().IsEmpty())
+    {
+      aView = aViewer->ActiveViews().First();
+    }
   }
   return aView;
 }