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
use super::*;
pub struct Contour {
pub colors: Vec<String>,
pub levels: Vec<f64>,
pub colormap_index: i32,
pub number_format: String,
pub no_lines: bool,
pub no_labels: bool,
pub no_inline: bool,
pub no_colorbar: bool,
pub colorbar_label: String,
pub selected_value: f64,
pub selected_color: String,
pub selected_linewidth: f64,
pub(crate) buffer: String,
}
impl Contour {
pub fn new() -> Self {
Contour {
colors: Vec::new(),
levels: Vec::new(),
colormap_index: 0,
number_format: String::new(),
no_lines: false,
no_labels: false,
no_inline: false,
no_colorbar: false,
colorbar_label: String::new(),
selected_value: 0.0,
selected_color: String::new(),
selected_linewidth: 0.0,
buffer: String::new(),
}
}
pub(crate) fn options(&self) -> String {
let mut options = String::new();
if self.colors.len() > 0 {
options.push_str(&format!(",colors={}", array2list(&self.colors)));
}
if self.levels.len() > 0 {
options.push_str(&format!(",levels={}", array2list(&self.levels)));
}
options
}
}
impl GraphMaker for Contour {
fn get_buffer<'a>(&'a self) -> &'a String {
&self.buffer
}
}