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 | |
42cf5bc1 |
19 | #include <gp_GTrsf.hxx> |
20 | #include <gp_Pnt.hxx> |
21 | #include <gp_Pnt2d.hxx> |
22 | #include <gp_XY.hxx> |
23 | #include <IGESDimen_LeaderArrow.hxx> |
7fd59977 |
24 | #include <Standard_DimensionMismatch.hxx> |
25 | #include <Standard_OutOfRange.hxx> |
42cf5bc1 |
26 | #include <Standard_Type.hxx> |
7fd59977 |
27 | |
92efcf78 |
28 | IMPLEMENT_STANDARD_RTTIEXT(IGESDimen_LeaderArrow,IGESData_IGESEntity) |
29 | |
b311480e |
30 | IGESDimen_LeaderArrow::IGESDimen_LeaderArrow () { } |
7fd59977 |
31 | |
32 | void IGESDimen_LeaderArrow::Init |
33 | (const Standard_Real height, const Standard_Real width, |
34 | const Standard_Real depth, const gp_XY& position, |
35 | const Handle(TColgp_HArray1OfXY)& segments) |
36 | { |
37 | if (segments->Lower() != 1) |
9775fa61 |
38 | throw Standard_DimensionMismatch("IGESDimen_LeaderArrow : Init"); |
7fd59977 |
39 | theArrowHeadHeight = height; |
40 | theArrowHeadWidth = width; |
41 | theZDepth = depth ; |
42 | theArrowHead = position; |
43 | theSegmentTails = segments; |
44 | InitTypeAndForm(214,FormNumber()); |
45 | // FormNumber precises the Type of the Arrow (1-12) |
46 | } |
47 | |
48 | void IGESDimen_LeaderArrow::SetFormNumber (const Standard_Integer form) |
49 | { |
9775fa61 |
50 | if (form < 1 || form > 12) throw Standard_OutOfRange("IGESDimen_LeaderArrow : SetFormNumber"); |
7fd59977 |
51 | InitTypeAndForm(214,form); |
52 | } |
53 | |
54 | Standard_Integer IGESDimen_LeaderArrow::NbSegments () const |
55 | { |
56 | return theSegmentTails->Length(); |
57 | } |
58 | |
59 | Standard_Real IGESDimen_LeaderArrow::ArrowHeadHeight () const |
60 | { |
61 | return theArrowHeadHeight; |
62 | } |
63 | |
64 | Standard_Real IGESDimen_LeaderArrow::ArrowHeadWidth () const |
65 | { |
66 | return theArrowHeadWidth; |
67 | } |
68 | |
69 | Standard_Real IGESDimen_LeaderArrow::ZDepth () const |
70 | { |
71 | return theZDepth; |
72 | } |
73 | |
74 | gp_Pnt2d IGESDimen_LeaderArrow::ArrowHead () const |
75 | { |
76 | gp_Pnt2d AHPnt2d(theArrowHead); |
77 | return AHPnt2d; |
78 | } |
79 | |
80 | gp_Pnt IGESDimen_LeaderArrow::TransformedArrowHead () const |
81 | { |
82 | gp_XYZ point(theArrowHead.X(), theArrowHead.Y(), ZDepth()); |
83 | if (HasTransf()) Location().Transforms(point); |
84 | return gp_Pnt(point); |
85 | } |
86 | |
87 | gp_Pnt2d IGESDimen_LeaderArrow::SegmentTail |
88 | (const Standard_Integer Index) const |
89 | { |
90 | gp_Pnt2d STPnt2d(theSegmentTails->Value(Index)); |
91 | return STPnt2d; |
92 | } |
93 | |
94 | gp_Pnt IGESDimen_LeaderArrow::TransformedSegmentTail |
95 | (const Standard_Integer Index) const |
96 | { |
97 | gp_XY point2d = theSegmentTails->Value(Index); |
98 | gp_XYZ point(point2d.X(), point2d.Y(), ZDepth()); |
99 | if (HasTransf()) Location().Transforms(point); |
100 | return gp_Pnt(point); |
101 | } |