0030480: Visualization - Clear of Select3D_SensitiveGroup does not update internal...
[occt.git] / src / Vrml / Vrml_LOD.cxx
CommitLineData
973c2be1 1// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 2//
973c2be1 3// This file is part of Open CASCADE Technology software library.
b311480e 4//
d5f74e42 5// This library is free software; you can redistribute it and/or modify it under
6// the terms of the GNU Lesser General Public License version 2.1 as published
973c2be1 7// by the Free Software Foundation, with special exception defined in the file
8// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9// distribution for complete text of the license and disclaimer of any warranty.
b311480e 10//
973c2be1 11// Alternatively, this file may be used under the terms of Open CASCADE
12// commercial license or contractual agreement.
b311480e 13
42cf5bc1 14
15#include <gp_Vec.hxx>
16#include <Standard_Type.hxx>
17#include <Vrml_LOD.hxx>
7fd59977 18
25e59720 19IMPLEMENT_STANDARD_RTTIEXT(Vrml_LOD,Standard_Transient)
92efcf78 20
7fd59977 21Vrml_LOD::Vrml_LOD()
22{
23 myRange = new TColStd_HArray1OfReal(1,1);
24 gp_Vec tmpVec(0,0,0);
25 myCenter = tmpVec;
26 myRangeFlag = Standard_False;
27}
28
29Vrml_LOD::Vrml_LOD(const Handle(TColStd_HArray1OfReal)& aRange,
30 const gp_Vec& aCenter)
31{
32 myRange = aRange;
33 myCenter = aCenter;
34 myRangeFlag = Standard_True;
35}
36
37 void Vrml_LOD::SetRange(const Handle(TColStd_HArray1OfReal)& aRange)
38{
39 myRange = aRange;
40 myRangeFlag = Standard_True;
41}
42
43 Handle(TColStd_HArray1OfReal) Vrml_LOD::Range() const
44{
45 return myRange;
46}
47
48 void Vrml_LOD::SetCenter(const gp_Vec& aCenter)
49{
50 myCenter = aCenter;
51}
52
53 gp_Vec Vrml_LOD::Center() const
54{
55 return myCenter;
56}
57
58 Standard_OStream& Vrml_LOD::Print(Standard_OStream& anOStream) const
59{
60 Standard_Integer i;
586db386 61 anOStream << "LOD {\n";
7fd59977 62
63 if ( myRangeFlag == Standard_True )
64 {
586db386 65 anOStream << " range [\n\t";
7fd59977 66 for ( i = myRange->Lower(); i <= myRange->Upper(); i++ )
67 {
68 anOStream << myRange->Value(i);
69 if ( i < myRange->Length() )
586db386 70 anOStream << ",";
7fd59977 71 }
586db386 72 anOStream << " ]\n";
7fd59977 73 }
74
75 if ( Abs(myCenter.X() - 0) > 0.0001 ||
76 Abs(myCenter.Y() - 0) > 0.0001 ||
77 Abs(myCenter.Z() - 0) > 0.0001 )
78 {
586db386 79 anOStream << " center\t";
80 anOStream << myCenter.X() << " " << myCenter.Y() << " " << myCenter.Z() << "\n";
7fd59977 81 }
82
586db386 83 anOStream << "}\n";
7fd59977 84 return anOStream;
85}