]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
Merge branch 'BR_LAND_COVER_MAP' of ssh://git.salome-platform.org/modules/hydro into...
authormkr <mkr@opencascade.com>
Tue, 17 Nov 2015 13:02:44 +0000 (16:02 +0300)
committermkr <mkr@opencascade.com>
Tue, 17 Nov 2015 13:02:44 +0000 (16:02 +0300)
30 files changed:
.gitignore
src/HYDROData/HYDROData_LandCoverMap.cxx
src/HYDROData/HYDROData_LandCoverMap.h
src/HYDROData/HYDROData_ShapeFile.cxx
src/HYDROData/HYDROData_ShapeFile.h
src/HYDROGUI/CMakeLists.txt
src/HYDROGUI/HYDROGUI_AISShape.cxx [new file with mode: 0644]
src/HYDROGUI/HYDROGUI_AISShape.h [new file with mode: 0644]
src/HYDROGUI/HYDROGUI_LandCoverArgsFilter.cxx [new file with mode: 0644]
src/HYDROGUI/HYDROGUI_LandCoverArgsFilter.h [new file with mode: 0644]
src/HYDROGUI/HYDROGUI_LandCoverMapDlg.cxx
src/HYDROGUI/HYDROGUI_LandCoverMapDlg.h
src/HYDROGUI/HYDROGUI_OCCDisplayer.cxx
src/HYDROGUI/HYDROGUI_SetColorOp.cxx
src/HYDROGUI/HYDROGUI_Shape.cxx
src/HYDROGUI/HYDROGUI_ShapeLandCoverMap.cxx
src/HYDROGUI/HYDROGUI_Tool.h
src/HYDROGUI/resources/LightApp.xml
src/HYDRO_tests/CMakeLists.txt
src/HYDRO_tests/ExternalFiles.cmake
src/HYDRO_tests/TestViewer.cxx
src/HYDRO_tests/TestViewer.h
src/HYDRO_tests/reference_data/LCM_copied.png [new file with mode: 0644]
src/HYDRO_tests/reference_data/Shape_preview_im_zone.png [new file with mode: 0644]
src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx
src/HYDRO_tests/test_HYDROData_LandCoverMap.h
src/HYDRO_tests/test_HYDROGUI_LandCoverMapDlg.cxx [new file with mode: 0644]
src/HYDRO_tests/test_HYDROGUI_LandCoverMapDlg.h [new file with mode: 0644]
src/HYDRO_tests/test_HYDROGUI_Shape.cxx [new file with mode: 0644]
src/HYDRO_tests/test_HYDROGUI_Shape.h [new file with mode: 0644]

index 12916051c48cbbcb0c5ba6930785f3e3ac094c22..2b75ba9e1c59ce44461cbfe4dc7d1cc4803b6fa7 100644 (file)
@@ -2,3 +2,7 @@ html
 latex
 documentation.log
 tests.cfg
+
+/src/HYDROGUI/HYDROGUI_LandCoverMapDlg.cxx.BASE.cxx
+/src/HYDROGUI/HYDROGUI_LandCoverMapDlg.cxx.LOCAL.cxx
+/src/HYDROGUI/HYDROGUI_LandCoverMapDlg.cxx.REMOTE.cxx
\ No newline at end of file
index 951f77d398cabb6c7426dc71c598d5124e8d215e..1187916c6dbf3742c3dd1183261a87c6154a517d 100644 (file)
@@ -939,7 +939,7 @@ QStringList HYDROData_LandCoverMap::DumpToPython( const QString&       thePyScri
   QString aDbfFileName = thePyScriptPath;
   aDbfFileName.replace( ".py", ".dbf" );
 
-  ExportSHP( aShpFileName );
+  ExportSHP( aShpFileName, true, 1 );
 
   QString anAttr = "CODE_06"; //TODO: some custom choice
   QStringList anAttrValues, aTypes;
@@ -1048,11 +1048,11 @@ bool HYDROData_LandCoverMap::ImportSHP( const QString& theSHPFileName,
   return true;
 }
 
-bool HYDROData_LandCoverMap::ExportSHP( const QString& theSHPFileName) const
+bool HYDROData_LandCoverMap::ExportSHP( const QString& theSHPFileName, bool bUseDiscr, double theDefl) const
 {
   HYDROData_ShapeFile anExporter;
   QStringList aList;
-  anExporter.Export(theSHPFileName, this, aList);
+  anExporter.Export(theSHPFileName, this, aList, bUseDiscr, theDefl );
   if (aList.empty())
     return true;
   else 
index 656a482e6c4b7f9d3950e9b1b93c2f2c73b15576..c2437d8c7c978f37e05e5a6493c3ba1d9dbf5171 100644 (file)
@@ -93,7 +93,7 @@ public:
   HYDRODATA_EXPORT bool ImportSHP( const QString& theSHPFileName,
                                    const QList<int>& theIndices = QList<int>() );
  
-  HYDRODATA_EXPORT bool ExportSHP( const QString& theSHPFileName ) const;
+  HYDRODATA_EXPORT bool ExportSHP( const QString& theSHPFileName, bool bUseDiscr = false, double theDefl = 0.1) const;
 
   HYDRODATA_EXPORT DBFStatus ImportDBF( const QString& theDBFFileName, 
                                         const QString& theFieldName, 
index d3ade82aff87c49e9997abeb5836a8b572823dd1..8b0711f86ec36cc975e18a465e0e722f8c228616 100644 (file)
@@ -104,8 +104,8 @@ void HYDROData_ShapeFile::Export(const QString& aFileName,
   }
 }
 
-void HYDROData_ShapeFile::Export(const QString& aFileName,
-  const Handle_HYDROData_LandCoverMap& aLCM, QStringList& aNonExpList)
+void HYDROData_ShapeFile::Export(const QString& aFileName, const Handle_HYDROData_LandCoverMap& aLCM, 
+                                 QStringList& aNonExpList, bool bUseDiscr, double theDefl)
 {
   SHPHandle hSHPHandle;
   if ( !aLCM.IsNull() && !aLCM->IsEmpty())
@@ -115,7 +115,7 @@ void HYDROData_ShapeFile::Export(const QString& aFileName,
     for( ; It.More(); It.Next())
     {
       TopoDS_Face aFace = It.Face();
-      if (WriteObjectPolygon(hSHPHandle, aFace) != 1)
+      if (WriteObjectPolygon(hSHPHandle, aFace, bUseDiscr, theDefl) != 1)
         aNonExpList.append(aLCM->GetName() + "_" +  QString::number(It.Index()));
     }
   }
@@ -289,11 +289,29 @@ void HYDROData_ShapeFile::ProcessFace(const TopoDS_Face& theFace, SHPHandle theS
         BRepAdaptor_Curve Cur( E );
         GCPnts_QuasiUniformDeflection Discr( Cur, theDefl );
         if( !Discr.IsDone() )
-          continue; //skip all edge?
-        for( int i = 1; i <= Discr.NbPoints(); i++ )
+          continue; //skip edge?
+        double NewDefl = theDefl/2.0;
+        while (Discr.NbPoints() < 2)
         {
-          gp_Pnt P = Discr.Value( i );
-          aPnts.Append(gp_Pnt2d(P.X(), P.Y()));
+          Discr.Initialize(Cur, NewDefl);
+          NewDefl = NewDefl/2.0;
+        }
+        //
+        if (E.Orientation() == TopAbs_FORWARD)
+        {
+          for( int i = 1; i <= Discr.NbPoints(); i++ )
+          {
+            gp_Pnt P = Discr.Value( i );
+            aPnts.Append(gp_Pnt2d(P.X(), P.Y()));
+          }
+        }
+        else
+        {
+          for( int i = Discr.NbPoints(); i > 0; i-- )
+          {
+            gp_Pnt P = Discr.Value( i );
+            aPnts.Append(gp_Pnt2d(P.X(), P.Y()));
+          }
         }
       }
     }
index cf24d3b5248b785f6bc7ff86d2b6564afb4b6b87..95a8b1752fa32dc7aac108a6beadc5c1a491af29 100644 (file)
@@ -88,13 +88,15 @@ public:
 
   HYDRODATA_EXPORT void Export(const QString& aFileName,
                                const Handle_HYDROData_LandCoverMap& aLCM,
-                               QStringList& aNonExpList);
+                               QStringList& aNonExpList,
+                               bool bUseDiscr = false, 
+                               double theDefl = 0.1);
 
   int WriteObjectPolyXY(SHPHandle theShpHandle, Handle_HYDROData_PolylineXY thePoly );
 
   int WriteObjectPoly3D(SHPHandle theShpHandle, Handle_HYDROData_Polyline3D thePoly );
 
-  int WriteObjectPolygon(SHPHandle theShpHandle, const TopoDS_Shape& theInputShape, bool bUseDiscr = false, double theDefl = 0.1 );
+  int WriteObjectPolygon(SHPHandle theShpHandle, const TopoDS_Shape& theInputShape, bool bUseDiscr, double theDefl );
   //Import
   bool Parse(SHPHandle theHandle, ShapeType theType, int& theShapeTypeOfFile);
   //Import Landcover
index 40a5fe2f524397395f184791a078e1ec6a11d5e3..549402caaa3e8a87aafa81a93864f3fff8a779fe 100644 (file)
@@ -4,6 +4,7 @@ include(../../CMake/UseQT4EXT.cmake)
 set(PROJECT_HEADERS 
     HYDROGUI.h
     HYDROGUI_AbstractDisplayer.h
+    HYDROGUI_AISShape.h
     HYDROGUI_AISTrihedron.h
     HYDROGUI_BathymetryPrs.h
     HYDROGUI_CalculationDlg.h
@@ -44,6 +45,7 @@ set(PROJECT_HEADERS
     HYDROGUI_ExportSinusXDlg.h
     HYDROGUI_ExportLandCoverMapDlg.h
     HYDROGUI_InputPanel.h
+    HYDROGUI_LandCoverArgsFilter.h
     HYDROGUI_LandCoverMapDlg.h
     HYDROGUI_LandCoverMapOp.h
     HYDROGUI_LandCoverMapPrs.h
@@ -146,6 +148,7 @@ QT4_WRAP_CPP(PROJECT_HEADERS_MOC ${PROJECT_HEADERS})
 
 set(PROJECT_SOURCES 
     HYDROGUI_AbstractDisplayer.cxx
+    HYDROGUI_AISShape.cxx
     HYDROGUI_AISTrihedron.cxx
     HYDROGUI_BathymetryPrs.cxx
     HYDROGUI_CalculationDlg.cxx
@@ -186,6 +189,7 @@ set(PROJECT_SOURCES
     HYDROGUI_ExportSinusXDlg.cxx
     HYDROGUI_ExportLandCoverMapDlg.cxx
     HYDROGUI_InputPanel.cxx
+    HYDROGUI_LandCoverArgsFilter.cxx
     HYDROGUI_LandCoverMapDlg.cxx
     HYDROGUI_LandCoverMapOp.cxx
     HYDROGUI_LandCoverMapPrs.cxx
diff --git a/src/HYDROGUI/HYDROGUI_AISShape.cxx b/src/HYDROGUI/HYDROGUI_AISShape.cxx
new file mode 100644 (file)
index 0000000..162e44c
--- /dev/null
@@ -0,0 +1,74 @@
+// Copyright (C) 2014-2015  EDF-R&D
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include <HYDROGUI_AISShape.h>
+#include <AIS_DisplayMode.hxx>
+#include <Prs3d_IsoAspect.hxx>
+#include <Prs3d_LineAspect.hxx>
+#include <StdPrs_WFDeflectionShape.hxx>
+
+IMPLEMENT_STANDARD_HANDLE(HYDROGUI_AISShape, AIS_Shape)
+IMPLEMENT_STANDARD_RTTIEXT(HYDROGUI_AISShape, AIS_Shape)
+
+HYDROGUI_AISShape::HYDROGUI_AISShape( const TopoDS_Shape& theShape )
+  : AIS_Shape( theShape ),
+    myBorderColor( Quantity_NOC_BLACK )
+{
+}
+
+HYDROGUI_AISShape::~HYDROGUI_AISShape()
+{
+}
+
+Quantity_Color HYDROGUI_AISShape::GetBorderColor() const
+{
+  return myBorderColor;
+}
+
+void HYDROGUI_AISShape::SetBorderColor( const Quantity_Color& theBorderColor )
+{
+  myBorderColor = theBorderColor;
+  Redisplay( Standard_True );
+}
+
+void HYDROGUI_AISShape::Compute( const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
+                                 const Handle(Prs3d_Presentation)& thePresentation, 
+                                 const Standard_Integer theMode )
+{
+  thePresentation->Clear();
+
+  myDrawer->FaceBoundaryAspect()->SetColor( myBorderColor );
+  myDrawer->FreeBoundaryAspect()->SetColor( myBorderColor );
+  myDrawer->UnFreeBoundaryAspect()->SetColor( myBorderColor );
+  myDrawer->LineAspect()->SetColor( myBorderColor );
+  myDrawer->SeenLineAspect()->SetColor( myBorderColor );
+  myDrawer->WireAspect()->SetColor( myBorderColor );
+  myDrawer->UIsoAspect()->SetColor( myBorderColor );
+  myDrawer->VIsoAspect()->SetColor( myBorderColor );
+
+  switch( theMode )
+  {
+  case AIS_WireFrame:
+  case AIS_Shaded:
+    AIS_Shape::Compute( thePresentationManager, thePresentation, theMode );
+    break;
+  }
+
+  if( theMode==AIS_Shaded )
+    StdPrs_WFDeflectionShape::Add( thePresentation, Shape(), myDrawer );
+}
diff --git a/src/HYDROGUI/HYDROGUI_AISShape.h b/src/HYDROGUI/HYDROGUI_AISShape.h
new file mode 100644 (file)
index 0000000..7353dcb
--- /dev/null
@@ -0,0 +1,46 @@
+// Copyright (C) 2014-2015  EDF-R&D
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+
+#ifndef HYDROGUI_AISSHAPE_H
+#define HYDROGUI_AISSHAPE_H
+
+#include <AIS_Shape.hxx>
+
+DEFINE_STANDARD_HANDLE(HYDROGUI_AISShape, AIS_Shape)
+
+class HYDROGUI_AISShape : public AIS_Shape
+{
+public:
+  DEFINE_STANDARD_RTTI(HYDROGUI_AISShape);
+
+  HYDROGUI_AISShape( const TopoDS_Shape& );
+  virtual ~HYDROGUI_AISShape();
+
+  Quantity_Color GetBorderColor() const;
+  void SetBorderColor( const Quantity_Color& theBorderColor );
+
+  virtual void Compute( const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
+                        const Handle(Prs3d_Presentation)& thePresentation, 
+                        const Standard_Integer theMode );
+
+private:
+  Quantity_Color myBorderColor;
+};
+
+#endif
diff --git a/src/HYDROGUI/HYDROGUI_LandCoverArgsFilter.cxx b/src/HYDROGUI/HYDROGUI_LandCoverArgsFilter.cxx
new file mode 100644 (file)
index 0000000..350e1df
--- /dev/null
@@ -0,0 +1,59 @@
+// Copyright (C) 2014-2015  EDF-R&D
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include <HYDROGUI_LandCoverArgsFilter.h>
+#include <HYDROGUI_Operations.h>
+#include <HYDROData_ArtificialObject.h>
+#include <HYDROData_NaturalObject.h>
+#include <HYDROData_PolylineXY.h>
+
+HYDROGUI_LandCoverArgsFilter::HYDROGUI_LandCoverArgsFilter( int theOperationId )
+  : myOperationId( theOperationId )
+{
+}
+
+HYDROGUI_LandCoverArgsFilter::~HYDROGUI_LandCoverArgsFilter()
+{
+}
+
+bool HYDROGUI_LandCoverArgsFilter::isOk( const Handle(HYDROData_Entity)& theEntity ) const
+{
+  if( theEntity.IsNull() )
+    return false;
+
+  ObjectKind aKind = theEntity->GetKind();
+  if( aKind==KIND_POLYLINEXY )
+  {
+    Handle(HYDROData_PolylineXY) aPolylineXY = Handle(HYDROData_PolylineXY)::DownCast( theEntity );
+    switch( myOperationId )
+    {
+    case CreateLandCoverMapId:
+    case AddLandCoverId:
+      return aPolylineXY->IsClosed();  // only closed polylines are allowed
+    case SplitLandCoverId:
+      return true;  // any polylines are allowed
+    default:
+      return false;
+    }
+  }
+
+  Handle(HYDROData_NaturalObject) aNaturalObject = Handle(HYDROData_NaturalObject)::DownCast( theEntity );
+  Handle(HYDROData_ArtificialObject) anArtificialObject = Handle(HYDROData_ArtificialObject)::DownCast( theEntity );
+  bool isOK = !aNaturalObject.IsNull() || !anArtificialObject.IsNull();
+  return isOK;
+}
diff --git a/src/HYDROGUI/HYDROGUI_LandCoverArgsFilter.h b/src/HYDROGUI/HYDROGUI_LandCoverArgsFilter.h
new file mode 100644 (file)
index 0000000..6983837
--- /dev/null
@@ -0,0 +1,36 @@
+// Copyright (C) 2014-2015  EDF-R&D
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef HYDROGUI_LANDCOVER_ARGS_FILTER_H
+#define HYDROGUI_LANDCOVER_ARGS_FILTER_H
+
+#include <HYDROGUI_ObjComboBox.h>
+
+class HYDROGUI_LandCoverArgsFilter : public HYDROGUI_ObjComboBoxFilter
+{
+public:
+  HYDROGUI_LandCoverArgsFilter( int theOperationId );
+  virtual ~HYDROGUI_LandCoverArgsFilter();
+
+  virtual bool isOk( const Handle(HYDROData_Entity)& theEntity ) const;
+
+private:
+  int myOperationId;
+};
+
+#endif
index be0bb55c7eed6f1f8ec0271df2f3fca2c5b327a4..565b678f5d72c2b02257116cec95654175639007 100644 (file)
@@ -34,8 +34,8 @@ HYDROGUI_LandCoverMapDlg::HYDROGUI_LandCoverMapDlg( HYDROGUI_Module* theModule,
                                                     const QString& theTitle,
                                                     const int theOperationId )
 : HYDROGUI_InputPanel( theModule, theTitle ),
-  HYDROGUI_ObjComboBoxFilter(),
-  myOperationId( theOperationId )
+  myOperationId( theOperationId ),
+  myFilter( theOperationId )
 {
   // Land Cover Map name
   myObjectNameGroup = new QGroupBox( tr( "LAND_COVER_MAP_NAME" ), mainFrame() );
@@ -60,7 +60,7 @@ HYDROGUI_LandCoverMapDlg::HYDROGUI_LandCoverMapDlg( HYDROGUI_Module* theModule,
   myPolylinesFacesLabel = new QLabel( tr( "LAND_COVER_MAP_POLYLINE_FACE" ) );
   aParamLayout->addWidget( myPolylinesFacesLabel, 0, 0, 1, 1 );
   aParamLayout->addWidget( myPolylinesFaces = new HYDROGUI_ObjComboBox( theModule, "", KIND_UNKNOWN, myParamGroup ), 0, 1, 1, 1 );
-  myPolylinesFaces->setObjectFilter( this );
+  myPolylinesFaces->setObjectFilter( &myFilter );
 
   // Strickler type name
   myStricklerTypesLabel = new QLabel( tr( "LAND_COVER_MAP_STRICKLER_TYPE" ), myParamGroup );
@@ -164,15 +164,6 @@ void HYDROGUI_LandCoverMapDlg::updateSelectedLandCoversLabel( int theNbSelected
   mySelectedLandCoversLabel->setText( tr( "LAND_COVER_MAP_SELECTED_FACES" ) + aLabel );
 }
 
-bool HYDROGUI_LandCoverMapDlg::isOk( const Handle(HYDROData_Entity)& theEntity ) const
-{
-  Handle(HYDROData_PolylineXY) aPolylineXY = Handle(HYDROData_PolylineXY)::DownCast(theEntity);
-  Handle(HYDROData_Object) anObject2d3dPrs = Handle(HYDROData_Object)::DownCast(theEntity);  
-  return ( !anObject2d3dPrs.IsNull() ||
-           ( !aPolylineXY.IsNull() && ( ( myOperationId == CreateLandCoverMapId || myOperationId == AddLandCoverId ) && aPolylineXY->IsClosed() ||
-                                        myOperationId == SplitLandCoverId ) ) );
-}
-
 void HYDROGUI_LandCoverMapDlg::onLandCoverMapChanged()
 {
   if ( signalsBlocked() )
index 2334a61a894cfa7bc12aef8770a1e0ff08dfb8f5..101c1f85e5ad8c77128a0b90ce5df3c1fbe940a7 100644 (file)
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
-// REMOVED FROM THE PROJECT, BUT KEPT AS A REFERENCE FILE. TO BE DELETED LATER.
-
 #ifndef HYDROGUI_LANDCOVERMAPDLG_H
 #define HYDROGUI_LANDCOVERMAPDLG_H
 
-#include "HYDROGUI_InputPanel.h"
-
-#include "HYDROGUI_ObjComboBox.h"
+#include <HYDROGUI_InputPanel.h>
+#include <HYDROGUI_LandCoverArgsFilter.h>
 
 class HYDROGUI_StricklerTypeComboBox;
 
@@ -31,7 +28,7 @@ class QGroupBox;
 class QLineEdit;
 class QLabel;
 
-class HYDROGUI_LandCoverMapDlg : public HYDROGUI_InputPanel, public HYDROGUI_ObjComboBoxFilter
+class HYDROGUI_LandCoverMapDlg : public HYDROGUI_InputPanel
 {
   Q_OBJECT
 
@@ -54,8 +51,6 @@ public:
 
   void                     updateSelectedLandCoversLabel( int theNbSelected );
 
-  virtual bool             isOk( const Handle(HYDROData_Entity)& ) const;
-
 signals:
   void                     landCoverMapChanged( const QString& theName );
 
@@ -78,6 +73,7 @@ private:
   QLabel*                         myStricklerTypesLabel;
   HYDROGUI_StricklerTypeComboBox* myStricklerTypes;
   QLabel*                         mySelectedLandCoversLabel;
+  HYDROGUI_LandCoverArgsFilter    myFilter;
 };
 
 #endif
index aa5a6fe75924d97bef3f89c4c341c6815c807feb..acbfad377df92a493000a37f511e301762ee98b2 100644 (file)
@@ -516,28 +516,6 @@ void HYDROGUI_OCCDisplayer::UpdateColorScale( const OCCViewer_Viewer* theViewer
       continue;
     }
     
-    QColor aUndefinedColor( Qt::gray );
-    aColor = aUndefinedColor;
-    // TODO
-    //QColor aColor = isLandCoverColoringOn ? aUndefinedColor : aLandCoverMap->GetFillingColor();
-    
-    if ( isLandCoverColoringOn && !aTable.IsNull() ) {
-      QString aStricklerType = "";
-        // TODO
-        //aLandCoverMap->GetStricklerType().toLatin1().constData();
-     
-      if ( aTable->HasType( aStricklerType ) ) {
-        double aStricklerCoeff = aTable->Get( aStricklerType, 0 );
-        Quantity_Color aShapeColor;
-        if ( aColorScale->FindColor( aStricklerCoeff, aShapeColor ) ) {
-          aColor = QColor( aShapeColor.Red() * 255, 
-                           aShapeColor.Green() * 255,
-                           aShapeColor.Blue() * 255 );
-        }
-      }
-    }    
-    
-    aLandCoverMapShape->setFillingColor( aColor, true, true );
     aLandCoverMapShape->setScalarMapModeEnabled( isLandCoverColoringOn );
     theViewer->getAISContext()->Redisplay( aLandCoverMapShape->getAISObject() );
   }
index ca2928462591ac956741a17b99122ad092555c8e..840d219458d8244e9b174e979048257b98369dde 100644 (file)
@@ -50,15 +50,11 @@ bool HYDROGUI_SetColorOp::CanObjectBeColored( const Handle(HYDROData_Entity)& th
   if ( theObject.IsNull() )
     return false;
 
-  bool isCanBeColored = false;
-  if ( theObject->IsKind( STANDARD_TYPE(HYDROData_LandCoverMap) ) ) {
-    size_t anActiveViewId = HYDROGUI_Tool::GetActiveOCCViewId( theModule );
-    isCanBeColored = !theModule->isLandCoversScalarMapModeOn( anActiveViewId );
-  }
+  bool isCanBeColored = 
+    theObject->IsKind( STANDARD_TYPE(HYDROData_Object) ) ||
+    theObject->IsKind( STANDARD_TYPE(HYDROData_IPolyline) );
 
-  return isCanBeColored ||
-         theObject->IsKind( STANDARD_TYPE(HYDROData_Object) ) ||
-         theObject->IsKind( STANDARD_TYPE(HYDROData_IPolyline) );
+  return isCanBeColored;
 }
 
 void HYDROGUI_SetColorOp::startOperation()
index 1feb96abd543ce574ea68ea8494ab18cc06b0502..ba8a9d8fb85d1094aedfa3ac9270371762d13660 100644 (file)
@@ -19,6 +19,7 @@
 #include <HYDROGUI_Shape.h>
 #include <HYDROGUI_Tool.h>
 #include <HYDROGUI_Polyline.h>
+#include <HYDROGUI_AISShape.h>
 
 #include <HYDROData_Channel.h>
 #include <HYDROData_Document.h>
 #include <HYDROData_Zone.h>
 #include <HYDROData_LandCoverMap.h>
 
-#include <AIS_Shape.hxx>
 #include <BRep_Builder.hxx>
 #include <BRepBuilderAPI_MakeFace.hxx>
-#include <Graphic3d_AspectFillArea3d.hxx>
 #include <Prs3d_IsoAspect.hxx>
 #include <TopoDS.hxx>
 #include <TopoDS_Face.hxx>
@@ -500,7 +499,7 @@ Handle_AIS_InteractiveObject HYDROGUI_Shape::createShape() const
   if ( aShapeType==TopAbs_EDGE || aShapeType==TopAbs_WIRE || IsWireEdgeCompound) {
     return new HYDROGUI_Polyline( myTopoShape );
   } else {
-    return new AIS_Shape( myTopoShape );
+    return new HYDROGUI_AISShape( myTopoShape );
   }
 }
 
@@ -562,7 +561,7 @@ void HYDROGUI_Shape::updateShape( const bool theToDisplay,
   const Handle(Prs3d_Drawer)& anAttributes = myShape->Attributes();
   if ( !anAttributes.IsNull() )
   {
-    if ( myDisplayMode == AIS_Shaded )
+    if ( myDisplayMode == AIS_Shaded && myFillingColor.isValid() )
     {
       Quantity_Color aFillingColor( getQuantityColorVal( myFillingColor.red() ), 
                                     getQuantityColorVal( myFillingColor.green() ),
@@ -577,7 +576,7 @@ void HYDROGUI_Shape::updateShape( const bool theToDisplay,
     }
 
     // Coloring borders
-    colorShapeBorder( getActiveColor() );
+    colorShapeBorder( myBorderColor );
   }
 
   if ( !theToDisplay || !isVisible() || myContext.IsNull() )
@@ -658,27 +657,9 @@ void HYDROGUI_Shape::colorShapeBorder( const QColor& theColor )
     }
     else if ( myDisplayMode == AIS_Shaded )
     {
-      if ( theColor.alpha() == 0 )
-      {
-        anAttributes->SetFaceBoundaryDraw( false );
-      }
-      else
-      {
-        anAttributes->SetFaceBoundaryDraw( true );
-  
-        Handle(Prs3d_LineAspect) aBoundaryAspect = anAttributes->FaceBoundaryAspect();
-        if ( !aBoundaryAspect.IsNull() )
-        {
-          aBoundaryAspect->SetColor( aBorderColor );
-          anAttributes->SetFaceBoundaryAspect( aBoundaryAspect );
-        }
-        Handle(Prs3d_LineAspect) aWireAspect = anAttributes->WireAspect();
-        if ( !aWireAspect.IsNull() )
-        {
-          aWireAspect->SetColor( aBorderColor );
-          anAttributes->SetWireAspect( aWireAspect );
-        }
-      }
+      Handle(HYDROGUI_AISShape) aShape = Handle(HYDROGUI_AISShape)::DownCast( myShape );
+      if( !aShape.IsNull() )
+        aShape->SetBorderColor( aBorderColor );
     }
     else if ( myDisplayMode == AIS_WireFrame )
     {
index 450a195e7525a4e0e580cdede2acfca2d3d4757f..de07a5b555496cf2dde81591a3fec57647b5b384 100644 (file)
@@ -41,6 +41,7 @@ HYDROGUI_ShapeLandCoverMap::HYDROGUI_ShapeLandCoverMap( HYDROGUI_OCCDisplayer* t
   myDisplayer( theDisplayer ),
   myIsScalarMapMode( theIsScalarMode )
 {
+  setFillingColor( QColor(), false, false );
 }
 
 HYDROGUI_ShapeLandCoverMap::~HYDROGUI_ShapeLandCoverMap()
index 4ea4039edd77b2fec67829cf454ccb8205fad0db..24563aa1fdbf8198da965150ddacea87da4921e6 100644 (file)
 
 #include <Image_PixMap.hxx>
 
+#ifndef LIGHT_MODE
 // IDL includes
 #include <SALOMEconfig.h>
 #include CORBA_SERVER_HEADER(GEOM_Gen)
+#endif
 
 class SUIT_ViewManager;
 class OCCViewer_ViewFrame;
@@ -341,6 +343,7 @@ public:
    */
   static Handle(Image_PixMap)     Pixmap( const QImage& theImage );
 
+#ifndef LIGHT_MODE
   /**
    * \brief Get the selected GEOM objects.
    * \param theModule the module
@@ -349,6 +352,7 @@ public:
    */
   static QStringList GetSelectedGeomObjects( HYDROGUI_Module* theModule,
                                              QList<GEOM::shape_type> theTypes );
+#endif
 
   /**
    * \brief Delete the GEOM objects.
index c7dc8b352a50d06294ed7efdb7edf2e7ad9973e3..316dc3f7ccb5a4c15fed4d6433163d3315c00dbc 100644 (file)
@@ -27,7 +27,7 @@
     <parameter value="HYDRO" name="name" />
     <parameter value="HYDROGUI" name="library" />
     <parameter value="0" name="parameter_test" />
-    <parameter name="version" value="1.1"/>
+    <parameter name="version" value="1.5"/>
     <parameter value="false" name="auto_fit_all"/>
   </section>
   <section name="launch" >
index 167285a9af7792c73996734f3b7a67d797a8a323..f9fb451832086fdb37bf8e14ef581035f821f2b7 100644 (file)
@@ -15,6 +15,8 @@ set(PROJECT_HEADERS
   test_HYDROData_ShapeFile.h
   test_HYDROData_StricklerTable.h
   test_HYDROGUI_ListModel.h
+  test_HYDROGUI_Shape.h
+  test_HYDROGUI_LandCoverMapDlg.h
   test_Dependencies.h
 
   TestShape.h
@@ -38,6 +40,8 @@ set(PROJECT_SOURCES
   test_HYDROData_ShapeFile.cxx
   test_HYDROData_StricklerTable.cxx
   test_HYDROGUI_ListModel.cxx
+  test_HYDROGUI_Shape.cxx
+  test_HYDROGUI_LandCoverMapDlg.cxx
   test_Dependencies.cxx
 
   TestShape.cxx
index 7ccb5c2661fec8db99807a35ca53e797de636b3e..96fb4c6ef34e40b657f24f4f056f893374d76367 100644 (file)
@@ -56,5 +56,8 @@ set( EXTERNAL_FILES
   ../HYDROGUI/HYDROGUI_ListModel.cxx
   ../HYDROGUI/HYDROGUI_DataObject.cxx
   ../HYDROGUI/HYDROGUI_LandCoverMapPrs.cxx
+  ../HYDROGUI/HYDROGUI_LandCoverArgsFilter.cxx
   ../HYDROGUI/HYDROGUI_Polyline.cxx
+  ../HYDROGUI/HYDROGUI_AISShape.cxx
+  ../HYDROGUI/HYDROGUI_Shape.cxx
 )
index 70dbd6fa029fde4c157ff10eb897bccce48dd3af..52917a31a07c023cd60eae54b1c830e4956ed48d 100644 (file)
@@ -84,9 +84,9 @@ OCCViewer_ViewWindow* TestViewer::viewWindow()
   return myViewWindow;
 }
 
-Handle(AIS_InteractiveContext) context()
+Handle(AIS_InteractiveContext) TestViewer::context()
 {
-  return TestViewer::viewer()->getAISContext();
+  return viewer()->getAISContext();
 }
 
 QColor TestViewer::GetColor(int i)
index d33885b0ce00d0d5d2d6cca9edd5c8bb9d8eb9b8..9030f33b80e0ee44d3f2c6921ba4d0056ebd2559 100644 (file)
@@ -24,6 +24,7 @@ class OCCViewer_ViewWindow;
 class TopoDS_Shape;
 class QString;
 class QColor;
+class Handle_AIS_InteractiveContext;
 class Handle_AIS_InteractiveObject;
 class Handle_Aspect_ColorScale;
 
@@ -33,6 +34,7 @@ public:
   static OCCViewer_ViewManager* viewManager();
   static OCCViewer_Viewer* viewer();
   static OCCViewer_ViewWindow* viewWindow();
+  static Handle_AIS_InteractiveContext context();
 
   static void eraseAll( bool isUpdate );
   static void show( const Handle_AIS_InteractiveObject& theObject,
diff --git a/src/HYDRO_tests/reference_data/LCM_copied.png b/src/HYDRO_tests/reference_data/LCM_copied.png
new file mode 100644 (file)
index 0000000..72382b9
Binary files /dev/null and b/src/HYDRO_tests/reference_data/LCM_copied.png differ
diff --git a/src/HYDRO_tests/reference_data/Shape_preview_im_zone.png b/src/HYDRO_tests/reference_data/Shape_preview_im_zone.png
new file mode 100644 (file)
index 0000000..fd1d123
Binary files /dev/null and b/src/HYDRO_tests/reference_data/Shape_preview_im_zone.png differ
index b096850b3c08a08b2df92ec0438d11fcf85ac2c0..286767a636c6bb8756086eaef4d60787adcd1d28 100644 (file)
@@ -1021,3 +1021,45 @@ void test_HYDROData_LandCoverMap::test_export_telemac()
 
   aDoc->Close();
 }
+
+void test_HYDROData_LandCoverMap::test_copy()
+{
+  Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
+
+  Handle(HYDROData_LandCoverMap) aMap =
+    Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) );
+  aMap->SetName( "map_1" );
+
+  TopoDS_Face aLC1 = Face( QList<double>() << 10 << 10 << 30 << 10 << 20 << 20 );
+  CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC1, "Zones de champs cultivé à végétation basse" ) );
+
+  TopoDS_Face aLC2 = Face( QList<double>() << 110 << 10 << 130 << 10 << 120 << 20 );
+  CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC2, "Zones de champs cultivé à végétation haute" ) );
+
+  Handle(HYDROData_LandCoverMap) aMap2 =
+    Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) );
+  aMap->CopyTo( aMap2, true );
+
+  CPPUNIT_ASSERT_EQUAL( QString( "map_2" ), aMap2->GetName() );
+  HYDROData_LandCoverMap::Explorer anIt( aMap2 );
+  CPPUNIT_ASSERT_EQUAL( true, anIt.More() );
+  CPPUNIT_ASSERT_EQUAL( QString( "Zones de champs cultivé à végétation basse" ), anIt.StricklerType() );
+  CPPUNIT_ASSERT( anIt.Face().TShape()!=aLC1.TShape() );
+  anIt.Next();
+  CPPUNIT_ASSERT_EQUAL( true, anIt.More() );
+  CPPUNIT_ASSERT_EQUAL( QString( "Zones de champs cultivé à végétation haute" ), anIt.StricklerType() );
+  CPPUNIT_ASSERT( anIt.Face().TShape()!=aLC2.TShape() );
+  anIt.Next();
+  CPPUNIT_ASSERT_EQUAL( false, anIt.More() );
+
+  TopoDS_Shape aShape1 = aMap->GetShape();
+  TopoDS_Shape aShape2 = aMap2->GetShape();
+  gp_Trsf aTr;
+  aTr.SetTranslation( gp_Vec( 0, 50, 0 ) );
+  aShape2.Move( TopLoc_Location( aTr ) );
+  TestViewer::show( aShape1, AIS_Shaded, /*0,*/ true, "LCM_copied" );
+  TestViewer::show( aShape2, AIS_Shaded, /*0,*/ true, "" );
+  CPPUNIT_ASSERT_IMAGES
+
+  aDoc->Close();
+}
index 36c8f6bd8ca1cd81ff47233a18488baa67760fe4..79eb35d365663346f95d23071533c6018f341793 100644 (file)
@@ -43,6 +43,7 @@ class test_HYDROData_LandCoverMap : public CppUnit::TestFixture
   CPPUNIT_TEST( test_transparent_prs );
   CPPUNIT_TEST( test_assign_to_calc_case );
   CPPUNIT_TEST( test_export_telemac );
+  CPPUNIT_TEST( test_copy );
 #ifdef SHP_TESTS
   CPPUNIT_TEST( test_shp_import_cyp );
   CPPUNIT_TEST( test_shp_import_clc_dec );
@@ -73,6 +74,7 @@ public:
   void test_shp_import_nld_areas();
   void test_shp_loop_back();
   void test_export_telemac();
+  void test_copy();
 };
 
 CPPUNIT_TEST_SUITE_REGISTRATION( test_HYDROData_LandCoverMap );
diff --git a/src/HYDRO_tests/test_HYDROGUI_LandCoverMapDlg.cxx b/src/HYDRO_tests/test_HYDROGUI_LandCoverMapDlg.cxx
new file mode 100644 (file)
index 0000000..20ef148
--- /dev/null
@@ -0,0 +1,91 @@
+// Copyright (C) 2014-2015  EDF-R&D
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#undef HYDROGUI_EXPORTS
+
+#include <test_HYDROGUI_LandCoverMapDlg.h>
+#include <HYDROGUI_LandCoverArgsFilter.h>
+#include <HYDROGUI_Operations.h>
+#include <HYDROData_Document.h>
+#include <HYDROData_PolylineXY.h>
+#include <gp_XY.hxx>
+
+bool isOK( const HYDROGUI_LandCoverArgsFilter& theFilter, 
+           const Handle(HYDROData_Document)& theDocument,
+           ObjectKind theKind )
+{
+  Handle(HYDROData_Entity) anEntity = theDocument->CreateObject( theKind );
+  return theFilter.isOk( anEntity );
+}
+
+void test_HYDROGUI_LandCoverMapDlg::test_objects_filtering_refs_707()
+{
+  Handle(HYDROData_Document) aDoc = HYDROData_Document::Document( 1 );
+  
+  HYDROGUI_LandCoverArgsFilter f( AddLandCoverId );
+
+  CPPUNIT_ASSERT_EQUAL( false, isOK( f, aDoc, KIND_IMAGE ) );
+  CPPUNIT_ASSERT_EQUAL( false, isOK( f, aDoc, KIND_POLYLINE ) );
+  CPPUNIT_ASSERT_EQUAL( false, isOK( f, aDoc, KIND_BATHYMETRY ) );
+  CPPUNIT_ASSERT_EQUAL( false, isOK( f, aDoc, KIND_ALTITUDE ) );
+  CPPUNIT_ASSERT_EQUAL( true,  isOK( f, aDoc, KIND_IMMERSIBLE_ZONE ) );
+  CPPUNIT_ASSERT_EQUAL( true,  isOK( f, aDoc, KIND_RIVER ) );
+  CPPUNIT_ASSERT_EQUAL( true,  isOK( f, aDoc, KIND_STREAM ) );
+  CPPUNIT_ASSERT_EQUAL( true,  isOK( f, aDoc, KIND_CONFLUENCE ) );
+  CPPUNIT_ASSERT_EQUAL( true,  isOK( f, aDoc, KIND_CHANNEL ) );
+  CPPUNIT_ASSERT_EQUAL( true,  isOK( f, aDoc, KIND_OBSTACLE ) );
+  CPPUNIT_ASSERT_EQUAL( true,  isOK( f, aDoc, KIND_DIGUE ) );
+  CPPUNIT_ASSERT_EQUAL( false, isOK( f, aDoc, KIND_PROFILE ) );
+  CPPUNIT_ASSERT_EQUAL( false, isOK( f, aDoc, KIND_PROFILEUZ ) );
+  CPPUNIT_ASSERT_EQUAL( false, isOK( f, aDoc, KIND_CALCULATION ) );
+  CPPUNIT_ASSERT_EQUAL( false, isOK( f, aDoc, KIND_ZONE ) );
+  CPPUNIT_ASSERT_EQUAL( false, isOK( f, aDoc, KIND_REGION ) );
+  CPPUNIT_ASSERT_EQUAL( false, isOK( f, aDoc, KIND_VISUAL_STATE ) );
+  CPPUNIT_ASSERT_EQUAL( false, isOK( f, aDoc, KIND_ARTIFICIAL_OBJECT ) );
+  CPPUNIT_ASSERT_EQUAL( false, isOK( f, aDoc, KIND_NATURAL_OBJECT ) );
+  CPPUNIT_ASSERT_EQUAL( false, isOK( f, aDoc, KIND_DUMMY_3D ) );
+  CPPUNIT_ASSERT_EQUAL( false, isOK( f, aDoc, KIND_SHAPES_GROUP ) );
+  CPPUNIT_ASSERT_EQUAL( false, isOK( f, aDoc, KIND_SPLITTED_GROUP ) );
+  CPPUNIT_ASSERT_EQUAL( false, isOK( f, aDoc, KIND_STREAM_ALTITUDE ) );
+  CPPUNIT_ASSERT_EQUAL( false, isOK( f, aDoc, KIND_OBSTACLE_ALTITUDE ) );
+  CPPUNIT_ASSERT_EQUAL( false, isOK( f, aDoc, KIND_STRICKLER_TABLE ) );
+  CPPUNIT_ASSERT_EQUAL( false, isOK( f, aDoc, KIND_LAND_COVER_OBSOLETE ) );
+  CPPUNIT_ASSERT_EQUAL( false, isOK( f, aDoc, KIND_LAND_COVER_MAP ) );
+
+  Handle(HYDROData_PolylineXY) aClosedPoly = Handle(HYDROData_PolylineXY)::DownCast( aDoc->CreateObject( KIND_POLYLINEXY ) );
+  aClosedPoly->AddSection( "", HYDROData_PolylineXY::SECTION_SPLINE, true );
+  aClosedPoly->AddPoint( 0, gp_XY( 0, 0 ) );
+  aClosedPoly->AddPoint( 0, gp_XY( 20, 0 ) );
+  aClosedPoly->AddPoint( 0, gp_XY( 10, 10 ) );
+  aClosedPoly->Update();
+  CPPUNIT_ASSERT_EQUAL( true, f.isOk( aClosedPoly ) );
+
+  Handle(HYDROData_PolylineXY) anOpenPoly = Handle(HYDROData_PolylineXY)::DownCast( aDoc->CreateObject( KIND_POLYLINEXY ) );
+  anOpenPoly->AddSection( "", HYDROData_PolylineXY::SECTION_SPLINE, false );
+  anOpenPoly->AddPoint( 0, gp_XY( 0, 0 ) );
+  anOpenPoly->AddPoint( 0, gp_XY( 20, 0 ) );
+  anOpenPoly->AddPoint( 0, gp_XY( 10, 10 ) );
+  anOpenPoly->Update();
+  CPPUNIT_ASSERT_EQUAL( false, f.isOk( anOpenPoly ) );
+
+  HYDROGUI_LandCoverArgsFilter fs( SplitLandCoverId );
+  CPPUNIT_ASSERT_EQUAL( true, fs.isOk( aClosedPoly ) );
+  CPPUNIT_ASSERT_EQUAL( true, fs.isOk( anOpenPoly ) );
+
+  aDoc->Close();
+}
diff --git a/src/HYDRO_tests/test_HYDROGUI_LandCoverMapDlg.h b/src/HYDRO_tests/test_HYDROGUI_LandCoverMapDlg.h
new file mode 100644 (file)
index 0000000..207624e
--- /dev/null
@@ -0,0 +1,32 @@
+// Copyright (C) 2014-2015  EDF-R&D
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include <cppunit/extensions/HelperMacros.h>
+
+class test_HYDROGUI_LandCoverMapDlg : public CppUnit::TestFixture
+{
+  CPPUNIT_TEST_SUITE(test_HYDROGUI_LandCoverMapDlg);
+  CPPUNIT_TEST(test_objects_filtering_refs_707);
+  CPPUNIT_TEST_SUITE_END();
+
+public:
+  void test_objects_filtering_refs_707();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(test_HYDROGUI_LandCoverMapDlg);
+CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(test_HYDROGUI_LandCoverMapDlg, "HYDROGUI_LandCoverMapDlg");
diff --git a/src/HYDRO_tests/test_HYDROGUI_Shape.cxx b/src/HYDRO_tests/test_HYDROGUI_Shape.cxx
new file mode 100644 (file)
index 0000000..e99db41
--- /dev/null
@@ -0,0 +1,46 @@
+// Copyright (C) 2014-2015  EDF-R&D
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#undef HYDROGUI_EXPORTS
+
+#include <test_HYDROGUI_Shape.h>
+#include <HYDROGUI_Shape.h>
+#include <TestShape.h>
+#include <TestViewer.h>
+#include <TopoDS_Face.hxx>
+
+void test_HYDROGUI_Shape::test_face_in_preview()
+{
+  TopoDS_Face aFace = Face( 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 );
+
+  Handle_AIS_InteractiveContext aContext = TestViewer::context();
+  Handle_HYDROData_Entity anEntity; //it should be null as in preview
+
+  HYDROGUI_Shape* aPreview = new HYDROGUI_Shape( aContext, anEntity );
+  aPreview->setFace( aFace, true, true, "" );
+  aPreview->setFillingColor( Qt::red, false, false );
+  aPreview->setBorderColor( Qt::darkBlue, false, false );
+  
+  TestViewer::show( aPreview->getAISObject(), AIS_Shaded, 0, true, "Shape_preview_im_zone" );
+  CPPUNIT_ASSERT_IMAGES
+
+  delete aPreview;
+}
diff --git a/src/HYDRO_tests/test_HYDROGUI_Shape.h b/src/HYDRO_tests/test_HYDROGUI_Shape.h
new file mode 100644 (file)
index 0000000..a4d2942
--- /dev/null
@@ -0,0 +1,32 @@
+// Copyright (C) 2014-2015  EDF-R&D
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include <cppunit/extensions/HelperMacros.h>
+
+class test_HYDROGUI_Shape : public CppUnit::TestFixture
+{
+  CPPUNIT_TEST_SUITE(test_HYDROGUI_Shape);
+  CPPUNIT_TEST(test_face_in_preview);
+  CPPUNIT_TEST_SUITE_END();
+
+public:
+  void test_face_in_preview();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(test_HYDROGUI_Shape);
+CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(test_HYDROGUI_Shape, "HYDROGUI_Shape");