From c43d1612d91ea03b1187d0e20c47e4fc72578fde Mon Sep 17 00:00:00 2001 From: gdd Date: Tue, 8 Nov 2011 13:45:21 +0000 Subject: [PATCH] Merge from BR_OPENCV --- configure.ac | 4 ++-- src/LightApp/Makefile.am | 5 ++++- src/OBJECT/Handle_SALOME_AISShape.hxx | 18 +++++++++++------- src/OBJECT/SALOME_AISShape.cxx | 2 +- src/OBJECT/SALOME_AISShape.hxx | 10 +++++++--- src/OBJECT/SALOME_AISShape.ixx | 4 ++-- src/OCCViewer/Makefile.am | 2 ++ src/OCCViewer/OCCViewer_ViewModel.cxx | 16 ++++++++++++---- src/OCCViewer/OCCViewer_ViewPort3d.cxx | 14 +++++++++++--- src/OCCViewer/OCCViewer_ViewPort3d.h | 7 +++++++ src/OCCViewer/OCCViewer_ViewWindow.cxx | 13 ++++++++++++- src/SOCC/Makefile.am | 5 ++++- 12 files changed, 75 insertions(+), 25 deletions(-) diff --git a/configure.ac b/configure.ac index 712107285..203158ba5 100644 --- a/configure.ac +++ b/configure.ac @@ -526,10 +526,10 @@ fi if test "$GUI_DISABLE_CORBA" != "yes"; then variables="cc_ok lex_yacc_ok python_ok swig_ok threads_ok OpenGL_ok qt_ok vtk_ok hdf5_ok -omniORB_ok boost_ok occ_ok sip_ok pyqt_ok qwt_ok doxygen_ok graphviz_ok libxml_ok Kernel_ok" +omniORB_ok boost_ok occ_ok sip_ok pyqt_ok qwt_ok doxygen_ok graphviz_ok opencv_ok libxml_ok Kernel_ok" else variables="cc_ok lex_yacc_ok python_ok threads_ok OpenGL_ok qt_ok vtk_ok hdf5_ok boost_ok -occ_ok sip_ok pyqt_ok qwt_ok doxygen_ok graphviz_ok Kernel_ok" +occ_ok sip_ok pyqt_ok qwt_ok doxygen_ok graphviz_ok opencv_ok Kernel_ok " fi for var in $variables diff --git a/src/LightApp/Makefile.am b/src/LightApp/Makefile.am index 814e02bb9..1f032bed8 100755 --- a/src/LightApp/Makefile.am +++ b/src/LightApp/Makefile.am @@ -183,10 +183,13 @@ nodist_salomeres_DATA = \ libLightApp_la_CPPFLAGS = $(PYTHON_INCLUDES) $(QT_INCLUDES) $(CAS_CPPFLAGS) \ $(HDF5_INCLUDES) @KERNEL_CXXFLAGS@ -I$(srcdir)/../SUIT -I$(srcdir)/../STD \ + $(OPENCV_INCLUDES) \ -I$(srcdir)/../CAM -I$(srcdir)/../ObjBrowser -I$(srcdir)/../LogWindow \ -I$(srcdir)/../Prs -I$(srcdir)/../Qtx -I$(srcdir)/../Event -I$(srcdir)/../Style \ -I$(srcdir)/../CASCatch -libLightApp_la_LDFLAGS = $(QT_MT_LIBS) + +libLightApp_la_LDFLAGS = $(QT_MT_LIBS) \ + $(OPENCV_LIBS) if ENABLE_VTKVIEWER libLightApp_la_CPPFLAGS += $(VTK_INCLUDES) -I$(srcdir)/../VTKViewer diff --git a/src/OBJECT/Handle_SALOME_AISShape.hxx b/src/OBJECT/Handle_SALOME_AISShape.hxx index 2c2026d39..b114d0a1d 100755 --- a/src/OBJECT/Handle_SALOME_AISShape.hxx +++ b/src/OBJECT/Handle_SALOME_AISShape.hxx @@ -34,8 +34,11 @@ #include #endif -#ifndef _Handle_AIS_Shape_HeaderFile -#include +// #ifndef _Handle_AIS_Shape_HeaderFile +// #include +// #endif +#ifndef _AIS_TexturedShape_HeaderFile +#include #endif class Standard_Transient; @@ -44,7 +47,8 @@ class Handle_Standard_Type; \class Handle(AIS_Shape) Smart pointer (handle) to AIS_Shape */ -class Handle(AIS_Shape); +// class Handle(AIS_Shape); +class Handle(AIS_TexturedShape); class SALOME_AISShape; Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOME_AISShape); @@ -52,7 +56,7 @@ Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOME_AISShape); \class Handle(SALOME_AISShape) Smart pointer (handle) to SALOME_AISShape */ -class Handle(SALOME_AISShape) : public Handle(AIS_Shape) { +class Handle(SALOME_AISShape) : public Handle(AIS_TexturedShape) { public: inline void* operator new(size_t,void* anAddress) { @@ -70,12 +74,12 @@ class Handle(SALOME_AISShape) : public Handle(AIS_Shape) { // { // if (anAddress) Standard::Free((Standard_Address&)anAddress,size); // } - Handle(SALOME_AISShape)():Handle(AIS_Shape)() {} - Handle(SALOME_AISShape)(const Handle(SALOME_AISShape)& aHandle) : Handle(AIS_Shape)(aHandle) + Handle(SALOME_AISShape)():Handle(AIS_TexturedShape)() {} + Handle(SALOME_AISShape)(const Handle(SALOME_AISShape)& aHandle) : Handle(AIS_TexturedShape)(aHandle) { } - Handle(SALOME_AISShape)(const SALOME_AISShape* anItem) : Handle(AIS_Shape)((AIS_Shape *)anItem) + Handle(SALOME_AISShape)(const SALOME_AISShape* anItem) : Handle(AIS_TexturedShape)((AIS_TexturedShape *)anItem) { } diff --git a/src/OBJECT/SALOME_AISShape.cxx b/src/OBJECT/SALOME_AISShape.cxx index 0916b3303..2f812e30f 100755 --- a/src/OBJECT/SALOME_AISShape.cxx +++ b/src/OBJECT/SALOME_AISShape.cxx @@ -34,7 +34,7 @@ \param shape - TopoDS shape */ SALOME_AISShape::SALOME_AISShape(const TopoDS_Shape& shape) -: AIS_Shape(shape) +: AIS_TexturedShape(shape) { } diff --git a/src/OBJECT/SALOME_AISShape.hxx b/src/OBJECT/SALOME_AISShape.hxx index eef6f61bd..cdc8afe2a 100755 --- a/src/OBJECT/SALOME_AISShape.hxx +++ b/src/OBJECT/SALOME_AISShape.hxx @@ -40,18 +40,22 @@ #ifndef _Handle_SALOME_InteractiveObject_HeaderFile #include #endif -#ifndef _AIS_Shape_HeaderFile -#include +// #ifndef _AIS_Shape_HeaderFile +// #include +// #endif +#ifndef _AIS_TexturedShape_HeaderFile +#include #endif #ifndef _Standard_Boolean_HeaderFile #include #endif + class SALOME_InteractiveObject; class TopoDS_Shape; class TColStd_IndexedMapOfInteger; -class SALOME_AISShape : public AIS_Shape { +class SALOME_AISShape : public AIS_TexturedShape { public: diff --git a/src/OBJECT/SALOME_AISShape.ixx b/src/OBJECT/SALOME_AISShape.ixx index ef67553bf..10aaaf693 100755 --- a/src/OBJECT/SALOME_AISShape.ixx +++ b/src/OBJECT/SALOME_AISShape.ixx @@ -37,8 +37,8 @@ SALOME_AISShape::~SALOME_AISShape() {} Standard_EXPORT Handle_Standard_Type& SALOME_AISShape_Type_() { - static Handle_Standard_Type aType1 = STANDARD_TYPE(AIS_Shape); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(AIS_Shape); + static Handle_Standard_Type aType1 = STANDARD_TYPE(AIS_TexturedShape); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(AIS_TexturedShape); static Handle_Standard_Type aType2 = STANDARD_TYPE(AIS_InteractiveObject); if ( aType2.IsNull()) aType2 = STANDARD_TYPE(AIS_InteractiveObject); static Handle_Standard_Type aType3 = STANDARD_TYPE(SelectMgr_SelectableObject); diff --git a/src/OCCViewer/Makefile.am b/src/OCCViewer/Makefile.am index f30b953f7..993692633 100755 --- a/src/OCCViewer/Makefile.am +++ b/src/OCCViewer/Makefile.am @@ -23,6 +23,7 @@ # Author : Vladimir Klyachin (OCN) # Module : OCCViewer # $Header$ +# include $(top_srcdir)/adm_local/unix/make_common_starter.am @@ -129,5 +130,6 @@ libOCCViewer_la_CPPFLAGS = $(QT_INCLUDES) $(OGL_INCLUDES) $(CAS_CPPFLAGS) @KERNE -I$(srcdir)/../OpenGLUtils -I$(srcdir)/../CASCatch libOCCViewer_la_LDFLAGS = $(OGL_LIBS) $(QT_MT_LIBS) $(CAS_KERNEL) $(CAS_VIEWER) + libOCCViewer_la_LIBADD = ../Qtx/libqtx.la ../SUIT/libsuit.la \ ../ViewerTools/libViewerTools.la ../OpenGLUtils/libOpenGLUtils.la diff --git a/src/OCCViewer/OCCViewer_ViewModel.cxx b/src/OCCViewer/OCCViewer_ViewModel.cxx index 25709f0a4..240277c31 100755 --- a/src/OCCViewer/OCCViewer_ViewModel.cxx +++ b/src/OCCViewer/OCCViewer_ViewModel.cxx @@ -18,6 +18,7 @@ // 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 "OCCViewer_ViewModel.h" #include "OCCViewer_ViewWindow.h" @@ -173,7 +174,10 @@ void OCCViewer_Viewer::initView( OCCViewer_ViewWindow* view ) OCCViewer_ViewPort3d* vp3d = view->getViewPort(); if ( vp3d ) + { vp3d->setBackgroundColor( myColors[0] ); + vp3d->getView()->SetSurfaceDetail(V3d_TEX_ALL); + } } } @@ -224,6 +228,7 @@ void OCCViewer_Viewer::onMousePress(SUIT_ViewWindow* theWindow, QMouseEvent* the */ void OCCViewer_Viewer::onMouseMove(SUIT_ViewWindow* theWindow, QMouseEvent* theEvent) { +// MESSAGE("OCCViewer_Viewer::onMouseMove") if (!mySelectionEnabled) return; if (!theWindow->inherits("OCCViewer_ViewWindow")) return; @@ -249,6 +254,7 @@ void OCCViewer_Viewer::onMouseMove(SUIT_ViewWindow* theWindow, QMouseEvent* theE */ void OCCViewer_Viewer::onMouseRelease(SUIT_ViewWindow* theWindow, QMouseEvent* theEvent) { + MESSAGE("OCCViewer_Viewer::onMouseRelease") if (!mySelectionEnabled) return; if (theEvent->button() != Qt::LeftButton) return; if (!theWindow->inherits("OCCViewer_ViewWindow")) return; @@ -470,9 +476,10 @@ void OCCViewer_Viewer::onChangeBgImageCentered() if ( !aView ) return; - QString selFile = QFileDialog::getOpenFileName(aView,tr( "SELECT_IMAGE"),aView->backgroundImageFilename(), tr("OCC_BG_IMAGE_FILES")); - if ( ! selFile.isEmpty() ) + QString selFile = QFileDialog::getOpenFileName(aView,tr( "SELECT_IMAGE"),aView->backgroundImageFilename(), tr("OCC_IMAGE_FILES")); + if ( ! selFile.isEmpty() ){ aView->setBackgroundImage(selFile,Aspect_FM_CENTERED); + } } /*! @@ -484,7 +491,7 @@ void OCCViewer_Viewer::onChangeBgImageTiled() if ( !aView ) return; - QString selFile = QFileDialog::getOpenFileName(aView,tr( "SELECT_IMAGE"),aView->backgroundImageFilename(), tr("OCC_BG_IMAGE_FILES")); + QString selFile = QFileDialog::getOpenFileName(aView,tr( "SELECT_IMAGE"),aView->backgroundImageFilename(), tr("OCC_IMAGE_FILES")); if ( ! selFile.isEmpty() ) aView->setBackgroundImage(selFile,Aspect_FM_TILED); } @@ -498,9 +505,10 @@ void OCCViewer_Viewer::onChangeBgImageStretched() if ( !aView ) return; - QString selFile = QFileDialog::getOpenFileName(aView,tr( "SELECT_IMAGE"),aView->backgroundImageFilename(), tr("OCC_BG_IMAGE_FILES")); + QString selFile = QFileDialog::getOpenFileName(aView,tr( "SELECT_IMAGE"),aView->backgroundImageFilename(), tr("OCC_IMAGE_FILES")); if ( ! selFile.isEmpty() ) aView->setBackgroundImage(selFile,Aspect_FM_STRETCH); +// aView->setBackgroundImage(selFile,Aspect_FM_STRETCH_NODEF); } /*! Updates OCC 3D viewer diff --git a/src/OCCViewer/OCCViewer_ViewPort3d.cxx b/src/OCCViewer/OCCViewer_ViewPort3d.cxx index ebaeedcae..7419c10a7 100755 --- a/src/OCCViewer/OCCViewer_ViewPort3d.cxx +++ b/src/OCCViewer/OCCViewer_ViewPort3d.cxx @@ -28,6 +28,7 @@ #include #include +#include #include #include @@ -41,6 +42,12 @@ #include #include +#include +#include +#include + +#include "utilities.h" + #if defined WNT #include #else @@ -312,9 +319,10 @@ QString OCCViewer_ViewPort3d::backgroundImageFilename() const void OCCViewer_ViewPort3d::setBackgroundImage( const QString& fileName,const Aspect_FillMethod& theFillMethod) { myBackgroundImageFilename=fileName; - if ( !activeView().IsNull() ) { - activeView()->SetBackgroundImage( (Standard_CString)fileName.toLatin1().constData(),theFillMethod,true); - } + //TEST +// if ( !activeView().IsNull() ) { +// activeView()->SetBackgroundImage( (Standard_CString)fileName.toLatin1().constData(),theFillMethod,true); +// } } /*! diff --git a/src/OCCViewer/OCCViewer_ViewPort3d.h b/src/OCCViewer/OCCViewer_ViewPort3d.h index 57ee49508..985126bb4 100755 --- a/src/OCCViewer/OCCViewer_ViewPort3d.h +++ b/src/OCCViewer/OCCViewer_ViewPort3d.h @@ -59,6 +59,11 @@ public: virtual QString backgroundImageFilename() const; virtual void setBackgroundImage( const QString& fileName , const Aspect_FillMethod& theFillMethod); + + virtual int getBgImgHeight(){return myBgImgHeight; }; + virtual int getBgImgWidth() {return myBgImgWidth; }; + + virtual void updateStaticTriedronVisibility(); virtual void updateStaticTriedronVisibility(); @@ -119,6 +124,8 @@ private: double myScale; bool myIsAdvancedZoomingEnabled; QString myBackgroundImageFilename; + int myBgImgHeight; + int myBgImgWidth; }; #ifdef WIN32 diff --git a/src/OCCViewer/OCCViewer_ViewWindow.cxx b/src/OCCViewer/OCCViewer_ViewWindow.cxx index 902558586..c6d6ef54e 100755 --- a/src/OCCViewer/OCCViewer_ViewWindow.cxx +++ b/src/OCCViewer/OCCViewer_ViewWindow.cxx @@ -80,6 +80,12 @@ #include +#include "utilities.h" + +// // OpenCV includes +// #include +// #include + static QEvent* l_mbPressEvent = 0; #ifdef WIN32 @@ -228,6 +234,7 @@ OCCViewer_ViewWindow::OCCViewer_ViewWindow( SUIT_Desktop* theDesktop, myInteractionStyle = SUIT_ViewModel::STANDARD; clearViewAspects(); + } /*! @@ -827,6 +834,7 @@ void OCCViewer_ViewWindow::vpMouseMoveEvent( QMouseEvent* theEvent ) myViewPort->setCursor( handCursor ); } } + emit mouseMoving( this, theEvent ); } else if ( anInteractionStyle == SUIT_ViewModel::STANDARD && aButton == Qt::RightButton && ( aState == Qt::NoModifier || Qt::ShiftModifier ) ) { @@ -2271,6 +2279,7 @@ void OCCViewer_ViewWindow::onSketchingStarted() */ void OCCViewer_ViewWindow::onSketchingFinished() { + MESSAGE("OCCViewer_ViewWindow::onSketchingFinished()") if ( mypSketcher && mypSketcher->result() == OCCViewer_ViewSketcher::Accept ) { Handle(AIS_InteractiveContext) ic = myModel->getAISContext(); @@ -2286,6 +2295,7 @@ void OCCViewer_ViewWindow::onSketchingFinished() int aRight = aRect->right(); int aTop = aRect->top(); int aBottom = aRect->bottom(); +// myRect = aRect; if( append ) ic->ShiftSelect( aLeft, aBottom, aRight, aTop, getViewPort()->getView(), Standard_False ); @@ -2421,7 +2431,8 @@ QString OCCViewer_ViewWindow::backgroundImageFilename() const void OCCViewer_ViewWindow::setBackgroundImage( const QString& theFileName,const Aspect_FillMethod& theFillMethod) { - if ( myViewPort ) myViewPort->setBackgroundImage( theFileName ,theFillMethod); + if ( myViewPort ) + myViewPort->setBackgroundImage( theFileName ,theFillMethod); } /*! diff --git a/src/SOCC/Makefile.am b/src/SOCC/Makefile.am index 91ea8e735..6f9ba3e5d 100755 --- a/src/SOCC/Makefile.am +++ b/src/SOCC/Makefile.am @@ -46,9 +46,12 @@ MOC_FILES = \ nodist_libSOCC_la_SOURCES = $(MOC_FILES) libSOCC_la_CPPFLAGS = $(QT_INCLUDES) $(CAS_CPPFLAGS) $(BOOST_CPPFLAGS) \ + $(OPENCV_INCLUDES) \ -I$(srcdir)/../SUIT -I$(srcdir)/../OBJECT -I$(srcdir)/../Prs \ -I$(srcdir)/../OCCViewer -I$(srcdir)/../Qtx -libSOCC_la_LDFLAGS = $(QT_MT_LIBS) +libSOCC_la_LDFLAGS = $(QT_MT_LIBS) \ + $(OPENCV_LIBS) + libSOCC_la_LIBADD = ../Qtx/libqtx.la ../SUIT/libsuit.la ../OBJECT/libSalomeObject.la \ ../Prs/libSalomePrs.la ../OCCViewer/libOCCViewer.la -- 2.39.2