(&self, _ui: &Ui, transform: &PlotTransform, shapes: &mut Vec<Shape>)
| 134 | |
| 135 | impl PlotItem for Points<'_> { |
| 136 | fn shapes(&self, _ui: &Ui, transform: &PlotTransform, shapes: &mut Vec<Shape>) { |
| 137 | let sqrt_3 = 3_f32.sqrt(); |
| 138 | let frac_sqrt_3_2 = 3_f32.sqrt() / 2.0; |
| 139 | let frac_1_sqrt_2 = 1.0 / 2_f32.sqrt(); |
| 140 | |
| 141 | let Self { |
| 142 | base, |
| 143 | series, |
| 144 | shape, |
| 145 | color, |
| 146 | filled, |
| 147 | radius, |
| 148 | stems, |
| 149 | .. |
| 150 | } = self; |
| 151 | |
| 152 | let mut radius = *radius; |
| 153 | |
| 154 | let stroke_size = radius / 5.0; |
| 155 | |
| 156 | let default_stroke = Stroke::new(stroke_size, *color); |
| 157 | let mut stem_stroke = default_stroke; |
| 158 | let (fill, stroke) = if *filled { |
| 159 | (*color, Stroke::NONE) |
| 160 | } else { |
| 161 | (Color32::TRANSPARENT, default_stroke) |
| 162 | }; |
| 163 | |
| 164 | if base.highlight { |
| 165 | radius *= 2f32.sqrt(); |
| 166 | stem_stroke.width *= 2.0; |
| 167 | } |
| 168 | |
| 169 | let y_reference = stems.map(|y| transform.position_from_point(&PlotPoint::new(0.0, y)).y); |
| 170 | |
| 171 | series |
| 172 | .points() |
| 173 | .iter() |
| 174 | .map(|value| transform.position_from_point(value)) |
| 175 | .for_each(|center| { |
| 176 | let tf = |dx: f32, dy: f32| -> Pos2 { center + radius * vec2(dx, dy) }; |
| 177 | |
| 178 | if let Some(y) = y_reference { |
| 179 | let stem = Shape::line_segment([center, pos2(center.x, y)], stem_stroke); |
| 180 | shapes.push(stem); |
| 181 | } |
| 182 | |
| 183 | match shape { |
| 184 | MarkerShape::Circle => { |
| 185 | shapes.push(Shape::Circle(CircleShape { |
| 186 | center, |
| 187 | radius, |
| 188 | fill, |
| 189 | stroke, |
| 190 | })); |
| 191 | } |
| 192 | MarkerShape::Diamond => { |
| 193 | let points = vec![ |
nothing calls this directly
no test coverage detected