X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROData%2FHYDROData_Image.cxx;h=ca01c6555c646d0b7083e3a118b7a871688941f8;hb=0d9decc8762a829f1bdc69048fab08122e441ec0;hp=694e65f8a1c16439d7b084caef920b22d33fed40;hpb=3cff85424556651afcab2e7fa5081531d748b7cc;p=modules%2Fhydro.git diff --git a/src/HYDROData/HYDROData_Image.cxx b/src/HYDROData/HYDROData_Image.cxx index 694e65f8..ca01c655 100644 --- a/src/HYDROData/HYDROData_Image.cxx +++ b/src/HYDROData/HYDROData_Image.cxx @@ -3,10 +3,11 @@ #include "HYDROData_Document.h" #include "HYDROData_Tool.h" -#include "HYDROOperations_Factory.h" +#include "HYDROData_OperationsFactory.h" #include #include +#include #include #include #include @@ -23,10 +24,11 @@ static const Standard_GUID GUID_SELF_SPLITTED("997995aa-5c19-40bf-9a60-ab4b70ad0 #define PYTHON_IMAGE_ID "KIND_IMAGE" -IMPLEMENT_STANDARD_HANDLE(HYDROData_Image, HYDROData_Object) -IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Image, HYDROData_Object) +IMPLEMENT_STANDARD_HANDLE(HYDROData_Image, HYDROData_Entity) +IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Image, HYDROData_Entity) HYDROData_Image::HYDROData_Image() +: HYDROData_Entity() { } @@ -74,32 +76,44 @@ QStringList HYDROData_Image::DumpToPython( MapOfTreatedObjects& theTreatedObject // Dump transformation points for image aResList << QString( "" ); - QPoint aPointAIn, aPointBIn, aPointCIn; - QPointF aPointAOut, aPointBOut, aPointCOut; - TrsfPoints( aPointAIn, aPointBIn, aPointCIn, - aPointAOut, aPointBOut, aPointCOut ); + QPoint aPointA, aPointB, aPointC; + QPointF aLambertPointA, aLambertPointB, aLambertPointC; + QPointF aCartesianPointA, aCartesianPointB, aCartesianPointC; + TrsfPoints( aPointA, aPointB, aPointC, + aLambertPointA, aLambertPointB, aLambertPointC, + aCartesianPointA, aCartesianPointB, aCartesianPointC ); - aResList << QString( "a_in = QPoint( %1, %2 );" ) - .arg( aPointAIn.x() ).arg( aPointAIn.y() ); + aResList << QString( "pa = QPoint( %1, %2 );" ) + .arg( aPointA.x() ).arg( aPointA.y() ); - aResList << QString( "b_in = QPoint( %1, %2 );" ) - .arg( aPointBIn.x() ).arg( aPointBIn.y() ); + aResList << QString( "pb = QPoint( %1, %2 );" ) + .arg( aPointB.x() ).arg( aPointB.y() ); - aResList << QString( "c_in = QPoint( %1, %2 );" ) - .arg( aPointCIn.x() ).arg( aPointCIn.y() ); + aResList << QString( "pc = QPoint( %1, %2 );" ) + .arg( aPointC.x() ).arg( aPointC.y() ); - aResList << QString( "a_out = QPointF( %1, %2 );" ) - .arg( aPointAOut.x() ).arg( aPointAOut.y() ); + aResList << QString( "lpa = QPointF( %1, %2 );" ) + .arg( aLambertPointA.x() ).arg( aLambertPointA.y() ); - aResList << QString( "b_out = QPointF( %1, %2 );" ) - .arg( aPointBOut.x() ).arg( aPointBOut.y() ); + aResList << QString( "lpb = QPointF( %1, %2 );" ) + .arg( aLambertPointB.x() ).arg( aLambertPointB.y() ); - aResList << QString( "c_out = QPointF( %1, %2 );" ) - .arg( aPointCOut.x() ).arg( aPointCOut.y() ); + aResList << QString( "lpc = QPointF( %1, %2 );" ) + .arg( aLambertPointC.x() ).arg( aLambertPointC.y() ); + + aResList << QString( "cpa = QPointF( %1, %2 );" ) + .arg( aCartesianPointA.x() ).arg( aCartesianPointA.y() ); + + aResList << QString( "cpb = QPointF( %1, %2 );" ) + .arg( aCartesianPointB.x() ).arg( aCartesianPointB.y() ); + + aResList << QString( "cpc = QPointF( %1, %2 );" ) + .arg( aCartesianPointC.x() ).arg( aCartesianPointC.y() ); QString aGap = QString().fill( ' ', anImageName.size() + 16 ); - aResList << QString( "%1.SetTrsfPoints( a_in, b_in, c_in," ).arg( anImageName ); - aResList << QString( aGap + "a_out, b_out, c_out );" ); + aResList << QString( "%1.SetTrsfPoints( pa, pb, pc," ).arg( anImageName ); + aResList << QString( aGap + "lpa, lpb, lpc," ); + aResList << QString( aGap + "cpa, cpb, cpc );" ); } else { @@ -113,7 +127,7 @@ QStringList HYDROData_Image::DumpToPython( MapOfTreatedObjects& theTreatedObject aResList << QString( "%1.SetOperatorName( \"%2\" );" ) .arg( anImageName ).arg( anOperatorName ); - ImageComposer_Operator* anImageOp = HYDROOperations_Factory::Factory()->Operator( this ); + ImageComposer_Operator* anImageOp = HYDROData_OperationsFactory::Factory()->Operator( this ); if ( anImageOp ) { // Dump operation arguments @@ -153,7 +167,7 @@ QStringList HYDROData_Image::DumpToPython( MapOfTreatedObjects& theTreatedObject void HYDROData_Image::Update( const bool theIsForce ) { - HYDROOperations_Factory* aFactory = HYDROOperations_Factory::Factory(); + HYDROData_OperationsFactory* aFactory = HYDROData_OperationsFactory::Factory(); // Update image only if there is an operation ImageComposer_Operator* anOp = aFactory->Operator( OperatorName() ); @@ -166,7 +180,7 @@ void HYDROData_Image::Update( const bool theIsForce ) if ( aNbReferences > 0 ) { // First referenced object - Handle(HYDROData_Object) aRefObj = Reference( 0 ); + Handle(HYDROData_Entity) aRefObj = Reference( 0 ); if ( !aRefObj.IsNull() ) { anObj1 = aRefObj->GetDataVariant(); @@ -182,7 +196,7 @@ void HYDROData_Image::Update( const bool theIsForce ) if ( aNbReferences > 1 ) { // Second referenced object - Handle(HYDROData_Object) aRefObj = Reference( 1 ); + Handle(HYDROData_Entity) aRefObj = Reference( 1 ); if ( !aRefObj.IsNull() ) anObj2 = aRefObj->GetDataVariant(); } @@ -309,46 +323,61 @@ QTransform HYDROData_Image::Trsf() const return aTrsf; } -void HYDROData_Image::SetTrsfPoints(const QPoint& thePointAIn, - const QPoint& thePointBIn, - const QPoint& thePointCIn, - const QPointF& thePointAOut, - const QPointF& thePointBOut, - const QPointF& thePointCOut) +void HYDROData_Image::SetTrsfPoints(const QPoint& thePointA, + const QPoint& thePointB, + const QPoint& thePointC, + const QPointF& theLambertPointA, + const QPointF& theLambertPointB, + const QPointF& theLambertPointC, + const QPointF& theCartesianPointA, + const QPointF& theCartesianPointB, + const QPointF& theCartesianPointC) { Handle(TDataStd_RealArray) anArray; if (!myLab.FindChild(DataTag_TrsfPoints).FindAttribute(TDataStd_RealArray::GetID(), anArray)) { - anArray = TDataStd_RealArray::Set(myLab.FindChild(DataTag_TrsfPoints), 1, 12); + anArray = TDataStd_RealArray::Set(myLab.FindChild(DataTag_TrsfPoints), 1, 18); } - anArray->SetValue(1, thePointAIn.x()); - anArray->SetValue(2, thePointAIn.y()); - anArray->SetValue(3, thePointBIn.x()); - anArray->SetValue(4, thePointBIn.y()); - anArray->SetValue(5, thePointCIn.x()); - anArray->SetValue(6, thePointCIn.y()); - anArray->SetValue(7, thePointAOut.x()); - anArray->SetValue(8, thePointAOut.y()); - anArray->SetValue(9, thePointBOut.x()); - anArray->SetValue(10, thePointBOut.y()); - anArray->SetValue(11, thePointCOut.x()); - anArray->SetValue(12, thePointCOut.y()); + anArray->SetValue(1, thePointA.x()); + anArray->SetValue(2, thePointA.y()); + anArray->SetValue(3, thePointB.x()); + anArray->SetValue(4, thePointB.y()); + anArray->SetValue(5, thePointC.x()); + anArray->SetValue(6, thePointC.y()); + anArray->SetValue(7, theLambertPointA.x()); + anArray->SetValue(8, theLambertPointA.y()); + anArray->SetValue(9, theLambertPointB.x()); + anArray->SetValue(10, theLambertPointB.y()); + anArray->SetValue(11, theLambertPointC.x()); + anArray->SetValue(12, theLambertPointC.y()); + anArray->SetValue(13, theCartesianPointA.x()); + anArray->SetValue(14, theCartesianPointA.y()); + anArray->SetValue(15, theCartesianPointB.x()); + anArray->SetValue(16, theCartesianPointB.y()); + anArray->SetValue(17, theCartesianPointC.x()); + anArray->SetValue(18, theCartesianPointC.y()); } -void HYDROData_Image::TrsfPoints(QPoint& thePointAIn, - QPoint& thePointBIn, - QPoint& thePointCIn, - QPointF& thePointAOut, - QPointF& thePointBOut, - QPointF& thePointCOut) const +void HYDROData_Image::TrsfPoints(QPoint& thePointA, + QPoint& thePointB, + QPoint& thePointC, + QPointF& theLambertPointA, + QPointF& theLambertPointB, + QPointF& theLambertPointC, + QPointF& theCartesianPointA, + QPointF& theCartesianPointB, + QPointF& theCartesianPointC) const { Handle(TDataStd_RealArray) anArray; if (myLab.FindChild(DataTag_TrsfPoints).FindAttribute(TDataStd_RealArray::GetID(), anArray)) { - thePointAIn = QPointF( anArray->Value(1), anArray->Value(2) ).toPoint(); - thePointBIn = QPointF( anArray->Value(3), anArray->Value(4) ).toPoint(); - thePointCIn = QPointF( anArray->Value(5), anArray->Value(6) ).toPoint(); - thePointAOut = QPointF( anArray->Value(7), anArray->Value(8) ); - thePointBOut = QPointF( anArray->Value(9), anArray->Value(10) ); - thePointCOut = QPointF( anArray->Value(11), anArray->Value(12) ); + thePointA = QPointF( anArray->Value(1), anArray->Value(2) ).toPoint(); + thePointB = QPointF( anArray->Value(3), anArray->Value(4) ).toPoint(); + thePointC = QPointF( anArray->Value(5), anArray->Value(6) ).toPoint(); + theLambertPointA = QPointF( anArray->Value(7), anArray->Value(8) ); + theLambertPointB = QPointF( anArray->Value(9), anArray->Value(10) ); + theLambertPointC = QPointF( anArray->Value(11), anArray->Value(12) ); + theCartesianPointA = QPointF( anArray->Value(13), anArray->Value(14) ); + theCartesianPointB = QPointF( anArray->Value(15), anArray->Value(16) ); + theCartesianPointC = QPointF( anArray->Value(17), anArray->Value(18) ); } } @@ -358,7 +387,20 @@ bool HYDROData_Image::HasTrsfPoints() const return myLab.FindChild(DataTag_TrsfPoints).FindAttribute(TDataStd_RealArray::GetID(), anArray); } -void HYDROData_Image::AppendReference( const Handle(HYDROData_Object)& theReferenced ) +void HYDROData_Image::SetTrsfMode(const int theMode) +{ + TDataStd_Integer::Set(myLab.FindChild(DataTag_TrsfMode), theMode); +} + +int HYDROData_Image::TrsfMode() const +{ + Handle(TDataStd_Integer) aMode; + if(myLab.FindChild(DataTag_TrsfMode).FindAttribute(TDataStd_Integer::GetID(), aMode)) + return aMode->Get(); + return 0; +} + +void HYDROData_Image::AppendReference( const Handle(HYDROData_Entity)& theReferenced ) { AddReferenceObject( theReferenced, 0 ); } @@ -368,13 +410,13 @@ int HYDROData_Image::NbReferences() const return NbReferenceObjects( 0 ); } -Handle(HYDROData_Object) HYDROData_Image::Reference( const int theIndex ) const +Handle(HYDROData_Entity) HYDROData_Image::Reference( const int theIndex ) const { return GetReferenceObject( 0, theIndex ); } void HYDROData_Image::ChangeReference( - const int theIndex, Handle(HYDROData_Object) theReferenced) + const int theIndex, Handle(HYDROData_Entity) theReferenced) { SetReferenceObject( theReferenced, 0, theIndex ); }