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 | // |
d5f74e42 |
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 |
973c2be1 |
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_WitnessLine.ixx> |
20 | #include <Standard_DimensionMismatch.hxx> |
21 | #include <IGESData_LineFontEntity.hxx> |
22 | #include <gp_GTrsf.hxx> |
23 | |
24 | |
b311480e |
25 | IGESDimen_WitnessLine::IGESDimen_WitnessLine () { } |
7fd59977 |
26 | |
27 | |
28 | void IGESDimen_WitnessLine::Init |
29 | (const Standard_Integer dataType, const Standard_Real aDisp, |
30 | const Handle(TColgp_HArray1OfXY)& dataPoints) |
31 | { |
32 | if (dataPoints->Lower() != 1) |
33 | Standard_DimensionMismatch::Raise("IGESDimen_WitnessLine : Init"); |
34 | theDatatype = dataType; |
35 | theZDisplacement = aDisp; |
36 | theDataPoints = dataPoints; |
37 | InitTypeAndForm(106,40); |
38 | } |
39 | |
40 | |
41 | Standard_Integer IGESDimen_WitnessLine::Datatype () const |
42 | { |
43 | return theDatatype; |
44 | } |
45 | |
46 | Standard_Integer IGESDimen_WitnessLine::NbPoints () const |
47 | { |
48 | return theDataPoints->Length(); |
49 | } |
50 | |
51 | Standard_Real IGESDimen_WitnessLine::ZDisplacement () const |
52 | { |
53 | return theZDisplacement; |
54 | } |
55 | |
56 | gp_Pnt IGESDimen_WitnessLine::Point (const Standard_Integer Index) const |
57 | { |
58 | gp_XY tempXY = theDataPoints->Value(Index); |
59 | gp_Pnt point(tempXY.X(), tempXY.Y(), theZDisplacement); |
60 | return point; |
61 | } |
62 | |
63 | gp_Pnt IGESDimen_WitnessLine::TransformedPoint |
64 | (const Standard_Integer Index) const |
65 | { |
66 | gp_XY point2d = theDataPoints->Value(Index); |
67 | gp_XYZ point(point2d.X(), point2d.Y(), theZDisplacement); |
68 | if (HasTransf()) Location().Transforms(point); |
69 | return gp_Pnt(point); |
70 | } |