-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathgn-map.html
110 lines (95 loc) · 2.73 KB
/
gn-map.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<link rel="import" href="../polymer/polymer.html"></link>
<!--
@demo
-->
<dom-module id="gn-map">
<!-- OpenStreetMaps style -->
<link rel="stylesheet" type="text/css" href="http://openlayers.org/en/v3.10.1/css/ol.css">
<!-- Default style -->
<link rel="stylesheet" type="text/css" href="../css/style.css"></link>
<style>
:host {
display: block;
}
div#mapcontainer {
width: 100%;
height: 100%;
}
</style>
<template>
<div id="mapcontainer"></div>
<content></content>
</template>
<script src="js/gn-map.js"></script>
<script src="js/gn-map-googlemaps.js"></script>
<script src="js/gn-map-openstreetmaps.js"></script>
<script>
'use strict';
/*
* Default behavior: Behavior for maps of no specific type
*
* Prints information text for every not-implemented method.
* All methods defined in specific behaviors override these defaults.
*/
MapBehaviors.DefaultBehavior = {
setCenter : function (center) {
console.log("gn-map.html: setCenter(center) is not implemented");
},
setRotation : function (rotation) {
console.log("gn-map.html: setRotation(rotation) is not implemented");
},
refresh : function () {
console.log("gn-map.html: refresh() is not implemented");
},
attached : function () {
console.log("gn-map.html: attached() is not implemented");
}
};
/*
* Map Polymer:
* Maps are canvases on which the geographical maps get displayed via any given source.
* Features like markers, polygons or polylines can be attached to the map.
*/
Polymer({
is: 'gn-map',
/*
* Behaviors: Polymer Methods/Properties which override eachother from left to right.
*
* Usage: The leftmost behavior should be the DefaultBehavior (defined above the Polymer)
* The rightmost behavior should be the specific behavior*
* Example: behaviors : [DefaultBehavior, SpecificBehavior]
*
* *: The DefaultBehavior gets overwritten by the specific Behavior which is defined by the variable "mapBehavior".
* For more information look up the commentary in "js/gn-map.js".
*/
behaviors : [MapBehaviors.DefaultBehavior,
eval("MapBehaviors." + mapBehavior + "Behavior")],
properties : {
// TODO needed?
mapOptions : {
type : Object,
value : function () {
return {
//zoom : Number
zoom : MapDefaults.zoom
};
}
},
// Shared Attributes
map : Object,
center : {
type : Object,
observer : "setCenter"
},
rotation : {
type : Number,
observer : "setRotation"
}
},
// Shared methods
listeners : {
refresh: 'refresh'
}
});
</script>
</dom-module>