Skip to content

Commit 0bf3d02

Browse files
authored
Merge branch 'master' into builds
2 parents 2058ae7 + 6853970 commit 0bf3d02

File tree

6 files changed

+118
-23
lines changed

6 files changed

+118
-23
lines changed

.gitignore

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
/nbproject/private/
2-
/nbproject/customs.json
3-
/nbproject/project.properties
4-
/nbproject/project.xml
5-
/nbproject/
6-
/src/bower_components/
7-
/src/demo/bower_components/
8-
/dist/
1+
/nbproject/private/
2+
/nbproject/customs.json
3+
/nbproject/project.properties
4+
/nbproject/project.xml
5+
/nbproject/
6+
/src/bower_components/
7+
/src/demo/bower_components/
8+
/dist/
9+
/bower_components/

README.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11

2-
# web-map Customized Built-In <map> Element
3-
4-
[![Build Status](https://travis-ci.org/prushforth/Web-Map-Custom-Element.svg?branch=master)](https://travis-ci.org/prushforth/Web-Map-Custom-Element)
5-
6-
The web-map Customized Built-In <map> Element is a [prototype implementation](http://maps4html.github.io/Web-Map-Custom-Element/) of the [HTML-Map-Element specification](http://maps4html.github.io/HTML-Map-Element/spec/).
2+
# Customized Built-In <map> Element
73

84
[![Build Status](https://travis-ci.org/prushforth/Web-Map-Custom-Element.svg?branch=master)](https://travis-ci.org/prushforth/Web-Map-Custom-Element)
95

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
{"name": "Maps for HTML Community Group", "email": "[email protected]", "homepage": "https://www.w3.org/community/maps4html/"}
88
],
99
"homepage": "http://maps4html.github.io/Web-Map-Custom-Element/",
10-
"license": "W3C SOFTWARE AND DOCUMENT NOTICE AND LICENSE",
10+
"license": "W3C",
1111
"keywords": [
1212
"framework",
1313
"web-components",

demo/index.html

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,23 +34,24 @@
3434
<body>
3535
<div>
3636
<!-- the @width / @height attributes take precedence over properties, but currently don't change to reflect updates -->
37-
<img usemap="#dowslake" src="map1.png" width="700" height="400" alt="Dow's Lake area" />
37+
<!-- <img usemap="#dowslake" src="map1.png" width="700" height="400" alt="Dow's Lake area" />-->
3838
<map name="dowslake" is="web-map" zoom="17" lat="45.398043" lon="-75.70683" width="700" height="400" controls hidden>
39-
<layer- id="osm" src="http://geogratis.gc.ca/mapml/en/osmtile/osm/" label="Open Street Map" checked hidden></layer->
40-
<layer- id="cbmt" label="Canada Base Map" src="http://geogratis.gc.ca/mapml/en/osmtile/cbmt/" checked></layer->
41-
<layer- id="canvec" label="CanVec+ 031G" src="http://geogratis.gc.ca/mapml/canvec/50k/features/" class="transparency"></layer->
42-
<!-- the HTML author can create MapML files and serve them as layers if they prefer -->
39+
<layer- id="osm" src="http://geogratis.gc.ca/mapml/en/osmtile/osm/" label="Open Street Map" checked ></layer->
40+
<device-location centered></device-location>
41+
<!-- <layer- id="cbmt" label="Canada Base Map" src="http://geogratis.gc.ca/mapml/en/osmtile/cbmt/" checked></layer->-->
42+
<!-- <layer- id="canvec" label="CanVec+ 031G" src="http://geogratis.gc.ca/mapml/canvec/50k/features/" class="transparency"></layer->
43+
the HTML author can create MapML files and serve them as layers if they prefer
4344
<layer- id="marker" label="Marker layer" src="marker.mapml"></layer->
4445
45-
<!-- or the HTML author can create map 'area's (links) within the HTML document -->
46-
<!-- <area is="map-area"id="wholemap" href='http://example.com/default/' alt="Default" shape="default" style="fill: salmon; stroke: none; fill-opacity: 0.01"></map-area>-->
46+
or the HTML author can create map 'area's (links) within the HTML document
47+
<area is="map-area"id="wholemap" href='http://example.com/default/' alt="Default" shape="default" style="fill: salmon; stroke: none; fill-opacity: 0.01"></map-area>
4748
<area is="map-area" id="marker2" href='http://example.com/marker/' alt="Marker" coords="265,185,265,185" shape="marker">
4849
<area is="map-area" id="line" href='http://example.com/line/' alt="Line" coords="275,275,540,107" shape="line">
4950
5051
<area is="map-area" id="doughnut" alt="Circle" href='http://example.com/circle/' coords="250,250,25" shape="circle" style="fill: white; stroke: aqua; stroke-width: 5px;fill-opacity: 0.0">
5152
<area is="map-area" id="hole" coords="250,250,7" shape="circle" style="fill: blue; stroke: none;fill-opacity: 0.3;">
5253
<area is="map-area" id="rect" href='http://example.com/rectangle/' alt="Rectangle" coords="345,290,415,320" shape="rect" style="fill: greenyellow; stroke: blue; stroke-width: 3px;fill-opacity: 0.4">
53-
<area is="map-area" id="poly" href='http://example.com/polygon/' alt="Polygon" coords="392,116,430,100,441,128,405,145" shape="poly" style="fill: pink; stroke: blue; stroke-width: 3px;fill-opacity: 0.4">
54+
<area is="map-area" id="poly" href='http://example.com/polygon/' alt="Polygon" coords="392,116,430,100,441,128,405,145" shape="poly" style="fill: pink; stroke: blue; stroke-width: 3px;fill-opacity: 0.4">-->
5455
</map>
5556
</div>
5657
</body>

device-location.html

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
<dom-module id="device-location">
2+
<script>
3+
4+
Polymer({
5+
is: "device-location",
6+
properties: {
7+
lat : {
8+
type: Number,
9+
value: 0,
10+
reflectToAttribute: false
11+
},
12+
lon : {
13+
type: Number,
14+
value: 0,
15+
reflectToAttribute: false
16+
},
17+
centered : {
18+
type: Boolean,
19+
reflectToAttribute: true
20+
}
21+
},
22+
observers: [
23+
'_toggleCentered(centered)'
24+
],
25+
_toggleCentered: function (centered) {
26+
if (centered) {
27+
// TODO create a point feature on the controls pane at the map center
28+
// DONE register a watchPosition function to move the map as the device
29+
// location changes
30+
var self = this,
31+
options = {
32+
enableHighAccuracy: true,
33+
timeout: 5000,
34+
maximumAge: 0
35+
};
36+
function moveTo(position) {
37+
self.lat = position.coords.latitude;
38+
self.lon = position.coords.longitude;
39+
if (self.parentNode.zoomTo && self.parentNode._map) {
40+
// TODO when the zoomTo bug is fixed, remove zoom+1
41+
self.parentNode.zoomTo(self.lat,self.lon,self.parentNode.zoom+1);
42+
}
43+
};
44+
this._watchID = navigator.geolocation.watchPosition(moveTo,null,options);
45+
} else {
46+
this._deleteWatch();
47+
// TODO replace the marker on the control pane at the center of the map
48+
// with an actual point feature , or simply move that point from
49+
// the control pane to the vector pane
50+
51+
// TODO register a navigator.geolocation.watchPosition function to
52+
// update the location of the above point feature
53+
}
54+
},
55+
detached: function() {
56+
this._deleteWatch();
57+
// TODO if there is a point associated to this control, remove/delete it
58+
},
59+
ready: function() {
60+
if (this.centered) {
61+
var self = this,
62+
options = {
63+
enableHighAccuracy: true,
64+
timeout: 5000,
65+
maximumAge: 0
66+
};
67+
function moveTo(position) {
68+
self.lat = position.coords.latitude;
69+
self.lon = position.coords.longitude;
70+
if (self.parentNode.zoomTo && self.parentNode._map) {
71+
// TODO when the zoomTo bug is fixed, remove zoom+1
72+
self.parentNode.zoomTo(self.lat,self.lon,self.parentNode.zoom+1);
73+
}
74+
};
75+
this._watchID = navigator.geolocation.watchPosition(moveTo,null,options);
76+
}
77+
},
78+
// attached: function() {
79+
// this._deleteWatch();
80+
// // could have a _watchID from being created without being detached
81+
// // i.e. never having been attached before...
82+
// if (this.centered) {
83+
// // create point on the control layer at the map center...
84+
//
85+
// }
86+
//
87+
// },
88+
_deleteWatch: function() {
89+
if (this._watchID) {
90+
navigator.geolocation.clearWatch(this._watchID);
91+
delete this._watchID;
92+
}
93+
}
94+
});
95+
</script>
96+
</dom-module>

web-map.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
<link rel="import" href="../polymer/polymer.html">
1+
<link rel="import" href="./bower_components/polymer/polymer.html">
2+
<link rel="import" href="device-location.html">
23
<link rel="import" href="map-layer.html">
34
<link rel="import" href="map-area.html">
45
<!-- styles scoped to inside a custom element must be in a style module -->

0 commit comments

Comments
 (0)