2019-07-03 20:17:04 -07:00
|
|
|
//! Map view.
|
|
|
|
|
|
|
|
use super::qobj::*;
|
2019-07-10 04:15:52 -07:00
|
|
|
use crate::cc;
|
2019-07-03 20:17:04 -07:00
|
|
|
|
|
|
|
impl IMapViewTrait for IMapView
|
|
|
|
{
|
2019-07-05 20:21:11 -07:00
|
|
|
/// Returns a new `IMapView` instance.
|
|
|
|
fn new(emit: IMapViewEmitter) -> Self
|
|
|
|
{
|
|
|
|
if cfg!(debug_assertions) {
|
|
|
|
eprintln!("new IMapView");
|
|
|
|
}
|
2019-07-03 20:17:04 -07:00
|
|
|
|
2019-07-05 20:21:11 -07:00
|
|
|
Self{emit}
|
|
|
|
}
|
2019-07-03 20:17:04 -07:00
|
|
|
|
2019-07-05 20:21:11 -07:00
|
|
|
/// Returns the emitter of `self`.
|
|
|
|
fn emit(&mut self) -> &mut IMapViewEmitter {&mut self.emit}
|
2019-07-10 04:15:52 -07:00
|
|
|
|
|
|
|
fn draw_view(&self, paint: *mut cc::QPainter)
|
|
|
|
{
|
2019-07-12 09:02:53 -07:00
|
|
|
cc::paint_fg(paint, 0, 255, 0, 255);
|
|
|
|
cc::paint_arc(paint, 30, 30, 100, 100, 77, 440);
|
|
|
|
cc::paint_chord(paint, 50, 50, 100, 100, 77, 440);
|
|
|
|
cc::paint_ellipse(paint, 80, 80, 30, 30);
|
|
|
|
cc::paint_image(paint, 200, 10, ":/tycho/images/tycho1.png");
|
|
|
|
cc::paint_line(paint, 100, 60, 140, 100);
|
2019-07-10 04:15:52 -07:00
|
|
|
cc::paint_point(paint, 20, 20);
|
2019-07-12 09:02:53 -07:00
|
|
|
cc::paint_polygon(paint, &[cc::Int2{x: 250, y: 170},
|
|
|
|
cc::Int2{x: 270, y: 190},
|
|
|
|
cc::Int2{x: 230, y: 190}]);
|
|
|
|
cc::paint_rect(paint, 150, 170, 20, 20);
|
|
|
|
cc::paint_squircle(paint, 90, 170, 30, 30, 7, 9);
|
|
|
|
cc::paint_text(paint, 50, 50, "hello, world");
|
2019-07-10 04:15:52 -07:00
|
|
|
}
|
2019-07-03 20:17:04 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
impl Drop for IMapView
|
|
|
|
{
|
2019-07-05 20:21:11 -07:00
|
|
|
fn drop(&mut self)
|
|
|
|
{
|
|
|
|
if cfg!(debug_assertions) {
|
|
|
|
eprintln!("drop IMapView");
|
|
|
|
}
|
|
|
|
}
|
2019-07-03 20:17:04 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
pub struct IMapView {
|
2019-07-05 20:21:11 -07:00
|
|
|
emit: IMapViewEmitter,
|
2019-07-03 20:17:04 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
// EOF
|