Warnings on vc14 were eliminated
[occt.git] / src / IGESGeom / IGESGeom_TransformationMatrix.cxx
1 // Created by: CKY / Contract Toubro-Larsen
2 // Copyright (c) 1993-1999 Matra Datavision
3 // Copyright (c) 1999-2014 OPEN CASCADE SAS
4 //
5 // This file is part of Open CASCADE Technology software library.
6 //
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
12 //
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
15
16 //--------------------------------------------------------------------
17 //--------------------------------------------------------------------
18
19 #include <gp_GTrsf.hxx>
20 #include <IGESGeom_TransformationMatrix.hxx>
21 #include <Standard_DimensionMismatch.hxx>
22 #include <Standard_OutOfRange.hxx>
23 #include <Standard_Type.hxx>
24
25 IMPLEMENT_STANDARD_RTTIEXT(IGESGeom_TransformationMatrix,IGESData_TransfEntity)
26
27 IGESGeom_TransformationMatrix::IGESGeom_TransformationMatrix ()    {  }
28
29
30     void IGESGeom_TransformationMatrix::Init
31   (const Handle(TColStd_HArray2OfReal)& aMatrix)
32 {
33   if(aMatrix.IsNull()) {
34     theData = new TColStd_HArray2OfReal(1,3,1,4);
35     theData->Init(0.0);
36     Standard_Integer i =1;
37     for( ;i <=3; i++)
38       theData->SetValue(i,i,1.0);
39     
40   }
41   if ((aMatrix->RowLength() != 4) || (aMatrix->ColLength() != 3))
42     throw Standard_DimensionMismatch("IGESGeom_TransformationMatrix : Init");
43
44   
45   
46   theData = aMatrix;
47   if(theData.IsNull()) {
48     return;
49   }
50   InitTypeAndForm(124,FormNumber());
51 }
52
53     void  IGESGeom_TransformationMatrix::SetFormNumber (const Standard_Integer fm)
54 {
55   if(theData.IsNull()) 
56     cout<<"Inavalid Transformation Data"<<endl;
57   if ((fm < 0 || fm > 1) && (fm < 10 || fm > 12)) throw Standard_OutOfRange("IGESGeom_TransformationMatrix : SetFormNumber");
58   InitTypeAndForm(124,fm);
59 }
60
61
62     Standard_Real  IGESGeom_TransformationMatrix::Data
63   (const Standard_Integer I, const Standard_Integer J) const
64 {
65   return theData->Value(I,J);
66 }
67
68     gp_GTrsf IGESGeom_TransformationMatrix::Value () const
69 {
70   gp_GTrsf Matrix;
71   if(!theData.IsNull()) {
72     for (Standard_Integer I = 1; I <= 3; I++) {
73       for (Standard_Integer J = 1; J <= 4; J++) {
74         Matrix.SetValue(I, J, theData->Value(I, J));
75       }
76     }
77   }
78   
79   return Matrix;
80 }