From 9befc66f671bd8035cd0127f54e1b3e631d1c1d2 Mon Sep 17 00:00:00 2001 From: asl Date: Tue, 17 Nov 2015 10:32:16 +0300 Subject: [PATCH] patch on the shape to support correctly the border color --- src/HYDROGUI/CMakeLists.txt | 2 + src/HYDROGUI/HYDROGUI_AISShape.cxx | 74 ++++++++++++++++++ src/HYDROGUI/HYDROGUI_AISShape.h | 46 +++++++++++ src/HYDROGUI/HYDROGUI_Shape.cxx | 31 ++------ src/HYDROGUI/HYDROGUI_Tool.h | 4 + src/HYDRO_tests/CMakeLists.txt | 2 + src/HYDRO_tests/ExternalFiles.cmake | 2 + src/HYDRO_tests/TestViewer.cxx | 4 +- src/HYDRO_tests/TestViewer.h | 2 + .../reference_data/Shape_preview_im_zone.png | Bin 0 -> 7232 bytes src/HYDRO_tests/test_HYDROGUI_Shape.cxx | 46 +++++++++++ src/HYDRO_tests/test_HYDROGUI_Shape.h | 32 ++++++++ 12 files changed, 218 insertions(+), 27 deletions(-) create mode 100644 src/HYDROGUI/HYDROGUI_AISShape.cxx create mode 100644 src/HYDROGUI/HYDROGUI_AISShape.h create mode 100644 src/HYDRO_tests/reference_data/Shape_preview_im_zone.png create mode 100644 src/HYDRO_tests/test_HYDROGUI_Shape.cxx create mode 100644 src/HYDRO_tests/test_HYDROGUI_Shape.h diff --git a/src/HYDROGUI/CMakeLists.txt b/src/HYDROGUI/CMakeLists.txt index 40a5fe2f..08c7da1f 100644 --- a/src/HYDROGUI/CMakeLists.txt +++ b/src/HYDROGUI/CMakeLists.txt @@ -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 @@ -146,6 +147,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 diff --git a/src/HYDROGUI/HYDROGUI_AISShape.cxx b/src/HYDROGUI/HYDROGUI_AISShape.cxx new file mode 100644 index 00000000..162e44cd --- /dev/null +++ b/src/HYDROGUI/HYDROGUI_AISShape.cxx @@ -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 +#include +#include +#include +#include + +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 index 00000000..7353dcb5 --- /dev/null +++ b/src/HYDROGUI/HYDROGUI_AISShape.h @@ -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 + +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_Shape.cxx b/src/HYDROGUI/HYDROGUI_Shape.cxx index 1feb96ab..133873a9 100644 --- a/src/HYDROGUI/HYDROGUI_Shape.cxx +++ b/src/HYDROGUI/HYDROGUI_Shape.cxx @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -33,10 +34,8 @@ #include #include -#include #include #include -#include #include #include #include @@ -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 ); } } @@ -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 ) { diff --git a/src/HYDROGUI/HYDROGUI_Tool.h b/src/HYDROGUI/HYDROGUI_Tool.h index 4ea4039e..24563aa1 100644 --- a/src/HYDROGUI/HYDROGUI_Tool.h +++ b/src/HYDROGUI/HYDROGUI_Tool.h @@ -31,9 +31,11 @@ #include +#ifndef LIGHT_MODE // IDL includes #include #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 theTypes ); +#endif /** * \brief Delete the GEOM objects. diff --git a/src/HYDRO_tests/CMakeLists.txt b/src/HYDRO_tests/CMakeLists.txt index 167285a9..4762aafb 100644 --- a/src/HYDRO_tests/CMakeLists.txt +++ b/src/HYDRO_tests/CMakeLists.txt @@ -15,6 +15,7 @@ set(PROJECT_HEADERS test_HYDROData_ShapeFile.h test_HYDROData_StricklerTable.h test_HYDROGUI_ListModel.h + test_HYDROGUI_Shape.h test_Dependencies.h TestShape.h @@ -38,6 +39,7 @@ set(PROJECT_SOURCES test_HYDROData_ShapeFile.cxx test_HYDROData_StricklerTable.cxx test_HYDROGUI_ListModel.cxx + test_HYDROGUI_Shape.cxx test_Dependencies.cxx TestShape.cxx diff --git a/src/HYDRO_tests/ExternalFiles.cmake b/src/HYDRO_tests/ExternalFiles.cmake index 7ccb5c26..9c245ce2 100644 --- a/src/HYDRO_tests/ExternalFiles.cmake +++ b/src/HYDRO_tests/ExternalFiles.cmake @@ -57,4 +57,6 @@ set( EXTERNAL_FILES ../HYDROGUI/HYDROGUI_DataObject.cxx ../HYDROGUI/HYDROGUI_LandCoverMapPrs.cxx ../HYDROGUI/HYDROGUI_Polyline.cxx + ../HYDROGUI/HYDROGUI_AISShape.cxx + ../HYDROGUI/HYDROGUI_Shape.cxx ) diff --git a/src/HYDRO_tests/TestViewer.cxx b/src/HYDRO_tests/TestViewer.cxx index 70dbd6fa..52917a31 100644 --- a/src/HYDRO_tests/TestViewer.cxx +++ b/src/HYDRO_tests/TestViewer.cxx @@ -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) diff --git a/src/HYDRO_tests/TestViewer.h b/src/HYDRO_tests/TestViewer.h index d33885b0..9030f33b 100644 --- a/src/HYDRO_tests/TestViewer.h +++ b/src/HYDRO_tests/TestViewer.h @@ -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/Shape_preview_im_zone.png b/src/HYDRO_tests/reference_data/Shape_preview_im_zone.png new file mode 100644 index 0000000000000000000000000000000000000000..fd1d1233d2898dada0cdce6f6fb6df15143a1209 GIT binary patch literal 7232 zcmb7J2{_c-`#&=VUxXQZS!RY}6c_E3F~(Suq?Aw?OIJc9sYJfRWG@r4RhC;xUDc%0 zZNZd1DJ{29$x_zrLe~Eo>HezU@;v`}o*w6W&bxfx<-F&dw-_61b8*o{q5uH#4Hk^8 z00@u(z}h21a3&)t+#mkI9iVU6hQMD4;t>tMMf@!s4gerg#{Y*oy-Y$80L9h~4C8Hw z&-T7|%G>REg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sz+zzo-->hCaWCzcW2?k6=~kpKR4q+xw~08-EOLRgxEjgazFUX-ia0{ zI1v6F-Fz&uc+I)o549s*&H$Vl4ka&HF|FWSsH3{xzpX~6e?)ltOtr^EQP;}QZGix6 zAG&z_q7<=hKui!&!nGYP5=h_1v0fG;WtE4gwqii6`=Z38afKbDesp2by!Jz;_5EaJ zKzr^}9qTcnM=jX}(AI`TS>uqh0Wl$v7wJ`HUuLdU;sIc9BXYr}kg~@!rfhgPy9MQh zjK<<~tSu!$_TIwXy^luJGF?^!+7~O6LNaw|Kuj3yiNrgkj#pLcD1&VM!rj_x)S;m` zIGyNKwLj{EmJT&ws0My!;5SsiI=^@Z-npGR*D%V=9j3?t+5#2?%^~Dsdn$%ZLR3*Uw<#l1e8< wO$~vzvan}g_PS3QV*nE5djVMh=6-v}X0`Vyr=iN9AMw98m|8Qg(V5}@2i`hlQUCw| literal 0 HcmV?d00001 diff --git a/src/HYDRO_tests/test_HYDROGUI_Shape.cxx b/src/HYDRO_tests/test_HYDROGUI_Shape.cxx new file mode 100644 index 00000000..e99db415 --- /dev/null +++ b/src/HYDRO_tests/test_HYDROGUI_Shape.cxx @@ -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 +#include +#include +#include +#include + +void test_HYDROGUI_Shape::test_face_in_preview() +{ + TopoDS_Face aFace = Face( QList() << 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 index 00000000..a4d2942d --- /dev/null +++ b/src/HYDRO_tests/test_HYDROGUI_Shape.h @@ -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 + +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"); -- 2.30.2