// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
#include "OCCViewer_ViewManager.h"
#include "SalomeApp_Study.h"
#include "SalomeApp_Tools.h"
+#include "SalomeApp_Application.h"
#include <TopoDS_Compound.hxx>
#include <BRep_Builder.hxx>
using namespace boost;
using namespace std;
-//=======================================================================
-// function : GetEntityGUI()
-// purpose : Get the only EntityGUI object [ static ]
-//=======================================================================
-EntityGUI* EntityGUI::GetEntityGUI( GeometryGUI* parent )
-{
- return new EntityGUI( parent );
-}
-
//=======================================================================
// function : EntityGUI()
// purpose : Constructor
//=======================================================================
bool EntityGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent)
{
+ SalomeApp_Application* app = getGeometryGUI()->getApp();
+ if ( !app ) return false;
+
getGeometryGUI()->EmitSignalDeactivateDialog();
QDialog* aDlg = NULL;
aDlg = new EntityGUI_SubShapeDlg(getGeometryGUI(), parent, "");
break;
default:
- SUIT_Session::session()->activeApplication()->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID));
+ app->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID));
break;
}
if ( aDlg )
//=====================================================================================
void EntityGUI::DisplaySimulationShape(const TopoDS_Shape& S1, const TopoDS_Shape& S2)
{
- SUIT_ViewManager* aVM =
- SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager();
+ SalomeApp_Application* app = getGeometryGUI()->getApp();
+ if ( !app ) return;
+
+ SUIT_ViewManager* aVM = app->desktop()->activeWindow()->getViewManager();
if (aVM->getType() != OCCViewer_Viewer::Type())
return;
mySimulationShape1 = new AIS_Shape(TopoDS_Shape());
mySimulationShape1->Set(S1);
mySimulationShape1->SetColor(Quantity_NOC_RED);
-
+
ic->Deactivate(mySimulationShape1);
ic->Display(mySimulationShape1, Standard_False);
mySimulationShape1->UnsetColor();
//==================================================================================
void EntityGUI::EraseSimulationShape()
{
+ SalomeApp_Application* app = getGeometryGUI()->getApp();
+ if ( !app ) return;
+
// get all view windows at the desktop
- QPtrList<SUIT_ViewWindow> aWndLst = SUIT_Session::session()->activeApplication()->desktop()->windows();
+ QPtrList<SUIT_ViewWindow> aWndLst = app->desktop()->windows();
//get all view windows, which belong to the active study
QPtrList<SUIT_ViewWindow> aWndLstAS;
SUIT_ViewWindow* vw;
for ( vw = aWndLst.first(); vw; vw = aWndLst.next() )
- if ( vw->getViewManager()->study() == SUIT_Session::session()->activeApplication()->activeStudy() )
+ if ( vw->getViewManager()->study() == app->activeStudy() )
aWndLstAS.append( vw );
-
+
for ( vw = aWndLstAS.first(); vw; vw = aWndLstAS.next() ) {
if ( vw->getViewManager()->getType() == OCCViewer_Viewer::Type() ) {
OCCViewer_Viewer* v3d = ((OCCViewer_ViewManager*)(vw->getViewManager()))->getOCCViewer();
//=====================================================================================
bool EntityGUI::SObjectExist(const _PTR(SObject)& theFatherObject, const char* IOR)
{
- SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>
- ( SUIT_Session::session()->activeApplication()->activeStudy() );
+ SalomeApp_Application* app = getGeometryGUI()->getApp();
+ if ( !app ) return false;
+ SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
if ( !appStudy ) return false;
+
_PTR(Study) aStudy = appStudy->studyDS();
_PTR(ChildIterator) it ( aStudy->NewChildIterator(theFatherObject) );
_PTR(SObject) RefSO;
#endif
GEOMGUI* GetLibGUI( GeometryGUI* parent )
{
- return EntityGUI::GetEntityGUI( parent );
+ return new EntityGUI( parent );
}
}