added maps_support.ml lib for getting google version at runtime from simple xml config file, changed gm.ml accordingly

This commit is contained in:
Stephen Dwyer
2011-07-28 19:57:12 -06:00
parent d93c545ac1
commit ab88268010
6 changed files with 57 additions and 2 deletions
+6
View File
@@ -0,0 +1,6 @@
<!-- Paparazzi Maps Support Configuration DTD -->
<!ELEMENT maps EMPTY>
<!ATTLIST maps
google_version CDATA #REQUIRED>
+3
View File
@@ -0,0 +1,3 @@
<!DOCTYPE maps SYSTEM "maps.dtd">
<maps google_version="88"/>
+1 -1
View File
@@ -39,7 +39,7 @@ OCAMLYACC=ocamlyacc
OCAMLLIBDIR=$(shell ocamlc -where)
SRC = fig.ml debug.ml base64.ml serial.ml ocaml_tools.ml expr_syntax.ml expr_parser.ml expr_lexer.ml extXml.ml env.ml xml2h.ml latlong.ml egm96.ml srtm.ml http.ml gm.ml iGN.ml geometry_2d.ml cserial.o convert.o ubx.ml pprz.ml xbee.ml logpprz.ml xmlCom.ml os_calls.ml editAirframe.ml defivybus.ml
SRC = fig.ml debug.ml base64.ml serial.ml ocaml_tools.ml expr_syntax.ml expr_parser.ml expr_lexer.ml extXml.ml env.ml xml2h.ml latlong.ml egm96.ml srtm.ml http.ml maps_support.ml gm.ml iGN.ml geometry_2d.ml cserial.o convert.o ubx.ml pprz.ml xbee.ml logpprz.ml xmlCom.ml os_calls.ml editAirframe.ml defivybus.ml
CMO = $(SRC:.ml=.cmo)
CMX = $(SRC:.ml=.cmx)
+1 -1
View File
@@ -196,7 +196,7 @@ let ms_key = fun key ->
done;
(ms_key, ms_key.[n-2])
let google_version = 87
let google_version = Maps_support.google_version
let url_of_tile_key = fun maps_source s ->
let (x, y, z) = xyz_of_qsrt s in
+45
View File
@@ -0,0 +1,45 @@
(*
* $Id$
*
* Support for obtaining google maps api information at runtime
*
* Copyright (C) 2011 Stephen Dwyer
*
* This file is part of paparazzi.
*
* paparazzi is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* paparazzi is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with paparazzi; see the file COPYING. If not, write to
* the Free Software Foundation, 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
*)
let google_ver = ref 0
let home = Env.paparazzi_home
let (//) = Filename.concat
let maps_xml_path = home // "conf" // "maps.xml"
let maps_xml = (
(*try*) ExtXml.parse_file maps_xml_path
(*with
Xml.File_not_found f -> (Printf.sprintf "File does not exist: %s" f)
| ExtXml.Error s -> (Printf.sprintf "Error in XML file: %s" s)*)
)
let google_version = (
if !google_ver == 0 then (
google_ver := ExtXml.int_attrib maps_xml "google_version" );
!google_ver
)
+1
View File
@@ -0,0 +1 @@
val google_version : int