Salome HOME
Merge branch 'BR_LAND_COVER_MAP' of ssh://git.salome-platform.org/modules/hydro into...
authorisn <isn@opencascade.com>
Fri, 13 Nov 2015 09:52:33 +0000 (12:52 +0300)
committerisn <isn@opencascade.com>
Fri, 13 Nov 2015 09:52:33 +0000 (12:52 +0300)
Conflicts:
src/HYDROData/HYDROData_LandCoverMap.cxx
src/HYDROData/HYDROData_LandCoverMap.h

1  2 
src/HYDROData/HYDROData_LandCoverMap.cxx
src/HYDROData/HYDROData_LandCoverMap.h
src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx

index 4af5467315e35e18a282f6a6025beadcdbbc1a74,02098d3e00e941542113394779624cb9c23a9b40..9df53033988a5f9b7406934b9ef22bd7db23971c
  #include <BRepTools.hxx>
  #include <TopExp_Explorer.hxx>
  #include <ShapeUpgrade_UnifySameDomain.hxx>
 +#include <TopExp.hxx>
+ #include <TDataStd_Real.hxx>
 +#include <TopTools_IndexedMapOfShape.hxx>
 +#include <ShapeBuild_ReShape.hxx>
 +#include <ShapeFix_Shape.hxx>
 +
  
  #include <QFile>
  #include <QString>
@@@ -901,29 -894,21 +902,49 @@@ QStringList HYDROData_LandCoverMap::Dum
    return aResList;
  }
  
 -}
 +TopoDS_Shape HYDROData_LandCoverMap::RemoveInternal(const TopoDS_Shape& InSh)
 +{
 +  //Shape must be topologically correct
 +  TopExp_Explorer anExp(InSh, TopAbs_EDGE);
 +  TopTools_ListOfShape anEdgesToRemove;
 +
 +  for(; anExp.More(); anExp.Next() )
 +  {
 +    TopoDS_Edge CurEdge = TopoDS::Edge(anExp.Current());
 +    if (CurEdge.Orientation() == TopAbs_INTERNAL)
 +      anEdgesToRemove.Append(CurEdge);
 +  }
 + 
 +  Handle_ShapeBuild_ReShape aReshape = new ShapeBuild_ReShape();
 +  TopoDS_Shape OutSh = aReshape->Apply(InSh);
 +  TopTools_ListIteratorOfListOfShape aIt(anEdgesToRemove);
 +  for (; aIt.More(); aIt.Next()) 
 +    aReshape->Remove(aIt.Value());
 +  OutSh = aReshape->Apply(InSh);
 +
 +  Handle(ShapeFix_Shape) sfs = new ShapeFix_Shape;
 +  sfs->Init(OutSh);
 +  sfs->Perform();
 +  return sfs->Shape();
 +
 +}
++
+ void HYDROData_LandCoverMap::SetTransparency( double theTransparency )
+ {
+   Handle(TDataStd_Real) anAttr;
+   TDF_Label aLabel = myLab.FindChild( DataTag_Transparency );
+   if( !aLabel.FindAttribute( TDataStd_Real::GetID(), anAttr ) )
+     aLabel.AddAttribute( anAttr = new TDataStd_Real() );
+   anAttr->Set( theTransparency );
+ }
+ double HYDROData_LandCoverMap::GetTransparency() const
+ {
+   Handle(TDataStd_Real) anAttr;
+   TDF_Label aLabel = myLab.FindChild( DataTag_Transparency );
+   if( !aLabel.FindAttribute( TDataStd_Real::GetID(), anAttr ) )
+     return 0.5;
+   return anAttr->Get();
++  
++}
index a4c44ab683878facba88b6d74574a39c5d089b43,5c632ebb5c7b1dd6e96ff81a44d56417553c8437..930fbbf1556ca63d9d1c0cb09bd810c07e8f854c
@@@ -124,8 -125,9 +125,11 @@@ public
  
    HYDRODATA_EXPORT void StoreLandCovers( const HYDROData_MapOfFaceToStricklerType& );
  
+   HYDRODATA_EXPORT void SetTransparency( double );
+   HYDRODATA_EXPORT double GetTransparency() const;
 +  HYDRODATA_EXPORT TopoDS_Shape RemoveInternal(const TopoDS_Shape& InSh);
 +
  protected:
    void SetShape( const TopoDS_Shape& );