0024002: Overall code and build procedure refactoring -- automatic
[occt.git] / src / StepGeom / StepGeom_CartesianPoint.cxx
CommitLineData
973c2be1 1// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 2//
973c2be1 3// This file is part of Open CASCADE Technology software library.
b311480e 4//
d5f74e42 5// This library is free software; you can redistribute it and/or modify it under
6// the terms of the GNU Lesser General Public License version 2.1 as published
973c2be1 7// by the Free Software Foundation, with special exception defined in the file
8// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9// distribution for complete text of the license and disclaimer of any warranty.
b311480e 10//
973c2be1 11// Alternatively, this file may be used under the terms of Open CASCADE
12// commercial license or contractual agreement.
b311480e 13
7fd59977 14
42cf5bc1 15#include <Standard_Type.hxx>
16#include <StepGeom_CartesianPoint.hxx>
17#include <TCollection_HAsciiString.hxx>
7fd59977 18
19StepGeom_CartesianPoint::StepGeom_CartesianPoint () {}
20
21void StepGeom_CartesianPoint::Init(
22 const Handle(TCollection_HAsciiString)& aName)
23{
24
25 StepRepr_RepresentationItem::Init(aName);
26}
27
28void StepGeom_CartesianPoint::Init(
29 const Handle(TCollection_HAsciiString)& aName,
30 const Handle(TColStd_HArray1OfReal)& aCoordinates)
31{
32 // --- classe own fields ---
33 nbcoord = aCoordinates->Length();
34 coords[0] = aCoordinates->Value(1);
35 coords[1] = aCoordinates->Value(2);
36 coords[2] = aCoordinates->Value(3);
37// coordinates = aCoordinates;
38 // --- classe inherited fields ---
39 StepRepr_RepresentationItem::Init(aName);
40}
41
42void StepGeom_CartesianPoint::Init2D(
43 const Handle(TCollection_HAsciiString)& aName,
44 const Standard_Real X, const Standard_Real Y)
45{
46 nbcoord = 2;
47 coords[0] = X;
48 coords[1] = Y;
49 // --- classe inherited fields ---
50 StepRepr_RepresentationItem::Init(aName);
51}
52
53void StepGeom_CartesianPoint::Init3D(
54 const Handle(TCollection_HAsciiString)& aName,
55 const Standard_Real X, const Standard_Real Y, const Standard_Real Z)
56{
57 nbcoord = 3;
58 coords[0] = X;
59 coords[1] = Y;
60 coords[2] = Z;
61 // --- classe inherited fields ---
62 StepRepr_RepresentationItem::Init(aName);
63}
64
65void StepGeom_CartesianPoint::SetCoordinates(const Handle(TColStd_HArray1OfReal)& aCoordinates)
66{
67 nbcoord = aCoordinates->Length();
68 coords[0] = aCoordinates->Value(1);
69 coords[1] = aCoordinates->Value(2);
70 coords[2] = aCoordinates->Value(3);
71// coordinates = aCoordinates;
72}
73
74Handle(TColStd_HArray1OfReal) StepGeom_CartesianPoint::Coordinates() const
75{
76 Handle(TColStd_HArray1OfReal) coordinates = new TColStd_HArray1OfReal(1,nbcoord);
77 coordinates->SetValue(1,coords[0]);
78 coordinates->SetValue(2,coords[1]);
79 coordinates->SetValue(3,coords[2]);
80 return coordinates;
81}
82
83Standard_Real StepGeom_CartesianPoint::CoordinatesValue(const Standard_Integer num) const
84{
85 return coords[num-1];
86// return coordinates->Value(num);
87}
88
89Standard_Integer StepGeom_CartesianPoint::NbCoordinates () const
90{
91 return nbcoord;
92// return coordinates->Length();
93}