From: adv Date: Thu, 19 Dec 2013 05:52:03 +0000 (+0000) Subject: Debug features for object groups. X-Git-Tag: BR_hydro_v_0_6~33 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=432a7392b96da52dfc75de5d845f73239a9d5eb2;p=modules%2Fhydro.git Debug features for object groups. --- diff --git a/src/HYDROGUI/HYDROGUI_DataModel.cxx b/src/HYDROGUI/HYDROGUI_DataModel.cxx index 4a1baf91..89c3edc2 100644 --- a/src/HYDROGUI/HYDROGUI_DataModel.cxx +++ b/src/HYDROGUI/HYDROGUI_DataModel.cxx @@ -705,6 +705,30 @@ LightApp_DataObject* HYDROGUI_DataModel::createObject( SUIT_DataObject* theParen return new HYDROGUI_NamedObject( theParent, theName, theParentEntry ); } +void HYDROGUI_DataModel::buildObjectPartition( SUIT_DataObject* theObject, + const HYDROData_SequenceOfObjects& theObjects, + const QString& thePartName, + const bool theIsCreateEmpty ) +{ + if ( theObjects.IsEmpty() && !theIsCreateEmpty ) + return; + + HYDROGUI_DataObject* aGuiObj = dynamic_cast( theObject ); + if ( !aGuiObj ) + return; + + LightApp_DataObject* aPartSect = + createObject( aGuiObj, thePartName, aGuiObj->entry() ); + + HYDROData_SequenceOfObjects::Iterator anIter( theObjects ); + for ( ; anIter.More(); anIter.Next() ) + { + Handle(HYDROData_Entity) anObj = anIter.Value(); + if( !anObj.IsNull() && !anObj->IsRemoved() ) + createObject( aPartSect, anObj, aGuiObj->entry(), false ); + } +} + void HYDROGUI_DataModel::buildObjectTree( SUIT_DataObject* theParent, SUIT_DataObject* theObject, const QString& theParentEntry, @@ -728,18 +752,8 @@ void HYDROGUI_DataModel::buildObjectTree( SUIT_DataObject* theParent, createObject( aGuiObj, anObject3D, aGuiObj->entry(), false ); #ifdef DEB_GROUPS - LightApp_DataObject* aGroupsSect = - createObject( aGuiObj, tr( "OBJECT_GROUPS" ), aGuiObj->entry() ); - HYDROData_SequenceOfObjects anObjGroups = aGeomObj->GetGroups(); - HYDROData_SequenceOfObjects::Iterator anIter( anObjGroups ); - for ( ; anIter.More(); anIter.Next() ) - { - Handle(HYDROData_ShapesGroup) anObjGroup = - Handle(HYDROData_ShapesGroup)::DownCast( anIter.Value() ); - if( !anObjGroup.IsNull() && !anObjGroup->IsRemoved() ) - createObject( aGroupsSect, anObjGroup, aGuiObj->entry(), false ); - } + buildObjectPartition( aGuiObj, anObjGroups, tr( "OBJECT_GROUPS" ), false ); #endif } @@ -826,6 +840,15 @@ void HYDROGUI_DataModel::buildObjectTree( SUIT_DataObject* theParent, if( !aCaseRegion.IsNull() && !aCaseRegion->IsRemoved() ) createRegion( aCaseRegionsSect, aCaseRegion, "", true, theIsInOperation ); } + +#ifdef DEB_GROUPS + HYDROData_SequenceOfObjects aCalcGroups = aCaseObj->GetSplittedGroups(); + buildObjectPartition( aGuiObj, aCalcGroups, tr( "OBJECT_GROUPS" ), false ); + + HYDROData_SequenceOfObjects aCalcSplitGroups = aCaseObj->GetSplittedGroups(); + buildObjectPartition( aGuiObj, aCalcSplitGroups, tr( "CASE_SPLITTED_GROUPS" ), false ); +#endif + } else if ( anObjectKind == KIND_REGION ) { diff --git a/src/HYDROGUI/HYDROGUI_DataModel.h b/src/HYDROGUI/HYDROGUI_DataModel.h index 077905a5..019350e1 100644 --- a/src/HYDROGUI/HYDROGUI_DataModel.h +++ b/src/HYDROGUI/HYDROGUI_DataModel.h @@ -320,6 +320,18 @@ protected: const QString& theParentEntry, const bool theIsBuildTree , const bool theIsInOperation = false ); + /** + * Build partition for object. + * \param theObject gui object for which the partition will be build + * \param theObjects sequence of builded objects + * \param thePartName name of created partition + * \param theIsCreateEmpty if true then partition will be created in any case + */ + void buildObjectPartition( SUIT_DataObject* theObject, + const HYDROData_SequenceOfObjects& theObjects, + const QString& thePartName, + const bool theIsCreateEmpty ); + /** * Build tree of a model object. * \param theParent a created object will be appended as a child of this object diff --git a/src/HYDROGUI/HYDROGUI_Module.cxx b/src/HYDROGUI/HYDROGUI_Module.cxx index 81eabc1f..6091e92e 100644 --- a/src/HYDROGUI/HYDROGUI_Module.cxx +++ b/src/HYDROGUI/HYDROGUI_Module.cxx @@ -308,6 +308,7 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient, bool anIsChannel = false; bool anIsDigue = false; bool anIsDummyObject3D = false; + bool anIsGroup = false; bool anIsObjectCanBeColored = false; // Check the selected GEOM objects (take into account the Object Browser only) @@ -416,6 +417,8 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient, anIsDigue = true; else if( anObjectKind == KIND_DUMMY_3D ) anIsDummyObject3D = true; + else if( anObjectKind == KIND_SHAPES_GROUP || anObjectKind == KIND_SPLITTED_GROUP ) + anIsGroup = true; } if ( !anIsObjectCanBeColored ) @@ -587,7 +590,7 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient, anIsImmersibleZone || anIsZone || anIsRegion || anIsBathymetry || anIsObstacle || anIsStream || anIsChannel || anIsDigue || anIsDummyObject3D || - anIsValidProfile ) + anIsValidProfile || anIsGroup ) { if( anIsHiddenInSelection ) theMenu->addAction( action( ShowId ) ); diff --git a/src/HYDROGUI/HYDROGUI_Shape.cxx b/src/HYDROGUI/HYDROGUI_Shape.cxx index 597c9db7..37eaf350 100644 --- a/src/HYDROGUI/HYDROGUI_Shape.cxx +++ b/src/HYDROGUI/HYDROGUI_Shape.cxx @@ -47,6 +47,7 @@ #include #include #include +#include #include #include @@ -350,6 +351,28 @@ void HYDROGUI_Shape::update( const bool theIsUpdateViewer ) setFillingColor( aFillingColor, false, false ); setBorderColor( aBorderColor, false, false ); } + else if ( myObject->IsKind( STANDARD_TYPE(HYDROData_ShapesGroup) ) ) + { + Handle(HYDROData_ShapesGroup) aShapesGroup = + Handle(HYDROData_ShapesGroup)::DownCast( myObject ); + + TopTools_SequenceOfShape aShapes; + aShapesGroup->GetShapes( aShapes ); + + BRepBuilderAPI_MakeWire aMakeWire; + + for ( int i = 1, n = aShapes.Length(); i <= n; ++i ) + { + TopoDS_Edge anEdge = TopoDS::Edge( aShapes.Value( i ) ); + aMakeWire.Add( anEdge ); + } + + aMakeWire.Build(); + TopoDS_Wire aResWire = aMakeWire.Wire(); + + setWire( aResWire, false, false ); + setBorderColor( Qt::red, false, false ); + } } if ( myShape.IsNull() || !isVisible() ) diff --git a/src/HYDROGUI/HYDROGUI_Tool.cxx b/src/HYDROGUI/HYDROGUI_Tool.cxx index 4733af2b..48bf1989 100644 --- a/src/HYDROGUI/HYDROGUI_Tool.cxx +++ b/src/HYDROGUI/HYDROGUI_Tool.cxx @@ -68,6 +68,8 @@ // encoding instead of default 'System' #define USE_LATIN1_ENCODING +// #define DEB_GROUPS 1 + QString HYDROGUI_Tool::ToQString( const TCollection_AsciiString& src ) { #ifdef USE_LATIN1_ENCODING @@ -227,7 +229,12 @@ bool HYDROGUI_Tool::IsObjectHasPresentation( const Handle(HYDROData_Entity)& the anObjectKind == KIND_STREAM || anObjectKind == KIND_CHANNEL || anObjectKind == KIND_DIGUE || - anObjectKind == KIND_DUMMY_3D ) + anObjectKind == KIND_DUMMY_3D +#ifdef DEB_GROUPS + || anObjectKind == KIND_SHAPES_GROUP || + anObjectKind == KIND_SPLITTED_GROUP +#endif + ) { return true; } diff --git a/src/HYDROGUI/resources/HYDROGUI_msg_en.ts b/src/HYDROGUI/resources/HYDROGUI_msg_en.ts index 021ef594..b0e13dd5 100644 --- a/src/HYDROGUI/resources/HYDROGUI_msg_en.ts +++ b/src/HYDROGUI/resources/HYDROGUI_msg_en.ts @@ -95,6 +95,10 @@ CASE_REGIONS Regions + + CASE_SPLITTED_GROUPS + Splitted groups + FILE_CAN_NOT_BE_IMPORTED The file '%1' can not be imported: format *.%2 is not supported.