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
/// Trait for generating data patterns in GeoTIFFs.
///
/// Implement this trait to create custom data generation patterns for GeoTIFFs.
///
/// # Examples
///
/// Creating a custom checkerboard pattern:
///
/// ```
/// use rasterfakers::DataGenerator;
///
/// struct CheckerboardPattern;
///
/// impl DataGenerator for CheckerboardPattern {
/// fn generate(&self, x: usize, y: usize, band: usize) -> f64 {
/// if (x + y + band) % 2 == 0 {
/// 255.0
/// } else {
/// 0.0
/// }
/// }
/// }
/// ```
/// A simple gradient pattern generator.
///
/// This pattern creates a gradient based on the sum of x, y, and band indices.
/// It produces a diagonal gradient effect across the image, with values
/// increasing from the top-left to the bottom-right corner.
///
/// # Examples
///
/// ```
/// use rasterfakers::{FakeGeoTiffBuilder, GradientPattern};
///
/// let geotiff = FakeGeoTiffBuilder::new()
/// .dimensions(256, 256).unwrap()
/// .bands(1).unwrap()
/// .data_generator(Box::new(GradientPattern))
/// .output_path("gradient.tiff")
/// .build::<u8>().unwrap();
///
/// geotiff.write().unwrap();
/// ```
;
/// A sine wave pattern generator.
///
/// This pattern creates a complex sine wave pattern using the x and y coordinates
/// and the band index. It produces an interesting interference pattern that
/// varies across bands.
///
/// # Examples
///
/// ```
/// use rasterfakers::{FakeGeoTiffBuilder, SineWavePattern};
///
/// let geotiff = FakeGeoTiffBuilder::new()
/// .dimensions(512, 512).unwrap()
/// .bands(3).unwrap()
/// .data_generator(Box::new(SineWavePattern))
/// .output_path("sine_wave.tiff")
/// .build::<f32>().unwrap();
///
/// geotiff.write().unwrap();
/// ```
;
/// A noise pattern generator.
///
/// This pattern creates a pseudo-random noise pattern using a simple hash function.
/// It produces a different noise pattern for each band, giving a multi-band
/// noise effect.
///
/// # Examples
///
/// ```
/// use rasterfakers::{FakeGeoTiffBuilder, NoisePattern};
///
/// let geotiff = FakeGeoTiffBuilder::new()
/// .dimensions(1024, 1024).unwrap()
/// .bands(1).unwrap()
/// .data_generator(Box::new(NoisePattern))
/// .output_path("noise.tiff")
/// .build::<u16>().unwrap();
///
/// geotiff.write().unwrap();
/// ```
;