+
+void HYDROGUI_GeoreferencementOp::onUpdateSelection()
+{
+ // Get the selected profiles
+ HYDROData_SequenceOfObjects aSeqOfProfiles =
+ HYDROGUI_Tool::GetSelectedObjects( module() );
+
+ // Set them to the dialog
+ setPanelData( aSeqOfProfiles );
+}
+
+void HYDROGUI_GeoreferencementOp::setPanelData(
+ const HYDROData_SequenceOfObjects& theProfiles )
+{
+ // Get the panel
+ HYDROGUI_GeoreferencementDlg* aPanel =
+ ::qobject_cast<HYDROGUI_GeoreferencementDlg*>( inputPanel() );
+ if ( !aPanel ) {
+ return;
+ }
+
+ // Get georeferencement data from the data model
+ HYDROGUI_GeoreferencementDlg::ProfilesGeoDataList aData;
+
+ HYDROData_SequenceOfObjects::Iterator anIter( theProfiles );
+ for ( ; anIter.More(); anIter.Next() ) {
+ Handle(HYDROData_Profile) aProfile =
+ Handle(HYDROData_Profile)::DownCast( anIter.Value() );
+ if ( aProfile.IsNull() ) {
+ continue;
+ }
+
+ HYDROGUI_GeoreferencementDlg::ProfileGeoData aGeoData( aProfile->GetName() );
+
+ gp_XY aFirstPoint, aLastPoint;
+ if ( aProfile->GetLeftPoint( aFirstPoint ) && aProfile->GetRightPoint( aLastPoint ) ) {
+ aGeoData =
+ HYDROGUI_GeoreferencementDlg::ProfileGeoData( aGeoData.Name,
+ aFirstPoint.X(), aFirstPoint.Y(),
+ aLastPoint.X(), aLastPoint.Y() );
+ }
+
+ aData.append( aGeoData );
+ }
+
+ // Set the collected data to the dialog
+ aPanel->setData( aData );
+}
\ No newline at end of file