-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2012 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.
//
-// 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.
//
-// 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
//
-// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
// VISU VISUGUI : GUI of VISU component
// File : VisuGUI_DeformedShapeAndScalarMapDlg.cxx
// Author : Eugeny Nikolaev
#include "VISU_Convertor.hxx"
-#include <QtxDoubleSpinBox.h>
+#include <SalomeApp_DoubleSpinBox.h>
#include <SalomeApp_Module.h>
#include <LightApp_Application.h>
#include <LightApp_SelectionMgr.h>
#include <SUIT_Desktop.h>
-#include <SUIT_ResourceMgr.h>
#include <SUIT_Session.h>
#include <SUIT_MessageBox.h>
QLabel* ScaleLabel = new QLabel (tr("SCALE_FACTOR"), TopGroup);
TopGroupLayout->addWidget(ScaleLabel, 0, 0);
- SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
- int aPrecision = aResourceMgr->integerValue( "VISU", "floating_point_precision", 0 );
-
- ScalFact = new QtxDoubleSpinBox (0, 1.0E+38, 0.1, aPrecision*(-1), 32, TopGroup);
+ ScalFact = new SalomeApp_DoubleSpinBox (TopGroup);
+ VISU::initSpinBox( ScalFact, 0., 1.0E+38, .1, "visual_data_precision" );
ScalFact->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
ScalFact->setValue(0.1);
TopGroupLayout->addWidget(ScalFact, 0, 1);
}
void VisuGUI_DeformedShapeAndScalarMapDlg::initFromPrsObject( VISU::ColoredPrs3d_i* thePrs,
- bool theInit )
+ bool theInit )
{
if( theInit )
myPrsCopy = VISU::TSameAsFactory<VISU::TDEFORMEDSHAPEANDSCALARMAP>().Create(thePrs, VISU::ColoredPrs3d_i::EDoNotPublish);
CORBA::String_var aFieldName(myPrsCopy->GetScalarFieldName());
QString aIteration = GetFloatValueOfTimeStamp(myPrsCopy->GetScalarEntity(),
- aFieldName.in(),
- myPrsCopy->GetScalarTimeStampNumber());
+ aFieldName.in(),
+ myPrsCopy->GetScalarTimeStampNumber());
if (myEntity2Fields.size() == 0)
{
// find all fields and time stamps on it
if (selected.Extent() > 0) {
Handle(SALOME_InteractiveObject) aIO = selected.First();
if (aIO->hasEntry()) {
- _PTR(SObject) aSObject = aActiveStudy->FindObjectID(aIO->getEntry());
- VISU::VISUType aType = VISU::Storable::SObject2Type( aSObject );
- switch(aType){
- case VISU::TTIMESTAMP: {
- aSObject = aSObject->GetFather();
- aSObject = aSObject->GetFather();
- break;
- }
- case VISU::TFIELD: {
- _PTR(SObject) newSObject;
- if(aSObject->ReferencedObject(newSObject)) aSObject = newSObject;
- aSObject = aSObject->GetFather();
- break;
- }
- case VISU::TANIMATION: {
- _PTR(ChildIterator) aTmpIter = aActiveStudy->NewChildIterator(aSObject);
- for (aTmpIter->InitEx(true); aTmpIter->More(); aTmpIter->Next()) {
- _PTR(SObject) aTmpChildSObj = aTmpIter->Value();
- _PTR(SObject) newSObject;
- if(aTmpChildSObj->ReferencedObject(newSObject)){
- aSObject = newSObject;
- aSObject->GetFather();
- break;
- }
- }
- break;
- }}
-
- aSObject = aSObject->GetFather();
- aSObject = aSObject->GetFather();
-
- mySelectionObj = aSObject;
- CORBA::Object_var anObject = VISU::ClientSObjectToObject(mySelectionObj);
- if (CORBA::is_nil(anObject)) {
- mySelectionObj = mySelectionObj->GetFather();
- }
+ _PTR(SObject) aSObject = aActiveStudy->FindObjectID(aIO->getEntry());
+ VISU::VISUType aType = VISU::Storable::SObject2Type( aSObject );
+ switch(aType){
+ case VISU::TTIMESTAMP: {
+ aSObject = aSObject->GetFather();
+ aSObject = aSObject->GetFather();
+ break;
+ }
+ case VISU::TFIELD: {
+ _PTR(SObject) newSObject;
+ if(aSObject->ReferencedObject(newSObject)) aSObject = newSObject;
+ aSObject = aSObject->GetFather();
+ break;
+ }
+ case VISU::TANIMATION: {
+ _PTR(ChildIterator) aTmpIter = aActiveStudy->NewChildIterator(aSObject);
+ for (aTmpIter->InitEx(true); aTmpIter->More(); aTmpIter->Next()) {
+ _PTR(SObject) aTmpChildSObj = aTmpIter->Value();
+ _PTR(SObject) newSObject;
+ if(aTmpChildSObj->ReferencedObject(newSObject)){
+ aSObject = newSObject;
+ aSObject->GetFather();
+ break;
+ }
+ }
+ break;
+ }}
+
+ aSObject = aSObject->GetFather();
+ aSObject = aSObject->GetFather();
+
+ mySelectionObj = aSObject;
+ CORBA::Object_var anObject = VISU::ClientSObjectToObject(mySelectionObj);
+ if (CORBA::is_nil(anObject)) {
+ mySelectionObj = mySelectionObj->GetFather();
+ }
}
}
for (aIter->InitEx(true); aIter->More(); aIter->Next()) {
_PTR(SObject) aChildSObj = aIter->Value();
- VISU::Storable::TRestoringMap aRestoringMap = VISU::Storable::GetStorableMap(aChildSObj);
+ VISU::Storable::TRestoringMap aRestoringMap = VISU::Storable::GetStorableMap(aChildSObj);
if (!aRestoringMap.empty()) {
- VISU::VISUType aType = VISU::Storable::RestoringMap2Type(aRestoringMap);
- if (aType == VISU::TTIMESTAMP) {
- QString aMeshName = aRestoringMap["myMeshName"];
- CORBA::String_var aName = myPrsCopy->GetMeshName();
- if (aMeshName != aName.in())
- continue;
- QString aFieldName = aRestoringMap["myFieldName"];
- QString aTimeIter = aRestoringMap["myTimeStampId"];
- QString aEntity = aRestoringMap["myEntityId"];
- VISU::Entity anEntity;
- switch (aEntity.toInt()) {
- case 0: anEntity = VISU::NODE; break;
- case 1: anEntity = VISU::EDGE; break;
- case 2: anEntity = VISU::FACE; break;
- case 3: anEntity = VISU::CELL; break;
- }
- TFieldName2TimeStamps& aFieldName2TimeStamps = myEntity2Fields[anEntity];
- TTimeStampNumber2Time& aTimeStampNumber2Time = aFieldName2TimeStamps[aFieldName];
- aTimeStampNumber2Time[aTimeIter.toInt()] =
- GetFloatValueOfTimeStamp(anEntity,
- aFieldName.toLatin1().constData(),
- aTimeIter.toInt());
- }
+ VISU::VISUType aType = VISU::Storable::RestoringMap2Type(aRestoringMap);
+ if (aType == VISU::TTIMESTAMP) {
+ QString aMeshName = aRestoringMap["myMeshName"];
+ CORBA::String_var aName = myPrsCopy->GetMeshName();
+ if (aMeshName != aName.in())
+ continue;
+ QString aFieldName = aRestoringMap["myFieldName"];
+ QString aTimeIter = aRestoringMap["myTimeStampId"];
+ QString aEntity = aRestoringMap["myEntityId"];
+ VISU::Entity anEntity;
+ switch (aEntity.toInt()) {
+ case 0: anEntity = VISU::NODE; break;
+ case 1: anEntity = VISU::EDGE; break;
+ case 2: anEntity = VISU::FACE; break;
+ case 3: anEntity = VISU::CELL; break;
+ }
+ TFieldName2TimeStamps& aFieldName2TimeStamps = myEntity2Fields[anEntity];
+ TTimeStampNumber2Time& aTimeStampNumber2Time = aFieldName2TimeStamps[aFieldName];
+ aTimeStampNumber2Time[aTimeIter.toInt()] =
+ GetFloatValueOfTimeStamp(anEntity,
+ aFieldName.toLatin1().constData(),
+ aTimeIter.toInt());
+ }
}
}
}
myPrsCopy->SetScale(getFactor());
myPrsCopy->SetScalarField(myPrsCopy->GetScalarEntity(),
- getCurrentScalarFieldName().toLatin1().constData(),
- myTimeStampID[ myTimeStampsCombo->currentIndex() ]);
+ getCurrentScalarFieldName().toLatin1().constData(),
+ myTimeStampID[ myTimeStampsCombo->currentIndex() ]);
if(myUpdateScalars)
SetScalarField( false );
for(; aFieldIter != aFieldName2TimeStamps.end(); aFieldIter++){
const QString& aFieldName = aFieldIter->first;
if (aFieldName == myFieldsCombo->currentText()) {
- anEntity = anIter->first;
- break;
+ anEntity = anIter->first;
+ break;
}
}
}
void
VisuGUI_DeformedShapeAndScalarMapDlg
::SetScalarField(int theIter,
- QString theFieldName,
- const bool save_scalar_pane )
+ QString theFieldName,
+ const bool save_scalar_pane )
{
QApplication::setOverrideCursor(Qt::WaitCursor);
try {
myPrsCopy->SetScalarField(anEntity,
- aFieldName.toLatin1().constData(),
- theIter);
+ aFieldName.toLatin1().constData(),
+ theIter);
if( save_scalar_pane )
UpdateScalarField();
myIsScalarFieldValid = true;
for(; aFieldIter != aFieldName2TimeStamps.end(); aFieldIter++){
const QString& aFieldName = aFieldIter->first;
if(theFieldName != aFieldName)
- continue;
+ continue;
myTimeStampID.clear();
myTimeStampsCombo->clear();
const TTimeStampNumber2Time& aTimeStampNumber2Time = aFieldIter->second;
TTimeStampNumber2Time::const_iterator aTimeStampIter = aTimeStampNumber2Time.begin();
for(; aTimeStampIter != aTimeStampNumber2Time.end(); aTimeStampIter++){
- int aTimeStampNumber = aTimeStampIter->first;
- myTimeStampID.push_back(aTimeStampNumber);
+ int aTimeStampNumber = aTimeStampIter->first;
+ myTimeStampID.push_back(aTimeStampNumber);
- QString aTimeStampTime = aTimeStampIter->second;
- myTimeStampsCombo->addItem(aTimeStampTime);
+ QString aTimeStampTime = aTimeStampIter->second;
+ myTimeStampsCombo->addItem(aTimeStampTime);
}
if(currentTimeStampId >= myTimeStampID.size())
currentTimeStampId = myTimeStampID.size()-1;
QString
VisuGUI_DeformedShapeAndScalarMapDlg
::GetFloatValueOfTimeStamp(VISU::Entity theEntity,
- const std::string& theFieldName,
- int theTimeStampNumber)
+ const std::string& theFieldName,
+ int theTimeStampNumber)
{
QString aTime("");
VISU::TEntity anEntity = VISU::TEntity(theEntity);
VISU::Result_i* theResult = myPrsCopy->GetCResult();
VISU::Result_i::PInput anInput = theResult->GetInput();
VISU::PField aField = anInput->GetField(myPrsCopy->GetCMeshName(),
- anEntity,
- theFieldName);
+ anEntity,
+ theFieldName);
if(!aField)
return aTime;