#include "SalomeApp_Module.h"
#include "SalomeApp_Study.h"
#include "SalomeApp_Application.h"
-#include "SalomeApp_SelectionMgr.h"
+#include "LightApp_SelectionMgr.h"
#include "SALOME_ListIO.hxx"
#include "SALOME_ListIteratorOfListIO.hxx"
return theModule->application()->desktop();
}
- SalomeApp_SelectionMgr*
+ LightApp_SelectionMgr*
GetSelectionMgr(const SalomeApp_Module* theModule)
{
return theModule->getApp()->selectionMgr();
CheckLock( _PTR(Study) theStudy )
{
if(IsStudyLocked(theStudy))
- throw std::runtime_error(QObject::tr("WRN_STUDY_LOCKED").latin1());
+ {
+ SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>
+ (SUIT_Session::session()->activeApplication());
+ if (anApp)
+ {
+ SUIT_MessageBox::warn1(anApp->desktop(),
+ QObject::tr("WRN_VISU_WARNING"),
+ QObject::tr("WRN_STUDY_LOCKED"),
+ QObject::tr("BUT_OK"));
+ return true;
+ }
+ }
return false;
}
Handle(SALOME_InteractiveObject)* theIO,
VISU::Storable::TRestoringMap* theMap)
{
- SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(theModule);
+ LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(theModule);
SALOME_ListIO aListIO;
aSelectionMgr->selectedObjects(aListIO);
SALOME_ListIteratorOfListIO anIter(aListIO);
}
void
- Add(SalomeApp_SelectionMgr* theSelectionMgr,
+ Add(LightApp_SelectionMgr* theSelectionMgr,
const Handle(SALOME_InteractiveObject)& theIO)
{
SALOME_ListIO aListIO;
}
void
- Remove(SalomeApp_SelectionMgr* theSelectionMgr,
+ Remove(LightApp_SelectionMgr* theSelectionMgr,
const Handle(SALOME_InteractiveObject)& theIO)
{
if (theIO.IsNull()) return;
bool
IsRemovableSelected (const SalomeApp_Module* theModule)
{
- SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(theModule);
+ LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(theModule);
SALOME_ListIO aListIO;
aSelectionMgr->selectedObjects(aListIO);
_PTR(SObject) aChildSObject = aChildIter->Value();
CORBA::Object_var aChildObj = VISU::ClientSObjectToObject(aChildSObject);
- VISU::RemovableObject_var aRemovableObject = VISU::RemovableObject::_narrow(aChildObj);
- if( !CORBA::is_nil( aRemovableObject ) )
- study->deleteReferencesTo( aChildSObject );
ErasePrs(theModule, aChildObj);
}
VISU::RemovableObject_var aRemovableObject = VISU::RemovableObject::_narrow(anObj);
if (!CORBA::is_nil(aRemovableObject)) {
- study->deleteReferencesTo( theSObject );
aRemovableObject->RemoveFromStudy();
}
} else {
return;
SALOMEDS::SObject_var aSObject = thePrs->GetSObject();
CORBA::String_var anEntry = aSObject->GetID();
- SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(theModule);
+ LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(theModule);
Remove(aSelectionMgr,theIO);
TViewWindows aViewWindows = GetViews(theModule);
for(int i = 0, iEnd = aViewWindows.size(); i < iEnd; i++){
}
SVTK_ViewWindow*
+ GetViewWindow( const SalomeApp_Module* theModule, const bool theCreate )
+ {
+ if (SalomeApp_Application* anApp = theModule->getApp())
+ {
+ SVTK_ViewWindow* wnd = dynamic_cast<SVTK_ViewWindow*>(anApp->desktop()->activeWindow());
+ if( wnd )
+ return wnd;
+ else
+ {
+ SUIT_ViewManager* aViewManager = anApp->getViewManager( SVTK_Viewer::Type(), theCreate );
+ return aViewManager ? dynamic_cast<SVTK_ViewWindow*>( aViewManager->getActiveView() ) : 0;
+ }
+ }
+ return NULL;
+ }
+
+ /*SVTK_ViewWindow*
GetViewWindow(const SalomeApp_Module* theModule, const bool theCreate )
{
if(SalomeApp_Application* anApp = theModule->getApp()){
}
}
return NULL;
- }
+ }*/
SVTK_ViewWindow*
int theDisplaying)
{
if ( theDisplaying == VISU::eErase ) {
- if ( plotCurve )
+ if ( plotCurve && aPlot )
aPlot->eraseCurve( plotCurve, false );
}
else if ( theDisplaying == VISU::eDisplay || theDisplaying == VISU::eDisplayOnly ) {
plotCurve->setColor( QColor( (int)(color.R*255.), (int)(color.G*255.), (int)(color.B*255.) ) );
}
plotCurve->setAutoAssign( theCurve->IsAuto() );
- aPlot->displayCurve( plotCurve, false );
+ if( aPlot )
+ aPlot->displayCurve( plotCurve, false );
}
else {
Plot2d_Curve* crv = theCurve->CreatePresentation();
if ( crv ) {
- aPlot->displayCurve( crv, false );
+ if( aPlot )
+ aPlot->displayCurve( crv, false );
theCurve->SetLine( (VISU::Curve::LineType)crv->getLine(), crv->getLineWidth() );
theCurve->SetMarker( (VISU::Curve::MarkerType)crv->getMarker());
SALOMEDS::Color newColor;