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<HYDROGUI_DataObject*>( 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,
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
}
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 )
{
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
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)
anIsDigue = true;
else if( anObjectKind == KIND_DUMMY_3D )
anIsDummyObject3D = true;
+ else if( anObjectKind == KIND_SHAPES_GROUP || anObjectKind == KIND_SPLITTED_GROUP )
+ anIsGroup = true;
}
if ( !anIsObjectCanBeColored )
anIsImmersibleZone || anIsZone || anIsRegion ||
anIsBathymetry || anIsObstacle || anIsStream ||
anIsChannel || anIsDigue || anIsDummyObject3D ||
- anIsValidProfile )
+ anIsValidProfile || anIsGroup )
{
if( anIsHiddenInSelection )
theMenu->addAction( action( ShowId ) );
#include <HYDROData_Polyline3D.h>
#include <HYDROData_Profile.h>
#include <HYDROData_Region.h>
+#include <HYDROData_ShapesGroup.h>
#include <HYDROData_Stream.h>
#include <HYDROData_Zone.h>
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() )
// 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
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;
}
<source>CASE_REGIONS</source>
<translation>Regions</translation>
</message>
+ <message>
+ <source>CASE_SPLITTED_GROUPS</source>
+ <translation>Splitted groups</translation>
+ </message>
<message>
<source>FILE_CAN_NOT_BE_IMPORTED</source>
<translation>The file '%1' can not be imported: format *.%2 is not supported.</translation>