-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcapengine.h
107 lines (66 loc) · 2.24 KB
/
capengine.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#ifndef CAPOC2_CAPENGINE_H
#define CAPOC2_CAPENGINE_H
class capEngine;
#ifdef WINDOWS
#include <windows.h>
#include <stringapiset.h>
#include <stdio.h>
static FILE * utf8open(const char *file, const char *mode)
{
int wfile_num = MultiByteToWideChar(CP_UTF8, 0, file, -1, NULL, 0);
int wmode_num = MultiByteToWideChar(CP_UTF8, 0, mode, -1, NULL, 0);
wchar_t* wfile = new wchar_t[wfile_num];
wchar_t* wmode = new wchar_t[wmode_num];
FILE *ret;
MultiByteToWideChar(CP_UTF8, 0, file, -1, wfile, wfile_num);
MultiByteToWideChar(CP_UTF8, 0, mode, -1, wmode, wmode_num);
ret = _wfopen(wfile, wmode);
delete[] wfile;
delete[] wmode;
return ret;
}
#else
#define utf8open(file, mode) fopen(file,mode)
#endif
#include "captypes.h"
#include "capmodel.h"
#include "capnvm.h"
#include "capserver.h"
#include "caprenderer.h"
#include "capcli.h"
class capEngine
{
public:
explicit capEngine(capRenderer *r);
std::vector <capModel*> models;
capReprojParams repr;
int logSeq = 0, stationId = 0;
float shiftStep = 0.5, rotateStep = CAP_PI/180.0f*2.0f, zoomStep = 1.1f;
capServer *server;
capCli *cli;
capCliThread *guiCliThread;
capRenderer *renderer;
bool needRefresh = true;
void execStream(FILE *fh);
bool execFile(const char *name);
const char * execString(const char *cmd);
const char * execStringf(const char *fmt, ...);
void saveProjectScript(const char *filename);
void render();
void processNetwork();
bool startNetwork(const char *ctrlAddr, int port);
void mouseAction(int action, float step, float x1, float y1, float x2, float y2);
void mouseAction(int action, float step);
void mouseAction(int action, float step, int x1, int y1, int x2, int y2);
void reshape(unsigned int w, unsigned int h);
void keyAction(unsigned char key, int type);
void setStatus(const char *fmt, ...);
void virtualMeasurement(float x1, float y1, float x2, float y2);
#define CA_STATUS_MAX 256
char status[CA_STATUS_MAX];
bool statusUpdated = false;
bool loadModel(const char *loadFrom, int modelId = -1, bool append = false);
protected:
bool mousePixToFloat(int x, int y, float *xs, float *ys);
};
#endif //CAPOC2_CAPENGINE_H