HYDROData_Iterator anIterator( aDocument, KIND_UNKNOWN );
for( ; anIterator.More(); anIterator.Next() ) {
+ LightApp_DataObject* obj = 0;
Handle(HYDROData_Entity) anObj = anIterator.Current();
if ( !anObj.IsNull() )
Handle(HYDROData_Image) anImageObj =
Handle(HYDROData_Image)::DownCast( anObj );
if( !anImageObj.IsNull() ) {
- createObject( anImageRootObj, anImageObj );
+ obj = createObject( anImageRootObj, anImageObj );
}
break;
Handle(HYDROData_Bathymetry) aBathymetryObj =
Handle(HYDROData_Bathymetry)::DownCast( anObj );
if( !aBathymetryObj.IsNull() ) {
- createObject( aBathymetryRootObj, aBathymetryObj );
+ obj = createObject( aBathymetryRootObj, aBathymetryObj );
}
break;
Handle(HYDROData_Channel) aChannelObj =
Handle(HYDROData_Channel)::DownCast( anObj );
if( !aChannelObj.IsNull() ) {
- createObject( anArtificialObjectsRootObj, aChannelObj );
+ obj = createObject( anArtificialObjectsRootObj, aChannelObj );
}
break;
Handle(HYDROData_Digue) aDigueObj =
Handle(HYDROData_Digue)::DownCast( anObj );
if( !aDigueObj.IsNull() ) {
- createObject( anArtificialObjectsRootObj, aDigueObj );
+ obj = createObject( anArtificialObjectsRootObj, aDigueObj );
}
break;
Handle(HYDROData_ImmersibleZone) anImmersibleZoneObj =
Handle(HYDROData_ImmersibleZone)::DownCast( anObj );
if( !anImmersibleZoneObj.IsNull() ) {
- createObject( aNaturalObjectsRootObj, anImmersibleZoneObj );
+ obj = createObject( aNaturalObjectsRootObj, anImmersibleZoneObj );
}
break;
Handle(HYDROData_River) aRiverObj =
Handle(HYDROData_River)::DownCast( anObj );
if( !aRiverObj.IsNull() ) {
- createObject( aNaturalObjectsRootObj, aRiverObj );
+ obj = createObject( aNaturalObjectsRootObj, aRiverObj );
}
break;
Handle(HYDROData_Stream) aStreamObj =
Handle(HYDROData_Stream)::DownCast( anObj );
if( !aStreamObj.IsNull() ) {
- createObject( aNaturalObjectsRootObj, aStreamObj );
+ obj = createObject( aNaturalObjectsRootObj, aStreamObj );
}
break;
Handle(HYDROData_Obstacle) anObstacleObj =
Handle(HYDROData_Obstacle)::DownCast( anObj );
if( !anObstacleObj.IsNull() ) {
- createObject( anObstaclesRootObj, anObstacleObj );
+ obj = createObject( anObstaclesRootObj, anObstacleObj );
}
break;
Handle(HYDROData_CalculationCase) aCalculObj =
Handle(HYDROData_CalculationCase)::DownCast( anObj );
if( !aCalculObj.IsNull() ) {
- createObject( aCalculRootObj, aCalculObj );
+ obj = createObject( aCalculRootObj, aCalculObj );
}
break;
Handle(HYDROData_PolylineXY) aPolylineObj =
Handle(HYDROData_PolylineXY)::DownCast( anObj );
if( !aPolylineObj.IsNull() ) {
- createObject( aPolylineRootObj, aPolylineObj );
+ obj = createObject( aPolylineRootObj, aPolylineObj );
}
break;
Handle(HYDROData_Polyline3D) aPolylineObj =
Handle(HYDROData_Polyline3D)::DownCast( anObj );
if( !aPolylineObj.IsNull() ) {
- createObject( aPolyline3DRootObj, aPolylineObj );
+ obj = createObject( aPolyline3DRootObj, aPolylineObj );
}
break;
Handle(HYDROData_Profile) aProfileObj =
Handle(HYDROData_Profile)::DownCast( anObj );
if( !aProfileObj.IsNull() ) {
- createObject( aProfileRootObj, aProfileObj );
+ obj = createObject( aProfileRootObj, aProfileObj );
}
break;
Handle(HYDROData_VisualState) aVisualStateObj =
Handle(HYDROData_VisualState)::DownCast( anObj );
if( !aVisualStateObj.IsNull() ) {
- createObject( aVisualStateRootObj, aVisualStateObj );
+ obj = createObject( aVisualStateRootObj, aVisualStateObj );
}
break;
::synchronize < suitPtr, suitPtr, HYDROGUI_DataModelSync >
( aNewRootObj, aRoot, aSync );
+ SUIT_DataBrowser* ob = anApp->objectBrowser();
- if( !myStates.isEmpty() )
+ if ( !myStates.isEmpty() )
{
- LightApp_Application* anApp = dynamic_cast<LightApp_Application*>( module()->application() );
- anApp->objectBrowser()->updateTree();
- anApp->objectBrowser()->setOpenStates( myStates, ENTRY_COLUMN );
+ ob->updateTree();
+ ob->setOpenStates( myStates, ENTRY_COLUMN );
myStates.clear();
}
}
const bool theIsBuildTree )
{
HYDROGUI_DataObject* aResObj = new HYDROGUI_DataObject( theParent, theModelObject, theParentEntry );
-
+
+ const ObjectKind aKind = theModelObject->GetKind();
+ bool visibility = aKind == KIND_IMAGE || aKind == KIND_POLYLINEXY || aKind == KIND_POLYLINE ||
+ aKind == KIND_SHAPES_GROUP || aKind == KIND_SPLITTED_GROUP || aKind == KIND_ZONE ||
+ aKind == KIND_IMMERSIBLE_ZONE || aKind == KIND_REGION || aKind == KIND_BATHYMETRY ||
+ aKind == KIND_OBSTACLE || aKind == KIND_STREAM || aKind == KIND_CHANNEL ||
+ aKind == KIND_DIGUE || aKind == KIND_DUMMY_3D;
+ if ( !visibility )
+ {
+ Handle(HYDROData_Profile) aProfObj = Handle(HYDROData_Profile)::DownCast( theModelObject );
+ visibility = !aProfObj.IsNull() && aProfObj->IsValid();
+ }
+
+ if ( aKind == KIND_REGION )
+ {
+ QString an = aResObj->name();
+ int a = 0;
+ }
+
+ if ( visibility )
+ {
+ SUIT_AbstractModel* treeModel = 0;
+ LightApp_Application* app = dynamic_cast<LightApp_Application*>( module()->application() );
+ if ( app )
+ treeModel = dynamic_cast<SUIT_AbstractModel*>( app->objectBrowser()->model() );
+
+ if ( treeModel )
+ treeModel->setVisibilityState( aResObj->text( aResObj->customData( Qtx::IdType ).toInt() ), Qtx::HiddenState, false );
+ }
+
if ( theIsBuildTree )
{
buildObjectTree( theParent, aResObj, theParentEntry );
}
return true;
}
-
#include <SALOME_Event.h>
#include <SUIT_DataBrowser.h>
-#include <SUIT_Desktop.h>
-#include <SUIT_Study.h>
+#include <SUIT_DataObject.h>
#include <SUIT_ViewManager.h>
#include <SUIT_ResourceMgr.h>
+#include <SUIT_Desktop.h>
+#include <SUIT_Study.h>
#include <SUIT_Session.h>
#include <SVTK_ViewManager.h>
}
}
+// SUIT_DataBrowser* ob = getApp()->objectBrowser();
+// SUIT_AbstractModel* treeModel = dynamic_cast<SUIT_AbstractModel*>( ob->model() );
+// treeModel->setAppropriate( SUIT_DataObject::VisibilityId, Qtx::Toggled );
+
return aRes;
}
ObjectState& anObjectState = aEntry2ObjectStateMap[ anEntry ];
anObjectState.Visibility = theState;
+
+ HYDROGUI_DataObject* hydroObject = getDataModel()->getDataObject( theObject );
+
+ SUIT_AbstractModel* treeModel = dynamic_cast<SUIT_AbstractModel*>( getApp()->objectBrowser()->model() );
+ QString id = hydroObject->text( hydroObject->customData( Qtx::IdType ).toInt() );
+ Qtx::VisibilityState visState = treeModel->visibilityState( id );
+ if ( visState != Qtx::UnpresentableState )
+ treeModel->setVisibilityState( id, theState ? Qtx::ShownState : Qtx::HiddenState );
}
}
return anOp;
}
+
+/*!
+ * \brief Virtual public slot
+ *
+ * This method is called after the object inserted into data view to update their visibility state
+ * This is default implementation
+ */
+void HYDROGUI_Module::onObjectClicked( SUIT_DataObject* theObject, int theColumn )
+{
+ if ( !isActiveModule() )
+ return;
+
+ HYDROGUI_DataObject* hydroObject = dynamic_cast<HYDROGUI_DataObject*>( theObject );
+
+ // change visibility of object
+ if ( !hydroObject || theColumn != SUIT_DataObject::VisibilityId )
+ return;
+
+ SUIT_AbstractModel* treeModel = dynamic_cast<SUIT_AbstractModel*>( getApp()->objectBrowser()->model() );
+
+ QString id = theObject->text( theObject->customData( Qtx::IdType ).toInt() );
+ Qtx::VisibilityState visState = treeModel->visibilityState( id );
+ if ( visState == Qtx::UnpresentableState )
+ return;
+
+ visState = visState == Qtx::ShownState ? Qtx::HiddenState : Qtx::ShownState;
+ treeModel->setVisibilityState( id, visState );
+
+ bool vis = visState == Qtx::ShownState;
+ if ( vis == isObjectVisible( HYDROGUI_Tool::GetActiveViewId( this ), hydroObject->modelObject() ) )
+ return;
+
+ setObjectVisible( HYDROGUI_Tool::GetActiveViewId( this ), hydroObject->modelObject(), vis );
+
+ update( UF_OCCViewer | UF_FitAll );
+}