#include <HYDROData_Tool.h>
#include <AIS_DisplayMode.hxx>
#include <Prs3d.hxx>
+#include <Prs3d_IsoAspect.hxx>
+#include <Prs3d_LineAspect.hxx>
+#include <Prs3d_ShadingAspect.hxx>
+#include <Graphic3d_AspectFillArea3d.hxx>
#include <Select3D_SensitiveBox.hxx>
#include <StdPrs_ShadedShape.hxx>
-#include <StdPrs_WFDeflectionShape.hxx>
+#include <StdPrs_WFShape.hxx>
#include <StdSelect.hxx>
#include <StdSelect_BRepOwner.hxx>
#include <StdSelect_BRepSelectionTool.hxx>
#include <QColor>
#include <QString>
+IMPLEMENT_STANDARD_HANDLE( HYDROGUI_LandCoverMapPrs, AIS_Shape )
+IMPLEMENT_STANDARD_RTTIEXT( HYDROGUI_LandCoverMapPrs, AIS_Shape )
+
+HYDROGUI_LandCoverMapPrs::HYDROGUI_LandCoverMapPrs( const Handle(HYDROData_LandCoverMap)& theMap )
+ : AIS_Shape( TopoDS_Shape() )
+{
+ SetLandCoverMap( theMap );
+}
+
+HYDROGUI_LandCoverMapPrs::~HYDROGUI_LandCoverMapPrs()
+{
+}
+
Handle(HYDROData_LandCoverMap) HYDROGUI_LandCoverMapPrs::GetLandCoverMap() const
{
return myLCMap;
void HYDROGUI_LandCoverMapPrs::SetLandCoverMap( const Handle(HYDROData_LandCoverMap)& theMap )
{
myLCMap = theMap;
+ Set( theMap->GetShape() );
}
Handle(Aspect_ColorScale) HYDROGUI_LandCoverMapPrs::GetColorScale() const
if( myLCMap.IsNull() )
return;
+ thePresentation->Clear();
+ SetMaterial( Graphic3d_NOM_PLASTIC );
+
+ Quantity_Color anEdgeColor = Quantity_NOC_WHITE;
+ myDrawer->LineAspect()->SetColor( anEdgeColor );
+ myDrawer->FaceBoundaryAspect()->SetColor( anEdgeColor );
+ myDrawer->FreeBoundaryAspect()->SetColor( anEdgeColor );
+ myDrawer->UIsoAspect()->SetNumber( 0 );
+ myDrawer->VIsoAspect()->SetNumber( 0 );
+
switch( theMode )
{
case AIS_WireFrame:
for( ; anIt.More(); anIt.Next() )
{
TopoDS_Face aFace = anIt.Face();
- QString aStricklerType = anIt.StricklerType();
- Quantity_Color aColor = GetColor( aStricklerType );
- SetColor( aColor );
-
if( isShaded )
+ {
+ QString aStricklerType = anIt.StricklerType();
+ Quantity_Color aColor = GetColor( aStricklerType );
+ Handle(Graphic3d_AspectFillArea3d) anAspect = new Graphic3d_AspectFillArea3d();
+ Graphic3d_MaterialAspect aMaterialAspect( Graphic3d_NOM_PLASTIC );
+ aMaterialAspect.SetColor( aColor );
+ anAspect->SetFrontMaterial( aMaterialAspect );
+ anAspect->SetBackMaterial( aMaterialAspect );
+
+ Handle(Graphic3d_AspectFillArea3d) aGlobalAspect = myDrawer->ShadingAspect()->Aspect();
+ myDrawer->ShadingAspect()->SetAspect( anAspect );
StdPrs_ShadedShape::Add( thePresentation, aFace, myDrawer );
+ myDrawer->ShadingAspect()->SetAspect( aGlobalAspect );
+
+ StdPrs_WFShape::Add( thePresentation, aFace, myDrawer );
+ }
else
- StdPrs_WFDeflectionShape::Add( thePresentation, aFace, myDrawer );
+ {
+ StdPrs_WFShape::Add( thePresentation, aFace, myDrawer );
+ }
}
}
break;
#include <AIS_Shape.hxx>
#include <Aspect_ColorScale.hxx>
+DEFINE_STANDARD_HANDLE( HYDROGUI_LandCoverMapPrs, AIS_Shape )
+
class HYDROGUI_LandCoverMapPrs : public AIS_Shape
{
public:
+ DEFINE_STANDARD_RTTI( HYDROGUI_LandCoverMapPrs );
+
+ HYDROGUI_LandCoverMapPrs( const Handle(HYDROData_LandCoverMap)& );
+ virtual ~HYDROGUI_LandCoverMapPrs();
+
Handle(HYDROData_LandCoverMap) GetLandCoverMap() const;
void SetLandCoverMap( const Handle(HYDROData_LandCoverMap)& );
ELSE()
link_directories( $ENV{CAS_ROOT_DIR}/lib )
ENDIF()
-SET( CAS_LIBRARIES TKernel TKLCAF TKCAF TKCDF TKMath TKG2d TKG3d TKBRep TKGeomBase TKTopAlgo TKGeomAlgo TKBool TKShHealing TKXSBase TKOffset TKHLR TKBO TKV3d )
+SET( CAS_LIBRARIES TKernel TKLCAF TKCAF TKCDF TKMath TKG2d TKG3d TKBRep TKGeomBase TKTopAlgo TKGeomAlgo TKBool TKShHealing TKXSBase TKOffset TKHLR TKBO TKV3d TKService )
link_directories( $ENV{QT4_ROOT_DIR}/lib )
IF( ${WIN32} )
../HYDROGUI/HYDROGUI_ListModel.cxx
../HYDROGUI/HYDROGUI_DataObject.cxx
+ ../HYDROGUI/HYDROGUI_LandCoverMapPrs.cxx
)
return aColor;
}
+void TestViewer::show( const Handle(AIS_InteractiveObject)& theObject,
+ int theMode, int theSelectionMode, bool isFitAll )
+{
+ context()->EraseAll( Standard_False );
+ context()->Display( theObject, theMode, theSelectionMode );
+
+ if( isFitAll )
+ {
+ viewWindow()->onTopView();
+ viewWindow()->onFitAll();
+ }
+}
+
void TestViewer::show( const TopoDS_Shape& theShape, int theMode, bool isFitAll, const QColor& theColor )
{
Handle(AIS_Shape) aShape = new AIS_Shape( theShape );
void TestViewer::show( const TopoDS_Shape& theShape, int theMode, bool isFitAll, const char* theKey )
{
- context()->EraseAll();
+ context()->EraseAll( Standard_False );
myKey = theKey;
test_srand( 0 );
class TopoDS_Shape;
class QString;
class QColor;
+class Handle_AIS_InteractiveObject;
class TestViewer
{
static OCCViewer_Viewer* viewer();
static OCCViewer_ViewWindow* viewWindow();
+ static void show( const Handle_AIS_InteractiveObject& theObject,
+ int theMode, int theSelelctionMode, bool isFitAll );
static void show( const TopoDS_Shape& theShape, int theMode, bool isFitAll, const QColor& theColor );
static void show( const TopoDS_Shape& theShape, int theMode, bool isFitAll, const char* theKey );
static bool AssertImages( QString& theMessage );
#include <HYDROData_Document.h>
#include <HYDROData_LandCoverMap.h>
#include <HYDROData_PolylineXY.h>
+#include <HYDROData_StricklerTable.h>
#include <HYDROData_Tool.h>
+#include <HYDROGUI_LandCoverMapPrs.h>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Wire.hxx>
#include <TopoDS_Face.hxx>
#include <BRep_Builder.hxx>
const QString REF_DATA_PATH = qgetenv( "HYDRO_REFERENCE_DATA" );
+const QString DEF_STR_PATH = qgetenv( "HYDRO_ROOT_DIR" ) + "/share/salome/resources/hydro/def_strickler_table.txt";
TopoDS_Edge Spline( const QList<double>& theXYList, bool isClosed = false )
{
CPPUNIT_ASSERT_IMAGES
CPPUNIT_ASSERT(aMergedFace.ShapeType() == TopAbs_SHELL);
}
+}
+
+void test_HYDROData_LandCoverMap::test_land_cover_prs()
+{
+ Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
+
+ Handle(HYDROData_StricklerTable) aTable =
+ Handle(HYDROData_StricklerTable)::DownCast( aDoc->CreateObject( KIND_STRICKLER_TABLE ) );
+ CPPUNIT_ASSERT_EQUAL( true, aTable->Import( DEF_STR_PATH ) );
-}
\ No newline at end of file
+ Handle(HYDROData_LandCoverMap) aMap =
+ Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) );
+
+ TopoDS_Face aLC1 = LandCover( QList<double>() << 12 << 19 << 82 << 9 << 126 << 53 << 107 << 80 << 29 << 75 );
+ CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC1, "Zones de champs cultivé à végétation basse" ) );
+
+ TopoDS_Face aLC2 = LandCover( QList<double>() << 21 << 34 << 24 << 25 << 37 << 37 << 40 << 61 <<
+ 44 << 95 << 85 << 100 << 104 << 66 << 107 << 33 <<
+ 128 << 18 << 140 << 50 << 131 << 89 << 104 << 111 <<
+ 31 << 114 );
+ CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC2, "Zones de champs cultivé à végétation haute" ) );
+
+ TopoDS_Face aLC3 = LandCover( QList<double>() << 4 << 54 << 1 << 47 << 51 << 45 <<
+ 127 << 42 << 145 << 43 << 148 << 60 << 90 << 65 );
+ CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC3, "Zones de champs, prairies, sans cultures" ) );
+
+ Handle(HYDROGUI_LandCoverMapPrs) aPrs = new HYDROGUI_LandCoverMapPrs( aMap );
+ aPrs->SetTable( aTable );
+ TestViewer::show( aPrs, AIS_Shaded, 1, true );
+
+ aDoc->Close();
+}
CPPUNIT_TEST( test_remove );
CPPUNIT_TEST( test_merge_faces_boxes );
CPPUNIT_TEST( test_merge_faces_circles );
+ CPPUNIT_TEST( test_land_cover_prs );
CPPUNIT_TEST_SUITE_END();
public:
void test_remove();
void test_merge_faces_boxes();
void test_merge_faces_circles();
+ void test_land_cover_prs();
};
CPPUNIT_TEST_SUITE_REGISTRATION( test_HYDROData_LandCoverMap );