File tree Expand file tree Collapse file tree 5 files changed +106
-0
lines changed Expand file tree Collapse file tree 5 files changed +106
-0
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ angular.module('angularGoogleMapsApp')
8
8
'circle' ,
9
9
'layer' ,
10
10
'map-control' ,
11
+ 'map-type' ,
11
12
'marker' ,
12
13
'marker-label' ,
13
14
'markers' ,
Original file line number Diff line number Diff line change
1
+ < new-scope >
2
+ < p > The < code > map-type</ code > directive is used to add custom map types, as overlays or single layers.</ p >
3
+
4
+ < h4 > Usage</ h4 >
5
+
6
+ < div hljs language ="html " include ="'map-type-template' "> </ div >
7
+ < h4 > Parameters</ h4 >
8
+
9
+ < p > Required properties are in red.</ p >
10
+ < table class ="table table-bordered table-striped ">
11
+ < thead >
12
+ < tr >
13
+ < th > Param</ th >
14
+ < th > Type</ th >
15
+ < th > Details</ th >
16
+ </ tr >
17
+ </ thead >
18
+ < tbody >
19
+ < tr >
20
+ < td > options</ td >
21
+ < td > < span class ="label label-danger "> expression</ span > </ td >
22
+ < td > Map type options, including in particular < code > getTile</ code > or < code > getTileUrl</ code > methods.
23
+ For complete list of options see < a
24
+ href ="https://developers.google.com/maps/documentation/javascript/maptypes#MapTypeInterface "
25
+ target ="_blank "> Google Maps API documentation</ a > .
26
+ </ td >
27
+ </ tr >
28
+ < tr >
29
+ < td > id</ td >
30
+ < td > < span class ="label label-info "> string</ span > </ td >
31
+ < td > Map type id, to be used in the controler to display the maptype as a single layer.</ td >
32
+ </ tr >
33
+ < tr >
34
+ < td > show</ td >
35
+ < td > < span class ="label label-info "> expression</ span > </ td >
36
+ < td > Scope variable used to show the maptype as an overlay. Defaults to < code > true</ code > , unless < code > id</ code >
37
+ has been defined
38
+ </ td >
39
+ </ tr >
40
+ < tr >
41
+ < td > refresh</ td >
42
+ < td > < span class ="label label-info "> expression</ span > </ td >
43
+ < td > Variable or expression to watch, which will trigger a maptype refresh when changing.< br >
44
+ Useful in the case where the < code > getTileUrl</ code > is dynamically defined (for example using
45
+ filters, options…), and you want to apply changes immediately.
46
+ </ td >
47
+ </ tr >
48
+ </ tbody >
49
+ </ table >
50
+
51
+ < h4 > Examples</ h4 >
52
+ < runnable-example example ="'map-type' "> </ runnable-example >
53
+
54
+ < script type ="text/ng-template " id ="map-type-template ">
55
+ < ui-gmap-map-type
56
+ options = '{expression}'
57
+ id = "'{string}'"
58
+ show = '{expression}'
59
+ refresh = '{expression}' >
60
+ </ ui-gmap-map-type >
61
+ </ script >
62
+ </ new-scope >
Original file line number Diff line number Diff line change
1
+ < div id ="map_canvas " ng-controller ="mainCtrl ">
2
+ < ui-gmap-google-map center ="map.center " zoom ="map.zoom ">
3
+ < ui-gmap-map-type options ="squaresMapType " show ="map.showOverlay "> </ ui-gmap-map-type >
4
+ </ ui-gmap-google-map >
5
+
6
+ < a class ="btn btn-primary " ng-click ="map.showOverlay = !map.showOverlay "> Toggle overlay</ a >
7
+ </ div >
Original file line number Diff line number Diff line change
1
+ {
2
+ "name" : " map-type" ,
3
+ "files" : [" index.html" , " script.js" , " ../base/plnkr.html" ]
4
+ }
Original file line number Diff line number Diff line change
1
+ angular
2
+ . module ( 'appMaps' , [ 'uiGmapgoogle-maps' ] )
3
+ . controller ( 'mainCtrl' , function ( $scope , $log ) {
4
+ // Define map type options
5
+ $scope . squaresMapType = {
6
+ getTile : function ( coord , zoom , ownerDocument ) {
7
+ var div = ownerDocument . createElement ( 'div' ) ;
8
+ div . innerHTML = coord ;
9
+ div . style . width = this . tileSize . width + 'px' ;
10
+ div . style . height = this . tileSize . height + 'px' ;
11
+ div . style . fontSize = '10' ;
12
+ div . style . borderStyle = 'solid' ;
13
+ div . style . borderWidth = '1px' ;
14
+ div . style . borderColor = '#AAAAAA' ;
15
+ return div ;
16
+ } ,
17
+ tileSize : new google . maps . Size ( 256 , 256 ) ,
18
+ name : 'Black Squares' ,
19
+ maxZoom : 19 ,
20
+ } ;
21
+
22
+ // Define map options
23
+ $scope . map = {
24
+ center : {
25
+ latitude : 41.850033 ,
26
+ longitude : - 87.6500523
27
+ } ,
28
+ showOverlay : true ,
29
+ zoom : 10 ,
30
+ } ;
31
+
32
+ } ) ;
You can’t perform that action at this time.
0 commit comments