1 // Copyright (C) 2014-2015 EDF-R&D
2 // This library is free software; you can redistribute it and/or
3 // modify it under the terms of the GNU Lesser General Public
4 // License as published by the Free Software Foundation; either
5 // version 2.1 of the License, or (at your option) any later version.
7 // This library is distributed in the hope that it will be useful,
8 // but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10 // Lesser General Public License for more details.
12 // You should have received a copy of the GNU Lesser General Public
13 // License along with this library; if not, write to the Free Software
14 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #include <HYDROData_LandCoverMap.h>
20 #include <HYDROData_Object.h>
21 #include <HYDROData_PolylineXY.h>
22 #include <HYDROData_Tool.h>
23 #include <HYDROData_ShapeFile.h>
25 #include <BOPAlgo_BOP.hxx>
26 #include <BOPAlgo_Builder.hxx>
27 #include <BOPAlgo_PaveFiller.hxx>
28 #include <BOPCol_ListOfShape.hxx>
29 #include <BRep_Builder.hxx>
30 #include <BRepAdaptor_Curve.hxx>
31 #include <BRepAlgoAPI_Fuse.hxx>
32 #include <BRepBuilderAPI_MakeFace.hxx>
33 #include <GCPnts_QuasiUniformDeflection.hxx>
35 #include <TopoDS_Compound.hxx>
36 #include <TopoDS_Edge.hxx>
37 #include <TopoDS_Face.hxx>
38 #include <TopoDS_Iterator.hxx>
39 #include <TopoDS_Shell.hxx>
40 #include <TopExp_Explorer.hxx>
41 #include <TopTools_ListIteratorOfListOfShape.hxx>
42 #include <BOPAlgo_PaveFiller.hxx>
43 #include <BRepTools.hxx>
44 #include <TopExp_Explorer.hxx>
45 #include <ShapeUpgrade_UnifySameDomain.hxx>
49 #include <QTextStream>
51 const char TELEMAC_FORMAT = 'f';
52 const int TELEMAC_PRECISION = 3;
55 IMPLEMENT_STANDARD_HANDLE(HYDROData_LandCoverMap, HYDROData_Entity)
56 IMPLEMENT_STANDARD_RTTIEXT(HYDROData_LandCoverMap, HYDROData_Entity)
60 @param theMap the land cover map to iterate through
62 HYDROData_LandCoverMap::Iterator::Iterator( const HYDROData_LandCoverMap& theMap )
67 HYDROData_LandCoverMap::Iterator::Iterator( const Handle( HYDROData_LandCoverMap )& theMap )
79 Initialize the iterator
80 @param theMap the land cover map to iterate through
82 void HYDROData_LandCoverMap::Iterator::Init( const HYDROData_LandCoverMap& theMap )
84 TopoDS_Shape aShape = theMap.GetShape();
88 myIterator = new TopoDS_Iterator( aShape );
90 theMap.myLab.FindChild( DataTag_Types ).FindAttribute( TDataStd_ExtStringArray::GetID(), myArray );
91 if( myArray.IsNull() )
94 myIndex = myArray->Lower();
100 HYDROData_LandCoverMap::Iterator::~Iterator()
106 Return the current 0-based index of the iterator
107 @return the current index
109 int HYDROData_LandCoverMap::Iterator::Index() const
111 if( myArray.IsNull() )
114 return myIndex - myArray->Lower();
118 Return if the iterator has more elements
119 @return if the iterator has more elements
121 bool HYDROData_LandCoverMap::Iterator::More() const
123 return !myArray.IsNull() && myIterator && myIterator->More();
127 Move iterator to the next element
129 void HYDROData_LandCoverMap::Iterator::Next()
139 Get the current land cover (face)
140 @return the land cover's face
142 TopoDS_Face HYDROData_LandCoverMap::Iterator::Face() const
145 return TopoDS::Face( myIterator->Value() );
147 return TopoDS_Face();
151 Get the current land cover's Strickler type
152 @return the land cover's Strickler type
154 QString HYDROData_LandCoverMap::Iterator::StricklerType() const
156 if( myArray.IsNull() || myIndex < myArray->Lower() || myIndex > myArray->Upper() )
159 return HYDROData_Tool::toQString( myArray->Value( myIndex ) );
163 Set the Strickler type for the current land cover
164 @param theType the Strickler type
166 void HYDROData_LandCoverMap::Iterator::SetStricklerType( const QString& theType )
168 if( myArray.IsNull() || myIndex < myArray->Lower() || myIndex > myArray->Upper() )
171 myArray->SetValue( myIndex, HYDROData_Tool::toExtString( theType ) );
177 HYDROData_LandCoverMap::HYDROData_LandCoverMap()
178 : HYDROData_Entity( Geom_No )
185 HYDROData_LandCoverMap::~HYDROData_LandCoverMap()
191 @return object's kind
193 const ObjectKind HYDROData_LandCoverMap::GetKind() const
195 return KIND_LAND_COVER_MAP;
198 int HYDROData_LandCoverMap::GetLCCount() const
200 Iterator anIt( *this );
202 for( ; anIt.More(); anIt.Next() )
207 bool HYDROData_LandCoverMap::IsEmpty() const
209 Iterator anIt( *this );
217 Load attributes from DBF File
220 HYDROData_LandCoverMap::DBFStatus HYDROData_LandCoverMap::ImportDBF( const QString& theDBFFileName,
221 const QString& theFieldName,
222 const QStringList& theDBFValues,
223 const QStringList& theStricklerTypes,
224 const QList<int>& theIndices )
226 if (theDBFValues.size() != theStricklerTypes.size())
227 return DBFStatus_DIFF_SIZE_ERROR;
228 HYDROData_ShapeFile aDBFImporter;
229 if (!aDBFImporter.DBF_OpenDBF(theDBFFileName))
230 return DBFStatus_OPEN_FILE_ERROR; //cant open file
232 QStringList FieldList = aDBFImporter.DBF_GetFieldList();
233 int FieldNameIndex = FieldList.indexOf(theFieldName);
234 if (FieldNameIndex == -1)
235 return DBFStatus_NO_SUCH_FIELD_ERROR; //no such field
237 std::vector<HYDROData_ShapeFile::DBF_AttrValue> theAttrV;
238 aDBFImporter.DBF_GetAttributeList(FieldNameIndex, theAttrV );
241 Iterator anIt( *this );
242 for( ; anIt.More(); anIt.Next() )
244 int CurIndex = anIt.Index();
245 HYDROData_ShapeFile::DBF_AttrValue AValue = theAttrV[theIndices[CurIndex]];
246 int StricklerTypesInd = theDBFValues.indexOf(QString(AValue.myStrVal));
247 if ( StricklerTypesInd != -1)
248 anIt.SetStricklerType(theStricklerTypes[StricklerTypesInd]);
255 return DBFStatus_NO_DBFVALUES_CORRESPONDENCE_WARNING;
259 Export attributes to DBF File
262 void HYDROData_LandCoverMap::ExportDBF( const QString& theDBFFileName,
263 const QString& theFieldName,
264 const QStringList& theDBFValues,
265 const QStringList& theStricklerTypes) const
267 if (theDBFValues.size() != theStricklerTypes.size())
269 HYDROData_ShapeFile anExporter;
270 std::vector<HYDROData_ShapeFile::DBF_AttrValue> theAttrV;
271 Iterator anIt( *this );
272 for( ; anIt.More(); anIt.Next() )
274 QString CurST = anIt.StricklerType();
275 HYDROData_ShapeFile::DBF_AttrValue aCurAttrV;
276 aCurAttrV.myIsNull = false;
277 int StricklerTypesInd = theStricklerTypes.indexOf(CurST);
278 if (StricklerTypesInd != -1)
280 aCurAttrV.myStrVal = theDBFValues[StricklerTypesInd];
281 aCurAttrV.myFieldType = HYDROData_ShapeFile::DBF_FieldType_String;
282 theAttrV.push_back(aCurAttrV);
285 aCurAttrV.myIsNull = true;
287 //use actual str value; not the raw value
288 anExporter.DBF_WriteFieldAndValues(theDBFFileName, theFieldName, HYDROData_ShapeFile::DBF_FieldType_String, theAttrV, false);
292 int HashCode( const gp_Pnt& thePoint, const Standard_Integer theUpper )
294 int aHashX = HashCode( thePoint.X(), theUpper );
295 int aHashY = HashCode( thePoint.Y(), theUpper );
296 return (aHashX^aHashY)%theUpper;
299 bool operator == ( const gp_Pnt& thePoint1, const gp_Pnt& thePoint2 )
301 return thePoint1.IsEqual( thePoint2, Precision::Confusion() );
304 bool EdgeDiscretization( const TopoDS_Edge& theEdge,
305 Standard_Real theDeflection,
306 NCollection_IndexedMap<gp_Pnt>& theVerticesMap,
307 QList<int>& theVerticesIds )
309 BRepAdaptor_Curve aCurve( theEdge );
310 GCPnts_QuasiUniformDeflection aDiscrete( aCurve, theDeflection );
311 if( !aDiscrete.IsDone() )
314 int n = aDiscrete.NbPoints();
315 for( int i=1; i<=n; i++ )
317 gp_Pnt aPnt = aDiscrete.Value( i );
319 if( theVerticesMap.Contains( aPnt ) )
320 anId = theVerticesMap.FindIndex( aPnt );
323 anId = theVerticesMap.Size();
324 theVerticesMap.Add( aPnt );
326 theVerticesIds.append( anId );
332 Export the land cover map for the solver (Telemac)
333 @param theFileName the name of file
334 @return if the export is successful
336 bool HYDROData_LandCoverMap::ExportTelemac( const QString& theFileName, Standard_Real theDeflection ) const
338 TopoDS_Shape aLandCoverMapShape = GetShape();
339 TopTools_ListOfShape aListOfFaces;
340 TopExp_Explorer anExp( aLandCoverMapShape, TopAbs_FACE );
341 for( ; anExp.More(); anExp.Next() )
342 aListOfFaces.Append( anExp.Current() );
344 TopoDS_Shape aShape = MergeFaces( aListOfFaces, false );
346 NCollection_IndexedMap<gp_Pnt> aVerticesMap;
347 NCollection_IndexedDataMap< TopoDS_Edge, QList<int> > anEdgesMap;
348 NCollection_IndexedDataMap< TopoDS_Face, QList<int> > aFacesMap;
350 // add into the map all edges existing in the shell
351 TopExp_Explorer anExp1( aShape, TopAbs_EDGE );
352 for( ; anExp1.More(); anExp1.Next() )
354 TopoDS_Edge anEdge = TopoDS::Edge( anExp1.Current() );
355 QList<int> aVerticesIdsList;
356 if( EdgeDiscretization( anEdge, theDeflection, aVerticesMap, aVerticesIdsList ) )
357 anEdgesMap.Add( anEdge, aVerticesIdsList );
360 // add into the map all faces existing in the shell and correspondence between face and edges ids
361 TopExp_Explorer anExp2( aShape, TopAbs_FACE );
362 for( ; anExp2.More(); anExp2.Next() )
364 TopoDS_Face aFace = TopoDS::Face( anExp2.Current() );
365 TopExp_Explorer anExp3( aFace, TopAbs_EDGE );
366 QList<int> anEdgesIdsList;
367 for( ; anExp3.More(); anExp3.Next() )
369 TopoDS_Edge anEdge = TopoDS::Edge( anExp3.Current() );
370 int anEdgeId = anEdgesMap.FindIndex( anEdge );
371 anEdgesIdsList.append( anEdgeId );
373 aFacesMap.Add( aFace, anEdgesIdsList );
376 QFile aFile( theFileName );
377 if( !aFile.open( QFile::WriteOnly | QFile::Text ) )
380 QTextStream aStream( &aFile );
381 aStream << "# nodes\n";
382 NCollection_IndexedMap<gp_Pnt>::Iterator anIt1( aVerticesMap );
383 for( ; anIt1.More(); anIt1.Next() )
385 gp_Pnt aPnt = anIt1.Value();
386 aStream << QString::number( aPnt.X(), TELEMAC_FORMAT, TELEMAC_PRECISION );
388 aStream << QString::number( aPnt.Y(), TELEMAC_FORMAT, TELEMAC_PRECISION );
390 aStream << QString::number( aPnt.Z(), TELEMAC_FORMAT, TELEMAC_PRECISION );
395 aStream << "# edges\n";
396 NCollection_IndexedDataMap< TopoDS_Edge, QList<int> >::Iterator anIt2( anEdgesMap );
397 for( ; anIt2.More(); anIt2.Next() )
399 QList<int> aVerticesIds = anIt2.Value();
400 foreach( int anId, aVerticesIds )
401 aStream << anId << " ";
406 aStream << "# faces\n";
407 NCollection_IndexedDataMap< TopoDS_Face, QList<int> >::Iterator anIt3( aFacesMap );
408 for( ; anIt3.More(); anIt3.Next() )
410 QList<int> anEdgesIds = anIt3.Value();
411 foreach( int anId, anEdgesIds )
412 aStream << anId << " ";
422 Add a new object as land cover
423 @param theObject the object to add as land cover
424 @param theType the Strickler type for the new land cover
425 @return if the addition is successful
427 bool HYDROData_LandCoverMap::Add( const Handle( HYDROData_Object )& theObject, const QString& theType )
429 if( theObject.IsNull() )
432 TopoDS_Shape aShape = theObject->GetTopShape();
433 if( aShape.ShapeType()!=TopAbs_FACE )
436 TopoDS_Face aFace = TopoDS::Face( aShape );
437 return LocalPartition( aFace, theType );
440 bool HYDROData_LandCoverMap::Add( const TopoDS_Wire& theWire, const QString& theType )
442 if( !theWire.Closed() )
445 TopoDS_Face aFace = BRepBuilderAPI_MakeFace( theWire, Standard_True ).Face();
446 return LocalPartition( aFace, theType );
450 Add a new polyline as land cover
451 @param thePolyline the polyline to add as land cover
452 @param theType the Strickler type for the new land cover
453 @return if the addition is successful
455 bool HYDROData_LandCoverMap::Add( const Handle( HYDROData_PolylineXY )& thePolyline, const QString& theType )
457 if( thePolyline.IsNull() )
460 TopoDS_Shape aShape = thePolyline->GetShape();
461 if( aShape.ShapeType()==TopAbs_WIRE )
462 return Add( TopoDS::Wire( aShape ), theType );
464 if( aShape.ShapeType()==TopAbs_COMPOUND )
466 TopExp_Explorer anExp( aShape, TopAbs_WIRE );
467 for( ; anExp.More(); anExp.Next() )
469 TopoDS_Wire aPart = TopoDS::Wire( anExp.Current() );
470 if( !Add( aPart, theType ) )
480 Remove the given face from land cover map
481 @param theFace the face to be removed
482 @return if the removing is successful
484 bool HYDROData_LandCoverMap::Remove( const TopoDS_Face& theFace )
486 TopTools_ListOfShape aList;
487 aList.Append( theFace );
488 return Remove( aList );
492 Remove the given faces from land cover map
493 @param theFacesToRemove the face list to be removed
494 @return if the removing is successful
496 bool HYDROData_LandCoverMap::Remove( const TopTools_ListOfShape& theFacesToRemove )
498 HYDROData_MapOfFaceToStricklerType aFacesToRemove, aNewFaces;
499 TopTools_ListIteratorOfListOfShape aFIt( theFacesToRemove );
500 for( ; aFIt.More(); aFIt.Next() )
502 TopoDS_Shape aShape = aFIt.Value();
503 if( aShape.ShapeType()==TopAbs_FACE )
504 aFacesToRemove.Add( TopoDS::Face( aShape ), "" );
507 Iterator anIt( *this );
508 for( ; anIt.More(); anIt.Next() )
509 if( !aFacesToRemove.Contains( anIt.Face() ) )
510 aNewFaces.Add( anIt.Face(), anIt.StricklerType() );
512 StoreLandCovers( aNewFaces );
517 Split the land cover map by the given polyline
518 @param thePolyline the tool polyline to split the land cover map
519 @return if the removing is successful
521 bool HYDROData_LandCoverMap::Split( const Handle( HYDROData_PolylineXY )& thePolyline )
523 if( thePolyline.IsNull() )
526 TopoDS_Shape aShape = thePolyline->GetShape();
527 return Split( aShape );
532 Split the land cover map by the given polyline
533 @param theShape the tool polyline to split the land cover map
534 @return if the removing is successful
536 bool HYDROData_LandCoverMap::Split( const TopoDS_Shape& theShape )
538 return LocalPartition( theShape, "" );
543 Merge the given faces in the land cover
544 @param theFaces the faces to merge in the land cover map
545 @param theType the Strickler type for the merged land cover
546 @return if the merge is successful
548 bool HYDROData_LandCoverMap::Merge( const TopTools_ListOfShape& theFaces, const QString& theType )
550 // 1. to fuse the faces into the new face
551 TopoDS_Shape aMergedFace = MergeFaces( theFaces, true );
552 if( aMergedFace.ShapeType()==TopAbs_FACE )
554 // 2. to remove the merged faces from the current map
557 // 3. to add the face into the map
558 return LocalPartition( TopoDS::Face( aMergedFace ), theType );
564 Merge the given faces into the shell/face
565 @param theFaces the faces to merge
566 @param IsToUnify if the common edges should be removed (fused)
567 @param theTolerance the operation's tolerance
568 @return result shape (face or shell)
570 TopoDS_Shape HYDROData_LandCoverMap::MergeFaces( const TopTools_ListOfShape& theFaces,
571 bool IsToUnify, double theTolerance )
574 TopTools_ListIteratorOfListOfShape anIt;
575 BOPCol_ListOfShape aLC;
576 anIt.Initialize(theFaces);
577 for( ; anIt.More(); anIt.Next() )
579 if (anIt.Value().ShapeType() != TopAbs_FACE)
580 return TopoDS_Shape();
581 aLC.Append( anIt.Value() );
584 BOPAlgo_PaveFiller aPF;
585 aPF.SetArguments( aLC );
586 aPF.SetRunParallel( Standard_False );
587 aPF.SetFuzzyValue( theTolerance );
590 anError = aPF.ErrorStatus();
592 return TopoDS_Shape();
594 BOPAlgo_Builder anAlgo;
595 anIt.Initialize( theFaces );
596 for( ; anIt.More(); anIt.Next() )
597 anAlgo.AddArgument( anIt.Value() );
599 anAlgo.PerformWithFiller( aPF );
600 anError = anAlgo.ErrorStatus();
602 return TopoDS_Shape();
604 const TopoDS_Shape& aMergedShape = anAlgo.Shape();
606 BRep_Builder aBuilder;
608 aBuilder.MakeShell( aShell );
609 aShell.Closed( Standard_False );
610 TopExp_Explorer anExplorer( aMergedShape, TopAbs_FACE );
611 for( ; anExplorer.More(); anExplorer.Next() )
613 const TopoDS_Face& aFace = TopoDS::Face(anExplorer.Current());
616 if( aFace.ShapeType() == TopAbs_FACE )
618 aBuilder.Add( aShell, aFace );
619 aShell.Closed( Standard_False );
623 TopoDS_Shape aResult;
626 ShapeUpgrade_UnifySameDomain aUSD;
627 aUSD.Initialize( aShell );
629 aResult = aUSD.Shape();
634 anExplorer.Init( aResult, TopAbs_FACE );
636 TopoDS_Face anOneFace;
637 for( ; anExplorer.More(); anExplorer.Next(), n++ )
638 anOneFace = TopoDS::Face( anExplorer.Current() );
647 Get the shape of the land cover map
649 TopoDS_Shape HYDROData_LandCoverMap::GetShape() const
651 return HYDROData_Entity::GetShape( DataTag_Shape );
655 Set the shape of the land cover map
656 @param theShape the new shape for the land cover map
658 void HYDROData_LandCoverMap::SetShape( const TopoDS_Shape& theShape )
660 HYDROData_Entity::SetShape( DataTag_Shape, theShape );
664 Perform the local partition algorithm on the land cover
665 @param theNewShape the new shape to add into the land cover
666 @param theNewType the new Strickler type for the new land cover
667 @return if the local partition is successful
669 bool HYDROData_LandCoverMap::LocalPartition( const TopoDS_Shape& theNewShape, const QString& theNewType )
671 if( theNewShape.IsNull() )
674 BOPCol_ListOfShape aShapesList;
675 BOPAlgo_PaveFiller aPaveFiller;
676 HYDROData_MapOfFaceToStricklerType aNewFaces;
678 // add faces to shapes list
679 Iterator anIt( *this );
680 for( ; anIt.More(); anIt.Next() )
681 aShapesList.Append( anIt.Face() );
682 aShapesList.Append( theNewShape );
684 if( aShapesList.Size()==1 && theNewShape.ShapeType()==TopAbs_FACE )
686 aNewFaces.Add( TopoDS::Face( theNewShape ), theNewType );
687 StoreLandCovers( aNewFaces );
691 // prepare pave filler
692 aPaveFiller.SetArguments( aShapesList );
693 aPaveFiller.Perform();
694 Standard_Integer anError = aPaveFiller.ErrorStatus();
698 // add faces to builder
699 BOPAlgo_Builder aBuilder;
701 for( ; anIt.More(); anIt.Next() )
702 aBuilder.AddArgument( anIt.Face() );
703 aBuilder.AddArgument( theNewShape );
705 // perform the partition with the pave filler
706 aBuilder.PerformWithFiller( aPaveFiller );
707 anError = aBuilder.ErrorStatus();
711 //std::cout << "History:" << std::endl;
712 // analysis of the history
713 // a. to fill map of shapes which come from the new face
714 NCollection_IndexedMap<int> aShapesFromNewFace;
715 //std::cout << "from NEW " << theNewShape << ":" << theNewType << std::endl;
716 TopTools_ListOfShape aModified = aBuilder.Modified( theNewShape );
717 TopTools_ListIteratorOfListOfShape aMIt( aModified );
718 for( ; aMIt.More(); aMIt.Next() )
720 //std::cout << " " << aMIt.Value() << std::endl;
721 int aKey = (int)(uintptr_t)aMIt.Value().TShape().operator->();
722 aShapesFromNewFace.Add( aKey );
725 // b. to fill map of parts except parts from new face
727 for( ; anIt.More(); anIt.Next() )
729 QString aSType = anIt.StricklerType();
730 //std::cout << "from " << anIt.Face() << ": " << anIt.StricklerType() << std::endl;
731 TopTools_ListOfShape aModified = aBuilder.Modified( anIt.Face() );
732 if( aModified.Extent() == 0 )
733 aModified.Append( anIt.Face() );
735 TopTools_ListIteratorOfListOfShape aMIt( aModified );
736 for( ; aMIt.More(); aMIt.Next() )
738 TopoDS_Shape aShape = aMIt.Value();
739 bool isFace = aShape.ShapeType()==TopAbs_FACE;
740 int aKey = (int)(uintptr_t)aShape.TShape().operator->();
741 bool isAlsoFromNew = aShapesFromNewFace.Contains( aKey );
742 //std::cout << " " << aShape << " " << isAlsoFromNew << std::endl;
743 if( isFace && !isAlsoFromNew )
744 aNewFaces.Add( TopoDS::Face( aShape ), aSType );
748 // c. add the new shape if it is face with its type
749 if( theNewShape.ShapeType()==TopAbs_FACE )
750 aNewFaces.Add( TopoDS::Face( theNewShape ), theNewType );
752 // convert map of shape to type to compound and list of types
753 StoreLandCovers( aNewFaces );
758 Replace the set of land covers in the land cover map
759 @param theMap the map of shape (face) to Strickler type (string)
761 void HYDROData_LandCoverMap::StoreLandCovers( const HYDROData_MapOfFaceToStricklerType& theMap )
763 TopTools_ListOfShape aListOfFaces;
765 int n = theMap.Size();
767 Handle( TDataStd_ExtStringArray ) aTypes =
768 TDataStd_ExtStringArray::Set( myLab.FindChild( DataTag_Types ), 0, n-1, Standard_True );
770 HYDROData_MapOfFaceToStricklerType::Iterator aNFIt( theMap );
771 for( int i=0; aNFIt.More(); aNFIt.Next(), i++ )
773 TopoDS_Face aFace = aNFIt.Key();
776 QString aType = aNFIt.Value();
777 aListOfFaces.Append(aFace);
778 aTypes->SetValue( i, HYDROData_Tool::toExtString( aType ) );
781 TopoDS_Shape aResult;
782 if( aListOfFaces.Extent() == 1 )
785 BRep_Builder aShellBuilder;
786 aShellBuilder.MakeShell( aShell );
787 aShell.Closed( Standard_False );
788 aShellBuilder.Add( aShell, aListOfFaces.First() );
791 else if( aListOfFaces.Extent() > 1 )
792 aResult = MergeFaces( aListOfFaces, false );
798 Find the land cover for the given point
799 @param thePoint the point laying in some land cover
800 @param theType the returned type
801 @return the found land cover's face
803 TopoDS_Face HYDROData_LandCoverMap::FindByPoint( const gp_Pnt2d& thePoint, QString& theType ) const
805 //TODO: some more optimal algorithm
806 Iterator anIt( *this );
807 for( ; anIt.More(); anIt.Next() )
808 if( HYDROData_Tool::ComputePointState( thePoint.XY(), anIt.Face() ) == TopAbs_IN )
810 theType = anIt.StricklerType();
815 return TopoDS_Face();
820 @param theTreatedObjects the map of treated objects
822 QStringList HYDROData_LandCoverMap::DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const
824 QStringList aResList = dumpObjectCreation( theTreatedObjects );
825 QString aName = GetObjPyName();
827 //Handle(HYDROData_PolylineXY) aHydAxis = GetHydraulicAxis();
828 //setPythonReferenceObject( theTreatedObjects, aResList, aHydAxis, "SetHydraulicAxis" );
830 //HYDROData_SequenceOfObjects aSeqOfProfiles = GetProfiles();
831 //for ( int i = 1, aNb = aSeqOfProfiles.Size(); i <= aNb; ++i )
833 //const Handle(HYDROData_Entity) aProfile = aSeqOfProfiles.Value( i );
834 //setPythonReferenceObject( theTreatedObjects, aResList, aProfile, "AddProfile" );