aViewWindow->getRenderer()->ResetCameraClippingRange();
aViewWindow->Repaint();
}
+ else
+ displayer()->Display(anIO->getEntry());
break;
default: {
VISU::Prs3d_i* aPrs3d = VISU::GetPrs3dFromBase(aBase);
// display/erase commands
QString andInvisible = " and (((not isVisible) and isActiveView) or (not isActiveView))";
- QString aTableOrCont = "(type='VISU::TTABLE' and nbChildren>0) or type='VISU::TCONTAINER'";
- QString orCurveVisible = "or (type='VISU::TCURVE' and isVisible)";
- QString orCurveInvisible = "or (type='VISU::TCURVE'" + andInvisible + ")";
- QString aPrsVisible = "(($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D'" + aPrsAll + "}) and isVisible)";
- QString aPrsInvisible = "(($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D'" + aPrsAll + "})" + andInvisible + ")";
+ QString aTableOrContHide = "(($type in {'VISU::TTABLE' 'VISU::TPOINTMAP3D' 'VISU::TCONTAINER'}) and isPlot2dViewer and hasCurves and isThereAreVisibleCurves)";
+ QString aTableOrContShow = "(($type in {'VISU::TTABLE' 'VISU::TPOINTMAP3D' 'VISU::TCONTAINER'}) and isPlot2dViewer and hasCurves and isThereAreHiddenCurves)";
+ QString orCurveVisible = " or (type='VISU::TCURVE' and isVisible)";
+ QString orCurveInvisible = " or (type='VISU::TCURVE'" + andInvisible + ")";
+ QString aPrsVisible = "(($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D'" + aPrsAll + "}) and isVisible and (not isPlot2dViewer))";
+ QString aPrsInvisible = "(($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D'" + aPrsAll + "})" + andInvisible + " and (not isPlot2dViewer))";
QString aComponent = "( selcount=1 and canBeDisplayed and isVisuComponent )";
QString anEraseRule = "( selcount>0 and ({true} in $canBeDisplayed) and (" + aPrsVisible +
- " or (client='ObjectBrowser' and (" + aTableOrCont + orCurveVisible + "))) ) or " + aComponent;
+ " or (client='ObjectBrowser' and (" + aTableOrContHide + orCurveVisible + "))) ) or " + aComponent;
QString aDisplayRule = "( selcount>0 and ({true} in $canBeDisplayed) and (" + aPrsInvisible +
- " or (client='ObjectBrowser' and (" + aTableOrCont + orCurveInvisible + "))) ) or " + aComponent;
+ " or (client='ObjectBrowser' and (" + aTableOrContShow + orCurveInvisible + "))) ) or " + aComponent;
QString aDOnlyRule = "( selcount>0 and ({true} in $canBeDisplayed) and (($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D'" + aPrsAll + "})"
" or (client='ObjectBrowser' and ((type='VISU::TTABLE' and nbChildren>0) or"
#include "SalomeApp_Study.h"
#include "LightApp_Study.h"
+#include "LightApp_Displayer.h"
using namespace VISU;
else if ( p == "mediumResolution" ) val = QtxValue( mediumResolution( ind ) );
else if ( p == "lowResolution" ) val = QtxValue( lowResolution( ind ) );
else if ( p == "resolutionState" ) val = QtxValue( resolutionState( ind ) );
+
+ else if ( p == "isThereAreVisibleCurves" ) val = QtxValue( findDisplayedCurves( ind, false ) );
+ else if ( p == "isThereAreHiddenCurves" ) val = QtxValue( findDisplayedCurves( ind, true ) );
+ else if ( p == "hasCurves" ) val = QtxValue( hasCurves( ind ) );
+ else if ( p == "isPlot2dViewer" ) val = QtxValue( Plot2dViewerType( ind ) );
}
return val;
if ( anIsExist && aVal != "MESH" )
aResStr = "VISU::T" + aVal;
}
-
return aResStr;
}
//---------------------------------------------------------------
-QString VisuGUI_Selection::resolution( const int ind, char theResoltuion ) const
+bool VisuGUI_Selection::resolution( const int ind, char theResoltuion ) const
{
- QString aResStr;
QString aResolutions = resolutions( ind );
if(aResolutions.isEmpty())
- return aResStr;
+ return false;
if(aResolutions.find(theResoltuion) != -1)
- aResStr = "1";
+ return true;
else
- aResStr = "0";
-
- return aResStr;
+ return false;
}
//---------------------------------------------------------------
-QString VisuGUI_Selection::fullResolution( const int ind ) const
+bool VisuGUI_Selection::fullResolution( const int ind ) const
{
return resolution( ind, 'F');
}
//---------------------------------------------------------------
-QString VisuGUI_Selection::mediumResolution( const int ind ) const
+bool VisuGUI_Selection::mediumResolution( const int ind ) const
{
return resolution( ind, 'M');
}
//---------------------------------------------------------------
-QString VisuGUI_Selection::lowResolution( const int ind ) const
+bool VisuGUI_Selection::lowResolution( const int ind ) const
{
return resolution( ind, 'L');
}
}
//----------------------------------------------------------------------------
-QString VisuGUI_Selection::nbChildren( const int ind ) const
+int VisuGUI_Selection::nbChildren( const int ind ) const
{
- QString aResStr;
- aResStr.setNum( nbChild( ind, false ) );
- return aResStr;
+ return nbChild( ind, false );
}
//----------------------------------------------------------------------------
-QString VisuGUI_Selection::nbNamedChildren( const int ind ) const
+int VisuGUI_Selection::nbNamedChildren( const int ind ) const
{
- QString aResStr;
- aResStr.setNum( nbChild( ind, true ) );
- return aResStr;
+ return nbChild( ind, true );
}
//----------------------------------------------------------------------------
-QString VisuGUI_Selection::hasActor( const int ind ) const
+bool VisuGUI_Selection::hasActor( const int ind ) const
{
- return representation( ind ).isEmpty() ? "0" : "1";
+ return representation( ind ).isEmpty();
}
return dynamic_cast<VISU::VISU_Gen_i*>( VISU::GetServant( anObj ).in() );
}
+
+//---------------------------------------------------------------------------
+bool VisuGUI_Selection::findDisplayedCurves( const int ind, bool findHidden ) const
+{
+ // findHidden == false - find at least one Visible curve in the childs of ind
+ // findHidden == true - find at least one Hidden curve in the childs of ind
+ SalomeApp_Study* aSStudy = GetStudy();
+ if ( !aSStudy )
+ return false;
+
+ QString entryId;
+ _PTR(Study) aStudy = GetCStudy( aSStudy );
+ if ( aStudy ){
+ _PTR(SObject) SO = aStudy->FindObjectID( entry( ind ).latin1() );
+ if ( SO ){
+ for ( _PTR(ChildIterator) Iter = aStudy->NewChildIterator( SO ); Iter->More(); Iter->Next() ) {
+ _PTR(SObject) refSO;
+ if ( Iter->Value()->ReferencedObject(refSO) )
+ entryId = refSO->GetID();
+ else
+ entryId = Iter->Value()->GetID();
+
+ LightApp_Displayer* displayer = LightApp_Displayer::FindDisplayer( myModule->moduleName(), false );
+ if ( displayer->IsDisplayed( entryId ) && findHidden == false )
+ return true;
+ else if ( !displayer->IsDisplayed( entryId ) && findHidden == true )
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+//---------------------------------------------------------------------------
+bool VisuGUI_Selection::hasCurves( const int ind ) const
+{
+ SalomeApp_Study* aSStudy = GetStudy();
+ if ( !aSStudy )
+ return false;
+
+ QString entryId;
+ _PTR(Study) aStudy = GetCStudy( aSStudy );
+ if ( aStudy ){
+ _PTR(SObject) SO = aStudy->FindObjectID( entry( ind ).latin1() );
+ if ( SO ){
+ for ( _PTR(ChildIterator) Iter = aStudy->NewChildIterator( SO ); Iter->More(); Iter->Next() ) {
+ _PTR(SObject) refSO;
+ if ( Iter->Value()->ReferencedObject(refSO) ) {
+ // reference on curve
+ }
+ else
+ refSO = Iter->Value();
+
+ CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(refSO);
+ if(!CORBA::is_nil(aCORBAObject)){
+ PortableServer::ServantBase_var aServant = VISU::GetServant(aCORBAObject);
+ if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aServant.in()))
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+}
+
+//---------------------------------------------------------------------------
+bool VisuGUI_Selection::Plot2dViewerType( const int ind ) const
+{
+ QString viewerType;
+ SUIT_Session* session = SUIT_Session::session();
+ if( SUIT_Application* app = session->activeApplication() )
+ if( LightApp_Application* sApp = dynamic_cast<LightApp_Application*>( app ) )
+ if( SUIT_ViewManager* vman = sApp->activeViewManager() )
+ if( SUIT_ViewModel* vmod = vman->getViewModel() ) {
+ viewerType = vmod->getType();
+ if (viewerType ==SPlot2d_Viewer::Type())
+ return true;
+ }
+ return false;
+}
QString medSource( const int ) const;
QString nbTimeStamps( const int ) const;
QString representation( const int ) const;
- QString nbChildren( const int ) const;
- QString nbNamedChildren( const int ) const;
+ int nbChildren( const int ) const;
+ int nbNamedChildren( const int ) const;
QString isVisible( const int ) const;
QString isShrunk( const int ) const;
- QString hasActor( const int ) const;
QString isShading( const int ) const;
+ bool hasActor( const int ) const;
QString isScalarMapAct( const int ) const;
bool isVisuComponent( const int ) const;
- QString fullResolution( const int ) const;
- QString mediumResolution( const int ) const;
- QString lowResolution( const int ) const;
+ bool fullResolution( const int ) const;
+ bool mediumResolution( const int ) const;
+ bool lowResolution( const int ) const;
QString resolutionState( const int ) const;
private:
- int nbChild( const int, const bool ) const;
- SalomeApp_Study* GetStudy() const;
+ bool findDisplayedCurves( const int, bool ) const;
+ bool Plot2dViewerType( const int ) const;
+ bool hasCurves( const int ) const;
+ int nbChild( const int, const bool ) const;
QString resolutions( const int ) const;
- QString resolution( const int, char theResoltuion ) const;
+ bool resolution( const int, char theResoltuion ) const;
-private:
+ SalomeApp_Study* GetStudy() const;
SalomeApp_Module* myModule;
};