#include <BRepTools.hxx>
#include <TopExp_Explorer.hxx>
#include <ShapeUpgrade_UnifySameDomain.hxx>
+#include <TDataStd_Real.hxx>
#include <QFile>
#include <QString>
return aResList;
}
+
+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();
+}
DataTag_First = HYDROData_Entity::DataTag_First + 100, ///< first tag, to reserve
DataTag_Shape, ///< the shape presentation of the land cover map
DataTag_Types,
+ DataTag_Transparency,
};
public:
HYDRODATA_EXPORT void StoreLandCovers( const HYDROData_MapOfFaceToStricklerType& );
+ HYDRODATA_EXPORT void SetTransparency( double );
+ HYDRODATA_EXPORT double GetTransparency() const;
+
protected:
void SetShape( const TopoDS_Shape& );
void HYDROGUI_LandCoverMapPrs::UpdateColors()
{
+ if( !myLCMap.IsNull() )
+ SetTransparency( myLCMap->GetTransparency() );
+
Set( myLCMap->GetShape() );
SetMaterial( Graphic3d_NOM_PLASTIC );
HYDROData_LandCoverMap::Iterator anIt( myLCMap );
TestViewer::show( aZone->GetTopShape(), AIS_Shaded, true, "LandCoverMap_TransparentPrs" );
+ aMap->SetTransparency( 0.5 );
+ CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.5, aMap->GetTransparency(), 1E-6 );
+
Handle(HYDROGUI_LandCoverMapPrs) aPrs = new HYDROGUI_LandCoverMapPrs( aMap );
aPrs->SetTable( aTable );
- aPrs->SetTransparency( 0.5 );
TestViewer::show( aPrs, AIS_Shaded, 0, true, "" );
CPPUNIT_ASSERT_IMAGES