//! Profile data structre constructor
HYDROGUI_GeoreferencementDlg::ProfileGeoData::ProfileGeoData(
+ const QString& theName,
const QString& theXg, const QString& theYg,
const QString& theXd, const QString& theYd)
{
+ this->Name = theName;
this->isEmpty = theXg.isEmpty() && theYg.isEmpty() &&
theXd.isEmpty() && theYd.isEmpty();
this->isIncomplete = !isEmpty;
myModeButtons->blockSignals( isBlocked );
}
-void HYDROGUI_GeoreferencementDlg::setData( const ProfilesGeoDataMap& theMap )
+void HYDROGUI_GeoreferencementDlg::setData( const ProfilesGeoDataList& theData )
{
disconnect( myTable->model(), SIGNAL( dataChanged ( const QModelIndex&, const QModelIndex& ) ),
this, SLOT( onDataChanged() ) );
myTable->setRowCount( 0 );
- foreach ( const QString& aProfileName, theMap.keys() ) {
+ foreach ( const ProfileGeoData& aGeoData, theData ) {
// Check the current profile name
- if ( aProfileName.isEmpty() ) {
+ if ( aGeoData.Name.isEmpty() ) {
continue;
}
// Get georeferencement data for the current profile
- ProfileGeoData aGeoData = theMap.value( aProfileName );
QString aXg, anYg, aXd, anYd;
if ( !aGeoData.isEmpty ) {
aXg = HYDROGUI_Tool::GetCoordinateString( aGeoData.Xg );
myTable->insertRow( aRow );
// "Profile" column
- QTableWidgetItem* aNameItem = new QTableWidgetItem( aProfileName );
+ QTableWidgetItem* aNameItem = new QTableWidgetItem( aGeoData.Name );
aNameItem->setFlags( Qt::ItemIsEnabled );
QFont aFont = aNameItem->font();
aFont.setBold( true );
this, SLOT( onDataChanged() ) );
}
-void HYDROGUI_GeoreferencementDlg::getData( ProfilesGeoDataMap& theMap )
+void HYDROGUI_GeoreferencementDlg::getData( ProfilesGeoDataList& theData ) const
{
- // Clear the map
- theMap.clear();
+ // Clear the list
+ theData.clear();
// Fill the map
bool isOk = false;
aXd = myTable->item( aRow, 3 )->text();
anYd = myTable->item( aRow, 4 )->text();
- theMap.insert( aProfileName, ProfileGeoData( aXg, anYg, aXd, anYd ) );
+ theData.append( ProfileGeoData( aProfileName, aXg, anYg, aXd, anYd ) );
}
}
bool isIncomplete, isEmpty;
+ QString Name;
+
ProfileGeoData() :
isEmpty( true ), isIncomplete( false ) {}
- ProfileGeoData( const QString& theXg, const QString& theYg,
+ ProfileGeoData( const QString& theName,
+ const QString& theXg, const QString& theYg,
const QString& theXd, const QString& theYd );
- ProfileGeoData( double theXg, double theYg,
+ ProfileGeoData( const QString& theName,
+ double theXg, double theYg,
double theXd, double theYd )
- : Xg( theXg ), Yg( theYg ), Xd( theXd ), Yd( theYd ),
+ : Name( theName), Xg( theXg ), Yg( theYg ), Xd( theXd ), Yd( theYd ),
isIncomplete(false), isEmpty(false) {}
};
- typedef QMap< QString, ProfileGeoData > ProfilesGeoDataMap;
+ typedef QList<ProfileGeoData> ProfilesGeoDataList;
public:
HYDROGUI_GeoreferencementDlg( HYDROGUI_Module* theModule, const QString& theTitle );
void setMode( const int theMode );
- void setData( const ProfilesGeoDataMap& theMap );
- void getData( ProfilesGeoDataMap& theMap );
+ void setData( const ProfilesGeoDataList& theData );
+ void getData( ProfilesGeoDataList& theData ) const;
bool isModified() const;
}
// Get georeferencement data from the panel
- HYDROGUI_GeoreferencementDlg::ProfilesGeoDataMap aGeoDataMap;
- aPanel->getData( aGeoDataMap );
-
- if ( aGeoDataMap.empty() ) {
+ HYDROGUI_GeoreferencementDlg::ProfilesGeoDataList aGeoDataList;
+ aPanel->getData( aGeoDataList );
+ if ( aGeoDataList.empty() ) {
return true;
}
// Check the data validity
- foreach ( const QString& aProfileName, aGeoDataMap.keys() ) {
- HYDROGUI_GeoreferencementDlg::ProfileGeoData aGeoData =
- aGeoDataMap.value( aProfileName );
+ foreach ( const HYDROGUI_GeoreferencementDlg::ProfileGeoData& aGeoData, aGeoDataList ) {
if ( aGeoData.isIncomplete ) {
- theErrorMsg = tr( "INCOMPLETE_DATA" ).arg( aProfileName );
+ theErrorMsg = tr( "INCOMPLETE_DATA" ).arg( aGeoData.Name );
return false;
}
}
// Store the data in the data model
- foreach ( const QString& aProfileName, aGeoDataMap.keys() ) {
+ foreach ( const HYDROGUI_GeoreferencementDlg::ProfileGeoData& aGeoData, aGeoDataList ) {
Handle(HYDROData_Profile) aProfile =
Handle(HYDROData_Profile)::DownCast(
- HYDROGUI_Tool::FindObjectByName( module(), aProfileName, KIND_PROFILE ) );
+ HYDROGUI_Tool::FindObjectByName( module(), aGeoData.Name, KIND_PROFILE ) );
if ( !aProfile.IsNull() ) {
- HYDROGUI_GeoreferencementDlg::ProfileGeoData aGeoData =
- aGeoDataMap.value( aProfileName );
if ( !aGeoData.isEmpty ) {
aProfile->SetFirstPoint( gp_XY( aGeoData.Xg, aGeoData.Yg ) );
aProfile->SetLastPoint( gp_XY( aGeoData.Xd, aGeoData.Yd ) );
}
// Get georeferencement data from the data model
- HYDROGUI_GeoreferencementDlg::ProfilesGeoDataMap aDataMap;
+ HYDROGUI_GeoreferencementDlg::ProfilesGeoDataList aData;
HYDROData_SequenceOfObjects::Iterator anIter( theProfiles );
for ( ; anIter.More(); anIter.Next() ) {
gp_XY aFirstPoint, aLastPoint;
if ( aProfile->GetFirstPoint( aFirstPoint ) && aProfile->GetLastPoint( aLastPoint ) ) {
aGeoData =
- HYDROGUI_GeoreferencementDlg::ProfileGeoData( aFirstPoint.X(), aFirstPoint.Y(),
+ HYDROGUI_GeoreferencementDlg::ProfileGeoData( aProfile->GetName(),
+ aFirstPoint.X(), aFirstPoint.Y(),
aLastPoint.X(), aLastPoint.Y() );
}
- aDataMap.insert( aProfile->GetName(), aGeoData );
+ aData.append( aGeoData );
}
// Set the collected data to the dialog
- aPanel->setData( aDataMap );
+ aPanel->setData( aData );
}
\ No newline at end of file