7fd59977 |
1 | //-------------------------------------------------------------------- |
2 | // |
3 | // File Name : IGESDimen_CenterLine.cxx |
4 | // Date : |
5 | // Author : CKY / Contract Toubro-Larsen |
6 | // Copyright : MATRA-DATAVISION 1993 |
7 | // |
8 | //-------------------------------------------------------------------- |
9 | |
10 | #include <IGESDimen_CenterLine.ixx> |
11 | #include <Standard_DimensionMismatch.hxx> |
12 | #include <IGESData_LineFontEntity.hxx> |
13 | #include <gp_GTrsf.hxx> |
14 | |
15 | |
16 | IGESDimen_CenterLine::IGESDimen_CenterLine () { } |
17 | |
18 | |
19 | void IGESDimen_CenterLine::Init |
20 | (const Standard_Integer aDataType, |
21 | const Standard_Real aZdisp, |
22 | const Handle(TColgp_HArray1OfXY)& dataPnts) |
23 | { |
24 | if (dataPnts->Lower() != 1) |
25 | Standard_DimensionMismatch::Raise("IGESDimen_CenterLine : Init"); |
26 | theDatatype = aDataType; |
27 | theZDisplacement = aZdisp; |
28 | theDataPoints = dataPnts; |
29 | InitTypeAndForm(106,FormNumber()); |
30 | // FormNumber : 20:points, 21:centres cercles |
31 | } |
32 | |
33 | void IGESDimen_CenterLine::SetCrossHair (const Standard_Boolean mode) |
34 | { |
35 | InitTypeAndForm(106, (mode ? 20 : 21)); |
36 | } |
37 | |
38 | |
39 | Standard_Integer IGESDimen_CenterLine::Datatype () const |
40 | { |
41 | return theDatatype; |
42 | } |
43 | |
44 | Standard_Integer IGESDimen_CenterLine::NbPoints () const |
45 | { |
46 | return theDataPoints->Length(); |
47 | } |
48 | |
49 | Standard_Real IGESDimen_CenterLine::ZDisplacement () const |
50 | { |
51 | return theZDisplacement; |
52 | } |
53 | |
54 | gp_Pnt IGESDimen_CenterLine::Point (const Standard_Integer Index) const |
55 | { |
56 | gp_XY tempXY = theDataPoints->Value(Index); |
57 | gp_Pnt point(tempXY.X(), tempXY.Y(), theZDisplacement); |
58 | return point; |
59 | } |
60 | |
61 | gp_Pnt IGESDimen_CenterLine::TransformedPoint |
62 | (const Standard_Integer Index) const |
63 | { |
64 | gp_XY point2d = (theDataPoints->Value(Index)); |
65 | gp_XYZ point(point2d.X(), point2d.Y(), theZDisplacement); |
66 | if (HasTransf()) Location().Transforms(point); |
67 | return gp_Pnt(point); |
68 | } |
69 | |
70 | Standard_Boolean IGESDimen_CenterLine::IsCrossHair () const |
71 | { |
72 | return(FormNumber() == 20); |
73 | } |