set(PROJECT_HEADERS
HYDROGUI.h
HYDROGUI_AbstractDisplayer.h
+ HYDROGUI_AISShape.h
HYDROGUI_AISTrihedron.h
HYDROGUI_BathymetryPrs.h
HYDROGUI_CalculationDlg.h
set(PROJECT_SOURCES
HYDROGUI_AbstractDisplayer.cxx
+ HYDROGUI_AISShape.cxx
HYDROGUI_AISTrihedron.cxx
HYDROGUI_BathymetryPrs.cxx
HYDROGUI_CalculationDlg.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
#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 );
}
}
}
// 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 )
{
#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.
test_HYDROData_ShapeFile.h
test_HYDROData_StricklerTable.h
test_HYDROGUI_ListModel.h
+ test_HYDROGUI_Shape.h
test_Dependencies.h
TestShape.h
test_HYDROData_ShapeFile.cxx
test_HYDROData_StricklerTable.cxx
test_HYDROGUI_ListModel.cxx
+ test_HYDROGUI_Shape.cxx
test_Dependencies.cxx
TestShape.cxx
../HYDROGUI/HYDROGUI_DataObject.cxx
../HYDROGUI/HYDROGUI_LandCoverMapPrs.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,
--- /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");