From 1eddd44827b0dad87cc7029cc4d6cc5fde6a0f5a Mon Sep 17 00:00:00 2001 From: apo Date: Wed, 9 Nov 2005 12:25:10 +0000 Subject: [PATCH] Adjust to CVS HEAD changes --- src/VISU_I/VISU_CutLines_i.cc | 93 +++++++++++++++++++++++++++++++++++ src/VISU_I/VISU_CutLines_i.hh | 10 ++++ 2 files changed, 103 insertions(+) diff --git a/src/VISU_I/VISU_CutLines_i.cc b/src/VISU_I/VISU_CutLines_i.cc index 90eb9f0c..caf7aee2 100644 --- a/src/VISU_I/VISU_CutLines_i.cc +++ b/src/VISU_I/VISU_CutLines_i.cc @@ -85,6 +85,12 @@ void VISU::CutLines_i::SameAs(const CutLines_i* theOrigin){ VISU::ScalarMap_i::SameAs(theOrigin); } +/*! Copy map to /a myMapCurvesInverted. + * \param theCurves - map + */ +void VISU::CutLines_i::CopyCurvesInverted(const TCurvesInv& theCurves){ + myMapCurvesInverted = theCurves; +} VISU::Storable* VISU::CutLines_i::Create(const char* theMeshName, VISU::Entity theEntity, const char* theFieldName, int theIteration) @@ -116,6 +122,20 @@ VISU::Storable* VISU::CutLines_i::Restore(const Storable::TRestoringMap& theMap) if(aCondList[i].toInt() == 0) SetLinePosition(i,aPosList[i].toDouble()); + // Restoring the map - \a myMapCurvesInverted + QStringList aMapCurvesInverted = QStringList::split("|",VISU::Storable::FindValue(theMap,"myMapCurvesInverted") ); + if (aMapCurvesInverted.count() == GetNbLines()){ + for(int i = 0, iEnd = GetNbLines(); i < iEnd ; i++){ + if(aMapCurvesInverted[i].toInt()) + SetCurveInverted(i,true); + else + SetCurveInverted(i,false); + } + } else { + for(int i = 0, iEnd = GetNbLines(); i < iEnd ; i++) + SetCurveInverted(i,false); + } + return ScalarMap_i::Restore(theMap); } @@ -144,6 +164,12 @@ void VISU::CutLines_i::ToStream(std::ostringstream& theStr){ } Storable::DataToStream( theStr, "myLinePosition", aStrPos.latin1()); Storable::DataToStream( theStr, "myLineCondition", aStrCon.latin1()); + + // Storing the map - \a myMapCurvesInverted + QString aStrCurvesInverted; + for(int i = 0, iEnd = GetNbLines(); i < iEnd; i++) + aStrCurvesInverted.append(QString::number(IsCurveInverted(i)) + "|"); + Storable::DataToStream( theStr, "myMapCurvesInverted", aStrCurvesInverted.latin1()); } VISU::CutLines_i::~CutLines_i(){ @@ -234,6 +260,38 @@ CORBA::Boolean VISU::CutLines_i::IsDefaultPosition(CORBA::Long thePlaneNumber){ return myCutLinesPL->IsPartDefault(thePlaneNumber); } +/*! Invert all curves of corresponding table + * see void VISU::CutLines_i::SetCurveInverted(CORBA::Long theCurveNumber,CORBA::Boolean theInvert) + * \param theInvert - Invert all curves, if value is TRUE, else not. + */ +void VISU::CutLines_i::SetAllCurvesInverted(CORBA::Boolean theInvert){ + for (int i=0; iSetNbParts(theNb); @@ -331,6 +389,41 @@ void VISU::CutLines_i::BuildTableOfReal(SALOMEDS::SObject_ptr theSObject){ } if(aXYMapCont.size() == 0) throw std::runtime_error("CutPlanes_i::BuildTableOfReal aXYMapCont.size() == 0 !!!"); + + { + // Invertion all curves in the table, which has inversion flag is TRUE (see \a myMapCurvesInverted) + for(int iLine=0; iLine < iLineEnd; iLine++){ + if (!IsCurveInverted(iLine)) continue; + TXYMap aNewXYMap; + TXYMap& aXYMap = aXYMapCont[iLine]; + TXYMap::const_iterator aXYMapIter = aXYMap.begin(); + std::list XKeys; + for (;aXYMapIter != aXYMap.end() ; aXYMapIter++) XKeys.push_back(aXYMapIter->first); + XKeys.sort(); + if (XKeys.size() > 1) { + float a_first_indx = XKeys.front(); + float a_last_indx = XKeys.back(); + if (a_first_indx > a_last_indx){ + XKeys.reverse(); + float tmp = a_first_indx; + a_first_indx = a_last_indx; + a_last_indx = tmp; + } + std::list::const_iterator aIter = XKeys.begin(); + for (int k=0;k= 0 and aDist<=1.0 + aNewXYMap[1.0 - *aIter] = aXYMap[*aIter]; + } + TXYMap::const_iterator aNewXYMapIter = aNewXYMap.begin(); + aXYMap.clear(); + for (;aNewXYMapIter != aNewXYMap.end();aNewXYMapIter++) { + aXYMap[aNewXYMapIter->first] = aNewXYMapIter->second; + } + } + } + } //Resorting of theXYMap TXYMapCont::iterator aXYMapContIter = aXYMapCont.begin(); for(; aXYMapContIter != aXYMapCont.end(); aXYMapContIter++){ diff --git a/src/VISU_I/VISU_CutLines_i.hh b/src/VISU_I/VISU_CutLines_i.hh index cbc68366..637e7b83 100644 --- a/src/VISU_I/VISU_CutLines_i.hh +++ b/src/VISU_I/VISU_CutLines_i.hh @@ -82,15 +82,25 @@ namespace VISU{ virtual void SetDefaultPosition(CORBA::Long thePlaneNumber); virtual CORBA::Boolean IsDefaultPosition(CORBA::Long thePlaneNumber); + virtual void SetAllCurvesInverted(CORBA::Boolean theInvert); + virtual CORBA::Boolean IsAllCurvesInverted(); + virtual void SetCurveInverted(CORBA::Long theCurveNumber,CORBA::Boolean theInvert); + virtual CORBA::Boolean IsCurveInverted(CORBA::Long theCurveNumber); + virtual void SetNbLines(CORBA::Long theNb); virtual CORBA::Long GetNbLines(); typedef VISU::CutLines TInterface; VISU_CutLinesPL* GetCutLinesPL(){ return myCutLinesPL;} + + typedef std::map TCurvesInv; + TCurvesInv GetCurvesInverted() {return myMapCurvesInverted;} + void CopyCurvesInverted(const TCurvesInv& theCurves); protected: virtual void DoHook(); VISU_CutLinesPL *myCutLinesPL; + TCurvesInv myMapCurvesInverted; public: static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity, -- 2.39.2