summaryrefslogtreecommitdiff
path: root/src/IGESDimen/IGESDimen_LeaderArrow.cxx
blob: 4b212d2074b6608ffeb9b5dd5b5ced0af1728a91 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
//--------------------------------------------------------------------
//
//  File Name : IGESDimen_LeaderArrow.cxx
//  Date      :
//  Author    : CKY / Contract Toubro-Larsen
//  Copyright : MATRA-DATAVISION 1993
//
//--------------------------------------------------------------------

#include <IGESDimen_LeaderArrow.ixx>
#include <Standard_DimensionMismatch.hxx>
#include <Standard_OutOfRange.hxx>
#include <gp_GTrsf.hxx>


    IGESDimen_LeaderArrow::IGESDimen_LeaderArrow ()    {  }

    void  IGESDimen_LeaderArrow::Init
  (const Standard_Real height, const Standard_Real width,
   const Standard_Real depth,  const gp_XY&        position,
   const Handle(TColgp_HArray1OfXY)& segments)
{
  if (segments->Lower() != 1)
    Standard_DimensionMismatch::Raise("IGESDimen_LeaderArrow : Init");
  theArrowHeadHeight = height;
  theArrowHeadWidth  = width;
  theZDepth          = depth ;
  theArrowHead       = position;
  theSegmentTails    = segments;
  InitTypeAndForm(214,FormNumber());
// FormNumber precises the Type of the Arrow (1-12)
}

    void  IGESDimen_LeaderArrow::SetFormNumber (const Standard_Integer form)
{
  if (form < 1 || form > 12) Standard_OutOfRange::Raise
    ("IGESDimen_LeaderArrow : SetFormNumber");
  InitTypeAndForm(214,form);
}

    Standard_Integer  IGESDimen_LeaderArrow::NbSegments () const 
{
  return theSegmentTails->Length();
}

    Standard_Real  IGESDimen_LeaderArrow::ArrowHeadHeight () const 
{
  return theArrowHeadHeight;
}

    Standard_Real  IGESDimen_LeaderArrow::ArrowHeadWidth () const 
{
  return theArrowHeadWidth;
}

    Standard_Real  IGESDimen_LeaderArrow::ZDepth () const 
{
  return theZDepth;
}

    gp_Pnt2d  IGESDimen_LeaderArrow::ArrowHead () const 
{
  gp_Pnt2d AHPnt2d(theArrowHead);
  return AHPnt2d;
}

    gp_Pnt  IGESDimen_LeaderArrow::TransformedArrowHead () const 
{
  gp_XYZ point(theArrowHead.X(), theArrowHead.Y(), ZDepth());
  if (HasTransf()) Location().Transforms(point);
  return gp_Pnt(point);
}

    gp_Pnt2d  IGESDimen_LeaderArrow::SegmentTail
  (const Standard_Integer Index) const 
{
  gp_Pnt2d STPnt2d(theSegmentTails->Value(Index));
  return STPnt2d;
}

    gp_Pnt  IGESDimen_LeaderArrow::TransformedSegmentTail
  (const Standard_Integer Index) const 
{
  gp_XY point2d = theSegmentTails->Value(Index);
  gp_XYZ point(point2d.X(), point2d.Y(), ZDepth());
  if (HasTransf()) Location().Transforms(point);
  return gp_Pnt(point);
}