return false;
}
- TCollection_ExtendedString a3DName("Visu3D");
- myViewer() = new V3d_Viewer (myGraphicDriver(), a3DName.ToExtString(),"", 1000.0,
- V3d_XposYnegZpos, Quantity_NOC_GRAY30,
- V3d_ZBUFFER,V3d_GOURAUD,V3d_WAIT,
- Standard_True, Standard_False);
-
+ myViewer() = new V3d_Viewer (myGraphicDriver());
myViewer()->SetDefaultLights();
myViewer()->SetLightOn();
myView() = myViewer()->CreateView();
myGraphicDriver()->ChangeOptions().buffersNoSwap = true;
//myGraphicDriver()->ChangeOptions().contextDebug = true;
- TCollection_ExtendedString a3DName ("Visu3D");
- myViewer() = new V3d_Viewer (myGraphicDriver(), a3DName.ToExtString(), "", 1000.0,
- V3d_XposYnegZpos, Quantity_NOC_GRAY30,
- V3d_ZBUFFER, V3d_GOURAUD, V3d_WAIT,
- Standard_True, Standard_False);
-
+ myViewer() = new V3d_Viewer (myGraphicDriver());
myViewer()->SetDefaultLights();
myViewer()->SetLightOn();
myView() = myViewer()->CreateView();
}
// create viewer
- myViewer = new V3d_Viewer (aDriver, TCollection_ExtendedString("Viewer").ToExtString(), "", 1000.0,
- V3d_XposYnegZpos, Quantity_NOC_BLACK, V3d_ZBUFFER, V3d_GOURAUD, V3d_WAIT,
- Standard_True, Standard_False);
+ myViewer = new V3d_Viewer (aDriver);
+ myViewer->SetDefaultBackgroundColor (Quantity_NOC_BLACK);
myViewer->SetDefaultLights();
myViewer->SetLightOn();
Handle(Graphic3d_WNTGraphicDevice) theGraphicDevice =
((COCCDemoApp*)AfxGetApp())->GetGraphicDevice();
- myViewer = new V3d_Viewer(theGraphicDevice,(Standard_ExtString )"Visu3D");
+ myViewer = new V3d_Viewer(theGraphicDevice);
myViewer->SetDefaultLights();
myViewer->SetLightOn();
myViewer->SetDefaultBackgroundColor(Quantity_TOC_RGB, 0.,0.,0.);
myAISContext->DefaultDrawer()->VIsoAspect()->SetNumber(11);
Handle(Graphic3d_GraphicDriver) aGraphicDriver = ((OCC_App*)AfxGetApp())->GetGraphicDriver();
- TCollection_ExtendedString a2DName("Visu2D");
- myViewer2D = new V3d_Viewer(aGraphicDriver,a2DName.ToExtString());
+ myViewer2D = new V3d_Viewer (aGraphicDriver);
myViewer2D->SetCircularGridValues(0,0,1,8,0);
myViewer2D->SetRectangularGridValues(0,0,1,1,0);
((CHLRApp*)AfxGetApp())->GetGraphicDriver();
// VIEWER 3D
- TCollection_ExtendedString a3DName ("Visu3D");
- myViewer = new V3d_Viewer (theGraphicDriver, a3DName.ToExtString(), "", 1000.0,
- V3d_XposYnegZpos, Quantity_NOC_GRAY30,
- V3d_ZBUFFER, V3d_GOURAUD, V3d_WAIT,
- Standard_True, Standard_False);
-
+ myViewer = new V3d_Viewer (theGraphicDriver);
myViewer->SetDefaultLights();
myViewer->SetLightOn();
myAISContext =new AIS_InteractiveContext (myViewer);
// 2D VIEWER: exploit V3d viewer for 2D visualization
- TCollection_ExtendedString a2DName ("Visu2D");
- my2DViewer = new V3d_Viewer (theGraphicDriver, a2DName.ToExtString());
+ my2DViewer = new V3d_Viewer (theGraphicDriver);
my2DViewer->SetCircularGridValues (0, 0, 10, 8, 0);
my2DViewer->SetRectangularGridValues (0, 0, 10, 10, 0);
Handle(Graphic3d_GraphicDriver) aGraphicDriver =
((CHLRApp*)AfxGetApp())->GetGraphicDriver();
- myActiveViewer = new V3d_Viewer (aGraphicDriver, (Standard_ExtString )"Visu3D");
+ myActiveViewer = new V3d_Viewer (aGraphicDriver);
myActiveViewer->SetDefaultLights();
myActiveViewer->SetLightOn();
myActiveView = myActiveViewer->CreateView();
Handle(Graphic3d_GraphicDriver) aGraphicDriver =
((CAnimationApp*)AfxGetApp())->GetGraphicDriver();
- TCollection_ExtendedString a3DName("Visu3D");
- myViewer = new V3d_Viewer(aGraphicDriver,a3DName.ToExtString(),"", 1000.0,
- V3d_XposYnegZpos, Quantity_NOC_GRAY30,
- V3d_ZBUFFER,V3d_GOURAUD,V3d_WAIT,
- Standard_True, Standard_False);
-
+ myViewer = new V3d_Viewer(aGraphicDriver);
myViewer->SetDefaultLights();
myViewer->SetLightOn();
Handle(Graphic3d_GraphicDriver) aGraphicDriver =
((COCCDemoApp*)AfxGetApp())->GetGraphicDriver();
- myViewer = new V3d_Viewer(aGraphicDriver, (Standard_ExtString )"Visu3D");
+ myViewer = new V3d_Viewer(aGraphicDriver);
myViewer->SetDefaultLights();
myViewer->SetLightOn();
- myViewer->SetDefaultBackgroundColor(Quantity_TOC_RGB, 0.,0.,0.);
+ myViewer->SetDefaultBackgroundColor (Quantity_NOC_BLACK);
myAISContext = new AIS_InteractiveContext(myViewer);
myShowResult = FALSE;
((OCC_App*)AfxGetApp())->GetGraphicDriver();
// create the Viewer
- TCollection_ExtendedString aName ("Viewer 2D");
- TCollection_AsciiString aDomain ("My Domain");
-
- myViewer = new V3d_Viewer (aGraphicDriver,
- aName.ToExtString(),
- aDomain.ToCString());
-
+ myViewer = new V3d_Viewer (aGraphicDriver);
myViewer->SetDefaultLights();
myViewer->SetLightOn();
myViewer->SetDefaultViewProj (V3d_Zpos);
Handle(Graphic3d_GraphicDriver) aGraphicDriver = ((OCC_App*)AfxGetApp())->GetGraphicDriver();
- myViewer = new V3d_Viewer (aGraphicDriver, Standard_ExtString("Visu3D") );
+ myViewer = new V3d_Viewer (aGraphicDriver);
myViewer->SetDefaultLights();
myViewer->SetLightOn();
myAISContext = new AIS_InteractiveContext (myViewer);
}
// create viewer
- myViewer = new V3d_Viewer (aDriver, TCollection_ExtendedString("Viewer").ToExtString(), "", 1000.0,
- V3d_XposYnegZpos, AndroidQt_UserInteractionParameters::BgColor.Name(), V3d_ZBUFFER, V3d_GOURAUD, V3d_WAIT,
- Standard_True, Standard_False);
+ myViewer = new V3d_Viewer (aDriver);
+ myViewer->SetDefaultBackgroundColor (AndroidQt_UserInteractionParameters::BgColor.Name());
myViewer->SetDefaultLights();
myViewer->SetLightOn();
// function : Viewer
// purpose :
// =======================================================================
-Handle(V3d_Viewer) DocumentCommon::Viewer (const Standard_ExtString theName,
- const Standard_CString theDomain,
+Handle(V3d_Viewer) DocumentCommon::Viewer (const Standard_ExtString ,
+ const Standard_CString ,
const Standard_Real theViewSize,
const V3d_TypeOfOrientation theViewProj,
const Standard_Boolean theComputedMode,
aGraphicDriver = new OpenGl_GraphicDriver (aDisplayConnection);
}
- return new V3d_Viewer (aGraphicDriver,
- theName,
- theDomain,
- theViewSize,
- theViewProj,
- Quantity_NOC_GRAY30,
- V3d_ZBUFFER,
- V3d_GOURAUD,
- V3d_WAIT,
- theComputedMode,
- theDefaultComputedMode);
+ Handle(V3d_Viewer) aViewer = new V3d_Viewer (aGraphicDriver);
+ aViewer->SetDefaultViewSize (theViewSize);
+ aViewer->SetDefaultViewProj (theViewProj);
+ aViewer->SetComputedMode (theComputedMode);
+ aViewer->SetDefaultComputedMode (theDefaultComputedMode);
+ return aViewer;
}
DocumentCommon::DocumentCommon( const int theIndex, ApplicationCommonWindow* app )
//=======================================================================
void AIS_ColorScale::TextSize (const TCollection_ExtendedString& theText, const Standard_Integer theHeight, Standard_Integer& theWidth, Standard_Integer& theAscent, Standard_Integer& theDescent) const
{
- const Handle(Graphic3d_CView)& aView = GetContext()->CurrentViewer()->ActiveView()->View();
+ const Handle(Graphic3d_CView)& aView = GetContext()->CurrentViewer()->ActiveViewIterator().Value()->View();
Standard_ShortReal aWidth(10.0), anAscent(1.0), aDescent(1.0);
TCollection_AsciiString aText (theText.ToExtString(), '?');
GetContext()->CurrentViewer()->Driver()->TextSize (aView, aText.ToCString(), (Standard_ShortReal)theHeight, aWidth, anAscent, aDescent);
myMainVwr->Update();
}
-
-//=======================================================================
-//function : DomainOfMainViewer
-//purpose :
-//=======================================================================
-
-Standard_CString AIS_InteractiveContext::DomainOfMainViewer() const
-{
- return myMainVwr->Domain();
-
-}
-
//=======================================================================
//function : DisplayedObjects
//purpose :
myObjects.UnBind (theIObj);
myMainVwr->StructureManager()->UnregisterObject (theIObj);
- for (myMainVwr->InitDefinedViews(); myMainVwr->MoreDefinedViews(); myMainVwr->NextDefinedViews())
+
+ for (V3d_ListOfViewIterator aDefViewIter (myMainVwr->DefinedViewIterator()); aDefViewIter.More(); aDefViewIter.Next())
{
- myMainVwr->DefinedView()->View()->ChangeHiddenObjects()->Remove (theIObj.get());
+ aDefViewIter.Value()->View()->ChangeHiddenObjects()->Remove (theIObj.get());
}
if (!myLastinMain.IsNull() && myLastinMain->Selectable() == theIObj)
const Standard_Integer aLayerId = myObjects.Find (theObject)->GetLayerIndex();
const Handle(V3d_Viewer)& aCurViewer = CurrentViewer();
- for (aCurViewer->InitActiveViews(); aCurViewer->MoreActiveViews(); aCurViewer->NextActiveViews())
+ for (V3d_ListOfViewIterator anActiveViewIter (aCurViewer->ActiveViewIterator()); anActiveViewIter.More(); anActiveViewIter.Next())
{
- aCurViewer->ActiveView()->View()->InvalidateBVHData (aLayerId);
- aCurViewer->ActiveView()->View()->InvalidateZLayerBoundingBox (aLayerId);
+ anActiveViewIter.Value()->View()->InvalidateBVHData (aLayerId);
+ anActiveViewIter.Value()->View()->InvalidateZLayerBoundingBox (aLayerId);
}
}
//! Returns true if there is an open context.
Standard_Boolean HasOpenedContext() const;
-
- //! Returns the domain name of the main viewer.
- Standard_EXPORT Standard_CString DomainOfMainViewer() const;
-
//! This method is only intended for advanced operation, particularly with
//! the aim to improve performance when many objects have to be selected
return Standard_False;
}
- myMainVwr->InitActiveViews();
- if (!myMainVwr->MoreActiveViews())
- {
- return Standard_False;
- }
-
- Handle(V3d_View) aView = myMainVwr->ActiveView();
- return myLocalContexts (myCurLocalIndex)->EndImmediateDraw (aView->Viewer());
+ return myLocalContexts (myCurLocalIndex)->EndImmediateDraw (myMainVwr);
}
if (myAutoHilight)
{
const Handle(V3d_Viewer)& aViewer = myCTX->CurrentViewer();
- for (aViewer->InitActiveViews(); aViewer->MoreActiveViews(); aViewer->NextActiveViews())
+ for (V3d_ListOfViewIterator anActiveViewIter (aViewer->ActiveViewIterator()); anActiveViewIter.More(); anActiveViewIter.Next())
{
- Unhilight (anOwner, aViewer->ActiveView());
+ Unhilight (anOwner, anActiveViewIter.Value());
}
// advanced selection highlighting mechanism
{
myMainPM->ClearImmediateDraw();
const Handle(V3d_Viewer)& aViewer = myCTX->CurrentViewer();
- for (aViewer->InitActiveViews(); aViewer->MoreActiveViews(); aViewer->NextActiveViews())
+ for (V3d_ListOfViewIterator anActiveViewIter (aViewer->ActiveViewIterator()); anActiveViewIter.More(); anActiveViewIter.Next())
{
- Unhilight (anOwner, aViewer->ActiveView());
+ Unhilight (anOwner, anActiveViewIter.Value());
}
// advanced selection highlighting mechanism
{
aRemoveEntites.Append (anOwner);
anOwner->SetSelected (Standard_False);
- for (aViewer->InitActiveViews(); aViewer->MoreActiveViews(); aViewer->NextActiveViews())
+ for (V3d_ListOfViewIterator anActiveViewIter (aViewer->ActiveViewIterator()); anActiveViewIter.More(); anActiveViewIter.Next())
{
- Unhilight (anOwner, aViewer->ActiveView());
+ Unhilight (anOwner, anActiveViewIter.Value());
}
}
}
}
else
{
- for (aViewer->InitActiveViews(); aViewer->MoreActiveViews(); aViewer->NextActiveViews())
+ for (V3d_ListOfViewIterator anActiveViewIter (aViewer->ActiveViewIterator()); anActiveViewIter.More(); anActiveViewIter.Next())
{
- Unhilight (anOwner, aViewer->ActiveView());
+ Unhilight (anOwner, anActiveViewIter.Value());
}
}
}
// Last detected owner was removed. First object from sequence become detected.
// Pass any active view because in current implementation the highlighting is
// synchronized in all view.
- aViewer->InitActiveViews();
manageDetected (myMainVS->Picked (myDetectedSeq.First()),
- aViewer->ActiveView(),
+ aViewer->ActiveViewIterator().Value(),
Standard_False);
}
}
&& !aDocViewer->GetInteractiveContext().IsNull())
{
Handle(V3d_Viewer) aViewer = aDocViewer->GetInteractiveContext()->CurrentViewer();
- for (aViewer->InitDefinedViews(); aViewer->MoreDefinedViews(); aViewer->NextDefinedViews())
+ V3d_ListOfView aViews;
+ for (V3d_ListOfViewIterator aViewIter (aDocViewer->GetInteractiveContext()->CurrentViewer()->DefinedViewIterator()); aViewIter.More(); aViewIter.Next())
{
- Handle(V3d_View) aView = aViewer->DefinedView();
+ aViews.Append (aViewIter.Value());
+ }
+ for (V3d_ListOfViewIterator aViewIter (aViews); aViewIter.More(); aViewIter.Next())
+ {
+ Handle(V3d_View) aView = aViewIter.Value();
ViewerTest::RemoveView (aView);
}
}
PRemove (theIter, ListNode::delNode);
}
+ //! Remove the first occurrence of the object.
+ Standard_Boolean Remove (const TheItemType& theObject)
+ {
+ for (Iterator anIter (*this); anIter.More(); anIter.Next())
+ {
+ if (anIter.Value() == theObject)
+ {
+ Remove (anIter);
+ return Standard_True;
+ }
+ }
+ return Standard_False;
+ }
+
//! InsertBefore
TheItemType& InsertBefore (const TheItemType& theItem,
Iterator& theIter)
void Reverse ()
{ PReverse(); }
+ //! Return true if object is stored in the list.
+ Standard_Boolean Contains (const TheItemType& theObject) const
+ {
+ for (Iterator anIter (*this); anIter.More(); anIter.Next())
+ {
+ if (anIter.Value() == theObject)
+ {
+ return Standard_True;
+ }
+ }
+ return Standard_False;
+ }
+
//! Destructor - clears the List
virtual ~NCollection_List (void)
{ Clear(); }
// =======================================================================
void PrsMgr_PresentationManager::displayImmediate (const Handle(V3d_Viewer)& theViewer)
{
- for (theViewer->InitActiveViews(); theViewer->MoreActiveViews(); theViewer->NextActiveViews())
+ for (V3d_ListOfViewIterator anActiveViewIter (theViewer->ActiveViewIterator()); anActiveViewIter.More(); anActiveViewIter.Next())
{
- const Handle(Graphic3d_CView)& aView = theViewer->ActiveView()->View();
+ const Handle(Graphic3d_CView)& aView = anActiveViewIter.Value()->View();
for (PrsMgr_ListOfPresentations::Iterator anIter (myImmediateList); anIter.More(); anIter.Next())
{
const Handle(Prs3d_Presentation)& aPrs = anIter.Value();
if (!myViewDependentImmediateList.IsEmpty())
{
- for (theViewer->InitActiveViews(); theViewer->MoreActiveViews(); theViewer->NextActiveViews())
+ for (V3d_ListOfViewIterator anActiveViewIter (theViewer->ActiveViewIterator()); anActiveViewIter.More(); anActiveViewIter.Next())
{
- const Handle(Graphic3d_CView)& aView = theViewer->ActiveView()->View();
+ const Handle(Graphic3d_CView)& aView = anActiveViewIter.Value()->View();
Handle(Graphic3d_Structure) aViewDepParentPrs;
if (aView->IsComputed (aParentId, aViewDepParentPrs))
{
V3d_ImageDumpOptions.hxx
V3d_Light.cxx
V3d_Light.hxx
-V3d_ListOfTransient.hxx
+V3d_ListOfLight.hxx
+V3d_ListOfView.hxx
V3d_Parameter.hxx
V3d_Plane.cxx
V3d_Plane.hxx
V3d_View_5.cxx
V3d_Viewer.cxx
V3d_Viewer.hxx
-V3d_Viewer_1.cxx
-V3d_Viewer_2.cxx
V3d_Viewer_3.cxx
V3d_Viewer_4.cxx
V3d_ViewerPointer.hxx
--- /dev/null
+// Copyright (c) 2016 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _V3d_ListOfLight_HeaderFile
+#define _V3d_ListOfLight_HeaderFile
+
+class V3d_Light;
+#include <NCollection_List.hxx>
+#include <Standard_Transient.hxx>
+
+typedef NCollection_List<Handle(V3d_Light)> V3d_ListOfLight;
+typedef V3d_ListOfLight::Iterator V3d_ListOfLightIterator;
+
+#endif // _V3d_ListOfLight_HeaderFile
+++ /dev/null
-// Created on: 1995-05-17
-// Created by: Mister rmi
-// Copyright (c) 1995-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#ifndef _V3d_ListOfTransient_HeaderFile
-#define _V3d_ListOfTransient_HeaderFile
-
-#include <TColStd_ListOfTransient.hxx>
-#include <TColStd_ListIteratorOfListOfTransient.hxx>
-
-//! List of transient objects with methods to check presence and remove elements
-class V3d_ListOfTransient: public TColStd_ListOfTransient
-{
-public:
-
- //! Return true if theObject is stored in the list
- Standard_Boolean Contains (const Handle(Standard_Transient)& theObject) const
- {
- for (TColStd_ListIteratorOfListOfTransient it (*this); it.More(); it.Next())
- {
- if (it.Value() == theObject)
- return Standard_True;
- }
- return Standard_False;
- }
-
- //! Remove all elements equal to theObject from the list
- void Remove (const Handle(Standard_Transient)& theObject)
- {
- for (TColStd_ListIteratorOfListOfTransient it (*this); it.More();)
- {
- if (it.Value() == theObject)
- TColStd_ListOfTransient::Remove (it);
- else
- it.Next();
- }
- }
-};
-
-#endif
--- /dev/null
+// Copyright (c) 2016 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _V3d_ListOfView_HeaderFile
+#define _V3d_ListOfView_HeaderFile
+
+class V3d_View;
+#include <NCollection_List.hxx>
+#include <Standard_Transient.hxx>
+
+typedef NCollection_List<Handle(V3d_View)> V3d_ListOfView;
+typedef V3d_ListOfView::Iterator V3d_ListOfViewIterator;
+
+#endif // _V3d_ListOfView_HeaderFile
//=============================================================================
V3d_View::V3d_View (const Handle(V3d_Viewer)& theViewer, const V3d_TypeOfView theType)
: MyViewer (theViewer.operator->()),
- MyActiveLights(),
- myActiveLightsIterator(),
SwitchSetFront (Standard_False),
myZRotation (Standard_False),
MyTrsf (1, 4, 1, 4)
//=============================================================================
V3d_View::V3d_View (const Handle(V3d_Viewer)& theViewer, const Handle(V3d_View)& theView)
: MyViewer (theViewer.operator->()),
- MyActiveLights(),
- myActiveLightsIterator(),
SwitchSetFront(Standard_False),
myZRotation (Standard_False),
MyTrsf (1, 4, 1, 4)
void V3d_View::UpdateLights() const
{
Graphic3d_ListOfCLight aLights;
-
- for (TColStd_ListIteratorOfListOfTransient anIt (MyActiveLights); anIt.More(); anIt.Next())
+ for (V3d_ListOfLight::Iterator anActiveLightIter (myActiveLights); anActiveLightIter.More(); anActiveLightIter.Next())
{
- aLights.Append (Handle(V3d_Light)::DownCast (anIt.Value())->Light());
+ aLights.Append (anActiveLightIter.Value()->Light());
}
-
myView->SetLights (aLights);
-
Update();
}
#include <TColStd_ListIteratorOfListOfTransient.hxx>
#include <V3d_Coordinate.hxx>
-#include <V3d_ListOfTransient.hxx>
#include <V3d_ImageDumpOptions.hxx>
#include <V3d_TypeOfAxe.hxx>
//! activated in this View.
Standard_EXPORT Standard_Boolean IfMoreLights() const;
+ //! Return iterator for defined lights.
+ V3d_ListOfLightIterator ActiveLightIterator() const { return V3d_ListOfLightIterator (myActiveLights); }
+
//! initializes an iteration on the active Lights.
- Standard_EXPORT void InitActiveLights();
+ void InitActiveLights() { myActiveLightsIterator.Initialize (myActiveLights); }
//! returns true if there are more active Light(s) to return.
- Standard_EXPORT Standard_Boolean MoreActiveLights() const;
+ Standard_Boolean MoreActiveLights() const { return myActiveLightsIterator.More(); }
- //! Go to the next active Light
- //! (if there is not, ActiveLight will raise an exception)
- Standard_EXPORT void NextActiveLights();
+ //! Go to the next active Light (if there is not, ActiveLight will raise an exception)
+ void NextActiveLights() { myActiveLightsIterator.Next(); }
- Standard_EXPORT Handle(V3d_Light) ActiveLight() const;
+ 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;
private:
V3d_ViewerPointer MyViewer;
- V3d_ListOfTransient MyActiveLights;
+ V3d_ListOfLight myActiveLights;
Graphic3d_Vector MyDefaultViewAxis;
Graphic3d_Vertex MyDefaultViewPoint;
Handle(Aspect_Window) MyWindow;
- TColStd_ListIteratorOfListOfTransient myActiveLightsIterator;
+ V3d_ListOfLight::Iterator myActiveLightsIterator;
Standard_Integer sx;
Standard_Integer sy;
Standard_Real rx;
//=============================================================================
void V3d_View::SetLightOn (const Handle(V3d_Light)& theLight)
{
- if (!MyActiveLights.Contains (theLight))
+ if (!myActiveLights.Contains (theLight))
{
- V3d_BadValue_Raise_if (MyActiveLights.Extent() >= LightLimit(),
+ V3d_BadValue_Raise_if (myActiveLights.Extent() >= LightLimit(),
"V3d_View::SetLightOn, "
"too many lights");
- MyActiveLights.Append (theLight);
+ myActiveLights.Append (theLight);
UpdateLights();
}
}
Standard_TypeMismatch_Raise_if (MyViewer->IsGlobalLight (theLight),
"V3d_View::SetLightOff, "
"the light is global");
- MyActiveLights.Remove (theLight);
+ myActiveLights.Remove (theLight);
UpdateLights();
}
//=============================================================================
Standard_Boolean V3d_View::IsActiveLight (const Handle(V3d_Light)& theLight) const
{
- if (theLight.IsNull())
- {
- return Standard_False;
- }
- return MyActiveLights.Contains(theLight);
+ return !theLight.IsNull()
+ && myActiveLights.Contains (theLight);
}
//=============================================================================
//=============================================================================
void V3d_View::SetLightOn()
{
- for (MyViewer->InitDefinedLights(); MyViewer->MoreDefinedLights(); MyViewer->NextDefinedLights())
+ for (V3d_ListOfLightIterator aDefLightIter (MyViewer->DefinedLightIterator()); aDefLightIter.More(); aDefLightIter.Next())
{
- if (!MyActiveLights.Contains (MyViewer->DefinedLight()))
+ if (!myActiveLights.Contains (aDefLightIter.Value()))
{
- MyActiveLights.Append (MyViewer->DefinedLight());
+ myActiveLights.Append (aDefLightIter.Value());
}
}
UpdateLights();
//=============================================================================
void V3d_View::SetLightOff()
{
- InitActiveLights();
- while(MoreActiveLights())
+ for (V3d_ListOfLight::Iterator anActiveLightIter (myActiveLights); anActiveLightIter.More();)
{
- if (!MyViewer->IsGlobalLight (ActiveLight()))
+ if (!MyViewer->IsGlobalLight (anActiveLightIter.Value()))
{
- MyActiveLights.Remove (ActiveLight());
+ myActiveLights.Remove (anActiveLightIter);
}
else
{
- NextActiveLights();
+ anActiveLightIter.Next();
}
}
UpdateLights();
}
-//=============================================================================
-//function : InitActiveLights
-//purpose :
-//=============================================================================
-void V3d_View::InitActiveLights()
-{
- myActiveLightsIterator.Initialize(MyActiveLights);
-}
-
-//=============================================================================
-//function : MoreActiveLights
-//purpose :
-//=============================================================================
-Standard_Boolean V3d_View::MoreActiveLights() const
-{
- return myActiveLightsIterator.More();
-}
-
-//=============================================================================
-//function : NextActiveLights
-//purpose :
-//=============================================================================
-void V3d_View::NextActiveLights()
-{
- myActiveLightsIterator.Next();
-}
-
-//=============================================================================
-//function : ActiveLight
-//purpose :
-//=============================================================================
-Handle(V3d_Light) V3d_View::ActiveLight() const
-{
- return (Handle(V3d_Light)&)(myActiveLightsIterator.Value());
-}
-
//=============================================================================
//function : IfMoreLights
//purpose :
//=============================================================================
Standard_Boolean V3d_View::IfMoreLights() const
{
- return MyActiveLights.Extent() < LightLimit();
+ return myActiveLights.Extent() < LightLimit();
}
//=======================================================================
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
+#include <V3d_Viewer.hxx>
-#include <Aspect_Background.hxx>
-#include <Aspect_GradientBackground.hxx>
#include <Aspect_Grid.hxx>
#include <Aspect_IdentDefinitionError.hxx>
-#include <gp_Ax3.hxx>
#include <Graphic3d_AspectMarker3d.hxx>
#include <Graphic3d_GraphicDriver.hxx>
#include <Graphic3d_Group.hxx>
#include <Graphic3d_Structure.hxx>
-#include <Quantity_Color.hxx>
#include <Standard_ErrorHandler.hxx>
#include <Standard_Type.hxx>
#include <V3d.hxx>
#include <V3d_BadValue.hxx>
#include <V3d_CircularGrid.hxx>
-#include <V3d_Light.hxx>
+#include <V3d_AmbientLight.hxx>
+#include <V3d_DirectionalLight.hxx>
#include <V3d_RectangularGrid.hxx>
#include <V3d_View.hxx>
-#include <V3d_Viewer.hxx>
-IMPLEMENT_STANDARD_RTTIEXT(V3d_Viewer,MMgt_TShared)
+IMPLEMENT_STANDARD_RTTIEXT(V3d_Viewer, Standard_Transient)
+
+// ========================================================================
+// function : V3d_Viewer
+// purpose :
+// ========================================================================
+V3d_Viewer::V3d_Viewer (const Handle(Graphic3d_GraphicDriver)& theDriver)
+: myDriver (theDriver),
+ myStructureManager (new Graphic3d_StructureManager (theDriver)),
+ myZLayerGenId (1, IntegerLast()),
+ myBackground (Quantity_NOC_GRAY30),
+ myViewSize (1000.0),
+ myViewProj (V3d_XposYnegZpos),
+ myVisualization (V3d_ZBUFFER),
+ myShadingModel (V3d_GOURAUD),
+ myDefaultTypeOfView (V3d_ORTHOGRAPHIC),
+ myComputedMode (Standard_True),
+ myDefaultComputedMode (Standard_False),
+ myPrivilegedPlane (gp_Ax3 (gp_Pnt (0.,0.,0), gp_Dir (0.,0.,1.), gp_Dir (1.,0.,0.))),
+ myDisplayPlane (Standard_False),
+ myDisplayPlaneLength (1000.0),
+ myGridType (Aspect_GT_Rectangular),
+ myGridEcho (Standard_True),
+ myGridEchoLastVert (ShortRealLast(), ShortRealLast(), ShortRealLast())
+{
+ myRGrid = new V3d_RectangularGrid (this, Quantity_Color (Quantity_NOC_GRAY50), Quantity_Color (Quantity_NOC_GRAY70));
+ myCGrid = new V3d_CircularGrid (this, Quantity_Color (Quantity_NOC_GRAY50), Quantity_Color (Quantity_NOC_GRAY70));
+}
// ========================================================================
// function : V3d_Viewer
// purpose :
// ========================================================================
V3d_Viewer::V3d_Viewer (const Handle(Graphic3d_GraphicDriver)& theDriver,
- const Standard_ExtString theName,
- const Standard_CString theDomain,
+ const Standard_ExtString ,
+ const Standard_CString ,
const Standard_Real theViewSize,
const V3d_TypeOfOrientation theViewProj,
const Quantity_NameOfColor theViewBackground,
const V3d_TypeOfUpdate theUpdateMode,
const Standard_Boolean theComputedMode,
const Standard_Boolean theDefaultComputedMode)
-:myNextCount (-1),
-myDriver (theDriver),
-myName (TCollection_ExtendedString (theName)),
-myDomain (TCollection_AsciiString (theDomain)),
-myStructureManager (new Graphic3d_StructureManager (theDriver)),
-MyDefinedViews(),
-MyActiveViews(),
-MyDefinedLights(),
-MyActiveLights(),
-myActiveViewsIterator(),
-myDefinedViewsIterator(),
-myActiveLightsIterator(),
-myDefinedLightsIterator(),
-myComputedMode (theComputedMode),
-myDefaultComputedMode (theDefaultComputedMode),
-myPrivilegedPlane (gp_Ax3 (gp_Pnt (0.,0.,0), gp_Dir (0.,0.,1.), gp_Dir (1.,0.,0.))),
-myDisplayPlane (Standard_False),
-myDisplayPlaneLength (theViewSize),
-myGridEcho (Standard_True),
-myGridEchoLastVert (ShortRealLast(), ShortRealLast(), ShortRealLast()),
-myZLayerGenId (1, IntegerLast())
-{
- SetUpdateMode (theUpdateMode);
+: myDriver (theDriver),
+ myStructureManager (new Graphic3d_StructureManager (theDriver)),
+ myZLayerGenId (1, IntegerLast()),
+ myBackground (theViewBackground),
+ myViewSize (theViewSize),
+ myViewProj (theViewProj),
+ myVisualization (theVisualization),
+ myShadingModel (theShadingModel),
+ myDefaultTypeOfView (V3d_ORTHOGRAPHIC),
+ myComputedMode (theComputedMode),
+ myDefaultComputedMode (theDefaultComputedMode),
+ myPrivilegedPlane (gp_Ax3 (gp_Pnt (0.,0.,0), gp_Dir (0.,0.,1.), gp_Dir (1.,0.,0.))),
+ myDisplayPlane (Standard_False),
+ myDisplayPlaneLength (theViewSize),
+ myGridType (Aspect_GT_Rectangular),
+ myGridEcho (Standard_True),
+ myGridEchoLastVert (ShortRealLast(), ShortRealLast(), ShortRealLast())
+{
+ myRGrid = new V3d_RectangularGrid (this, Quantity_Color (Quantity_NOC_GRAY50), Quantity_Color (Quantity_NOC_GRAY70));
+ myCGrid = new V3d_CircularGrid (this, Quantity_Color (Quantity_NOC_GRAY50), Quantity_Color (Quantity_NOC_GRAY70));
SetDefaultViewSize (theViewSize);
- SetDefaultViewProj (theViewProj);
- SetDefaultBackgroundColor (theViewBackground);
- SetDefaultVisualization (theVisualization);
- SetDefaultShadingModel (theShadingModel);
- SetDefaultAngle (M_PI / 2.);
- SetDefaultTypeOfView (V3d_ORTHOGRAPHIC);
-
- Quantity_Color Color1 (Quantity_NOC_GRAY50);
- Quantity_Color Color2 (Quantity_NOC_GRAY70);
-// Quantity_Color White (Quantity_NOC_WHITE);
- myRGrid = new V3d_RectangularGrid (this, Color1, Color2);
- myCGrid = new V3d_CircularGrid (this, Color1, Color2);
- myGridType = Aspect_GT_Rectangular;
+ SetUpdateMode (theUpdateMode);
}
// ========================================================================
// ========================================================================
Handle(V3d_View) V3d_Viewer::CreateView ()
{
- return new V3d_View(this, MyDefaultTypeOfView);
+ return new V3d_View(this, myDefaultTypeOfView);
}
// ========================================================================
// ========================================================================
void V3d_Viewer::SetViewOn()
{
- for (InitDefinedViews();MoreDefinedViews();NextDefinedViews())
+ for (V3d_ListOfView::Iterator aDefViewIter (myDefinedViews); aDefViewIter.More(); aDefViewIter.Next())
{
- SetViewOn (ActiveView());
+ SetViewOn (aDefViewIter.Value());
}
}
// ========================================================================
void V3d_Viewer::SetViewOff()
{
- for (InitDefinedViews();MoreDefinedViews();NextDefinedViews())
+ for (V3d_ListOfView::Iterator aDefViewIter (myDefinedViews); aDefViewIter.More(); aDefViewIter.Next())
{
- SetViewOff (ActiveView());
+ SetViewOff (aDefViewIter.Value());
}
}
void V3d_Viewer::SetViewOn (const Handle(V3d_View)& theView)
{
Handle(Graphic3d_CView) aViewImpl = theView->View();
- if (aViewImpl->IsDefined() && !IsActive (theView))
+ if (!aViewImpl->IsDefined() || myActiveViews.Contains (theView))
{
- MyActiveViews.Append (theView);
- aViewImpl->Activate();
- for (InitActiveLights();MoreActiveLights();NextActiveLights())
- {
- theView->SetLightOn (ActiveLight());
- }
+ return;
+ }
- theView->SetGrid (myPrivilegedPlane, Grid ());
- theView->SetGridActivity (Grid ()->IsActive ());
- theView->Redraw();
+ myActiveViews.Append (theView);
+ aViewImpl->Activate();
+ for (V3d_ListOfLight::Iterator anActiveLightIter (myActiveLights); anActiveLightIter.More(); anActiveLightIter.Next())
+ {
+ theView->SetLightOn (anActiveLightIter.Value());
}
+
+ theView->SetGrid (myPrivilegedPlane, Grid ());
+ theView->SetGridActivity (Grid ()->IsActive ());
+ theView->Redraw();
}
// ========================================================================
void V3d_Viewer::SetViewOff (const Handle(V3d_View)& theView)
{
Handle(Graphic3d_CView) aViewImpl = theView->View();
- if (aViewImpl->IsDefined() && IsActive (theView))
+ if (aViewImpl->IsDefined() && myActiveViews.Contains (theView))
{
- MyActiveViews.Remove (theView);
+ myActiveViews.Remove (theView);
aViewImpl->Deactivate() ;
}
}
-// ========================================================================
-// function : ComputedMode
-// purpose :
-// ========================================================================
-Standard_Boolean V3d_Viewer::ComputedMode() const
-{
- return myComputedMode;
-}
-
-// ========================================================================
-// function : DefaultComputedMode
-// purpose :
-// ========================================================================
-Standard_Boolean V3d_Viewer::DefaultComputedMode() const
-{
- return myDefaultComputedMode;
-}
-
-// ========================================================================
-// function : Update
-// purpose :
-// ========================================================================
-void V3d_Viewer::Update()
-{
- // Redraw() is still here for compatibility with old code.
- // See comments, the method is deprecated - Redraw() should
- // be used instead.
- Redraw();
-}
-
// ========================================================================
// function : Redraw
// purpose :
// ========================================================================
-void V3d_Viewer::Redraw()const
+void V3d_Viewer::Redraw() const
{
- TColStd_ListIteratorOfListOfTransient anIt (MyDefinedViews);
- for (; anIt.More(); anIt.Next())
+ for (V3d_ListOfView::Iterator aDefViewIter (myDefinedViews); aDefViewIter.More(); aDefViewIter.Next())
{
- Handle(V3d_View)::DownCast (anIt.Value())->Redraw();
+ aDefViewIter.Value()->Redraw();
}
}
// ========================================================================
void V3d_Viewer::RedrawImmediate() const
{
- TColStd_ListIteratorOfListOfTransient anIt (MyDefinedViews);
- for (; anIt.More(); anIt.Next())
+ for (V3d_ListOfView::Iterator aDefViewIter (myDefinedViews); aDefViewIter.More(); aDefViewIter.Next())
{
- Handle(V3d_View)::DownCast (anIt.Value())->RedrawImmediate();
+ aDefViewIter.Value()->RedrawImmediate();
}
}
// ========================================================================
void V3d_Viewer::Invalidate() const
{
- TColStd_ListIteratorOfListOfTransient anIt (MyDefinedViews);
- for (; anIt.More(); anIt.Next())
+ for (V3d_ListOfView::Iterator aDefViewIter (myDefinedViews); aDefViewIter.More(); aDefViewIter.Next())
{
- Handle(V3d_View)::DownCast (anIt.Value())->Invalidate();
+ aDefViewIter.Value()->Invalidate();
}
}
myStructureManager->UnHighlight();
}
-void V3d_Viewer::SetDefaultBackgroundColor(const Quantity_TypeOfColor Type, const Standard_Real v1, const Standard_Real v2, const Standard_Real v3) {
- Standard_Real V1 = v1 ;
- Standard_Real V2 = v2 ;
- Standard_Real V3 = v3 ;
-
- if( V1 < 0. ) V1 = 0. ; else if( V1 > 1. ) V1 = 1. ;
- if( V2 < 0. ) V2 = 0. ; else if( V2 > 1. ) V2 = 1. ;
- if( V3 < 0. ) V3 = 0. ; else if( V3 > 1. ) V3 = 1. ;
-
- Quantity_Color C(V1,V2,V3,Type) ;
- SetDefaultBackgroundColor(C);
-}
-
-void V3d_Viewer::SetDefaultBackgroundColor(const Quantity_NameOfColor Name)
+void V3d_Viewer::SetDefaultViewSize (const Standard_Real theSize)
{
- Quantity_Color C(Name) ;
- SetDefaultBackgroundColor(C);
-}
-
-void V3d_Viewer::SetDefaultBackgroundColor(const Quantity_Color &Color)
-{
- MyBackground.SetColor(Color) ;
-}
-
-void V3d_Viewer::SetDefaultBgGradientColors( const Quantity_NameOfColor Name1,
- const Quantity_NameOfColor Name2,
- const Aspect_GradientFillMethod FillStyle){
-
- Quantity_Color C1(Name1) ;
- Quantity_Color C2(Name2) ;
- MyGradientBackground.SetColors(C1, C2, FillStyle);
-
-}
-
-void V3d_Viewer::SetDefaultBgGradientColors( const Quantity_Color& Color1,
- const Quantity_Color& Color2,
- const Aspect_GradientFillMethod FillStyle ){
-
- MyGradientBackground.SetColors(Color1, Color2, FillStyle);
-
-}
-
-
-void V3d_Viewer::SetDefaultViewSize(const Standard_Real Size) {
-
- V3d_BadValue_Raise_if( Size <= 0. ,"V3d_Viewer::SetDefaultViewSize, bad size");
- MyViewSize = Size ;
+ V3d_BadValue_Raise_if (theSize <= 0.0, "V3d_Viewer::SetDefaultViewSize, bad size");
+ myViewSize = theSize;
}
-void V3d_Viewer::SetDefaultViewProj(const V3d_TypeOfOrientation Orientation) {
-
- MyViewProj = Orientation ;
-}
-
-void V3d_Viewer::SetDefaultVisualization(const V3d_TypeOfVisualization Type) {
-
- MyVisualization = Type ;
-}
-
-void V3d_Viewer::SetDefaultShadingModel(const V3d_TypeOfShadingModel Type) {
-
- MyShadingModel = Type ;
-}
-
-void V3d_Viewer::SetDefaultAngle(const Quantity_PlaneAngle Angle) {
- MyDefaultAngle = Angle;
-}
-
-void V3d_Viewer::SetDefaultTypeOfView(const V3d_TypeOfView Type) {
- MyDefaultTypeOfView = Type;}
-
// ========================================================================
// function : SetUpdateMode
// purpose :
myStructureManager->SetUpdateMode (static_cast<Aspect_TypeOfUpdate> (theMode));
}
-void V3d_Viewer::DefaultBackgroundColor(const Quantity_TypeOfColor Type,Standard_Real &V1,Standard_Real &V2,Standard_Real &V3) const
-{
- Quantity_Color C = DefaultBackgroundColor();
- C.Values(V1,V2,V3,Type) ;
-}
-
-Quantity_Color V3d_Viewer::DefaultBackgroundColor() const
-{
- return MyBackground.Color() ;
-}
-
-void V3d_Viewer::DefaultBgGradientColors(Quantity_Color& Color1,Quantity_Color& Color2) const
-{
- MyGradientBackground.Colors(Color1,Color2);
-}
-
-Standard_Real V3d_Viewer::DefaultViewSize() const {
- return MyViewSize ;
-}
-
-V3d_TypeOfOrientation V3d_Viewer::DefaultViewProj() const {
- return MyViewProj ;
-}
-
-V3d_TypeOfVisualization V3d_Viewer::DefaultVisualization() const {
- return MyVisualization ;
-}
-
-V3d_TypeOfShadingModel V3d_Viewer::DefaultShadingModel() const {
- return MyShadingModel ;
-}
-
-Quantity_PlaneAngle V3d_Viewer::DefaultAngle() const {
- return MyDefaultAngle;
-}
-
// ========================================================================
// function : UpdateMode
// purpose :
return static_cast<V3d_TypeOfUpdate> (myStructureManager->UpdateMode());
}
-Standard_Boolean V3d_Viewer::IfMoreViews() const {
- Standard_Boolean TheStatus = Standard_False ;
-
-#ifdef NEW
- if (MyActiveViews->Length() < myDriver->InquireViewLimit())
-#endif /*NEW*/
- TheStatus = Standard_True ;
- return TheStatus ;
-}
-
// ========================================================================
-// function : StructureManager
+// function : IfMoreViews
// purpose :
// ========================================================================
-Handle(Graphic3d_StructureManager) V3d_Viewer::StructureManager() const
+Standard_Boolean V3d_Viewer::IfMoreViews() const
{
- return myStructureManager;
-}
-
-Aspect_Background V3d_Viewer::GetBackgroundColor() const {
- return MyBackground ;
+ return myDefinedViews.Size() < myStructureManager->MaxNumOfViews();
}
-Aspect_GradientBackground V3d_Viewer::GetGradientBackground() const {
- return MyGradientBackground;
-}
-
-void V3d_Viewer::AddView( const Handle(V3d_View)& TheView ) {
-
- MyDefinedViews.Append(TheView);
- IncrCount();
+// ========================================================================
+// function : AddView
+// purpose :
+// ========================================================================
+void V3d_Viewer::AddView (const Handle(V3d_View)& theView)
+{
+ if (!myDefinedViews.Contains (theView))
+ {
+ myDefinedViews.Append (theView);
+ }
}
-void V3d_Viewer::DelView( const Handle(V3d_View)& TheView ) {
-
- MyActiveViews.Remove(TheView);
- MyDefinedViews.Remove(TheView);
+// ========================================================================
+// function : DelView
+// purpose :
+// ========================================================================
+void V3d_Viewer::DelView (const Handle(V3d_View)& theView)
+{
+ myActiveViews.Remove (theView);
+ myDefinedViews.Remove (theView);
}
//=======================================================================
}
//=======================================================================
-//function : Domain
+//function : UpdateLights
+//purpose :
+//=======================================================================
+void V3d_Viewer::UpdateLights()
+{
+ for (V3d_ListOfView::Iterator anActiveViewIter (myActiveViews); anActiveViewIter.More(); anActiveViewIter.Next())
+ {
+ anActiveViewIter.Value()->UpdateLights();
+ }
+}
+
+//=======================================================================
+//function : SetLightOn
//purpose :
//=======================================================================
-Standard_CString V3d_Viewer::Domain() const
+void V3d_Viewer::SetLightOn (const Handle(V3d_Light)& theLight)
{
- return myDomain.ToCString();
+ if (!myActiveLights.Contains (theLight))
+ {
+ myActiveLights.Append (theLight);
+ }
+
+ for (V3d_ListOfView::Iterator anActiveViewIter (myActiveViews); anActiveViewIter.More(); anActiveViewIter.Next())
+ {
+ anActiveViewIter.Value()->SetLightOn (theLight);
+ }
}
//=======================================================================
-//function : Driver
+//function : SetLightOff
//purpose :
//=======================================================================
-const Handle(Graphic3d_GraphicDriver)& V3d_Viewer::Driver() const
+void V3d_Viewer::SetLightOff (const Handle(V3d_Light)& theLight)
{
- return myDriver;
+ myActiveLights.Remove (theLight);
+ for (V3d_ListOfView::Iterator anActiveViewIter (myActiveViews); anActiveViewIter.More(); anActiveViewIter.Next())
+ {
+ anActiveViewIter.Value()->SetLightOff (theLight);
+ }
}
//=======================================================================
-//function : NextName
+//function : SetLightOn
//purpose :
//=======================================================================
-Standard_ExtString V3d_Viewer::NextName() const
+void V3d_Viewer::SetLightOn()
{
- TCollection_ExtendedString aNextName = TCollection_ExtendedString (myName.ToExtString());
- aNextName.AssignCat (TCollection_ExtendedString (myNextCount));
-
- return aNextName.ToExtString();
+ for (V3d_ListOfLight::Iterator aDefLightIter (myDefinedLights); aDefLightIter.More(); aDefLightIter.Next())
+ {
+ if (!myActiveLights.Contains (aDefLightIter.Value()))
+ {
+ myActiveLights.Append (aDefLightIter.Value());
+ for (V3d_ListOfView::Iterator anActiveViewIter (myActiveViews); anActiveViewIter.More(); anActiveViewIter.Next())
+ {
+ anActiveViewIter.Value()->SetLightOn (aDefLightIter.Value());
+ }
+ }
+ }
}
//=======================================================================
-//function : IncrCount
+//function : SetLightOff
//purpose :
//=======================================================================
-void V3d_Viewer::IncrCount()
+void V3d_Viewer::SetLightOff()
{
- myNextCount++;
+ for (V3d_ListOfLight::Iterator anActiveLightIter (myActiveLights); anActiveLightIter.More(); anActiveLightIter.Next())
+ {
+ for (V3d_ListOfView::Iterator anActiveViewIter (myActiveViews); anActiveViewIter.More(); anActiveViewIter.Next())
+ {
+ anActiveViewIter.Value()->SetLightOff (anActiveLightIter.Value());
+ }
+ }
+ myActiveLights.Clear();
}
//=======================================================================
-//function : DefaultRenderingParams
+//function : IsGlobalLight
//purpose :
//=======================================================================
-const Graphic3d_RenderingParams& V3d_Viewer::DefaultRenderingParams() const
+Standard_Boolean V3d_Viewer::IsGlobalLight (const Handle(V3d_Light)& theLight) const
{
- return myDefaultRenderingParams;
+ return myActiveLights.Contains (theLight);
}
//=======================================================================
-//function : SetDefaultRenderingParams
+//function : AddLight
//purpose :
//=======================================================================
-void V3d_Viewer::SetDefaultRenderingParams (const Graphic3d_RenderingParams& theParams)
+void V3d_Viewer::AddLight (const Handle(V3d_Light)& theLight)
{
- myDefaultRenderingParams = theParams;
+ if (!myDefinedLights.Contains (theLight))
+ {
+ myDefinedLights.Append (theLight);
+ }
+}
+
+//=======================================================================
+//function : DelLight
+//purpose :
+//=======================================================================
+void V3d_Viewer::DelLight (const Handle(V3d_Light)& theLight)
+{
+ SetLightOff (theLight);
+ myDefinedLights.Remove (theLight);
+}
+
+//=======================================================================
+//function : SetDefaultLights
+//purpose :
+//=======================================================================
+void V3d_Viewer::SetDefaultLights()
+{
+ while (!myDefinedLights.IsEmpty())
+ {
+ Handle(V3d_Light) aLight = myDefinedLights.First();
+ DelLight (aLight);
+ }
+
+ SetLightOn (new V3d_DirectionalLight (this, V3d_Zneg, Quantity_NOC_WHITE, Standard_True));
+ SetLightOn (new V3d_AmbientLight (this));
}
#include <Graphic3d_Vertex.hxx>
#include <Graphic3d_ZLayerSettings.hxx>
-#include <MMgt_TShared.hxx>
-
#include <Standard.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_CString.hxx>
#include <TCollection_AsciiString.hxx>
#include <TCollection_ExtendedString.hxx>
-#include <V3d_ListOfTransient.hxx>
+#include <V3d_ListOfLight.hxx>
+#include <V3d_ListOfView.hxx>
#include <V3d_TypeOfOrientation.hxx>
#include <V3d_TypeOfShadingModel.hxx>
#include <V3d_TypeOfUpdate.hxx>
#include <V3d_TypeOfView.hxx>
#include <V3d_TypeOfVisualization.hxx>
-#include <Quantity_NameOfColor.hxx>
+#include <Quantity_Color.hxx>
#include <Quantity_Length.hxx>
#include <Quantity_Parameter.hxx>
#include <Quantity_PlaneAngle.hxx>
class V3d_View;
class Quantity_Color;
-class V3d_Viewer;
-DEFINE_STANDARD_HANDLE(V3d_Viewer, MMgt_TShared)
-
//! Defines services on Viewer type objects.
//! The methods of this class allow editing and
//! interrogation of the parameters linked to the viewer
//! its friend classes (View,light,plane).
-class V3d_Viewer : public MMgt_TShared
+class V3d_Viewer : public Standard_Transient
{
-
+ friend class V3d_View;
+ friend class V3d_Light;
+ DEFINE_STANDARD_RTTIEXT(V3d_Viewer, Standard_Transient)
public:
-
- //! Create a Viewer with the given graphic driver and the given parameters or
- //! with their default values.
- //! Currently creating of more than 100 viewer instances
- //! is not supported and leads to an exception.
- //! This limitation might be addressed in some future OCCT releases.
- //! If the size of the view is <= 0
- //! Warning: Client must creates a graphic driver
- Standard_EXPORT V3d_Viewer(const Handle(Graphic3d_GraphicDriver)& theDriver, const Standard_ExtString theName, const Standard_CString theDomain = "", const Quantity_Length theViewSize = 1000.0, const V3d_TypeOfOrientation theViewProj = V3d_XposYnegZpos, const Quantity_NameOfColor theViewBackground = Quantity_NOC_GRAY30, const V3d_TypeOfVisualization theVisualization = V3d_ZBUFFER, const V3d_TypeOfShadingModel theShadingModel = V3d_GOURAUD, const V3d_TypeOfUpdate theUpdateMode = V3d_WAIT, const Standard_Boolean theComputedMode = Standard_True, const Standard_Boolean theDefaultComputedMode = Standard_True);
-
- //! creates a view in the viewer according to its
- //! default parameters.
+ //! Create a Viewer with the given graphic driver and with default parameters:
+ //! - View orientation: V3d_XposYnegZpos
+ //! - View background: Quantity_NOC_GRAY30
+ //! - Shading model: V3d_GOURAUD
+ Standard_EXPORT V3d_Viewer (const Handle(Graphic3d_GraphicDriver)& theDriver);
+
+ //! Returns True if One View more can be defined in this Viewer.
+ Standard_EXPORT Standard_Boolean IfMoreViews() const;
+
+ //! Creates a view in the viewer according to its default parameters.
Standard_EXPORT Handle(V3d_View) CreateView();
- //! Activates all of the views of a viewer attached
- //! to a window.
+ //! Activates all of the views of a viewer attached to a window.
Standard_EXPORT void SetViewOn();
- //! Activates a particular view in the Viewer .
- //! Must be call if the Window attached to the view
- //! has been Deiconified .
- Standard_EXPORT void SetViewOn (const Handle(V3d_View)& View);
-
+ //! Activates a particular view in the Viewer.
+ //! Must be call if the Window attached to the view has been Deiconified.
+ Standard_EXPORT void SetViewOn (const Handle(V3d_View)& theView);
+
//! Deactivates all the views of a Viewer
//! attached to a window.
Standard_EXPORT void SetViewOff();
//! Deactivates a particular view in the Viewer.
//! Must be call if the Window attached to the view
//! has been Iconified .
- Standard_EXPORT void SetViewOff (const Handle(V3d_View)& View);
+ Standard_EXPORT void SetViewOff (const Handle(V3d_View)& theView);
//! Deprecated, Redraw() should be used instead.
- Standard_EXPORT void Update();
-
- //! Updates the lights of all the views of a viewer.
- Standard_EXPORT void UpdateLights();
-
+ void Update() { Redraw(); }
+
//! Redraws all the views of the Viewer even if no
//! modification has taken place. Must be called if
//! all the views of the Viewer are exposed, as for
//! Suppresses the Viewer.
Standard_EXPORT void Remove();
-
- //! Erase all Objects in All the views.
- Standard_EXPORT void Erase() const;
-
- //! UnHighlight all Objects in All the views.
- Standard_EXPORT void UnHighlight() const;
-
- //! Defines the default base colour of views attached
- //! to the Viewer by supplying the type of colour
- //! definition and the three component values..
- Standard_EXPORT void SetDefaultBackgroundColor (const Quantity_TypeOfColor Type, const Quantity_Parameter V1, const Quantity_Parameter V2, const Quantity_Parameter V3);
-
+
+ //! Return Graphic Driver instance.
+ const Handle(Graphic3d_GraphicDriver)& Driver() const { return myDriver; }
+
+ //! Returns the structure manager associated to this viewer.
+ Handle(Graphic3d_StructureManager) StructureManager() const { return myStructureManager; }
+
+ //! Return default Rendering Parameters.
+ //! By default these parameters are set in a new V3d_View.
+ const Graphic3d_RenderingParams& DefaultRenderingParams() const { return myDefaultRenderingParams; }
+
+ //! Set default Rendering Parameters.
+ void SetDefaultRenderingParams (const Graphic3d_RenderingParams& theParams) { myDefaultRenderingParams = theParams; }
+
//! Defines the default background colour of views
//! attached to the viewer by supplying the name of the
//! colour under the form Quantity_NOC_xxxx .
- Standard_EXPORT void SetDefaultBackgroundColor (const Quantity_NameOfColor Name);
-
+ void SetDefaultBackgroundColor (const Quantity_NameOfColor theName) { myBackground.SetColor (Quantity_Color (theName)); }
+
//! Defines the default background colour of views
//! attached to the viewer by supplying the color object
- Standard_EXPORT void SetDefaultBackgroundColor (const Quantity_Color& Color);
-
+ void SetDefaultBackgroundColor (const Quantity_Color& theColor) { myBackground.SetColor (theColor); }
+
+ //! Returns the gradient background of the view.
+ const Aspect_GradientBackground& GetGradientBackground() const { return myGradientBackground; }
+
//! Defines the default gradient background colours of view
//! attached to the viewer by supplying the name of the
//! colours under the form Quantity_NOC_xxxx .
- Standard_EXPORT void SetDefaultBgGradientColors (const Quantity_NameOfColor Name1, const Quantity_NameOfColor Name2, const Aspect_GradientFillMethod FillStyle = Aspect_GFM_HOR);
+ void SetDefaultBgGradientColors (const Quantity_NameOfColor theName1,
+ const Quantity_NameOfColor theName2,
+ const Aspect_GradientFillMethod theFillStyle = Aspect_GFM_HOR)
+ {
+ myGradientBackground.SetColors (Quantity_Color (theName1), Quantity_Color (theName2), theFillStyle);
+ }
//! Defines the default gradient background colours of views
//! attached to the viewer by supplying the colour objects
- Standard_EXPORT void SetDefaultBgGradientColors (const Quantity_Color& Color1, const Quantity_Color& Color2, const Aspect_GradientFillMethod FillStyle = Aspect_GFM_HOR);
-
- //! Gives a default size for the creation of views of
- //! the viewer.
- Standard_EXPORT void SetDefaultViewSize (const Quantity_Length Size);
-
- //! Gives the default projection for creating views
- //! in the viewer.
- Standard_EXPORT void SetDefaultViewProj (const V3d_TypeOfOrientation Orientation);
-
- //! Gives the default visualization mode..
- Standard_EXPORT void SetDefaultVisualization (const V3d_TypeOfVisualization Type);
+ void SetDefaultBgGradientColors (const Quantity_Color& theColor1,
+ const Quantity_Color& theColor2,
+ const Aspect_GradientFillMethod theFillStyle = Aspect_GFM_HOR)
+ {
+ myGradientBackground.SetColors (theColor1, theColor2, theFillStyle);
+ }
+
+ //! Returns the default size of the view.
+ Standard_Real DefaultViewSize() const { return myViewSize; }
+
+ //! Gives a default size for the creation of views of the viewer.
+ Standard_EXPORT void SetDefaultViewSize (const Standard_Real theSize);
+
+ //! Returns the default Projection.
+ V3d_TypeOfOrientation DefaultViewProj() const { return myViewProj; }
+
+ //! Sets the default projection for creating views in the viewer.
+ void SetDefaultViewProj (const V3d_TypeOfOrientation theOrientation) { myViewProj = theOrientation; }
+
+ //! Returns the default type of Visualization.
+ V3d_TypeOfVisualization DefaultVisualization() const { return myVisualization; }
+
+ //! Gives the default visualization mode.
+ void SetDefaultVisualization (const V3d_TypeOfVisualization theType) { myVisualization = theType; }
+
+ //! Returns the default type of Shading
+ V3d_TypeOfShadingModel DefaultShadingModel() const { return myShadingModel; }
//! Gives the default type of SHADING.
- Standard_EXPORT void SetDefaultShadingModel (const V3d_TypeOfShadingModel Type);
-
- Standard_EXPORT void SetDefaultAngle (const Quantity_PlaneAngle Angle);
-
+ void SetDefaultShadingModel (const V3d_TypeOfShadingModel theType) { myShadingModel = theType; }
+
+ //! Returns the regeneration mode of views in the viewer.
+ Standard_EXPORT V3d_TypeOfUpdate UpdateMode() const;
+
//! Defines the mode of regenerating the views making
//! up the viewer. This can be immediate <ASAP> or
//! deferred <WAIT>. In this latter case, the views are
//! updated when the method Update(me) is called.
Standard_EXPORT void SetUpdateMode (const V3d_TypeOfUpdate theMode);
- Standard_EXPORT void SetDefaultTypeOfView (const V3d_TypeOfView Type);
-
- Standard_EXPORT void SetPrivilegedPlane (const gp_Ax3& aPlane);
-
- Standard_EXPORT gp_Ax3 PrivilegedPlane() const;
+ void SetDefaultTypeOfView (const V3d_TypeOfView theType) { myDefaultTypeOfView = theType; }
+
+ //! Returns the default background colour object.
+ Quantity_Color DefaultBackgroundColor() const { return myBackground.Color(); }
+
+ //! Returns the gradient background colour objects of the view.
+ void DefaultBgGradientColors (Quantity_Color& theColor1, Quantity_Color& theColor2) const { myGradientBackground.Colors (theColor1, theColor2); }
+
+ //! Return all Z layer ids in sequence ordered by overlay level from lowest layer to highest ( foreground ).
+ //! The first layer ID in sequence is the default layer that can't be removed.
+ Standard_EXPORT void GetAllZLayers (TColStd_SequenceOfInteger& theLayerSeq) const;
+
+ //! Add a new top-level Z layer to all managed views and get its ID as <theLayerId> value.
+ //! The Z layers are controlled entirely by viewer, it is not possible to add a layer to a particular view.
+ //! The method returns Standard_False if the layer can not be created.
+ //! The layer mechanism allows to display structures in higher layers in overlay of structures in lower layers.
+ Standard_EXPORT Standard_Boolean AddZLayer (Standard_Integer& theLayerId);
+
+ //! Remove Z layer with ID <theLayerId>.
+ //! Method returns Standard_False if the layer can not be removed or doesn't exists.
+ //! By default, there are always default bottom-level layer that can't be removed.
+ Standard_EXPORT Standard_Boolean RemoveZLayer (const Standard_Integer theLayerId);
+
+ //! Returns the settings of a single Z layer.
+ Standard_EXPORT Graphic3d_ZLayerSettings ZLayerSettings (const Standard_Integer theLayerId);
+
+ //! Sets the settings for a single Z layer.
+ Standard_EXPORT void SetZLayerSettings (const Standard_Integer theLayerId, const Graphic3d_ZLayerSettings& theSettings);
+
+public:
+
+ //! 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(); }
- Standard_EXPORT void DisplayPrivilegedPlane (const Standard_Boolean OnOff, const Quantity_Length aSize = 1);
+ 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 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:
+ //! positional-light 0.3 0. 0.
+ //! directional-light V3d_XnegYposZpos
+ //! directional-light V3d_XnegYneg
+ //! ambient-light
+ Standard_EXPORT void SetDefaultLights();
+
//! Activates MyLight in the viewer.
- Standard_EXPORT void SetLightOn (const Handle(V3d_Light)& MyLight);
+ Standard_EXPORT void SetLightOn (const Handle(V3d_Light)& theLight);
//! Activates all the lights defined in this viewer.
Standard_EXPORT void SetLightOn();
//! Deactivates MyLight in this viewer.
- Standard_EXPORT void SetLightOff (const Handle(V3d_Light)& MyLight);
+ Standard_EXPORT void SetLightOff (const Handle(V3d_Light)& theLight);
//! Deactivate all the Lights defined in this viewer.
Standard_EXPORT void SetLightOff();
//! Delete Light in Sequence Of Lights.
- Standard_EXPORT void DelLight (const Handle(V3d_Light)& MyLight);
-
- //! Defines the selected light.
- Standard_EXPORT void SetCurrentSelectedLight (const Handle(V3d_Light)& TheLight);
-
- //! Defines the selected light at NULL.
- Standard_EXPORT void ClearCurrentSelectedLight();
-
- //! Returns the default background colour depending of the type.
- Standard_EXPORT void DefaultBackgroundColor (const Quantity_TypeOfColor Type, Quantity_Parameter& V1, Quantity_Parameter& V2, Quantity_Parameter& V3) const;
-
- //! Returns the default background colour object.
- Standard_EXPORT Quantity_Color DefaultBackgroundColor() const;
-
- //! Returns the gradient background colour objects of the view.
- Standard_EXPORT void DefaultBgGradientColors (Quantity_Color& Color1, Quantity_Color& Color2) const;
-
- //! Returns the default size of the view.
- Standard_EXPORT Quantity_Length DefaultViewSize() const;
-
- //! Returns the default Projection.
- Standard_EXPORT V3d_TypeOfOrientation DefaultViewProj() const;
-
- //! Returns the default type of Visualization.
- Standard_EXPORT V3d_TypeOfVisualization DefaultVisualization() const;
-
- //! Returns the default type of Shading
- Standard_EXPORT V3d_TypeOfShadingModel DefaultShadingModel() const;
-
- Standard_EXPORT Quantity_PlaneAngle DefaultAngle() const;
-
- //! Returns the regeneration mode of views in the viewer.
- Standard_EXPORT V3d_TypeOfUpdate UpdateMode() const;
-
- //! Returns True if One View more can be
- //! activated in this Viewer.
- Standard_EXPORT Standard_Boolean IfMoreViews() const;
-
- //! initializes an iteration on the active views.
- Standard_EXPORT void InitActiveViews();
-
- //! returns true if there are more active view(s) to return.
- Standard_EXPORT Standard_Boolean MoreActiveViews() const;
-
- //! Go to the next active view
- //! (if there is not, ActiveView will raise an exception)
- Standard_EXPORT void NextActiveViews();
-
- Standard_EXPORT Handle(V3d_View) ActiveView() const;
-
- //! returns true if there is only
- //! one active view.
- Standard_EXPORT Standard_Boolean LastActiveView() const;
-
- //! initializes an iteration on the Defined views.
- Standard_EXPORT void InitDefinedViews();
-
- //! returns true if there are more Defined view(s) to return.
- Standard_EXPORT Standard_Boolean MoreDefinedViews() const;
-
- //! Go to the next Defined view
- //! (if there is not, DefinedView will raise an exception)
- Standard_EXPORT void NextDefinedViews();
-
- Standard_EXPORT Handle(V3d_View) DefinedView() const;
-
- //! initializes an iteration on the active Lights.
- Standard_EXPORT void InitActiveLights();
-
- //! returns true if there are more active Light(s) to return.
- Standard_EXPORT Standard_Boolean MoreActiveLights() const;
-
- //! Go to the next active Light
- //! (if there is not, ActiveLight will raise an exception)
- Standard_EXPORT void NextActiveLights();
-
- Standard_EXPORT Handle(V3d_Light) ActiveLight() const;
-
- //! initializes an iteration on the Defined Lights.
- Standard_EXPORT void InitDefinedLights();
-
- //! returns true if there are more Defined Light(s) to return.
- Standard_EXPORT Standard_Boolean MoreDefinedLights() const;
-
- //! Go to the next Defined Light
- //! (if there is not, DefinedLight will raise an exception)
- Standard_EXPORT void NextDefinedLights();
-
- Standard_EXPORT Handle(V3d_Light) DefinedLight() const;
-
- //! Returns the structure manager associated to this viewer.
- Standard_EXPORT Handle(Graphic3d_StructureManager) StructureManager() const;
-
- //! Returns the Selected Light.
- Standard_EXPORT Handle(V3d_Light) CurrentSelectedLight() const;
+ Standard_EXPORT void DelLight (const Handle(V3d_Light)& theLight);
+ //! Updates the lights of all the views of a viewer.
+ Standard_EXPORT void UpdateLights();
+
Standard_EXPORT Standard_Boolean IsGlobalLight (const Handle(V3d_Light)& TheLight) const;
+
+ //! 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 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.
+ Standard_EXPORT void Erase() const;
+
+ //! UnHighlight all Objects in All the views.
+ Standard_EXPORT void UnHighlight() const;
+
+public:
+
//! returns true if the computed mode can be used.
- Standard_EXPORT Standard_Boolean ComputedMode() const;
-
+ Standard_Boolean ComputedMode() const { return myComputedMode; }
+
+ //! Set if the computed mode can be used.
+ void SetComputedMode (const Standard_Boolean theMode) { myComputedMode = theMode; }
+
//! returns true if by default the computed mode must be used.
- Standard_EXPORT Standard_Boolean DefaultComputedMode() const;
-
+ Standard_Boolean DefaultComputedMode() const { return myDefaultComputedMode; }
+
+ //! Set if by default the computed mode must be used.
+ void SetDefaultComputedMode (const Standard_Boolean theMode) { myDefaultComputedMode = theMode; }
+
+public: //! @name privileged plane management
+
+ Standard_EXPORT gp_Ax3 PrivilegedPlane() const;
+
+ Standard_EXPORT void SetPrivilegedPlane (const gp_Ax3& thePlane);
+
+ Standard_EXPORT void DisplayPrivilegedPlane (const Standard_Boolean theOnOff, const Quantity_Length theSize = 1);
+
+public: //! @name grid management
+
//! Activates the grid in all views of <me>.
Standard_EXPORT void ActivateGrid (const Aspect_GridType aGridType, const Aspect_GridDrawMode aGridDrawMode);
//! <OffSet> defines the displacement along the plane normal.
Standard_EXPORT void SetRectangularGridGraphicValues (const Quantity_Length XSize, const Quantity_Length YSize, const Quantity_Length OffSet);
- //! Returns the gradient background of the view.
- Standard_EXPORT Aspect_GradientBackground GetGradientBackground() const;
-
- //! defines default lights -
- //! positional-light 0.3 0. 0.
- //! directional-light V3d_XnegYposZpos
- //! directional-light V3d_XnegYneg
- //! ambient-light
- Standard_EXPORT void SetDefaultLights();
-
-
//! Display grid echo at requested point in the view.
Standard_EXPORT void ShowGridEcho (const Handle(V3d_View)& theView, const Graphic3d_Vertex& thePoint);
-
//! Temporarly hide grid echo.
Standard_EXPORT void HideGridEcho (const Handle(V3d_View)& theView);
- //! Add a new top-level Z layer to all managed views and get
- //! its ID as <theLayerId> value. The Z layers are controlled entirely
- //! by viewer, it is not possible to add a layer to a
- //! particular view. The method returns Standard_False if the layer can
- //! not be created. The layer mechanism allows to display structures
- //! in higher layers in overlay of structures in lower layers.
- Standard_EXPORT Standard_Boolean AddZLayer (Standard_Integer& theLayerId);
-
- //! Remove Z layer with ID <theLayerId>. Method returns
- //! Standard_False if the layer can not be removed or doesn't exists.
- //! By default, there are always default bottom-level layer that can't
- //! be removed.
- Standard_EXPORT Standard_Boolean RemoveZLayer (const Standard_Integer theLayerId);
-
- //! Return all Z layer ids in sequence ordered by overlay level
- //! from lowest layer to highest ( foreground ). The first layer ID
- //! in sequence is the default layer that can't be removed.
- Standard_EXPORT void GetAllZLayers (TColStd_SequenceOfInteger& theLayerSeq) const;
-
- //! Sets the settings for a single Z layer.
- Standard_EXPORT void SetZLayerSettings (const Standard_Integer theLayerId, const Graphic3d_ZLayerSettings& theSettings);
-
- //! Returns the settings of a single Z layer.
- Standard_EXPORT Graphic3d_ZLayerSettings ZLayerSettings (const Standard_Integer theLayerId);
-
- //! Return Graphic Driver instance.
- Standard_EXPORT const Handle(Graphic3d_GraphicDriver)& Driver() const;
-
- Standard_EXPORT Standard_ExtString NextName() const;
-
- Standard_EXPORT Standard_CString Domain() const;
-
- //! Return default Rendering Parameters.
- //! By default these parameters are set in a new V3d_View.
- Standard_EXPORT const Graphic3d_RenderingParams& DefaultRenderingParams() const;
-
- //! Set default Rendering Parameters.
- Standard_EXPORT void SetDefaultRenderingParams (const Graphic3d_RenderingParams& theParams);
-
-friend class V3d_View;
-friend class V3d_Light;
-
- DEFINE_STANDARD_RTTIEXT(V3d_Viewer,MMgt_TShared)
+public: //! @name deprecated methods
+
+ Standard_DEPRECATED("This constructor is deprecated")
+ Standard_EXPORT V3d_Viewer (const Handle(Graphic3d_GraphicDriver)& theDriver,
+ const Standard_ExtString theName,
+ const Standard_CString theDomain = "",
+ const Quantity_Length theViewSize = 1000.0,
+ const V3d_TypeOfOrientation theViewProj = V3d_XposYnegZpos,
+ const Quantity_NameOfColor theViewBackground = Quantity_NOC_GRAY30,
+ const V3d_TypeOfVisualization theVisualization = V3d_ZBUFFER,
+ const V3d_TypeOfShadingModel theShadingModel = V3d_GOURAUD,
+ const V3d_TypeOfUpdate theUpdateMode = V3d_WAIT,
+ const Standard_Boolean theComputedMode = Standard_True,
+ const Standard_Boolean theDefaultComputedMode = Standard_True);
-protected:
-
- Standard_EXPORT void IncrCount();
+ //! Defines the default base colour of views attached
+ //! to the Viewer by supplying the type of colour
+ //! definition and the three component values.
+ Standard_DEPRECATED("This method is deprecated - SetDefaultBackgroundColor() taking Quantity_Color should be used instead")
+ void SetDefaultBackgroundColor (const Quantity_TypeOfColor theType,
+ const Quantity_Parameter theV1,
+ const Quantity_Parameter theV2,
+ const Quantity_Parameter theV3)
+ {
+ Standard_Real aV1 = theV1;
+ Standard_Real aV2 = theV2;
+ Standard_Real aV3 = theV3;
+ if (aV1 < 0.0) aV1 = 0.0; else if (aV1 > 1.0) aV1 = 1.0;
+ if (aV2 < 0.0) aV2 = 0.0; else if (aV2 > 1.0) aV2 = 1.0;
+ if (aV3 < 0.0) aV3 = 0.0; else if (aV3 > 1.0) aV3 = 1.0;
+ SetDefaultBackgroundColor (Quantity_Color (aV1, aV2, aV3, theType));
+ }
+
+ Standard_DEPRECATED("This method is deprecated - DefaultBackgroundColor() without arguments should be used instead")
+ void DefaultBackgroundColor (const Quantity_TypeOfColor theType, Quantity_Parameter& theV1, Quantity_Parameter& theV2, Quantity_Parameter& theV3) const
+ {
+ Quantity_Color aColor = DefaultBackgroundColor();
+ aColor.Values (theV1, theV2, theV3, theType) ;
+ }
private:
//! Returns the default background colour.
- Standard_EXPORT Aspect_Background GetBackgroundColor() const;
-
+ const Aspect_Background& GetBackgroundColor() const { return myBackground; }
+
//! Adds View in Sequence Of Views.
- Standard_EXPORT void AddView (const Handle(V3d_View)& MyView);
+ Standard_EXPORT void AddView (const Handle(V3d_View)& theView);
//! Delete View in Sequence Of Views.
- Standard_EXPORT void DelView (const Handle(V3d_View)& MyView);
+ Standard_EXPORT void DelView (const Handle(V3d_View)& theView);
//! Adds Light in Sequence Of Lights.
- Standard_EXPORT void AddLight (const Handle(V3d_Light)& MyLight);
+ Standard_EXPORT void AddLight (const Handle(V3d_Light)& theLight);
- Standard_EXPORT Standard_Boolean IsActive (const Handle(V3d_View)& aView) const;
-
private:
- Standard_Integer myNextCount;
Handle(Graphic3d_GraphicDriver) myDriver;
- TCollection_ExtendedString myName;
- TCollection_AsciiString myDomain;
Handle(Graphic3d_StructureManager) myStructureManager;
- V3d_ListOfTransient MyDefinedViews;
- V3d_ListOfTransient MyActiveViews;
- V3d_ListOfTransient MyDefinedLights;
- V3d_ListOfTransient MyActiveLights;
- Aspect_Background MyBackground;
- Aspect_GradientBackground MyGradientBackground;
- Standard_Real MyViewSize;
- V3d_TypeOfOrientation MyViewProj;
- V3d_TypeOfVisualization MyVisualization;
- V3d_TypeOfShadingModel MyShadingModel;
- Quantity_PlaneAngle MyDefaultAngle;
- V3d_TypeOfView MyDefaultTypeOfView;
+ TColStd_MapOfInteger myLayerIds;
+ Aspect_GenId myZLayerGenId;
+
+ V3d_ListOfView myDefinedViews;
+ V3d_ListOfView myActiveViews;
+ V3d_ListOfLight myDefinedLights;
+ V3d_ListOfLight myActiveLights;
+
+ Aspect_Background myBackground;
+ Aspect_GradientBackground myGradientBackground;
+ Standard_Real myViewSize;
+ V3d_TypeOfOrientation myViewProj;
+ V3d_TypeOfVisualization myVisualization;
+ V3d_TypeOfShadingModel myShadingModel;
+ V3d_TypeOfView myDefaultTypeOfView;
Graphic3d_RenderingParams myDefaultRenderingParams;
- Handle(V3d_Light) MyCurrentSelectedLight;
- TColStd_ListIteratorOfListOfTransient myActiveViewsIterator;
- TColStd_ListIteratorOfListOfTransient myDefinedViewsIterator;
- TColStd_ListIteratorOfListOfTransient myActiveLightsIterator;
- TColStd_ListIteratorOfListOfTransient myDefinedLightsIterator;
+
+ V3d_ListOfView::Iterator myActiveViewsIterator;
+ V3d_ListOfView::Iterator myDefinedViewsIterator;
+ V3d_ListOfLight::Iterator myActiveLightsIterator;
+ V3d_ListOfLight::Iterator myDefinedLightsIterator;
+
Standard_Boolean myComputedMode;
Standard_Boolean myDefaultComputedMode;
+
gp_Ax3 myPrivilegedPlane;
Handle(Graphic3d_Structure) myPlaneStructure;
Standard_Boolean myDisplayPlane;
Quantity_Length myDisplayPlaneLength;
+
Handle(V3d_RectangularGrid) myRGrid;
Handle(V3d_CircularGrid) myCGrid;
Aspect_GridType myGridType;
Handle(Graphic3d_Group) myGridEchoGroup;
Handle(Graphic3d_AspectMarker3d) myGridEchoAspect;
Graphic3d_Vertex myGridEchoLastVert;
- TColStd_MapOfInteger myLayerIds;
- Aspect_GenId myZLayerGenId;
+
};
+DEFINE_STANDARD_HANDLE(V3d_Viewer, Standard_Transient)
+
#endif // _V3d_Viewer_HeaderFile
+++ /dev/null
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-
-#include <Aspect_Background.hxx>
-#include <Aspect_GradientBackground.hxx>
-#include <Aspect_Grid.hxx>
-#include <gp_Ax3.hxx>
-#include <Graphic3d_AspectMarker3d.hxx>
-#include <Graphic3d_GraphicDriver.hxx>
-#include <Graphic3d_Group.hxx>
-#include <Graphic3d_Structure.hxx>
-#include <Quantity_Color.hxx>
-#include <V3d.hxx>
-#include <V3d_BadValue.hxx>
-#include <V3d_CircularGrid.hxx>
-#include <V3d_Light.hxx>
-#include <V3d_RectangularGrid.hxx>
-#include <V3d_View.hxx>
-#include <V3d_Viewer.hxx>
-
-void V3d_Viewer::InitActiveViews() {
-myActiveViewsIterator.Initialize(MyActiveViews);
-}
-Standard_Boolean V3d_Viewer::MoreActiveViews () const {
- return myActiveViewsIterator.More();
-}
-void V3d_Viewer::NextActiveViews () {
- if(!MyActiveViews.IsEmpty())myActiveViewsIterator.Next();
-}
-Handle(V3d_View) V3d_Viewer::ActiveView() const {
- return (Handle(V3d_View)&)(myActiveViewsIterator.Value());}
-
-Standard_Boolean V3d_Viewer::LastActiveView() const {
- return MyActiveViews.Extent() == 1;}
-
-Standard_Boolean V3d_Viewer::IsActive(const Handle(V3d_View)& aView) const {
- return MyActiveViews.Contains(aView);
-}
-void V3d_Viewer::InitDefinedViews() {
-myDefinedViewsIterator.Initialize(MyDefinedViews);
-}
-Standard_Boolean V3d_Viewer::MoreDefinedViews () const {
- return myDefinedViewsIterator.More();
-}
-void V3d_Viewer::NextDefinedViews () {
- if(!MyDefinedViews.IsEmpty())myDefinedViewsIterator.Next();
-}
-Handle(V3d_View) V3d_Viewer::DefinedView() const {
- return (Handle(V3d_View)&)(myDefinedViewsIterator.Value());}
-
-void V3d_Viewer::InitActiveLights() {
-myActiveLightsIterator.Initialize(MyActiveLights);
-}
-Standard_Boolean V3d_Viewer::MoreActiveLights () const {
- return myActiveLightsIterator.More();
-}
-void V3d_Viewer::NextActiveLights () {
- myActiveLightsIterator.Next();
-}
-Handle(V3d_Light) V3d_Viewer::ActiveLight() const {
- return (Handle(V3d_Light)&)(myActiveLightsIterator.Value());}
-
-void V3d_Viewer::InitDefinedLights() {
-myDefinedLightsIterator.Initialize(MyDefinedLights);
-}
-Standard_Boolean V3d_Viewer::MoreDefinedLights () const {
- return myDefinedLightsIterator.More();
-}
-void V3d_Viewer::NextDefinedLights () {
- if(!MyDefinedLights.IsEmpty())myDefinedLightsIterator.Next();
-}
-Handle(V3d_Light) V3d_Viewer::DefinedLight() const {
- return (Handle(V3d_Light)&)(myDefinedLightsIterator.Value());}
+++ /dev/null
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-
-#include <Aspect_Background.hxx>
-#include <Aspect_GradientBackground.hxx>
-#include <Aspect_Grid.hxx>
-#include <gp_Ax3.hxx>
-#include <Graphic3d_AspectMarker3d.hxx>
-#include <Graphic3d_GraphicDriver.hxx>
-#include <Graphic3d_Group.hxx>
-#include <Graphic3d_Structure.hxx>
-#include <Quantity_Color.hxx>
-#include <V3d.hxx>
-#include <V3d_AmbientLight.hxx>
-#include <V3d_BadValue.hxx>
-#include <V3d_CircularGrid.hxx>
-#include <V3d_DirectionalLight.hxx>
-#include <V3d_Light.hxx>
-#include <V3d_PositionalLight.hxx>
-#include <V3d_RectangularGrid.hxx>
-#include <V3d_View.hxx>
-#include <V3d_Viewer.hxx>
-
-void V3d_Viewer::UpdateLights() {
-
- for (InitActiveViews();MoreActiveViews();NextActiveViews()){
- ActiveView()->UpdateLights();
- }
-}
-
-void V3d_Viewer::SetLightOn( const Handle(V3d_Light)& TheLight ) {
-
-
- if(!MyActiveLights.Contains(TheLight)) {
-// V3d_BadValue_Raise_if( MyActiveLights.Extent() >= MyDriver->InquireLightLimit(),
-// "too many lights");
- MyActiveLights.Append(TheLight) ;
- }
-
- for (InitActiveViews();MoreActiveViews();NextActiveViews()){
- ActiveView()->SetLightOn(TheLight);}
-}
-
-void V3d_Viewer::SetLightOff( const Handle(V3d_Light)& TheLight ) {
-
- MyActiveLights.Remove(TheLight);
- for (InitActiveViews();MoreActiveViews();NextActiveViews()) {
- ActiveView()->SetLightOff(TheLight);}
-}
-
-
-void V3d_Viewer::SetLightOn() {
-
- for (InitDefinedLights();MoreDefinedLights();NextDefinedLights()) {
- if(!MyActiveLights.Contains(DefinedLight())) {
-// V3d_BadValue_Raise_if( MyActiveLights.Extent() >= MyDriver->InquireLightLimit(),
-// "too many lights");
- MyActiveLights.Append(DefinedLight());
- for (InitActiveViews();MoreActiveViews();NextActiveViews()) {
- ActiveView()->SetLightOn(DefinedLight());}
- }
- }
-}
-
-void V3d_Viewer::SetLightOff() {
-
- for (InitActiveLights();MoreActiveLights();NextActiveLights()) {
- for(InitActiveViews();MoreActiveViews();NextActiveViews()){
- ActiveView()->SetLightOff(ActiveLight());}
- }
- MyActiveLights.Clear();
-}
-
-void V3d_Viewer::SetCurrentSelectedLight(const Handle(V3d_Light)& TheLight) {
- MyCurrentSelectedLight = TheLight;
-}
-
-void V3d_Viewer::ClearCurrentSelectedLight() {
- MyCurrentSelectedLight.Nullify();
-}
-
-
-Handle(V3d_Light) V3d_Viewer::CurrentSelectedLight() const {
-
- return MyCurrentSelectedLight;
-}
-
-Standard_Boolean V3d_Viewer::IsGlobalLight(const Handle(V3d_Light)& TheLight)
- const {
-
- return MyActiveLights.Contains(TheLight);
-}
-
-
-void V3d_Viewer::AddLight( const Handle(V3d_Light)& TheLight ) {
-
- MyDefinedLights.Append(TheLight);
-}
-
-void V3d_Viewer::DelLight( const Handle(V3d_Light)& TheLight ) {
-
- SetLightOff(TheLight);
- MyDefinedLights.Remove(TheLight);
-}
-
-void V3d_Viewer::SetDefaultLights()
-{
- while (MyDefinedLights.Extent() > 0)
- {
- DelLight (Handle(V3d_Light)::DownCast (MyDefinedLights.First()));
- }
-
- SetLightOn (new V3d_DirectionalLight (this, V3d_Zneg, Quantity_NOC_WHITE, Standard_True));
- SetLightOn (new V3d_AmbientLight (this));
-}
{
myPrivilegedPlane = aPlane;
Grid()->SetDrawMode(Grid()->DrawMode());
- for (InitActiveViews (); MoreActiveViews (); NextActiveViews ())
- ActiveView ()->SetGrid (myPrivilegedPlane, Grid ());
+ for (V3d_ListOfView::Iterator anActiveViewIter (myActiveViews); anActiveViewIter.More(); anActiveViewIter.Next())
+ {
+ anActiveViewIter.Value()->SetGrid (myPrivilegedPlane, Grid());
+ }
+
if(myDisplayPlane)
DisplayPrivilegedPlane(Standard_True,myDisplayPlaneLength);
else
Grid()->Display();
}
Grid()->Activate();
- for (InitActiveViews(); MoreActiveViews(); NextActiveViews())
+ for (V3d_ListOfView::Iterator anActiveViewIter (myActiveViews); anActiveViewIter.More(); anActiveViewIter.Next())
{
- ActiveView()->SetGrid (myPrivilegedPlane, Grid());
+ anActiveViewIter.Value()->SetGrid (myPrivilegedPlane, Grid());
}
Update();
}
Grid()->Erase();
myGridType = Aspect_GT_Rectangular;
Grid()->Deactivate();
- for (InitActiveViews(); MoreActiveViews(); NextActiveViews())
+ for (V3d_ListOfView::Iterator anActiveViewIter (myActiveViews); anActiveViewIter.More(); anActiveViewIter.Next())
{
- ActiveView()->SetGridActivity (Standard_False);
+ anActiveViewIter.Value()->SetGridActivity (Standard_False);
if (myGridEcho
&& !myGridEchoStructure.IsNull())
{
const Quantity_PlaneAngle theRotationAngle)
{
myRGrid->SetGridValues (theXOrigin, theYOrigin, theXStep, theYStep, theRotationAngle);
- for (InitActiveViews(); MoreActiveViews(); NextActiveViews())
+ for (V3d_ListOfView::Iterator anActiveViewIter (myActiveViews); anActiveViewIter.More(); anActiveViewIter.Next())
{
- ActiveView()->SetGrid (myPrivilegedPlane, myRGrid);
+ anActiveViewIter.Value()->SetGrid (myPrivilegedPlane, myRGrid);
}
Update();
}
{
myCGrid->SetGridValues (theXOrigin, theYOrigin, theRadiusStep,
theDivisionNumber, theRotationAngle);
- for (InitActiveViews(); MoreActiveViews(); NextActiveViews())
+ for (V3d_ListOfView::Iterator anActiveViewIter (myActiveViews); anActiveViewIter.More(); anActiveViewIter.Next())
{
- ActiveView()->SetGrid (myPrivilegedPlane, myCGrid);
+ anActiveViewIter.Value()->SetGrid (myPrivilegedPlane, myCGrid);
}
Update();
}
aDispStatus);
if (toDisplayInView)
{
- for (aCtx->CurrentViewer()->InitDefinedViews(); aCtx->CurrentViewer()->MoreDefinedViews(); aCtx->CurrentViewer()->NextDefinedViews())
+ for (V3d_ListOfViewIterator aViewIter (aCtx->CurrentViewer()->DefinedViewIterator()); aViewIter.More(); aViewIter.Next())
{
- aCtx->SetViewAffinity (aShape, aCtx->CurrentViewer()->DefinedView(), Standard_False);
+ aCtx->SetViewAffinity (aShape, aViewIter.Value(), Standard_False);
}
aCtx->SetViewAffinity (aShape, ViewerTest::CurrentView(), Standard_True);
}
else if (a3DViewer.IsNull())
{
toCreateViewer = Standard_True;
- TCollection_ExtendedString NameOfWindow("Viewer3D");
- a3DViewer = new V3d_Viewer(aGraphicDriver, NameOfWindow.ToExtString());
+ a3DViewer = new V3d_Viewer(aGraphicDriver);
a3DViewer->SetDefaultBackgroundColor (ViewerTest_DefaultBackground.FlatColor);
a3DViewer->SetDefaultBgGradientColors (ViewerTest_DefaultBackground.GradientColor1,
ViewerTest_DefaultBackground.GradientColor2,
{
// print lights info
Standard_Integer aLightId = 0;
- for (aView->InitActiveLights(); aView->MoreActiveLights(); aView->NextActiveLights(), ++aLightId)
+ for (V3d_ListOfLightIterator aLightIter (aView->ActiveLightIterator()); aLightIter.More(); aLightIter.Next(), ++aLightId)
{
- Handle(V3d_Light) aLight = aView->ActiveLight();
+ Handle(V3d_Light) aLight = aLightIter.Value();
const Quantity_Color aColor = aLight->Color();
theDi << "Light" << aLightId << "\n";
switch (aLight->Type())
|| anArgCase.IsEqual ("CLEAR"))
{
toCreate = Standard_False;
- aView->InitActiveLights();
- while (aView->MoreActiveLights())
+ for (V3d_ListOfLightIterator aLightIter (aView->ActiveLightIterator()); aLightIter.More();)
{
- aViewer->DelLight (aView->ActiveLight());
- aView->InitActiveLights();
+ Handle(V3d_Light) aLight = aLightIter.Value();
+ aViewer->DelLight (aLight);
+ aLightIter = aView->ActiveLightIterator();
}
}
else if (anArgCase.IsEqual ("AMB")
const Standard_Integer aLightId = getLightId (theArgVec[anArgIt]);
Standard_Integer aLightIt = 0;
- for (aView->InitActiveLights(); aView->MoreActiveLights(); aView->NextActiveLights(), ++aLightIt)
+ for (V3d_ListOfLightIterator aLightIter (aView->ActiveLightIterator()); aLightIter.More(); aLightIter.Next(), ++aLightIt)
{
if (aLightIt == aLightId)
{
- aLightOld = aView->ActiveLight();
+ aLightOld = aLightIter.Value();
break;
}
}
const TCollection_AsciiString anArgNext (theArgVec[anArgIt]);
const Standard_Integer aLightDelId = getLightId (theArgVec[anArgIt]);
Standard_Integer aLightIt = 0;
- for (aView->InitActiveLights(); aView->MoreActiveLights(); aView->NextActiveLights(), ++aLightIt)
+ for (V3d_ListOfLightIterator aLightIter (aView->ActiveLightIterator()); aLightIter.More(); aLightIter.Next(), ++aLightIt)
{
- aLightDel = aView->ActiveLight();
+ aLightDel = aLightIter.Value();
if (aLightIt == aLightDelId)
{
break;
#include <XmlXCAFDrivers.hxx>
#include <stdio.h>
-#define ZVIEW_SIZE 1000000.0
-// avoid warnings on 'extern "C"' functions returning C++ classes
-#ifdef _MSC_VER
-#pragma warning(4:4190)
-#endif
//=======================================================================
// Section: General commands
aDocViewer = TPrsStd_AISViewer::New (aRoot, ViewerTest::GetAISContext());
}
- //szv:CAX-TRJ7 c2-pe-214.stp was clipped
- aDocViewer->GetInteractiveContext()->CurrentViewer()->InitActiveViews();
- aDocViewer->GetInteractiveContext()->CurrentViewer()->ActiveView()->SetZSize(ZVIEW_SIZE);
- //DDF::ReturnLabel(di,viewer->Label());
-
// collect sequence of labels to display
Handle(XCAFDoc_ShapeTool) shapes = XCAFDoc_DocumentTool::ShapeTool (aDoc->Main());
TDF_LabelSequence seq;
return 1;
}
- Handle(V3d_Viewer) viewer = IC->CurrentViewer();
- viewer->InitActiveViews();
- if ( viewer->MoreActiveViews() ) {
- viewer->ActiveView()->Dump ( argv[2] );
+ Handle(V3d_Viewer) aViewer = IC->CurrentViewer();
+ V3d_ListOfViewIterator aViewIter = aViewer->ActiveViewIterator();
+ if (aViewIter.More())
+ {
+ aViewIter.Value()->Dump ( argv[2] );
}
else {
di << "Cannot find an active view in a viewer " << argv[1] << "\n";