#include "HYDROGUI_Tool2.h"
#include "HYDROGUI_UpdateFlags.h"
+#include <HYDROGUI_OCCDisplayer.h>
+
#include <HYDROData_Bathymetry.h>
#include <LightApp_Application.h>
#include <SUIT_ViewManager.h>
#include <SVTK_ViewModel.h>
+#include <OCCViewer_ViewManager.h>
#include <QFileInfo>
#include <QSet>
#include <SUIT_MessageBox.h>
#include <SUIT_Desktop.h>
+#include <HYDROGUI_ShapeBathymetry.h>
HYDROGUI_ImportBathymetryOp::HYDROGUI_ImportBathymetryOp( HYDROGUI_Module* theModule,
return;
aPanel->reset();
+ aPanel->SetEditMode(myIsEdit);
if( myIsEdit )
{
aPanel->setFuseIntoOneOptionChecked( true );
aPanel->setObjectName( aName );
- aPanel->setFileNames( aFileNames );
+ aPanel->addFileNames( aFileNames );
aPanel->setInvertAltitudes( anIsAltitudesInverted );
aPanel->setFuseIntoOneOptionEnabled( false );
}
if (!inexistWarn.isNull())
SUIT_MessageBox::warning( module()->getApp()->desktop(),
- tr( "BATHEMETRY_IMPORT_WARNING" ), "Can't read the next files:" + inexistWarn );
+ tr( "BATHYMETRY_IMPORT_WARNING" ), "Can't read the next files:" + inexistWarn );
aFileNames = DummyFileList;
if (myEditedObject.IsNull())
return false;
QStringList anOldFileNames = myEditedObject->GetFilePaths();
- bool anIsInvertAltitudes = aPanel->isInvertAltitudes();
- myEditedObject->SetAltitudesInverted( anIsInvertAltitudes, false );
+ //bool anIsInvertAltitudes = aPanel->isInvertAltitudes();
+ //myEditedObject->SetAltitudesInverted( anIsInvertAltitudes, false );
if ( aFileNames.toSet() != anOldFileNames.toSet() )
{
- myEditedObject->SetAltitudesInverted( anIsInvertAltitudes, false );
+ myEditedObject->SetAltitudesInverted( anIsInvertAltitudes, true );
if ( !myEditedObject->ImportFromFiles( aFileNames ) )
{
theErrorMsg = tr( "BAD_IMPORTED_BATHYMETRY_FILE" ).arg( aFileNames.join("\n") );
}
}
else if ( anIsInvertAltitudes != myEditedObject->IsAltitudesInverted() )
- myEditedObject->SetAltitudesInverted( anIsInvertAltitudes );
+ myEditedObject->SetAltitudesInverted( anIsInvertAltitudes, true );
- QString aNewObjName;
- if (CheckNameExistingBathy(anObjectName, aNewObjName))
- {
- myEditedObject->SetName( aNewObjName );
- replacemWarn += "\n'" + anObjectName + "' => '" + aNewObjName + "'";
- }
- else
- myEditedObject->SetName( anObjectName );
+ myEditedObject->SetName( anObjectName );
myEditedObject->Update();
}
else
if (!UnreadFilesWarn.isNull())
SUIT_MessageBox::warning( module()->getApp()->desktop(),
- tr( "BATHEMETRY_IMPORT_WARNING" ), "The next files cannot be imported:" + UnreadFilesWarn );
+ tr( "BATHYMETRY_IMPORT_WARNING" ), "The next files cannot be imported:" + UnreadFilesWarn );
if (!replacemWarn.isNull())
SUIT_MessageBox::warning( module()->getApp()->desktop(),
- tr( "BATHEMETRY_IMPORT_WARNING" ), "The next objects names are already exist in the document; so the new objects was renamed:" + replacemWarn );
+ tr( "BATHYMETRY_IMPORT_WARNING" ), "The next objects names are already exist in the document; so the new objects was renamed:" + replacemWarn );
// Activate VTK viewer and show the bathymetry
SUIT_ViewManager* aVTKMgr = 0;
aVTKMgr = module()->getApp()->viewManager( SVTK_Viewer::Type() );
}
}
+
+ OCCViewer_ViewManager* mgr = dynamic_cast<OCCViewer_ViewManager*>(aViewMgr);
+ OCCViewer_Viewer* occ_viewer = mgr->getOCCViewer();
+ int aViewerId = (size_t)(occ_viewer);
+
+ HYDROGUI_Shape* aObjSh = module()->getObjectShape( aViewerId, myEditedObject );
+ HYDROGUI_ShapeBathymetry* aBathSh = dynamic_cast<HYDROGUI_ShapeBathymetry*>( aObjSh );
+ if (aBathSh)
+ {
+ aBathSh->update(false, false);
+ aBathSh->RescaleDefault();
+ module()->getOCCDisplayer()->UpdateColorScale( occ_viewer );
+ }
theUpdateFlags = UF_Model | UF_OCCViewer | UF_OCC_Forced |
UF_VTKViewer | UF_VTK_Forced;
if ( !aPanel )
return;
- QStringList aFileNames = aPanel->getFileNames();
- if ( !aPanel->isFuseIntoOneOptionEnabled() )
- aPanel->setFuseIntoOneOptionEnabled( !myIsEdit && aFileNames.count() > 1 );
-
- QString anObjectName = aPanel->getObjectName().simplified();
- if ( anObjectName.isEmpty() )
- {
- if (aFileNames.count() == 1)
- {
- anObjectName = aFileNames[0];
- if ( !anObjectName.isEmpty() )
- anObjectName = QFileInfo( anObjectName ).baseName();
- }
-
- if ( anObjectName.isEmpty() ) {
- anObjectName = HYDROGUI_Tool::GenerateObjectName( module(), tr( "DEFAULT_BATHYMETRY_NAME" ) );
- }
- aPanel->setObjectName( anObjectName );
- }
+ aPanel->UpdateCheckBoxStates();
}
bool HYDROGUI_ImportBathymetryOp::CheckNameExistingBathy(const QString& InpName, QString& OutputName)