0031642: Visualization - crash in Graphic3d_Structure::SetVisual() on redisplaying...
[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
92efcf78 19IMPLEMENT_STANDARD_RTTIEXT(StepGeom_CartesianPoint,StepGeom_Point)
20
7fd59977 21StepGeom_CartesianPoint::StepGeom_CartesianPoint () {}
22
7fd59977 23void StepGeom_CartesianPoint::Init(
24 const Handle(TCollection_HAsciiString)& aName,
25 const Handle(TColStd_HArray1OfReal)& aCoordinates)
26{
27 // --- classe own fields ---
28 nbcoord = aCoordinates->Length();
29 coords[0] = aCoordinates->Value(1);
30 coords[1] = aCoordinates->Value(2);
31 coords[2] = aCoordinates->Value(3);
32// coordinates = aCoordinates;
33 // --- classe inherited fields ---
34 StepRepr_RepresentationItem::Init(aName);
35}
36
37void StepGeom_CartesianPoint::Init2D(
38 const Handle(TCollection_HAsciiString)& aName,
39 const Standard_Real X, const Standard_Real Y)
40{
41 nbcoord = 2;
42 coords[0] = X;
43 coords[1] = Y;
44 // --- classe inherited fields ---
45 StepRepr_RepresentationItem::Init(aName);
46}
47
48void StepGeom_CartesianPoint::Init3D(
49 const Handle(TCollection_HAsciiString)& aName,
50 const Standard_Real X, const Standard_Real Y, const Standard_Real Z)
51{
52 nbcoord = 3;
53 coords[0] = X;
54 coords[1] = Y;
55 coords[2] = Z;
56 // --- classe inherited fields ---
57 StepRepr_RepresentationItem::Init(aName);
58}
59
60void StepGeom_CartesianPoint::SetCoordinates(const Handle(TColStd_HArray1OfReal)& aCoordinates)
61{
62 nbcoord = aCoordinates->Length();
63 coords[0] = aCoordinates->Value(1);
64 coords[1] = aCoordinates->Value(2);
65 coords[2] = aCoordinates->Value(3);
66// coordinates = aCoordinates;
67}
68
69Handle(TColStd_HArray1OfReal) StepGeom_CartesianPoint::Coordinates() const
70{
71 Handle(TColStd_HArray1OfReal) coordinates = new TColStd_HArray1OfReal(1,nbcoord);
72 coordinates->SetValue(1,coords[0]);
73 coordinates->SetValue(2,coords[1]);
74 coordinates->SetValue(3,coords[2]);
75 return coordinates;
76}
77
78Standard_Real StepGeom_CartesianPoint::CoordinatesValue(const Standard_Integer num) const
79{
80 return coords[num-1];
81// return coordinates->Value(num);
82}
83
84Standard_Integer StepGeom_CartesianPoint::NbCoordinates () const
85{
86 return nbcoord;
87// return coordinates->Length();
88}