X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROData%2FHYDROData_SplitToZonesTool.h;h=367b22cdcf10512743edbd57c142d6eb3ba11475;hb=0f4c16e80e5c9160fb6e240e3f09b151701a1e5b;hp=4d7780f3ba882fbb1858e963d519a6e8573b850f;hpb=d84fadb6fba0d9ef3926995eab878175cc24e291;p=modules%2Fhydro.git diff --git a/src/HYDROData/HYDROData_SplitToZonesTool.h b/src/HYDROData/HYDROData_SplitToZonesTool.h index 4d7780f3..367b22cd 100644 --- a/src/HYDROData/HYDROData_SplitToZonesTool.h +++ b/src/HYDROData/HYDROData_SplitToZonesTool.h @@ -1,12 +1,40 @@ +// Copyright (C) 2014-2015 EDF-R&D +// 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_SplitToZonesTool_H #define HYDROData_SplitToZonesTool_H -#include +#ifdef WIN32 + #pragma warning ( disable: 4251 ) +#endif +#include +#include +#include +#include #include - +#include +#include +#include +#include +#include #include +#include class Handle(HYDROData_PolylineXY); @@ -20,40 +48,81 @@ class HYDRODATA_EXPORT HYDROData_SplitToZonesTool public: struct HYDRODATA_EXPORT SplitData { - TopoDS_Shape Shape; - QStringList ObjectNames; - - SplitData() {} + enum SplitObjectType + { + Data_None, + Data_Zone, + Data_Edge, + Data_IntEdge + }; + + TopoDS_Shape Shape; + QStringList ObjectNames; + SplitObjectType Type; + + SplitData() : + Type( Data_None ) {} - SplitData( const TopoDS_Shape& theShape, - const QStringList& theObjectNames ) : - Shape( theShape ), ObjectNames( theObjectNames ) {} + SplitData( const SplitObjectType& theType, + const TopoDS_Shape& theShape, + const QStringList& theObjectNames ) : + Type( theType ), Shape( theShape ), ObjectNames( theObjectNames ) {} - SplitData( const TopoDS_Shape& theShape, - const QString& theObjectNames ) : - Shape( theShape ), ObjectNames( theObjectNames ) {} + SplitData( const SplitObjectType& theType, + const TopoDS_Shape& theShape, + const QString& theObjectName ) : + Type( theType ), Shape( theShape ), ObjectNames( theObjectName ) {} TopoDS_Face Face() const; }; typedef QList SplitDataList; - typedef QListIterator SplitDataListIterator; + typedef QListIterator SplitDataListIterator; + typedef NCollection_IndexedMap HYDROData_MapOfShape; + typedef HYDROData_MapOfShape::Iterator HYDROData_MapIteratorOfMapOfShape; + typedef NCollection_IndexedDataMap HYDROData_DataMapOfShapeListOfShape; + typedef HYDROData_DataMapOfShapeListOfShape::Iterator HYDROData_DataMapIteratorOfDataMapOfShapeListOfShape; + typedef NCollection_IndexedDataMap HYDROData_DataMapOfShapeListOfString; + typedef HYDROData_DataMapOfShapeListOfString::Iterator HYDROData_DataMapIteratorOfDataMapOfShapeListOfString; + #undef _NCollection_MapHasher public: - static SplitDataList SplitToZones( const HYDROData_SequenceOfObjects& theObjectList, - const Handle(HYDROData_PolylineXY)& thePolyline ); + static SplitDataList Split( const HYDROData_SequenceOfObjects& theObjectList, + const HYDROData_SequenceOfObjects& theGroupsList, + const Handle(HYDROData_PolylineXY)& thePolyline, + const HYDROData_SequenceOfObjects& InterPolys ); -private: + static SplitDataList Split( const HYDROData_SequenceOfObjects& theObjectList ); + + static void AddInternalEdges(HYDROData_DataMapOfShapeListOfShape& DM, + const HYDROData_SequenceOfObjects& thePolylines, + NCollection_DataMap* OutNE); - static bool SplitTwoData( const SplitData& theData1, - const SplitData& theData2, - SplitData& theData1Subtracted, - SplitData& theData2Subtracted, - SplitData& theDataIntersected ); + static void CutFaceByEdges(const TopoDS_Face& in, + TopTools_ListOfShape& out, + const HYDROData_SequenceOfObjects& thePolylines, + NCollection_DataMap* OutNE, + TopTools_IndexedDataMapOfShapeListOfShape* OutOrSh2M); - static SplitDataList ExtractSeparateData( const SplitData& theData ); + static int CutByEdges(const TopoDS_Shape& InSh, const TopTools_ListOfShape& InW, + TopTools_ListOfShape& outShs, + TopTools_IndexedDataMapOfShapeShape* OutNE2OE, + TopTools_IndexedDataMapOfShapeListOfShape* OInSH2MSH); + static void SetFileNames(const QString& theNameBefore, const QString& theNameAfter); + +private: + + /** + * Split input faces. + */ + static Standard_Integer SplitFaces(const TopoDS_Compound& theComp, HYDROData_Transform& theTool); }; +#ifdef WIN32 + #pragma warning ( default: 4251 ) +#endif + + #endif