0030675: Visualization - remove redundant proxy classes in hierarchy of PrsMgr_Presen...
[occt.git] / src / Plate / Plate_LinearScalarConstraint.cxx
1 // Created on: 1998-03-26
2 // Created by: # Andre LIEUTIER
3 // Copyright (c) 1998-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17
18 #include <gp_XYZ.hxx>
19 #include <Plate_LinearScalarConstraint.hxx>
20 #include <Plate_PinpointConstraint.hxx>
21 #include <Standard_DimensionMismatch.hxx>
22 #include <Standard_OutOfRange.hxx>
23
24 Plate_LinearScalarConstraint::Plate_LinearScalarConstraint() {}
25
26 Plate_LinearScalarConstraint::Plate_LinearScalarConstraint
27    (const Plate_PinpointConstraint& PPC1,const gp_XYZ& coeff)
28
29 {
30   myPPC = new Plate_HArray1OfPinpointConstraint(1,1);
31   myCoef = new TColgp_HArray2OfXYZ(1,1,1,1);
32
33   myPPC->ChangeValue(1) = PPC1;
34   myCoef->ChangeValue(1,1) = coeff;
35 }
36
37 Plate_LinearScalarConstraint::Plate_LinearScalarConstraint(const Plate_Array1OfPinpointConstraint& thePPC,const TColgp_Array1OfXYZ& theCoeff)
38 {
39   if(theCoeff.Length()!= thePPC.Length()) throw Standard_DimensionMismatch();
40   myPPC = new Plate_HArray1OfPinpointConstraint(1, thePPC.Length());
41   myCoef = new TColgp_HArray2OfXYZ(1,1,1, theCoeff.Length());
42
43   myPPC->ChangeArray1() = thePPC;
44   for(Standard_Integer i = 1; i<= theCoeff.Length(); i++) {
45     myCoef->ChangeValue(1,i) = theCoeff(i+ theCoeff.Lower()-1);
46   }
47 }
48
49 Plate_LinearScalarConstraint::Plate_LinearScalarConstraint
50    (const Plate_Array1OfPinpointConstraint& thePPC,const TColgp_Array2OfXYZ& theCoeff)
51 {
52   if(theCoeff.RowLength()!= thePPC.Length()) throw Standard_DimensionMismatch();
53   myPPC = new Plate_HArray1OfPinpointConstraint(1, thePPC.Length());
54   myCoef = new TColgp_HArray2OfXYZ(1, theCoeff.ColLength(),1, theCoeff.RowLength());
55   
56   myPPC->ChangeArray1() = thePPC;
57   myCoef->ChangeArray2() = theCoeff;
58 }
59
60
61 Plate_LinearScalarConstraint::Plate_LinearScalarConstraint(const Standard_Integer ColLen,const Standard_Integer RowLen)
62 {
63   myPPC = new Plate_HArray1OfPinpointConstraint(1,RowLen);
64   myCoef = new TColgp_HArray2OfXYZ(1,ColLen,1,RowLen);
65   myCoef->Init(gp_XYZ(0.,0.,0.));
66 }
67
68  void Plate_LinearScalarConstraint::SetPPC(const Standard_Integer Index,const Plate_PinpointConstraint& Value) 
69 {
70   myPPC->ChangeValue(Index) = Value;
71 }
72
73  void Plate_LinearScalarConstraint::SetCoeff(const Standard_Integer Row,const Standard_Integer Col,const gp_XYZ& Value) 
74 {
75   myCoef->ChangeValue(Row,Col) = Value;
76 }
77