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
QString aDbfFileName = thePyScriptPath;
aDbfFileName.replace( ".py", ".dbf" );
- ExportSHP( aShpFileName );
+ ExportSHP( aShpFileName, true, 1 );
QString anAttr = "CODE_06"; //TODO: some custom choice
QStringList anAttrValues, aTypes;
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
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,
}
}
-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())
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()));
}
}
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()));
+ }
}
}
}
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
set(PROJECT_HEADERS
HYDROGUI.h
HYDROGUI_AbstractDisplayer.h
+ HYDROGUI_AISShape.h
HYDROGUI_AISTrihedron.h
HYDROGUI_BathymetryPrs.h
HYDROGUI_CalculationDlg.h
HYDROGUI_ExportSinusXDlg.h
HYDROGUI_ExportLandCoverMapDlg.h
HYDROGUI_InputPanel.h
+ HYDROGUI_LandCoverArgsFilter.h
HYDROGUI_LandCoverMapDlg.h
HYDROGUI_LandCoverMapOp.h
HYDROGUI_LandCoverMapPrs.h
set(PROJECT_SOURCES
HYDROGUI_AbstractDisplayer.cxx
+ HYDROGUI_AISShape.cxx
HYDROGUI_AISTrihedron.cxx
HYDROGUI_BathymetryPrs.cxx
HYDROGUI_CalculationDlg.cxx
HYDROGUI_ExportSinusXDlg.cxx
HYDROGUI_ExportLandCoverMapDlg.cxx
HYDROGUI_InputPanel.cxx
+ HYDROGUI_LandCoverArgsFilter.cxx
HYDROGUI_LandCoverMapDlg.cxx
HYDROGUI_LandCoverMapOp.cxx
HYDROGUI_LandCoverMapPrs.cxx
--- /dev/null
+// 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 );
+}
--- /dev/null
+// 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
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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
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() );
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 );
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() )
// 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;
class QLineEdit;
class QLabel;
-class HYDROGUI_LandCoverMapDlg : public HYDROGUI_InputPanel, public HYDROGUI_ObjComboBoxFilter
+class HYDROGUI_LandCoverMapDlg : public HYDROGUI_InputPanel
{
Q_OBJECT
void updateSelectedLandCoversLabel( int theNbSelected );
- virtual bool isOk( const Handle(HYDROData_Entity)& ) const;
-
signals:
void landCoverMapChanged( const QString& theName );
QLabel* myStricklerTypesLabel;
HYDROGUI_StricklerTypeComboBox* myStricklerTypes;
QLabel* mySelectedLandCoversLabel;
+ HYDROGUI_LandCoverArgsFilter myFilter;
};
#endif
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() );
}
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()
#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>
if ( aShapeType==TopAbs_EDGE || aShapeType==TopAbs_WIRE || IsWireEdgeCompound) {
return new HYDROGUI_Polyline( myTopoShape );
} else {
- return new AIS_Shape( myTopoShape );
+ return new HYDROGUI_AISShape( myTopoShape );
}
}
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() ),
}
// Coloring borders
- colorShapeBorder( getActiveColor() );
+ colorShapeBorder( myBorderColor );
}
if ( !theToDisplay || !isVisible() || myContext.IsNull() )
}
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 )
{
myDisplayer( theDisplayer ),
myIsScalarMapMode( theIsScalarMode )
{
+ setFillingColor( QColor(), false, false );
}
HYDROGUI_ShapeLandCoverMap::~HYDROGUI_ShapeLandCoverMap()
#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;
*/
static Handle(Image_PixMap) Pixmap( const QImage& theImage );
+#ifndef LIGHT_MODE
/**
* \brief Get the selected GEOM objects.
* \param theModule the module
*/
static QStringList GetSelectedGeomObjects( HYDROGUI_Module* theModule,
QList<GEOM::shape_type> theTypes );
+#endif
/**
* \brief Delete the GEOM objects.
<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" >
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
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
../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
)
return myViewWindow;
}
-Handle(AIS_InteractiveContext) context()
+Handle(AIS_InteractiveContext) TestViewer::context()
{
- return TestViewer::viewer()->getAISContext();
+ return viewer()->getAISContext();
}
QColor TestViewer::GetColor(int i)
class TopoDS_Shape;
class QString;
class QColor;
+class Handle_AIS_InteractiveContext;
class Handle_AIS_InteractiveObject;
class Handle_Aspect_ColorScale;
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,
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();
+}
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 );
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 );
--- /dev/null
+// 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();
+}
--- /dev/null
+// 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");
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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");