// Created by: NW,JPB,CAL // Copyright (c) 1991-1999 Matra Datavision // Copyright (c) 1999-2012 OPEN CASCADE SAS // // The content of this file is subject to the Open CASCADE Technology Public // License Version 6.5 (the "License"). You may not use the content of this file // except in compliance with the License. Please obtain a copy of the License // at http://www.opencascade.org and read it completely before using this file. // // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. // // The Original Code and all software distributed under the License is // distributed on an "AS IS" basis, without warranty of any kind, and the // Initial Developer hereby disclaims all such warranties, including without // limitation, any warranties of merchantability, fitness for a particular // purpose or non-infringement. Please see the License for the specific terms // and conditions governing the rights and limitations under the License. #define XTRACE //-Version //-Design Declaration of variables specific to managers //-Warning Manager manages a set of structures //-References //-Language C++ 2.0 //-Declarations // for the class #include #include static Standard_Boolean Initialisation = Standard_True; static int StructureManager_ArrayId[StructureManager_MAX]; static Standard_Integer StructureManager_CurrentId = 0; #include #include //-Aliases //-Global data definitions // -- l'identifieur du manager // MyId : Standard_Integer; // -- le mode de mise a jour de l'affichage // MyUpdateMode : TypeOfUpdate; // -- les differents contextes de primitives // MyAspectLine3d : AspectLine3d; // MyAspectText3d : AspectText3d; // MyAspectMarker3d : AspectMarker3d; // MyAspectFillArea3d : AspectFillArea3d; // -- les structures affichees // MyDisplayedStructure : SequenceOfStructure; // -- les structures mises en evidence // MyHighlightedStructure : SequenceOfStructure; // -- les structures visibles // MyVisibleStructure : SequenceOfStructure; // -- les structures detectables // MyPickStructure : SequenceOfStructure; // -- le generateur d'identificateurs de structures // MyStructGenId : GenId; //-Constructors Graphic3d_StructureManager::Graphic3d_StructureManager (const Handle(Graphic3d_GraphicDriver)& theDriver): MyDisplayedStructure (), MyHighlightedStructure (), MyVisibleStructure (), MyPickStructure () { Standard_Real Coef; Standard_Integer i; Standard_Boolean NotFound = Standard_True; Standard_Integer Limit = Graphic3d_StructureManager::Limit (); /* Initialize PHIGS and start up */ if (Initialisation) { Initialisation = Standard_False; /* table to manage IDs of StructureManager */ for (i=0; iIsEmpty() || SG->IsInfinite ())) { SG->MinMaxValues (Xm, Ym, Zm, XM, YM, ZM); if (Xm < XMin) XMin = Xm; if (Ym < YMin) YMin = Ym; if (Zm < ZMin) ZMin = Zm; if (XM > XMax) XMax = XM; if (YM > YMax) YMax = YM; if (ZM > ZMax) ZMax = ZM; Flag = Standard_False; } } // If all structures are empty or infinite if (Flag) { XMin = YMin = ZMin = RF; XMax = YMax = ZMax = RL; } } Standard_Integer Graphic3d_StructureManager::NewIdentification () { Standard_Integer Id = MyStructGenId.Next (); #ifdef TRACE cout << "Graphic3d_StructureManager::NewIdentification " << Id << "\n"; cout << flush; #endif return Id; } Handle(Graphic3d_Structure) Graphic3d_StructureManager::Identification (const Standard_Integer AId) const { // Standard_Integer ind=0; Standard_Boolean notfound = Standard_True; Handle(Graphic3d_Structure) StructNull; Graphic3d_MapIteratorOfMapOfStructure it( MyDisplayedStructure); Handle(Graphic3d_Structure) SGfound; for (; it.More() && notfound; it.Next()) { Handle(Graphic3d_Structure) SG = it.Key(); if ( SG->Identification () == AId) { notfound = Standard_False; SGfound = SG; } } if (notfound) return (StructNull); else return (SGfound); } Standard_Integer Graphic3d_StructureManager::Identification () const { return (MyId); } Standard_Integer Graphic3d_StructureManager::Limit () { return (StructureManager_MAX); } Standard_Integer Graphic3d_StructureManager::CurrentId () { return (StructureManager_CurrentId); } const Handle(Graphic3d_GraphicDriver)& Graphic3d_StructureManager::GraphicDriver () const { return (MyGraphicDriver); }