From: ouv Date: Fri, 4 Oct 2013 07:43:56 +0000 (+0000) Subject: Debug. X-Git-Tag: BR_hydro_v_0_3~98 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=754600d998f99ee604193e739f852a8b6f04031b;p=modules%2Fhydro.git Debug. 1) Fixed crash on the creation of the second polyline. 2) Canceled creation of preview OCC view for Create/edit zone operation. 3) Temporary fix to avoid blinking of coincident zones in OCC view. --- diff --git a/src/HYDROGUI/HYDROGUI_AISCurve.cxx b/src/HYDROGUI/HYDROGUI_AISCurve.cxx index c8366ebc..75d90586 100755 --- a/src/HYDROGUI/HYDROGUI_AISCurve.cxx +++ b/src/HYDROGUI/HYDROGUI_AISCurve.cxx @@ -106,7 +106,7 @@ void HYDROGUI_AISCurveSection::buildSection() if( aSectSize > 1 ) { - HYDROOperations_BSpline aBSpline( aPoints, aSectIsClosed ); + HYDROOperations_BSpline aBSpline( aPoints, 0, aSectIsClosed ); TopoDS_Edge anEdge = BRepBuilderAPI_MakeEdge( aBSpline.Curve() ).Edge(); TopoDS_Wire aWire = BRepBuilderAPI_MakeWire( anEdge ).Wire(); @@ -174,6 +174,7 @@ HYDROGUI_AISCurve::HYDROGUI_AISCurve( CurveCreator_Curve* theCurve, Handle_AIS_I HYDROGUI_AISCurve::~HYDROGUI_AISCurve(void) { + myCurve->removeListener(); } void HYDROGUI_AISCurve::setCurve( CurveCreator_Curve* theCurve ) diff --git a/src/HYDROGUI/HYDROGUI_Module.h b/src/HYDROGUI/HYDROGUI_Module.h index 0f0ac148..14c366a9 100644 --- a/src/HYDROGUI/HYDROGUI_Module.h +++ b/src/HYDROGUI/HYDROGUI_Module.h @@ -53,9 +53,15 @@ class HYDROGUI_Module : public LightApp_Module public: - enum ViewManagerRole { VMR_Unknown = 0, VMR_General, - VMR_TransformImage, VMR_ObserveImage, - VMR_PreviewZone, VMR_PreviewCaseZones }; + enum ViewManagerRole + { + VMR_Unknown = 0, + VMR_General, + VMR_TransformImage, + VMR_ObserveImage, + //VMR_PreviewZone, // totally unused, to delete + VMR_PreviewCaseZones // actually unused, to review + }; typedef QPair< SUIT_ViewManager*, ViewManagerRole > ViewManagerInfo; typedef QMap < int, ViewManagerInfo > ViewManagerMap; diff --git a/src/HYDROGUI/HYDROGUI_PolylineOp.cxx b/src/HYDROGUI/HYDROGUI_PolylineOp.cxx index 2aa8ccac..b1fc1e85 100755 --- a/src/HYDROGUI/HYDROGUI_PolylineOp.cxx +++ b/src/HYDROGUI/HYDROGUI_PolylineOp.cxx @@ -43,6 +43,10 @@ #include +#include + +static int ZValueIncrement = 0; + HYDROGUI_PolylineOp::HYDROGUI_PolylineOp( HYDROGUI_Module* theModule, bool theIsEdit ) : HYDROGUI_Operation( theModule ), myIsEdit(theIsEdit), myCurve(NULL), myViewManager(NULL), myAISCurve(NULL) @@ -57,7 +61,11 @@ HYDROGUI_PolylineOp::~HYDROGUI_PolylineOp() void HYDROGUI_PolylineOp::startOperation() { - CurveCreator_Curve* anOldCurve = myCurve; + if( myCurve ) + { + delete myCurve; + myCurve = 0; + } HYDROGUI_Operation::startOperation(); @@ -99,10 +107,10 @@ void HYDROGUI_PolylineOp::startOperation() aPanel->setPolylineName(aNewName); } aPanel->setCurve(myCurve); + if( myAISCurve ) myAISCurve->setCurve(myCurve); - if( anOldCurve ) - delete anOldCurve; + displayPreview(); } @@ -144,6 +152,9 @@ bool HYDROGUI_PolylineOp::processApply( int& theUpdateFlags, } else{ aPolylineObj = Handle(HYDROData_Polyline)::DownCast( aDocument->CreateObject( KIND_POLYLINE ) ); + + double aZValue = double( ++ZValueIncrement ) * 1e-2; // empiric value, to be revised + aPolylineObj->SetZValue( aZValue ); } if( aPolylineObj.IsNull() ) diff --git a/src/HYDROGUI/HYDROGUI_ZoneOp.cxx b/src/HYDROGUI/HYDROGUI_ZoneOp.cxx index 216904b6..e6daf5f8 100644 --- a/src/HYDROGUI/HYDROGUI_ZoneOp.cxx +++ b/src/HYDROGUI/HYDROGUI_ZoneOp.cxx @@ -45,8 +45,7 @@ HYDROGUI_ZoneOp::HYDROGUI_ZoneOp( HYDROGUI_Module* theModule, const bool theIsEdit ) : HYDROGUI_Operation( theModule ), myIsEdit( theIsEdit ), - myActiveViewManager( 0 ), - myPreviewViewManager( 0 ), + myViewManager( 0 ), myPreviewPrs( 0 ) { setName( theIsEdit ? tr( "EDIT_ZONE" ) : tr( "CREATE_ZONE" ) ); @@ -272,36 +271,21 @@ void HYDROGUI_ZoneOp::onCreatePreview( const QString& thePolylineName ) } LightApp_Application* anApp = module()->getApp(); + if ( !myViewManager ) + myViewManager = ::qobject_cast( + anApp->getViewManager( OCCViewer_Viewer::Type(), true ) ); - if ( !myActiveViewManager ) + if ( myViewManager && !myPreviewPrs ) { - myActiveViewManager = anApp->activeViewManager(); - } - - if ( !myPreviewViewManager ) - { - myPreviewViewManager = ::qobject_cast( - anApp->createViewManager( OCCViewer_Viewer::Type() ) ); - if ( myPreviewViewManager ) + if ( OCCViewer_Viewer* aViewer = myViewManager->getOCCViewer() ) { - connect( myPreviewViewManager, SIGNAL( lastViewClosed( SUIT_ViewManager* ) ), - this, SLOT( onLastViewClosed( SUIT_ViewManager* ) ) ); - - module()->setViewManagerRole( myPreviewViewManager, HYDROGUI_Module::VMR_PreviewZone ); - myPreviewViewManager->setTitle( tr( "PREVIEW_ZONE" ) ); - - if ( OCCViewer_Viewer* aViewer = myPreviewViewManager->getOCCViewer() ) - { - Handle(AIS_InteractiveContext) aCtx = aViewer->getAISContext(); - if ( !aCtx.IsNull() ) - { - myPreviewPrs = new HYDROGUI_Shape( aCtx, NULL ); - } - } + Handle(AIS_InteractiveContext) aCtx = aViewer->getAISContext(); + if ( !aCtx.IsNull() ) + myPreviewPrs = new HYDROGUI_Shape( aCtx, NULL ); } } - if ( !myPreviewViewManager || !myPreviewPrs ) + if ( !myViewManager || !myPreviewPrs ) return; myPreviewPrs->setFillingColor( aPanel->getFillingColor(), false, false ); @@ -309,11 +293,6 @@ void HYDROGUI_ZoneOp::onCreatePreview( const QString& thePolylineName ) myPreviewPrs->setFace( aWire ); } -void HYDROGUI_ZoneOp::onLastViewClosed( SUIT_ViewManager* theViewManager ) -{ - closePreview(); -} - void HYDROGUI_ZoneOp::closePreview() { if( myPreviewPrs ) @@ -321,19 +300,4 @@ void HYDROGUI_ZoneOp::closePreview() delete myPreviewPrs; myPreviewPrs = 0; } - - if( myPreviewViewManager ) - { - disconnect( myPreviewViewManager, SIGNAL( lastViewClosed( SUIT_ViewManager* ) ), - this, SLOT( onLastViewClosed( SUIT_ViewManager* ) ) ); - - module()->getApp()->removeViewManager( myPreviewViewManager ); // myPreviewViewManager is deleted here - myPreviewViewManager = 0; - } - - if( myActiveViewManager ) - { - HYDROGUI_Tool::SetActiveViewManager( module(), myActiveViewManager ); - myActiveViewManager = 0; - } } diff --git a/src/HYDROGUI/HYDROGUI_ZoneOp.h b/src/HYDROGUI/HYDROGUI_ZoneOp.h index f1419481..85760aac 100644 --- a/src/HYDROGUI/HYDROGUI_ZoneOp.h +++ b/src/HYDROGUI/HYDROGUI_ZoneOp.h @@ -29,8 +29,6 @@ class OCCViewer_ViewManager; -class SUIT_ViewManager; - class HYDROGUI_Shape; class HYDROGUI_ZoneOp : public HYDROGUI_Operation @@ -53,8 +51,6 @@ protected: protected slots: void onCreatePreview( const QString& thePolylineName ); - void onLastViewClosed( SUIT_ViewManager* ); - private: void closePreview(); @@ -62,9 +58,8 @@ private: bool myIsEdit; Handle(HYDROData_Zone) myEditedObject; - SUIT_ViewManager* myActiveViewManager; + OCCViewer_ViewManager* myViewManager; - OCCViewer_ViewManager* myPreviewViewManager; HYDROGUI_Shape* myPreviewPrs; }; diff --git a/src/HYDROGUI/resources/HYDROGUI_msg_en.ts b/src/HYDROGUI/resources/HYDROGUI_msg_en.ts index 2a584178..356159ad 100644 --- a/src/HYDROGUI/resources/HYDROGUI_msg_en.ts +++ b/src/HYDROGUI/resources/HYDROGUI_msg_en.ts @@ -879,10 +879,6 @@ file cannot be correctly imported for a Bathymetry definition. EDIT_ZONE Edit zone - - PREVIEW_ZONE - Preview zone -