-
Notifications
You must be signed in to change notification settings - Fork 0
/
OCCWindow.h
80 lines (74 loc) · 1.59 KB
/
OCCWindow.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#pragma once
#include <gp_Dir2d.hxx>
#include <gp_Pnt.hxx>
#include <gp_Pnt2d.hxx>
#include <gp_Trsf.hxx>
#include <gp_Vec.hxx>
#include <Geom_CylindricalSurface.hxx>
#include <Geom_Plane.hxx>
#include <Geom_Surface.hxx>
#include <Geom_TrimmedCurve.hxx>
#include <Geom2d_Ellipse.hxx>
#include <Geom2d_TrimmedCurve.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Wire.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Compound.hxx>
#include <TopTools_ListOfShape.hxx>
#include <wx/event.h>
#include <wx/window.h>
#include "occview.h"
class OCCWindow : public wxWindow
{
public:
OCCWindow(wxWindow* parent, wxWindowID id = wxID_ANY) :
wxWindow(parent, id)
{ }
OCCView* occview;
bool dragging;
// this callback function is really important.
// otherwise wxwidget just paints over the window
void OnPaint(wxPaintEvent& event)
{
occview->reset();
}
void OnResize(wxSizeEvent& event)
{
//occview->redraw();
}
void onMouseUp(wxMouseEvent& event)
{
ReleaseMouse();
dragging = false;
}
void OnMouseDown(wxMouseEvent& event)
{
CaptureMouse();
mouseX = event.GetX();
mouseY = event.GetY();
occview->StartRotation(mouseX, mouseY);
dragging = true;
}
void onMove(wxMouseEvent& event)
{
if (dragging)
{
//wxPoint mouseOnScreen = wxGetMousePosition();
//int dx = event.GetX() - mouseX;
//xVal += dx;
//int dy = event.GetY() - mouseY;
//yVal += dy;
occview->rotate(event.GetX(),
event.GetY());
}
}
private:
int mouseX;
int mouseY;
int xVal = 0;
int yVal = 0;
DECLARE_EVENT_TABLE()
};