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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
#![deny(missing_docs, missing_debug_implementations, missing_copy_implementations, trivial_casts,
trivial_numeric_casts, unsafe_code, unstable_features, unused_import_braces,
unused_qualifications)]
#![recursion_limit="128"]
#[cfg(test)]
#[macro_use]
extern crate approx;
extern crate nalgebra;
#[macro_use]
extern crate quick_error;
#[macro_use]
extern crate serde_derive;
extern crate xmltree;
mod camera_calibration;
pub mod element;
mod mount_calibration;
mod point;
mod project;
pub mod scan_position;
mod utils;
pub use camera_calibration::CameraCalibration;
pub use mount_calibration::MountCalibration;
pub use point::{Cmcs, Glcs, Point, Prcs, Socs};
pub use project::Project;
pub use scan_position::ScanPosition;
quick_error! {
#[derive(Debug)]
pub enum Error {
CameraCalibrationVersion(version: String) {
description("invalid camera calibration version")
display("This camera calibration version is not supported: {}", version)
}
ImageFromPath(path: std::path::PathBuf) {
description("could not create image from project and path")
display("Could not create image from path: {}", path.display())
}
Io(err: std::io::Error) {
description(err.description())
display("IO error: {}", err)
from()
cause(err)
}
MissingCameraCalibration(name: String) {
description("the camera calibration does not exist")
display("The camera calibration does not exist: {}", name)
}
MissingChild(parent: String, child: String) {
description("the child element does not exist")
display("The element {} is not a child of {}", parent, child)
}
MissingMountCalibration(name: String) {
description("the mount calibration does not exist")
display("The mount calibration does not exist: {}", name)
}
MissingNoderef(element: xmltree::Element) {
description("the element does not have a noderef attribute")
display("The element named {} does not have a noderef attribute", element.name)
}
NoElementText(element: xmltree::Element) {
description("the element does not have text")
display("The element named {} does not have text", element.name)
}
ParseFloat(err: std::num::ParseFloatError) {
description(err.description())
display("Parse float error: {}", err)
from()
cause(err)
}
ParseInt(err: std::num::ParseIntError) {
description(err.description())
display("Parse int error: {}", err)
from()
cause(err)
}
ParseProjective3(text: String) {
description("cannot parse text as Projective3")
display("Cannot parse text as Projective3: {}", text)
}
ProjectPath(path: std::path::PathBuf) {
description("invalid project path")
display("Invalid project path: {}", path.display())
}
ScanPositionFromPath(path: std::path::PathBuf) {
description("cound not find scan position in project from path")
display("Path {} does not refer to a scan position", path.display())
}
XmltreeParse(err: xmltree::ParseError) {
description(err.description())
display("Xmltree parse error: {}", err)
from()
cause(err)
}
}
}
pub type Result<T> = std::result::Result<T, Error>;