X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROData%2FHYDROData_Stream.h;h=45a81943493c1a8cb4c07474f372e15bded0bc13;hb=cd6ea20d9a76665a24a533d0340385a335961f05;hp=4f3644060af53742c1ba0a8d8c70b5043a903d6c;hpb=517590ff502b021ac3b88b59c9f063a1470cc8a9;p=modules%2Fhydro.git diff --git a/src/HYDROData/HYDROData_Stream.h b/src/HYDROData/HYDROData_Stream.h index 4f364406..45a81943 100644 --- a/src/HYDROData/HYDROData_Stream.h +++ b/src/HYDROData/HYDROData_Stream.h @@ -1,10 +1,35 @@ +// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// #ifndef HYDROData_Stream_HeaderFile #define HYDROData_Stream_HeaderFile #include "HYDROData_NaturalObject.h" + #include +#include + #include + DEFINE_STANDARD_HANDLE(HYDROData_Stream, HYDROData_NaturalObject) class Handle(HYDROData_PolylineXY); @@ -17,6 +42,18 @@ class TColStd_Array1OfReal; */ class HYDROData_Stream : public HYDROData_NaturalObject { +public: + + struct PrsDefinition + { + TopoDS_Shape myPrs3D; + TopoDS_Shape myPrs2D; + TopoDS_Edge myLeftBank; + TopoDS_Edge myRightBank; + TopoDS_Edge myInlet; + TopoDS_Edge myOutlet; + }; + protected: /** * Enumeration of tags corresponding to the persistent object parameters. @@ -30,8 +67,20 @@ protected: }; public: + DEFINE_STANDARD_RTTI(HYDROData_Stream); +public: + + /** + * Creates the presentations(2D and 3D) by given hydraulic axis and profiles. + */ + HYDRODATA_EXPORT static bool CreatePresentations( const Handle(HYDROData_PolylineXY)& theHydAxis, + const HYDROData_SequenceOfObjects& theProfiles, + PrsDefinition& thePrs ); + +public: + /** * Returns the kind of this object. Must be redefined in all objects of known type. */ @@ -58,11 +107,21 @@ public: HYDRODATA_EXPORT virtual TopoDS_Shape GetShape3D() const; /** - * Update the shape presentations of stream. + * Update the profiles order and shape presentations of stream. * Call this method whenever you made changes for stream data. */ HYDRODATA_EXPORT virtual void Update(); + /** + * Checks that object has 2D presentation. Reimlemented to retun true. + */ + HYDRODATA_EXPORT virtual bool IsHas2dPrs() const; + + /** + * Update the shape presentations of stream. + */ + HYDRODATA_EXPORT virtual void UpdatePrs(); + /** * Returns default filling color for new stream. */ @@ -73,10 +132,38 @@ public: */ HYDRODATA_EXPORT static QColor DefaultBorderColor(); + /** + * Returns true if given polyline can be used as stream axis. + */ + HYDRODATA_EXPORT static bool IsValidAsAxis( const Handle(HYDROData_PolylineXY)& theAxis ); public: - // Public methods to work with Stream + // Public methods to work with Stream presentation + /** + * Returns the left edge of the stream. + */ + HYDRODATA_EXPORT virtual TopoDS_Shape GetLeftShape() const; + + /** + * Returns the right edge of the stream. + */ + HYDRODATA_EXPORT virtual TopoDS_Shape GetRightShape() const; + + /** + * Returns the inlet edge of the stream. + */ + HYDRODATA_EXPORT virtual TopoDS_Shape GetInletShape() const; + + /** + * Returns the outlet edge of the stream. + */ + HYDRODATA_EXPORT virtual TopoDS_Shape GetOutletShape() const; + + +public: + // Public methods to work with Stream data fields + /** * Sets reference hydraulic axis object for stream. */ @@ -98,27 +185,36 @@ public: * if axis presented by set of edges the returns a common length of segments till the intersection point. */ HYDRODATA_EXPORT static bool HasIntersection( const Handle(HYDROData_PolylineXY)& theHydAxis, - const Handle(HYDROData_Profile)& theProfile, const TopoDS_Face& thePlane, - Standard_Real& outPar); + const Handle(HYDROData_Profile)& theProfile, + const TopoDS_Face& thePlane, + Standard_Real& theOutPar ); /** * Returns true if profile has the intersection with reference hydraulic axis. * Returns the parameter of inresection point on axis if axis is presented by one curve, * if axis presented by set of edges the returns a common length of segments till the intersection point. */ - HYDRODATA_EXPORT virtual bool HasIntersection( const Handle(HYDROData_Profile)& theProfile, const TopoDS_Face& thePlane, - Standard_Real& outPar) const; + HYDRODATA_EXPORT virtual bool HasIntersection( const Handle(HYDROData_Profile)& theProfile, + const TopoDS_Face& thePlane, + Standard_Real& theOutPar ) const; - /** - * Builds a planar face - */ - HYDRODATA_EXPORT virtual bool BuildFace( const Handle(HYDROData_PolylineXY)& theHydAxis, TopoDS_Face& thePlane) const; + /** + * Builds a planar face + */ + HYDRODATA_EXPORT static bool BuildFace( const Handle(HYDROData_PolylineXY)& theHydAxis, + TopoDS_Face& thePlane ); /** * Add new one reference profile object for stream. */ HYDRODATA_EXPORT virtual bool AddProfile( const Handle(HYDROData_Profile)& theProfile ); + /** + * Add new one reference profile object for stream. + */ + HYDRODATA_EXPORT virtual bool SetProfiles( const HYDROData_SequenceOfObjects& theProfiles, + const bool& theIsToOrder = true ); + /** * Returns all reference profile objects of stream. */ @@ -148,31 +244,27 @@ protected: */ void updateProfilesOrder(); - /** - * Create all necessary child group objects. - */ - virtual void createGroupObjects(); - /** * Returns the type of child altitude object. * Reimplemented to create stream altitude object. */ - virtual ObjectKind getAltitudeObjectType() const; + HYDRODATA_EXPORT virtual ObjectKind getAltitudeObjectType() const; /** * Builds b-spline using interpolation algorithm. */ - Handle(Geom_BSplineCurve) buildInterpolationCurve(const Handle(TColgp_HArray1OfPnt)& theArrayOfPnt); + static Handle(Geom_BSplineCurve) buildInterpolationCurve( + const Handle(TColgp_HArray1OfPnt)& theArrayOfPnt ); /** * Returns default filling color for new object. */ - virtual QColor getDefaultFillingColor() const; + HYDRODATA_EXPORT virtual QColor getDefaultFillingColor() const; /** * Returns default border color for new object. */ - virtual QColor getDefaultBorderColor() const; + HYDRODATA_EXPORT virtual QColor getDefaultBorderColor() const; private: @@ -203,3 +295,5 @@ protected: }; #endif + +