-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
17955f2
commit 126fd27
Showing
294 changed files
with
3,824 additions
and
1,073 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
function startDemo() { | ||
var browser = Melown.MapBrowser("map-div", { | ||
map : "https://demo.test.mlwn.se/public-maps/grand-ev/mapConfig.json" | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<html> | ||
<head> | ||
<title>Vadstena Map Viewer</title> | ||
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"> | ||
<link rel="stylesheet" type="text/css" href="../../build/melown-v1.css" /> | ||
<script type="text/javascript" src="../../build/melown-v1.js"></script> | ||
<script type="text/javascript" src="./demo.js"></script> | ||
</head> | ||
|
||
<body style = "padding: 0; margin: 0;" onload="startDemo()"> | ||
<div id="map-div" style="width:100%; height:100%;"> | ||
</div> | ||
</body> | ||
</html> |
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
|
||
var browser = null; | ||
var ui = null; | ||
var list = null; | ||
|
||
function startDemo() { | ||
browser = Melown.MapBrowser("map-div", { | ||
map : "https://demo.test.mlwn.se/public-maps/grand-ev/mapConfig.json", | ||
position : [ "obj", 1683559, 6604129, "float", 0, -13, -58, 0, 3764, 90 ] | ||
}); | ||
|
||
ui = browser.getUI(); | ||
var panel = ui.addControl("destination-panel", | ||
'<form id="panel">' + | ||
'<input type="radio" name="destination" value="a"> Destination A<br>' + | ||
'<input type="radio" name="destination" value="b"> Destination B<br>' + | ||
'<input type="radio" name="destination" value="c"> Destination C' + | ||
'</form>'); | ||
|
||
list = panel.getElement("panel"); | ||
list.on("change", onFlyToNewDestination); | ||
} | ||
|
||
function onFlyToNewDestination() { | ||
switch (list.getElement().elements["destination"].value) { | ||
case "a": | ||
browser.flyTo([ "obj", 1683559, 6604129, "float", 0, -13, -58, 0, 1764, 90 ]); | ||
break; | ||
|
||
case "b": | ||
browser.flyTo([ "obj", 1679084, 6607401, "float", 0, -17, -57, 0, 1158, 90 ]); | ||
break; | ||
|
||
case "c": | ||
browser.flyTo([ "obj", 1694920, 6608430, "float", 0, -24, -76, 0, 2049, 90 ]); | ||
break; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<html> | ||
<head> | ||
<title>Vadstena Map Viewer</title> | ||
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"> | ||
<link rel="stylesheet" type="text/css" href="../../build/melown-v1.css" /> | ||
<script type="text/javascript" src="../../build/melown-v1.js"></script> | ||
<script type="text/javascript" src="./demo.js"></script> | ||
|
||
|
||
<style> | ||
#panel { | ||
font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; | ||
position: absolute; | ||
right: 30px; | ||
bottom: 30px; | ||
background-color: #eee; | ||
padding: 10px 20px; | ||
border-radius: 5px; | ||
border: solid 1px #000; | ||
} | ||
</style> | ||
|
||
</head> | ||
|
||
<body style = "padding: 0; margin: 0;" onload="startDemo()"> | ||
<div id="map-div" style="width:100%; height:100%;"> | ||
</div> | ||
</body> | ||
</html> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
|
||
var browser = null; | ||
var pointTexture = null; | ||
var clickCoords = null; | ||
|
||
function startDemo() { | ||
browser = Melown.MapBrowser("map-div", { | ||
map : "https://demo.test.mlwn.se/public-maps/grand-ev/mapConfig.json", | ||
position : [ "obj", 1683559, 6604129, "float", 0, -13, -58, 0, 964, 90 ] | ||
}); | ||
|
||
//callback once is map config loaded | ||
browser.on("map-loaded", onMapLoaded); | ||
|
||
//add mouse down callback | ||
browser.getMapElement().on('mousedown', onMouseDown); | ||
|
||
loadTexture(); | ||
} | ||
|
||
function loadTexture() { | ||
//load icon used for displaing hit point | ||
var pointImage = Melown.Http.imageFactory( | ||
"http://maps.google.com/mapfiles/kml/shapes/placemark_circle.png", | ||
(function(){ | ||
pointTexture = browser.getRenderer().createTexture({ "source": pointImage }); | ||
}).bind(this) | ||
); | ||
} | ||
|
||
|
||
function onMapLoaded() { | ||
//add render slots | ||
//render slots are called during map render | ||
browser.addRenderSlot("custom-points", onDrawPoints, true); | ||
browser.moveRenderSlotAfter("after-map-render", "custom-points"); | ||
} | ||
|
||
function onMouseDown(event) { | ||
if (event.getMouseButton() == "left") { | ||
var coords = event.getMouseCoords(); | ||
|
||
//get hit coords with fixed height | ||
clickCoords = browser.getHitCoords(coords[0], coords[1], "fixed"); | ||
|
||
//force map redraw to display hit point | ||
browser.redraw(); | ||
} | ||
} | ||
|
||
function onDrawPoints(renderChannel) { | ||
if (renderChannel == "hit") { | ||
return; //do render points in to the hit texture | ||
} | ||
|
||
if (clickCoords) { //draw hit point | ||
var renderer = browser.getRenderer(); | ||
|
||
//conver hit coords to canvas coords | ||
coords = browser.convertCoordsFromNavToCanvas(clickCoords, "fixed"); | ||
|
||
renderer.drawImage({ | ||
"rect" : [coords[0]-12, coords[1]-12, 24, 24], | ||
"texture" : pointTexture, | ||
"color" : [255,0,0,255], | ||
"depth" : coords[2], | ||
"depth-test" : false, | ||
"blend" : true | ||
}); | ||
} | ||
}; | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<html> | ||
<head> | ||
<title>Vadstena Map Viewer</title> | ||
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"> | ||
<link rel="stylesheet" type="text/css" href="../../build/melown-v1.css" /> | ||
<script type="text/javascript" src="../../build/melown-v1.js"></script> | ||
<script type="text/javascript" src="./demo.js"></script> | ||
</head> | ||
|
||
<body style = "padding: 0; margin: 0;" onload="startDemo()"> | ||
<div id="map-div" style="width:100%; height:100%;"> | ||
</div> | ||
</body> | ||
</html> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
|
||
var browser = null; | ||
|
||
function startDemo() { | ||
browser = Melown.MapBrowser("map-div", { | ||
map : "https://demo.test.mlwn.se/public-maps/grand-ev/mapConfig.json", | ||
position : [ "obj", 1683559, 6604129, "float", 0, -13, -58, 0, 1764, 90 ] | ||
}); | ||
|
||
browser.on("map-loaded", onMapLoaded); | ||
loadImage(); | ||
} | ||
|
||
var demoTexture = null; | ||
|
||
function loadImage() { | ||
var demoImage = Melown.Http.imageFactory( | ||
"http://maps.google.com/mapfiles/kml/shapes/placemark_circle.png", | ||
(function(){ | ||
demoTexture = browser.getRenderer().createTexture({ "source": demoImage }); | ||
})); | ||
} | ||
|
||
function onMapLoaded() { | ||
browser.addRenderSlot("custom-render", onCustomRender, true); | ||
browser.moveRenderSlotAfter("after-map-render", "map"); | ||
}; | ||
|
||
function onCustomRender() { | ||
if (demoTexture) { | ||
var renderer = browser.getRenderer(); | ||
var coords = browser.convertCoordsFromNavToCanvas([1683559, 6604129, 0], "float"); | ||
|
||
var totalPoints = 32; | ||
var points = new Array(totalPoints); | ||
var p = [1683559, 6604129, 0]; | ||
var scale = [400, 100]; | ||
|
||
for (var i = 0; i < totalPoints; i++) { | ||
points[i] = browser.convertCoordsFromNavToCanvas( | ||
[p[0] + (i / totalPoints) * scale[0], | ||
p[1] + Math.sin(2 * Math.PI * (i / totalPoints)) * scale[1], | ||
p[2]], "float"); | ||
} | ||
|
||
renderer.drawLineString({ | ||
"points" : points, | ||
"size" : 2.0, | ||
"color" : [255,0,255,255], | ||
"depth-test" : false, | ||
"blend" : false | ||
}); | ||
|
||
|
||
renderer.drawImage({ | ||
"rect" : [coords[0]-12, coords[1]-12, 24, 24], | ||
"texture" : demoTexture, | ||
"color" : [255,0,255,255], | ||
"depth" : coords[2], | ||
"depth-test" : false, | ||
"blend" : true | ||
}); | ||
|
||
} | ||
} | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<html> | ||
<head> | ||
<title>Vadstena Map Viewer</title> | ||
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"> | ||
<link rel="stylesheet" type="text/css" href="../../build/melown-v1.css" /> | ||
<script type="text/javascript" src="../../build/melown-v1.js"></script> | ||
<script type="text/javascript" src="./demo.js"></script> | ||
</head> | ||
|
||
<body style = "padding: 0; margin: 0;" onload="startDemo()"> | ||
<div id="map-div" style="width:100%; height:100%;"> | ||
</div> | ||
</body> | ||
</html> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.