[bknr-cvs] ksprotte changed trunk/projects/bos/

BKNR Commits bknr at bknr.net
Tue Sep 9 10:50:51 UTC 2008


Revision: 3862
Author: ksprotte
URL: http://bknr.net/trac/changeset/3862

infosystem: added poi GE link via show_poi_google_earth

U   trunk/projects/bos/payment-website/infosystem/javascript.js
U   trunk/projects/bos/web/poi-handlers.lisp
U   trunk/projects/bos/web/webserver.lisp

Modified: trunk/projects/bos/payment-website/infosystem/javascript.js
===================================================================
--- trunk/projects/bos/payment-website/infosystem/javascript.js	2008-09-09 10:05:39 UTC (rev 3861)
+++ trunk/projects/bos/payment-website/infosystem/javascript.js	2008-09-09 10:50:51 UTC (rev 3862)
@@ -914,6 +914,11 @@
                 "microsite", "width=820,height=780,scrollbars=yes");
 }
 
+function show_poi_google_earth() {
+    var the_poi = poi[aktuelles_objekt];
+    document.location = "/poi-kml-look-at/" + the_poi.id;
+}
+
 var poi_menu_items;
 var poi_active_menu_item;
 
@@ -952,8 +957,10 @@
     if (the_poi.movies) {
 	poi_menu_items.push([ msg('Film'), show_poi_movie ]);
     }
-    poi_menu_items.push(["more info", show_poi_microsite]);
+    poi_menu_items.push(["More-Info", show_poi_microsite]);
 
+    poi_menu_items.push(["Google-Earth", show_poi_google_earth]);
+
     poi_active_menu_item = msg('Sat-Karte');
 
     make_poi_menu();

Modified: trunk/projects/bos/web/poi-handlers.lisp
===================================================================
--- trunk/projects/bos/web/poi-handlers.lisp	2008-09-09 10:05:39 UTC (rev 3861)
+++ trunk/projects/bos/web/poi-handlers.lisp	2008-09-09 10:50:51 UTC (rev 3862)
@@ -635,6 +635,31 @@
                     (with-element "href" (text (format nil "http://~a/static/Orang_weiss.png" (website-host)))))))
               (mapc #'(lambda (poi) (write-poi-kml poi lang)) relevant-pois))))))))
 
+;;; poi-kml-look-at-handler
+(defclass poi-kml-look-at-handler (object-handler)
+  ()
+  (:default-initargs :object-class 'poi :query-function #'find-poi))
+
+(defmethod handle-object ((handler poi-kml-look-at-handler) poi)
+  (let ((poi-last-change (store-object-last-change poi 0)))
+    (hunchentoot:handle-if-modified-since poi-last-change)
+    (setf (hunchentoot:header-out :last-modified)
+          (hunchentoot:rfc-1123-date poi-last-change)
+          (hunchentoot:header-out :content-disposition)
+          (format nil "attachment; filename=look-at-~A.kml" (store-object-id poi)))
+    (destructuring-bind (lon lat)
+        (poi-center-lon-lat poi)
+      (with-xml-response (:content-type "application/vnd.google-earth.kml+xml; charset=utf-8")
+        (with-namespace (nil "http://earth.google.com/kml/2.1")
+          (with-element "kml"
+            (with-element "Document"
+              (with-element "LookAt"
+                (with-element "longitude" (text (format nil "~,20F" lon)))
+                (with-element "latitude" (text (format nil "~,20F" lat)))
+                (with-element "range" (text "253"))
+                (with-element "tilt" (text "0"))
+                (with-element "heading" (text "0"))))))))))
+
 ;;; poi-image-handler
 (defclass poi-image-handler (object-handler)
   ()

Modified: trunk/projects/bos/web/webserver.lisp
===================================================================
--- trunk/projects/bos/web/webserver.lisp	2008-09-09 10:05:39 UTC (rev 3861)
+++ trunk/projects/bos/web/webserver.lisp	2008-09-09 10:50:51 UTC (rev 3862)
@@ -177,6 +177,7 @@
                                         ("/poi-image" poi-image-handler)
                                         ("/poi-xml" poi-xml-handler)
                                         ("/poi-kml-all" poi-kml-all-handler)
+                                        ("/poi-kml-look-at" poi-kml-look-at-handler)
                                         ("/poi-kml" poi-kml-handler)
                                         ("/map-browser" map-browser-handler)
                                         ("/poi-javascript" poi-javascript-handler)




More information about the Bknr-cvs mailing list