//
#include <HYDROData_LandCoverMap.h>
+#include <HYDROData_Object.h>
#include <HYDROData_PolylineXY.h>
#include <HYDROData_Tool.h>
*/
bool HYDROData_LandCoverMap::Add( const Handle( HYDROData_Object )& theObject, const QString& theType )
{
- //TODO
- return false;
+ if( theObject.IsNull() )
+ return false;
+
+ TopoDS_Shape aShape = theObject->GetTopShape();
+ if( aShape.ShapeType()!=TopAbs_FACE )
+ return false;
+
+ TopoDS_Face aFace = TopoDS::Face( aShape );
+ return LocalPartition( aFace, theType );
}
/**
*/
bool HYDROData_LandCoverMap::Remove( const TopoDS_Face& theFace )
{
- //TODO
- return false;
+ TopTools_ListOfShape aList;
+ aList.Append( theFace );
+ return Remove( aList );
+}
+
+/**
+ Remove the given faces from land cover map
+ @param theFacesList the face list to be removed
+ @return if the removing is successful
+*/
+bool HYDROData_LandCoverMap::Remove( const TopTools_ListOfShape& theFacesList )
+{
+ TopoDS_Compound aCompound = TopoDS::Compound( GetShape() );
+ BRep_Builder aCompoundBuilder;
+ //TODO: aCompoundBuilder.Remove( aCompound, theFace );
+ //TODO: update types
+ SetShape( aCompound );
+ return true;
}
/**
*/
bool HYDROData_LandCoverMap::Merge( const TopTools_ListOfShape& theFaces, const QString& theType )
{
- //TODO
- return false;
+ // 1. to remove the merged faces from the current map
+ Remove( theFaces );
+
+ // 2. to fuse the faces into the new face
+ // TODO
+ TopoDS_Face aMergedFace;
+
+ // 3. to add the face into the map
+ return LocalPartition( aMergedFace, theType );
}
/**
bool Add( const Handle( HYDROData_PolylineXY )&, const QString& theType );
bool Remove( const TopoDS_Face& );
+ bool Remove( const TopTools_ListOfShape& );
bool Split( const Handle( HYDROData_PolylineXY )& );
bool Merge( const TopTools_ListOfShape&, const QString& theType );
generateOne( anOutStream, 1040.079834, -441.303467, 1017.623413, -459.9102175 );
generateOne( anOutStream, 1055.478516, -456.060547, 1034.946899, -475.9505 );
generateOne( anOutStream, 1074.085327, -474.025665, 1058.044922, -493.274017 );
- srand( time( 0 ) );
+ srand( 0 );
}
aTmpFile.close();