1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

0024742: Remove rarely used collection classes: Set

Classes NCollection_Set and NCollection_HSet removed as unused (along with NCollection_DefineSet.hxx and NCollection_DefineHSet.hxx).

Classes TCollection_Set and TCollection_HSet removed (along with TCollection_SetIterator and TCollection_SetList nested classes).
Code previously using Set classes updated to equivalent use of Sequence (Adaptor3d and Visual3d packages) or TColStd_PackedMapOfInteger (BRepAlgo package).

In Adaptor3d_CurveOnSurface, calculation of continuity intervals refactored so as to build and store sorted sequence of reals, instead of collecting them to set, copying to array, and then sorting.
This commit is contained in:
dln
2014-04-08 12:55:04 +04:00
committed by abv
parent 6af4fe1c46
commit 54f7544df6
34 changed files with 353 additions and 1869 deletions

View File

@@ -268,22 +268,20 @@ is
imported NListOfLayerItem;
class SetOfLight instantiates
Set from TCollection (Light from Visual3d);
class SequenceOfLight instantiates
Sequence from TCollection (Light from Visual3d);
---Category: Instantiated classes
class HSetOfLight instantiates
HSet from TCollection
(Light from Visual3d, SetOfLight);
class HSequenceOfLight instantiates
HSequence from TCollection (Light from Visual3d, SequenceOfLight);
---Category: Instantiated classes
class SetOfView instantiates
Set from TCollection (View from Visual3d);
class SequenceOfView instantiates
Sequence from TCollection (View from Visual3d);
---Category: Instantiated classes
class HSetOfView instantiates
HSet from TCollection
(View from Visual3d, SetOfView);
class HSequenceOfView instantiates
HSequence from TCollection (View from Visual3d, SequenceOfView);
---Category: Instantiated classes
end Visual3d;

View File

@@ -36,7 +36,7 @@ uses
SequenceOfAddress from TColStd,
Light from Visual3d,
HSetOfLight from Visual3d,
HSequenceOfLight from Visual3d,
TypeOfModel from Visual3d,
TypeOfVisualization from Visual3d,
TypeOfSurfaceDetail from Visual3d,
@@ -277,7 +277,7 @@ is
----------------------------
ActivatedLights ( me )
returns HSetOfLight from Visual3d
returns HSequenceOfLight from Visual3d
is static;
---Level: Internal
---Purpose: Returns the group of active light sources

View File

@@ -281,13 +281,13 @@ Standard_Integer indexL = 0;
}
Handle(Visual3d_HSetOfLight) Visual3d_ContextView::ActivatedLights () const {
Handle(Visual3d_HSequenceOfLight) Visual3d_ContextView::ActivatedLights () const {
Handle(Visual3d_HSetOfLight) SG = new Visual3d_HSetOfLight ();
Handle(Visual3d_HSequenceOfLight) SG = new Visual3d_HSequenceOfLight();
Standard_Integer Length = MyLights.Length ();
for (Standard_Integer i=1; i<=Length; i++)
SG->Add ((Visual3d_Light *) (MyLights.Value (i)));
SG->Append((Visual3d_Light *) (MyLights.Value (i)));
return (SG);

View File

@@ -91,7 +91,7 @@ uses
ContextView from Visual3d,
Layer from Visual3d,
Light from Visual3d,
SetOfLight from Visual3d,
SequenceOfLight from Visual3d,
TypeOfAnswer from Visual3d,
ViewManager from Visual3d,
ViewManagerPtr from Visual3d,

View File

@@ -134,11 +134,7 @@
#include <Graphic3d_Vertex.hxx>
#include <Visual3d_Light.hxx>
#include <Visual3d_SetOfLight.hxx>
#include <Visual3d_HSetOfLight.hxx>
#include <Visual3d_HSetOfView.hxx>
#include <Visual3d_SetIteratorOfSetOfLight.hxx>
#include <Visual3d_SetIteratorOfSetOfView.hxx>
#include <Visual3d_HSequenceOfView.hxx>
#include <Graphic3d_TextureEnv.hxx>
@@ -1306,12 +1302,13 @@ Standard_Boolean Visual3d_View::DisplayImmediate (const Handle(Graphic3d_Structu
if (theIsSingleView)
{
Handle(Visual3d_HSetOfView) aViews = MyViewManager->DefinedView();
for (Visual3d_SetIteratorOfSetOfView aViewIter (aViews->Set()); aViewIter.More(); aViewIter.Next())
Handle(Visual3d_HSequenceOfView) aViews = MyViewManager->DefinedView();
for (int i=1;i<=aViews->Length();i++)
{
if (aViewIter.Value().Access() != this)
if (aViews->Value(i).Access() != this)
{
aViewIter.Value()->EraseImmediate (theStructure);
aViews->Value(i)->EraseImmediate (theStructure);
}
}
}

View File

@@ -46,8 +46,8 @@ uses
ContextPick from Visual3d,
Layer from Visual3d,
SetOfView from Visual3d,
HSetOfView from Visual3d,
SequenceOfView from Visual3d,
HSequenceOfView from Visual3d,
View from Visual3d
is
@@ -123,14 +123,14 @@ is
----------------------------
ActivatedView ( me )
returns HSetOfView from Visual3d
returns HSequenceOfView from Visual3d
is static;
---Level: Internal
---Purpose: Returns the group of views activated in the visualiser <me>.
---Category: Inquire methods
DefinedView ( me )
returns HSetOfView from Visual3d
returns HSequenceOfView from Visual3d
is static;
---Level: Internal
---Purpose: Returns the group of views defined in the visualiser <me>.
@@ -459,7 +459,7 @@ fields
-- and a group of views.
--
-- the defined views
MyDefinedView : SetOfView from Visual3d;
MyDefinedView : SequenceOfView from Visual3d;
-- the layers
MyUnderLayer : Layer from Visual3d;

View File

@@ -67,7 +67,6 @@
#include <Graphic3d_MapOfStructure.hxx>
#include <Graphic3d_MapIteratorOfMapOfStructure.hxx>
#include <Visual3d_SetIteratorOfSetOfView.hxx>
#if defined (_WIN32) || defined(__WIN32__)
# include <WNT_Window.hxx>
@@ -82,7 +81,7 @@
//-Global data definitions
// -- les vues definies
// MyDefinedView : SetOfView;
// MyDefinedView : SequenceOfView;
// -- le generateur d'identificateurs de vues
// MyViewGenId : GenId;
@@ -142,28 +141,23 @@ void Visual3d_ViewManager::Remove () {
MyDefinedView.Clear();
}
void Visual3d_ViewManager::ChangeDisplayPriority (const Handle(Graphic3d_Structure)& AStructure, const Standard_Integer OldPriority, const Standard_Integer NewPriority) {
void Visual3d_ViewManager::ChangeDisplayPriority (const Handle(Graphic3d_Structure)& AStructure, const Standard_Integer OldPriority, const Standard_Integer NewPriority)
{
#ifdef TRACE
cout << "Visual3d_ViewManager::ChangeDisplayPriority ("
<< AStructure->Identification ()
<< ", " << OldPriority << ", " << NewPriority << ")\n";
cout << flush;
cout << "Visual3d_ViewManager::ChangeDisplayPriority ("
<< AStructure->Identification ()
<< ", " << OldPriority << ", " << NewPriority << ")\n";
cout << flush;
#endif
//
// Change structure priority in all defined views
//
Visual3d_SetIteratorOfSetOfView MyIterator(MyDefinedView);
while (MyIterator.More ()) {
(MyIterator.Value ())->ChangeDisplayPriority
(AStructure, OldPriority, NewPriority);
// MyIterator.Next () is located on the next view
MyIterator.Next ();
}
//
// Change structure priority in all defined views
//
for(int i=1; i<=MyDefinedView.Length(); i++)
{
(MyDefinedView.Value(i))->ChangeDisplayPriority(AStructure, OldPriority, NewPriority);
}
}
void Visual3d_ViewManager::ReCompute (const Handle(Graphic3d_Structure)& AStructure) {
@@ -180,15 +174,10 @@ void Visual3d_ViewManager::ReCompute (const Handle(Graphic3d_Structure)& AStruct
//
// Recompute structure in all activated views
//
Visual3d_SetIteratorOfSetOfView MyIterator(MyDefinedView);
while (MyIterator.More ()) {
(MyIterator.Value ())->ReCompute (AStructure);
// MyIterator.Next () is located on the next view
MyIterator.Next ();
for(int i=1; i<=MyDefinedView.Length(); i++)
{
(MyDefinedView.Value(i))->ReCompute(AStructure);
}
}
void Visual3d_ViewManager::ReCompute (const Handle(Graphic3d_Structure)& AStructure,
@@ -213,106 +202,71 @@ void Visual3d_ViewManager::ReCompute (const Handle(Graphic3d_Structure)& AStruct
//
// Recompute structure in all activated views
//
Visual3d_SetIteratorOfSetOfView MyIterator(MyDefinedView);
while (MyIterator.More ()) {
if ((MyIterator.Value ())->Identification () == ViewId)
for(int i=1; i<=MyDefinedView.Length(); i++)
{
if ((MyDefinedView.Value(i))->Identification () == ViewId)
{
theView->ReCompute (AStructure);
// MyIterator.Next () is located on the next view
MyIterator.Next ();
}
}
}
void Visual3d_ViewManager::Clear (const Handle(Graphic3d_Structure)& AStructure, const Standard_Boolean WithDestruction) {
Visual3d_SetIteratorOfSetOfView MyIterator(MyDefinedView);
while (MyIterator.More ()) {
(MyIterator.Value ())->Clear (AStructure, WithDestruction);
// MyIterator.Next () is located on the next view
MyIterator.Next ();
}
void Visual3d_ViewManager::Clear (const Handle(Graphic3d_Structure)& AStructure, const Standard_Boolean WithDestruction)
{
for(int i=1; i<=MyDefinedView.Length(); i++)
{
(MyDefinedView.Value(i))->Clear(AStructure, WithDestruction);
}
}
void Visual3d_ViewManager::Connect (const Handle(Graphic3d_Structure)& AMother, const Handle(Graphic3d_Structure)& ADaughter) {
Visual3d_SetIteratorOfSetOfView MyIterator(MyDefinedView);
while (MyIterator.More ()) {
(MyIterator.Value ())->Connect (AMother, ADaughter);
// MyIterator.Next () is located on the next view
MyIterator.Next ();
}
void Visual3d_ViewManager::Connect (const Handle(Graphic3d_Structure)& AMother, const Handle(Graphic3d_Structure)& ADaughter)
{
for(int i=1; i<=MyDefinedView.Length(); i++)
{
(MyDefinedView.Value(i))->Connect (AMother, ADaughter);
}
}
void Visual3d_ViewManager::Disconnect (const Handle(Graphic3d_Structure)& AMother, const Handle(Graphic3d_Structure)& ADaughter) {
Visual3d_SetIteratorOfSetOfView MyIterator(MyDefinedView);
while (MyIterator.More ()) {
(MyIterator.Value ())->Disconnect (AMother, ADaughter);
// MyIterator.Next () is located on the next view
MyIterator.Next ();
}
void Visual3d_ViewManager::Disconnect (const Handle(Graphic3d_Structure)& AMother, const Handle(Graphic3d_Structure)& ADaughter)
{
for(int i=1; i<=MyDefinedView.Length(); i++)
{
(MyDefinedView.Value(i))->Disconnect (AMother, ADaughter);
}
}
void Visual3d_ViewManager::Display (const Handle(Graphic3d_Structure)& AStructure) {
// Even if physically the structure cannot
void Visual3d_ViewManager::Display (const Handle(Graphic3d_Structure)& AStructure)
{
// Even if physically the structure cannot
// be displayed (pb of visualisation type)
// it has status Displayed.
MyDisplayedStructure.Add(AStructure);
//
// Display structure in all activated views
//
Visual3d_SetIteratorOfSetOfView MyIterator(MyDefinedView);
while (MyIterator.More ()) {
(MyIterator.Value ())->Display (AStructure);
// MyIterator.Next () is located on the next view
MyIterator.Next ();
}
for(int i=1; i<=MyDefinedView.Length(); i++)
{
(MyDefinedView.Value(i))->Display(AStructure);
}
}
void Visual3d_ViewManager::Erase (const Handle(Graphic3d_Structure)& AStructure) {
// Even if physically the structure cannot
void Visual3d_ViewManager::Erase (const Handle(Graphic3d_Structure)& AStructure)
{
// Even if physically the structure cannot
// be displayed (pb of visualisation type)
// it has status Displayed.
MyDisplayedStructure.Remove(AStructure);
MyDisplayedStructure.Remove(AStructure);
//
// Erase structure in all defined views
//
for(int i=1; i<=MyDefinedView.Length(); i++)
{
(MyDefinedView.Value(i))->Erase (AStructure);
}
//
// Erase structure in all defined views
//
Visual3d_SetIteratorOfSetOfView MyIterator(MyDefinedView);
while (MyIterator.More ()) {
(MyIterator.Value ())->Erase (AStructure);
// MyIterator.Next () is located on the next view
MyIterator.Next ();
}
MyHighlightedStructure.Remove (AStructure);
MyPickStructure.Remove (AStructure);
MyHighlightedStructure.Remove (AStructure);
MyPickStructure.Remove (AStructure);
}
void Visual3d_ViewManager::Erase () {
@@ -326,35 +280,26 @@ void Visual3d_ViewManager::Erase () {
}
void Visual3d_ViewManager::Highlight (const Handle(Graphic3d_Structure)& AStructure, const Aspect_TypeOfHighlightMethod AMethod) {
void Visual3d_ViewManager::Highlight (const Handle(Graphic3d_Structure)& AStructure, const Aspect_TypeOfHighlightMethod AMethod)
{
MyHighlightedStructure.Add(AStructure);
//
// Highlight in all activated views
//
Visual3d_SetIteratorOfSetOfView MyIterator(MyDefinedView);
while (MyIterator.More ()) {
(MyIterator.Value ())->Highlight (AStructure, AMethod);
// MyIterator.Next () is located on the next view
MyIterator.Next ();
}
//
// Highlight in all activated views
//
for(int i=1; i<=MyDefinedView.Length(); i++)
{
(MyDefinedView.Value(i))->Highlight (AStructure, AMethod);
}
}
void Visual3d_ViewManager::SetTransform (const Handle(Graphic3d_Structure)& AStructure, const TColStd_Array2OfReal& ATrsf) {
Visual3d_SetIteratorOfSetOfView MyIterator(MyDefinedView);
while (MyIterator.More ()) {
(MyIterator.Value ())->SetTransform (AStructure, ATrsf);
// MyIterator.Next () is located on the next view
MyIterator.Next ();
}
void Visual3d_ViewManager::SetTransform (const Handle(Graphic3d_Structure)& AStructure, const TColStd_Array2OfReal& ATrsf)
{
for(int i=1; i<=MyDefinedView.Length(); i++)
{
(MyDefinedView.Value(i))->SetTransform (AStructure, ATrsf);
}
}
void Visual3d_ViewManager::UnHighlight () {
@@ -369,29 +314,24 @@ void Visual3d_ViewManager::UnHighlight () {
}
void Visual3d_ViewManager::UnHighlight (const Handle(Graphic3d_Structure)& AStructure) {
void Visual3d_ViewManager::UnHighlight (const Handle(Graphic3d_Structure)& AStructure)
{
MyHighlightedStructure.Remove(AStructure);
//
// UnHighlight in all activated views
//
//
// UnHighlight in all activated views
//
Visual3d_SetIteratorOfSetOfView MyIterator(MyDefinedView);
while (MyIterator.More ()) {
(MyIterator.Value ())->UnHighlight (AStructure);
// MyIterator.Next () is located on the next view
MyIterator.Next ();
}
for(int i=1; i<=MyDefinedView.Length(); i++)
{
(MyDefinedView.Value(i))->UnHighlight (AStructure);
}
}
void Visual3d_ViewManager::Redraw() const
{
// redraw all activated views
if (MyDefinedView.Extent() == 0)
if (MyDefinedView.Length() == 0)
{
return;
}
@@ -401,13 +341,14 @@ void Visual3d_ViewManager::Redraw() const
Standard_Integer aWidth = 0, aHeight = 0;
Standard_Integer aWidthMax = 0;
Standard_Integer aHeightMax = 0;
for (Visual3d_SetIteratorOfSetOfView anIter (MyDefinedView);
anIter.More(); anIter.Next())
for(int i=1; i<=MyDefinedView.Length(); i++)
{
anIter.Value()->Window()->Size (aWidth, aHeight);
MyDefinedView.Value(i)->Window()->Size (aWidth, aHeight);
aWidthMax = Max (aWidthMax, aWidth);
aHeightMax = Max (aHeightMax, aWidth);
}
if (!MyUnderLayer.IsNull())
{
MyUnderLayer->SetViewport (aWidthMax, aHeightMax);
@@ -418,11 +359,10 @@ void Visual3d_ViewManager::Redraw() const
}
}
for (Visual3d_SetIteratorOfSetOfView anIter (MyDefinedView);
anIter.More(); anIter.Next())
for(int i=1; i<=MyDefinedView.Length(); i++)
{
anIter.Value()->Redraw (MyUnderLayer, MyOverLayer);
}
MyDefinedView.Value(i)->Redraw (MyUnderLayer, MyOverLayer);
}
}
void Visual3d_ViewManager::Update() const
@@ -432,101 +372,86 @@ void Visual3d_ViewManager::Update() const
void Visual3d_ViewManager::RedrawImmediate() const
{
if (MyDefinedView.Extent() == 0)
if (MyDefinedView.Length() == 0)
{
return;
}
// update all activated views
for (Visual3d_SetIteratorOfSetOfView anIter (MyDefinedView);
anIter.More(); anIter.Next())
for(int i=1; i<=MyDefinedView.Length(); i++)
{
anIter.Value()->RedrawImmediate (MyUnderLayer, MyOverLayer);
MyDefinedView.Value(i)->RedrawImmediate (MyUnderLayer, MyOverLayer);
}
}
void Visual3d_ViewManager::Invalidate() const
{
if (MyDefinedView.Extent() == 0)
if (MyDefinedView.Length() == 0)
{
return;
}
// update all activated views
for (Visual3d_SetIteratorOfSetOfView anIter (MyDefinedView);
anIter.More(); anIter.Next())
for(int i=1; i<=MyDefinedView.Length(); i++)
{
anIter.Value()->Invalidate();
MyDefinedView.Value(i)->Invalidate();
}
}
Handle(Visual3d_HSetOfView) Visual3d_ViewManager::ActivatedView () const {
Handle(Visual3d_HSequenceOfView) Visual3d_ViewManager::ActivatedView () const
{
Handle (Visual3d_HSetOfView) SG = new Visual3d_HSetOfView ();
Handle(Visual3d_HSequenceOfView) SG = new Visual3d_HSequenceOfView();
Visual3d_SetIteratorOfSetOfView MyIterator(MyDefinedView);
while (MyIterator.More ()) {
if ((MyIterator.Value ())->IsActive ())
SG->Add (MyIterator.Value ());
// MyIterator.Next () is located on the next view
MyIterator.Next ();
}
return (SG);
for(int i=1; i<=MyDefinedView.Length(); i++)
{
if ((MyDefinedView.Value(i))->IsActive ())
{
SG->Append(MyDefinedView.Value(i));
}
}
return (SG);
}
#ifdef IMPLEMENTED
Standard_Boolean Visual3d_ViewManager::ContainsComputedStructure () const {
Standard_Boolean Visual3d_ViewManager::ContainsComputedStructure () const
{
Standard_Boolean Result = Standard_False;
Standard_Boolean Result = Standard_False;
//
// Check all activated views
//
for(int i=1; (!Result) && i<=MyDefinedView.Length(); i++)
{
if ((MyDefinedView.Value(i))->IsActive())
{
Result = (MyDefinedView.Value(i))->ContainsComputedStructure();
}
}
//
// Check all activated views
//
Visual3d_SetIteratorOfSetOfView MyIterator(MyDefinedView);
Standard_Integer i = MyDefinedView.Extent ();
while ((! Result) && (MyIterator.More ())) {
if ((MyIterator.Value ())->IsActive ())
Result =
(MyIterator.Value ())->ContainsComputedStructure ();
// MyIterator.Next () is located on the next view
MyIterator.Next ();
}
return Result;
return Result;
}
#endif
Handle(Visual3d_HSetOfView) Visual3d_ViewManager::DefinedView () const {
Handle(Visual3d_HSequenceOfView) Visual3d_ViewManager::DefinedView () const
{
Handle (Visual3d_HSequenceOfView) SG = new Visual3d_HSequenceOfView();
Handle (Visual3d_HSetOfView) SG = new Visual3d_HSetOfView ();
Visual3d_SetIteratorOfSetOfView MyIterator(MyDefinedView);
while (MyIterator.More ()) {
SG->Add (MyIterator.Value ());
// MyIterator.Next () is located on the next view
MyIterator.Next ();
}
return (SG);
for(int i=1; i<=MyDefinedView.Length(); i++)
{
SG->Append(MyDefinedView.Value(i));
}
return (SG);
}
Standard_Boolean Visual3d_ViewManager::ViewExists (const Handle(Aspect_Window)& AWindow, Graphic3d_CView& TheCView) const {
Standard_Boolean Visual3d_ViewManager::ViewExists (const Handle(Aspect_Window)& AWindow, Graphic3d_CView& TheCView) const
{
Standard_Boolean Exist = Standard_False;
Standard_Boolean Exist = Standard_False;
// Parse the list of views to find
// a view with the specified window
Visual3d_SetIteratorOfSetOfView MyIterator(MyDefinedView);
// Parse the list of views to find
// a view with the specified window
#if defined(_WIN32) || defined(__WIN32__)
const Handle(WNT_Window) THEWindow = Handle(WNT_Window)::DownCast (AWindow);
@@ -539,68 +464,60 @@ Standard_Boolean Exist = Standard_False;
int TheSpecifiedWindowId = int (THEWindow->XWindow ());
#endif
while ((! Exist) && (MyIterator.More ())) {
for(int i=1; (!Exist) && i<=MyDefinedView.Length(); i++)
{
if ( ((MyDefinedView.Value(i))->IsDefined ()) && ((MyDefinedView.Value(i))->IsActive ()) )
{
const Handle(Aspect_Window) AspectWindow = (MyDefinedView.Value(i))->Window();
if ( ((MyIterator.Value ())->IsDefined ()) &&
((MyIterator.Value ())->IsActive ()) ) {
const Handle(Aspect_Window) AspectWindow = (MyIterator.Value ())->Window ();
#if defined(_WIN32) || defined(__WIN32__)
const Handle(WNT_Window) theWindow = Handle(WNT_Window)::DownCast (AspectWindow);
Aspect_Handle TheWindowIdOfView = theWindow->HWindow ();
const Handle(WNT_Window) theWindow = Handle(WNT_Window)::DownCast (AspectWindow);
Aspect_Handle TheWindowIdOfView = theWindow->HWindow ();
#elif defined(__APPLE__) && !defined(MACOSX_USE_GLX)
const Handle(Cocoa_Window) theWindow = Handle(Cocoa_Window)::DownCast (AspectWindow);
NSView* TheWindowIdOfView = theWindow->HView();
const Handle(Cocoa_Window) theWindow = Handle(Cocoa_Window)::DownCast (AspectWindow);
NSView* TheWindowIdOfView = theWindow->HView();
#else
const Handle(Xw_Window) theWindow = Handle(Xw_Window)::DownCast (AspectWindow);
int TheWindowIdOfView = int (theWindow->XWindow ());
const Handle(Xw_Window) theWindow = Handle(Xw_Window)::DownCast (AspectWindow);
int TheWindowIdOfView = int (theWindow->XWindow ());
#endif // WNT
// Comparaison on window IDs
if (TheWindowIdOfView == TheSpecifiedWindowId) {
Exist = Standard_True;
TheCView = *(Graphic3d_CView* )(MyIterator.Value())->CView();
}
} /* if ((MyIterator.Value ())->IsDefined ()) */
// MyIterator.Next () is located on the next view
MyIterator.Next ();
}
return (Exist);
// Comparaison on window IDs
if (TheWindowIdOfView == TheSpecifiedWindowId)
{
Exist = Standard_True;
TheCView = *(Graphic3d_CView* )(MyDefinedView.Value(i))->CView();
}
}
}
return (Exist);
}
void Visual3d_ViewManager::Activate () {
//
// Activates all deactivated views
//
Visual3d_SetIteratorOfSetOfView MyIterator(MyDefinedView);
while (MyIterator.More ()) {
if (! (MyIterator.Value ())->IsActive ())
(MyIterator.Value ())->Activate ();
// MyIterator.Next () is located on the next view
MyIterator.Next ();
}
void Visual3d_ViewManager::Activate ()
{
//
// Activates all deactivated views
//
for(int i=1; i<=MyDefinedView.Length(); i++)
{
if (! (MyDefinedView.Value(i))->IsActive())
{
(MyDefinedView.Value(i))->Activate();
}
}
}
void Visual3d_ViewManager::Deactivate () {
//
// Deactivates all activated views
//
Visual3d_SetIteratorOfSetOfView MyIterator(MyDefinedView);
while (MyIterator.More ()) {
if ((MyIterator.Value ())->IsActive ())
(MyIterator.Value ())->Deactivate ();
// MyIterator.Next () is located on the next view
MyIterator.Next ();
}
void Visual3d_ViewManager::Deactivate ()
{
//
// Deactivates all activated views
//
for(int i=1; i<=MyDefinedView.Length(); i++)
{
if ((MyDefinedView.Value(i))->IsActive())
{
(MyDefinedView.Value(i))->Deactivate();
}
}
}
@@ -625,82 +542,71 @@ Standard_Integer Visual3d_ViewManager::Identification () const {
}
Standard_Integer Visual3d_ViewManager::Identification (const Handle(Visual3d_View)& AView) {
MyDefinedView.Add (AView);
return (MyViewGenId.Next ());
Standard_Integer Visual3d_ViewManager::Identification (const Handle(Visual3d_View)& AView)
{
MyDefinedView.Append(AView);
return (MyViewGenId.Next ());
}
void Visual3d_ViewManager::UnIdentification (const Standard_Integer aViewId)
{
Visual3d_SetIteratorOfSetOfView MyIterator(MyDefinedView);
while (MyIterator.More())
for(int i=1; i<=MyDefinedView.Length(); i++)
{
if ((MyIterator.Value())->Identification () == aViewId)
if ((MyDefinedView.Value(i))->Identification() == aViewId)
{
const Handle(Visual3d_View)& theView = MyIterator.Value();
//remove the view from the list
MyDefinedView.Remove(theView);
MyDefinedView.Remove(i);
break;
}
// go to next
MyIterator.Next ();
}
MyViewGenId.Free(aViewId);
}
void Visual3d_ViewManager::SetTransparency (const Standard_Boolean AFlag) {
void Visual3d_ViewManager::SetTransparency (const Standard_Boolean AFlag)
{
if (MyTransparency && AFlag) return;
if (! MyTransparency && ! AFlag) return;
if (MyTransparency && AFlag) return;
if (! MyTransparency && ! AFlag) return;
Visual3d_SetIteratorOfSetOfView MyIterator(MyDefinedView);
while (MyIterator.More ()) {
(MyIterator.Value ())->SetTransparency (AFlag);
// MyIterator.Next () is located on the next view
MyIterator.Next ();
}
MyTransparency = AFlag;
for(int i=1; i<=MyDefinedView.Length(); i++)
{
(MyDefinedView.Value(i))->SetTransparency(AFlag);
}
MyTransparency = AFlag;
}
Standard_Boolean Visual3d_ViewManager::Transparency () const {
return (MyTransparency);
Standard_Boolean Visual3d_ViewManager::Transparency () const
{
return (MyTransparency);
}
void Visual3d_ViewManager::SetZBufferAuto (const Standard_Boolean AFlag) {
if (MyZBufferAuto && AFlag) return;
if (! MyZBufferAuto && ! AFlag) return;
// if pass from False to True :
// no problem, at the next view update, it
// will properly ask questions to answer (SetVisualisation)
// if pass from True to False :
// it is necessary to modify ZBufferActivity at each view so that
// zbuffer could be active only if required by context.
// In this case -1 is passed so that the view ask itself the question
// Note : 0 forces the desactivation, 1 forces the activation
if (! AFlag) {
Visual3d_SetIteratorOfSetOfView MyIterator(MyDefinedView);
while (MyIterator.More ()) {
(MyIterator.Value ())->SetZBufferActivity (-1);
// MyIterator.Next () is located on the next view
MyIterator.Next ();
}
}
MyZBufferAuto = AFlag;
void Visual3d_ViewManager::SetZBufferAuto (const Standard_Boolean AFlag)
{
if (MyZBufferAuto && AFlag) return;
if (! MyZBufferAuto && ! AFlag) return;
// if pass from False to True :
// no problem, at the next view update, it
// will properly ask questions to answer (SetVisualisation)
// if pass from True to False :
// it is necessary to modify ZBufferActivity at each view so that
// zbuffer could be active only if required by context.
// In this case -1 is passed so that the view ask itself the question
// Note : 0 forces the desactivation, 1 forces the activation
if (! AFlag)
{
for(int i=1; i<=MyDefinedView.Length(); i++)
{
(MyDefinedView.Value(i))->SetZBufferActivity(-1);
}
}
MyZBufferAuto = AFlag;
}
Standard_Boolean Visual3d_ViewManager::ZBufferAuto () const {
return (MyZBufferAuto);
Standard_Boolean Visual3d_ViewManager::ZBufferAuto () const
{
return (MyZBufferAuto);
}
void Visual3d_ViewManager::SetLayer (const Handle(Visual3d_Layer)& ALayer) {
@@ -756,9 +662,10 @@ void Visual3d_ViewManager::ChangeZLayer (const Handle(Graphic3d_Structure)& theS
// change display layer for structure in all views
if (MyDisplayedStructure.Contains (theStructure))
{
Visual3d_SetIteratorOfSetOfView aViewIt(MyDefinedView);
for ( ; aViewIt.More (); aViewIt.Next ())
(aViewIt.Value ())->ChangeZLayer (theStructure, theLayerId);
for(int i=1; i<=MyDefinedView.Length(); i++)
{
(MyDefinedView.Value(i))->ChangeZLayer(theStructure, theLayerId);
}
}
// tell graphic driver to update the structure's display layer
@@ -783,10 +690,9 @@ void Visual3d_ViewManager::SetZLayerSettings (const Standard_Integer theLayerId,
const Graphic3d_ZLayerSettings& theSettings)
{
// tell all managed views to set zlayer settings
Visual3d_SetIteratorOfSetOfView aViewIt (MyDefinedView);
for (; aViewIt.More (); aViewIt.Next ())
for(int i=1; i<=MyDefinedView.Length(); i++)
{
(aViewIt.Value ())->SetZLayerSettings (theLayerId, theSettings);
(MyDefinedView.Value(i))->SetZLayerSettings (theLayerId, theSettings);
}
if (myMapOfZLayerSettings.IsBound (theLayerId))
@@ -838,9 +744,10 @@ Standard_Boolean Visual3d_ViewManager::AddZLayer (Standard_Integer& theLayerId)
myMapOfZLayerSettings.Bind (theLayerId, Graphic3d_ZLayerSettings());
// tell all managed views to remove display layers
Visual3d_SetIteratorOfSetOfView aViewIt(MyDefinedView);
for ( ; aViewIt.More (); aViewIt.Next ())
(aViewIt.Value ())->AddZLayer (theLayerId);
for(int i=1; i<=MyDefinedView.Length(); i++)
{
(MyDefinedView.Value(i))->AddZLayer(theLayerId);
}
return Standard_True;
}
@@ -856,9 +763,10 @@ Standard_Boolean Visual3d_ViewManager::RemoveZLayer (const Standard_Integer theL
return Standard_False;
// tell all managed views to remove display layers
Visual3d_SetIteratorOfSetOfView aViewIt (MyDefinedView);
for ( ; aViewIt.More (); aViewIt.Next ())
(aViewIt.Value ())->RemoveZLayer (theLayerId);
for(int i=1; i<=MyDefinedView.Length(); i++)
{
(MyDefinedView.Value(i))->RemoveZLayer (theLayerId);
}
MyGraphicDriver->UnsetZLayer (theLayerId);
@@ -908,7 +816,16 @@ Aspect_GenId& Visual3d_ViewManager::getZLayerGenId ()
void Visual3d_ViewManager::InstallZLayers(const Handle(Visual3d_View)& theView) const
{
if (!MyDefinedView.Contains (theView))
Standard_Boolean isContainsView = Standard_False;
for(int i=1; i<=MyDefinedView.Length(); i++)
{
if(MyDefinedView.Value(i) == theView)
{
isContainsView = Standard_True;
break;
}
}
if (!isContainsView)
return;
// erase and insert layers iteratively to provide the same layer order as