* Gets the number of cut lines.
*/
long GetNbLines();
+
+ /*! Invert all curves of corresponding table
+ * \param theInvert - Invert all curves, if value is TRUE, else not.
+ */
+ void SetAllCurvesInverted(in boolean theInvert);
+
+ /*! Checks the orientation of all curves
+ * \retval TRUE - if all curves are inverted, else FALSE
+ */
+ boolean IsAllCurvesInverted();
+
+ /*! Sets values which cutlines would be shown: aboslute or relative values
+ * \param theAbsLength - boolean value, TRUE or false.
+ */
+ void SetUseAbsoluteLength(in boolean theAbsLength);
+
+ /*! Checks values of cutlines: using aboslute or relative values
+ */
+ boolean IsUseAbsoluteLength();
};
/*! \brief Interface of the stream lines representation
<parameter name="name" value="Post-Pro"/>
<parameter name="icon" value="ModuleVisu.png"/>
<!-- Other module preferences -->
+ <parameter name="show_preview" value="false"/>
+ <parameter name="invert_all_curves" value="false"/>
+ <parameter name="use_absolute_length" value="false"/>
+ <parameter name="generate_data_table" value="true"/>
+ <parameter name="generate_curves" value="true"/>
<parameter name="use_build_progress" value="false"/>
<parameter name="full_med_loading" value="false"/>
<parameter name="mesh_represent" value="2"/>
msgid "VISU_NB_STEPS"
msgstr "Number of steps"
+msgid "VISU_CUTLINE_PREF"
+msgstr "CutLine preferences"
+
msgid "VISU_PREF_MED_IMPORT"
msgstr "MED files import"
msgid "VisuGUI_CutLinesDlg::LBL_INVERT_CURVES"
msgstr "Invert all curves"
+msgid "VisuGUI_CutLinesDlg::LBL_ABSOLUTE_LENGTH"
+msgstr "Use absolute length"
+
msgid "VisuGUI_CutLinesDlg::LBL_GENERATE_CURVES"
msgstr "Generate Curves"
msgstr "Plot3D"
msgid "VISU_SCALAR_MAP_ON_DEFORMED_SHAPE"
-msgstr "Scalar Map on Def. Shape"
\ No newline at end of file
+msgstr "Scalar Map on Def. Shape"
setPreferenceProperty( nbcycles, "max", 100 );
setPreferenceProperty( nbsteps, "max", 200 );
+ // group: "CutLines preferences"
+ int cutLineTab = addPreference( tr( "CutLines" ) );
+ int cutLineGr = addPreference( tr( "VISU_CUTLINE_PREF" ), cutLineTab );
+ setPreferenceProperty( cutLineGr, "columns", 1 );
+ addPreference( tr( "Show preview" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "show_preview" );
+ addPreference( tr( "Invert all curves" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "invert_all_curves" );
+ addPreference( tr( "Use absolute length" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "use_absolute_length" );
+ addPreference( tr( "Generate data table" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "generate_data_table" );
+ addPreference( tr( "Generate curves" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "generate_curves" );
+
// group: "MED files import"
int importGr = addPreference( tr( "MED files import" ), srangeTab );
setPreferenceProperty( importGr, "columns", 1 );
using namespace std;
-bool VisuGUI_CutLinesDlg::MYGenerateTable = true;
-bool VisuGUI_CutLinesDlg::MYGenerateCurve = true;
-
VisuGUI_CutLinesDlg::VisuGUI_CutLinesDlg (SalomeApp_Module* theModule)
: QDialog(VISU::GetDesktop(theModule), "VisuGUI_CutLinesDlg", false,
WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu),
myAllCurvesInvertedCheck->setChecked(false);
aPlaneLayout->addWidget(myAllCurvesInvertedCheck);
+ myUseAbsoluteLengthCheck = new QCheckBox(tr("LBL_ABSOLUTE_LENGTH"), aPlanePane);
+ myUseAbsoluteLengthCheck->setChecked(false);
+ aPlaneLayout->addWidget(myUseAbsoluteLengthCheck);
+
myCreateTable = new QCheckBox (tr("LBL_GENERATE_TABLE"), aPlanePane);
- myCreateTable->setChecked(MYGenerateTable);
+ myCreateTable->setChecked(true);
aPlaneLayout->addWidget( myCreateTable );
QHBox* aCheckPane = new QHBox(aPlanePane);
aCheckPane->setStretchFactor(aLbl, 0);
myCurvesCheck = new QCheckBox(tr("LBL_GENERATE_CURVES"), aCheckPane);
aCheckPane->setStretchFactor(aCheckPane, 0);
- myCurvesCheck->setChecked(MYGenerateCurve);
- myCurvesCheck->setEnabled(MYGenerateTable);
+ myCurvesCheck->setChecked(true);
+ myCurvesCheck->setEnabled(true);
QLabel* aLbl2 = new QLabel(" ", aCheckPane);
aCheckPane->setStretchFactor(aLbl2, 1);
aPlaneLayout->addWidget( aCheckPane );
myPrs = thePrs;
myScalarPane->initFromPrsObject(thePrs);
+ SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
+ myPreviewCheck->setChecked( aResourceMgr->booleanValue("VISU", "show_preview", false) );
+ myCreateTable->setChecked( aResourceMgr->booleanValue("VISU", "generate_data_table", true) );
+ myCurvesCheck->setChecked( aResourceMgr->booleanValue("VISU", "generate_curves", true) );
+ myCurvesCheck->setEnabled( aResourceMgr->booleanValue("VISU", "generate_curves", true) );
+
myRotXSpn->setValue(thePrs->GetRotateX()*180./PI);
myRotYSpn->setValue(thePrs->GetRotateY()*180./PI);
myPosSpn->setValue(thePrs->GetDisplacement());
hasInit = true;
myCutLines = new VISU::CutLines_i(thePrs->GetResult(),false);
myCutLines->SameAs(thePrs);
- myCutLines->CopyCurvesInverted(thePrs->GetCurvesInverted());
- if (myCutLines->IsAllCurvesInverted()) myAllCurvesInvertedCheck->setChecked(true);
+ myAllCurvesInvertedCheck->setChecked(myCutLines->IsAllCurvesInverted());
+ myUseAbsoluteLengthCheck->setChecked(myCutLines->IsUseAbsoluteLength());
myBasePlanePos->setText( QString::number(myCutLines->GetBasePlanePosition()) );
myCBSetDef->setChecked(thePrs->IsDefault());
DrawTable();
}
if (myAllCurvesInvertedCheck->isChecked())
thePrs->SetAllCurvesInverted(true);
+
+ thePrs->SetUseAbsoluteLength(myUseAbsoluteLengthCheck->isChecked());
return 1;
}
void VisuGUI_CutLinesDlg::accept()
{
- //if ( !VisuGUI::CheckActiveStudyLock() ) {
- // reject();
- // return;
- //}
- MYGenerateTable = myCreateTable->isChecked();
- MYGenerateCurve = myCurvesCheck->isChecked();
- // if (myScalarPane->check()) {
- /*jfa tmp:((QWidget*)sender())->setDisabled(true);
- storeToPrsObject(myPrs);
- if (myIsCreation) {
- if (isGenerateTable()) {
- visuGUI->GetVisuGen()->CreateTable(myPrs->GetEntry());
- if (isGenerateCurves()) {
- SALOMEDSClient_Study* aStudy = study()->studyDS();
- SALOMEDSClient_SObject* aSObject = aStudy->FindObjectID(myPrs->GetEntry());
- if( aSObject ) {
- SALOMEDSClient_ChildIterator* aIter = aStudy->NewChildIterator( aSObject );
- SALOMEDSClient_StudyBuilder* aBuilder = aStudy->NewBuilder();
- for ( ;aIter->More(); aIter->Next()) {
- SALOMEDSClient_SObject* aTblObj = aIter->Value();
- if ( aTblObj ) {
- SALOMEDSClient_GenericAttribute* anAttr;
- if (aTblObj->FindAttribute(anAttr, "AttributeName")) {
- visuGUI->CreatePlot(aTblObj);
- }
- }
- }
- }
- }
- }
- if (GET_VTK_VIEWWINDOW(myMgr)) {
- try {
- visuGUI->CreateActor(myPrs);
- } catch (...) {
- reject();
- return;
- }
- GET_VTK_VIEWWINDOW(myMgr)->onFitAll();
- }
- } else {
- visuGUI->RecreateActor(myPrs);
- if (VTKViewer_ViewWindow* vf = GET_VTK_VIEWWINDOW(myMgr)) {
- if (vf->getRenderer()->GetActors()->GetNumberOfItems() > 0) {
- vf->getRenderer()->ResetCameraClippingRange();
- vf->Repaint();
- }
- }
- // Remove old Table
- SALOMEDSClient_Study* aStudy = study()->studyDS();
- SALOMEDSClient_SObject* aSObject = aStudy->FindObjectID(myPrs->GetEntry());
- if( aSObject ) {
- SALOMEDSClient_ChildIterator* aIter = aStudy->NewChildIterator( aSObject );
- SALOMEDSClient_StudyBuilder* aBuilder = aStudy->NewBuilder();
- for ( ;aIter->More(); aIter->Next()) {
- SALOMEDSClient_SObject* aTblObj = aIter->Value();
- if ( aTblObj ) {
- SALOMEDSClient_GenericAttribute* anAttr;
- if (aTblObj->FindAttribute(anAttr, "AttributeName")) {
- aBuilder->RemoveObjectWithChildren(aIter->Value()); // We should have only one child
- break;
- }
- }
- }
- if (isGenerateTable()) {
- visuGUI->GetVisuGen()->CreateTable(aSObject->GetID().c_str());
- if (isGenerateCurves()) {
- SALOMEDSClient_Study* aStudy = study()->studyDS();
- SALOMEDSClient_ChildIterator* aIter = aStudy->NewChildIterator( aSObject );
- SALOMEDSClient_StudyBuilder* aBuilder = aStudy->NewBuilder();
- for ( ;aIter->More(); aIter->Next()) {
- SALOMEDSClient_SObject* aTblObj = aIter->Value();
- if ( aTblObj ) {
- SALOMEDSClient_GenericAttribute* anAttr;
- if (aTblObj->FindAttribute(anAttr, "AttributeName")) {
- visuGUI->CreatePlot(aTblObj);
- }
- }
- }
- }
- }
- }
- }
- VisuGUI::application()->objectBrowser()->updateTree();*/
myScalarPane->deletePreview();
deletePlanes();
QDialog::accept();
- // }
}
void VisuGUI_CutLinesDlg::reject()
SALOME_Actor* myPreviewActorGlyphs;
QCheckBox* myPreviewCheck;
QCheckBox* myAllCurvesInvertedCheck;
+ QCheckBox* myUseAbsoluteLengthCheck;
VISU::CutLines_i* myPrs;
Prs3d_i(theResult,theAddToStudy),
ColoredPrs3d_i(theResult,theAddToStudy),
ScalarMap_i(theResult,theAddToStudy),
- myCutLinesPL(NULL)
+ myCutLinesPL(NULL),
+ myUseAbsLength(false)
{}
Prs3d_i(theResult,theSObject),
ColoredPrs3d_i(theResult,theSObject),
ScalarMap_i(theResult,theSObject),
- myCutLinesPL(NULL)
+ myCutLinesPL(NULL),
+ myUseAbsLength(false)
{
}
VISU::Storable* VISU::CutLines_i::Create(const char* theMeshName, VISU::Entity theEntity,
const char* theFieldName, int theIteration)
{
- return ScalarMap_i::Create(theMeshName,theEntity,theFieldName,theIteration);
+ TSuperClass::Create(theMeshName,theEntity,theFieldName,theIteration);
+ SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
+ SetAllCurvesInverted( aResourceMgr->booleanValue("VISU", "invert_all_curves", false) );
+ SetUseAbsoluteLength( aResourceMgr->booleanValue("VISU", "use_absolute_length", false) );
+
+ return this;
}
SetOrientation2(CutPlanes::Orientation(VISU::Storable::FindValue(theMap,"myBasePlane[1]").toInt()),
Storable::FindValue(theMap,"aRot[1][0]").toDouble(),
Storable::FindValue(theMap,"aRot[1][1]").toDouble());
+ SetUseAbsoluteLength(VISU::Storable::FindValue(theMap,"myUseAbsLength").toInt());
+
if (VISU::Storable::FindValue(theMap,"myBasePlaneCondition").toInt())
SetDefault();
else
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,"myUseAbsLength", IsUseAbsoluteLength());
// Storing the map - \a myMapCurvesInverted
QString aStrCurvesInverted;
myMapCurvesInverted[theCurveNumber] = theInvert;
}
+/*! It control the way the length of cutlines is shown: using aboslute or relative values
+* \param theAbsLength - boolean value, TRUE or false.
+*/
+void VISU::CutLines_i::SetUseAbsoluteLength(CORBA::Boolean theAbsLength){
+ myUseAbsLength = theAbsLength;
+}
+
/*! Checks orientation of curve.
* \param theCurveNumber - integer value, number of cut line.
* \retval TRUE - if line in the table is inverted, else FALSE.
if(MYDEBUG) MESSAGE("CutPlanes_i::BuildTableOfReal iLine = "<<iLine<<"; aNbPoints = "<<aNbPoints);
aLineIdCont[iLine] = jLine++;
TXYMap& aXYMap = aXYMapCont[iLine];
- vtkFloatingPointType aPnt[3], aVect[3], aDist;
+ vtkFloatingPointType aPnt[3], aVect[3], aDist, aTopBnd;
+ aTopBnd = aBoundPrjLn[2];
+ if( !IsUseAbsoluteLength() ){
+ aTopBnd = 1.0;
+ }
for(int i = 0; i < aNbPoints; i++){
aDataSet->GetPoint(i,aPnt);
Sub(aPnt,aBasePnt,aVect);
aDist = 0.5;
else
{
- aDist = vtkMath::Dot(aVect,aDirLn) / aBoundPrjLn[2];
+ aDist = vtkMath::Dot(aVect,aDirLn)/aTopBnd;
// the workaround
if(aDist < 0.0) aDist = 0.0;
- if(aDist > 1.0) aDist = 1.0;
+ if(aDist > aTopBnd) aDist = aTopBnd;
}
aXYMap[aDist] = aScalars->GetTuple1(i);
}
INFOS("Unknown exception was occured !!!");
}
}
+
+void VISU::CutLines_i::SameAs(const Prs3d_i* theOrigin){
+ TSuperClass::SameAs(theOrigin);
+ if(const CutLines_i* aPrs3d = dynamic_cast<const CutLines_i*>(theOrigin)){
+ CutLines_i* anOrigin = const_cast<CutLines_i*>(aPrs3d);
+ myUseAbsLength = anOrigin->IsUseAbsoluteLength();
+ CopyCurvesInverted(anOrigin->GetCurvesInverted());
+ }
+}
+
virtual void SetCurveInverted(CORBA::Long theCurveNumber,CORBA::Boolean theInvert);
virtual CORBA::Boolean IsCurveInverted(CORBA::Long theCurveNumber);
+ virtual void SetUseAbsoluteLength(CORBA::Boolean theAbsLength);
+ virtual CORBA::Boolean IsUseAbsoluteLength() {return myUseAbsLength;}
+
virtual void SetNbLines(CORBA::Long theNb);
virtual CORBA::Long GetNbLines();
typedef VISU::CutLines TInterface;
VISU_CutLinesPL *myCutLinesPL;
TCurvesInv myMapCurvesInverted;
+ CORBA::Boolean myUseAbsLength;
public:
static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
virtual void ToStream(std::ostringstream& theStr);
virtual Storable* Restore(const Storable::TRestoringMap& theMap);
+ virtual void SameAs( const Prs3d_i* Origin );
virtual
VISU_Actor*