Examples in HTML5, with AngularJS

Example 1


Lorem ipsum dolor sit amet, consectetur adipiscing elit.Pellentesque vel placerat eros. Sed id libero et mi ultrices eleifend. Praesent ut rhoncus ligula.Suspendisse non lorem massa, in adipiscing turpis.

					< html ng-app="twente-app">
  					< head>
    					
    					Example 1
    					
    					
    				< /head>
  					< body>
						
< /body> < /html>
					#map
					{
						width: 600px; 
						height: 322px;
						overflow: hidden;
					}
				
				angular.module('twente-app', ['nine-e']).
    				factory('boundsScope', ['$rootScope', function($rootScope) {
        				var scope = $rootScope.$new();
        				var model = new BoundsModel();
       					var timer = new Timer(50, -1);
        				timer.scope = scope;
        				timer.timerHandler = function() {
            			var map = document.getElementById("map");
            			var style = map.currentStyle || getComputedStyle(map, null);
            			var width = style.width.replace("px", "");
            			var height = style.height.replace("px", "");
            			model.setBounds(new Bounds(width, height));
        			};
        			scope.timer = timer;
        			scope.model = model;
        			return scope;
    			}]).
    			factory('focusScope', ['$rootScope', function($rootScope) {
        			var scope = $rootScope.$new();
        			var model = new FocusModel();
       				model.minScale = 1692.7500637975315;
        			model.maxScale = 866688.0326643360;
        			model.scaleToZoomLevels = true;
        			var timer = new Timer(50, 20);
        			model.timer = timer;
        			scope.model = model;
        			return scope;
    			}]).
    			factory('tileScope', ['$rootScope', function($rootScope) {
        			var scope = $rootScope.$new();
        			scope.model = new TileModel();
        			return scope;
    			}]).
    			run(['$rootScope', 'boundsScope', 'focusScope', 'tileScope', function($rootScope, boundsScope, focusScope, tileScope) {
        			var tileModel = tileScope.model;
        			boundsScope.$watch('model.bounds', function(val) {  
            			tileModel.setBounds(val); 
        			});
        			focusScope.$watch('model.centerScale', function(val) { 
            			tileModel.setCenterScale(val); 
        			});
        			boundsScope.timer.tick();
        			boundsScope.timer.start();
        			focusScope.model.setCenterScale(new CenterScale(745000, 6856000, 433344.01633216810));
    			}]).
    			controller('MapCtrl', ['$scope', 'boundsScope', 'focusScope', 'tileScope', function ($scope, boundsScope, focusScope,  tileScope) {
       		 		$scope.boundsModel = boundsScope.model;
        			$scope.focusModel = focusScope.model;
        			$scope.tileModel = tileScope.model;
    			}]).
    			controller('FocusPanelCtrl', ['$scope', 'focusScope', function ($scope, focusScope) {
        			$scope.focusModel = focusScope.model;
    			}]);
				function setMapSize(width, height) {
    				var mapStyle = document.getElementById("map").style;
    				mapStyle.width = width + "px";
    				mapStyle.height = height + "px";
				}
			

Example 2


Lorem ipsum dolor sit amet, consectetur adipiscing elit.Pellentesque vel placerat eros. Sed id libero et mi ultrices eleifend. Praesent ut rhoncus ligula.Suspendisse non lorem massa, in adipiscing turpis.

					< html ng-app="twente-app">
  					< head>
    					
    					Example 2
    					
    					
    				< /head>
  					< body>
						
< /body> < /html>
					#map
					{
						width: 600px; 
						height: 322px;
						overflow: hidden;
					}
					#navigationControl
					{
						position: absolute; 
						margin: 2% 0 0 2%;
						z-index: 999;
					}
				
				angular.module('twente-app', ['nine-e']).
    				factory('boundsScope', ['$rootScope', function($rootScope) {
        				var scope = $rootScope.$new();
        				var model = new BoundsModel();
       					var timer = new Timer(50, -1);
        				timer.scope = scope;
        				timer.timerHandler = function() {
            			var map = document.getElementById("map");
            			var style = map.currentStyle || getComputedStyle(map, null);
            			var width = style.width.replace("px", "");
            			var height = style.height.replace("px", "");
            			model.setBounds(new Bounds(width, height));
        			};
        			scope.timer = timer;
        			scope.model = model;
        			return scope;
    			}]).
    			factory('focusScope', ['$rootScope', function($rootScope) {
        			var scope = $rootScope.$new();
        			var model = new FocusModel();
       				model.minScale = 1692.7500637975315;
        			model.maxScale = 866688.0326643360;
        			model.scaleToZoomLevels = true;
        			var timer = new Timer(50, 20);
        			model.timer = timer;
        			scope.model = model;
        			return scope;
    			}]).
    			factory('tileScope', ['$rootScope', function($rootScope) {
        			var scope = $rootScope.$new();
        			scope.model = new TileModel();
        			return scope;
    			}]).
    			run(['$rootScope', 'boundsScope', 'focusScope', 'tileScope', function($rootScope, boundsScope, focusScope, tileScope) {
        			var tileModel = tileScope.model;
        			boundsScope.$watch('model.bounds', function(val) {  
            			tileModel.setBounds(val); 
        			});
        			focusScope.$watch('model.centerScale', function(val) { 
            			tileModel.setCenterScale(val); 
        			});
        			boundsScope.timer.tick();
        			boundsScope.timer.start();
        			focusScope.model.setCenterScale(new CenterScale(745000, 6856000, 433344.01633216810));
    			}]).
    			controller('MapCtrl', ['$scope', 'boundsScope', 'focusScope', 'tileScope', function ($scope, boundsScope, focusScope,  tileScope) {
       		 		$scope.boundsModel = boundsScope.model;
        			$scope.focusModel = focusScope.model;
        			$scope.tileModel = tileScope.model;
    			}]).
    			controller('FocusButtonBarCtrl', ['$scope', 'boundsScope', 'focusScope', function ($scope, boundsScope, focusScope) {
        			var boundsModel = boundsScope.model;
        			var focusModel = focusScope.model;
       		 		$scope.panNorth = function() {
            			var bounds = boundsModel.bounds;
            			var cs = focusModel.centerScale;
            			focusModel.setAnimationCenterScale(new CenterScale(cs.centerX, cs.centerY + cs.getNumWorldCoords(bounds.height / 2), cs.scale));
        			}
        			$scope.panSouth = function() {
            			var bounds = boundsModel.bounds;
            			var cs = focusModel.centerScale;
            			focusModel.setAnimationCenterScale(new CenterScale(cs.centerX, cs.centerY - cs.getNumWorldCoords(bounds.height / 2), cs.scale));
        			}
        			$scope.panWest = function() {
            			var bounds = boundsModel.bounds;
            			var cs = focusModel.centerScale;
            			focusModel.setAnimationCenterScale(new CenterScale(cs.centerX - cs.getNumWorldCoords(bounds.width / 2), cs.centerY, cs.scale));
        			}
        			$scope.panEast = function() {
            			var bounds = boundsModel.bounds;
            			var cs = focusModel.centerScale;
            			focusModel.setAnimationCenterScale(new CenterScale(cs.centerX + cs.getNumWorldCoords(bounds.width / 2), cs.centerY, cs.scale));
        			}
        			$scope.zoomIn = function() {
            			var cs = focusModel.centerScale;
            			focusModel.setAnimationCenterScale(new CenterScale(cs.centerX, cs.centerY, cs.scale / 2));
        			}
        			$scope.zoomOut = function() {
            			var cs = focusModel.centerScale;
            			focusModel.setAnimationCenterScale(new CenterScale(cs.centerX, cs.centerY, cs.scale * 2));
        			}
    			}]).
    			controller('FocusPanelCtrl', ['$scope', 'focusScope', function ($scope, focusScope) {
        			$scope.focusModel = focusScope.model;
    			}]);
				function setMapSize(width, height) {
    				var mapStyle = document.getElementById("map").style;
    				mapStyle.width = width + "px";
    				mapStyle.height = height + "px";
				}
			

Example 3


Lorem ipsum dolor sit amet, consectetur adipiscing elit.Pellentesque vel placerat eros. Sed id libero et mi ultrices eleifend. Praesent ut rhoncus ligula.Suspendisse non lorem massa, in adipiscing turpis.


					< html ng-app="twente-app">
  					< head>
    					
    					Example 3
    					
    					
    				< /head>
  					< body>
						
< /body> < /html>
					.twente_map_container
                    {
                        color: #757575;
                        font: 12px Arial;
                        max-width: 1200px;
                        margin: 0 auto;
                    }
                    #legend
                    {
                        float: left;
                        width: 14%;
                    }
                    
                    #legend ul
                    {
                        list-style-type: none;
                        margin-left: -3em;
                    }
                    #map
                    {
                        width: 68%; 
                        min-width: 310px;
                        height: 600px; 
                        float: left; 
                        overflow: hidden;
                    }
                    #navigationControl
                    {
                        position: absolute; 
                        margin: 2% 0 0 2%;
                        z-index: 999;
                    }
                    .highlightSymbolizer
                    {
                        opacity: 0.4;
                        width: 26px;
                        margin: -4px 0 0 -4px;
                    }
                    .defaultSymbolizer
                    {
                        opacity: 1.0;
                        width: 18px;
                        margin: 0;
                    }
                    .highlightGeometrySymbolizer
                    {
                        fill: none;
                        stroke-width: 7;
                    }
                    .defaultGeometrySymbolizer
                    {
                        fill: none;
                        stroke-width: 5;
                    }
				
	                    angular.module('twente-app', ['nine-e', 'ngSanitize']).
                        factory('boundsScope', ['$rootScope', function($rootScope) {
                            var scope = $rootScope.$new();
                            var model = new BoundsModel();
                            var timer = new Timer(50, -1);
                            timer.scope = scope;
                            timer.timerHandler = function() {
                                var map = document.getElementById("map");
                                var style = map.currentStyle || getComputedStyle(map, null);
                                var width = style.width.replace("px", "");
                                var height = style.height.replace("px", "");
                                model.setBounds(new Bounds(width, height));
                            };
                            scope.timer = timer;
                            scope.model = model;
                            return scope;
                        }]).
                        factory('focusScope', ['$rootScope', function($rootScope) {
                            var scope = $rootScope.$new();
                            var model = new FocusModel();
                            model.minScale = 1692.7500637975315;
                            model.maxScale = 866688.0326643360;
                            model.scaleToZoomLevels = true;
                            var timer = new Timer(50, 20);
                            model.timer = timer;
                            scope.model = model;
                            return scope;
                        }]).
                        factory('envelopeScope', ['$rootScope', function($rootScope) {
                            var scope = $rootScope.$new();
                            var model = new EnvelopeCenterScale();
                            scope.model = model;
                            return scope;
                        }]).
                        factory('layerScope', ['$rootScope', function($rootScope) {
                            var scope = $rootScope.$new();
                            var layers = [
                            {id:1, title:'Hinder en afsluitingen', visible:false},
                            {id:2, title:'Treinstations', visible:false},
                            {id:3, title:'OV-fietslocaties', visible:false},
                            {id:4, title:'P&R-plaatsen', visible:false},
                            {id:5, title:'Carpoolplaatsen', visible:false},
                            {id:6, title:'Parkeren in het centrum', visible:false},
                            {id:7, title:'Webcams', visible:false}
                              ];
                            scope.layers = layers;
                            return scope;
                        }]).
                        factory('featureScope', ['$rootScope', '$http', function($rootScope, $http) {
                            var scope = $rootScope.$new();
                            var services = [
                            {id:1, url:'twentemobiel/objects.csv', fieldSeparator:'|', simple:true, featureName:'hinderFeatureModel', featureType:new FeatureType('hinderFeatureModel', new Array(new Property('a', PropertyType.prototype.STRING), new Property('b', PropertyType.prototype.STRING), new Property('c', PropertyType.prototype.GEOMETRY), new Property('d', PropertyType.prototype.GEOMETRY), new Property('e', PropertyType.prototype.GEOMETRY), new Property('f', PropertyType.prototype.STRING), new Property('g', PropertyType.prototype.STRING), new Property('h', PropertyType.prototype.STRING), new Property('j', PropertyType.prototype.STRING), new Property('k', PropertyType.prototype.STRING), new Property('l', PropertyType.prototype.STRING)))},
                            {id:2, url:'twentemobiel/trains.csv', fieldSeparator:';', simple:false, featureName:'trainFeatureModel', featureType:new FeatureType('trainFeatureModel', new Array(new Property('a', PropertyType.prototype.STRING), new Property('b', PropertyType.prototype.STRING), new Property('c', PropertyType.prototype.STRING), new Property('d', PropertyType.prototype.GEOMETRY), new Property('e', PropertyType.prototype.STRING), new Property('f', PropertyType.prototype.STRING), new Property('g', PropertyType.prototype.STRING)))},
                            {id:3, url:'twentemobiel/bikes.csv', fieldSeparator:';', simple:false, featureName:'bikesFeatureModel', featureType:new FeatureType('bikesFeatureModel', new Array(new Property('a', PropertyType.prototype.STRING), new Property('b', PropertyType.prototype.STRING), new Property('c', PropertyType.prototype.GEOMETRY), new Property('d', PropertyType.prototype.STRING), new Property('e', PropertyType.prototype.STRING), new Property('f', PropertyType.prototype.STRING), new Property('g', PropertyType.prototype.STRING), new Property('h', PropertyType.prototype.STRING), new Property('e', PropertyType.prototype.STRING), new Property('k', PropertyType.prototype.STRING), new Property('l', PropertyType.prototype.STRING)))},
                            {id:4, url:'twentemobiel/parkrides.csv', fieldSeparator:';', simple:false, featureName:'parkridesFeatureModel', featureType:new FeatureType('parkridesFeatureModel', new Array(new Property('a', PropertyType.prototype.STRING), new Property('b', PropertyType.prototype.STRING), new Property('c', PropertyType.prototype.STRING), new Property('d', PropertyType.prototype.GEOMETRY)))},
                            {id:5, url:'twentemobiel/carpools.csv', fieldSeparator:';', simple:false, featureName:'carpoolsFeatureModel', featureType:new FeatureType('carpoolsFeatureModel', new Array(new Property('a', PropertyType.prototype.STRING), new Property('b', PropertyType.prototype.STRING), new Property('c', PropertyType.prototype.STRING), new Property('d', PropertyType.prototype.GEOMETRY)))},
                            {id:6, url:'twentemobiel/carparks.csv', fieldSeparator:';', simple:false, featureName:'carparksFeatureModel', featureType:new FeatureType('carparksFeatureModel', new Array(new Property('a', PropertyType.prototype.STRING), new Property('b', PropertyType.prototype.STRING), new Property('c', PropertyType.prototype.STRING), new Property('d', PropertyType.prototype.GEOMETRY)))},
                            {id:7, url:'twentemobiel/webcams.csv', fieldSeparator:';', simple:false, featureName:'webcamsFeatureModel', featureType:new FeatureType('webcamsFeatureModel', new Array(new Property('a', PropertyType.prototype.STRING), new Property('b', PropertyType.prototype.STRING), new Property('c', PropertyType.prototype.STRING), new Property('d', PropertyType.prototype.GEOMETRY)))}
                            ];
                            scope.models = new Array(services.length);
                            for (var i = 0; i < services.length; ++i) {
                                var serviceConnector = new CSVServiceConnector($http, services[i].id, services[i].fieldSeparator, services[i].simple, services[i].featureType, services[i].url);
                                serviceConnector.load(scope, function(scope, id, featureModel) { 
                                    scope.models[id] = featureModel; 
                                });
                            }
                            return scope;
                        }]).
                        factory('selectionScope', ['$rootScope', function($rootScope) {
                            var scope = $rootScope.$new();
                            scope.model = new SelectionModel();
                            scope.model.selectedFeatures = [null, null]; // [0] is the mouseover feature, [1] is the selected feature. Each one causes a highlight in the map, but only [1] actives the info panel.
                            return scope;
                        }]).
                        factory('tileScope', ['$rootScope', function($rootScope) {
                            var scope = $rootScope.$new();
                            scope.model = new TileModel();
                            return scope;
                        }]).
                        run(['$rootScope', 'boundsScope', 'focusScope', 'envelopeScope', 'tileScope', function($rootScope, boundsScope, focusScope, envelopeScope, tileScope) {
                            var tileModel = tileScope.model;
                            
                            boundsScope.$watch('model.bounds', function(val) {             
                                envelopeScope.model.setBounds(val);
                                tileModel.setBounds(val); 
                            });
                            focusScope.$watch('model.centerScale', function(val) { 
                                envelopeScope.model.setCenterScale(val); 
                                tileModel.setCenterScale(val); 
                            });
                            
                            boundsScope.timer.tick();
                            boundsScope.timer.start();
                            focusScope.model.setCenterScale(new CenterScale(745000, 6856000, 433344.01633216810));
                        }]).
                        controller('MapCtrl', ['$scope', 'boundsScope', 'focusScope', 'envelopeScope', 'selectionScope', 'tileScope', 'layerScope', 'featureScope', function ($scope, boundsScope, focusScope, envelopeScope, selectionScope, tileScope, layerScope, featureScope) {
                            $scope.boundsModel = boundsScope.model;
                            $scope.focusModel = focusScope.model;
                            $scope.envelopeModel = envelopeScope.model;
                            $scope.selectionModel = selectionScope.model;
                            $scope.tileModel = tileScope.model;
                            $scope.layers = layerScope.layers;
                            $scope.featureModels = featureScope.models;
                            
                            $scope.toggleSelect0FeatureCommand = new ToggleSelectFeatureCommand($scope.selectionModel, 0);
                            $scope.toggleSelect1FeatureCommand = new ToggleSelectFeatureCommand($scope.selectionModel, 1);
                            $scope.toURLFeatureCommand = new ToURLFeatureCommand();
                            
                            $scope.selectCommands = [$scope.toggleSelect0FeatureCommand, $scope.toggleSelect0FeatureCommand, $scope.toggleSelect1FeatureCommand];
                            $scope.urlCommands = [$scope.toggleSelect0FeatureCommand, $scope.toggleSelect0FeatureCommand, $scope.toURLFeatureCommand];
                        }]).
                        controller('FocusButtonBarCtrl', ['$scope', 'boundsScope', 'focusScope', function ($scope, boundsScope, focusScope) {
                            var boundsModel = boundsScope.model;
                            var focusModel = focusScope.model;
                            
                            $scope.panNorth = function() {
                                var bounds = boundsModel.bounds;
                                var cs = focusModel.centerScale;
                                focusModel.setAnimationCenterScale(new CenterScale(cs.centerX, cs.centerY + cs.getNumWorldCoords(bounds.height / 2), cs.scale));
                            }
                            $scope.panSouth = function() {
                                var bounds = boundsModel.bounds;
                                var cs = focusModel.centerScale;
                                focusModel.setAnimationCenterScale(new CenterScale(cs.centerX, cs.centerY - cs.getNumWorldCoords(bounds.height / 2), cs.scale));
                            }
                            $scope.panWest = function() {
                                var bounds = boundsModel.bounds;
                                var cs = focusModel.centerScale;
                                focusModel.setAnimationCenterScale(new CenterScale(cs.centerX - cs.getNumWorldCoords(bounds.width / 2), cs.centerY, cs.scale));
                            }
                            $scope.panEast = function() {
                                var bounds = boundsModel.bounds;
                                var cs = focusModel.centerScale;
                                focusModel.setAnimationCenterScale(new CenterScale(cs.centerX + cs.getNumWorldCoords(bounds.width / 2), cs.centerY, cs.scale));
                            }
                            $scope.zoomIn = function() {
                                var cs = focusModel.centerScale;
                                focusModel.setAnimationCenterScale(new CenterScale(cs.centerX, cs.centerY, cs.scale / 2));
                            }
                            $scope.zoomOut = function() {
                                var cs = focusModel.centerScale;
                                focusModel.setAnimationCenterScale(new CenterScale(cs.centerX, cs.centerY, cs.scale * 2));
                            }
                        }]).
                        controller('FocusPanelCtrl', ['$scope', 'focusScope', function ($scope, focusScope) {
                            $scope.focusModel = focusScope.model;
                        }]);
                    function setMapSize(width, height) {
                        var mapStyle = document.getElementById("map").style;
                        mapStyle.width = width + "px";
                        mapStyle.height = height + "px";
                    }
			

Example 4


Lorem ipsum dolor sit amet, consectetur adipiscing elit.Pellentesque vel placerat eros. Sed id libero et mi ultrices eleifend. Praesent ut rhoncus ligula.Suspendisse non lorem massa, in adipiscing turpis.


					< html ng-app="twente-app">
  					< head>
    					
    					Example 4
    					
    					
    				< /head>
  					< body>
						
Er zijn op dit moment {{featureModels[1].features.length}} meldingen van hinder en afsluitingen. Wegwerkzaamheden en evenementen die over meer dan 4 weken aanvangen zijn nog niet zichtbaar.
< /body> < /html>
					.twente_map_container
                    {
                        color: #757575;
                        font: 12px Arial;
                        max-width: 1200px;
                        margin: 0 auto;
                    }
                    #legend
                    {
                        float: left;
                        width: 14%;
                    }
                    
                    #legend ul
                    {
                        list-style-type: none;
                        margin-left: -3em;
                    }
                    #infoPanel
                    {
                        width: 16%; 
                        padding: 1%;
                        float: left;
                    }
                    #infoPanel .heading
                    {
                        color:#222222;
                        font-weight:bold;
                    }
                    #map
                    {
                        width: 68%; 
                        min-width: 310px;
                        height: 600px; 
                        float: left; 
                        overflow: hidden;
                    }
                    #navigationControl
                    {
                        position: absolute; 
                        margin: 2% 0 0 2%;
                        z-index: 999;
                    }
                    .highlightSymbolizer
                    {
                        opacity: 0.4;
                        width: 26px;
                        margin: -4px 0 0 -4px;
                    }
                    .defaultSymbolizer
                    {
                        opacity: 1.0;
                        width: 18px;
                        margin: 0;
                    }
                    .highlightGeometrySymbolizer
                    {
                        fill: none;
                        stroke-width: 7;
                    }
                    .defaultGeometrySymbolizer
                    {
                        fill: none;
                        stroke-width: 5;
                    }
				
                    angular.module('twente-app', ['nine-e', 'ngSanitize']).
                        factory('boundsScope', ['$rootScope', function($rootScope) {
                            var scope = $rootScope.$new();
                            var model = new BoundsModel();
                            var timer = new Timer(50, -1);
                            timer.scope = scope;
                            timer.timerHandler = function() {
                                var map = document.getElementById("map");
                                var style = map.currentStyle || getComputedStyle(map, null);
                                var width = style.width.replace("px", "");
                                var height = style.height.replace("px", "");
                                model.setBounds(new Bounds(width, height));
                            };
                            scope.timer = timer;
                            scope.model = model;
                            return scope;
                        }]).
                        factory('focusScope', ['$rootScope', function($rootScope) {
                            var scope = $rootScope.$new();
                            var model = new FocusModel();
                            model.minScale = 1692.7500637975315;
                            model.maxScale = 866688.0326643360;
                            model.scaleToZoomLevels = true;
                            var timer = new Timer(50, 20);
                            model.timer = timer;
                            scope.model = model;
                            return scope;
                        }]).
                        factory('envelopeScope', ['$rootScope', function($rootScope) {
                            var scope = $rootScope.$new();
                            var model = new EnvelopeCenterScale();
                            scope.model = model;
                            return scope;
                        }]).
                        factory('layerScope', ['$rootScope', function($rootScope) {
                            var scope = $rootScope.$new();
                            var layers = [
                            {id:1, title:'Hinder en afsluitingen', visible:false},
                            {id:2, title:'Treinstations', visible:false},
                            {id:3, title:'OV-fietslocaties', visible:false},
                            {id:4, title:'P&R-plaatsen', visible:false},
                            {id:5, title:'Carpoolplaatsen', visible:false},
                            {id:6, title:'Parkeren in het centrum', visible:false},
                            {id:7, title:'Webcams', visible:false}
                              ];
                            scope.layers = layers;
                            return scope;
                        }]).
                        factory('featureScope', ['$rootScope', '$http', function($rootScope, $http) {
                            var scope = $rootScope.$new();
                            var services = [
                            {id:1, url:'twentemobiel/objects.csv', fieldSeparator:'|', simple:true, featureName:'hinderFeatureModel', featureType:new FeatureType('hinderFeatureModel', new Array(new Property('a', PropertyType.prototype.STRING), new Property('b', PropertyType.prototype.STRING), new Property('c', PropertyType.prototype.GEOMETRY), new Property('d', PropertyType.prototype.GEOMETRY), new Property('e', PropertyType.prototype.GEOMETRY), new Property('f', PropertyType.prototype.STRING), new Property('g', PropertyType.prototype.STRING), new Property('h', PropertyType.prototype.STRING), new Property('j', PropertyType.prototype.STRING), new Property('k', PropertyType.prototype.STRING), new Property('l', PropertyType.prototype.STRING)))},
                            {id:2, url:'twentemobiel/trains.csv', fieldSeparator:';', simple:false, featureName:'trainFeatureModel', featureType:new FeatureType('trainFeatureModel', new Array(new Property('a', PropertyType.prototype.STRING), new Property('b', PropertyType.prototype.STRING), new Property('c', PropertyType.prototype.STRING), new Property('d', PropertyType.prototype.GEOMETRY), new Property('e', PropertyType.prototype.STRING), new Property('f', PropertyType.prototype.STRING), new Property('g', PropertyType.prototype.STRING)))},
                            {id:3, url:'twentemobiel/bikes.csv', fieldSeparator:';', simple:false, featureName:'bikesFeatureModel', featureType:new FeatureType('bikesFeatureModel', new Array(new Property('a', PropertyType.prototype.STRING), new Property('b', PropertyType.prototype.STRING), new Property('c', PropertyType.prototype.GEOMETRY), new Property('d', PropertyType.prototype.STRING), new Property('e', PropertyType.prototype.STRING), new Property('f', PropertyType.prototype.STRING), new Property('g', PropertyType.prototype.STRING), new Property('h', PropertyType.prototype.STRING), new Property('e', PropertyType.prototype.STRING), new Property('k', PropertyType.prototype.STRING), new Property('l', PropertyType.prototype.STRING)))},
                            {id:4, url:'twentemobiel/parkrides.csv', fieldSeparator:';', simple:false, featureName:'parkridesFeatureModel', featureType:new FeatureType('parkridesFeatureModel', new Array(new Property('a', PropertyType.prototype.STRING), new Property('b', PropertyType.prototype.STRING), new Property('c', PropertyType.prototype.STRING), new Property('d', PropertyType.prototype.GEOMETRY)))},
                            {id:5, url:'twentemobiel/carpools.csv', fieldSeparator:';', simple:false, featureName:'carpoolsFeatureModel', featureType:new FeatureType('carpoolsFeatureModel', new Array(new Property('a', PropertyType.prototype.STRING), new Property('b', PropertyType.prototype.STRING), new Property('c', PropertyType.prototype.STRING), new Property('d', PropertyType.prototype.GEOMETRY)))},
                            {id:6, url:'twentemobiel/carparks.csv', fieldSeparator:';', simple:false, featureName:'carparksFeatureModel', featureType:new FeatureType('carparksFeatureModel', new Array(new Property('a', PropertyType.prototype.STRING), new Property('b', PropertyType.prototype.STRING), new Property('c', PropertyType.prototype.STRING), new Property('d', PropertyType.prototype.GEOMETRY)))},
                            {id:7, url:'twentemobiel/webcams.csv', fieldSeparator:';', simple:false, featureName:'webcamsFeatureModel', featureType:new FeatureType('webcamsFeatureModel', new Array(new Property('a', PropertyType.prototype.STRING), new Property('b', PropertyType.prototype.STRING), new Property('c', PropertyType.prototype.STRING), new Property('d', PropertyType.prototype.GEOMETRY)))}
                            ];
                            scope.models = new Array(services.length);
                            for (var i = 0; i < services.length; ++i) {
                                var serviceConnector = new CSVServiceConnector($http, services[i].id, services[i].fieldSeparator, services[i].simple, services[i].featureType, services[i].url);
                                serviceConnector.load(scope, function(scope, id, featureModel) { 
                                    scope.models[id] = featureModel; 
                                });
                            }
                            return scope;
                        }]).
                        factory('selectionScope', ['$rootScope', function($rootScope) {
                            var scope = $rootScope.$new();
                            scope.model = new SelectionModel();
                            scope.model.selectedFeatures = [null, null]; // [0] is the mouseover feature, [1] is the selected feature. Each one causes a highlight in the map, but only [1] actives the info panel.
                            return scope;
                        }]).
                        factory('tileScope', ['$rootScope', function($rootScope) {
                            var scope = $rootScope.$new();
                            scope.model = new TileModel();
                            return scope;
                        }]).
                        run(['$rootScope', 'boundsScope', 'focusScope', 'envelopeScope', 'tileScope', function($rootScope, boundsScope, focusScope, envelopeScope, tileScope) {
                            var tileModel = tileScope.model;
                            
                            boundsScope.$watch('model.bounds', function(val) {             
                                envelopeScope.model.setBounds(val);
                                tileModel.setBounds(val); 
                            });
                            focusScope.$watch('model.centerScale', function(val) { 
                                envelopeScope.model.setCenterScale(val); 
                                tileModel.setCenterScale(val); 
                            });
                            
                            boundsScope.timer.tick();
                            boundsScope.timer.start();
                            focusScope.model.setCenterScale(new CenterScale(745000, 6856000, 433344.01633216810));
                        }]).
                        controller('MapCtrl', ['$scope', 'boundsScope', 'focusScope', 'envelopeScope', 'selectionScope', 'tileScope', 'layerScope', 'featureScope', function ($scope, boundsScope, focusScope, envelopeScope, selectionScope, tileScope, layerScope, featureScope) {
                            $scope.boundsModel = boundsScope.model;
                            $scope.focusModel = focusScope.model;
                            $scope.envelopeModel = envelopeScope.model;
                            $scope.selectionModel = selectionScope.model;
                            $scope.tileModel = tileScope.model;
                            $scope.layers = layerScope.layers;
                            $scope.featureModels = featureScope.models;
                            
                            $scope.toggleSelect0FeatureCommand = new ToggleSelectFeatureCommand($scope.selectionModel, 0);
                            $scope.toggleSelect1FeatureCommand = new ToggleSelectFeatureCommand($scope.selectionModel, 1);
                            $scope.toURLFeatureCommand = new ToURLFeatureCommand();
                            
                            $scope.selectCommands = [$scope.toggleSelect0FeatureCommand, $scope.toggleSelect0FeatureCommand, $scope.toggleSelect1FeatureCommand];
                            $scope.urlCommands = [$scope.toggleSelect0FeatureCommand, $scope.toggleSelect0FeatureCommand, $scope.toURLFeatureCommand];
                        }]).
                        controller('FocusButtonBarCtrl', ['$scope', 'boundsScope', 'focusScope', function ($scope, boundsScope, focusScope) {
                            var boundsModel = boundsScope.model;
                            var focusModel = focusScope.model;
                            
                            $scope.panNorth = function() {
                                var bounds = boundsModel.bounds;
                                var cs = focusModel.centerScale;
                                focusModel.setAnimationCenterScale(new CenterScale(cs.centerX, cs.centerY + cs.getNumWorldCoords(bounds.height / 2), cs.scale));
                            }
                            $scope.panSouth = function() {
                                var bounds = boundsModel.bounds;
                                var cs = focusModel.centerScale;
                                focusModel.setAnimationCenterScale(new CenterScale(cs.centerX, cs.centerY - cs.getNumWorldCoords(bounds.height / 2), cs.scale));
                            }
                            $scope.panWest = function() {
                                var bounds = boundsModel.bounds;
                                var cs = focusModel.centerScale;
                                focusModel.setAnimationCenterScale(new CenterScale(cs.centerX - cs.getNumWorldCoords(bounds.width / 2), cs.centerY, cs.scale));
                            }
                            $scope.panEast = function() {
                                var bounds = boundsModel.bounds;
                                var cs = focusModel.centerScale;
                                focusModel.setAnimationCenterScale(new CenterScale(cs.centerX + cs.getNumWorldCoords(bounds.width / 2), cs.centerY, cs.scale));
                            }
                            $scope.zoomIn = function() {
                                var cs = focusModel.centerScale;
                                focusModel.setAnimationCenterScale(new CenterScale(cs.centerX, cs.centerY, cs.scale / 2));
                            }
                            $scope.zoomOut = function() {
                                var cs = focusModel.centerScale;
                                focusModel.setAnimationCenterScale(new CenterScale(cs.centerX, cs.centerY, cs.scale * 2));
                            }
                        }]).
                        controller('FocusPanelCtrl', ['$scope', 'focusScope', function ($scope, focusScope) {
                            $scope.focusModel = focusScope.model;
                        }]).
                        controller('InfoCtrl', ['$scope', 'layerScope', 'featureScope', 'selectionScope', function ($scope, layerScope, featureScope, selectionScope) {
                            $scope.layers = layerScope.layers;
                            $scope.featureModels = featureScope.models;
                            $scope.selectionModel = selectionScope.model;
                            $scope.setWegobjectText = function(propertyValues) {
                                var typeText = "";
                                switch(propertyValues[0]) {
                                    case '1': typeText = "Hinder door wegwerkzaamheden"; break;
                                    case '2': typeText = "Afsluiting vanwege wegwerkzaamheden"; break;
                                    case '3': typeText = "Hinder door evenement"; break;
                                    case '4': typeText = "Afsluiting vanwege evenement"; break;
                                    case '5': typeText = "Hinder door calamiteit"; break;
                                    case '6': typeText = "Afsluiting vanwege calamiteit"; break;
                                    default: return;
                                }
                                var text = "";
                                text += "

" + typeText + "

"; text += "

" + propertyValues[7] + "

"; text += "

" + propertyValues[6] + "

"; text += "

Waar

"; text += "

" + propertyValues[9] + "

"; text += "

Wanneer

"; text += "

" + propertyValues[1] + "

"; text += "

Meer informatie

"; if(propertyValues[8] != null) { text += "

" + propertyValues[8] + "

"; } text += "

Download als pdf

"; text = text.replace(/null/g, ""); text = text.replace(/\[link\](.*?)\n*?\[text\](.*?)\[end\]/g, "$2"); text = text.replace(/\[7C\]/g, "|"); text = text.replace(/\[0A\]/g, "
"); return text; } $scope.setTrainText = function(propertyValues) { var text = ""; text += "

Treinstation

"; text += "

" + propertyValues[1] + "

"; text += "

Voorzieningen op het station

"; text += "

Plan een reis vanaf dit station

"; text += "

Plan een reis naar dit station

"; text += "

Actuele vertrektijden

"; return text; } $scope.setBikeText = function(propertyValues) { var text = ""; text += "

OV-fietslocatie

"; text += "

" + propertyValues[3] + "

"; if (propertyValues[4] != null) { text += "

" + propertyValues[4] + "

"; } if (propertyValues[5] != null) { text += "

" + propertyValues[5] + "

"; } if (propertyValues[6] != null) { text += "

" + propertyValues[6] + " " + propertyValues[7] + "

"; } text += "

Openingstijden

"; text += "

" + propertyValues[8] + "

"; if (propertyValues[9] != null) { text += "

Bijzonderheden

"; text += "

" + propertyValues[9] + "

"; } text += "

Plan een fietsroute vanaf hier

"; text += "

Meer informatie

"; return text; } }]); function setMapSize(width, height) { var mapStyle = document.getElementById("map").style; mapStyle.width = width + "px"; mapStyle.height = height + "px"; }

Copyright 2011-2013 Niney