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.
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();
HYDROGUI_AISCurve::~HYDROGUI_AISCurve(void)
{
+ myCurve->removeListener();
}
void HYDROGUI_AISCurve::setCurve( CurveCreator_Curve* theCurve )
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;
#include <OCCViewer_AISSelector.h>
+#include <Precision.hxx>
+
+static int ZValueIncrement = 0;
+
HYDROGUI_PolylineOp::HYDROGUI_PolylineOp( HYDROGUI_Module* theModule, bool theIsEdit )
: HYDROGUI_Operation( theModule ), myIsEdit(theIsEdit), myCurve(NULL),
myViewManager(NULL), myAISCurve(NULL)
void HYDROGUI_PolylineOp::startOperation()
{
- CurveCreator_Curve* anOldCurve = myCurve;
+ if( myCurve )
+ {
+ delete myCurve;
+ myCurve = 0;
+ }
HYDROGUI_Operation::startOperation();
aPanel->setPolylineName(aNewName);
}
aPanel->setCurve(myCurve);
+
if( myAISCurve )
myAISCurve->setCurve(myCurve);
- if( anOldCurve )
- delete anOldCurve;
+
displayPreview();
}
}
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() )
const bool theIsEdit )
: HYDROGUI_Operation( theModule ),
myIsEdit( theIsEdit ),
- myActiveViewManager( 0 ),
- myPreviewViewManager( 0 ),
+ myViewManager( 0 ),
myPreviewPrs( 0 )
{
setName( theIsEdit ? tr( "EDIT_ZONE" ) : tr( "CREATE_ZONE" ) );
}
LightApp_Application* anApp = module()->getApp();
+ if ( !myViewManager )
+ myViewManager = ::qobject_cast<OCCViewer_ViewManager*>(
+ anApp->getViewManager( OCCViewer_Viewer::Type(), true ) );
- if ( !myActiveViewManager )
+ if ( myViewManager && !myPreviewPrs )
{
- myActiveViewManager = anApp->activeViewManager();
- }
-
- if ( !myPreviewViewManager )
- {
- myPreviewViewManager = ::qobject_cast<OCCViewer_ViewManager*>(
- 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 );
myPreviewPrs->setFace( aWire );
}
-void HYDROGUI_ZoneOp::onLastViewClosed( SUIT_ViewManager* theViewManager )
-{
- closePreview();
-}
-
void HYDROGUI_ZoneOp::closePreview()
{
if( myPreviewPrs )
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;
- }
}
class OCCViewer_ViewManager;
-class SUIT_ViewManager;
-
class HYDROGUI_Shape;
class HYDROGUI_ZoneOp : public HYDROGUI_Operation
protected slots:
void onCreatePreview( const QString& thePolylineName );
- void onLastViewClosed( SUIT_ViewManager* );
-
private:
void closePreview();
bool myIsEdit;
Handle(HYDROData_Zone) myEditedObject;
- SUIT_ViewManager* myActiveViewManager;
+ OCCViewer_ViewManager* myViewManager;
- OCCViewer_ViewManager* myPreviewViewManager;
HYDROGUI_Shape* myPreviewPrs;
};
<source>EDIT_ZONE</source>
<translation>Edit zone</translation>
</message>
- <message>
- <source>PREVIEW_ZONE</source>
- <translation>Preview zone</translation>
- </message>
</context>
</TS>