HYDROData_Digue.h
HYDROData_Document.h
HYDROData_DummyObject3D.h
+ HYDROData_EdgesGroup.h
HYDROData_Entity.h
HYDROData_IAltitudeObject.h
HYDROData_Image.h
HYDROData_Digue.cxx
HYDROData_Document.cxx
HYDROData_DummyObject3D.cxx
+ HYDROData_EdgesGroup.cxx
HYDROData_Entity.cxx
HYDROData_IAltitudeObject.cxx
HYDROData_Image.cxx
#include "HYDROData_ArtificialObject.h"
#include "HYDROData_Bathymetry.h"
#include "HYDROData_Document.h"
+#include "HYDROData_EdgesGroup.h"
#include "HYDROData_Iterator.h"
#include "HYDROData_NaturalObject.h"
#include "HYDROData_PolylineXY.h"
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <BRepTopAdaptor_FClass2d.hxx>
#include <TopAbs.hxx>
+
#define CALCULATION_REGIONS_PREF GetName() + "_Reg"
#define CALCULATION_ZONES_PREF GetName() + "_Zone"
AddReferenceObject( theObject, DataTag_GeometryObject );
- // Indicate model of the need to update zones splitting
+ // Indicate model of the need to update splitting
SetToUpdate( true );
return true;
RemoveReferenceObject( theObject->Label(), DataTag_GeometryObject );
- // Indicate model of the need to update zones splitting
+ // Indicate model of the need to update splitting
SetToUpdate( true );
}
{
ClearReferenceObjects( DataTag_GeometryObject );
- // Indicate model of the need to update zones splitting
+ // Indicate model of the need to update splitting
+ SetToUpdate( true );
+}
+
+bool HYDROData_CalculationCase::AddGeometryGroup( const Handle(HYDROData_EdgesGroup)& theGroup )
+{
+ if ( theGroup.IsNull() )
+ return false;
+
+ if ( HasReference( theGroup, DataTag_GeometryGroup ) )
+ return false; // Object is already in reference list
+
+ AddReferenceObject( theGroup, DataTag_GeometryGroup );
+
+ // Indicate model of the need to update splitting
+ SetToUpdate( true );
+
+ return true;
+}
+
+HYDROData_SequenceOfObjects HYDROData_CalculationCase::GetGeometryGroups() const
+{
+ return GetReferenceObjects( DataTag_GeometryGroup );
+}
+
+void HYDROData_CalculationCase::RemoveGeometryGroup( const Handle(HYDROData_EdgesGroup)& theGroup )
+{
+ if ( theGroup.IsNull() )
+ return;
+
+ RemoveReferenceObject( theGroup->Label(), DataTag_GeometryGroup );
+
+ // Indicate model of the need to update splitting
+ SetToUpdate( true );
+}
+
+void HYDROData_CalculationCase::RemoveGeometryGroups()
+{
+ ClearReferenceObjects( DataTag_GeometryGroup );
+
+ // Indicate model of the need to update splitting
SetToUpdate( true );
}
class Handle(HYDROData_Region);
class Handle(HYDROData_Zone);
class Handle(HYDROData_PolylineXY);
+class Handle(HYDROData_EdgesGroup);
DEFINE_STANDARD_HANDLE(HYDROData_CalculationCase, HYDROData_Entity)
DataTag_GeometryObject, ///< reference geometry objects
DataTag_ChildRegion, ///< child regions
DataTag_Region, ///< reference regions
- DataTag_Polyline ///< reference boundary polyline
+ DataTag_Polyline, ///< reference boundary polyline
+ DataTag_GeometryGroup, ///< reference geometry groups
+ DataTag_SplittedGroups, ///< reference splitted groups
};
public:
HYDRODATA_EXPORT virtual void RemoveGeometryObjects();
+ /**
+ * Add new one reference geometry group for calculation case.
+ */
+ HYDRODATA_EXPORT virtual bool AddGeometryGroup( const Handle(HYDROData_EdgesGroup)& theGroup );
+
+ /**
+ * Returns all reference geometry groups of calculation case.
+ */
+ HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetGeometryGroups() const;
+
+ /**
+ * Removes reference geometry group from calculation case.
+ */
+ HYDRODATA_EXPORT virtual void RemoveGeometryGroup( const Handle(HYDROData_EdgesGroup)& theGroup );
+
+ /**
+ * Removes all reference geometry groups from calculation case.
+ */
+ HYDRODATA_EXPORT virtual void RemoveGeometryGroups();
+
+
/**
* Sets reference boundary polyline object for calculation case.
*/
--- /dev/null
+
+#include "HYDROData_EdgesGroup.h"
+
+#include <TDF_ChildIDIterator.hxx>
+
+#include <TopoDS.hxx>
+#include <TopoDS_Edge.hxx>
+
+#include <TNaming_Builder.hxx>
+#include <TNaming_NamedShape.hxx>
+
+IMPLEMENT_STANDARD_HANDLE(HYDROData_EdgesGroup,HYDROData_Entity)
+IMPLEMENT_STANDARD_RTTIEXT(HYDROData_EdgesGroup,HYDROData_Entity)
+
+HYDROData_EdgesGroup::HYDROData_EdgesGroup()
+: HYDROData_Entity()
+{
+}
+
+HYDROData_EdgesGroup::~HYDROData_EdgesGroup()
+{
+}
+
+bool HYDROData_EdgesGroup::CanBeUpdated() const
+{
+ return false;
+}
+
+bool HYDROData_EdgesGroup::CanRemove()
+{
+ return false;
+}
+
+void HYDROData_EdgesGroup::AddEdge( const TopoDS_Edge& theEdge )
+{
+ if ( theEdge.IsNull() )
+ return;
+
+ TDF_Label aNewLab = myLab.FindChild( DataTag_Edge ).NewChild();
+
+ TNaming_Builder aBuilder( aNewLab );
+ aBuilder.Generated( theEdge );
+}
+
+void HYDROData_EdgesGroup::SetEdges( const HYDROData_SequenceOfEdges& theEdges )
+{
+ RemoveEdges();
+
+ for ( int i = 1, n = theEdges.Length(); i <= n; ++i )
+ {
+ const TopoDS_Edge& anEdge = theEdges.Value( i );
+ AddEdge( anEdge );
+ }
+}
+
+HYDROData_SequenceOfEdges HYDROData_EdgesGroup::GetEdges() const
+{
+ HYDROData_SequenceOfEdges aResSeq;
+
+ TDF_Label aLabel = myLab.FindChild( DataTag_Edge, false );
+ if ( aLabel.IsNull() )
+ return aResSeq;
+
+ TDF_ChildIDIterator aChildIt( aLabel, TNaming_NamedShape::GetID() );
+ for ( ; aChildIt.More(); aChildIt.Next() )
+ {
+ Handle(TNaming_NamedShape) aNamedShape =
+ Handle(TNaming_NamedShape)::DownCast( aChildIt.Value() );
+ if ( aNamedShape.IsNull() )
+ continue;
+
+ TopoDS_Shape aStoredShape = aNamedShape->Get();
+ if ( aStoredShape.IsNull() || aStoredShape.ShapeType() != TopAbs_EDGE )
+ continue;
+
+ TopoDS_Edge aStoredEdge = TopoDS::Edge( aStoredShape );
+ aResSeq.Append( aStoredEdge );
+ }
+
+ return aResSeq;
+}
+
+void HYDROData_EdgesGroup::RemoveEdges()
+{
+ TDF_Label aLabel = myLab.FindChild( DataTag_Edge, false );
+ if ( !aLabel.IsNull() )
+ aLabel.ForgetAllAttributes();
+}
+
--- /dev/null
+
+#ifndef HYDROData_EdgesGroup_HeaderFile
+#define HYDROData_EdgesGroup_HeaderFile
+
+#include <HYDROData_Entity.h>
+
+class TopoDS_Edge;
+
+DEFINE_STANDARD_HANDLE(HYDROData_EdgesGroup, HYDROData_Entity)
+
+typedef NCollection_Sequence<TopoDS_Edge> HYDROData_SequenceOfEdges;
+
+/**\class HYDROData_EdgesGroup
+ * \brief The artificial objects are objects created or planned for creation by human.
+ *
+ */
+class HYDROData_EdgesGroup : public HYDROData_Entity
+{
+protected:
+ /**
+ * Enumeration of tags corresponding to the persistent object parameters.
+ */
+ enum DataTag
+ {
+ DataTag_First = HYDROData_Entity::DataTag_First + 100, ///< first tag, to reserve
+ DataTag_Edge, ///< reference edges
+ };
+
+public:
+ DEFINE_STANDARD_RTTI(HYDROData_EdgesGroup);
+
+ /**
+ * Returns the kind of this object. Must be redefined in all objects of known type.
+ */
+ HYDRODATA_EXPORT virtual const ObjectKind GetKind() const { return KIND_EDGES_GROUP; }
+
+ /**
+ * Returns flag indicating that object is updateble or not.
+ */
+ HYDRODATA_EXPORT virtual bool CanBeUpdated() const;
+
+ /**
+ * Returns flag indicating that object can be removed or not.
+ */
+ HYDRODATA_EXPORT virtual bool CanRemove();
+
+public:
+ // Public methods to work with reference Edges
+
+ /**
+ * Add new one edge for the group.
+ */
+ HYDRODATA_EXPORT virtual void AddEdge( const TopoDS_Edge& theEdge );
+
+ /**
+ * Sets new sequence of edges for the group.
+ */
+ HYDRODATA_EXPORT virtual void SetEdges( const HYDROData_SequenceOfEdges& theEdges );
+
+ /**
+ * Returns all edges of the group.
+ */
+ HYDRODATA_EXPORT virtual HYDROData_SequenceOfEdges GetEdges() const;
+
+ /**
+ * Removes all edges from the group.
+ */
+ HYDRODATA_EXPORT virtual void RemoveEdges();
+
+
+protected:
+
+ friend class HYDROData_Iterator;
+
+ /**
+ * Creates new object in the internal data structure. Use higher level objects
+ * to create objects with real content.
+ */
+ HYDRODATA_EXPORT HYDROData_EdgesGroup();
+
+ /**
+ * Destructs properties of the object and object itself, removes it from the document.
+ */
+ virtual HYDRODATA_EXPORT ~HYDROData_EdgesGroup();
+};
+
+#endif
const ObjectKind KIND_ARTIFICIAL_OBJECT = 19;
const ObjectKind KIND_NATURAL_OBJECT = 20;
const ObjectKind KIND_DUMMY_3D = 21;
-const ObjectKind KIND_LAST = KIND_DUMMY_3D;
+const ObjectKind KIND_EDGES_GROUP = 22;
+const ObjectKind KIND_LAST = KIND_EDGES_GROUP;
DEFINE_STANDARD_HANDLE(HYDROData_Entity, MMgt_TShared)
#include "HYDROData_Confluence.h"
#include "HYDROData_DummyObject3D.h"
#include "HYDROData_Digue.h"
+#include "HYDROData_EdgesGroup.h"
#include "HYDROData_Image.h"
#include "HYDROData_ImmersibleZone.h"
#include "HYDROData_Obstacle.h"
switch( aKind )
{
- case KIND_IMAGE:
- aResult = new HYDROData_Image();
- break;
- case KIND_POLYLINE:
- aResult = new HYDROData_Polyline3D();
- break;
- case KIND_BATHYMETRY:
- aResult = new HYDROData_Bathymetry();
- break;
- case KIND_ALTITUDE:
- aResult = new HYDROData_AltitudeObject();
- break;
- case KIND_IMMERSIBLE_ZONE:
- aResult = new HYDROData_ImmersibleZone();
- break;
- case KIND_RIVER:
- aResult = new HYDROData_River();
- break;
- case KIND_STREAM:
- aResult = new HYDROData_Stream();
- break;
- case KIND_CONFLUENCE:
- aResult = new HYDROData_Confluence();
- break;
- case KIND_CHANNEL:
- aResult = new HYDROData_Channel();
- break;
- case KIND_OBSTACLE:
- aResult = new HYDROData_Obstacle();
- break;
- case KIND_DIGUE:
- aResult = new HYDROData_Digue();
- break;
- case KIND_PROFILE:
- aResult = new HYDROData_Profile();
- break;
- case KIND_PROFILEUZ:
- aResult = new HYDROData_ProfileUZ();
- break;
- case KIND_POLYLINEXY:
- aResult = new HYDROData_PolylineXY();
- break;
- case KIND_CALCULATION:
- aResult = new HYDROData_CalculationCase();
- break;
- case KIND_REGION:
- aResult = new HYDROData_Region();
- break;
- case KIND_ZONE:
- aResult = new HYDROData_Zone();
- break;
- case KIND_VISUAL_STATE:
- aResult = new HYDROData_VisualState();
- break;
- case KIND_DUMMY_3D:
- aResult = new HYDROData_DummyObject3D();
- break;
- default:
- break;
+ case KIND_IMAGE: aResult = new HYDROData_Image(); break;
+ case KIND_POLYLINE: aResult = new HYDROData_Polyline3D(); break;
+ case KIND_BATHYMETRY: aResult = new HYDROData_Bathymetry(); break;
+ case KIND_ALTITUDE: aResult = new HYDROData_AltitudeObject(); break;
+ case KIND_IMMERSIBLE_ZONE: aResult = new HYDROData_ImmersibleZone(); break;
+ case KIND_RIVER: aResult = new HYDROData_River(); break;
+ case KIND_STREAM: aResult = new HYDROData_Stream(); break;
+ case KIND_CONFLUENCE: aResult = new HYDROData_Confluence(); break;
+ case KIND_CHANNEL: aResult = new HYDROData_Channel(); break;
+ case KIND_OBSTACLE: aResult = new HYDROData_Obstacle(); break;
+ case KIND_DIGUE: aResult = new HYDROData_Digue(); break;
+ case KIND_PROFILE: aResult = new HYDROData_Profile(); break;
+ case KIND_PROFILEUZ: aResult = new HYDROData_ProfileUZ(); break;
+ case KIND_POLYLINEXY: aResult = new HYDROData_PolylineXY(); break;
+ case KIND_CALCULATION: aResult = new HYDROData_CalculationCase(); break;
+ case KIND_REGION: aResult = new HYDROData_Region(); break;
+ case KIND_ZONE: aResult = new HYDROData_Zone(); break;
+ case KIND_VISUAL_STATE: aResult = new HYDROData_VisualState(); break;
+ case KIND_DUMMY_3D: aResult = new HYDROData_DummyObject3D(); break;
+ case KIND_EDGES_GROUP: aResult = new HYDROData_EdgesGroup(); break;
+ default: break;
}
if ( !aResult.IsNull() )
#include "HYDROData_Bathymetry.h"
#include "HYDROData_DummyObject3D.h"
+#include "HYDROData_EdgesGroup.h"
#include "HYDROData_Iterator.h"
#include <TNaming_Builder.hxx>
{
}
+void HYDROData_Object::Update()
+{
+ HYDROData_Entity::Update();
+ removeTopShape();
+ removeShape3D();
+ removeGroupObjects();
+}
+
HYDROData_SequenceOfObjects HYDROData_Object::GetAllReferenceObjects() const
{
HYDROData_SequenceOfObjects aResSeq = HYDROData_Entity::GetAllReferenceObjects();
HYDROData_Iterator::CreateObject( aChildLabel, KIND_DUMMY_3D );
}
-void HYDROData_Object::Update()
+HYDROData_SequenceOfObjects HYDROData_Object::GetGroups() const
{
- HYDROData_Entity::Update();
- removeTopShape();
- removeShape3D();
+ return GetReferenceObjects( DataTag_EdgesGroup );
}
bool HYDROData_Object::SetBathymetry( const Handle(HYDROData_Bathymetry)& theBathymetry )
SetToUpdate( true );
}
-TopoDS_Shape HYDROData_Object::getTopShape() const
-{
- TDF_Label aLabel = myLab.FindChild( DataTag_TopShape, false );
- if ( !aLabel.IsNull() )
- {
- Handle(TNaming_NamedShape) aNamedShape;
- if( aLabel.FindAttribute( TNaming_NamedShape::GetID(), aNamedShape ) )
- return aNamedShape->Get();
- }
-
- return TopoDS_Shape();
-}
-
-void HYDROData_Object::removeTopShape()
-{
- TDF_Label aLabel = myLab.FindChild( DataTag_TopShape, false );
- if ( !aLabel.IsNull() )
- aLabel.ForgetAllAttributes();
-}
-
-TopoDS_Shape HYDROData_Object::getShape3D() const
-{
- TDF_Label aLabel = myLab.FindChild( DataTag_Shape3D, false );
- if ( !aLabel.IsNull() )
- {
- Handle(TNaming_NamedShape) aNamedShape;
- if( aLabel.FindAttribute( TNaming_NamedShape::GetID(), aNamedShape ) )
- return aNamedShape->Get();
- }
-
- return TopoDS_Shape();
-}
-
-void HYDROData_Object::removeShape3D()
-{
- TDF_Label aLabel = myLab.FindChild( DataTag_Shape3D, false );
- if ( !aLabel.IsNull() )
- aLabel.ForgetAllAttributes();
-}
-
void HYDROData_Object::SetFillingColor( const QColor& theColor )
{
SetColor( theColor, DataTag_FillingColor );
return DefaultBorderColor();
}
+Handle(HYDROData_EdgesGroup) HYDROData_Object::createGroupObject()
+{
+ TDF_Label aNewLab = myLab.FindChild( DataTag_EdgesGroup ).NewChild();
+
+ Handle(HYDROData_EdgesGroup) aNewGroup =
+ Handle(HYDROData_EdgesGroup)::DownCast( HYDROData_Iterator::CreateObject( aNewLab, KIND_EDGES_GROUP ) );
+ AddReferenceObject( aNewGroup, DataTag_EdgesGroup );
+
+ return aNewGroup;
+}
+
+void HYDROData_Object::createGroupObjects()
+{
+}
+
+void HYDROData_Object::removeGroupObjects()
+{
+ TDF_Label aLabel = myLab.FindChild( DataTag_EdgesGroup, false );
+ if ( !aLabel.IsNull() )
+ aLabel.ForgetAllAttributes();
+}
+
+TopoDS_Shape HYDROData_Object::getTopShape() const
+{
+ TDF_Label aLabel = myLab.FindChild( DataTag_TopShape, false );
+ if ( !aLabel.IsNull() )
+ {
+ Handle(TNaming_NamedShape) aNamedShape;
+ if( aLabel.FindAttribute( TNaming_NamedShape::GetID(), aNamedShape ) )
+ return aNamedShape->Get();
+ }
+
+ return TopoDS_Shape();
+}
+
+void HYDROData_Object::removeTopShape()
+{
+ TDF_Label aLabel = myLab.FindChild( DataTag_TopShape, false );
+ if ( !aLabel.IsNull() )
+ aLabel.ForgetAllAttributes();
+}
+
+TopoDS_Shape HYDROData_Object::getShape3D() const
+{
+ TDF_Label aLabel = myLab.FindChild( DataTag_Shape3D, false );
+ if ( !aLabel.IsNull() )
+ {
+ Handle(TNaming_NamedShape) aNamedShape;
+ if( aLabel.FindAttribute( TNaming_NamedShape::GetID(), aNamedShape ) )
+ return aNamedShape->Get();
+ }
+
+ return TopoDS_Shape();
+}
+
+void HYDROData_Object::removeShape3D()
+{
+ TDF_Label aLabel = myLab.FindChild( DataTag_Shape3D, false );
+ if ( !aLabel.IsNull() )
+ aLabel.ForgetAllAttributes();
+}
+
class TopoDS_Shape;
class Handle(HYDROData_Bathymetry);
class Handle(HYDROData_DummyObject3D);
+class Handle(HYDROData_EdgesGroup);
/**\class HYDROData_Object
* \brief The base class for all geometrical objects in the HYDRO module.
DataTag_Bathymetry, ///< reference bathymetry
DataTag_FillingColor, ///< filling color of geometrical object
DataTag_BorderColor, ///< border color of geometrical object
- DataTag_Object3D ///< child 3D object
+ DataTag_Object3D, ///< child 3D object
+ DataTag_EdgesGroup, ///< child group objects
};
public:
/**
* Returns reference object which represent the 3D shape of object.
- * Base implementation returns NULL pointer.
*/
HYDRODATA_EXPORT virtual Handle(HYDROData_DummyObject3D) GetObject3D() const;
+ /**
+ * Returns sequence of object groups.
+ */
+ HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetGroups() const;
+
/**
* Set reference bathymetry object for geometry object.
*/
HYDRODATA_EXPORT virtual void checkAndSetObject3D();
+
+ /**
+ * Create new one child group object.
+ */
+ HYDRODATA_EXPORT virtual Handle(HYDROData_EdgesGroup) createGroupObject();
+
+ /**
+ * Create all necessary child group objects.
+ * Base implementation does nothing.
+ */
+ HYDRODATA_EXPORT virtual void createGroupObjects();
+
+ /**
+ * Remove all child group objects.
+ */
+ HYDRODATA_EXPORT virtual void removeGroupObjects();
+
+
/**
* Retrieve the top shape of the object from data label.
*/