0031687: Draw Harness, ViewerTest - extend command vrenderparams with option updating...
[occt.git] / src / IGESDimen / IGESDimen_SectionedArea.cxx
1 // Created by: CKY / Contract Toubro-Larsen
2 // Copyright (c) 1993-1999 Matra Datavision
3 // Copyright (c) 1999-2014 OPEN CASCADE SAS
4 //
5 // This file is part of Open CASCADE Technology software library.
6 //
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
12 //
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
15
16 //--------------------------------------------------------------------
17 //--------------------------------------------------------------------
18
19 #include <gp_GTrsf.hxx>
20 #include <gp_Pnt.hxx>
21 #include <gp_XYZ.hxx>
22 #include <IGESData_IGESEntity.hxx>
23 #include <IGESDimen_SectionedArea.hxx>
24 #include <Standard_DimensionMismatch.hxx>
25 #include <Standard_OutOfRange.hxx>
26 #include <Standard_Type.hxx>
27
28 IMPLEMENT_STANDARD_RTTIEXT(IGESDimen_SectionedArea,IGESData_IGESEntity)
29
30 IGESDimen_SectionedArea::IGESDimen_SectionedArea ()    {  }
31
32
33     void IGESDimen_SectionedArea::Init
34   (const Handle(IGESData_IGESEntity)& aCurve,
35    const Standard_Integer aPattern,
36    const gp_XYZ& aPoint,
37    const Standard_Real aDistance,
38    const Standard_Real anAngle,
39    const Handle(IGESData_HArray1OfIGESEntity)& someIslands)
40 {
41   if (!someIslands.IsNull())
42     if (someIslands->Lower() != 1)
43       throw Standard_DimensionMismatch("IGESDimen_SectionedArea : Init");
44   theExteriorCurve = aCurve;
45   thePattern       = aPattern;
46   thePassingPoint  = aPoint;
47   theDistance      = aDistance;
48   theAngle         = anAngle;
49   theIslandCurves  = someIslands;
50   InitTypeAndForm(230,FormNumber());
51 }
52
53     void IGESDimen_SectionedArea::SetInverted (const Standard_Boolean mode)
54 {
55   InitTypeAndForm (230, (mode ? 1 : 0));
56 }
57
58     Standard_Boolean IGESDimen_SectionedArea::IsInverted () const
59 {
60   return (FormNumber() != 0);
61 }
62
63
64     Handle(IGESData_IGESEntity) IGESDimen_SectionedArea::ExteriorCurve () const
65 {
66   return theExteriorCurve;
67 }
68
69     Standard_Integer IGESDimen_SectionedArea::Pattern () const
70 {
71   return thePattern;
72 }
73
74     gp_Pnt IGESDimen_SectionedArea::PassingPoint () const
75 {
76   return gp_Pnt(thePassingPoint);
77 }
78
79     gp_Pnt IGESDimen_SectionedArea::TransformedPassingPoint () const
80 {
81   gp_XYZ tmpXYZ(thePassingPoint);
82   if (HasTransf()) Location().Transforms(tmpXYZ);
83   return gp_Pnt(tmpXYZ);
84 }
85
86     Standard_Real IGESDimen_SectionedArea::ZDepth () const
87 {
88   return thePassingPoint.Z();
89 }
90
91     Standard_Real IGESDimen_SectionedArea::Distance () const
92 {
93   return theDistance;
94 }
95
96     Standard_Real IGESDimen_SectionedArea::Angle () const
97 {
98   return theAngle;
99 }
100
101     Standard_Integer IGESDimen_SectionedArea::NbIslands () const
102 {
103   return (theIslandCurves.IsNull() ? 0 : theIslandCurves->Length());
104 }
105
106     Handle(IGESData_IGESEntity) IGESDimen_SectionedArea::IslandCurve
107   (const Standard_Integer num) const
108 {
109   return  theIslandCurves->Value(num);
110 }