From e462de6222a46d226e7353f8bb91b60deadf81c2 Mon Sep 17 00:00:00 2001 From: rkv Date: Wed, 6 Nov 2013 11:56:23 +0000 Subject: [PATCH] Fix for import image: Lambert - x,y; Geodesic - grad, min, sec. Fix for calculation case wizard when no geometry object and Next is pushed. --- src/HYDROGUI/HYDROGUI_CalculationDlg.cxx | 4 +-- src/HYDROGUI/HYDROGUI_CalculationOp.cxx | 33 +++++++++++++----------- src/HYDROGUI/HYDROGUI_ImportImageDlg.cxx | 18 ++++++------- src/HYDROGUI/HYDROGUI_NameValidator.cxx | 24 ++++++++++------- 4 files changed, 44 insertions(+), 35 deletions(-) diff --git a/src/HYDROGUI/HYDROGUI_CalculationDlg.cxx b/src/HYDROGUI/HYDROGUI_CalculationDlg.cxx index 4b7a1617..6345e5f5 100644 --- a/src/HYDROGUI/HYDROGUI_CalculationDlg.cxx +++ b/src/HYDROGUI/HYDROGUI_CalculationDlg.cxx @@ -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 ); diff --git a/src/HYDROGUI/HYDROGUI_CalculationOp.cxx b/src/HYDROGUI/HYDROGUI_CalculationOp.cxx index 5607f4f4..b9089a7f 100644 --- a/src/HYDROGUI/HYDROGUI_CalculationOp.cxx +++ b/src/HYDROGUI/HYDROGUI_CalculationOp.cxx @@ -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() ); + } } } } diff --git a/src/HYDROGUI/HYDROGUI_ImportImageDlg.cxx b/src/HYDROGUI/HYDROGUI_ImportImageDlg.cxx index 7186d96e..775a43ba 100644 --- a/src/HYDROGUI/HYDROGUI_ImportImageDlg.cxx +++ b/src/HYDROGUI/HYDROGUI_ImportImageDlg.cxx @@ -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 ); diff --git a/src/HYDROGUI/HYDROGUI_NameValidator.cxx b/src/HYDROGUI/HYDROGUI_NameValidator.cxx index 5c663041..4c029fc7 100644 --- a/src/HYDROGUI/HYDROGUI_NameValidator.cxx +++ b/src/HYDROGUI/HYDROGUI_NameValidator.cxx @@ -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 ) -- 2.39.2