b311480e |
1 | // Created by: CKY / Contract Toubro-Larsen |
2 | // Copyright (c) 1993-1999 Matra Datavision |
973c2be1 |
3 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
4 | // |
973c2be1 |
5 | // This file is part of Open CASCADE Technology software library. |
7fd59977 |
6 | // |
973c2be1 |
7 | // This library is free software; you can redistribute it and / or modify it |
8 | // under the terms of the GNU Lesser General Public 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. |
7fd59977 |
12 | // |
973c2be1 |
13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. |
b311480e |
15 | |
16 | //-------------------------------------------------------------------- |
7fd59977 |
17 | //-------------------------------------------------------------------- |
18 | |
19 | #include <IGESDimen_Section.ixx> |
20 | #include <Standard_DimensionMismatch.hxx> |
21 | #include <Standard_OutOfRange.hxx> |
22 | #include <IGESData_LineFontEntity.hxx> |
23 | #include <gp_GTrsf.hxx> |
24 | |
25 | |
b311480e |
26 | IGESDimen_Section::IGESDimen_Section () { } |
7fd59977 |
27 | |
28 | |
29 | void IGESDimen_Section::Init |
30 | (const Standard_Integer dataType, const Standard_Real aDisp, |
31 | const Handle(TColgp_HArray1OfXY)& dataPoints) |
32 | { |
33 | if (dataPoints->Lower() != 1) |
34 | Standard_DimensionMismatch::Raise("IGESDimen_Section : Init"); |
35 | theDatatype = dataType; |
36 | theZDisplacement = aDisp; |
37 | theDataPoints = dataPoints; |
38 | InitTypeAndForm(106,FormNumber()); |
39 | // FormNumber precises the type of Hatches (31-38) |
40 | } |
41 | |
42 | |
43 | void IGESDimen_Section::SetFormNumber (const Standard_Integer form) |
44 | { |
45 | if (form < 31 || form > 38) Standard_OutOfRange::Raise |
46 | ("IGESDimen_Section : SetFormNumber"); |
47 | InitTypeAndForm(106,form); |
48 | } |
49 | |
50 | |
51 | Standard_Integer IGESDimen_Section::Datatype () const |
52 | { |
53 | return theDatatype; |
54 | } |
55 | |
56 | Standard_Integer IGESDimen_Section::NbPoints () const |
57 | { |
58 | return theDataPoints->Length(); |
59 | } |
60 | |
61 | Standard_Real IGESDimen_Section::ZDisplacement () const |
62 | { |
63 | return theZDisplacement; |
64 | } |
65 | |
66 | gp_Pnt IGESDimen_Section::Point (const Standard_Integer Index) const |
67 | { |
68 | gp_XY tempXY = theDataPoints->Value(Index); |
69 | gp_Pnt point(tempXY.X(), tempXY.Y(), theZDisplacement); |
70 | return point; |
71 | } |
72 | |
73 | gp_Pnt IGESDimen_Section::TransformedPoint (const Standard_Integer Index) const |
74 | { |
75 | gp_XY point2d = theDataPoints->Value(Index); |
76 | gp_XYZ point(point2d.X(), point2d.Y(), theZDisplacement); |
77 | if (HasTransf()) Location().Transforms(point); |
78 | return gp_Pnt(point); |
79 | } |