mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-06-05 15:30:08 +08:00
features added for THibaut
This commit is contained in:
@@ -206,10 +206,10 @@ class widget = fun ?(height=800) ?width ?wgs84_of_en () ->
|
|||||||
| _ -> false
|
| _ -> false
|
||||||
|
|
||||||
|
|
||||||
method segment = fun ?(width=1) ?fill_color en1 en2 ->
|
method segment = fun ?(group = canvas#root) ?(width=1) ?fill_color en1 en2 ->
|
||||||
let (x1, y1) = self#world_of_en en1
|
let (x1, y1) = self#world_of_en en1
|
||||||
and (x2, y2) = self#world_of_en en2 in
|
and (x2, y2) = self#world_of_en en2 in
|
||||||
let l = GnoCanvas.line ?fill_color ~props:[`WIDTH_PIXELS width] ~points:[|x1;y1;x2;y2|] canvas#root in
|
let l = GnoCanvas.line ?fill_color ~props:[`WIDTH_PIXELS width] ~points:[|x1;y1;x2;y2|] group in
|
||||||
l#show ();
|
l#show ();
|
||||||
l
|
l
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -38,7 +38,8 @@ class track = fun ?(name="coucou") ?(size = 50) ?(color="red") (geomap:MapCanvas
|
|||||||
let group = GnoCanvas.group geomap#canvas#root in
|
let group = GnoCanvas.group geomap#canvas#root in
|
||||||
let empty = ({ G.east = 0.; north = 0. }, GnoCanvas.line group) in
|
let empty = ({ G.east = 0.; north = 0. }, GnoCanvas.line group) in
|
||||||
|
|
||||||
let aircraft = GnoCanvas.group group in
|
let aircraft = GnoCanvas.group group
|
||||||
|
and track = GnoCanvas.group group in
|
||||||
let _ac_icon =
|
let _ac_icon =
|
||||||
ignore (GnoCanvas.line ~fill_color:color ~props:[`WIDTH_PIXELS 4;`CAP_STYLE `ROUND] ~points:[|0.;-6.;0.;14.|] aircraft);
|
ignore (GnoCanvas.line ~fill_color:color ~props:[`WIDTH_PIXELS 4;`CAP_STYLE `ROUND] ~points:[|0.;-6.;0.;14.|] aircraft);
|
||||||
ignore (GnoCanvas.line ~fill_color:color ~props:[`WIDTH_PIXELS 4;`CAP_STYLE `ROUND] ~points:[|-9.;0.;9.;0.|] aircraft);
|
ignore (GnoCanvas.line ~fill_color:color ~props:[`WIDTH_PIXELS 4;`CAP_STYLE `ROUND] ~points:[|-9.;0.;9.;0.|] aircraft);
|
||||||
@@ -50,6 +51,8 @@ class track = fun ?(name="coucou") ?(size = 50) ?(color="red") (geomap:MapCanvas
|
|||||||
val mutable segments = Array.create size empty
|
val mutable segments = Array.create size empty
|
||||||
val mutable top = 0
|
val mutable top = 0
|
||||||
val mutable last = None
|
val mutable last = None
|
||||||
|
method track = track
|
||||||
|
method aircraft = aircraft
|
||||||
method clear_one = fun i ->
|
method clear_one = fun i ->
|
||||||
if segments.(i) != empty then begin
|
if segments.(i) != empty then begin
|
||||||
(snd segments.(i))#destroy ();
|
(snd segments.(i))#destroy ();
|
||||||
@@ -68,9 +71,9 @@ class track = fun ?(name="coucou") ?(size = 50) ?(color="red") (geomap:MapCanvas
|
|||||||
begin
|
begin
|
||||||
match last with
|
match last with
|
||||||
None ->
|
None ->
|
||||||
segments.(top) <- (en, geomap#segment ~fill_color:color en en)
|
segments.(top) <- (en, geomap#segment ~group:track ~fill_color:color en en)
|
||||||
| Some last ->
|
| Some last ->
|
||||||
segments.(top) <- (en, geomap#segment ~width:2 ~fill_color:color last en)
|
segments.(top) <- (en, geomap#segment ~group:track ~width:2 ~fill_color:color last en)
|
||||||
end;
|
end;
|
||||||
self#incr;
|
self#incr;
|
||||||
last <- Some en
|
last <- Some en
|
||||||
|
|||||||
Reference in New Issue
Block a user