summaryrefslogtreecommitdiff
path: root/src/StepGeom/StepGeom_CartesianPoint.cxx
blob: 5ad77e36be0d84bd249ec23418e00fb9950cac91 (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
#include <StepGeom_CartesianPoint.ixx>


StepGeom_CartesianPoint::StepGeom_CartesianPoint ()  {}

void StepGeom_CartesianPoint::Init(
	const Handle(TCollection_HAsciiString)& aName)
{

	StepRepr_RepresentationItem::Init(aName);
}

void StepGeom_CartesianPoint::Init(
	const Handle(TCollection_HAsciiString)& aName,
	const Handle(TColStd_HArray1OfReal)& aCoordinates)
{
	// --- classe own fields ---
  nbcoord = aCoordinates->Length();
  coords[0] = aCoordinates->Value(1);
  coords[1] = aCoordinates->Value(2);
  coords[2] = aCoordinates->Value(3);
//	coordinates = aCoordinates;
	// --- classe inherited fields ---
	StepRepr_RepresentationItem::Init(aName);
}

void StepGeom_CartesianPoint::Init2D(
	const Handle(TCollection_HAsciiString)& aName,
        const Standard_Real X, const Standard_Real Y)
{
  nbcoord = 2;
  coords[0] = X;
  coords[1] = Y;
	// --- classe inherited fields ---
	StepRepr_RepresentationItem::Init(aName);
}

void StepGeom_CartesianPoint::Init3D(
	const Handle(TCollection_HAsciiString)& aName,
        const Standard_Real X, const Standard_Real Y, const Standard_Real Z)
{
  nbcoord = 3;
  coords[0] = X;
  coords[1] = Y;
  coords[2] = Z;
	// --- classe inherited fields ---
	StepRepr_RepresentationItem::Init(aName);
}

void StepGeom_CartesianPoint::SetCoordinates(const Handle(TColStd_HArray1OfReal)& aCoordinates)
{
  nbcoord = aCoordinates->Length();
  coords[0] = aCoordinates->Value(1);
  coords[1] = aCoordinates->Value(2);
  coords[2] = aCoordinates->Value(3);
//	coordinates = aCoordinates;
}

Handle(TColStd_HArray1OfReal) StepGeom_CartesianPoint::Coordinates() const
{
  Handle(TColStd_HArray1OfReal)  coordinates = new TColStd_HArray1OfReal(1,nbcoord);
  coordinates->SetValue(1,coords[0]);
  coordinates->SetValue(2,coords[1]);
  coordinates->SetValue(3,coords[2]);
	return coordinates;
}

Standard_Real StepGeom_CartesianPoint::CoordinatesValue(const Standard_Integer num) const
{
  return coords[num-1];
//	return coordinates->Value(num);
}

Standard_Integer StepGeom_CartesianPoint::NbCoordinates () const
{
  return nbcoord;
//	return coordinates->Length();
}