-// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
+// Copyright (C) 2014-2015 EDF-R&D
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
#include "HYDROGUI_TranslateObstacleDlg.h"
#include "HYDROGUI_Module.h"
#include "HYDROGUI_Shape.h"
-#include "HYDROGUI_Tool.h"
+#include "HYDROGUI_Tool2.h"
#include "HYDROGUI_UpdateFlags.h"
#include <HYDROData_ShapesTool.h>
aPanel->reset();
// Get the edited object
- myEditedObject = Handle(HYDROData_Obstacle)::DownCast( HYDROGUI_Tool::GetSelectedObject( module() ) );
+ if ( isApplyAndClose() )
+ myEditedObject = Handle(HYDROData_Obstacle)::DownCast( HYDROGUI_Tool::GetSelectedObject( module() ) );
if ( myEditedObject.IsNull() ) {
abort();
return;
}
- else if ( myEditedObject->IsMustBeUpdated() ) {
- myEditedObject->Update();
- }
// Set the edited object name to the panel
aPanel->setName( myEditedObject->GetName() );
}
bool HYDROGUI_TranslateObstacleOp::processApply( int& theUpdateFlags,
- QString& theErrorMsg )
+ QString& theErrorMsg,
+ QStringList& theBrowseObjectsEntries )
{
HYDROGUI_TranslateObstacleDlg* aPanel = ::qobject_cast<HYDROGUI_TranslateObstacleDlg*>( inputPanel() );
if ( !aPanel || myEditedObject.IsNull() ) {
// Create preview presentation if necessary
if ( !myPreviewPrs ) {
LightApp_Application* anApp = module()->getApp();
- OCCViewer_ViewManager* aViewManager = ::qobject_cast<OCCViewer_ViewManager*>(
- anApp->getViewManager( OCCViewer_Viewer::Type(), true ) );
-
+
+ if ( !getPreviewManager() )
+ setPreviewManager( ::qobject_cast<OCCViewer_ViewManager*>(
+ anApp->getViewManager( OCCViewer_Viewer::Type(), true ) ) );
+ OCCViewer_ViewManager* aViewManager = getPreviewManager();
if ( aViewManager ) {
if ( OCCViewer_Viewer* aViewer = aViewManager->getOCCViewer() ) {
Handle(AIS_InteractiveContext) aCtx = aViewer->getAISContext();
if ( !aCtx.IsNull() ) {
- myPreviewPrs = new HYDROGUI_Shape( aCtx, NULL );
+ myPreviewPrs = new HYDROGUI_Shape( aCtx, NULL, getPreviewZLayer() );
myPreviewPrs->setFillingColor( myEditedObject->GetFillingColor(), false, false );
myPreviewPrs->setBorderColor( myEditedObject->GetBorderColor(), false, false );
}
createPreview();
}
-TopoDS_Shape HYDROGUI_TranslateObstacleOp::getTranslatedShape() const
-{
- TopoDS_Shape aTranslatedShape;
-
- HYDROGUI_TranslateObstacleDlg* aPanel = (HYDROGUI_TranslateObstacleDlg*)inputPanel();
- if ( aPanel && !myEditedObject.IsNull() ) {
- double aDx = aPanel->getDx();
- double aDy = aPanel->getDy();
- double aDz = aPanel->getDz();
-
- TopoDS_Shape aShape = myEditedObject->GetShape3D();
- gp_Trsf aTrsf;
- gp_Vec aVec( aDx, aDy, aDz );
- aTrsf.SetTranslation(aVec);
- TopLoc_Location aLocOrig = aShape.Location();
- gp_Trsf aTrsfOrig = aLocOrig.Transformation();
- TopLoc_Location aLocRes( aTrsf * aTrsfOrig );
- aTranslatedShape = aShape.Located( aLocRes );
- }
-
- return aTranslatedShape;
-}
\ No newline at end of file