vtkDataArray *aScalars = aPointData->GetScalars();
vtkCellDataToPointData *aFilter = NULL;
if(!aScalars) {
- aFilter = vtkCellDataToPointData::New();
- aFilter->SetInput(aDataSet);
- aFilter->PassCellDataOn();
- aDataSet = aFilter->GetOutput();
- aDataSet->Update();
+ aFilter = vtkCellDataToPointData::New();
+ aFilter->SetInput(aDataSet);
+ aFilter->PassCellDataOn();
+ aDataSet = aFilter->GetOutput();
+ aDataSet->Update();
}
aPointData = aDataSet->GetPointData();
aScalars = aPointData->GetScalars();
else aDivide = 1.0;
for(int i = 0; i < aNbPoints; i++){
- aDataSet->GetPoint(i,aPnt);
+ aDataSet->GetPoint(i,aPnt);
for(int j = 0; j < 3; j++)
aVect[j] = aPnt[j] - aBasePnt[j];
- //VISU::Sub(aPnt,aBasePnt,aVect);
- if ( fabs(aBoundPrjLn[2]) < EPS_machine )
- aDist = 0.5;
- else
- {
- aDist = vtkMath::Dot(aVect,aDirLn)/aDivide;
- // the workaround
- if(aDist < 0.0) aDist = 0.0;
- if(aDist > aTopBnd) aDist = aTopBnd;
- }
- aXYMap[aDist] = aScalars->GetTuple1(i);
+ //VISU::Sub(aPnt,aBasePnt,aVect);
+ if ( fabs(aBoundPrjLn[2]) < EPS_machine )
+ aDist = 0.5;
+ else
+ {
+ aDist = vtkMath::Dot(aVect,aDirLn)/aDivide;
+ // the workaround
+ if(aDist < 0.0) aDist = 0.0;
+ if(aDist > aTopBnd) aDist = aTopBnd;
+ }
+ aXYMap[aDist] = aScalars->GetTuple1(i);
}
if(aFilter)
- aFilter->Delete();
+ aFilter->Delete();
}
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<vtkFloatingPointType> XKeys;
- for (;aXYMapIter != aXYMap.end() ; aXYMapIter++) XKeys.push_back(aXYMapIter->first);
- XKeys.sort();
- if (XKeys.size() > 1) {
- vtkFloatingPointType a_first_indx = XKeys.front();
- vtkFloatingPointType a_last_indx = XKeys.back();
- if (a_first_indx > a_last_indx){
- XKeys.reverse();
- vtkFloatingPointType tmp = a_first_indx;
- a_first_indx = a_last_indx;
- a_last_indx = tmp;
- }
- std::list<vtkFloatingPointType>::const_iterator aIter = XKeys.begin();
- for (int k=0;k<XKeys.size() && 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
- vtkFloatingPointType aTopBnd = aBoundPrjLn[2];
- if( !IsUseAbsoluteLength() ){
- aTopBnd = 1.0;
- }
- aNewXYMap[aTopBnd - *aIter] = aXYMap[*aIter];
- }
- TXYMap::const_iterator aNewXYMapIter = aNewXYMap.begin();
- aXYMap.clear();
- for (;aNewXYMapIter != aNewXYMap.end();aNewXYMapIter++) {
- aXYMap[aNewXYMapIter->first] = aNewXYMapIter->second;
- }
- }
+ if (!IsCurveInverted(iLine)) continue;
+ TXYMap aNewXYMap;
+ TXYMap& aXYMap = aXYMapCont[iLine];
+ TXYMap::const_iterator aXYMapIter = aXYMap.begin();
+ std::list<vtkFloatingPointType> XKeys;
+ for (;aXYMapIter != aXYMap.end() ; aXYMapIter++) XKeys.push_back(aXYMapIter->first);
+ XKeys.sort();
+ if (XKeys.size() > 1) {
+ vtkFloatingPointType a_first_indx = XKeys.front();
+ vtkFloatingPointType a_last_indx = XKeys.back();
+ if (a_first_indx > a_last_indx){
+ XKeys.reverse();
+ vtkFloatingPointType tmp = a_first_indx;
+ a_first_indx = a_last_indx;
+ a_last_indx = tmp;
+ }
+ std::list<vtkFloatingPointType>::const_iterator aIter = XKeys.begin();
+ for (int k=0;k<XKeys.size() && 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
+ vtkFloatingPointType aTopBnd = aBoundPrjLn[2];
+ if( !IsUseAbsoluteLength() ){
+ aTopBnd = 1.0;
+ }
+ aNewXYMap[aTopBnd - *aIter] = aXYMap[*aIter];
+ }
+ TXYMap::const_iterator aNewXYMapIter = aNewXYMap.begin();
+ aXYMap.clear();
+ for (;aNewXYMapIter != aNewXYMap.end();aNewXYMapIter++) {
+ aXYMap[aNewXYMapIter->first] = aNewXYMapIter->second;
+ }
+ }
}
}
//Resorting of theXYMap
for(; aXYMapContIter != aXYMapCont.end(); aXYMapContIter++){
TXYMap& aXYMap = aXYMapContIter->second, aNewXYMap;
if(aXYMap.size() > 2){
- // Try to smooth the values of the line by applying linear approximation
- TXYMap::const_iterator aXYMapIter[2] = {aXYMap.begin(), ++aXYMap.begin()};
- aNewXYMap[aXYMapIter[0]->first] = aXYMapIter[0]->second;
- aXCont.insert(aXYMapIter[0]->first);
- for(; aXYMapIter[1] != aXYMap.end(); aXYMapIter[0]++, aXYMapIter[1]++){
- vtkFloatingPointType aY[3] = {aXYMapIter[0]->second, aXYMapIter[1]->second, 0.0};
- aY[2] = (aY[0] + aY[1])/2.0;
- vtkFloatingPointType aX[3] = {aXYMapIter[0]->first, aXYMapIter[1]->first, 0.0};
- aX[2] = (aX[0] + aX[1])/2.0;
- aNewXYMap[aX[2]] = aY[2];
- aXCont.insert(aX[2]);
- }
- aNewXYMap[aXYMapIter[0]->first] = aXYMapIter[0]->second;
- aXCont.insert(aXYMapIter[0]->first);
- aXYMap = aNewXYMap;
+ // Try to smooth the values of the line by applying linear approximation
+ TXYMap::const_iterator aXYMapIter[2] = {aXYMap.begin(), ++aXYMap.begin()};
+ aNewXYMap[aXYMapIter[0]->first] = aXYMapIter[0]->second;
+ aXCont.insert(aXYMapIter[0]->first);
+ for(; aXYMapIter[1] != aXYMap.end(); aXYMapIter[0]++, aXYMapIter[1]++){
+ vtkFloatingPointType aY[3] = {aXYMapIter[0]->second, aXYMapIter[1]->second, 0.0};
+ aY[2] = (aY[0] + aY[1])/2.0;
+ vtkFloatingPointType aX[3] = {aXYMapIter[0]->first, aXYMapIter[1]->first, 0.0};
+ aX[2] = (aX[0] + aX[1])/2.0;
+ aNewXYMap[aX[2]] = aY[2];
+ aXCont.insert(aX[2]);
+ }
+ aNewXYMap[aXYMapIter[0]->first] = aXYMapIter[0]->second;
+ aXCont.insert(aXYMapIter[0]->first);
+ aXYMap = aNewXYMap;
}else{
- TXYMap::const_iterator aXYMapIter = aXYMap.begin();
- for(; aXYMapIter != aXYMap.end(); aXYMapIter++)
- aXCont.insert(aXYMapIter->first);
+ TXYMap::const_iterator aXYMapIter = aXYMap.begin();
+ for(; aXYMapIter != aXYMap.end(); aXYMapIter++)
+ aXCont.insert(aXYMapIter->first);
}
}
if(aXCont.size() == 0)
if(MYDEBUG) MESSAGE("CutPlanes_i::BuildTableOfReal aDist = "<<aDist);
TXYMapCont::const_iterator aXYMapContIter = aXYMapCont.begin();
for(; aXYMapContIter != aXYMapCont.end(); aXYMapContIter++){
- long iLine = aXYMapContIter->first;
- long iLineId = aLineIdCont[iLine];
- const TXYMap& aXYMap = aXYMapCont[iLine];
- TXYMap::const_iterator aXYMapIter = aXYMap.find(aDist);
- // Can we find some value that belong to the line and have the same X coordinate?
- if(aXYMapIter == aXYMap.end()) continue;
- vtkFloatingPointType aVal = aXYMapIter->second;
- aTableOfReal->PutValue(aVal,iLineId+2,i+1);
+ long iLine = aXYMapContIter->first;
+ long iLineId = aLineIdCont[iLine];
+ const TXYMap& aXYMap = aXYMapCont[iLine];
+ TXYMap::const_iterator aXYMapIter = aXYMap.find(aDist);
+ // Can we find some value that belong to the line and have the same X coordinate?
+ if(aXYMapIter == aXYMap.end()) continue;
+ vtkFloatingPointType aVal = aXYMapIter->second;
+ aTableOfReal->PutValue(aVal,iLineId+2,i+1);
}
}
{
QString aUnitName = GetField()->myUnitNames[0].c_str();
int aScalarMode = myCutLinesBasePL->GetScalarMode();
if(aScalarMode != 0)
- aUnitName = GetField()->myUnitNames[aScalarMode-1].c_str();
+ aUnitName = GetField()->myUnitNames[aScalarMode-1].c_str();
aUnitName = aUnitName.simplified();
if(aUnitName.isEmpty()) aUnitName = "-";
TXYMapCont::const_iterator aXYMapContIter = aXYMapCont.begin();
for(; aXYMapContIter != aXYMapCont.end(); aXYMapContIter++){
- long iLine = aXYMapContIter->first;
- long iLineId = aLineIdCont[iLine];
- aString.sprintf("Y%d",iLine);
- if(MYDEBUG)
- MESSAGE("CutPlanes_i::BuildTableOfReal - SetRowTitle("<<iLineId+2<<",'"<<(const char*)aString.toLatin1()<<"')");
- aTableOfReal->SetRowTitle(iLineId+2,(const char*)aString.toLatin1());
- aTableOfReal->SetRowUnit(iLineId+2,(const char*)aUnitName.toLatin1());
+ long iLine = aXYMapContIter->first;
+ long iLineId = aLineIdCont[iLine];
+ aString.sprintf("Y%d",iLine);
+ if(MYDEBUG)
+ MESSAGE("CutPlanes_i::BuildTableOfReal - SetRowTitle("<<iLineId+2<<",'"<<(const char*)aString.toLatin1()<<"')");
+ aTableOfReal->SetRowTitle(iLineId+2,(const char*)aString.toLatin1());
+ aTableOfReal->SetRowUnit(iLineId+2,(const char*)aUnitName.toLatin1());
}
}
}catch(std::exception& exc){