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)
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);
}
}
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(){
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; i<GetNbLines(); i++) SetCurveInverted(i,theInvert);
+}
+
+/*! Checks the orientation of all curves
+ * \retval TRUE - if all curves are inverted, else FALSE
+ */
+CORBA::Boolean VISU::CutLines_i::IsAllCurvesInverted(){
+ for (int i=0; i<GetNbLines(); i++)
+ if (!IsCurveInverted(i)) return false;
+ return true;
+}
+
+/*! Sets orientation of curve
+ * \param theCurveNumber - integer value, number of cut line.
+ * \param theInvert - boolean value, TRUE or false.
+ */
+void VISU::CutLines_i::SetCurveInverted(CORBA::Long theCurveNumber,CORBA::Boolean theInvert){
+ myMapCurvesInverted[theCurveNumber] = theInvert;
+}
+
+/*! Checks orientation of curve.
+ * \param theCurveNumber - integer value, number of cut line.
+ * \retval TRUE - if line in the table is inverted, else FALSE.
+ */
+CORBA::Boolean VISU::CutLines_i::IsCurveInverted(CORBA::Long theCurveNumber){
+ return myMapCurvesInverted[theCurveNumber];
+}
void VISU::CutLines_i::SetNbLines(CORBA::Long theNb) {
myCutLinesPL->SetNbParts(theNb);
}
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<float> 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<float>::const_iterator aIter = XKeys.begin();
+ for (int k=0;k<XKeys.size() and aIter != XKeys.end();k++,aIter++){
+ // Warning: value '1.0' come from workaround:
+ // see also aDist = vtkMath::Dot(aVect,aDirLn) / aBoundPrjLn[2];
+ // aDist >= 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++){
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<int,bool> 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,