1 // Created by: CKY / Contract Toubro-Larsen
2 // Copyright (c) 1993-1999 Matra Datavision
3 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
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.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 //--------------------------------------------------------------------
17 //--------------------------------------------------------------------
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>
25 IMPLEMENT_STANDARD_RTTIEXT(IGESGeom_TransformationMatrix,IGESData_TransfEntity)
27 IGESGeom_TransformationMatrix::IGESGeom_TransformationMatrix () { }
30 void IGESGeom_TransformationMatrix::Init
31 (const Handle(TColStd_HArray2OfReal)& aMatrix)
33 if(aMatrix.IsNull()) {
34 theData = new TColStd_HArray2OfReal(1,3,1,4);
36 Standard_Integer i =1;
38 theData->SetValue(i,i,1.0);
41 if ((aMatrix->RowLength() != 4) || (aMatrix->ColLength() != 3))
42 throw Standard_DimensionMismatch("IGESGeom_TransformationMatrix : Init");
47 if(theData.IsNull()) {
50 InitTypeAndForm(124,FormNumber());
53 void IGESGeom_TransformationMatrix::SetFormNumber (const Standard_Integer fm)
56 std::cout<<"Inavalid Transformation Data"<<std::endl;
57 if ((fm < 0 || fm > 1) && (fm < 10 || fm > 12)) throw Standard_OutOfRange("IGESGeom_TransformationMatrix : SetFormNumber");
58 InitTypeAndForm(124,fm);
62 Standard_Real IGESGeom_TransformationMatrix::Data
63 (const Standard_Integer I, const Standard_Integer J) const
65 return theData->Value(I,J);
68 gp_GTrsf IGESGeom_TransformationMatrix::Value () const
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));