Salome HOME
Fix for import image: Lambert - x,y; Geodesic - grad, min, sec.
authorrkv <rkv@opencascade.com>
Wed, 6 Nov 2013 11:56:23 +0000 (11:56 +0000)
committerrkv <rkv@opencascade.com>
Wed, 6 Nov 2013 11:56:23 +0000 (11:56 +0000)
Fix for calculation case wizard when no geometry object and Next is pushed.

src/HYDROGUI/HYDROGUI_CalculationDlg.cxx
src/HYDROGUI/HYDROGUI_CalculationOp.cxx
src/HYDROGUI/HYDROGUI_ImportImageDlg.cxx
src/HYDROGUI/HYDROGUI_NameValidator.cxx

index 4b7a161738b4034221c6c6f22874360d52843f3a..6345e5f5b94f704fbacb4c469d3309c7b48878c7 100644 (file)
@@ -90,8 +90,8 @@ QWizardPage* HYDROGUI_CalculationDlg::createObjectsPage() {
   myValidator = new HYDROGUI_NameValidator(module(), myObjectName);
   myObjectName->setValidator( myValidator );
 
-  //connect( myValidator, SIGNAL( emptyName() ), SLOT( onEmptyName() ) );
-  //connect( myValidator, SIGNAL( alreadyExists( QString ) ), SLOT( onAlreadyExists( QString ) ) );
+  connect( myValidator, SIGNAL( emptyName() ), SLOT( onEmptyName() ) );
+  connect( myValidator, SIGNAL( alreadyExists( QString ) ), SLOT( onAlreadyExists( QString ) ) );
 
   myGeomObjects = new QListWidget( aPage );
   myGeomObjects->setSelectionMode( QListWidget::SingleSelection );
index 5607f4f435345d96cf037b983f7e82508c690ac1..b9089a7feb34ed047277060c737f43abaa07b027 100644 (file)
@@ -472,27 +472,30 @@ void HYDROGUI_CalculationOp::setZonesVisible( bool theIsVisible )
   HYDROData_SequenceOfObjects::Iterator aRegionsIter( aRegions );
   HYDROData_SequenceOfObjects aZones;
   Handle(HYDROData_Region) aRegion;
-  if ( OCCViewer_Viewer* aViewer = myPreviewViewManager->getOCCViewer() )
+  if ( myPreviewViewManager ) 
   {
-    Handle(AIS_InteractiveContext) aCtx = aViewer->getAISContext();
-    if ( !aCtx.IsNull() )
+    if ( OCCViewer_Viewer* aViewer = myPreviewViewManager->getOCCViewer() )
     {
-      for ( ; aRegionsIter.More(); aRegionsIter.Next() )
+      Handle(AIS_InteractiveContext) aCtx = aViewer->getAISContext();
+      if ( !aCtx.IsNull() )
       {
-        aRegion = Handle(HYDROData_Region)::DownCast( aRegionsIter.Value() );
-        if ( !aRegion.IsNull() )
+        for ( ; aRegionsIter.More(); aRegionsIter.Next() )
         {
-          aZones = aRegion->GetZones();
-          HYDROData_SequenceOfObjects::Iterator aZonesIter( aZones );
-          for ( ; aZonesIter.More(); aZonesIter.Next() )
+          aRegion = Handle(HYDROData_Region)::DownCast( aRegionsIter.Value() );
+          if ( !aRegion.IsNull() )
           {
-            if ( theIsVisible )
-            {
-              showObject( aZonesIter.Value(), aCtx );
-            }
-            else
+            aZones = aRegion->GetZones();
+            HYDROData_SequenceOfObjects::Iterator aZonesIter( aZones );
+            for ( ; aZonesIter.More(); aZonesIter.Next() )
             {
-              module()->removeObjectShape( HYDROGUI_Module::VMR_PreviewCaseZones, aZonesIter.Value() );
+              if ( theIsVisible )
+              {
+                showObject( aZonesIter.Value(), aCtx );
+              }
+              else
+              {
+                module()->removeObjectShape( HYDROGUI_Module::VMR_PreviewCaseZones, aZonesIter.Value() );
+              }
             }
           }
         }
index 7186d96e26ac3bac4fa238da812d353231de77cf..775a43bac416a6d3a002d8cf2e36110be405ebae 100644 (file)
@@ -660,15 +660,15 @@ void HYDROGUI_ImportImageDlg::onModeActivated( int theMode )
   for( int aPointType = HYDROGUI_PrsImage::PointA;
        aPointType <= HYDROGUI_PrsImage::PointC; aPointType++ )
   {
-    myPointXDegMap[ aPointType ]->setVisible( anIsManualLambert );
-    myPointYDegMap[ aPointType ]->setVisible( anIsManualLambert );
-    myPointXMinMap[ aPointType ]->setVisible( anIsManualLambert );
-    myPointYMinMap[ aPointType ]->setVisible( anIsManualLambert );
-    myPointXSecMap[ aPointType ]->setVisible( anIsManualLambert );
-    myPointYSecMap[ aPointType ]->setVisible( anIsManualLambert );
-
-    myCartPointXMap[ aPointType ]->setVisible( anIsManualCartesian );
-    myCartPointYMap[ aPointType ]->setVisible( anIsManualCartesian );
+    myPointXDegMap[ aPointType ]->setVisible( anIsManualCartesian );
+    myPointYDegMap[ aPointType ]->setVisible( anIsManualCartesian );
+    myPointXMinMap[ aPointType ]->setVisible( anIsManualCartesian );
+    myPointYMinMap[ aPointType ]->setVisible( anIsManualCartesian );
+    myPointXSecMap[ aPointType ]->setVisible( anIsManualCartesian );
+    myPointYSecMap[ aPointType ]->setVisible( anIsManualCartesian );
+
+    myCartPointXMap[ aPointType ]->setVisible( anIsManualLambert );
+    myCartPointYMap[ aPointType ]->setVisible( anIsManualLambert );
 
     myRefPointXMap[ aPointType ]->setVisible( anIsRefImage );
     myRefPointYMap[ aPointType ]->setVisible( anIsRefImage );
index 5c6630410c319a6ebcea625addae20dd851352b8..4c029fc72113daed44fa693b39c6d5b3056fbe27 100644 (file)
@@ -38,18 +38,21 @@ QValidator::State HYDROGUI_NameValidator::validate( QString & theName, int & the
   State aRes = Acceptable;
   QString aName = theName.simplified();
 
-  if ( aName.isEmpty() )
+  if( !myEditedObject.IsNull() ) // To avoid problems when myEditedObject is not set yet
   {
-    aRes = Intermediate;
-  }
-  else if( !myEditedObject.IsNull() && myEditedObject->GetName() != theName )
-  {
-    // check that there are no other objects with the same name in the document
-    Handle(HYDROData_Entity) anObject = HYDROGUI_Tool::FindObjectByName( myModule, aName );
-    if ( !anObject.IsNull() )
+    if ( aName.isEmpty() )
     {
       aRes = Intermediate;
     }
+    else if( myEditedObject->GetName() != theName )
+    {
+      // check that there are no other objects with the same name in the document
+      Handle(HYDROData_Entity) anObject = HYDROGUI_Tool::FindObjectByName( myModule, aName );
+      if ( !anObject.IsNull() )
+      {
+        aRes = Intermediate;
+      }
+    }
   }
 
   return aRes;
@@ -67,7 +70,10 @@ void HYDROGUI_NameValidator::fixup( QString & theName ) const
     emit alreadyExists( theName );
   }
 
-  theName = myEditedObject->GetName();
+  if( !myEditedObject.IsNull() )
+  {
+    theName = myEditedObject->GetName();
+  }
 }
 
 void HYDROGUI_NameValidator::setEditedObject( const Handle(HYDROData_Entity) theObj )