1 // VISU OBJECT : interactive object for VISU entities implementation
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // File : VISU_PrsObject_i.cxx
24 // Author : Alexey PETROV
27 #include "VISU_CutLines_i.hh"
28 #include "VISU_Prs3dUtils.hh"
29 #include "VISU_Result_i.hh"
31 #include "VISU_Actor.h"
32 #include "VISU_CutLinesPL.hxx"
33 #include "VISU_Convertor.hxx"
34 #include "VISU_PipeLineUtils.hxx"
36 #include "SUIT_ResourceMgr.h"
37 #include "SALOME_Event.hxx"
39 #include <vtkAppendPolyData.h>
41 static vtkFloatingPointType EPS_machine = 1.0E-7;
44 static int MYDEBUG = 0;
46 static int MYDEBUG = 0;
50 //---------------------------------------------------------------
53 ::IsPossible(Result_i* theResult,
54 const std::string& theMeshName,
55 VISU::Entity theEntity,
56 const std::string& theFieldName,
57 CORBA::Long theTimeStampNumber,
58 bool theIsMemoryCheck)
60 return TSuperClass::IsPossible(theResult,
68 //---------------------------------------------------------------
69 int VISU::CutLines_i::myNbPresent = 0;
71 //---------------------------------------------------------------
73 VISU::CutLines_i::GenerateName()
75 return VISU::GenerateName("CutLines",myNbPresent++);
78 //---------------------------------------------------------------
79 const string VISU::CutLines_i::myComment = "CUTLINES";
81 //---------------------------------------------------------------
86 return myComment.c_str();
89 //----------------------------------------------------------------------------
95 return "ICON_TREE_CUT_LINES";
97 return "ICON_TREE_CUT_LINES_GROUPS";
100 //---------------------------------------------------------------
102 CutLines_i(EPublishInStudyMode thePublishInStudyMode) :
103 ColoredPrs3d_i(thePublishInStudyMode),
104 ScalarMap_i(thePublishInStudyMode),
109 //---------------------------------------------------------------
112 ::SameAs(const Prs3d_i* theOrigin)
114 TSuperClass::SameAs(theOrigin);
116 if(const CutLines_i* aPrs3d = dynamic_cast<const CutLines_i*>(theOrigin)){
117 CutLines_i* anOrigin = const_cast<CutLines_i*>(aPrs3d);
118 myUseAbsLength = anOrigin->IsUseAbsoluteLength();
119 CopyCurvesInverted(anOrigin->GetCurvesInverted());
124 //---------------------------------------------------------------
125 /*! Copy map to /a myMapCurvesInverted.
126 * \param theCurves - map
130 ::CopyCurvesInverted(const TCurvesInv& theCurves)
132 myMapCurvesInverted = theCurves;
136 //---------------------------------------------------------------
139 ::Create(const std::string& theMeshName,
140 VISU::Entity theEntity,
141 const std::string& theFieldName,
142 CORBA::Long theTimeStampNumber)
144 SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
145 SetUseAbsoluteLength( aResourceMgr->booleanValue( "VISU", "use_absolute_length", false ) );
146 SetAllCurvesInverted( aResourceMgr->booleanValue( "VISU", "invert_all_curves", false ) );
147 return TSuperClass::Create(theMeshName,theEntity,theFieldName,theTimeStampNumber);
151 //---------------------------------------------------------------
154 ::Restore(SALOMEDS::SObject_ptr theSObject,
155 const Storable::TRestoringMap& theMap)
157 if(!TSuperClass::Restore(theSObject, theMap))
160 SetNbLines(VISU::Storable::FindValue(theMap,"myNbLines").toInt());
161 SetDisplacement(VISU::Storable::FindValue(theMap,"myDisplacement[0]").toDouble());
162 SetDisplacement2(VISU::Storable::FindValue(theMap,"myDisplacement[1]").toDouble());
163 SetOrientation(CutPlanes::Orientation(VISU::Storable::FindValue(theMap,"myBasePlane[0]").toInt()),
164 Storable::FindValue(theMap,"aRot[0][0]").toDouble(),
165 Storable::FindValue(theMap,"aRot[0][1]").toDouble());
166 SetOrientation2(CutPlanes::Orientation(VISU::Storable::FindValue(theMap,"myBasePlane[1]").toInt()),
167 Storable::FindValue(theMap,"aRot[1][0]").toDouble(),
168 Storable::FindValue(theMap,"aRot[1][1]").toDouble());
169 SetUseAbsoluteLength(VISU::Storable::FindValue(theMap,"myUseAbsLength").toInt());
171 if (VISU::Storable::FindValue(theMap,"myBasePlaneCondition").toInt())
174 SetBasePlanePosition(VISU::Storable::FindValue(theMap,"myBasePlanePosition").toDouble());
176 QStringList aPosList = QStringList::split("|",VISU::Storable::FindValue(theMap,"myLinePosition") );
177 QStringList aCondList = QStringList::split("|",VISU::Storable::FindValue(theMap,"myLineCondition") );
178 for(int i = 0, iEnd = GetNbLines(); i < iEnd; i++)
179 if(aCondList[i].toInt() == 0)
180 SetLinePosition(i,aPosList[i].toDouble());
182 // Restoring the map - \a myMapCurvesInverted
183 QStringList aMapCurvesInverted = QStringList::split("|",VISU::Storable::FindValue(theMap,"myMapCurvesInverted") );
184 if (aMapCurvesInverted.count() == GetNbLines()){
185 for(int i = 0, iEnd = GetNbLines(); i < iEnd ; i++){
186 if(aMapCurvesInverted[i].toInt())
187 SetCurveInverted(i,true);
189 SetCurveInverted(i,false);
192 for(int i = 0, iEnd = GetNbLines(); i < iEnd ; i++)
193 SetCurveInverted(i,false);
200 //---------------------------------------------------------------
203 ::ToStream(std::ostringstream& theStr)
205 TSuperClass::ToStream(theStr);
207 int aNbLines = GetNbLines();
209 Storable::DataToStream( theStr, "myNbLines", aNbLines );
210 Storable::DataToStream( theStr, "myDisplacement[0]", GetDisplacement() );
211 Storable::DataToStream( theStr, "myDisplacement[1]", GetDisplacement2() );
212 Storable::DataToStream( theStr, "myBasePlane[0]", int(GetOrientationType()) );
213 Storable::DataToStream( theStr, "myBasePlane[1]", int(GetOrientationType2()) );
214 Storable::DataToStream( theStr, "aRot[0][0]", GetRotateX() );
215 Storable::DataToStream( theStr, "aRot[0][1]", GetRotateY() );
216 Storable::DataToStream( theStr, "aRot[1][0]", GetRotateX2() );
217 Storable::DataToStream( theStr, "aRot[1][1]", GetRotateY2() );
218 Storable::DataToStream( theStr, "myBasePlanePosition", GetBasePlanePosition() );
219 Storable::DataToStream( theStr, "myBasePlaneCondition", IsDefault() );
221 QString aStrPos, aStrCon;
222 for(int i = 0, iEnd = GetNbLines(); i < iEnd; i++){
223 aStrPos.append(QString::number(GetLinePosition(i)) + "|");
224 aStrCon.append(QString::number(IsDefaultPosition(i)) + "|");
227 Storable::DataToStream( theStr, "myLinePosition", aStrPos.latin1());
228 Storable::DataToStream( theStr, "myLineCondition", aStrCon.latin1());
229 Storable::DataToStream( theStr,"myUseAbsLength", IsUseAbsoluteLength());
231 // Storing the map - \a myMapCurvesInverted
232 QString aStrCurvesInverted;
233 for(int i = 0, iEnd = GetNbLines(); i < iEnd; i++)
234 aStrCurvesInverted.append(QString::number(IsCurveInverted(i)) + "|");
235 Storable::DataToStream( theStr, "myMapCurvesInverted", aStrCurvesInverted.latin1());
239 //---------------------------------------------------------------
243 if(MYDEBUG) MESSAGE("CutLines_i::~CutLines_i()");
247 //---------------------------------------------------------------
250 ::SetOrientation(VISU::CutPlanes::Orientation theOrient,
251 CORBA::Double theXAngle,
252 CORBA::Double theYAngle)
254 struct TEvent: public SALOME_Event
256 VISU_CutLinesPL* myCutLinesPL;
257 CORBA::Double myXAngle, myYAngle;
258 VISU::CutPlanes::Orientation myOrient;
259 TEvent(VISU_CutLinesPL* theCutLines,
260 VISU::CutPlanes::Orientation theOrient,
261 CORBA::Double theXAngle,
262 CORBA::Double theYAngle):
263 myCutLinesPL(theCutLines),
273 myCutLinesPL->SetOrientation(VISU_CutPlanesPL::PlaneOrientation(myOrient),
279 VISU::TSetModified aModified(this);
281 ProcessVoidEvent(new TEvent(myCutLinesPL, theOrient, theXAngle, theYAngle));
284 //---------------------------------------------------------------
287 ::SetOrientation2(VISU::CutPlanes::Orientation theOrient,
288 CORBA::Double theXAngle,
289 CORBA::Double theYAngle)
291 struct TEvent: public SALOME_Event
293 VISU_CutLinesPL* myCutLinesPL;
294 CORBA::Double myXAngle, myYAngle;
295 VISU::CutPlanes::Orientation myOrient;
296 TEvent(VISU_CutLinesPL* theCutLines,
297 VISU::CutPlanes::Orientation theOrient,
298 CORBA::Double theXAngle,
299 CORBA::Double theYAngle):
300 myCutLinesPL(theCutLines),
310 myCutLinesPL->SetOrientation(VISU_CutPlanesPL::PlaneOrientation(myOrient),
317 VISU::TSetModified aModified(this);
319 ProcessVoidEvent(new TEvent(myCutLinesPL, theOrient, theXAngle, theYAngle));
322 //---------------------------------------------------------------
323 VISU::CutPlanes::Orientation
325 ::GetOrientationType()
327 return VISU::CutPlanes::Orientation(myCutLinesPL->GetPlaneOrientation());
330 //---------------------------------------------------------------
331 VISU::CutPlanes::Orientation
333 ::GetOrientationType2()
335 return VISU::CutPlanes::Orientation(myCutLinesPL->GetPlaneOrientation(1));
338 //---------------------------------------------------------------
343 return myCutLinesPL->GetRotateX();
346 //---------------------------------------------------------------
351 return myCutLinesPL->GetRotateY();
355 //---------------------------------------------------------------
360 return myCutLinesPL->GetRotateX(1);
363 //---------------------------------------------------------------
368 return myCutLinesPL->GetRotateY(1);
372 //---------------------------------------------------------------
375 ::SetDisplacement(CORBA::Double theDisp)
377 VISU::TSetModified aModified(this);
379 ProcessVoidEvent(new TVoidMemFun2ArgEvent<VISU_CutLinesPL, vtkFloatingPointType, int>
380 (GetSpecificPL(), &VISU_CutLinesPL::SetDisplacement, theDisp, 0));
383 //---------------------------------------------------------------
386 ::SetDisplacement2(CORBA::Double theDisp)
388 VISU::TSetModified aModified(this);
390 ProcessVoidEvent(new TVoidMemFun2ArgEvent<VISU_CutLinesPL, vtkFloatingPointType, int>
391 (GetSpecificPL(), &VISU_CutLinesPL::SetDisplacement, theDisp, 1));
395 //---------------------------------------------------------------
400 return myCutLinesPL->GetDisplacement();
403 //---------------------------------------------------------------
408 return myCutLinesPL->GetDisplacement(1);
412 //---------------------------------------------------------------
415 ::SetBasePlanePosition(CORBA::Double thePlanePosition)
417 VISU::TSetModified aModified(this);
419 ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_CutLinesPL, vtkFloatingPointType>
420 (GetSpecificPL(), &VISU_CutLinesPL::SetPosition, thePlanePosition));
423 //---------------------------------------------------------------
426 ::GetBasePlanePosition()
428 return myCutLinesPL->GetPosition();
431 //---------------------------------------------------------------
434 ::SetLinePosition(CORBA::Long thePlaneNumber,
435 CORBA::Double thePlanePosition)
437 VISU::TSetModified aModified(this);
439 ProcessVoidEvent(new TVoidMemFun2ArgEvent<VISU_CutLinesPL, int, vtkFloatingPointType>
440 (GetSpecificPL(), &VISU_CutLinesPL::SetPartPosition, thePlaneNumber, thePlanePosition));
443 //---------------------------------------------------------------
446 ::GetLinePosition(CORBA::Long thePlaneNumber)
448 return myCutLinesPL->GetPartPosition(thePlaneNumber,1);
452 //---------------------------------------------------------------
457 VISU::TSetModified aModified(this);
459 ProcessVoidEvent(new TVoidMemFunEvent<VISU_CutLinesPL>
460 (GetSpecificPL(), &VISU_CutLinesPL::SetDefault));
463 //---------------------------------------------------------------
468 return myCutLinesPL->IsDefault();
471 //---------------------------------------------------------------
474 ::SetDefaultPosition(CORBA::Long thePlaneNumber)
476 VISU::TSetModified aModified(this);
478 ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_CutLinesPL, int>
479 (GetSpecificPL(), &VISU_CutLinesPL::SetPartDefault, thePlaneNumber));
482 //---------------------------------------------------------------
485 ::IsDefaultPosition(CORBA::Long thePlaneNumber)
487 return myCutLinesPL->IsPartDefault(thePlaneNumber);
490 //---------------------------------------------------------------
491 /*! Invert all curves of corresponding table
492 * see void VISU::CutLines_i::SetCurveInverted(CORBA::Long theCurveNumber,CORBA::Boolean theInvert)
493 * \param theInvert - Invert all curves, if value is TRUE, else not.
497 ::SetAllCurvesInverted(CORBA::Boolean theInvert)
499 for(int i=0; i < GetNbLines(); i++)
500 SetCurveInverted(i, theInvert);
503 //---------------------------------------------------------------
504 /*! Checks the orientation of all curves
505 * \retval TRUE - if all curves are inverted, else FALSE
509 ::IsAllCurvesInverted()
511 for (int i=0; i<GetNbLines(); i++)
512 if (!IsCurveInverted(i)) return false;
516 //---------------------------------------------------------------
517 /*! Sets orientation of curve
518 * \param theCurveNumber - integer value, number of cut line.
519 * \param theInvert - boolean value, TRUE or false.
523 ::SetCurveInverted(CORBA::Long theCurveNumber, CORBA::Boolean theInvert)
525 if(myMapCurvesInverted[theCurveNumber] == theInvert)
528 VISU::TSetModified aModified(this);
530 myMapCurvesInverted[theCurveNumber] = theInvert;
531 myParamsTime.Modified();
534 //---------------------------------------------------------------
535 /*! Checks orientation of curve.
536 * \param theCurveNumber - integer value, number of cut line.
537 * \retval TRUE - if line in the table is inverted, else FALSE.
541 ::IsCurveInverted(CORBA::Long theCurveNumber)
543 return myMapCurvesInverted[theCurveNumber];
546 //---------------------------------------------------------------
547 /*! It control the way the length of cutlines is shown: using aboslute or relative values
548 * \param theAbsLength - boolean value, TRUE or false.
552 ::SetUseAbsoluteLength(CORBA::Boolean theAbsLength)
554 if(myUseAbsLength == theAbsLength)
557 VISU::TSetModified aModified(this);
559 myUseAbsLength = theAbsLength;
560 myParamsTime.Modified();
563 //---------------------------------------------------------------
566 ::IsUseAbsoluteLength()
568 return myUseAbsLength;
571 //---------------------------------------------------------------
574 ::SetNbLines(CORBA::Long theNb)
576 VISU::TSetModified aModified(this);
578 ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_CutLinesPL, int>
579 (GetSpecificPL(), &VISU_CutLinesPL::SetNbParts, theNb));
582 //---------------------------------------------------------------
587 return myCutLinesPL->GetNbParts();
591 //---------------------------------------------------------------
594 ::CreatePipeLine(VISU_PipeLine* thePipeLine)
597 myCutLinesPL = VISU_CutLinesPL::New();
599 myCutLinesPL = dynamic_cast<VISU_CutLinesPL*>(thePipeLine);
601 TSuperClass::CreatePipeLine(myCutLinesPL);
605 //----------------------------------------------------------------------------
610 return IsPossible(GetCResult(),GetCMeshName(),GetEntity(),GetCFieldName(),GetTimeStampNumber(),true);
614 //---------------------------------------------------------------
619 if(VISU_Actor* anActor = TSuperClass::CreateActor()){
620 anActor->SetVTKMapping(true);
621 SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
622 int aDispMode = aResourceMgr->integerValue("VISU" , "cut_lines_represent", 2);
623 anActor->SetRepresentation(aDispMode);
629 //---------------------------------------------------------------
632 ::BuildTableOfReal(SALOMEDS::SObject_var theSObject)
635 if(MYDEBUG) MESSAGE("CutPlanes_i::BuildTableOfReal");
637 SALOMEDS::GenericAttribute_var anAttr;
638 SALOMEDS::StudyBuilder_var aStudyBuilder = GetStudyDocument()->NewBuilder();
639 anAttr = aStudyBuilder->FindOrCreateAttribute(theSObject, "AttributeTableOfReal");
640 SALOMEDS::AttributeTableOfReal_var aTableOfReal = SALOMEDS::AttributeTableOfReal::_narrow(anAttr);
642 typedef set<vtkFloatingPointType> TXCont;
643 typedef map<vtkFloatingPointType,vtkFloatingPointType> TXYMap;
644 typedef map<int,TXYMap> TXYMapCont;
645 typedef map<long,long> TLineIdCont;
647 QString aTitle( GetScalarBarTitle().c_str() );
648 aTitle = aTitle.simplifyWhiteSpace();
649 aTableOfReal->SetTitle( aTitle.latin1() );
651 int iLineEnd = myCutLinesPL->GetAppendPolyData()->GetNumberOfInputConnections(0);
652 if(MYDEBUG) MESSAGE("CutPlanes_i::BuildTableOfReal iLineEnd = "<<iLineEnd);
654 TXYMapCont aXYMapCont;
655 TLineIdCont aLineIdCont; // Define internal numeration of lines
656 const vtkFloatingPointType *aDirLn = myCutLinesPL->GetDirLn();
657 const vtkFloatingPointType *aBasePnt = myCutLinesPL->GetBasePnt();
658 const vtkFloatingPointType *aBoundPrjLn = myCutLinesPL->GetBoundPrjLn();
659 for(int iLine = 0, jLine = 0; iLine < iLineEnd; iLine++){
660 vtkDataSet *aDataSet = myCutLinesPL->GetAppendPolyData()->GetInput(iLine);
662 int aNbPoints = aDataSet->GetNumberOfPoints();
663 if(!aNbPoints) continue;
664 vtkPointData *aPointData = aDataSet->GetPointData();
665 vtkDataArray *aScalars = aPointData->GetScalars();
666 vtkCellDataToPointData *aFilter = NULL;
668 aFilter = vtkCellDataToPointData::New();
669 aFilter->SetInput(aDataSet);
670 aFilter->PassCellDataOn();
671 aDataSet = aFilter->GetOutput();
674 aPointData = aDataSet->GetPointData();
675 aScalars = aPointData->GetScalars();
676 if(!aScalars) continue;
677 if(MYDEBUG) MESSAGE("CutPlanes_i::BuildTableOfReal iLine = "<<iLine<<"; aNbPoints = "<<aNbPoints);
678 aLineIdCont[iLine] = jLine++;
679 TXYMap& aXYMap = aXYMapCont[iLine];
680 vtkFloatingPointType aPnt[3], aVect[3], aDist, aTopBnd, aDivide;
681 aTopBnd = aBoundPrjLn[2];
682 aDivide = aBoundPrjLn[2];
683 if( !IsUseAbsoluteLength() ){
688 for(int i = 0; i < aNbPoints; i++){
689 aDataSet->GetPoint(i,aPnt);
690 for(int j = 0; j < 3; j++)
691 aVect[j] = aPnt[j] - aBasePnt[j];
692 //VISU::Sub(aPnt,aBasePnt,aVect);
693 if ( fabs(aBoundPrjLn[2]) < EPS_machine )
697 aDist = vtkMath::Dot(aVect,aDirLn)/aDivide;
699 if(aDist < 0.0) aDist = 0.0;
700 if(aDist > aTopBnd) aDist = aTopBnd;
702 aXYMap[aDist] = aScalars->GetTuple1(i);
707 if(aXYMapCont.size() == 0)
708 throw std::runtime_error("CutPlanes_i::BuildTableOfReal aXYMapCont.size() == 0 !!!");
711 // Invertion all curves in the table, which has inversion flag is TRUE (see \a myMapCurvesInverted)
712 for(int iLine=0; iLine < iLineEnd; iLine++){
713 if (!IsCurveInverted(iLine)) continue;
715 TXYMap& aXYMap = aXYMapCont[iLine];
716 TXYMap::const_iterator aXYMapIter = aXYMap.begin();
717 std::list<vtkFloatingPointType> XKeys;
718 for (;aXYMapIter != aXYMap.end() ; aXYMapIter++) XKeys.push_back(aXYMapIter->first);
720 if (XKeys.size() > 1) {
721 vtkFloatingPointType a_first_indx = XKeys.front();
722 vtkFloatingPointType a_last_indx = XKeys.back();
723 if (a_first_indx > a_last_indx){
725 vtkFloatingPointType tmp = a_first_indx;
726 a_first_indx = a_last_indx;
729 std::list<vtkFloatingPointType>::const_iterator aIter = XKeys.begin();
730 for (int k=0;k<XKeys.size() && aIter != XKeys.end();k++,aIter++){
731 // Warning: value '1.0' come from workaround:
732 // see also aDist = vtkMath::Dot(aVect,aDirLn) / aBoundPrjLn[2];
733 // aDist >= 0 and aDist<=1.0
734 vtkFloatingPointType aTopBnd = aBoundPrjLn[2];
735 if( !IsUseAbsoluteLength() ){
738 aNewXYMap[aTopBnd - *aIter] = aXYMap[*aIter];
740 TXYMap::const_iterator aNewXYMapIter = aNewXYMap.begin();
742 for (;aNewXYMapIter != aNewXYMap.end();aNewXYMapIter++) {
743 aXYMap[aNewXYMapIter->first] = aNewXYMapIter->second;
748 //Resorting of theXYMap
749 TXYMapCont::iterator aXYMapContIter = aXYMapCont.begin();
750 for(; aXYMapContIter != aXYMapCont.end(); aXYMapContIter++){
751 TXYMap& aXYMap = aXYMapContIter->second, aNewXYMap;
752 if(aXYMap.size() > 2){
753 // Try to smooth the values of the line by applying linear approximation
754 TXYMap::const_iterator aXYMapIter[2] = {aXYMap.begin(), ++aXYMap.begin()};
755 aNewXYMap[aXYMapIter[0]->first] = aXYMapIter[0]->second;
756 aXCont.insert(aXYMapIter[0]->first);
757 for(; aXYMapIter[1] != aXYMap.end(); aXYMapIter[0]++, aXYMapIter[1]++){
758 vtkFloatingPointType aY[3] = {aXYMapIter[0]->second, aXYMapIter[1]->second, 0.0};
759 aY[2] = (aY[0] + aY[1])/2.0;
760 vtkFloatingPointType aX[3] = {aXYMapIter[0]->first, aXYMapIter[1]->first, 0.0};
761 aX[2] = (aX[0] + aX[1])/2.0;
762 aNewXYMap[aX[2]] = aY[2];
763 aXCont.insert(aX[2]);
765 aNewXYMap[aXYMapIter[0]->first] = aXYMapIter[0]->second;
766 aXCont.insert(aXYMapIter[0]->first);
769 TXYMap::const_iterator aXYMapIter = aXYMap.begin();
770 for(; aXYMapIter != aXYMap.end(); aXYMapIter++)
771 aXCont.insert(aXYMapIter->first);
774 if(aXCont.size() == 0)
775 throw std::runtime_error("CutPlanes_i::BuildTableOfReal aXCont.size() == 0 !!!");
777 int iEnd = aXCont.size();
778 aTableOfReal->SetNbColumns(iEnd);
779 TXCont::const_iterator aXContIter = aXCont.begin();
780 for(long i = 0; aXContIter != aXCont.end(); aXContIter++, i++){
781 vtkFloatingPointType aDist = *aXContIter;
782 aTableOfReal->PutValue(aDist,1,i+1);
783 aString.sprintf("%d",i);
784 aTableOfReal->SetColumnTitle(i+1,aString.latin1());
785 if(MYDEBUG) MESSAGE("CutPlanes_i::BuildTableOfReal aDist = "<<aDist);
786 TXYMapCont::const_iterator aXYMapContIter = aXYMapCont.begin();
787 for(; aXYMapContIter != aXYMapCont.end(); aXYMapContIter++){
788 long iLine = aXYMapContIter->first;
789 long iLineId = aLineIdCont[iLine];
790 const TXYMap& aXYMap = aXYMapCont[iLine];
791 TXYMap::const_iterator aXYMapIter = aXYMap.find(aDist);
792 // Can we find some value that belong to the line and have the same X coordinate?
793 if(aXYMapIter == aXYMap.end()) continue;
794 vtkFloatingPointType aVal = aXYMapIter->second;
795 aTableOfReal->PutValue(aVal,iLineId+2,i+1);
799 aTableOfReal->SetRowTitle(1,"X");
800 aTableOfReal->SetRowUnit(1,"-");
801 QString aUnitName = GetField()->myUnitNames[0].c_str();
802 int aScalarMode = myCutLinesPL->GetScalarMode();
804 aUnitName = GetField()->myUnitNames[aScalarMode-1].c_str();
805 aUnitName = aUnitName.simplifyWhiteSpace();
806 if(aUnitName.isEmpty()) aUnitName = "-";
807 TXYMapCont::const_iterator aXYMapContIter = aXYMapCont.begin();
808 for(; aXYMapContIter != aXYMapCont.end(); aXYMapContIter++){
809 long iLine = aXYMapContIter->first;
810 long iLineId = aLineIdCont[iLine];
811 aString.sprintf("Y%d",iLine);
813 MESSAGE("CutPlanes_i::BuildTableOfReal - SetRowTitle("<<iLineId+2<<",'"<<aString<<"')");
814 aTableOfReal->SetRowTitle(iLineId+2,aString.latin1());
815 aTableOfReal->SetRowUnit(iLineId+2,aUnitName.latin1());
818 }catch(std::exception& exc){
819 INFOS("Follow exception was occured :\n"<<exc.what());
821 INFOS("Unknown exception was occured !!!");