Orbiter 2022
Combinatorial Objects
interface_povray.cpp
Go to the documentation of this file.
1/*
2 * interface_povray.cpp
3 *
4 * Created on: Apr 6, 2020
5 * Author: betten
6 */
7
8
9
10
11
12
13
14#include "orbiter.h"
15
16using namespace std;
17
18namespace orbiter {
19namespace layer5_applications {
20namespace user_interface {
21
22
24{
25 f_povray = FALSE;
26 Povray_job_description = NULL;
27
28 f_prepare_frames = FALSE;
29 Prepare_frames = NULL;
30}
31
32
33void interface_povray::print_help(int argc, std::string *argv, int i, int verbose_level)
34{
36
37 if (ST.stringcmp(argv[i], "-povray") == 0) {
38 cout << "-povray" << endl;
39 }
40 else if (ST.stringcmp(argv[i], "-prepare_frames") == 0) {
41 cout << "-prepare_frames <description> -end" << endl;
42 }
43}
44
45int interface_povray::recognize_keyword(int argc, std::string *argv, int i, int verbose_level)
46{
48
49 if (i >= argc) {
50 return false;
51 }
52 if (ST.stringcmp(argv[i], "-povray") == 0) {
53 return true;
54 }
55 else if (ST.stringcmp(argv[i], "-prepare_frames") == 0) {
56 return true;
57 }
58 return false;
59}
60
61void interface_povray::read_arguments(int argc, std::string *argv, int &i, int verbose_level)
62{
63 int f_v = (verbose_level >= 1);
65
66 if (f_v) {
67 cout << "interface_povray::read_arguments" << endl;
68 }
69
70 if (f_v) {
71 cout << "interface_povray::read_arguments the next argument is " << argv[i] << endl;
72 }
73 if (ST.stringcmp(argv[i], "-povray") == 0) {
74 f_povray = TRUE;
75 if (f_v) {
76 cout << "-povray " << endl;
77 }
78 Povray_job_description = NEW_OBJECT(graphics::povray_job_description);
79 i += Povray_job_description->read_arguments(argc - (i + 1),
80 argv + i + 1, verbose_level);
81
82 if (f_v) {
83 cout << "done reading -povray_job_description " << endl;
84 cout << "i = " << i << endl;
85 cout << "argc = " << argc << endl;
86 if (i < argc) {
87 cout << "next argument is " << argv[i] << endl;
88 }
89 }
90 }
91 else if (ST.stringcmp(argv[i], "-prepare_frames") == 0) {
92 f_prepare_frames = TRUE;
94 i += Prepare_frames->parse_arguments(argc - (i + 1), argv + i + 1, verbose_level);
95
96 if (f_v) {
97 cout << "done reading -prepare_frames " << endl;
98 cout << "i = " << i << endl;
99 cout << "argc = " << argc << endl;
100 if (i < argc) {
101 cout << "next argument is " << argv[i] << endl;
102 }
103 }
104 }
105 if (f_v) {
106 cout << "interface_povray::read_arguments done" << endl;
107 }
108}
109
111{
112 if (f_povray) {
113 cout << "-povray " << endl;
114 Povray_job_description->print();
115 }
116 if (f_prepare_frames) {
117 Prepare_frames->print();
118 }
119}
120
121void interface_povray::worker(int verbose_level)
122{
123 int f_v = (verbose_level >= 1);
124
125 if (f_v) {
126 cout << "interface_povray::worker" << endl;
127 }
128
129
130 if (f_povray) {
131
133
134
136 Povray_job_description,
137 verbose_level);
138
139 }
140 else if (f_prepare_frames) {
141 Prepare_frames->do_the_work(verbose_level);
142 }
143 if (f_v) {
144 cout << "interface_povray::worker done" << endl;
145 }
146}
147
148
149}}}
150
151
functions related to strings and character arrays
a catch-all class for things related to 2D graphics
Definition: graphics.h:411
void animate_povray(povray_job_description *Povray_job_description, int verbose_level)
int read_arguments(int argc, std::string *argv, int verbose_level)
to prepare files using a unified file naming scheme
int parse_arguments(int argc, std::string *argv, int verbose_level)
int recognize_keyword(int argc, std::string *argv, int i, int verbose_level)
void print_help(int argc, std::string *argv, int i, int verbose_level)
void read_arguments(int argc, std::string *argv, int &i, int verbose_level)
#define NEW_OBJECT(type)
Definition: foundations.h:638
#define TRUE
Definition: foundations.h:231
#define FALSE
Definition: foundations.h:234
the orbiter library for the classification of combinatorial objects