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