# Author : Vladimir Klyachin (OCN)
# Module : OCCViewer
# $Header$
+#
include $(top_srcdir)/adm_local/unix/make_common_starter.am
OCCViewer_FontWidget.h \
OCCViewer_CubeAxesDlg.h \
OCCViewer_ToolTip.h \
- OCCViewer_ViewFrame.h
+ OCCViewer_ViewFrame.h \
+ OCCViewer_FeatureDetector.h
dist_libOCCViewer_la_SOURCES = \
OCCViewer_AISSelector.cxx \
OCCViewer_FontWidget.cxx \
OCCViewer_CubeAxesDlg.cxx \
OCCViewer_ToolTip.cxx \
- OCCViewer_ViewFrame.cxx
+ OCCViewer_ViewFrame.cxx \
+ OCCViewer_FeatureDetector.cxx
MOC_FILES = \
OCCViewer_AISSelector_moc.cxx \
libOCCViewer_la_CPPFLAGS = $(QT_INCLUDES) $(OGL_INCLUDES) $(CAS_CPPFLAGS) @KERNEL_CXXFLAGS@ \
-I$(srcdir)/../SUIT -I$(srcdir)/../ViewerTools -I$(srcdir)/../Qtx \
- -I$(srcdir)/../OpenGLUtils -I$(srcdir)/../CASCatch
+ -I$(srcdir)/../OpenGLUtils -I$(srcdir)/../CASCatch \
+ -I/home/palmco/OpenCV/OpenCV-2.3.0/install/include/opencv \
+ -I/home/palmco/OpenCV/OpenCV-2.3.0/install/include
-libOCCViewer_la_LDFLAGS = $(OGL_LIBS) $(QT_MT_LIBS) $(CAS_KERNEL) $(CAS_VIEWER)
+libOCCViewer_la_LDFLAGS = $(OGL_LIBS) $(QT_MT_LIBS) $(CAS_KERNEL) $(CAS_VIEWER) \
+ -L/home/palmco/OpenCV/OpenCV-2.3.0/install/lib -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_ml -lopencv_video -lopencv_features2d -lopencv_calib3d -lopencv_objdetect -lopencv_contrib -lopencv_legacy -lopencv_flann
libOCCViewer_la_LIBADD = ../Qtx/libqtx.la ../SUIT/libsuit.la \
../ViewerTools/libViewerTools.la ../OpenGLUtils/libOpenGLUtils.la
// 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"
#include <Prs3d_AngleAspect.hxx>
#include <Prs3d_TextAspect.hxx>
+#include "utilities.h"
+
/*!
Constructor
\param DisplayTrihedron - is trihedron displayed
*/
void OCCViewer_Viewer::onMouseMove(SUIT_ViewWindow* theWindow, QMouseEvent* theEvent)
{
+// MESSAGE("OCCViewer_Viewer::onMouseMove")
if (!mySelectionEnabled) return;
if (!theWindow->inherits("OCCViewer_ViewWindow")) return;
*/
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;
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);
+ }
}
/*!
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);
}
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
#include <Basics_OCCTVersion.hxx>
#include <SUIT_ViewManager.h>
+#include <SUIT_ViewModel.h>
#include <QColor>
#include <QString>
#include <V3d_PerspectiveView.hxx>
#include <V3d_OrthographicView.hxx>
+#include <InterfaceGraphic_Visual3d.hxx>
+#include <OpenGl_cmn_varargs.h>
+#include <OpenGl_tsm_ws.h>
+
+#include "utilities.h"
+
#if defined WNT
#include <WNT_Window.hxx>
#else
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);
+
+// //TEST
+// SUIT_ViewWindow* theViewWindow = getDesktop()->activeWindow();
+// OCCViewer_Viewer* anOCCViewer = ( (OCCViewer_ViewManager*)( theViewWindow->getViewManager() ) )->getOCCViewer();
+// QString theImgFileName = backgroundImageFilename();
+// Handle(AIS_InteractiveContext) aContext = anOCCViewer->getAISContext();
+//
+// gp_Pnt p1(0,0,0);
+// gp_Pnt p2(0,100,0);
+// gp_Pnt p3(100,100,0);
+// gp_Pnt p4(100,0,0);
+//
+// BRepBuilderAPI_MakePolygon Wire(p1,p2,p3,p4, Standard_True);
+// BRepBuilderAPI_MakeFace Face(Wire,Standard_True);
+// const TopoDS_Shape& S = Face.Shape();
+// Handle(AIS_TexturedShape) anAIS = new AIS_TexturedShape(S);
+// if (!theImgFileName.isEmpty())
+// {
+// MESSAGE("filename is not empty")
+// anAIS->SetTextureFileName(TCollection_AsciiString(theImgFileName.toStdString().c_str()));
+// anAIS->SetTextureMapOn();
+// activeView()->SetSurfaceDetail(V3d_TEX_ALL);
+// // anAIS->SetDisplayMode(AIS_Shaded);
+// }
+// else
+// anAIS->SetTextureMapOff();
+// //creation of the presentable object
+// aContext->SetDisplayMode(anAIS,3);
+// aContext->SetMaterial(anAIS,Graphic3d_NOM_SATIN);
+// aContext->Display(anAIS);
+// aContext->UpdateCurrentViewer();
+// }
}
/*!
virtual QString backgroundImageFilename() const;
virtual void setBackgroundImage( const QString& fileName , const Aspect_FillMethod& theFillMethod);
+
+ virtual int getBgImgHeight(){return myBgImgHeight; };
+ virtual int getBgImgWidth() {return myBgImgWidth; };
// void setActive( V3d_TypeOfView );
virtual bool syncronize( const OCCViewer_ViewPort3d* );
double myScale;
bool myIsAdvancedZoomingEnabled;
QString myBackgroundImageFilename;
+ int myBgImgHeight;
+ int myBgImgWidth;
};
#ifdef WIN32
#include <AIS_ListOfInteractive.hxx>
#include <AIS_ListIteratorOfListOfInteractive.hxx>
#include <AIS_Shape.hxx>
+#include <AIS_TexturedShape.hxx>
+
+#include <BRepBuilderAPI_MakeVertex.hxx>
+#include <BRepBuilderAPI_MakeFace.hxx>
+#include <BRepBuilderAPI_MakePolygon.hxx>
+#include <BRepBuilderAPI_Transform.hxx>
+
+#include <TCollection_AsciiString.hxx>
+#include <Graphic3d_MaterialAspect.hxx>
#include <BRep_Tool.hxx>
#include <BRepBndLib.hxx>
#include <TopoDS.hxx>
+#include <TopoDS_Wire.hxx>
#include <Graphic3d_MapIteratorOfMapOfStructure.hxx>
#include <Graphic3d_MapOfStructure.hxx>
#include <Standard_Version.hxx>
+#include "utilities.h"
+
+// OpenCV includes
+#include <cv.h>
+#include <highgui.h>
+
static QEvent* l_mbPressEvent = 0;
#ifdef WIN32
myViewPort->setCursor( handCursor );
}
}
+ emit mouseMoving( this, theEvent );
}
else if ( anInteractionStyle == SUIT_ViewModel::STANDARD &&
aButton == Qt::RightButton && ( aState == Qt::NoModifier || Qt::ShiftModifier ) ) {
*/
void OCCViewer_ViewWindow::onSketchingFinished()
{
+ MESSAGE("OCCViewer_ViewWindow::onSketchingFinished()")
if ( mypSketcher && mypSketcher->result() == OCCViewer_ViewSketcher::Accept )
{
Handle(AIS_InteractiveContext) ic = myModel->getAISContext();
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 );
void OCCViewer_ViewWindow::setBackgroundImage( const QString& theFileName,const Aspect_FillMethod& theFillMethod)
{
- if ( myViewPort ) myViewPort->setBackgroundImage( theFileName ,theFillMethod);
+ if ( myViewPort )
+ {
+ myViewPort->setBackgroundImage( theFileName ,theFillMethod);
+ // set2dMode(XYPlane);
+ // onTopView();
+ //TEST
+ OCCViewer_Viewer* anOCCViewer = ((OCCViewer_ViewManager*)getViewManager())->getOCCViewer();
+ // QString theImgFileName = backgroundImageFilename();
+ Handle(AIS_InteractiveContext) aContext = anOCCViewer->getAISContext();
+
+ IplImage* img = cvLoadImage( theFileName.toStdString().c_str(),CV_LOAD_IMAGE_GRAYSCALE);
+ int height = img->height;
+ int width = img->width;
+
+ gp_Pnt p1(0,0,0);
+ gp_Pnt p2(0,height,0);
+ gp_Pnt p3(width,height,0);
+ gp_Pnt p4(width,0,0);
+
+ BRepBuilderAPI_MakePolygon Wire(p1,p2,p3,p4, Standard_True);
+ BRepBuilderAPI_MakeFace Face(Wire,Standard_True);
+ const TopoDS_Shape& S = Face.Shape();
+ Handle(AIS_TexturedShape) anAIS = new AIS_TexturedShape(S);
+ if (!theFileName.isEmpty())
+ {
+ MESSAGE("filename is not empty")
+ anAIS->SetTextureFileName(TCollection_AsciiString(theFileName.toStdString().c_str()));
+ anAIS->SetTextureMapOn();
+ anAIS->DisableTextureModulate();
+ myViewPort->getView()->SetSurfaceDetail(V3d_TEX_ALL);
+ // anAIS->SetDisplayMode(AIS_Shaded);
+ }
+ else
+ anAIS->SetTextureMapOff();
+ //creation of the presentable object
+ aContext->SetDisplayMode(anAIS,3);
+ aContext->SetMaterial(anAIS,Graphic3d_NOM_SATIN);
+ aContext->Display(anAIS);
+ onTopView();
+ aContext->UpdateCurrentViewer();
+
+ }
}
/*!