olwrapper 0.3.7.10 → 0.3.7.12
raw patch · 12 files changed
+128/−16 lines, 12 files
Files
- README.md +2/−0
- olwrapper.cabal +8/−1
- snaplets/fay/devel.cfg +24/−0
- snaplets/fay/src/Index.hs +2/−5
- snaplets/heist/templates/index.tpl +74/−0
- static/dummy +0/−0
- web/OlApp.hs +3/−1
- web/Tutorial/OlApp.hs +3/−1
- wrapper/OpenLayers.hs +5/−2
- wrapper/OpenLayers/Func.hs +3/−4
- wrapper/OpenLayers/Html.hs +3/−1
- wrapper/OpenLayers/Types.hs +1/−1
+ README.md view
@@ -0,0 +1,2 @@+please read my diploma thesis 2015 (TU Vienna)+Haskell OpenLayers Wrapper
olwrapper.cabal view
@@ -1,5 +1,5 @@ Name: olwrapper-Version: 0.3.7.10+Version: 0.3.7.12 Synopsis: An OpenLayers JavaScript Wrapper and Webframework with snaplet-fay Description: test Author: Thomas Edelmann@@ -10,6 +10,13 @@ Cabal-version: >=1.12 license: GPL license-file: LICENSE++extra-source-files:+ LICENSE+ README.md+ snaplets/fay/devel.cfg+ snaplets/heist/templates/index.tpl+ static/dummy Flag development Description: Whether to build the server in development (interpreted) mode
+ snaplets/fay/devel.cfg view
@@ -0,0 +1,24 @@+# "Development": Compile files on every request.+# "Production": Compile all files in snaplets/src/fay when the application is started and then serve them statically.+#+# Both methods will write files to disk for debugging purposes.+# Default is "Development".+compileMode = "Development"+# Print more or less information about what the snaplet is doing.+# Default is on.+verbose = on+# Run js-beautify on the results if it is available in the PATH.+# If it isn't available the compiled file will be used as is.+# Default is on.+prettyPrint = on+# A comma-separated list of directories to look for fay imports in.+# This is useful if you want to share modules between Fay and Snap.+# Paths are relative to the root of the snap application.+# snaplets/fay/src will always be checked for imports.+# Default is "" meaning no additional directories will be checked.+includeDirs = "wrapper,web"+# A comma separated list of Fay package names.+# This gives the same result as using includeDirs,+# except Fay figures out the paths for you.+# Default is "" meaning no other Fay packages will be used.+packages = "fay-text,fay-jquery"
snaplets/fay/src/Index.hs view
@@ -8,18 +8,15 @@ import Prelude hiding (void) import JQuery hiding (Element) import Fay.Text (Text, fromString)-import FFI+import Fay.FFI import OpenLayers -- include OpenLayers, to wrap the OlApp-+import OpenLayers.Internal addOnload :: Fay f -> Fay () addOnload = ffi "window.addEventListener(\"load\", %1)" main :: Fay () main = addOnload onload--void :: Fay f -> Fay ()-void f = f >> return () onload :: Fay () onload = void $ do
+ snaplets/heist/templates/index.tpl view
@@ -0,0 +1,74 @@+<!DOCTYPE html>++<!-- minimum code+<html>+ <head>+ <script src="http://openlayers.org/en/v3.1.1/build/ol.js"/>+ <script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"/>+ <script src="/fay/Index.js"/>+ </head>+ <body>Hello Map+ <div id="map" style="width: 200px; height: 200px;"/>+ </body>+</html>+-->+++<!-- tutorial -->+<html>+ <head>+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>+ <title>Haskell OpenLayers Wrapper - diploma thesis TU Vienna 2014/2015 - Geoinformation</title>+ <script src="http://openlayers.org/en/v3.1.1/build/ol.js"/>+ <script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"/>+ <script src="/fay/Index.js"/>+ <style type="text/css">+ * {+ font-family: Arial, Verdana, Helvetica, sans-serif;+ }+ #map {+ width: 500px;+ height: 300px;+ }+ </style>+ </head>+ <body>+ <center>+ <p><b>Haskell OpenLayers Wrapper</b></p>+ + <div id="mapdesc"></div>+ + <table style="padding: 12px;">+ <tr>+ <td id="table1" style="color: red; padding-right: 12px"/>+ <td id="table2" style="color: purple; padding-right: 12px"/>+ <td id="table3" style="color: orange; padding-right: 12px"/>+ <td id="table4" style="color: green"/>+ </tr>+ </table>+ + <div id="map"></div>+ + <table style="padding: 12px;">+ <tr>+ <td>Zoomlevel:</td>+ <td>+ <div id="zoomlabel" align="center" style="padding: 4px"></div>+ </td>+ </tr>+ <tr>+ <td>Kartenzentrum (WGS 84):</td>+ <td>+ <div id="wgslabel" align="center" style="padding: 4px"></div>+ </td>+ </tr>+ <tr>+ <td>Kartenzentrum (Mercator):</td>+ <td>+ <div id="mercatorlabel" align="center" style="padding: 4px"></div>+ </td>+ </tr>+ </table>+ </center>+ </body>+</html>
+ static/dummy view
web/OlApp.hs view
@@ -4,10 +4,12 @@ -} module OlApp where -import Prelude hiding (void)+import Prelude hiding (void) import OpenLayers.Func import OpenLayers.Types+import OpenLayers.Internal import Tutorial.OlApp (designTutorialMap)+import Fay.FFI -- | ID for the combination of the HTML-Element map and the OpenLayers object targetId = "map"
web/Tutorial/OlApp.hs view
@@ -1,10 +1,12 @@ module Tutorial.OlApp where -import Prelude hiding (void)+import Prelude hiding (void) import OpenLayers.Func import OpenLayers.Types import OpenLayers.Html+import OpenLayers.Internal import Tutorial.Traffic+import Fay.FFI zoomlevel = 11 defaultopacity = Opacity 80
wrapper/OpenLayers.hs view
@@ -3,11 +3,14 @@ Description : combine OpenLayers with Fay -} module OpenLayers where+ import Prelude hiding (void)-import OpenLayers.Func (void, setDefaultView, setTarget)-import FFI+import OpenLayers.Func (setDefaultView, setTarget)+import OpenLayers.Internal import Fay.Text import OlApp (targetId, designMap)+import Fay.FFI+ -- | Adds an default naked OpenLayers Map Object addDefaultMap :: Fay () addDefaultMap = ffi "olmap = new ol.Map({renderer: 'canvas'})"
wrapper/OpenLayers/Func.hs view
@@ -13,12 +13,14 @@ -- Fay JQuery always uses Text, i do not want this so there is always an equivalent function with ' at the end -- that takes a String as parameter (defined in the OpenLayersHtmlFunc module) + import Prelude hiding (void) import JQuery import Fay.Text hiding (head, tail, map) import OpenLayers.Types import OpenLayers.Html-import FFI+import Fay.FFI+import OpenLayers.Internal -- * NEW FUNCTION @@ -226,9 +228,6 @@ -- * OTHER FUNCTION coordFixed :: (Double, Double) -> Integer -> Fay Text coordFixed = ffi "%1[0].toFixed(%2) + ',' + %1[1].toFixed(%2)"--void :: Fay f -> Fay ()-void f = f >> return () lois :: Fay f -> f lois = ffi "%1"
wrapper/OpenLayers/Html.hs view
@@ -5,9 +5,11 @@ module OpenLayers.Html where import JQuery-import FFI import Fay.Text import OpenLayers.HtmlInternal+import OpenLayers.Internal+import Fay.FFI+import Prelude hiding (void) addTextToHtml :: String -> String -> String -> Fay () addTextToHtml content element id = void $ do
wrapper/OpenLayers/Types.hs view
@@ -70,7 +70,7 @@ | Hyb -- ^ MapQuest's hybrid | Osm -- ^ MapQuest's OpenStreetMap | OSM -- ^ OpenStreetMap- deriving (Eq)+ deriving (Show, Eq) -- * List -- | puts the sources from MapQuest in a list