-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathResolutionCtrl.h
106 lines (84 loc) · 2.32 KB
/
ResolutionCtrl.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
//############################################################
//
// ResolutionCtrl.h
//
// Kari Pulli
// Fri Jul 3 11:52:55 PDT 1998
//
//############################################################
#ifndef _RESOLUTIONCTRL_H_
#define _RESOLUTIONCTRL_H_
#include <vector>
#include <ext/rope>
using namespace std;
using namespace __gnu_cxx;
class ResolutionCtrl {
public:
struct res_info {
int abs_resolution; // number of vertices
bool in_memory; // true == in memory, false == in file
bool desired_in_mem;
crope filename;
res_info(void) : abs_resolution(0),
in_memory(false), desired_in_mem(true) { }
friend bool operator<(const res_info& r1, const res_info& r2)
{ // descending sort by number of vertices
return r1.abs_resolution > r2.abs_resolution;
};
};
protected:
vector<res_info> resolutions;
int curr_res;
crope name;
crope basename;
crope ending;
private:
void split_name(void);
public:
ResolutionCtrl(void) : curr_res(0) { }
//
// Functions for name
//
void set_name(const char *n);
void set_name(const crope &n);
crope get_name(void);
crope get_basename(void);
crope get_nameending(void);
bool has_ending(const char *end);
//
// Select a resolution
//
bool select_finest(void);
bool select_coarsest(void);
bool select_finer(void);
bool select_coarser(void);
bool select_by_count(int n);
//
// Create a new resolution (if it doesn't exist)
//
typedef enum { decQslim, decPlycrunch } Decimator;
virtual int create_resolution_absolute(int budget = 0,
Decimator dec = decQslim);
virtual bool delete_resolution (int abs_res);
//
// Find out about resolutions
//
int num_resolutions(void) { return resolutions.size(); }
void existing_resolutions(vector<res_info> &res);
res_info current_resolution(void);
int current_resolution_index (void);
int findResForLevel (int n);
bool set_load_desired (int nPolys, bool desired);
//
// Memory handling
//
virtual bool load_resolution(int i);
virtual bool release_resolution(int nPolys);
protected:
int findLevelForRes (int n);
void insert_resolution (int abs, crope filename,
bool in_mem = true,
bool desired_mem = true);
virtual bool switchToResLevel (int iRes);
};
#endif