HYDROData_NaturalObject.h
HYDROData_Object.h
HYDROData_Obstacle.h
+ HYDROData_ObstacleAltitude.h
HYDROData_OperationsFactory.h
HYDROData_PolylineXY.h
HYDROData_Polyline3D.h
HYDROData_SplittedShapesGroup.h
HYDROData_SplitToZonesTool.h
HYDROData_Stream.h
+ HYDROData_StreamAltitude.h
HYDROData_Tool.h
HYDROData_VisualState.h
HYDROData_Zone.h
HYDROData_NaturalObject.cxx
HYDROData_Object.cxx
HYDROData_Obstacle.cxx
+ HYDROData_ObstacleAltitude.cxx
HYDROData_OperationsFactory.cxx
HYDROData_PolylineXY.cxx
HYDROData_Polyline3D.cxx
HYDROData_SplittedShapesGroup.cxx
HYDROData_SplitToZonesTool.cxx
HYDROData_Stream.cxx
+ HYDROData_StreamAltitude.cxx
HYDROData_Tool.cxx
HYDROData_VisualState.cxx
HYDROData_Zone.cxx
// Indicate model of the need to update the chanel presentation
SetToUpdate( true );
}
+
+ObjectKind HYDROData_Channel::getAltitudeObjectType() const
+{
+ return KIND_OBSTACLE_ALTITUDE;
+}
*/
HYDRODATA_EXPORT virtual QColor getDefaultBorderColor() const;
+ /**
+ * Returns the type of child altitude object.
+ * Reimplemented to create chanel altitude object.
+ */
+ virtual ObjectKind getAltitudeObjectType() const;
+
protected:
friend class HYDROData_Iterator;
const ObjectKind KIND_DUMMY_3D = 21;
const ObjectKind KIND_SHAPES_GROUP = 22;
const ObjectKind KIND_SPLITTED_GROUP = 23;
-const ObjectKind KIND_LAST = KIND_SPLITTED_GROUP;
+const ObjectKind KIND_STREAM_ALTITUDE = 24;
+const ObjectKind KIND_OBSTACLE_ALTITUDE = 25;
+const ObjectKind KIND_LAST = KIND_OBSTACLE_ALTITUDE;
DEFINE_STANDARD_HANDLE(HYDROData_Entity, MMgt_TShared)
#include "HYDROData_Image.h"
#include "HYDROData_ImmersibleZone.h"
#include "HYDROData_Obstacle.h"
+#include "HYDROData_ObstacleAltitude.h"
#include "HYDROData_Polyline3D.h"
#include "HYDROData_PolylineXY.h"
#include "HYDROData_Profile.h"
#include "HYDROData_River.h"
#include "HYDROData_SplittedShapesGroup.h"
#include "HYDROData_Stream.h"
+#include "HYDROData_StreamAltitude.h"
#include "HYDROData_Zone.h"
#include <TDataStd_Name.hxx>
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;
- case KIND_SHAPES_GROUP: aResult = new HYDROData_ShapesGroup(); break;
- case KIND_SPLITTED_GROUP: aResult = new HYDROData_SplittedShapesGroup();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_SHAPES_GROUP: aResult = new HYDROData_ShapesGroup(); break;
+ case KIND_SPLITTED_GROUP: aResult = new HYDROData_SplittedShapesGroup(); break;
+ case KIND_STREAM_ALTITUDE: aResult = new HYDROData_StreamAltitude(); break;
+ case KIND_OBSTACLE_ALTITUDE: aResult = new HYDROData_ObstacleAltitude(); break;
+ default: break;
}
if ( !aResult.IsNull() )
#include "HYDROData_DummyObject3D.h"
#include "HYDROData_ShapesGroup.h"
+#include "HYDROData_Tool.h"
#include "HYDROData_Iterator.h"
#include "HYDROData_IAltitudeObject.h"
if ( aGroup.IsNull() )
continue;
- QString aGroupName = aGroup->GetName();
- if ( anOldObjName.isEmpty() )
- aGroupName.prepend( theName + "_" );
- else if ( aGroupName.startsWith( anOldObjName ) )
- aGroupName.replace( anOldObjName, theName );
- else
- continue;
-
- aGroup->SetName( aGroupName );
+ HYDROData_Tool::UpdateChildObjectName( anOldObjName, theName, aGroup );
}
+
+ Handle(HYDROData_DummyObject3D) anObject3D = GetObject3D();
+ if ( !anObject3D.IsNull() )
+ HYDROData_Tool::UpdateChildObjectName( anOldObjName, theName, anObject3D );
+
+ Handle(HYDROData_IAltitudeObject) anAltitudeObj = getChildAltitudeObject();
+ if ( !anAltitudeObj.IsNull() )
+ HYDROData_Tool::UpdateChildObjectName( anOldObjName, theName, anAltitudeObj );
}
HYDROData_Entity::SetName( theName );
removeTopShape();
removeShape3D();
removeGroupObjects();
+ checkAndSetAltitudeObject();
}
HYDROData_SequenceOfObjects HYDROData_Object::GetAllReferenceObjects() const
return DefaultBorderColor();
}
+ObjectKind HYDROData_Object::getAltitudeObjectType() const
+{
+ return KIND_UNKNOWN;
+}
+
+Handle(HYDROData_IAltitudeObject) HYDROData_Object::getChildAltitudeObject() const
+{
+ Handle(HYDROData_IAltitudeObject) anObject;
+
+ TDF_Label aLabel = myLab.FindChild( DataTag_ChildAltitudeObject, false );
+ if ( !aLabel.IsNull() )
+ {
+ TDF_Label aChildLabel = aLabel.FindChild( 0, false );
+ if ( !aChildLabel.IsNull() )
+ {
+ anObject = Handle(HYDROData_IAltitudeObject)::DownCast(
+ HYDROData_Iterator::Object( aChildLabel ) );
+ }
+ }
+
+ return anObject;
+}
+
+void HYDROData_Object::checkAndSetAltitudeObject()
+{
+ Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myLab );
+
+ ObjectKind anAltitudeObjectType = getAltitudeObjectType();
+ if ( anAltitudeObjectType == KIND_UNKNOWN )
+ return; // No need to create altitude object
+
+ TDF_Label aLabel = myLab.FindChild( DataTag_ChildAltitudeObject, false );
+ if ( !aLabel.IsNull() )
+ return;
+
+ TDF_Label aChildLabel = myLab.FindChild( DataTag_ChildAltitudeObject ).FindChild( 0 );
+
+ Handle(HYDROData_IAltitudeObject) anAltitudeObject =
+ Handle(HYDROData_IAltitudeObject)::DownCast(
+ HYDROData_Iterator::CreateObject( aChildLabel, anAltitudeObjectType ) );
+
+ QString anAltitudePref = GetName() + "_Altitude";
+ QString anAltitudeName = HYDROData_Tool::GenerateObjectName( aDocument, anAltitudePref );
+ anAltitudeObject->SetName( anAltitudeName );
+
+ SetAltitudeObject( anAltitudeObject );
+}
+
Handle(HYDROData_ShapesGroup) HYDROData_Object::createGroupObject()
{
TDF_Label aNewLab = myLab.FindChild( DataTag_EdgesGroup ).NewChild();
DataTag_First = HYDROData_Entity::DataTag_First + 100, ///< first tag, to reserve
DataTag_TopShape,
DataTag_Shape3D,
- DataTag_AltitudeObject, ///< reference altitude object
- DataTag_FillingColor, ///< filling color of geometrical object
- DataTag_BorderColor, ///< border color of geometrical object
- DataTag_Object3D, ///< child 3D object
- DataTag_EdgesGroup, ///< child group objects
+ DataTag_AltitudeObject, ///< reference altitude object
+ DataTag_FillingColor, ///< filling color of geometrical object
+ DataTag_BorderColor, ///< border color of geometrical object
+ DataTag_Object3D, ///< child 3D object
+ DataTag_EdgesGroup, ///< child group objects
+ DataTag_ChildAltitudeObject, ///< child altitude object
};
public:
HYDRODATA_EXPORT virtual void checkAndSetObject3D();
+ /**
+ * Returns the type of child altitude object.
+ * Base implementation returns KIND_UNKNOWN, it means that child altitude
+ * object will not be created inside of checkAndSetAltitudeObject() function.
+ * Reimplement this function in your subclass an return correct altitude
+ * object type if you want to create child altitude object.
+ */
+ HYDRODATA_EXPORT virtual ObjectKind getAltitudeObjectType() const;
+
+ /**
+ * Checks and if necessary create child altitude object.
+ */
+ HYDRODATA_EXPORT virtual void checkAndSetAltitudeObject();
+
+ /**
+ * Return the child altitude object.
+ */
+ HYDRODATA_EXPORT virtual Handle(HYDROData_IAltitudeObject) getChildAltitudeObject() const;
+
+
/**
* Create new one child group object.
*/
}
}
+ObjectKind HYDROData_Obstacle::getAltitudeObjectType() const
+{
+ return KIND_OBSTACLE_ALTITUDE;
+}
*/
HYDRODATA_EXPORT virtual void createGroupObjects();
+ /**
+ * Returns the type of child altitude object.
+ * Reimplemented to create obstacle altitude object.
+ */
+ virtual ObjectKind getAltitudeObjectType() const;
+
protected:
friend class HYDROData_Iterator;
--- /dev/null
+
+#include "HYDROData_ObstacleAltitude.h"
+#include "HYDROData_Document.h"
+
+#include <QStringList>
+
+#define PYTHON_OBSTACLE_ALTITUDE_ID "KIND_OBSTACLE_ALTITUDE"
+
+
+IMPLEMENT_STANDARD_HANDLE(HYDROData_ObstacleAltitude, HYDROData_IAltitudeObject)
+IMPLEMENT_STANDARD_RTTIEXT(HYDROData_ObstacleAltitude, HYDROData_IAltitudeObject)
+
+HYDROData_ObstacleAltitude::HYDROData_ObstacleAltitude()
+: HYDROData_IAltitudeObject()
+{
+}
+
+HYDROData_ObstacleAltitude::~HYDROData_ObstacleAltitude()
+{
+}
+
+QStringList HYDROData_ObstacleAltitude::DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const
+{
+ QStringList aResList;
+
+ Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myLab );
+ if ( aDocument.IsNull() )
+ return aResList;
+
+ QString aDocName = aDocument->GetDocPyName();
+ QString anAltitudeName = GetName();
+
+ aResList << QString( "%1 = %2.CreateObject( %3 );" )
+ .arg( anAltitudeName ).arg( aDocName ).arg( PYTHON_OBSTACLE_ALTITUDE_ID );
+ aResList << QString( "%1.SetName( \"%2\" );" )
+ .arg( anAltitudeName ).arg( anAltitudeName );
+
+ // TODO
+
+ return aResList;
+}
+
+double HYDROData_ObstacleAltitude::GetAltitudeForPoint( const gp_XY& thePoint ) const
+{
+ double aResAltitude = GetInvalidAltitude();
+
+ return aResAltitude;
+}
+
+
+
+
--- /dev/null
+
+#ifndef HYDROData_ObstacleAltitude_HeaderFile
+#define HYDROData_ObstacleAltitude_HeaderFile
+
+
+#include "HYDROData_IAltitudeObject.h"
+
+
+DEFINE_STANDARD_HANDLE(HYDROData_ObstacleAltitude, HYDROData_IAltitudeObject)
+
+
+/**\class HYDROData_ObstacleAltitude
+ * \brief Class that stores/retreives information about the obstacle altitude.
+ *
+ */
+class HYDROData_ObstacleAltitude : public HYDROData_IAltitudeObject
+{
+protected:
+
+ /**
+ * Enumeration of tags corresponding to the persistent object parameters.
+ */
+ enum DataTag
+ {
+ DataTag_First = HYDROData_IAltitudeObject::DataTag_First + 100, ///< first tag, to reserve
+ };
+
+public:
+
+ DEFINE_STANDARD_RTTI(HYDROData_ObstacleAltitude);
+
+ /**
+ * Returns the kind of this object.
+ */
+ HYDRODATA_EXPORT virtual const ObjectKind GetKind() const { return KIND_OBSTACLE_ALTITUDE; }
+
+
+ /**
+ * Dump Altitude object to Python script representation.
+ */
+ HYDRODATA_EXPORT virtual QStringList DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const;
+
+public:
+
+ // Public methods to work with altitudes.
+
+ /**
+ * Returns altitude for given point.
+ * \param thePoint the point to examine
+ * \return altitude value
+ */
+ HYDRODATA_EXPORT virtual double GetAltitudeForPoint( const gp_XY& thePoint ) const;
+
+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_ObstacleAltitude();
+
+ /**
+ * Destructs properties of the object and object itself, removes it from the document.
+ */
+ HYDRODATA_EXPORT ~HYDROData_ObstacleAltitude();
+};
+
+#endif
anOutGroup->AddShape( aTopEdge );
}
+ObjectKind HYDROData_Stream::getAltitudeObjectType() const
+{
+ return KIND_STREAM_ALTITUDE;
+}
+
void HYDROData_Stream::setParametersArray( const TColStd_Array1OfReal& theArray )
{
if ( theArray.Length() == 0 )
/**
* Create all necessary child group objects.
*/
- HYDRODATA_EXPORT virtual void createGroupObjects();
+ virtual void createGroupObjects();
+
+ /**
+ * Returns the type of child altitude object.
+ * Reimplemented to create stream altitude object.
+ */
+ virtual ObjectKind getAltitudeObjectType() const;
/**
* Builds b-spline using interpolation algorithm.
/**
* Returns default filling color for new object.
*/
- HYDRODATA_EXPORT virtual QColor getDefaultFillingColor() const;
+ virtual QColor getDefaultFillingColor() const;
/**
* Returns default border color for new object.
*/
- HYDRODATA_EXPORT virtual QColor getDefaultBorderColor() const;
+ virtual QColor getDefaultBorderColor() const;
private:
--- /dev/null
+
+#include "HYDROData_StreamAltitude.h"
+#include "HYDROData_Document.h"
+
+#include <QStringList>
+
+#define PYTHON_STREAM_ALTITUDE_ID "KIND_STREAM_ALTITUDE"
+
+
+IMPLEMENT_STANDARD_HANDLE(HYDROData_StreamAltitude, HYDROData_IAltitudeObject)
+IMPLEMENT_STANDARD_RTTIEXT(HYDROData_StreamAltitude, HYDROData_IAltitudeObject)
+
+HYDROData_StreamAltitude::HYDROData_StreamAltitude()
+: HYDROData_IAltitudeObject()
+{
+}
+
+HYDROData_StreamAltitude::~HYDROData_StreamAltitude()
+{
+}
+
+QStringList HYDROData_StreamAltitude::DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const
+{
+ QStringList aResList;
+
+ Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myLab );
+ if ( aDocument.IsNull() )
+ return aResList;
+
+ QString aDocName = aDocument->GetDocPyName();
+ QString anAltitudeName = GetName();
+
+ aResList << QString( "%1 = %2.CreateObject( %3 );" )
+ .arg( anAltitudeName ).arg( aDocName ).arg( PYTHON_STREAM_ALTITUDE_ID );
+ aResList << QString( "%1.SetName( \"%2\" );" )
+ .arg( anAltitudeName ).arg( anAltitudeName );
+
+ // TODO
+
+ return aResList;
+}
+
+double HYDROData_StreamAltitude::GetAltitudeForPoint( const gp_XY& thePoint ) const
+{
+ double aResAltitude = GetInvalidAltitude();
+
+ return aResAltitude;
+}
+
+
+
+
--- /dev/null
+
+#ifndef HYDROData_StreamAltitude_HeaderFile
+#define HYDROData_StreamAltitude_HeaderFile
+
+
+#include "HYDROData_IAltitudeObject.h"
+
+
+DEFINE_STANDARD_HANDLE(HYDROData_StreamAltitude, HYDROData_IAltitudeObject)
+
+
+/**\class HYDROData_StreamAltitude
+ * \brief Class that stores/retreives information about the stream altitude.
+ *
+ */
+class HYDROData_StreamAltitude : public HYDROData_IAltitudeObject
+{
+protected:
+
+ /**
+ * Enumeration of tags corresponding to the persistent object parameters.
+ */
+ enum DataTag
+ {
+ DataTag_First = HYDROData_IAltitudeObject::DataTag_First + 100, ///< first tag, to reserve
+ };
+
+public:
+
+ DEFINE_STANDARD_RTTI(HYDROData_StreamAltitude);
+
+ /**
+ * Returns the kind of this object.
+ */
+ HYDRODATA_EXPORT virtual const ObjectKind GetKind() const { return KIND_STREAM_ALTITUDE; }
+
+
+ /**
+ * Dump Altitude object to Python script representation.
+ */
+ HYDRODATA_EXPORT virtual QStringList DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const;
+
+public:
+
+ // Public methods to work with altitudes.
+
+ /**
+ * Returns altitude for given point.
+ * \param thePoint the point to examine
+ * \return altitude value
+ */
+ HYDRODATA_EXPORT virtual double GetAltitudeForPoint( const gp_XY& thePoint ) const;
+
+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_StreamAltitude();
+
+ /**
+ * Destructs properties of the object and object itself, removes it from the document.
+ */
+ HYDRODATA_EXPORT ~HYDROData_StreamAltitude();
+};
+
+#endif