-// VISU OBJECT : interactive object for VISU entities implementation
+// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+// VISU OBJECT : interactive object for VISU entities implementation
// File : VISU_PrsObject_i.cxx
// Author : Alexey PETROV
// Module : VISU
-
-#include "VISU_CutLinesPL.hxx"
-#include "VISU_Result_i.hh"
+//
#include "VISU_CutLines_i.hh"
-#include "VISU_Actor.h"
+#include "VISU_Prs3dUtils.hh"
+#include "VISU_Result_i.hh"
+#include "VISU_Actor.h"
+#include "VISU_CutLinesPL.hxx"
+#include "VISU_Convertor.hxx"
#include "VISU_PipeLineUtils.hxx"
-#include <vtkAppendPolyData.h>
+#include "SUIT_ResourceMgr.h"
+#include "SALOME_Event.h"
-using namespace VISU;
-using namespace std;
+#include <vtkAppendPolyData.h>
#ifdef _DEBUG_
static int MYDEBUG = 0;
static int MYDEBUG = 0;
#endif
-int VISU::CutLines_i::IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
- const char* theFieldName, int theIteration, int isMemoryCheck)
+using namespace std;
+
+//---------------------------------------------------------------
+size_t
+VISU::CutLines_i
+::IsPossible(Result_i* theResult,
+ const std::string& theMeshName,
+ VISU::Entity theEntity,
+ const std::string& theFieldName,
+ CORBA::Long theTimeStampNumber,
+ bool theIsMemoryCheck)
{
- return VISU::ScalarMap_i::IsPossible(theResult,theMeshName,theEntity,theFieldName,theIteration,isMemoryCheck);
+ return TSuperClass::IsPossible(theResult,
+ theMeshName,
+ theEntity,
+ theFieldName,
+ theTimeStampNumber,
+ theIsMemoryCheck);
}
+//---------------------------------------------------------------
int VISU::CutLines_i::myNbPresent = 0;
-QString VISU::CutLines_i::GenerateName() { return VISU::GenerateName("CutLines",myNbPresent++);}
+//---------------------------------------------------------------
+QString
+VISU::CutLines_i::GenerateName()
+{
+ return VISU::GenerateName("CutLines",myNbPresent++);
+}
+
+//---------------------------------------------------------------
const string VISU::CutLines_i::myComment = "CUTLINES";
-const char* VISU::CutLines_i::GetComment() const { return myComment.c_str();}
+//---------------------------------------------------------------
+const char*
+VISU::CutLines_i
+::GetComment() const
+{
+ return myComment.c_str();
+}
-VISU::CutLines_i::CutLines_i(Result_i* theResult, bool theAddToStudy, SALOMEDS::SObject_ptr theSObject) :
- PrsObject_i(theResult->GetStudyDocument()),
- Prs3d_i(theResult,theSObject),
- ScalarMap_i(theResult,theAddToStudy,theSObject)
+//----------------------------------------------------------------------------
+const char*
+VISU::CutLines_i
+::GetIconName()
{
- myCutLinesPL = NULL;
+ if (!IsGroupsUsed())
+ return "ICON_TREE_CUT_LINES";
+ else
+ return "ICON_TREE_CUT_LINES_GROUPS";
}
+//---------------------------------------------------------------
+VISU::CutLines_i::
+CutLines_i(EPublishInStudyMode thePublishInStudyMode) :
+ ColoredPrs3d_i(thePublishInStudyMode),
+ ScalarMap_i(thePublishInStudyMode),
+ CutLinesBase_i(thePublishInStudyMode),
+ myCutLinesPL(NULL)
+{}
-void VISU::CutLines_i::SameAs(const CutLines_i* theOrigin){
- VISU::ScalarMap_i::SameAs(theOrigin);
+//---------------------------------------------------------------
+void
+VISU::CutLines_i
+::SameAs(const Prs3d_i* theOrigin)
+{
+ TSuperClass::SameAs(theOrigin);
}
-VISU::Storable* VISU::CutLines_i::Create(const char* theMeshName, VISU::Entity theEntity,
- const char* theFieldName, int theIteration)
+//---------------------------------------------------------------
+VISU::Storable*
+VISU::CutLines_i
+::Create(const std::string& theMeshName,
+ VISU::Entity theEntity,
+ const std::string& theFieldName,
+ CORBA::Long theTimeStampNumber)
{
- return ScalarMap_i::Create(theMeshName,theEntity,theFieldName,theIteration);
+ return TSuperClass::Create(theMeshName,theEntity,theFieldName,theTimeStampNumber);
}
-VISU::Storable* VISU::CutLines_i::Restore(const Storable::TRestoringMap& theMap)
+//---------------------------------------------------------------
+VISU::Storable*
+VISU::CutLines_i
+::Restore(SALOMEDS::SObject_ptr theSObject,
+ const Storable::TRestoringMap& theMap)
{
- DoHook();
- SetNbLines(VISU::Storable::FindValue(theMap,"myNbLines").toInt());
+ if(!TSuperClass::Restore(theSObject, theMap))
+ return NULL;
+
SetDisplacement(VISU::Storable::FindValue(theMap,"myDisplacement[0]").toDouble());
SetDisplacement2(VISU::Storable::FindValue(theMap,"myDisplacement[1]").toDouble());
SetOrientation(CutPlanes::Orientation(VISU::Storable::FindValue(theMap,"myBasePlane[0]").toInt()),
SetOrientation2(CutPlanes::Orientation(VISU::Storable::FindValue(theMap,"myBasePlane[1]").toInt()),
Storable::FindValue(theMap,"aRot[1][0]").toDouble(),
Storable::FindValue(theMap,"aRot[1][1]").toDouble());
+
if (VISU::Storable::FindValue(theMap,"myBasePlaneCondition").toInt())
SetDefault();
else
SetBasePlanePosition(VISU::Storable::FindValue(theMap,"myBasePlanePosition").toDouble());
- QStringList aPosList = QStringList::split("|",VISU::Storable::FindValue(theMap,"myLinePosition") );
- QStringList aCondList = QStringList::split("|",VISU::Storable::FindValue(theMap,"myLineCondition") );
+ QStringList aPosList = VISU::Storable::FindValue(theMap,"myLinePosition").split("|", QString::SkipEmptyParts );
+ QStringList aCondList = VISU::Storable::FindValue(theMap,"myLineCondition").split("|",QString::SkipEmptyParts );
for(int i = 0, iEnd = GetNbLines(); i < iEnd; i++)
if(aCondList[i].toInt() == 0)
SetLinePosition(i,aPosList[i].toDouble());
- return ScalarMap_i::Restore(theMap);
+ return this;
}
-void VISU::CutLines_i::ToStream(std::ostringstream& theStr){
- ScalarMap_i::ToStream(theStr);
+//---------------------------------------------------------------
+void
+VISU::CutLines_i
+::ToStream(std::ostringstream& theStr)
+{
+ TSuperClass::ToStream(theStr);
- int aNbLines = GetNbLines();
-
- Storable::DataToStream( theStr, "myNbLines", aNbLines );
Storable::DataToStream( theStr, "myDisplacement[0]", GetDisplacement() );
Storable::DataToStream( theStr, "myDisplacement[1]", GetDisplacement2() );
Storable::DataToStream( theStr, "myBasePlane[0]", int(GetOrientationType()) );
aStrPos.append(QString::number(GetLinePosition(i)) + "|");
aStrCon.append(QString::number(IsDefaultPosition(i)) + "|");
}
- Storable::DataToStream( theStr, "myLinePosition", aStrPos.latin1());
- Storable::DataToStream( theStr, "myLineCondition", aStrCon.latin1());
+
+ Storable::DataToStream( theStr, "myLinePosition", (const char*)aStrPos.toLatin1());
+ Storable::DataToStream( theStr, "myLineCondition", (const char*)aStrCon.toLatin1());
}
-VISU::CutLines_i::~CutLines_i(){
+
+//---------------------------------------------------------------
+VISU::CutLines_i
+::~CutLines_i()
+{
if(MYDEBUG) MESSAGE("CutLines_i::~CutLines_i()");
}
-void VISU::CutLines_i::SetOrientation(VISU::CutPlanes::Orientation theOrient,
- CORBA::Double theXAngle, CORBA::Double theYAngle)
+//---------------------------------------------------------------
+void
+VISU::CutLines_i
+::SetOrientation(VISU::CutPlanes::Orientation theOrient,
+ CORBA::Double theXAngle,
+ CORBA::Double theYAngle)
{
- myCutLinesPL->SetOrientation(VISU_CutPlanesPL::PlaneOrientation(theOrient),
- theXAngle,theYAngle);
+ struct TEvent: public SALOME_Event
+ {
+ VISU_CutLinesPL* myCutLinesPL;
+ CORBA::Double myXAngle, myYAngle;
+ VISU::CutPlanes::Orientation myOrient;
+ TEvent(VISU_CutLinesPL* theCutLines,
+ VISU::CutPlanes::Orientation theOrient,
+ CORBA::Double theXAngle,
+ CORBA::Double theYAngle):
+ myCutLinesPL(theCutLines),
+ myOrient(theOrient),
+ myXAngle(theXAngle),
+ myYAngle(theYAngle)
+ {}
+
+ virtual
+ void
+ Execute()
+ {
+ myCutLinesPL->SetOrientation(VISU_CutPlanesPL::PlaneOrientation(myOrient),
+ myXAngle,
+ myYAngle);
+ }
+ };
+
+ VISU::TSetModified aModified(this);
+
+ ProcessVoidEvent(new TEvent(myCutLinesPL, theOrient, theXAngle, theYAngle));
}
-void VISU::CutLines_i::SetOrientation2(VISU::CutPlanes::Orientation theOrient,
- CORBA::Double theXAngle, CORBA::Double theYAngle)
+
+//---------------------------------------------------------------
+void
+VISU::CutLines_i
+::SetOrientation2(VISU::CutPlanes::Orientation theOrient,
+ CORBA::Double theXAngle,
+ CORBA::Double theYAngle)
{
- myCutLinesPL->SetOrientation(VISU_CutPlanesPL::PlaneOrientation(theOrient),
- theXAngle,theYAngle,1);
+ struct TEvent: public SALOME_Event
+ {
+ VISU_CutLinesPL* myCutLinesPL;
+ CORBA::Double myXAngle, myYAngle;
+ VISU::CutPlanes::Orientation myOrient;
+ TEvent(VISU_CutLinesPL* theCutLines,
+ VISU::CutPlanes::Orientation theOrient,
+ CORBA::Double theXAngle,
+ CORBA::Double theYAngle):
+ myCutLinesPL(theCutLines),
+ myOrient(theOrient),
+ myXAngle(theXAngle),
+ myYAngle(theYAngle)
+ {}
+
+ virtual
+ void
+ Execute()
+ {
+ myCutLinesPL->SetOrientation(VISU_CutPlanesPL::PlaneOrientation(myOrient),
+ myXAngle,
+ myYAngle,
+ 1);
+ }
+ };
+
+ VISU::TSetModified aModified(this);
+
+ ProcessVoidEvent(new TEvent(myCutLinesPL, theOrient, theXAngle, theYAngle));
}
-VISU::CutPlanes::Orientation VISU::CutLines_i::GetOrientationType() {
+//---------------------------------------------------------------
+VISU::CutPlanes::Orientation
+VISU::CutLines_i
+::GetOrientationType()
+{
return VISU::CutPlanes::Orientation(myCutLinesPL->GetPlaneOrientation());
}
-VISU::CutPlanes::Orientation VISU::CutLines_i::GetOrientationType2() {
+
+//---------------------------------------------------------------
+VISU::CutPlanes::Orientation
+VISU::CutLines_i
+::GetOrientationType2()
+{
return VISU::CutPlanes::Orientation(myCutLinesPL->GetPlaneOrientation(1));
}
-CORBA::Double VISU::CutLines_i::GetRotateX(){
+//---------------------------------------------------------------
+CORBA::Double
+VISU::CutLines_i
+::GetRotateX()
+{
return myCutLinesPL->GetRotateX();
}
-CORBA::Double VISU::CutLines_i::GetRotateY(){
+
+//---------------------------------------------------------------
+CORBA::Double
+VISU::CutLines_i
+::GetRotateY()
+{
return myCutLinesPL->GetRotateY();
}
-CORBA::Double VISU::CutLines_i::GetRotateX2(){
+
+//---------------------------------------------------------------
+CORBA::Double
+VISU::CutLines_i
+::GetRotateX2()
+{
return myCutLinesPL->GetRotateX(1);
}
-CORBA::Double VISU::CutLines_i::GetRotateY2(){
+
+//---------------------------------------------------------------
+CORBA::Double
+VISU::CutLines_i
+::GetRotateY2()
+{
return myCutLinesPL->GetRotateY(1);
}
-void VISU::CutLines_i::SetDisplacement(CORBA::Double theDisp) {
- myCutLinesPL->SetDisplacement(theDisp);
+//---------------------------------------------------------------
+void
+VISU::CutLines_i
+::SetDisplacement(CORBA::Double theDisp)
+{
+ VISU::TSetModified aModified(this);
+
+ ProcessVoidEvent(new TVoidMemFun2ArgEvent<VISU_CutLinesPL, double, int>
+ (GetSpecificPL(), &VISU_CutLinesPL::SetDisplacement, theDisp, 0));
}
-void VISU::CutLines_i::SetDisplacement2(CORBA::Double theDisp) {
- myCutLinesPL->SetDisplacement(theDisp,1);
+
+//---------------------------------------------------------------
+void
+VISU::CutLines_i
+::SetDisplacement2(CORBA::Double theDisp)
+{
+ VISU::TSetModified aModified(this);
+
+ ProcessVoidEvent(new TVoidMemFun2ArgEvent<VISU_CutLinesPL, double, int>
+ (GetSpecificPL(), &VISU_CutLinesPL::SetDisplacement, theDisp, 1));
}
-CORBA::Double VISU::CutLines_i::GetDisplacement() {
+
+//---------------------------------------------------------------
+CORBA::Double
+VISU::CutLines_i
+::GetDisplacement()
+{
return myCutLinesPL->GetDisplacement();
}
-CORBA::Double VISU::CutLines_i::GetDisplacement2() {
+
+//---------------------------------------------------------------
+CORBA::Double
+VISU::CutLines_i
+::GetDisplacement2()
+{
return myCutLinesPL->GetDisplacement(1);
}
-void VISU::CutLines_i::SetBasePlanePosition(CORBA::Double thePlanePosition){
- myCutLinesPL->SetPosition(thePlanePosition);
+//---------------------------------------------------------------
+void
+VISU::CutLines_i
+::SetBasePlanePosition(CORBA::Double thePlanePosition)
+{
+ VISU::TSetModified aModified(this);
+
+ ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_CutLinesPL, double>
+ (GetSpecificPL(), &VISU_CutLinesPL::SetPosition, thePlanePosition));
}
-CORBA::Double VISU::CutLines_i::GetBasePlanePosition(){
+//---------------------------------------------------------------
+CORBA::Double
+VISU::CutLines_i
+::GetBasePlanePosition()
+{
return myCutLinesPL->GetPosition();
}
-void VISU::CutLines_i::SetLinePosition(CORBA::Long thePlaneNumber, CORBA::Double thePlanePosition){
- myCutLinesPL->SetPartPosition(thePlaneNumber,thePlanePosition);
+//---------------------------------------------------------------
+void
+VISU::CutLines_i
+::SetLinePosition(CORBA::Long thePlaneNumber,
+ CORBA::Double thePlanePosition)
+{
+ VISU::TSetModified aModified(this);
+
+ ProcessVoidEvent(new TVoidMemFun2ArgEvent<VISU_CutLinesPL, int, double>
+ (GetSpecificPL(), &VISU_CutLinesPL::SetPartPosition, thePlaneNumber, thePlanePosition));
}
-CORBA::Double VISU::CutLines_i::GetLinePosition(CORBA::Long thePlaneNumber){
+//---------------------------------------------------------------
+CORBA::Double
+VISU::CutLines_i
+::GetLinePosition(CORBA::Long thePlaneNumber)
+{
return myCutLinesPL->GetPartPosition(thePlaneNumber,1);
}
-void VISU::CutLines_i::SetDefault(){
- myCutLinesPL->SetDefault();
+//---------------------------------------------------------------
+void
+VISU::CutLines_i
+::SetDefault()
+{
+ VISU::TSetModified aModified(this);
+
+ ProcessVoidEvent(new TVoidMemFunEvent<VISU_CutLinesPL>
+ (GetSpecificPL(), &VISU_CutLinesPL::SetDefault));
}
-CORBA::Boolean VISU::CutLines_i::IsDefault(){
+//---------------------------------------------------------------
+CORBA::Boolean
+VISU::CutLines_i
+::IsDefault()
+{
return myCutLinesPL->IsDefault();
}
-void VISU::CutLines_i::SetDefaultPosition(CORBA::Long thePlaneNumber){
- myCutLinesPL->SetPartDefault(thePlaneNumber);
+//---------------------------------------------------------------
+void
+VISU::CutLines_i
+::SetDefaultPosition(CORBA::Long thePlaneNumber)
+{
+ VISU::TSetModified aModified(this);
+
+ ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_CutLinesPL, int>
+ (GetSpecificPL(), &VISU_CutLinesPL::SetPartDefault, thePlaneNumber));
}
-CORBA::Boolean VISU::CutLines_i::IsDefaultPosition(CORBA::Long thePlaneNumber){
+//---------------------------------------------------------------
+CORBA::Boolean
+VISU::CutLines_i
+::IsDefaultPosition(CORBA::Long thePlaneNumber)
+{
return myCutLinesPL->IsPartDefault(thePlaneNumber);
}
+//---------------------------------------------------------------
+void
+VISU::CutLines_i
+::CreatePipeLine(VISU_PipeLine* thePipeLine)
+{
+ if(!thePipeLine){
+ myCutLinesPL = VISU_CutLinesPL::New();
+ }else
+ myCutLinesPL = dynamic_cast<VISU_CutLinesPL*>(thePipeLine);
-void VISU::CutLines_i::SetNbLines(CORBA::Long theNb) {
- myCutLinesPL->SetNbParts(theNb);
-}
-CORBA::Long VISU::CutLines_i::GetNbLines() {
- return myCutLinesPL->GetNbParts();
-}
-
-
-void VISU::CutLines_i::DoHook(){
- if(!myPipeLine) myPipeLine = VISU_CutLinesPL::New();
- myCutLinesPL = dynamic_cast<VISU_CutLinesPL*>(myPipeLine);
-
- ScalarMap_i::DoHook();
-}
-
-void VISU::CutLines_i::BuildTableOfReal(SALOMEDS::SObject_ptr theSObject){
- try{
- if(MYDEBUG) MESSAGE("CutPlanes_i::BuildTableOfReal");
- Update();
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder();
- anAttr = aStudyBuilder->FindOrCreateAttribute(theSObject, "AttributeTableOfReal");
- SALOMEDS::AttributeTableOfReal_var aTableOfReal = SALOMEDS::AttributeTableOfReal::_narrow(anAttr);
-
- typedef set<float> TXCont;
- typedef map<float,float> TXYMap;
- typedef map<int,TXYMap> TXYMapCont;
- typedef map<long,long> TLineIdCont;
-
- QString aTitle;
- aTitle.sprintf("%s",myTitle.c_str());
- aTitle = aTitle.simplifyWhiteSpace();
- aTableOfReal->SetTitle(aTitle.latin1());
-
- int iLineEnd = myCutLinesPL->GetAppendPolyData()->GetNumberOfInputs();
- if(MYDEBUG) MESSAGE("CutPlanes_i::BuildTableOfReal iLineEnd = "<<iLineEnd);
- TXCont aXCont;
- TXYMapCont aXYMapCont;
- TLineIdCont aLineIdCont; // Define internal numeration of lines
- const float *aDirLn = myCutLinesPL->GetDirLn();
- const float *aBasePnt = myCutLinesPL->GetBasePnt();
- const float *aBoundPrjLn = myCutLinesPL->GetBoundPrjLn();
- for(int iLine = 0, jLine = 0; iLine < iLineEnd; iLine++){
- vtkDataSet *aDataSet = myCutLinesPL->GetAppendPolyData()->GetInput(iLine);
- aDataSet->Update();
- int aNbPoints = aDataSet->GetNumberOfPoints();
- if(!aNbPoints) continue;
- vtkPointData *aPointData = aDataSet->GetPointData();
- vtkDataArray *aScalars = aPointData->GetScalars();
- vtkCellDataToPointData *aFilter = NULL;
- if(!aScalars) {
- aFilter = vtkCellDataToPointData::New();
- aFilter->SetInput(aDataSet);
- aFilter->PassCellDataOn();
- aDataSet = aFilter->GetOutput();
- aDataSet->Update();
- }
- aPointData = aDataSet->GetPointData();
- aScalars = aPointData->GetScalars();
- if(!aScalars) continue;
- if(MYDEBUG) MESSAGE("CutPlanes_i::BuildTableOfReal iLine = "<<iLine<<"; aNbPoints = "<<aNbPoints);
- aLineIdCont[iLine] = jLine++;
- TXYMap& aXYMap = aXYMapCont[iLine];
- float aPnt[3], aVect[3], aDist;
- for(int i = 0; i < aNbPoints; i++){
- aDataSet->GetPoint(i,aPnt);
- Sub(aPnt,aBasePnt,aVect);
- aDist = vtkMath::Dot(aVect,aDirLn) / aBoundPrjLn[2];
- // the workaround
- if(aDist < 0.0) aDist = 0.0;
- if(aDist > 1.0) aDist = 1.0;
- aXYMap[aDist] = aScalars->GetTuple1(i);
- }
- if(aFilter){
- aFilter->UnRegisterAllOutputs();
- aFilter->Delete();
- }
- }
- if(aXYMapCont.size() == 0)
- throw std::runtime_error("CutPlanes_i::BuildTableOfReal aXYMapCont.size() == 0 !!!");
- //Resorting of theXYMap
- TXYMapCont::iterator aXYMapContIter = aXYMapCont.begin();
- 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]++){
- float aY[3] = {aXYMapIter[0]->second, aXYMapIter[1]->second, 0.0};
- aY[2] = (aY[0] + aY[1])/2.0;
- float 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);
- }
- }
- if(aXCont.size() == 0)
- throw std::runtime_error("CutPlanes_i::BuildTableOfReal aXCont.size() == 0 !!!");
- QString aString;
- int iEnd = aXCont.size();
- aTableOfReal->SetNbColumns(iEnd);
- TXCont::const_iterator aXContIter = aXCont.begin();
- for(long i = 0; aXContIter != aXCont.end(); aXContIter++, i++){
- float aDist = *aXContIter;
- aTableOfReal->PutValue(aDist,1,i+1);
- aString.sprintf("%d",i);
- aTableOfReal->SetColumnTitle(i+1,aString.latin1());
- 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;
- float aVal = aXYMapIter->second;
- aTableOfReal->PutValue(aVal,iLineId+2,i+1);
- }
- }
- {
- aTableOfReal->SetRowTitle(1,"X");
- aTableOfReal->SetRowUnit(1,"-");
- QString aUnitName = myField->myUnitNames[0].c_str();
- int aScalarMode = myCutLinesPL->GetScalarMode();
- if(aScalarMode != 0)
- aUnitName = myField->myUnitNames[aScalarMode-1].c_str();
- aUnitName = aUnitName.simplifyWhiteSpace();
- 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<<",'"<<aString<<"')");
- aTableOfReal->SetRowTitle(iLineId+2,aString.latin1());
- aTableOfReal->SetRowUnit(iLineId+2,aUnitName.latin1());
- }
- }
- }catch(std::exception& exc){
- INFOS("Follow exception was occured :\n"<<exc.what());
- }catch (...){
- INFOS("Unknown exception was occured !!!");
+ TSuperClass::CreatePipeLine(myCutLinesPL);
+}
+
+
+//----------------------------------------------------------------------------
+bool
+VISU::CutLines_i
+::CheckIsPossible()
+{
+ return IsPossible(GetCResult(),GetCMeshName(),GetEntity(),GetCFieldName(),GetTimeStampNumber(),true);
+}
+
+
+//---------------------------------------------------------------
+VISU_Actor*
+VISU::CutLines_i
+::CreateActor()
+{
+ if(VISU_Actor* anActor = TSuperClass::CreateActor()){
+ anActor->SetVTKMapping(true);
+ SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
+ int aDispMode = aResourceMgr->integerValue("VISU" , "cut_lines_represent", 2);
+ anActor->SetRepresentation(aDispMode);
+ return anActor;
}
+ return NULL;
}