1 // Created by: CKY / Contract Toubro-Larsen
2 // Copyright (c) 1993-1999 Matra Datavision
3 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
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.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 //--------------------------------------------------------------------
17 //--------------------------------------------------------------------
19 #include <gp_GTrsf.hxx>
21 #include <gp_Pnt2d.hxx>
23 #include <IGESDimen_LeaderArrow.hxx>
24 #include <Standard_DimensionMismatch.hxx>
25 #include <Standard_OutOfRange.hxx>
26 #include <Standard_Type.hxx>
28 IMPLEMENT_STANDARD_RTTIEXT(IGESDimen_LeaderArrow,IGESData_IGESEntity)
30 IGESDimen_LeaderArrow::IGESDimen_LeaderArrow () { }
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)
37 if (segments->Lower() != 1)
38 Standard_DimensionMismatch::Raise("IGESDimen_LeaderArrow : Init");
39 theArrowHeadHeight = height;
40 theArrowHeadWidth = width;
42 theArrowHead = position;
43 theSegmentTails = segments;
44 InitTypeAndForm(214,FormNumber());
45 // FormNumber precises the Type of the Arrow (1-12)
48 void IGESDimen_LeaderArrow::SetFormNumber (const Standard_Integer form)
50 if (form < 1 || form > 12) Standard_OutOfRange::Raise
51 ("IGESDimen_LeaderArrow : SetFormNumber");
52 InitTypeAndForm(214,form);
55 Standard_Integer IGESDimen_LeaderArrow::NbSegments () const
57 return theSegmentTails->Length();
60 Standard_Real IGESDimen_LeaderArrow::ArrowHeadHeight () const
62 return theArrowHeadHeight;
65 Standard_Real IGESDimen_LeaderArrow::ArrowHeadWidth () const
67 return theArrowHeadWidth;
70 Standard_Real IGESDimen_LeaderArrow::ZDepth () const
75 gp_Pnt2d IGESDimen_LeaderArrow::ArrowHead () const
77 gp_Pnt2d AHPnt2d(theArrowHead);
81 gp_Pnt IGESDimen_LeaderArrow::TransformedArrowHead () const
83 gp_XYZ point(theArrowHead.X(), theArrowHead.Y(), ZDepth());
84 if (HasTransf()) Location().Transforms(point);
88 gp_Pnt2d IGESDimen_LeaderArrow::SegmentTail
89 (const Standard_Integer Index) const
91 gp_Pnt2d STPnt2d(theSegmentTails->Value(Index));
95 gp_Pnt IGESDimen_LeaderArrow::TransformedSegmentTail
96 (const Standard_Integer Index) const
98 gp_XY point2d = theSegmentTails->Value(Index);
99 gp_XYZ point(point2d.X(), point2d.Y(), ZDepth());
100 if (HasTransf()) Location().Transforms(point);
101 return gp_Pnt(point);