1 // Copyright (c) 2014 OPEN CASCADE SAS
3 // This file is part of Open CASCADE Technology software library.
5 // This library is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU Lesser General Public License version 2.1 as published
7 // by the Free Software Foundation, with special exception defined in the file
8 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9 // distribution for complete text of the license and disclaimer of any warranty.
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
17 #include <OpenGl_Context.hxx>
19 // workaround broken definitions in Qt
20 #define GLdouble GLdouble
22 #include <QtQuick/qquickwindow.h>
23 #include <QtQuick/QQuickItem>
27 #include <AIS_InteractiveContext.hxx>
28 #include <V3d_View.hxx>
32 #include <AndroidQt_TouchParameters.h>
34 //! QML item with embedded OCCT viewer.
35 class AndroidQt : public QQuickItem
40 //! Default constructor.
43 //! Display shape from file.
44 Q_INVOKABLE bool ReadShapeFromFile (QString theFilePath);
46 //! Handle touch event.
47 Q_INVOKABLE void InitTouch (const double theX,
50 //! Handle touch event.
51 Q_INVOKABLE void UpdateTouch (const double theX,
56 //! Handle OpenGL context creation and window resize events.
59 //! Redraw OCCT viewer and handle pending viewer events in rendering thread.
64 //! Handle window change event.
65 void handleWindowChanged (QQuickWindow* theWin);
69 //! (Re-)initialize viewer on OpenGL context change.
77 Handle(V3d_Viewer) myViewer; //!< 3D viewer
78 Handle(V3d_View) myView; //!< 3D view
79 Handle(AIS_InteractiveContext) myContext; //!< interactive context
81 QMutex myMutex; //!< mutex for interconnection with rendering thread
82 QSize myViewportSize; //!< QML item size
83 AndroidQt_TouchParameters myTouchPoint; //!< cached state of touch event
84 bool myFitAllAction; //!< queued viewer FitALL event