Resize the current map to the specified width and height
(since it is actually on a child div of the mapElement passed
as argument to the Mapstraction constructor, the resizing of this
mapElement may have no effect on the size of the actual map)
Set the api call deferment on or off - When it's on, mxn.invoke will queue up provider API calls until
runDeferred is called, at which time everything in the queue will be run in the order it was added.
Sets the imagery type for the map
The type can be one of:
mxn.Mapstraction.ROAD
mxn.Mapstraction.SATELLITE
mxn.Mapstraction.HYBRID
mxn.Mapstraction.PHYSICAL
Sets the zoom level for the map
MS doesn't seem to do zoom=0, and Gg's sat goes closer than it's maps, and MS's sat goes closer than Y!'s
TODO: Mapstraction.prototype.getZoomLevels or something.
Sets the center and zoom of the map to the smallest bounding box
containing all visible markers and polylines
will only include markers and polylines with an attribute of "visible"
- Mapstraction instantiates a map with some API choice into the HTML element given
-
-
-
-
-
-
-
-
-
Parameters:
-
-
- {String}element
-
-
-
The HTML element to replace with a map
-
-
- {String}api
-
-
-
The API to use, one of 'google', 'googlev3', 'yahoo', 'microsoft', 'openstreetmap', 'multimap', 'map24', 'openlayers', 'mapquest'. If omitted, first loaded provider implementation is used.
-
-
- {Bool}debug
-
-
-
optional parameter to turn on debug support - this uses alert panels for unsupported actions
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Field Detail
-
-
-
-
-
-
- api
-
-
-
- The name of the active API.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- currentElement
-
-
-
- The DOM element containing the map.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- element
-
-
-
- The original element value passed to the constructor.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- markers
-
-
-
- The markers currently loaded.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- options
-
-
-
- Options defaults.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- polylines
-
-
-
- The polylines currently loaded.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Method Detail
-
-
-
-
-
-
- addControls(args)
-
-
-
- addControls adds controls to the map. You specify which controls to add in
the associative array that is the only argument.
addControls can be called multiple time, with different args, to dynamically change controls.
args = {
pan: true,
zoom: 'large' || 'small',
overview: true,
scale: true,
map_type: true,
}
-
-
-
- Adds a Tile Layer to the map
Requires providing a parameterized tile url. Use {Z}, {X}, and {Y} to specify where the parameters
should go in the URL.
For example, the OpenStreetMap tiles are:
m.addTileLayer("http://tile.openstreetmap.org/{Z}/{X}/{Y}.png", 1.0, "OSM", 1, 19, true);
-
-
-
-
-
-
-
-
-
Parameters:
-
-
- {tile_url}template
-
-
-
url of the tiles.
-
-
- {opacity}opacity
-
-
-
of the tile layer - 0 is transparent, 1 is opaque. (default=0.6)
-
-
- {copyright_text}copyright
-
-
-
text to use for the tile layer. (default=Mapstraction)
-
-
- {min_zoom}Minimum
-
-
-
(furtherest out) zoom level that tiles are available (default=1)
-
-
- {max_zoom}Maximum
-
-
-
(closest) zoom level that the tiles are available (default=18)
-
-
- {map_type}Should
-
-
-
the tile layer be a selectable map type in the layers palette (default=false)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- applyFilter(o, f)
-
-
-
-
-
-
-
-
-
-
-
-
-
Parameters:
-
-
- o
-
-
-
-
-
- f
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- applyOptions()
-
-
-
- Applies the current option settings
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- autoCenterAndZoom()
-
-
-
- Sets the center and zoom of the map to the smallest bounding box
containing all markers and polylines
-
-
-
- centerAndZoomOnPoints sets the center and zoom of the map from an array of points
This is useful if you don't want to have to add markers to the map
-
-
-
-
-
-
-
-
-
Parameters:
-
-
- points
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- clickHandler(lat, lon, me)
-
-
-
-
-
-
-
-
-
-
-
-
-
Parameters:
-
-
- lat
-
-
-
-
-
- lon
-
-
-
-
-
- me
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- declutterMarkers(opts)
-
-
-
- Declutter the markers on the map, group together overlapping markers.
-
-
-
- doFilter executes all filters added since last call
Now supports a callback function for when a marker is shown or hidden
-
-
-
-
-
-
-
-
-
Parameters:
-
-
- {Function}showCallback
-
-
-
-
-
- {Function}hideCallback
-
-
-
-
-
-
-
-
-
-
-
-
Returns:
-
-
{Int} count of visible markers
-
-
-
-
-
-
-
-
-
-
-
-
- dragging(on)
-
-
-
- Enable/disable dragging of the map
-
-
-
-
-
-
-
-
-
Parameters:
-
-
- {Boolean}on
-
-
-
-
-
-
-
-
-
Deprecated:
-
- Use setOption instead.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- enableScrollWheelZoom()
-
-
-
- Enable scroll wheel zooming
-
-
-
-
-
-
-
-
-
-
Deprecated:
-
- Use setOption instead.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {array}
- getAttributeExtremes(name)
-
-
-
- getAttributeExtremes returns the minimum/maximum of "field" from all markers
-
-
-
-
-
-
-
-
-
Parameters:
-
-
- {field}name
-
-
-
of "field" to query
-
-
-
-
-
-
-
-
-
Returns:
-
-
{array} of minimum/maximum
-
-
-
-
-
-
-
-
-
-
-
- {BoundingBox}
- getBounds()
-
-
-
- Gets the BoundingBox of the map
-
-
-
-
-
-
-
-
-
-
-
-
-
Returns:
-
-
{BoundingBox} The bounding box for the current map state
-
-
-
-
-
-
-
-
-
-
-
- {LatLonPoint}
- getCenter()
-
-
-
- Gets the central point of the map
-
-
-
-
-
-
-
-
-
-
-
-
-
Returns:
-
-
{LatLonPoint} The center point of the map
-
-
-
-
-
-
-
-
-
-
-
-
- getMap()
-
-
-
- getMap returns the native map object that mapstraction is talking to
-
-
-
-
-
-
-
-
-
-
-
-
-
Returns:
-
-
the native map object mapstraction is using
-
-
-
-
-
-
-
-
-
-
-
- {Number}
- getMapType()
-
-
-
- Gets the imagery type for the map.
The type can be one of:
mxn.Mapstraction.ROAD
mxn.Mapstraction.SATELLITE
mxn.Mapstraction.HYBRID
mxn.Mapstraction.PHYSICAL
-
-
-
-
-
-
-
-
-
-
-
-
-
Returns:
-
-
{Number}
-
-
-
-
-
-
-
-
-
-
-
- {Float}
- getPixelRatio()
-
-
-
- Returns a ratio to turn distance into pixels based on current projection
-
-
-
- Returns the best zoom level for bounds given
-
-
-
-
-
-
-
-
-
Parameters:
-
-
- {BoundingBox}bbox
-
-
-
The bounds to fit
-
-
-
-
-
-
-
-
-
Returns:
-
-
{Integer} The closest zoom level that contains the bounding box
-
-
-
-
-
-
-
-
-
-
-
-
- isLoaded(api)
-
-
-
- Returns the loaded state of a Map Provider
-
-
-
-
-
-
-
-
-
Parameters:
-
-
- {String}api
-
-
-
Optional API to query for. If not specified, returns state of the originally created API
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- mousePosition(element)
-
-
-
- Displays the coordinates of the cursor in the HTML element
-
-
-
-
-
-
-
-
-
Parameters:
-
-
- {String}element
-
-
-
ID of the HTML element to display the coordinates in
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- moveendHandler(me)
-
-
-
-
-
-
-
-
-
-
-
-
-
Parameters:
-
-
- me
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- polylineCenterAndZoom(padding)
-
-
-
- Automatically sets center and zoom level to show all polylines
-
-
-
-
-
-
-
-
-
Parameters:
-
-
- {Number}padding
-
-
-
Optional number of kilometers to pad around polyline
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- removeAllFilters()
-
-
-
- removeAllFilters
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- removeAllMarkers()
-
-
-
- removeAllMarkers removes all the Markers on a map
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- removeAllPolylines()
-
-
-
- Removes all polylines from the map
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- removeFilter(field, operator, value)
-
-
-
- Remove the specified filter
-
-
-
-
-
-
-
-
-
Parameters:
-
-
- {Object}field
-
-
-
-
-
- {Object}operator
-
-
-
-
-
- {Object}value
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- removeMarker(marker)
-
-
-
- removeMarker removes a Marker from the map
-
-
-
-
-
-
-
-
-
Parameters:
-
-
- {Marker}marker
-
-
-
The marker to remove
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- removePolyline(polyline)
-
-
-
- Remove the polyline from the map
-
-
-
-
-
-
-
-
-
Parameters:
-
-
- {Polyline}polyline
-
-
-
The Polyline to remove from the map
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- resizeTo(width, height)
-
-
-
- Resize the current map to the specified width and height
(since it is actually on a child div of the mapElement passed
as argument to the Mapstraction constructor, the resizing of this
mapElement may have no effect on the size of the actual map)
-
-
-
-
-
-
-
-
-
Parameters:
-
-
- {Integer}width
-
-
-
The width the map should be.
-
-
- {Integer}height
-
-
-
The width the map should be.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- runDeferred()
-
-
-
- Run any queued provider API calls for the methods defined in the provider's implementation.
For example, if defferable in mxn.[provider].core.js is set to {getCenter: true, setCenter: true}
then any calls to map.setCenter or map.getCenter will be queued up in this.onload. When the provider's
implementation loads the map, it calls this.runDeferred and any queued calls will be run.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- setBounds(bounds)
-
-
-
- Sets the map to the appropriate location and zoom for a given BoundingBox
-
-
-
-
-
-
-
-
-
Parameters:
-
-
- {BoundingBox}bounds
-
-
-
The bounding box you want the map to show
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- setCenter(point, options)
-
-
-
- setCenter sets the central point of the map
-
-
-
-
-
-
-
-
-
Parameters:
-
-
- {LatLonPoint}point
-
-
-
The point at which to center the map
-
-
- {Object}options
-
-
-
Optional parameters
-
-
- {Boolean}options.pan
-
-
-
Whether the map should move to the locations using a pan or just jump straight there
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- setCenterAndZoom(point, zoom)
-
-
-
- Centers the map to some place and zoom level
-
-
-
-
-
-
-
-
-
Parameters:
-
-
- {LatLonPoint}point
-
-
-
Where the center of the map should be
-
-
- {Integer}zoom
-
-
-
The zoom level where 0 is all the way out.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- setDebug(debug)
-
-
-
- Set the debugging on or off - shows alert panels for functions that don't exist in Mapstraction
-
-
-
-
-
-
-
-
-
Parameters:
-
-
- {Boolean}debug
-
-
-
true to turn on debugging, false to turn it off
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- setDefer(set)
-
-
-
- Set the api call deferment on or off - When it's on, mxn.invoke will queue up provider API calls until
runDeferred is called, at which time everything in the queue will be run in the order it was added.
-
-
-
-
-
-
-
-
-
Parameters:
-
-
- {Boolean}set
-
-
-
deferred to true to turn on deferment
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- setImageOpacity(id, opacity)
-
-
-
-
-
-
-
-
-
-
-
-
-
Parameters:
-
-
- id
-
-
-
-
-
- opacity
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- setImagePosition(id)
-
-
-
-
-
-
-
-
-
-
-
-
-
Parameters:
-
-
- id
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- setMapType(type)
-
-
-
- Sets the imagery type for the map
The type can be one of:
mxn.Mapstraction.ROAD
mxn.Mapstraction.SATELLITE
mxn.Mapstraction.HYBRID
mxn.Mapstraction.PHYSICAL
-
-
-
-
-
-
-
-
-
Parameters:
-
-
- {Number}type
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- setOption(sOptName, vVal)
-
-
-
- Sets an option and applies it.
-
-
-
-
-
-
-
-
-
Parameters:
-
-
- {String}sOptName
-
-
-
Option name
-
-
- vVal
-
-
-
Option value
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- setOptions(oOpts)
-
-
-
- Sets the current options to those specified in oOpts and applies them
-
-
-
-
-
-
-
-
-
Parameters:
-
-
- {Object}oOpts
-
-
-
Hash of options to set
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- setZoom(zoom)
-
-
-
- Sets the zoom level for the map
MS doesn't seem to do zoom=0, and Gg's sat goes closer than it's maps, and MS's sat goes closer than Y!'s
TODO: Mapstraction.prototype.getZoomLevels or something.
-
-
-
-
-
-
-
-
-
Parameters:
-
-
- {Number}zoom
-
-
-
The (native to the map) level zoom the map to.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- swap(api, element)
-
-
-
- Change the current api on the fly
-
-
-
-
-
-
-
-
-
Parameters:
-
-
- {String}api
-
-
-
The API to swap to
-
-
- element
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- toggleFilter(field, operator, value)
-
-
-
- Delete the current filter if present; otherwise add it
-
-
-
-
-
-
-
-
-
Parameters:
-
-
- {Object}field
-
-
-
-
-
- {Object}operator
-
-
-
-
-
- {Object}value
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- toggleTileLayer(url)
-
-
-
- Turns a Tile Layer on or off
-
-
-
-
-
-
-
-
-
Parameters:
-
-
- {tile_url}url
-
-
-
of the tile layer that was created.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- visibleCenterAndZoom()
-
-
-
- Sets the center and zoom of the map to the smallest bounding box
containing all visible markers and polylines
will only include markers and polylines with an attribute of "visible"
-
-
-
- Convert longitude to metres
http://www.uwgb.edu/dutchs/UsefulData/UTMFormulas.HTM
"A degree of longitude at the equator is 111.2km... For other latitudes,
multiply by cos(lat)"
assumes the earth is a sphere but good enough for our purposes
-
-
-
-
-
-
-
-
-
Parameters:
-
-
- {Float}lon
-
-
-
-
-
- {Float}lat
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- mxn.util.merge(oRecv, oGive)
-
-
-
- Merges properties of one object into another recursively.
-
-
-
- Formats a string, inserting values of subsequent parameters at specified
locations. e.g. stringFormat('{0} {1}', 'hello', 'world');
-
-
-
-
-
-
-
-
-
Parameters:
-
-
- strIn
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<static>
-
-
- mxn.util.traverse(start)
-
-
-
- Traverses an object graph using a series of map functions provided as arguments
2 to n. Map functions are only called if the working object is not undefined/null.
For usage see mxn.google.geocoder.js.
-
-
-
1(function(){
- 2
- 3/**
- 4 * @exports mxn.util.$m as $m
- 5 */
- 6var$m=mxn.util.$m;
- 7
- 8/**
- 9 * Initialise our provider. This function should only be called
- 10 * from within mapstraction code, not exposed as part of the API.
- 11 * @private
- 12 */
- 13varinit=function(){
- 14this.invoker.go('init',[this.currentElement,this.api]);
- 15this.applyOptions();
- 16};
- 17
- 18/**
- 19 * Mapstraction instantiates a map with some API choice into the HTML element given
- 20 * @name mxn.Mapstraction
- 21 * @constructor
- 22 * @param {String} element The HTML element to replace with a map
- 23 * @param {String} api The API to use, one of 'google', 'googlev3', 'yahoo', 'microsoft', 'openstreetmap', 'multimap', 'map24', 'openlayers', 'mapquest'. If omitted, first loaded provider implementation is used.
- 24 * @param {Bool} debug optional parameter to turn on debug support - this uses alert panels for unsupported actions
- 25 * @exports Mapstraction as mxn.Mapstraction
- 26 */
- 27varMapstraction=mxn.Mapstraction=function(element,api,debug){
- 28if(!api){
- 29api=mxn.util.getAvailableProviders()[0];
- 30}
- 31
- 32/**
- 33 * The name of the active API.
- 34 * @name mxn.Mapstraction#api
- 35 * @type {String}
- 36 */
- 37this.api=api;
- 38
- 39this.maps={};
- 40
- 41/**
- 42 * The DOM element containing the map.
- 43 * @name mxn.Mapstraction#currentElement
- 44 * @property
- 45 * @type {DOMElement}
- 46 */
- 47this.currentElement=$m(element);
- 48
- 49this.eventListeners=[];
- 50
- 51/**
- 52 * The array of all layers that have been added to the map.
- 53 */
- 54this.tileLayers=[];
- 55
- 56/**
- 57 * The markers currently loaded.
- 58 * @name mxn.Mapstraction#markers
- 59 * @property
- 60 * @type {Array}
- 61 */
- 62this.markers=[];
- 63
- 64/**
- 65 * The polylines currently loaded.
- 66 * @name mxn.Mapstraction#polylines
- 67 * @property
- 68 * @type {Array}
- 69 */
- 70this.polylines=[];
- 71
- 72this.images=[];
- 73this.controls=[];
- 74this.loaded={};
- 75this.onload={};
- 76//this.loaded[api] = true; // FIXME does this need to be true? -ajturner
- 77this.onload[api]=[];
- 78
- 79/**
- 80 * The original element value passed to the constructor.
- 81 * @name mxn.Mapstraction#element
- 82 * @property
- 83 * @type {String|DOMElement}
- 84 */
- 85this.element=element;
- 86
- 87/**
- 88 * Options defaults.
- 89 * @name mxn.Mapstraction#options
- 90 * @property {Object}
- 91 */
- 92this.options={
- 93enableScrollWheelZoom:false,
- 94enableDragging:true
- 95};
- 96
- 97this.addControlsArgs={};
- 98
- 99// set up our invoker for calling API methods
-100this.invoker=newmxn.Invoker(this,'Mapstraction',function(){returnthis.api;});
-101
-102// Adding our events
-103mxn.addEvents(this,[
-104
-105/**
-106 * Map has loaded
-107 * @name mxn.Mapstraction#load
-108 * @event
-109 */
-110'load',
-111
-112/**
-113 * Map is clicked {location: LatLonPoint}
-114 * @name mxn.Mapstraction#click
-115 * @event
-116 */
-117'click',
-118
-119/**
-120 * Map is panned
-121 * @name mxn.Mapstraction#endPan
-122 * @event
-123 */
-124'endPan',
-125
-126/**
-127 * Zoom is changed
-128 * @name mxn.Mapstraction#changeZoom
-129 * @event
-130 */
-131'changeZoom',
-132
-133/**
-134 * Marker is added {marker: Marker}
-135 * @name mxn.Mapstraction#markerAdded
-136 * @event
-137 */
-138'markerAdded',
-139
-140/**
-141 * Marker is removed {marker: Marker}
-142 * @name mxn.Mapstraction#markerRemoved
-143 * @event
-144 */
-145'markerRemoved',
-146
-147/**
-148 * Polyline is added {polyline: Polyline}
-149 * @name mxn.Mapstraction#polylineAdded
-150 * @event
-151 */
-152'polylineAdded',
-153
-154/**
-155 * Polyline is removed {polyline: Polyline}
-156 * @name mxn.Mapstraction#polylineRemoved
-157 * @event
-158 */
-159'polylineRemoved'
-160]);
-161
-162// finally initialize our proper API map
-163init.apply(this);
-164};
-165
-166// Map type constants
-167Mapstraction.ROAD=1;
-168Mapstraction.SATELLITE=2;
-169Mapstraction.HYBRID=3;
-170Mapstraction.PHYSICAL=4;
-171
-172// methods that have no implementation in mapstraction core
-173mxn.addProxyMethods(Mapstraction,[
-174/**
-175 * Adds a large map panning control and zoom buttons to the map
-176 * @name mxn.Mapstraction#addLargeControls
-177 * @function
-178 */
-179'addLargeControls',
-180
-181/**
-182 * Adds a map type control to the map (streets, aerial imagery etc)
-183 * @name mxn.Mapstraction#addMapTypeControls
-184 * @function
-185 */
-186'addMapTypeControls',
-187
-188/**
-189 * Adds a GeoRSS or KML overlay to the map
-190 * some flavors of GeoRSS and KML are not supported by some of the Map providers
-191 * @name mxn.Mapstraction#addOverlay
-192 * @function
-193 * @param {String} url GeoRSS or KML feed URL
-194 * @param {Boolean} autoCenterAndZoom Set true to auto center and zoom after the feed is loaded
-195 */
-196'addOverlay',
-197
-198/**
-199 * Adds a small map panning control and zoom buttons to the map
-200 * @name mxn.Mapstraction#addSmallControls
-201 * @function
-202 */
-203'addSmallControls',
-204
-205/**
-206 * Applies the current option settings
-207 * @name mxn.Mapstraction#applyOptions
-208 * @function
-209 */
-210'applyOptions',
-211
-212/**
-213 * Gets the BoundingBox of the map
-214 * @name mxn.Mapstraction#getBounds
-215 * @function
-216 * @returns {BoundingBox} The bounding box for the current map state
-217 */
-218'getBounds',
-219
-220/**
-221 * Gets the central point of the map
-222 * @name mxn.Mapstraction#getCenter
-223 * @function
-224 * @returns {LatLonPoint} The center point of the map
-225 */
-226'getCenter',
-227
-228/**
-229 * Gets the imagery type for the map.
-230 * The type can be one of:
-231 * mxn.Mapstraction.ROAD
-232 * mxn.Mapstraction.SATELLITE
-233 * mxn.Mapstraction.HYBRID
-234 * mxn.Mapstraction.PHYSICAL
-235 * @name mxn.Mapstraction#getMapType
-236 * @function
-237 * @returns {Number}
-238 */
-239'getMapType',
-240
-241/**
-242 * Returns a ratio to turn distance into pixels based on current projection
-243 * @name mxn.Mapstraction#getPixelRatio
-244 * @function
-245 * @returns {Float} ratio
-246 */
-247'getPixelRatio',
-248
-249/**
-250 * Returns the zoom level of the map
-251 * @name mxn.Mapstraction#getZoom
-252 * @function
-253 * @returns {Integer} The zoom level of the map
-254 */
-255'getZoom',
-256
-257/**
-258 * Returns the best zoom level for bounds given
-259 * @name mxn.Mapstraction#getZoomLevelForBoundingBox
-260 * @function
-261 * @param {BoundingBox} bbox The bounds to fit
-262 * @returns {Integer} The closest zoom level that contains the bounding box
-263 */
-264'getZoomLevelForBoundingBox',
-265
-266/**
-267 * Displays the coordinates of the cursor in the HTML element
-268 * @name mxn.Mapstraction#mousePosition
-269 * @function
-270 * @param {String} element ID of the HTML element to display the coordinates in
-271 */
-272'mousePosition',
-273
-274/**
-275 * Resize the current map to the specified width and height
-276 * (since it is actually on a child div of the mapElement passed
-277 * as argument to the Mapstraction constructor, the resizing of this
-278 * mapElement may have no effect on the size of the actual map)
-279 * @name mxn.Mapstraction#resizeTo
-280 * @function
-281 * @param {Integer} width The width the map should be.
-282 * @param {Integer} height The width the map should be.
-283 */
-284'resizeTo',
-285
-286/**
-287 * Sets the map to the appropriate location and zoom for a given BoundingBox
-288 * @name mxn.Mapstraction#setBounds
-289 * @function
-290 * @param {BoundingBox} bounds The bounding box you want the map to show
-291 */
-292'setBounds',
-293
-294/**
-295 * setCenter sets the central point of the map
-296 * @name mxn.Mapstraction#setCenter
-297 * @function
-298 * @param {LatLonPoint} point The point at which to center the map
-299 * @param {Object} options Optional parameters
-300 * @param {Boolean} options.pan Whether the map should move to the locations using a pan or just jump straight there
-301 */
-302'setCenter',
-303
-304/**
-305 * Centers the map to some place and zoom level
-306 * @name mxn.Mapstraction#setCenterAndZoom
-307 * @function
-308 * @param {LatLonPoint} point Where the center of the map should be
-309 * @param {Integer} zoom The zoom level where 0 is all the way out.
-310 */
-311'setCenterAndZoom',
-312
-313/**
-314 * Sets the imagery type for the map
-315 * The type can be one of:
-316 * mxn.Mapstraction.ROAD
-317 * mxn.Mapstraction.SATELLITE
-318 * mxn.Mapstraction.HYBRID
-319 * mxn.Mapstraction.PHYSICAL
-320 * @name mxn.Mapstraction#setMapType
-321 * @function
-322 * @param {Number} type
-323 */
-324'setMapType',
-325
-326/**
-327 * Sets the zoom level for the map
-328 * MS doesn't seem to do zoom=0, and Gg's sat goes closer than it's maps, and MS's sat goes closer than Y!'s
-329 * TODO: Mapstraction.prototype.getZoomLevels or something.
-330 * @name mxn.Mapstraction#setZoom
-331 * @function
-332 * @param {Number} zoom The (native to the map) level zoom the map to.
-333 */
-334'setZoom',
-335
-336/**
-337 * Turns a Tile Layer on or off
-338 * @name mxn.Mapstraction#toggleTileLayer
-339 * @function
-340 * @param {tile_url} url of the tile layer that was created.
-341 */
-342'toggleTileLayer'
-343]);
-344
-345/**
-346 * Sets the current options to those specified in oOpts and applies them
-347 * @param {Object} oOpts Hash of options to set
-348 */
-349Mapstraction.prototype.setOptions=function(oOpts){
-350mxn.util.merge(this.options,oOpts);
-351this.applyOptions();
-352};
-353
-354/**
-355 * Sets an option and applies it.
-356 * @param {String} sOptName Option name
-357 * @param vVal Option value
-358 */
-359Mapstraction.prototype.setOption=function(sOptName,vVal){
-360this.options[sOptName]=vVal;
-361this.applyOptions();
-362};
-363
-364/**
-365 * Enable scroll wheel zooming
-366 * @deprecated Use setOption instead.
-367 */
-368Mapstraction.prototype.enableScrollWheelZoom=function(){
-369this.setOption('enableScrollWheelZoom',true);
-370};
-371
-372/**
-373 * Enable/disable dragging of the map
-374 * @param {Boolean} on
-375 * @deprecated Use setOption instead.
-376 */
-377Mapstraction.prototype.dragging=function(on){
-378this.setOption('enableDragging',on);
-379};
-380
-381/**
-382 * Change the current api on the fly
-383 * @param {String} api The API to swap to
-384 * @param element
-385 */
-386Mapstraction.prototype.swap=function(element,api){
-387if(this.api===api){
-388return;
-389}
-390
-391varcenter=this.getCenter();
-392varzoom=this.getZoom();
-393
-394this.currentElement.style.visibility='hidden';
-395this.currentElement.style.display='none';
-396
-397this.currentElement=$m(element);
-398this.currentElement.style.visibility='visible';
-399this.currentElement.style.display='block';
-400
-401this.api=api;
-402this.onload[api]=[];
-403
-404if(this.maps[this.api]===undefined){
-405init.apply(this);
-406
-407for(vari=0;i<this.markers.length;i++){
-408this.addMarker(this.markers[i],true);
-409}
-410
-411for(varj=0;j<this.polylines.length;j++){
-412this.addPolyline(this.polylines[j],true);
-413}
-414
-415this.setCenterAndZoom(center,zoom);
-416}
-417else{
-418
-419//sync the view
-420this.setCenterAndZoom(center,zoom);
-421
-422//TODO synchronize the markers and polylines too
-423// (any overlays created after api instantiation are not sync'd)
-424}
-425
-426this.addControls(this.addControlsArgs);
-427
-428};
-429
-430/**
-431 * Returns the loaded state of a Map Provider
-432 * @param {String} api Optional API to query for. If not specified, returns state of the originally created API
-433 */
-434Mapstraction.prototype.isLoaded=function(api){
-435if(api===null){
-436api=this.api;
-437}
-438returnthis.loaded[api];
-439};
-440
-441/**
-442 * Set the debugging on or off - shows alert panels for functions that don't exist in Mapstraction
-443 * @param {Boolean} debug true to turn on debugging, false to turn it off
-444 */
-445Mapstraction.prototype.setDebug=function(debug){
-446if(debug!==null){
-447this.debug=debug;
-448}
-449returnthis.debug;
-450};
-451
-452/**
-453 * Set the api call deferment on or off - When it's on, mxn.invoke will queue up provider API calls until
-454 * runDeferred is called, at which time everything in the queue will be run in the order it was added.
-455 * @param {Boolean} set deferred to true to turn on deferment
-456 */
-457Mapstraction.prototype.setDefer=function(deferred){
-458this.loaded[this.api]=!deferred;
-459};
-460
-461/**
-462 * Run any queued provider API calls for the methods defined in the provider's implementation.
-463 * For example, if defferable in mxn.[provider].core.js is set to {getCenter: true, setCenter: true}
-464 * then any calls to map.setCenter or map.getCenter will be queued up in this.onload. When the provider's
-465 * implementation loads the map, it calls this.runDeferred and any queued calls will be run.
-466 */
-467Mapstraction.prototype.runDeferred=function(){
-468while(this.onload[this.api].length>0){
-469this.onload[this.api].shift().apply(this);//run deferred calls
-470}
-471};
-472
-473/////////////////////////
-474//
-475// Event Handling
-476//
-477// FIXME need to consolidate some of these handlers...
-478//
-479///////////////////////////
-480
-481// Click handler attached to native API
-482Mapstraction.prototype.clickHandler=function(lat,lon,me){
-483this.callEventListeners('click',{
-484location:newLatLonPoint(lat,lon)
-485});
-486};
-487
-488// Move and zoom handler attached to native API
-489Mapstraction.prototype.moveendHandler=function(me){
-490this.callEventListeners('moveend',{});
-491};
-492
-493/**
-494 * Add a listener for an event.
-495 * @param {String} type Event type to attach listener to
-496 * @param {Function} func Callback function
-497 * @param {Object} caller Callback object
-498 */
-499Mapstraction.prototype.addEventListener=function(){
-500varlistener={};
-501listener.event_type=arguments[0];
-502listener.callback_function=arguments[1];
-503
-504// added the calling object so we can retain scope of callback function
-505if(arguments.length==3){
-506listener.back_compat_mode=false;
-507listener.callback_object=arguments[2];
-508}
-509else{
-510listener.back_compat_mode=true;
-511listener.callback_object=null;
-512}
-513this.eventListeners.push(listener);
-514};
-515
-516/**
-517 * Call listeners for a particular event.
-518 * @param {String} sEventType Call listeners of this event type
-519 * @param {Object} oEventArgs Event args object to pass back to the callback
-520 */
-521Mapstraction.prototype.callEventListeners=function(sEventType,oEventArgs){
-522oEventArgs.source=this;
-523for(vari=0;i<this.eventListeners.length;i++){
-524varevLi=this.eventListeners[i];
-525if(evLi.event_type==sEventType){
-526// only two cases for this, click and move
-527if(evLi.back_compat_mode){
-528if(evLi.event_type=='click'){
-529evLi.callback_function(oEventArgs.location);
-530}
-531else{
-532evLi.callback_function();
-533}
-534}
-535else{
-536varscope=evLi.callback_object||this;
-537evLi.callback_function.call(scope,oEventArgs);
-538}
-539}
-540}
-541};
-542
-543
-544////////////////////
-545//
-546// map manipulation
-547//
-548/////////////////////
-549
-550
-551/**
-552 * addControls adds controls to the map. You specify which controls to add in
-553 * the associative array that is the only argument.
-554 * addControls can be called multiple time, with different args, to dynamically change controls.
-555 *
-556 * args = {
-557 * pan: true,
-558 * zoom: 'large' || 'small',
-559 * overview: true,
-560 * scale: true,
-561 * map_type: true,
-562 * }
-563 * @param {array} args Which controls to switch on
-564 */
-565Mapstraction.prototype.addControls=function(args){
-566this.addControlsArgs=args;
-567this.invoker.go('addControls',arguments);
-568};
-569
-570/**
-571 * Adds a marker pin to the map
-572 * @param {Marker} marker The marker to add
-573 * @param {Boolean} old If true, doesn't add this marker to the markers array. Used by the "swap" method
-574 */
-575Mapstraction.prototype.addMarker=function(marker,old){
-576marker.mapstraction=this;
-577marker.api=this.api;
-578marker.location.api=this.api;
-579marker.map=this.maps[this.api];
-580varpropMarker=this.invoker.go('addMarker',arguments);
-581marker.setChild(propMarker);
-582if(!old){
-583this.markers.push(marker);
-584}
-585this.markerAdded.fire({'marker':marker});
-586};
-587
-588/**
-589 * addMarkerWithData will addData to the marker, then add it to the map
-590 * @param {Marker} marker The marker to add
-591 * @param {Object} data A data has to add
-592 */
-593Mapstraction.prototype.addMarkerWithData=function(marker,data){
-594marker.addData(data);
-595this.addMarker(marker);
-596};
-597
-598/**
-599 * addPolylineWithData will addData to the polyline, then add it to the map
-600 * @param {Polyline} polyline The polyline to add
-601 * @param {Object} data A data has to add
-602 */
-603Mapstraction.prototype.addPolylineWithData=function(polyline,data){
-604polyline.addData(data);
-605this.addPolyline(polyline);
-606};
-607
-608/**
-609 * removeMarker removes a Marker from the map
-610 * @param {Marker} marker The marker to remove
-611 */
-612Mapstraction.prototype.removeMarker=function(marker){
-613varcurrent_marker;
-614for(vari=0;i<this.markers.length;i++){
-615current_marker=this.markers[i];
-616if(marker==current_marker){
-617this.invoker.go('removeMarker',arguments);
-618marker.onmap=false;
-619this.markers.splice(i,1);
-620this.markerRemoved.fire({'marker':marker});
-621break;
-622}
-623}
-624};
-625
-626/**
-627 * removeAllMarkers removes all the Markers on a map
-628 */
-629Mapstraction.prototype.removeAllMarkers=function(){
-630varcurrent_marker;
-631while(this.markers.length>0){
-632current_marker=this.markers.pop();
-633this.invoker.go('removeMarker',[current_marker]);
-634}
-635};
-636
-637/**
-638 * Declutter the markers on the map, group together overlapping markers.
-639 * @param {Object} opts Declutter options
-640 */
-641Mapstraction.prototype.declutterMarkers=function(opts){
-642if(this.loaded[this.api]===false){
-643varme=this;
-644this.onload[this.api].push(function(){
-645me.declutterMarkers(opts);
-646});
-647return;
-648}
-649
-650varmap=this.maps[this.api];
-651
-652switch(this.api)
-653{
-654// case 'yahoo':
-655//
-656// break;
-657// case 'google':
-658//
-659// break;
-660// case 'openstreetmap':
-661//
-662// break;
-663// case 'microsoft':
-664//
-665// break;
-666// case 'openlayers':
-667//
-668// break;
-669case'multimap':
-670/*
-671 * Multimap supports quite a lot of decluttering options such as whether
-672 * to use an accurate of fast declutter algorithm and what icon to use to
-673 * represent a cluster. Using all this would mean abstracting all the enums
-674 * etc so we're only implementing the group name function at the moment.
-675 */
-676map.declutterGroup(opts.groupName);
-677break;
-678// case 'mapquest':
-679//
-680// break;
-681// case 'map24':
-682//
-683// break;
-684case' dummy':
-685break;
-686default:
-687if(this.debug){
-688alert(this.api+' not supported by Mapstraction.declutterMarkers');
-689}
-690}
-691};
-692
-693/**
-694 * Add a polyline to the map
-695 * @param {Polyline} polyline The Polyline to add to the map
-696 * @param {Boolean} old If true replaces an existing Polyline
-697 */
-698Mapstraction.prototype.addPolyline=function(polyline,old){
-699polyline.api=this.api;
-700polyline.map=this.maps[this.api];
-701varpropPoly=this.invoker.go('addPolyline',arguments);
-702polyline.setChild(propPoly);
-703if(!old){
-704this.polylines.push(polyline);
-705}
-706this.polylineAdded.fire({'polyline':polyline});
-707};
-708
-709// Private remove implementation
-710varremovePolylineImpl=function(polyline){
-711this.invoker.go('removePolyline',arguments);
-712polyline.onmap=false;
-713this.polylineRemoved.fire({'polyline':polyline});
-714};
-715
-716/**
-717 * Remove the polyline from the map
-718 * @param {Polyline} polyline The Polyline to remove from the map
-719 */
-720Mapstraction.prototype.removePolyline=function(polyline){
-721varcurrent_polyline;
-722for(vari=0;i<this.polylines.length;i++){
-723current_polyline=this.polylines[i];
-724if(polyline==current_polyline){
-725this.polylines.splice(i,1);
-726removePolylineImpl.call(this,polyline);
-727break;
-728}
-729}
-730};
-731
-732/**
-733 * Removes all polylines from the map
-734 */
-735Mapstraction.prototype.removeAllPolylines=function(){
-736varcurrent_polyline;
-737while(this.polylines.length>0){
-738current_polyline=this.polylines.pop();
-739removePolylineImpl.call(this,current_polyline);
-740}
-741};
-742
-743varcollectPoints=function(bMarkers,bPolylines,predicate){
-744varpoints=[];
-745
-746if(bMarkers){
-747for(vari=0;i<this.markers.length;i++){
-748varmark=this.markers[i];
-749if(!predicate||predicate(mark)){
-750points.push(mark.location);
-751}
-752}
-753}
-754
-755if(bPolylines){
-756for(i=0;i<this.polylines.length;i++){
-757varpoly=this.polylines[i];
-758if(!predicate||predicate(poly)){
-759for(varj=0;j<poly.points.length;j++){
-760points.push(poly.points[j]);
-761}
-762}
-763}
-764}
-765
-766returnpoints;
-767};
-768
-769/**
-770 * Sets the center and zoom of the map to the smallest bounding box
-771 * containing all markers and polylines
-772 */
-773Mapstraction.prototype.autoCenterAndZoom=function(){
-774varpoints=collectPoints.call(this,true,true);
-775
-776this.centerAndZoomOnPoints(points);
-777};
-778
-779/**
-780 * centerAndZoomOnPoints sets the center and zoom of the map from an array of points
-781 *
-782 * This is useful if you don't want to have to add markers to the map
-783 */
-784Mapstraction.prototype.centerAndZoomOnPoints=function(points){
-785varbounds=newBoundingBox(90,180,-90,-180);
-786
-787for(vari=0,len=points.length;i<len;i++){
-788bounds.extend(points[i]);
-789}
-790
-791this.setBounds(bounds);
-792};
-793
-794/**
-795 * Sets the center and zoom of the map to the smallest bounding box
-796 * containing all visible markers and polylines
-797 * will only include markers and polylines with an attribute of "visible"
-798 */
-799Mapstraction.prototype.visibleCenterAndZoom=function(){
-800varpredicate=function(obj){
-801returnobj.getAttribute("visible");
-802};
-803varpoints=collectPoints.call(this,true,true,predicate);
-804
-805this.centerAndZoomOnPoints(points);
-806};
-807
-808/**
-809 * Automatically sets center and zoom level to show all polylines
-810 * @param {Number} padding Optional number of kilometers to pad around polyline
-811 */
-812Mapstraction.prototype.polylineCenterAndZoom=function(padding){
-813padding=padding||0;
-814
-815varpoints=collectPoints.call(this,false,true);
-816
-817if(padding>0){
-818varpadPoints=[];
-819for(vari=0;i<points.length;i++){
-820varpoint=points[i];
-821
-822varkmInOneDegreeLat=point.latConv();
-823varkmInOneDegreeLon=point.lonConv();
-824
-825varlatPad=padding/kmInOneDegreeLat;
-826varlonPad=padding/kmInOneDegreeLon;
-827
-828varne=newLatLonPoint(point.lat+latPad,point.lon+lonPad);
-829varsw=newLatLonPoint(point.lat-latPad,point.lon-lonPad);
-830
-831padPoints.push(ne,sw);
-832}
-833points=points.concat(padPoints);
-834}
-835
-836this.centerAndZoomOnPoints(points);
-837};
-838
-839/**
-840 * addImageOverlay layers an georeferenced image over the map
-841 * @param {id} unique DOM identifier
-842 * @param {src} url of image
-843 * @param {opacity} opacity 0-100
-844 * @param {west} west boundary
-845 * @param {south} south boundary
-846 * @param {east} east boundary
-847 * @param {north} north boundary
-848 */
-849Mapstraction.prototype.addImageOverlay=function(id,src,opacity,west,south,east,north){
-850
-851varb=document.createElement("img");
-852b.style.display='block';
-853b.setAttribute('id',id);
-854b.setAttribute('src',src);
-855b.style.position='absolute';
-856b.style.zIndex=1;
-857b.setAttribute('west',west);
-858b.setAttribute('south',south);
-859b.setAttribute('east',east);
-860b.setAttribute('north',north);
-861
-862varoContext={
-863imgElm:b
-864};
-865
-866this.invoker.go('addImageOverlay',arguments,{context:oContext});
-867};
-868
-869Mapstraction.prototype.setImageOpacity=function(id,opacity){
-870if(opacity<0){
-871opacity=0;
-872}
-873if(opacity>=100){
-874opacity=100;
-875}
-876varc=opacity/100;
-877vard=document.getElementById(id);
-878if(typeof(d.style.filter)=='string'){
-879d.style.filter='alpha(opacity:'+opacity+')';
-880}
-881if(typeof(d.style.KHTMLOpacity)=='string'){
-882d.style.KHTMLOpacity=c;
-883}
-884if(typeof(d.style.MozOpacity)=='string'){
-885d.style.MozOpacity=c;
-886}
-887if(typeof(d.style.opacity)=='string'){
-888d.style.opacity=c;
-889}
-890};
-891
-892Mapstraction.prototype.setImagePosition=function(id){
-893varimgElement=document.getElementById(id);
-894varoContext={
-895latLng:{
-896top:imgElement.getAttribute('north'),
-897left:imgElement.getAttribute('west'),
-898bottom:imgElement.getAttribute('south'),
-899right:imgElement.getAttribute('east')
-900},
-901pixels:{top:0,right:0,bottom:0,left:0}
-902};
-903
-904this.invoker.go('setImagePosition',arguments,{context:oContext});
-905
-906imgElement.style.top=oContext.pixels.top.toString()+'px';
-907imgElement.style.left=oContext.pixels.left.toString()+'px';
-908imgElement.style.width=(oContext.pixels.right-oContext.pixels.left).toString()+'px';
-909imgElement.style.height=(oContext.pixels.bottom-oContext.pixels.top).toString()+'px';
-910};
-911
-912Mapstraction.prototype.addJSON=function(json){
-913varfeatures;
-914if(typeof(json)=="string"){
-915features=eval('('+json+')');
-916}else{
-917features=json;
-918}
-919features=features.features;
-920varmap=this.maps[this.api];
-921varhtml="";
-922varitem;
-923varpolyline;
-924varmarker;
-925varmarkers=[];
-926
-927if(features.type=="FeatureCollection"){
-928this.addJSON(features.features);
-929}
-930
-931for(vari=0;i<features.length;i++){
-932item=features[i];
-933switch(item.geometry.type){
-934case"Point":
-935html="<strong>"+item.title+"</strong><p>"+item.description+"</p>";
-936marker=newMarker(newLatLonPoint(item.geometry.coordinates[1],item.geometry.coordinates[0]));
-937markers.push(marker);
-938this.addMarkerWithData(marker,{
-939infoBubble:html,
-940label:item.title,
-941date:"new Date(\""+item.date+"\")",
-942iconShadow:item.icon_shadow,
-943marker:item.id,
-944iconShadowSize:item.icon_shadow_size,
-945icon:item.icon,
-946iconSize:item.icon_size,
-947category:item.source_id,
-948draggable:false,
-949hover:false
-950});
-951break;
-952case"Polygon":
-953varpoints=[];
-954polyline=newPolyline(points);
-955mapstraction.addPolylineWithData(polyline,{
-956fillColor:item.poly_color,
-957date:"new Date(\""+item.date+"\")",
-958category:item.source_id,
-959width:item.line_width,
-960opacity:item.line_opacity,
-961color:item.line_color,
-962polygon:true
-963});
-964markers.push(polyline);
-965break;
-966default:
-967// console.log("Geometry: " + features.items[i].geometry.type);
-968}
-969}
-970returnmarkers;
-971};
-972
-973/**
-974 * Adds a Tile Layer to the map
-975 *
-976 * Requires providing a parameterized tile url. Use {Z}, {X}, and {Y} to specify where the parameters
-977 * should go in the URL.
-978 *
-979 * For example, the OpenStreetMap tiles are:
-980 * m.addTileLayer("http://tile.openstreetmap.org/{Z}/{X}/{Y}.png", 1.0, "OSM", 1, 19, true);
-981 *
-982 * @param {tile_url} template url of the tiles.
-983 * @param {opacity} opacity of the tile layer - 0 is transparent, 1 is opaque. (default=0.6)
-984 * @param {copyright_text} copyright text to use for the tile layer. (default=Mapstraction)
-985 * @param {min_zoom} Minimum (furtherest out) zoom level that tiles are available (default=1)
-986 * @param {max_zoom} Maximum (closest) zoom level that the tiles are available (default=18)
-987 * @param {map_type} Should the tile layer be a selectable map type in the layers palette (default=false)
-988 */
-989Mapstraction.prototype.addTileLayer=function(tile_url,opacity,copyright_text,min_zoom,max_zoom,map_type){
-990if(!tile_url){
-991return;
-992}
-993
-994opacity=opacity||0.6;
-995copyright_text=copyright_text||"Mapstraction";
-996min_zoom=min_zoom||1;
-997max_zoom=max_zoom||18;
-998map_type=map_type||false;
-999
-1000returnthis.invoker.go('addTileLayer',[tile_url,opacity,copyright_text,min_zoom,max_zoom,map_type]);
-1001};
-1002
-1003/**
-1004 * addFilter adds a marker filter
-1005 * @param {field} name of attribute to filter on
-1006 * @param {operator} presently only "ge" or "le"
-1007 * @param {value} the value to compare against
-1008 */
-1009Mapstraction.prototype.addFilter=function(field,operator,value){
-1010if(!this.filters){
-1011this.filters=[];
-1012}
-1013this.filters.push([field,operator,value]);
-1014};
-1015
-1016/**
-1017 * Remove the specified filter
-1018 * @param {Object} field
-1019 * @param {Object} operator
-1020 * @param {Object} value
-1021 */
-1022Mapstraction.prototype.removeFilter=function(field,operator,value){
-1023if(!this.filters){
-1024return;
-1025}
-1026
-1027vardel;
-1028for(varf=0;f<this.filters.length;f++){
-1029if(this.filters[f][0]==field&&
-1030(!operator||(this.filters[f][1]==operator&&this.filters[f][2]==value))){
-1031this.filters.splice(f,1);
-1032f--;//array size decreased
-1033}
-1034}
-1035};
-1036
-1037/**
-1038 * Delete the current filter if present; otherwise add it
-1039 * @param {Object} field
-1040 * @param {Object} operator
-1041 * @param {Object} value
-1042 */
-1043Mapstraction.prototype.toggleFilter=function(field,operator,value){
-1044if(!this.filters){
-1045this.filters=[];
-1046}
-1047
-1048varfound=false;
-1049for(varf=0;f<this.filters.length;f++){
-1050if(this.filters[f][0]==field&&this.filters[f][1]==operator&&this.filters[f][2]==value){
-1051this.filters.splice(f,1);
-1052f--;//array size decreased
-1053found=true;
-1054}
-1055}
-1056
-1057if(!found){
-1058this.addFilter(field,operator,value);
-1059}
-1060};
-1061
-1062/**
-1063 * removeAllFilters
-1064 */
-1065Mapstraction.prototype.removeAllFilters=function(){
-1066this.filters=[];
-1067};
-1068
-1069/**
-1070 * doFilter executes all filters added since last call
-1071 * Now supports a callback function for when a marker is shown or hidden
-1072 * @param {Function} showCallback
-1073 * @param {Function} hideCallback
-1074 * @returns {Int} count of visible markers
-1075 */
-1076Mapstraction.prototype.doFilter=function(showCallback,hideCallback){
-1077varmap=this.maps[this.api];
-1078varvisibleCount=0;
-1079varf;
-1080if(this.filters){
-1081switch(this.api){
-1082case'multimap':
-1083/* TODO polylines aren't filtered in multimap */
-1084varmmfilters=[];
-1085for(f=0;f<this.filters.length;f++){
-1086mmfilters.push(newMMSearchFilter(this.filters[f][0],this.filters[f][1],this.filters[f][2]));
-1087}
-1088map.setMarkerFilters(mmfilters);
-1089map.redrawMap();
-1090break;
-1091case' dummy':
-1092break;
-1093default:
-1094varvis;
-1095for(varm=0;m<this.markers.length;m++){
-1096vis=true;
-1097for(f=0;f<this.filters.length;f++){
-1098if(!this.applyFilter(this.markers[m],this.filters[f])){
-1099vis=false;
-1100}
-1101}
-1102if(vis){
-1103visibleCount++;
-1104if(showCallback){
-1105showCallback(this.markers[m]);
-1106}
-1107else{
-1108this.markers[m].show();
-1109}
-1110}
-1111else{
-1112if(hideCallback){
-1113hideCallback(this.markers[m]);
-1114}
-1115else{
-1116this.markers[m].hide();
-1117}
-1118}
-1119
-1120this.markers[m].setAttribute("visible",vis);
-1121}
-1122break;
-1123}
-1124}
-1125returnvisibleCount;
-1126};
-1127
-1128Mapstraction.prototype.applyFilter=function(o,f){
-1129varvis=true;
-1130switch(f[1]){
-1131case'ge':
-1132if(o.getAttribute(f[0])<f[2]){
-1133vis=false;
-1134}
-1135break;
-1136case'le':
-1137if(o.getAttribute(f[0])>f[2]){
-1138vis=false;
-1139}
-1140break;
-1141case'eq':
-1142if(o.getAttribute(f[0])==f[2]){
-1143vis=false;
-1144}
-1145break;
-1146}
-1147
-1148returnvis;
-1149};
-1150
-1151/**
-1152 * getAttributeExtremes returns the minimum/maximum of "field" from all markers
-1153 * @param {field} name of "field" to query
-1154 * @returns {array} of minimum/maximum
-1155 */
-1156Mapstraction.prototype.getAttributeExtremes=function(field){
-1157varmin;
-1158varmax;
-1159for(varm=0;m<this.markers.length;m++){
-1160if(!min||min>this.markers[m].getAttribute(field)){
-1161min=this.markers[m].getAttribute(field);
-1162}
-1163if(!max||max<this.markers[m].getAttribute(field)){
-1164max=this.markers[m].getAttribute(field);
-1165}
-1166}
-1167for(varp=0;m<this.polylines.length;m++){
-1168if(!min||min>this.polylines[p].getAttribute(field)){
-1169min=this.polylines[p].getAttribute(field);
-1170}
-1171if(!max||max<this.polylines[p].getAttribute(field)){
-1172max=this.polylines[p].getAttribute(field);
-1173}
-1174}
-1175
-1176return[min,max];
-1177};
-1178
-1179/**
-1180 * getMap returns the native map object that mapstraction is talking to
-1181 * @returns the native map object mapstraction is using
-1182 */
-1183Mapstraction.prototype.getMap=function(){
-1184// FIXME in an ideal world this shouldn't exist right?
-1185returnthis.maps[this.api];
-1186};
-1187
-1188
-1189//////////////////////////////
-1190//
-1191// LatLonPoint
-1192//
-1193/////////////////////////////
-1194
-1195/**
-1196 * LatLonPoint is a point containing a latitude and longitude with helper methods
-1197 * @name mxn.LatLonPoint
-1198 * @constructor
-1199 * @param {double} lat is the latitude
-1200 * @param {double} lon is the longitude
-1201 * @exports LatLonPoint as mxn.LatLonPoint
-1202 */
-1203varLatLonPoint=mxn.LatLonPoint=function(lat,lon){
-1204this.lat=Number(lat);// force to be numeric
-1205this.lon=Number(lon);
-1206this.lng=this.lon;// lets be lon/lng agnostic
-1207
-1208this.invoker=newmxn.Invoker(this,'LatLonPoint');
-1209};
-1210
-1211mxn.addProxyMethods(LatLonPoint,[
-1212/**
-1213 * Retrieve the lat and lon values from a proprietary point.
-1214 * @name mxn.LatLonPoint#fromProprietary
-1215 * @function
-1216 * @param {String} apiId The API ID of the proprietary point.
-1217 * @param {Object} point The proprietary point.
-1218 */
-1219'fromProprietary',
-1220
-1221/**
-1222 * Converts the current LatLonPoint to a proprietary one for the API specified by apiId.
-1223 * @name mxn.LatLonPoint#toProprietary
-1224 * @function
-1225 * @param {String} apiId The API ID of the proprietary point.
-1226 * @returns A proprietary point.
-1227 */
-1228'toProprietary'
-1229],true);
-1230
-1231/**
-1232 * toString returns a string represntation of a point
-1233 * @returns a string like '51.23, -0.123'
-1234 * @type String
-1235 */
-1236LatLonPoint.prototype.toString=function(){
-1237returnthis.lat+', '+this.lon;
-1238};
-1239
-1240/**
-1241 * distance returns the distance in kilometers between two points
-1242 * @param {LatLonPoint} otherPoint The other point to measure the distance from to this one
-1243 * @returns the distance between the points in kilometers
-1244 * @type double
-1245 */
-1246LatLonPoint.prototype.distance=function(otherPoint){
-1247// Uses Haversine formula from http://www.movable-type.co.uk
-1248varrads=Math.PI/180;
-1249vardiffLat=(this.lat-otherPoint.lat)*rads;
-1250vardiffLon=(this.lon-otherPoint.lon)*rads;
-1251vara=Math.sin(diffLat/2)*Math.sin(diffLat/2)+
-1252Math.cos(this.lat*rads)*Math.cos(otherPoint.lat*rads)*
-1253Math.sin(diffLon/2)*Math.sin(diffLon/2);
-1254return2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))*6371;// Earth's mean radius in km
-1255};
-1256
-1257/**
-1258 * equals tests if this point is the same as some other one
-1259 * @param {LatLonPoint} otherPoint The other point to test with
-1260 * @returns true or false
-1261 * @type boolean
-1262 */
-1263LatLonPoint.prototype.equals=function(otherPoint){
-1264returnthis.lat==otherPoint.lat&&this.lon==otherPoint.lon;
-1265};
-1266
-1267/**
-1268 * Returns latitude conversion based on current projection
-1269 * @returns {Float} conversion
-1270 */
-1271LatLonPoint.prototype.latConv=function(){
-1272returnthis.distance(newLatLonPoint(this.lat+0.1,this.lon))*10;
-1273};
-1274
-1275/**
-1276 * Returns longitude conversion based on current projection
-1277 * @returns {Float} conversion
-1278 */
-1279LatLonPoint.prototype.lonConv=function(){
-1280returnthis.distance(newLatLonPoint(this.lat,this.lon+0.1))*10;
-1281};
-1282
-1283
-1284//////////////////////////
-1285//
-1286// BoundingBox
-1287//
-1288//////////////////////////
-1289
-1290/**
-1291 * BoundingBox creates a new bounding box object
-1292 * @name mxn.BoundingBox
-1293 * @constructor
-1294 * @param {double} swlat the latitude of the south-west point
-1295 * @param {double} swlon the longitude of the south-west point
-1296 * @param {double} nelat the latitude of the north-east point
-1297 * @param {double} nelon the longitude of the north-east point
-1298 * @exports BoundingBox as mxn.BoundingBox
-1299 */
-1300varBoundingBox=mxn.BoundingBox=function(swlat,swlon,nelat,nelon){
-1301//FIXME throw error if box bigger than world
-1302this.sw=newLatLonPoint(swlat,swlon);
-1303this.ne=newLatLonPoint(nelat,nelon);
-1304};
-1305
-1306/**
-1307 * getSouthWest returns a LatLonPoint of the south-west point of the bounding box
-1308 * @returns the south-west point of the bounding box
-1309 * @type LatLonPoint
-1310 */
-1311BoundingBox.prototype.getSouthWest=function(){
-1312returnthis.sw;
-1313};
-1314
-1315/**
-1316 * getNorthEast returns a LatLonPoint of the north-east point of the bounding box
-1317 * @returns the north-east point of the bounding box
-1318 * @type LatLonPoint
-1319 */
-1320BoundingBox.prototype.getNorthEast=function(){
-1321returnthis.ne;
-1322};
-1323
-1324/**
-1325 * isEmpty finds if this bounding box has zero area
-1326 * @returns whether the north-east and south-west points of the bounding box are the same point
-1327 * @type boolean
-1328 */
-1329BoundingBox.prototype.isEmpty=function(){
-1330returnthis.ne==this.sw;// is this right? FIXME
-1331};
-1332
-1333/**
-1334 * contains finds whether a given point is within a bounding box
-1335 * @param {LatLonPoint} point the point to test with
-1336 * @returns whether point is within this bounding box
-1337 * @type boolean
-1338 */
-1339BoundingBox.prototype.contains=function(point){
-1340returnpoint.lat>=this.sw.lat&&point.lat<=this.ne.lat&&point.lon>=this.sw.lon&&point.lon<=this.ne.lon;
-1341};
-1342
-1343/**
-1344 * toSpan returns a LatLonPoint with the lat and lon as the height and width of the bounding box
-1345 * @returns a LatLonPoint containing the height and width of this bounding box
-1346 * @type LatLonPoint
-1347 */
-1348BoundingBox.prototype.toSpan=function(){
-1349returnnewLatLonPoint(Math.abs(this.sw.lat-this.ne.lat),Math.abs(this.sw.lon-this.ne.lon));
-1350};
-1351
-1352
-1353
-1354/**
-1355 * extend extends the bounding box to include the new point
-1356 */
-1357BoundingBox.prototype.extend=function(point){
-1358if(this.sw.lat>point.lat){
-1359this.sw.lat=point.lat;
-1360}
-1361if(this.sw.lon>point.lon){
-1362this.sw.lon=point.lon;
-1363}
-1364if(this.ne.lat<point.lat){
-1365this.ne.lat=point.lat;
-1366}
-1367if(this.ne.lon<point.lon){
-1368this.ne.lon=point.lon;
-1369}
-1370return;
-1371};
-1372
-1373//////////////////////////////
-1374//
-1375// Marker
-1376//
-1377///////////////////////////////
-1378
-1379/**
-1380 * Marker create's a new marker pin
-1381 * @name mxn.Marker
-1382 * @constructor
-1383 * @param {LatLonPoint} point the point on the map where the marker should go
-1384 * @exports Marker as mxn.Marker
-1385 */
-1386varMarker=mxn.Marker=function(point){
-1387this.api=null;
-1388this.location=point;
-1389this.onmap=false;
-1390this.proprietary_marker=false;
-1391this.attributes=[];
-1392this.invoker=newmxn.Invoker(this,'Marker',function(){returnthis.api;});
-1393mxn.addEvents(this,[
-1394'openInfoBubble',// Info bubble opened
-1395'closeInfoBubble',// Info bubble closed
-1396'click'// Marker clicked
-1397]);
-1398};
-1399
-1400mxn.addProxyMethods(Marker,[
-1401/**
-1402 * Retrieve the settings from a proprietary marker.
-1403 * @name mxn.Marker#fromProprietary
-1404 * @function
-1405 * @param {String} apiId The API ID of the proprietary point.
-1406 * @param {Object} marker The proprietary marker.
-1407 */
-1408'fromProprietary',
-1409
-1410/**
-1411 * Hide the marker.
-1412 * @name mxn.Marker#hide
-1413 * @function
-1414 */
-1415'hide',
-1416
-1417/**
-1418 * Open the marker's info bubble.
-1419 * @name mxn.Marker#openBubble
-1420 * @function
-1421 */
-1422'openBubble',
-1423
-1424/**
-1425 * Closes the marker's info bubble.
-1426 * @name mxn.Marker#closeBubble
-1427 * @function
-1428 */
-1429'closeBubble',
-1430
-1431/**
-1432 * Show the marker.
-1433 * @name mxn.Marker#show
-1434 * @function
-1435 */
-1436'show',
-1437
-1438/**
-1439 * Converts the current Marker to a proprietary one for the API specified by apiId.
-1440 * @name mxn.Marker#toProprietary
-1441 * @function
-1442 * @param {String} apiId The API ID of the proprietary marker.
-1443 * @returns A proprietary marker.
-1444 */
-1445'toProprietary',
-1446
-1447/**
-1448 * Updates the Marker with the location of the attached proprietary marker on the map.
-1449 * @name mxn.Marker#update
-1450 * @function
-1451 */
-1452'update'
-1453]);
-1454
-1455Marker.prototype.setChild=function(some_proprietary_marker){
-1456this.proprietary_marker=some_proprietary_marker;
-1457some_proprietary_marker.mapstraction_marker=this;
-1458this.onmap=true;
-1459};
-1460
-1461Marker.prototype.setLabel=function(labelText){
-1462this.labelText=labelText;
-1463};
-1464
-1465/**
-1466 * addData conviniently set a hash of options on a marker
-1467 * @param {Object} options An object literal hash of key value pairs. Keys are: label, infoBubble, icon, iconShadow, infoDiv, draggable, hover, hoverIcon, openBubble, groupName.
-1468 */
-1469Marker.prototype.addData=function(options){
-1470for(varsOptKeyinoptions){
-1471if(options.hasOwnProperty(sOptKey)){
-1472switch(sOptKey){
-1473case'label':
-1474this.setLabel(options.label);
-1475break;
-1476case'infoBubble':
-1477this.setInfoBubble(options.infoBubble);
-1478break;
-1479case'icon':
-1480if(options.iconSize&&options.iconAnchor){
-1481this.setIcon(options.icon,options.iconSize,options.iconAnchor);
-1482}
-1483elseif(options.iconSize){
-1484this.setIcon(options.icon,options.iconSize);
-1485}
-1486else{
-1487this.setIcon(options.icon);
-1488}
-1489break;
-1490case'iconShadow':
-1491if(options.iconShadowSize){
-1492this.setShadowIcon(options.iconShadow,[options.iconShadowSize[0],options.iconShadowSize[1]]);
-1493}
-1494else{
-1495this.setIcon(options.iconShadow);
-1496}
-1497break;
-1498case'infoDiv':
-1499this.setInfoDiv(options.infoDiv[0],options.infoDiv[1]);
-1500break;
-1501case'draggable':
-1502this.setDraggable(options.draggable);
-1503break;
-1504case'hover':
-1505this.setHover(options.hover);
-1506this.setHoverIcon(options.hoverIcon);
-1507break;
-1508case'hoverIcon':
-1509this.setHoverIcon(options.hoverIcon);
-1510break;
-1511case'openBubble':
-1512this.openBubble();
-1513break;
-1514case'closeBubble':
-1515this.closeBubble();
-1516break;
-1517case'groupName':
-1518this.setGroupName(options.groupName);
-1519break;
-1520default:
-1521// don't have a specific action for this bit of
-1522// data so set a named attribute
-1523this.setAttribute(sOptKey,options[sOptKey]);
-1524break;
-1525}
-1526}
-1527}
-1528};
-1529
-1530/**
-1531 * Sets the html/text content for a bubble popup for a marker
-1532 * @param {String} infoBubble the html/text you want displayed
-1533 */
-1534Marker.prototype.setInfoBubble=function(infoBubble){
-1535this.infoBubble=infoBubble;
-1536};
-1537
-1538/**
-1539 * Sets the text and the id of the div element where to the information
-1540 * useful for putting information in a div outside of the map
-1541 * @param {String} infoDiv the html/text you want displayed
-1542 * @param {String} div the element id to use for displaying the text/html
-1543 */
-1544Marker.prototype.setInfoDiv=function(infoDiv,div){
-1545this.infoDiv=infoDiv;
-1546this.div=div;
-1547};
-1548
-1549/**
-1550 * Sets the icon for a marker
-1551 * @param {String} iconUrl The URL of the image you want to be the icon
-1552 */
-1553Marker.prototype.setIcon=function(iconUrl,iconSize,iconAnchor){
-1554this.iconUrl=iconUrl;
-1555if(iconSize){
-1556this.iconSize=iconSize;
-1557}
-1558if(iconAnchor){
-1559this.iconAnchor=iconAnchor;
-1560}
-1561};
-1562
-1563/**
-1564 * Sets the size of the icon for a marker
-1565 * @param {Array} iconSize The array size in pixels of the marker image: [ width, height ]
-1566 */
-1567Marker.prototype.setIconSize=function(iconSize){
-1568if(iconSize){
-1569this.iconSize=iconSize;
-1570}
-1571};
-1572
-1573/**
-1574 * Sets the anchor point for a marker
-1575 * @param {Array} iconAnchor The array offset in pixels of the anchor point from top left: [ right, down ]
-1576 */
-1577Marker.prototype.setIconAnchor=function(iconAnchor){
-1578if(iconAnchor){
-1579this.iconAnchor=iconAnchor;
-1580}
-1581};
-1582
-1583/**
-1584 * Sets the icon for a marker
-1585 * @param {String} iconUrl The URL of the image you want to be the icon
-1586 */
-1587Marker.prototype.setShadowIcon=function(iconShadowUrl,iconShadowSize){
-1588this.iconShadowUrl=iconShadowUrl;
-1589if(iconShadowSize){
-1590this.iconShadowSize=iconShadowSize;
-1591}
-1592};
-1593
-1594Marker.prototype.setHoverIcon=function(hoverIconUrl){
-1595this.hoverIconUrl=hoverIconUrl;
-1596};
-1597
-1598/**
-1599 * Sets the draggable state of the marker
-1600 * @param {Bool} draggable set to true if marker should be draggable by the user
-1601 */
-1602Marker.prototype.setDraggable=function(draggable){
-1603this.draggable=draggable;
-1604};
-1605
-1606/**
-1607 * Sets that the marker info is displayed on hover
-1608 * @param {Boolean} hover set to true if marker should display info on hover
-1609 */
-1610Marker.prototype.setHover=function(hover){
-1611this.hover=hover;
-1612};
-1613
-1614/**
-1615 * Markers are grouped up by this name. declutterGroup makes use of this.
-1616 */
-1617Marker.prototype.setGroupName=function(sGrpName){
-1618this.groupName=sGrpName;
-1619};
-1620
-1621/**
-1622 * Set an arbitrary key/value pair on a marker
-1623 * @param {String} key
-1624 * @param value
-1625 */
-1626Marker.prototype.setAttribute=function(key,value){
-1627this.attributes[key]=value;
-1628};
-1629
-1630/**
-1631 * getAttribute: gets the value of "key"
-1632 * @param {String} key
-1633 * @returns value
-1634 */
-1635Marker.prototype.getAttribute=function(key){
-1636returnthis.attributes[key];
-1637};
-1638
-1639
-1640///////////////
-1641// Polyline ///
-1642///////////////
-1643
-1644/**
-1645 * Instantiates a new Polyline.
-1646 * @name mxn.Polyline
-1647 * @constructor
-1648 * @param {Point[]} points Points that make up the Polyline.
-1649 * @exports Polyline as mxn.Polyline
-1650 */
-1651varPolyline=mxn.Polyline=function(points){
-1652this.api=null;
-1653this.points=points;
-1654this.attributes=[];
-1655this.onmap=false;
-1656this.proprietary_polyline=false;
-1657this.pllID="mspll-"+newDate().getTime()+'-'+(Math.floor(Math.random()*Math.pow(2,16)));
-1658this.invoker=newmxn.Invoker(this,'Polyline',function(){returnthis.api;});
-1659};
-1660
-1661mxn.addProxyMethods(Polyline,[
-1662
-1663/**
-1664 * Retrieve the settings from a proprietary polyline.
-1665 * @name mxn.Polyline#fromProprietary
-1666 * @function
-1667 * @param {String} apiId The API ID of the proprietary polyline.
-1668 * @param {Object} polyline The proprietary polyline.
-1669 */
-1670'fromProprietary',
-1671
-1672/**
-1673 * Hide the polyline.
-1674 * @name mxn.Polyline#hide
-1675 * @function
-1676 */
-1677'hide',
-1678
-1679/**
-1680 * Show the polyline.
-1681 * @name mxn.Polyline#show
-1682 * @function
-1683 */
-1684'show',
-1685
-1686/**
-1687 * Converts the current Polyline to a proprietary one for the API specified by apiId.
-1688 * @name mxn.Polyline#toProprietary
-1689 * @function
-1690 * @param {String} apiId The API ID of the proprietary polyline.
-1691 * @returns A proprietary polyline.
-1692 */
-1693'toProprietary',
-1694
-1695/**
-1696 * Updates the Polyline with the path of the attached proprietary polyline on the map.
-1697 * @name mxn.Polyline#update
-1698 * @function
-1699 */
-1700'update'
-1701]);
-1702
-1703/**
-1704 * addData conviniently set a hash of options on a polyline
-1705 * @param {Object} options An object literal hash of key value pairs. Keys are: color, width, opacity, closed, fillColor.
-1706 */
-1707Polyline.prototype.addData=function(options){
-1708for(varsOptinoptions){
-1709if(options.hasOwnProperty(sOpt)){
-1710switch(sOpt){
-1711case'color':
-1712this.setColor(options.color);
-1713break;
-1714case'width':
-1715this.setWidth(options.width);
-1716break;
-1717case'opacity':
-1718this.setOpacity(options.opacity);
-1719break;
-1720case'closed':
-1721this.setClosed(options.closed);
-1722break;
-1723case'fillColor':
-1724this.setFillColor(options.fillColor);
-1725break;
-1726default:
-1727this.setAttribute(sOpt,options[sOpt]);
-1728break;
-1729}
-1730}
-1731}
-1732};
-1733
-1734Polyline.prototype.setChild=function(some_proprietary_polyline){
-1735this.proprietary_polyline=some_proprietary_polyline;
-1736this.onmap=true;
-1737};
-1738
-1739/**
-1740 * in the form: #RRGGBB
-1741 * Note map24 insists on upper case, so we convert it.
-1742 */
-1743Polyline.prototype.setColor=function(color){
-1744this.color=(color.length==7&&color[0]=="#")?color.toUpperCase():color;
-1745};
-1746
-1747/**
-1748 * Stroke width of the polyline
-1749 * @param {Integer} width
-1750 */
-1751Polyline.prototype.setWidth=function(width){
-1752this.width=width;
-1753};
-1754
-1755/**
-1756 * A float between 0.0 and 1.0
-1757 * @param {Float} opacity
-1758 */
-1759Polyline.prototype.setOpacity=function(opacity){
-1760this.opacity=opacity;
-1761};
-1762
-1763/**
-1764 * Marks the polyline as a closed polygon
-1765 * @param {Boolean} bClosed
-1766 */
-1767Polyline.prototype.setClosed=function(bClosed){
-1768this.closed=bClosed;
-1769};
-1770
-1771/**
-1772 * Fill color for a closed polyline as HTML color value e.g. #RRGGBB
-1773 * @param {String} sFillColor HTML color value #RRGGBB
-1774 */
-1775Polyline.prototype.setFillColor=function(sFillColor){
-1776this.fillColor=sFillColor;
-1777};
-1778
-1779
-1780/**
-1781 * Set an arbitrary key/value pair on a polyline
-1782 * @param {String} key
-1783 * @param value
-1784 */
-1785Polyline.prototype.setAttribute=function(key,value){
-1786this.attributes[key]=value;
-1787};
-1788
-1789/**
-1790 * Gets the value of "key"
-1791 * @param {String} key
-1792 * @returns value
-1793 */
-1794Polyline.prototype.getAttribute=function(key){
-1795returnthis.attributes[key];
-1796};
-1797
-1798/**
-1799 * Simplifies a polyline, averaging and reducing the points
-1800 * @param {Number} tolerance (1.0 is a good starting point)
-1801 */
-1802Polyline.prototype.simplify=function(tolerance){
-1803varreduced=[];
-1804
-1805// First point
-1806reduced[0]=this.points[0];
-1807
-1808varmarkerPoint=0;
-1809
-1810for(vari=1;i<this.points.length-1;i++){
-1811if(this.points[i].distance(this.points[markerPoint])>=tolerance)
-1812{
-1813reduced[reduced.length]=this.points[i];
-1814markerPoint=i;
-1815}
-1816}
-1817
-1818// Last point
-1819reduced[reduced.length]=this.points[this.points.length-1];
-1820
-1821// Revert
-1822this.points=reduced;
-1823};
-1824
-1825///////////////
-1826// Radius //
-1827///////////////
-1828
-1829/**
-1830 * Creates a new radius object for drawing circles around a point, does a lot of initial calculation to increase load time
-1831 * @name mxn.Radius
-1832 * @constructor
-1833 * @param {LatLonPoint} center LatLonPoint of the radius
-1834 * @param {Number} quality Number of points that comprise the approximated circle (20 is a good starting point)
-1835 * @exports Radius as mxn.Radius
-1836 */
-1837varRadius=mxn.Radius=function(center,quality){
-1838this.center=center;
-1839varlatConv=center.latConv();
-1840varlonConv=center.lonConv();
-1841
-1842// Create Radian conversion constant
-1843varrad=Math.PI/180;
-1844this.calcs=[];
-1845
-1846for(vari=0;i<360;i+=quality){
-1847this.calcs.push([Math.cos(i*rad)/latConv,Math.sin(i*rad)/lonConv]);
-1848}
-1849};
-1850
-1851/**
-1852 * Returns polyline of a circle around the point based on new radius
-1853 * @param {Radius} radius
-1854 * @param {Color} color
-1855 * @returns {Polyline} Polyline
-1856 */
-1857Radius.prototype.getPolyline=function(radius,color){
-1858varpoints=[];
-1859
-1860for(vari=0;i<this.calcs.length;i++){
-1861varpoint=newLatLonPoint(
-1862this.center.lat+(radius*this.calcs[i][0]),
-1863this.center.lon+(radius*this.calcs[i][1])
-1864);
-1865points.push(point);
-1866}
-1867
-1868// Add first point
-1869points.push(points[0]);
-1870
-1871varline=newPolyline(points);
-1872line.setColor(color);
-1873
-1874returnline;
-1875};
-1876
-1877
-1878})();
-1879
\ No newline at end of file
diff --git a/demoplanner/js/mapstraction/docs/symbols/src/H__Projects_mapstraction-2.0_git_mapstraction_mxn_build_2.0.18_mxn.geocoder.js.html b/demoplanner/js/mapstraction/docs/symbols/src/H__Projects_mapstraction-2.0_git_mapstraction_mxn_build_2.0.18_mxn.geocoder.js.html
deleted file mode 100644
index d4fdf80ffc..0000000000
--- a/demoplanner/js/mapstraction/docs/symbols/src/H__Projects_mapstraction-2.0_git_mapstraction_mxn_build_2.0.18_mxn.geocoder.js.html
+++ /dev/null
@@ -1,67 +0,0 @@
-
1(function(){
- 2
- 3/**
- 4 * Initialise our provider. This function should only be called
- 5 * from within mapstraction code, not exposed as part of the API.
- 6 * @private
- 7 */
- 8varinit=function(){
- 9this.invoker.go('init');
- 10};
- 11
- 12/**
- 13 * Geocoder instantiates a geocoder with some API choice
- 14 * @name mxn.Geocoder
- 15 * @constructor
- 16 * @param {String} api The API to use, currently only 'mapquest' is supported
- 17 * @param {Function} callback The function to call when a geocode request returns (function(waypoint))
- 18 * @param {Function} error_callback The optional function to call when a geocode request fails
- 19 * @exports Geocoder as mxn.Geocoder
- 20 */
- 21varGeocoder=mxn.Geocoder=function(api,callback,error_callback){
- 22this.api=api;
- 23this.geocoders={};
- 24this.callback=callback;
- 25this.error_callback=error_callback||function(){};
- 26
- 27// set up our invoker for calling API methods
- 28this.invoker=newmxn.Invoker(this,'Geocoder',function(){returnthis.api;});
- 29init.apply(this);
- 30};
- 31
- 32mxn.addProxyMethods(Geocoder,[
- 33
- 34/**
- 35 * Geocodes the provided address.
- 36 * @name mxn.Geocoder#geocode
- 37 * @function
- 38 * @param {Object} address Address hash, keys are: street, locality, region, country.
- 39 */
- 40'geocode',
- 41
- 42'geocode_callback'
- 43
- 44]);
- 45
- 46/**
- 47 * Change the geocoding API in use
- 48 * @name mxn.Geocoder#swap
- 49 * @param {String} api The API to swap to
- 50 */
- 51Geocoder.prototype.swap=function(api){
- 52if(this.api==api){return;}
- 53
- 54this.api=api;
- 55if(!this.geocoders.hasOwnProperty(this.api)){
- 56init.apply(this);
- 57}
- 58};
- 59
- 60})();
\ No newline at end of file
diff --git a/demoplanner/js/mapstraction/docs/symbols/src/H__Projects_mapstraction-2.0_git_mapstraction_mxn_build_2.0.18_mxn.js.html b/demoplanner/js/mapstraction/docs/symbols/src/H__Projects_mapstraction-2.0_git_mapstraction_mxn_build_2.0.18_mxn.js.html
deleted file mode 100644
index ad65952e4c..0000000000
--- a/demoplanner/js/mapstraction/docs/symbols/src/H__Projects_mapstraction-2.0_git_mapstraction_mxn_build_2.0.18_mxn.js.html
+++ /dev/null
@@ -1,575 +0,0 @@
-
1// Auto-load scripts
- 2//
- 3// specify which map providers to load by using
- 4// <script src="mxn.js?(provider1,provider2,[module1,module2])" ...
- 5// in your HTML
- 6//
- 7// for each provider mxn.provider.module.js and mxn.module.js will be loaded
- 8// module 'core' is always loaded
- 9//
- 10// NOTE: if you call without providers
- 11// <script src="mxn.js" ...
- 12// no scripts will be loaded at all and it is then up to you to load the scripts independently
- 13(function(){
- 14varproviders=null;
- 15varmodules='core';
- 16varscriptBase;
- 17varscripts=document.getElementsByTagName('script');
- 18
- 19// Determine which scripts we need to load
- 20for(vari=0;i<scripts.length;i++){
- 21varmatch=scripts[i].src.replace(/%20/g,'').match(/^(.*?)mxn\.js(\?\(\[?(.*?)\]?\))?$/);
- 22if(match!==null){
- 23scriptBase=match[1];
- 24if(match[3]){
- 25varsettings=match[3].split(',[');
- 26providers=settings[0].replace(']','');
- 27if(settings[1]){
- 28modules+=','+settings[1];
- 29}
- 30}
- 31break;
- 32}
- 33}
- 34
- 35if(providers===null||providers=='none'){
- 36return;// Bail out if no auto-load has been found
- 37}
- 38providers=providers.replace(/ /g,'').split(',');
- 39modules=modules.replace(/ /g,'').split(',');
- 40
- 41// Actually load the scripts
- 42varscriptTagStart='<script type="text/javascript" src="'+scriptBase+'mxn.';
- 43varscriptTagEnd='.js"></script>';
- 44varscriptsAry=[];
- 45for(i=0;i<modules.length;i++){
- 46scriptsAry.push(scriptTagStart+modules[i]+scriptTagEnd);
- 47for(varj=0;j<providers.length;j++){
- 48scriptsAry.push(scriptTagStart+providers[j]+'.'+modules[i]+scriptTagEnd);
- 49}
- 50}
- 51document.write(scriptsAry.join(''));
- 52})();
- 53
- 54(function(){
- 55
- 56// holds all our implementing functions
- 57varapis={};
- 58
- 59// Our special private methods
- 60/**
- 61 * Calls the API specific implementation of a particular method.
- 62 * Deferrable: If the API implmentation includes a deferable hash such as { getCenter: true, setCenter: true},
- 63 * then the methods calls mentioned with in it will be queued until runDeferred is called.
- 64 *
- 65 * @private
- 66 */
- 67varinvoke=function(sApiId,sObjName,sFnName,oScope,args){
- 68if(!hasImplementation(sApiId,sObjName,sFnName)){
- 69throw'Method '+sFnName+' of object '+sObjName+' is not supported by API '+sApiId+'. Are you missing a script tag?';
- 70}
- 71if(typeof(apis[sApiId][sObjName].deferrable)!='undefined'&&apis[sApiId][sObjName].deferrable[sFnName]===true){
- 72mxn.deferUntilLoaded.call(oScope,function(){returnapis[sApiId][sObjName][sFnName].apply(oScope,args);});
- 73}
- 74else{
- 75returnapis[sApiId][sObjName][sFnName].apply(oScope,args);
- 76}
- 77};
- 78
- 79/**
- 80 * Determines whether the specified API provides an implementation for the
- 81 * specified object and function name.
- 82 * @private
- 83 */
- 84varhasImplementation=function(sApiId,sObjName,sFnName){
- 85if(typeof(apis[sApiId])=='undefined'){
- 86throw'API '+sApiId+' not loaded. Are you missing a script tag?';
- 87}
- 88if(typeof(apis[sApiId][sObjName])=='undefined'){
- 89throw'Object definition '+sObjName+' in API '+sApiId+' not loaded. Are you missing a script tag?';
- 90}
- 91returntypeof(apis[sApiId][sObjName][sFnName])=='function';
- 92};
- 93
- 94/**
- 95 * @name mxn
- 96 * @namespace
- 97 */
- 98varmxn=window.mxn=/** @lends mxn */{
- 99
-100/**
-101 * Registers a set of provider specific implementation functions.
-102 * @function
-103 * @param {String} sApiId The API ID to register implementing functions for.
-104 * @param {Object} oApiImpl An object containing the API implementation.
-105 */
-106register:function(sApiId,oApiImpl){
-107if(!apis.hasOwnProperty(sApiId)){
-108apis[sApiId]={};
-109}
-110mxn.util.merge(apis[sApiId],oApiImpl);
-111},
-112
-113/**
-114 * Adds a list of named proxy methods to the prototype of a
-115 * specified constructor function.
-116 * @function
-117 * @param {Function} func Constructor function to add methods to
-118 * @param {Array} aryMethods Array of method names to create
-119 * @param {Boolean} bWithApiArg Optional. Whether the proxy methods will use an API argument
-120 */
-121addProxyMethods:function(func,aryMethods,bWithApiArg){
-122for(vari=0;i<aryMethods.length;i++){
-123varsMethodName=aryMethods[i];
-124if(bWithApiArg){
-125func.prototype[sMethodName]=newFunction('return this.invoker.go(\''+sMethodName+'\', arguments, { overrideApi: true } );');
-126}
-127else{
-128func.prototype[sMethodName]=newFunction('return this.invoker.go(\''+sMethodName+'\', arguments);');
-129}
-130}
-131},
-132
-133checkLoad:function(funcDetails){
-134if(this.loaded[this.api]===false){
-135varscope=this;
-136this.onload[this.api].push(function(){funcDetails.callee.apply(scope,funcDetails);});
-137returntrue;
-138}
-139returnfalse;
-140},
-141
-142deferUntilLoaded:function(fnCall){
-143if(this.loaded[this.api]===false){
-144varscope=this;
-145this.onload[this.api].push(fnCall);
-146}else{
-147fnCall.call(this);
-148}
-149},
-150
-151/**
-152 * Bulk add some named events to an object.
-153 * @function
-154 * @param {Object} oEvtSrc The event source object.
-155 * @param {String[]} aEvtNames Event names to add.
-156 */
-157addEvents:function(oEvtSrc,aEvtNames){
-158for(vari=0;i<aEvtNames.length;i++){
-159varsEvtName=aEvtNames[i];
-160if(sEvtNameinoEvtSrc){
-161throw'Event or method '+sEvtName+' already declared.';
-162}
-163oEvtSrc[sEvtName]=newmxn.Event(sEvtName,oEvtSrc);
-164}
-165}
-166
-167};
-168
-169/**
-170 * Instantiates a new Event
-171 * @constructor
-172 * @param {String} sEvtName The name of the event.
-173 * @param {Object} oEvtSource The source object of the event.
-174 */
-175mxn.Event=function(sEvtName,oEvtSource){
-176varhandlers=[];
-177if(!sEvtName){
-178throw'Event name must be provided';
-179}
-180/**
-181 * Add a handler to the Event.
-182 * @param {Function} fn The handler function.
-183 * @param {Object} ctx The context of the handler function.
-184 */
-185this.addHandler=function(fn,ctx){
-186handlers.push({context:ctx,handler:fn});
-187};
-188/**
-189 * Remove a handler from the Event.
-190 * @param {Function} fn The handler function.
-191 * @param {Object} ctx The context of the handler function.
-192 */
-193this.removeHandler=function(fn,ctx){
-194for(vari=0;i<handlers.length;i++){
-195if(handlers[i].handler==fn&&handlers[i].context==ctx){
-196handlers.splice(i,1);
-197}
-198}
-199};
-200/**
-201 * Remove all handlers from the Event.
-202 */
-203this.removeAllHandlers=function(){
-204handlers=[];
-205};
-206/**
-207 * Fires the Event.
-208 * @param {Object} oEvtArgs Event arguments object to be passed to the handlers.
-209 */
-210this.fire=function(oEvtArgs){
-211varargs=[sEvtName,oEvtSource,oEvtArgs];
-212for(vari=0;i<handlers.length;i++){
-213handlers[i].handler.apply(handlers[i].context,args);
-214}
-215};
-216};
-217
-218/**
-219 * Creates a new Invoker, a class which helps with on-the-fly
-220 * invocation of the correct API methods.
-221 * @constructor
-222 * @param {Object} aobj The core object whose methods will make cals to go()
-223 * @param {String} asClassName The name of the Mapstraction class to be invoked, normally the same name as aobj's constructor function
-224 * @param {Function} afnApiIdGetter The function on object aobj which will return the active API ID
-225 */
-226mxn.Invoker=function(aobj,asClassName,afnApiIdGetter){
-227varobj=aobj;
-228varsClassName=asClassName;
-229varfnApiIdGetter=afnApiIdGetter;
-230vardefOpts={
-231overrideApi:false,// {Boolean} API ID is overridden by value in first argument
-232context:null,// {Object} Local vars can be passed from the body of the method to the API method within this object
-233fallback:null// {Function} If an API implementation doesn't exist this function is run instead
-234};
-235
-236/**
-237 * Invoke the API implementation of a specific method.
-238 * @param {String} sMethodName The method name to invoke
-239 * @param {Array} args Arguments to pass on
-240 * @param {Object} oOptions Optional. Extra options for invocation
-241 * @param {Boolean} oOptions.overrideApi When true the first argument is used as the API ID.
-242 * @param {Object} oOptions.context A context object for passing extra information on to the provider implementation.
-243 * @param {Function} oOptions.fallback A fallback function to run if the provider implementation is missing.
-244 */
-245this.go=function(sMethodName,args,oOptions){
-246
-247// make sure args is an array
-248args=typeof(args)!='undefined'?Array.prototype.slice.apply(args):[];
-249
-250if(typeof(oOptions)=='undefined'){
-251oOptions=defOpts;
-252}
-253
-254varsApiId;
-255if(oOptions.overrideApi){
-256sApiId=args.shift();
-257}
-258else{
-259sApiId=fnApiIdGetter.apply(obj);
-260}
-261
-262if(typeof(sApiId)!='string'){
-263throw'API ID not available.';
-264}
-265
-266if(typeof(oOptions.context)!='undefined'&&oOptions.context!==null){
-267args.push(oOptions.context);
-268}
-269
-270if(typeof(oOptions.fallback)=='function'&&!hasImplementation(sApiId,sClassName,sMethodName)){
-271// we've got no implementation but have got a fallback function
-272returnoOptions.fallback.apply(obj,args);
-273}
-274else{
-275returninvoke(sApiId,sClassName,sMethodName,obj,args);
-276}
-277
-278};
-279
-280};
-281
-282/**
-283 * @namespace
-284 */
-285mxn.util={
-286
-287/**
-288 * Merges properties of one object into another recursively.
-289 * @param {Object} oRecv The object receiveing properties
-290 * @param {Object} oGive The object donating properties
-291 */
-292merge:function(oRecv,oGive){
-293for(varsPropNameinoGive){
-294if(oGive.hasOwnProperty(sPropName)){
-295if(!oRecv.hasOwnProperty(sPropName)||typeof(oRecv[sPropName])!=='object'||typeof(oGive[sPropName])!=='object'){
-296oRecv[sPropName]=oGive[sPropName];
-297}
-298else{
-299mxn.util.merge(oRecv[sPropName],oGive[sPropName]);
-300}
-301}
-302}
-303},
-304
-305/**
-306 * $m, the dollar function, elegantising getElementById()
-307 * @return An HTML element or array of HTML elements
-308 */
-309$m:function(){
-310varelements=[];
-311for(vari=0;i<arguments.length;i++){
-312varelement=arguments[i];
-313if(typeof(element)=='string'){
-314element=document.getElementById(element);
-315}
-316if(arguments.length==1){
-317returnelement;
-318}
-319elements.push(element);
-320}
-321returnelements;
-322},
-323
-324/**
-325 * loadScript is a JSON data fetcher
-326 * @param {String} src URL to JSON file
-327 * @param {Function} callback Callback function
-328 */
-329loadScript:function(src,callback){
-330varscript=document.createElement('script');
-331script.type='text/javascript';
-332script.src=src;
-333if(callback){
-334if(script.addEventListener){
-335script.addEventListener('load',callback,true);
-336}
-337elseif(script.attachEvent){
-338vardone=false;
-339script.attachEvent("onreadystatechange",function(){
-340if(!done&&document.readyState==="complete"){
-341done=true;
-342callback();
-343}
-344});
-345}
-346}
-347varh=document.getElementsByTagName('head')[0];
-348h.appendChild(script);
-349return;
-350},
-351
-352/**
-353 *
-354 * @param {Object} point
-355 * @param {Object} level
-356 */
-357convertLatLonXY_Yahoo:function(point,level){//Mercator
-358varsize=1<<(26-level);
-359varpixel_per_degree=size/360.0;
-360varpixel_per_radian=size/(2*Math.PI);
-361varorigin=newYCoordPoint(size/2,size/2);
-362varanswer=newYCoordPoint();
-363answer.x=Math.floor(origin.x+point.lon*pixel_per_degree);
-364varsin=Math.sin(point.lat*Math.PI/180.0);
-365answer.y=Math.floor(origin.y+0.5*Math.log((1+sin)/(1-sin))*-pixel_per_radian);
-366returnanswer;
-367},
-368
-369/**
-370 * Load a stylesheet from a remote file.
-371 * @param {String} href URL to the CSS file
-372 */
-373loadStyle:function(href){
-374varlink=document.createElement('link');
-375link.type='text/css';
-376link.rel='stylesheet';
-377link.href=href;
-378document.getElementsByTagName('head')[0].appendChild(link);
-379return;
-380},
-381
-382/**
-383 * getStyle provides cross-browser access to css
-384 * @param {Object} el HTML Element
-385 * @param {String} prop Style property name
-386 */
-387getStyle:function(el,prop){
-388vary;
-389if(el.currentStyle){
-390y=el.currentStyle[prop];
-391}
-392elseif(window.getComputedStyle){
-393y=window.getComputedStyle(el,'').getPropertyValue(prop);
-394}
-395returny;
-396},
-397
-398/**
-399 * Convert longitude to metres
-400 * http://www.uwgb.edu/dutchs/UsefulData/UTMFormulas.HTM
-401 * "A degree of longitude at the equator is 111.2km... For other latitudes,
-402 * multiply by cos(lat)"
-403 * assumes the earth is a sphere but good enough for our purposes
-404 * @param {Float} lon
-405 * @param {Float} lat
-406 */
-407lonToMetres:function(lon,lat){
-408returnlon*(111200*Math.cos(lat*(Math.PI/180)));
-409},
-410
-411/**
-412 * Convert metres to longitude
-413 * @param {Object} m
-414 * @param {Object} lat
-415 */
-416metresToLon:function(m,lat){
-417returnm/(111200*Math.cos(lat*(Math.PI/180)));
-418},
-419
-420/**
-421 * Convert kilometres to miles
-422 * @param {Float} km
-423 * @returns {Float} miles
-424 */
-425KMToMiles:function(km){
-426returnkm/1.609344;
-427},
-428
-429/**
-430 * Convert miles to kilometres
-431 * @param {Float} miles
-432 * @returns {Float} km
-433 */
-434milesToKM:function(miles){
-435returnmiles*1.609344;
-436},
-437
-438// stuff to convert google zoom levels to/from degrees
-439// assumes zoom 0 = 256 pixels = 360 degrees
-440// zoom 1 = 256 pixels = 180 degrees
-441// etc.
-442
-443/**
-444 *
-445 * @param {Object} pixels
-446 * @param {Object} zoom
-447 */
-448getDegreesFromGoogleZoomLevel:function(pixels,zoom){
-449return(360*pixels)/(Math.pow(2,zoom+8));
-450},
-451
-452/**
-453 *
-454 * @param {Object} pixels
-455 * @param {Object} degrees
-456 */
-457getGoogleZoomLevelFromDegrees:function(pixels,degrees){
-458returnmxn.util.logN((360*pixels)/degrees,2)-8;
-459},
-460
-461/**
-462 *
-463 * @param {Object} number
-464 * @param {Object} base
-465 */
-466logN:function(number,base){
-467returnMath.log(number)/Math.log(base);
-468},
-469
-470/**
-471 * Returns array of loaded provider apis
-472 * @returns {Array} providers
-473 */
-474getAvailableProviders:function(){
-475varproviders=[];
-476for(varpropertyNameinapis){
-477if(apis.hasOwnProperty(propertyName)){
-478providers.push(propertyName);
-479}
-480}
-481returnproviders;
-482},
-483
-484/**
-485 * Formats a string, inserting values of subsequent parameters at specified
-486 * locations. e.g. stringFormat('{0} {1}', 'hello', 'world');
-487 */
-488stringFormat:function(strIn){
-489varreplaceRegEx=/\{\d+\}/g;
-490varargs=Array.prototype.slice.apply(arguments);
-491args.shift();
-492returnstrIn.replace(replaceRegEx,function(strVal){
-493varnum=strVal.slice(1,-1);
-494returnargs[num];
-495});
-496},
-497
-498/**
-499 * Traverses an object graph using a series of map functions provided as arguments
-500 * 2 to n. Map functions are only called if the working object is not undefined/null.
-501 * For usage see mxn.google.geocoder.js.
-502 */
-503traverse:function(start){
-504varargs=Array.prototype.slice.apply(arguments);
-505args.shift();
-506varworking=start;
-507while(typeof(working)!='undefined'&&working!==null&&args.length>0){
-508varop=args.shift();
-509working=op(working);
-510}
-511}
-512};
-513
-514/**
-515 * Class for converting between HTML and RGB integer color formats.
-516 * Accepts either a HTML color string argument or three integers for R, G and B.
-517 * @constructor
-518 */
-519mxn.util.Color=function(){
-520if(arguments.length==3){
-521this.red=arguments[0];
-522this.green=arguments[1];
-523this.blue=arguments[2];
-524}
-525elseif(arguments.length==1){
-526this.setHexColor(arguments[0]);
-527}
-528};
-529
-530mxn.util.Color.prototype.reHex=/^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;
-531
-532/**
-533 * Set the color from the supplied HTML hex string.
-534 * @param {String} strHexColor A HTML hex color string e.g. '#00FF88'.
-535 */
-536mxn.util.Color.prototype.setHexColor=function(strHexColor){
-537varmatch=strHexColor.match(this.reHex);
-538if(match){
-539// grab the code - strips off the preceding # if there is one
-540strHexColor=match[1];
-541}
-542else{
-543throw'Invalid HEX color format, expected #000, 000, #000000 or 000000';
-544}
-545// if a three character hex code was provided, double up the values
-546if(strHexColor.length==3){
-547strHexColor=strHexColor.replace(/\w/g,function(str){returnstr.concat(str);});
-548}
-549this.red=parseInt(strHexColor.substr(0,2),16);
-550this.green=parseInt(strHexColor.substr(2,2),16);
-551this.blue=parseInt(strHexColor.substr(4,2),16);
-552};
-553
-554/**
-555 * Retrieve the color value as an HTML hex string.
-556 * @returns {String} Format '#00FF88'.
-557 */
-558mxn.util.Color.prototype.getHexColor=function(){
-559varrgb=this.blue|(this.green<<8)|(this.red<<16);
-560varhexString=rgb.toString(16).toUpperCase();
-561if(hexString.length<6){
-562hexString='0'+hexString;
-563}
-564return'#'+hexString;
-565};
-566
-567})();
-568
\ No newline at end of file
diff --git a/demoplanner/js/mapstraction/mxn-min.js b/demoplanner/js/mapstraction/mxn-min.js
deleted file mode 100644
index ddd1bc0698..0000000000
--- a/demoplanner/js/mapstraction/mxn-min.js
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
-MAPSTRACTION v2.0.18 http://www.mapstraction.com
-
-Copyright (c) 2012 Tom Carden, Steve Coast, Mikel Maron, Andrew Turner, Henri Bergius, Rob Moran, Derek Fowler, Gary Gale
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- * Neither the name of the Mapstraction nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-(function(){var g=null;var c="core";var d;var e=document.getElementsByTagName("script");for(var h=0;h0){var g=f.shift();e=g(e)}}};a.util.Color=function(){if(arguments.length==3){this.red=arguments[0];this.green=arguments[1];this.blue=arguments[2]}else{if(arguments.length==1){this.setHexColor(arguments[0])}}};a.util.Color.prototype.reHex=/^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;a.util.Color.prototype.setHexColor=function(f){var e=f.match(this.reHex);if(e){f=e[1]}else{throw"Invalid HEX color format, expected #000, 000, #000000 or 000000"}if(f.length==3){f=f.replace(/\w/g,function(g){return g.concat(g)})}this.red=parseInt(f.substr(0,2),16);this.green=parseInt(f.substr(2,2),16);this.blue=parseInt(f.substr(4,2),16)};a.util.Color.prototype.getHexColor=function(){var f=this.blue|(this.green<<8)|(this.red<<16);var e=f.toString(16).toUpperCase();if(e.length<6){e="0"+e}return"#"+e}})();
\ No newline at end of file
diff --git a/demoplanner/js/mapstraction/mxn.cartociudad.geocoder-min.js b/demoplanner/js/mapstraction/mxn.cartociudad.geocoder-min.js
deleted file mode 100644
index 86b7cace9c..0000000000
--- a/demoplanner/js/mapstraction/mxn.cartociudad.geocoder-min.js
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
-MAPSTRACTION v2.0.18 http://www.mapstraction.com
-
-Copyright (c) 2012 Tom Carden, Steve Coast, Mikel Maron, Andrew Turner, Henri Bergius, Rob Moran, Derek Fowler, Gary Gale
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- * Neither the name of the Mapstraction nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-mxn.register("cartociudad",{Geocoder:{init:function(){this.geocoders[this.api]=new metodosCartociudad()},geocode:function(b){var a={};var c=this;b.error=0;this.geocoders[this.api].queryNomenclator(b);if(b.error!==0){this.error_callback(b)}else{this.geocoders[this.api].addressToMapstraction(b);this.callback(b)}},geocode_callback:function(b,c){var a={}}}});
\ No newline at end of file
diff --git a/demoplanner/js/mapstraction/mxn.cartociudad.geocoder.js b/demoplanner/js/mapstraction/mxn.cartociudad.geocoder.js
deleted file mode 100644
index d9d2f42e28..0000000000
--- a/demoplanner/js/mapstraction/mxn.cartociudad.geocoder.js
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
-MAPSTRACTION v2.0.18 http://www.mapstraction.com
-
-Copyright (c) 2012 Tom Carden, Steve Coast, Mikel Maron, Andrew Turner, Henri Bergius, Rob Moran, Derek Fowler, Gary Gale
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- * Neither the name of the Mapstraction nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-mxn.register('cartociudad', {
-
-Geocoder: {
-
- init: function() {
- this.geocoders[this.api] = new metodosCartociudad();
- },
-
- geocode: function(address){
- var return_location = {};
- var mapstraction_geodocer = this;
-
- address.error = 0; //creamos una variable para devolver errores
-
- this.geocoders[this.api].queryNomenclator(address);
-
- if (address.error !== 0) {
- this.error_callback(address);
- }
- else {
- this.geocoders[this.api].addressToMapstraction(address);
- this.callback(address);
- }
- },
-
- geocode_callback: function(response, mapstraction_geocoder){
- var return_location = {};
-
- // TODO: Add provider code
- }
-}
-});
\ No newline at end of file
diff --git a/demoplanner/js/mapstraction/mxn.cloudmade.core-min.js b/demoplanner/js/mapstraction/mxn.cloudmade.core-min.js
deleted file mode 100644
index 30e47c144d..0000000000
--- a/demoplanner/js/mapstraction/mxn.cloudmade.core-min.js
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
-MAPSTRACTION v2.0.18 http://www.mapstraction.com
-
-Copyright (c) 2012 Tom Carden, Steve Coast, Mikel Maron, Andrew Turner, Henri Bergius, Rob Moran, Derek Fowler, Gary Gale
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- * Neither the name of the Mapstraction nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-mxn.register("cloudmade",{Mapstraction:{init:function(a,b){var d=this;var c={key:cloudmade_key};if(typeof cloudmade_styleId!="undefined"){c.styleId=cloudmade_styleId}var e=new CM.Tiles.CloudMade.Web(c);this.maps[b]=new CM.Map(a,e);this.loaded[b]=true;CM.Event.addListener(this.maps[b],"click",function(g,f){if(f&&f.mapstraction_marker){f.mapstraction_marker.click.fire()}else{if(g){d.click.fire({location:new mxn.LatLonPoint(g.lat(),g.lng())})}}if(g){d.clickHandler(g.lat(),g.lng(),g,d)}});CM.Event.addListener(this.maps[b],"dragend",function(){d.endPan.fire()});CM.Event.addListener(this.maps[b],"zoomend",function(){d.changeZoom.fire()})},applyOptions:function(){var a=this.maps[this.api];if(this.options.enableScrollWheelZoom){a.enableScrollWheelZoom()}else{a.disableScrollWheelZoom()}},resizeTo:function(b,a){this.maps[this.api].checkResize()},addControls:function(a){var b=this.maps[this.api];var d=this.addControlsArgs;switch(d.zoom){case"large":this.addLargeControls();break;case"small":this.addSmallControls();break}if(d.map_type){this.addMapTypeControls()}if(d.scale){b.addControl(new CM.ScaleControl());this.addControlsArgs.scale=true}},addSmallControls:function(){var a=this.maps[this.api];a.addControl(new CM.SmallMapControl());this.addControlsArgs.zoom="small"},addLargeControls:function(){var a=this.maps[this.api];a.addControl(new CM.LargeMapControl());this.addControlsArgs.zoom="large"},addMapTypeControls:function(){var a=this.maps[this.api];a.addControl(new CM.TileLayerControl());this.addControlsArgs.map_type=true},dragging:function(a){var b=this.maps[this.api];if(a){b.enableDragging()}else{b.disableDragging()}},setCenterAndZoom:function(a,b){var d=this.maps[this.api];var c=a.toProprietary(this.api);d.setCenter(c,b)},addMarker:function(b,a){var d=this.maps[this.api];var c=b.toProprietary(this.api);d.addOverlay(c);return c},removeMarker:function(a){var b=this.maps[this.api];a.proprietary_marker.closeInfoWindow();b.removeOverlay(a.proprietary_marker)},declutterMarkers:function(a){var b=this.maps[this.api]},addPolyline:function(b,a){var d=this.maps[this.api];var c=b.toProprietary(this.api);d.addOverlay(c);return c},removePolyline:function(a){var b=this.maps[this.api];b.removeOverlay(a.proprietary_polyline)},getCenter:function(){var b=this.maps[this.api];var a=b.getCenter();return new mxn.LatLonPoint(a.lat(),a.lng())},setCenter:function(a,b){var d=this.maps[this.api];var c=a.toProprietary(this.api);if(b!==null&&b.pan){d.panTo(c)}else{d.setCenter(c)}},setZoom:function(a){var b=this.maps[this.api];b.setZoom(a)},getZoom:function(){var a=this.maps[this.api];return a.getZoom()},getZoomLevelForBoundingBox:function(e){var d=this.maps[this.api];var c=e.getNorthEast();var a=e.getSouthWest();var b=d.getBoundsZoomLevel(new CM.LatLngBounds(a.toProprietary(this.api),c.toProprietary(this.api)));return b},setMapType:function(a){var b=this.maps[this.api];switch(a){case mxn.Mapstraction.ROAD:break;case mxn.Mapstraction.SATELLITE:break;case mxn.Mapstraction.HYBRID:break;default:}},getMapType:function(){var a=this.maps[this.api];return mxn.Mapstraction.ROAD},getBounds:function(){var d=this.maps[this.api];var b=d.getBounds();var a=b.getSouthWest();var c=b.getNorthEast();return new mxn.BoundingBox(a.lat(),a.lng(),c.lat(),c.lng())},setBounds:function(b){var d=this.maps[this.api];var a=b.getSouthWest();var c=b.getNorthEast();d.zoomToBounds(new CM.LatLngBounds(a.toProprietary(this.api),c.toProprietary(this.api)))},addImageOverlay:function(c,a,e,i,f,g,d,h){var b=this.maps[this.api]},setImagePosition:function(e,b){var d=this.maps[this.api];var c;var a},addOverlay:function(a,b){var c=this.maps[this.api]},addTileLayer:function(f,a,b,d,e){var c=this.maps[this.api]},toggleTileLayer:function(b){var a=this.maps[this.api]},getPixelRatio:function(){var a=this.maps[this.api]},mousePosition:function(a){var b=this.maps[this.api]}},LatLonPoint:{toProprietary:function(){var a=new CM.LatLng(this.lat,this.lon);return a},fromProprietary:function(a){this.lat=a.lat();this.lon=a.lng()}},Marker:{toProprietary:function(){var d=this.location.toProprietary(this.api);var a={};if(this.iconUrl){var b=new CM.Icon();b.image=this.iconUrl;if(this.iconSize){b.iconSize=new CM.Size(this.iconSize[0],this.iconSize[1]);if(this.iconAnchor){b.iconAnchor=new CM.Point(this.iconAnchor[0],this.iconAnchor[1])}}if(this.iconShadowUrl){b.shadow=this.iconShadowUrl;if(this.iconShadowSize){b.shadowSize=new CM.Size(this.iconShadowSize[0],this.iconShadowSize[1])}}a.icon=b}if(this.labelText){a.title=this.labelText}var c=new CM.Marker(d,a);if(this.infoBubble){c.bindInfoWindow(this.infoBubble)}return c},openBubble:function(){var a=this.proprietary_marker;a.openInfoWindow(this.infoBubble)},hide:function(){var a=this.proprietary_marker;a.hide()},show:function(){var a=this.proprietary_marker;a.show()},update:function(){}},Polyline:{toProprietary:function(){var d=[];var c;for(var a=0,b=this.points.length;a0){this.onload[this.api].shift().apply(this)}};Mapstraction.prototype.clickHandler=function(lat,lon,me){this.callEventListeners("click",{location:new LatLonPoint(lat,lon)})};Mapstraction.prototype.moveendHandler=function(me){this.callEventListeners("moveend",{})};Mapstraction.prototype.addEventListener=function(){var listener={};listener.event_type=arguments[0];listener.callback_function=arguments[1];if(arguments.length==3){listener.back_compat_mode=false;listener.callback_object=arguments[2]}else{listener.back_compat_mode=true;listener.callback_object=null}this.eventListeners.push(listener)};Mapstraction.prototype.callEventListeners=function(sEventType,oEventArgs){oEventArgs.source=this;for(var i=0;i0){current_marker=this.markers.pop();this.invoker.go("removeMarker",[current_marker])}};Mapstraction.prototype.declutterMarkers=function(opts){if(this.loaded[this.api]===false){var me=this;this.onload[this.api].push(function(){me.declutterMarkers(opts)});return}var map=this.maps[this.api];switch(this.api){case"multimap":map.declutterGroup(opts.groupName);break;case" dummy":break;default:if(this.debug){alert(this.api+" not supported by Mapstraction.declutterMarkers")}}};Mapstraction.prototype.addPolyline=function(polyline,old){polyline.api=this.api;polyline.map=this.maps[this.api];var propPoly=this.invoker.go("addPolyline",arguments);polyline.setChild(propPoly);if(!old){this.polylines.push(polyline)}this.polylineAdded.fire({polyline:polyline})};var removePolylineImpl=function(polyline){this.invoker.go("removePolyline",arguments);polyline.onmap=false;this.polylineRemoved.fire({polyline:polyline})};Mapstraction.prototype.removePolyline=function(polyline){var current_polyline;for(var i=0;i0){current_polyline=this.polylines.pop();removePolylineImpl.call(this,current_polyline)}};var collectPoints=function(bMarkers,bPolylines,predicate){var points=[];if(bMarkers){for(var i=0;i0){var padPoints=[];for(var i=0;i=100){opacity=100}var c=opacity/100;var d=document.getElementById(id);if(typeof(d.style.filter)=="string"){d.style.filter="alpha(opacity:"+opacity+")"}if(typeof(d.style.KHTMLOpacity)=="string"){d.style.KHTMLOpacity=c}if(typeof(d.style.MozOpacity)=="string"){d.style.MozOpacity=c}if(typeof(d.style.opacity)=="string"){d.style.opacity=c}};Mapstraction.prototype.setImagePosition=function(id){var imgElement=document.getElementById(id);var oContext={latLng:{top:imgElement.getAttribute("north"),left:imgElement.getAttribute("west"),bottom:imgElement.getAttribute("south"),right:imgElement.getAttribute("east")},pixels:{top:0,right:0,bottom:0,left:0}};this.invoker.go("setImagePosition",arguments,{context:oContext});imgElement.style.top=oContext.pixels.top.toString()+"px";imgElement.style.left=oContext.pixels.left.toString()+"px";imgElement.style.width=(oContext.pixels.right-oContext.pixels.left).toString()+"px";imgElement.style.height=(oContext.pixels.bottom-oContext.pixels.top).toString()+"px"};Mapstraction.prototype.addJSON=function(json){var features;if(typeof(json)=="string"){features=eval("("+json+")")}else{features=json}features=features.features;var map=this.maps[this.api];var html="";var item;var polyline;var marker;var markers=[];if(features.type=="FeatureCollection"){this.addJSON(features.features)}for(var i=0;i"+item.title+"
"+item.description+"
";marker=new Marker(new LatLonPoint(item.geometry.coordinates[1],item.geometry.coordinates[0]));markers.push(marker);this.addMarkerWithData(marker,{infoBubble:html,label:item.title,date:'new Date("'+item.date+'")',iconShadow:item.icon_shadow,marker:item.id,iconShadowSize:item.icon_shadow_size,icon:item.icon,iconSize:item.icon_size,category:item.source_id,draggable:false,hover:false});break;case"Polygon":var points=[];polyline=new Polyline(points);mapstraction.addPolylineWithData(polyline,{fillColor:item.poly_color,date:'new Date("'+item.date+'")',category:item.source_id,width:item.line_width,opacity:item.line_opacity,color:item.line_color,polygon:true});markers.push(polyline);break;default:}}return markers};Mapstraction.prototype.addTileLayer=function(tile_url,opacity,copyright_text,min_zoom,max_zoom,map_type){if(!tile_url){return}opacity=opacity||0.6;copyright_text=copyright_text||"Mapstraction";min_zoom=min_zoom||1;max_zoom=max_zoom||18;map_type=map_type||false;return this.invoker.go("addTileLayer",[tile_url,opacity,copyright_text,min_zoom,max_zoom,map_type])};Mapstraction.prototype.addFilter=function(field,operator,value){if(!this.filters){this.filters=[]}this.filters.push([field,operator,value])};Mapstraction.prototype.removeFilter=function(field,operator,value){if(!this.filters){return}var del;for(var f=0;ff[2]){vis=false}break;case"eq":if(o.getAttribute(f[0])==f[2]){vis=false}break}return vis};Mapstraction.prototype.getAttributeExtremes=function(field){var min;var max;for(var m=0;mthis.markers[m].getAttribute(field)){min=this.markers[m].getAttribute(field)}if(!max||maxthis.polylines[p].getAttribute(field)){min=this.polylines[p].getAttribute(field)}if(!max||max=this.sw.lat&&point.lat<=this.ne.lat&&point.lon>=this.sw.lon&&point.lon<=this.ne.lon};BoundingBox.prototype.toSpan=function(){return new LatLonPoint(Math.abs(this.sw.lat-this.ne.lat),Math.abs(this.sw.lon-this.ne.lon))};BoundingBox.prototype.extend=function(point){if(this.sw.lat>point.lat){this.sw.lat=point.lat}if(this.sw.lon>point.lon){this.sw.lon=point.lon}if(this.ne.lat=tolerance){reduced[reduced.length]=this.points[i];markerPoint=i}}reduced[reduced.length]=this.points[this.points.length-1];this.points=reduced};var Radius=mxn.Radius=function(center,quality){this.center=center;var latConv=center.latConv();var lonConv=center.lonConv();var rad=Math.PI/180;this.calcs=[];for(var i=0;i<360;i+=quality){this.calcs.push([Math.cos(i*rad)/latConv,Math.sin(i*rad)/lonConv])}};Radius.prototype.getPolyline=function(radius,color){var points=[];for(var i=0;i 0) {
- this.onload[this.api].shift().apply(this); //run deferred calls
- }
-};
-
-/////////////////////////
-//
-// Event Handling
-//
-// FIXME need to consolidate some of these handlers...
-//
-///////////////////////////
-
-// Click handler attached to native API
-Mapstraction.prototype.clickHandler = function(lat, lon, me) {
- this.callEventListeners('click', {
- location: new LatLonPoint(lat, lon)
- });
-};
-
-// Move and zoom handler attached to native API
-Mapstraction.prototype.moveendHandler = function(me) {
- this.callEventListeners('moveend', {});
-};
-
-/**
- * Add a listener for an event.
- * @param {String} type Event type to attach listener to
- * @param {Function} func Callback function
- * @param {Object} caller Callback object
- */
-Mapstraction.prototype.addEventListener = function() {
- var listener = {};
- listener.event_type = arguments[0];
- listener.callback_function = arguments[1];
-
- // added the calling object so we can retain scope of callback function
- if(arguments.length == 3) {
- listener.back_compat_mode = false;
- listener.callback_object = arguments[2];
- }
- else {
- listener.back_compat_mode = true;
- listener.callback_object = null;
- }
- this.eventListeners.push(listener);
-};
-
-/**
- * Call listeners for a particular event.
- * @param {String} sEventType Call listeners of this event type
- * @param {Object} oEventArgs Event args object to pass back to the callback
- */
-Mapstraction.prototype.callEventListeners = function(sEventType, oEventArgs) {
- oEventArgs.source = this;
- for(var i = 0; i < this.eventListeners.length; i++) {
- var evLi = this.eventListeners[i];
- if(evLi.event_type == sEventType) {
- // only two cases for this, click and move
- if(evLi.back_compat_mode) {
- if(evLi.event_type == 'click') {
- evLi.callback_function(oEventArgs.location);
- }
- else {
- evLi.callback_function();
- }
- }
- else {
- var scope = evLi.callback_object || this;
- evLi.callback_function.call(scope, oEventArgs);
- }
- }
- }
-};
-
-
-////////////////////
-//
-// map manipulation
-//
-/////////////////////
-
-
-/**
- * addControls adds controls to the map. You specify which controls to add in
- * the associative array that is the only argument.
- * addControls can be called multiple time, with different args, to dynamically change controls.
- *
- * args = {
- * pan: true,
- * zoom: 'large' || 'small',
- * overview: true,
- * scale: true,
- * map_type: true,
- * }
- * @param {array} args Which controls to switch on
- */
-Mapstraction.prototype.addControls = function( args ) {
- this.addControlsArgs = args;
- this.invoker.go('addControls', arguments);
-};
-
-/**
- * Adds a marker pin to the map
- * @param {Marker} marker The marker to add
- * @param {Boolean} old If true, doesn't add this marker to the markers array. Used by the "swap" method
- */
-Mapstraction.prototype.addMarker = function(marker, old) {
- marker.mapstraction = this;
- marker.api = this.api;
- marker.location.api = this.api;
- marker.map = this.maps[this.api];
- var propMarker = this.invoker.go('addMarker', arguments);
- marker.setChild(propMarker);
- if (!old) {
- this.markers.push(marker);
- }
- this.markerAdded.fire({'marker': marker});
-};
-
-/**
- * addMarkerWithData will addData to the marker, then add it to the map
- * @param {Marker} marker The marker to add
- * @param {Object} data A data has to add
- */
-Mapstraction.prototype.addMarkerWithData = function(marker, data) {
- marker.addData(data);
- this.addMarker(marker);
-};
-
-/**
- * addPolylineWithData will addData to the polyline, then add it to the map
- * @param {Polyline} polyline The polyline to add
- * @param {Object} data A data has to add
- */
-Mapstraction.prototype.addPolylineWithData = function(polyline, data) {
- polyline.addData(data);
- this.addPolyline(polyline);
-};
-
-/**
- * removeMarker removes a Marker from the map
- * @param {Marker} marker The marker to remove
- */
-Mapstraction.prototype.removeMarker = function(marker) {
- var current_marker;
- for(var i = 0; i < this.markers.length; i++){
- current_marker = this.markers[i];
- if(marker == current_marker) {
- this.invoker.go('removeMarker', arguments);
- marker.onmap = false;
- this.markers.splice(i, 1);
- this.markerRemoved.fire({'marker': marker});
- break;
- }
- }
-};
-
-/**
- * removeAllMarkers removes all the Markers on a map
- */
-Mapstraction.prototype.removeAllMarkers = function() {
- var current_marker;
- while(this.markers.length > 0) {
- current_marker = this.markers.pop();
- this.invoker.go('removeMarker', [current_marker]);
- }
-};
-
-/**
- * Declutter the markers on the map, group together overlapping markers.
- * @param {Object} opts Declutter options
- */
-Mapstraction.prototype.declutterMarkers = function(opts) {
- if(this.loaded[this.api] === false) {
- var me = this;
- this.onload[this.api].push( function() {
- me.declutterMarkers(opts);
- } );
- return;
- }
-
- var map = this.maps[this.api];
-
- switch(this.api)
- {
- // case 'yahoo':
- //
- // break;
- // case 'google':
- //
- // break;
- // case 'openstreetmap':
- //
- // break;
- // case 'microsoft':
- //
- // break;
- // case 'openlayers':
- //
- // break;
- case 'multimap':
- /*
- * Multimap supports quite a lot of decluttering options such as whether
- * to use an accurate of fast declutter algorithm and what icon to use to
- * represent a cluster. Using all this would mean abstracting all the enums
- * etc so we're only implementing the group name function at the moment.
- */
- map.declutterGroup(opts.groupName);
- break;
- // case 'mapquest':
- //
- // break;
- // case 'map24':
- //
- // break;
- case ' dummy':
- break;
- default:
- if(this.debug) {
- alert(this.api + ' not supported by Mapstraction.declutterMarkers');
- }
- }
-};
-
-/**
- * Add a polyline to the map
- * @param {Polyline} polyline The Polyline to add to the map
- * @param {Boolean} old If true replaces an existing Polyline
- */
-Mapstraction.prototype.addPolyline = function(polyline, old) {
- polyline.api = this.api;
- polyline.map = this.maps[this.api];
- var propPoly = this.invoker.go('addPolyline', arguments);
- polyline.setChild(propPoly);
- if(!old) {
- this.polylines.push(polyline);
- }
- this.polylineAdded.fire({'polyline': polyline});
-};
-
-// Private remove implementation
-var removePolylineImpl = function(polyline) {
- this.invoker.go('removePolyline', arguments);
- polyline.onmap = false;
- this.polylineRemoved.fire({'polyline': polyline});
-};
-
-/**
- * Remove the polyline from the map
- * @param {Polyline} polyline The Polyline to remove from the map
- */
-Mapstraction.prototype.removePolyline = function(polyline) {
- var current_polyline;
- for(var i = 0; i < this.polylines.length; i++){
- current_polyline = this.polylines[i];
- if(polyline == current_polyline) {
- this.polylines.splice(i, 1);
- removePolylineImpl.call(this, polyline);
- break;
- }
- }
-};
-
-/**
- * Removes all polylines from the map
- */
-Mapstraction.prototype.removeAllPolylines = function() {
- var current_polyline;
- while(this.polylines.length > 0) {
- current_polyline = this.polylines.pop();
- removePolylineImpl.call(this, current_polyline);
- }
-};
-
-var collectPoints = function(bMarkers, bPolylines, predicate) {
- var points = [];
-
- if (bMarkers) {
- for (var i = 0; i < this.markers.length; i++) {
- var mark = this.markers[i];
- if (!predicate || predicate(mark)) {
- points.push(mark.location);
- }
- }
- }
-
- if (bPolylines) {
- for(i = 0; i < this.polylines.length; i++) {
- var poly = this.polylines[i];
- if (!predicate || predicate(poly)) {
- for (var j = 0; j < poly.points.length; j++) {
- points.push(poly.points[j]);
- }
- }
- }
- }
-
- return points;
-};
-
-/**
- * Sets the center and zoom of the map to the smallest bounding box
- * containing all markers and polylines
- */
-Mapstraction.prototype.autoCenterAndZoom = function() {
- var points = collectPoints.call(this, true, true);
-
- this.centerAndZoomOnPoints(points);
-};
-
-/**
- * centerAndZoomOnPoints sets the center and zoom of the map from an array of points
- *
- * This is useful if you don't want to have to add markers to the map
- */
-Mapstraction.prototype.centerAndZoomOnPoints = function(points) {
- var bounds = new BoundingBox(90, 180, -90, -180);
-
- for (var i = 0, len = points.length; i < len; i++) {
- bounds.extend(points[i]);
- }
-
- this.setBounds(bounds);
-};
-
-/**
- * Sets the center and zoom of the map to the smallest bounding box
- * containing all visible markers and polylines
- * will only include markers and polylines with an attribute of "visible"
- */
-Mapstraction.prototype.visibleCenterAndZoom = function() {
- var predicate = function(obj) {
- return obj.getAttribute("visible");
- };
- var points = collectPoints.call(this, true, true, predicate);
-
- this.centerAndZoomOnPoints(points);
-};
-
-/**
- * Automatically sets center and zoom level to show all polylines
- * @param {Number} padding Optional number of kilometers to pad around polyline
- */
-Mapstraction.prototype.polylineCenterAndZoom = function(padding) {
- padding = padding || 0;
-
- var points = collectPoints.call(this, false, true);
-
- if (padding > 0) {
- var padPoints = [];
- for (var i = 0; i < points.length; i++) {
- var point = points[i];
-
- var kmInOneDegreeLat = point.latConv();
- var kmInOneDegreeLon = point.lonConv();
-
- var latPad = padding / kmInOneDegreeLat;
- var lonPad = padding / kmInOneDegreeLon;
-
- var ne = new LatLonPoint(point.lat + latPad, point.lon + lonPad);
- var sw = new LatLonPoint(point.lat - latPad, point.lon - lonPad);
-
- padPoints.push(ne, sw);
- }
- points = points.concat(padPoints);
- }
-
- this.centerAndZoomOnPoints(points);
-};
-
-/**
- * addImageOverlay layers an georeferenced image over the map
- * @param {id} unique DOM identifier
- * @param {src} url of image
- * @param {opacity} opacity 0-100
- * @param {west} west boundary
- * @param {south} south boundary
- * @param {east} east boundary
- * @param {north} north boundary
- */
-Mapstraction.prototype.addImageOverlay = function(id, src, opacity, west, south, east, north) {
-
- var b = document.createElement("img");
- b.style.display = 'block';
- b.setAttribute('id',id);
- b.setAttribute('src',src);
- b.style.position = 'absolute';
- b.style.zIndex = 1;
- b.setAttribute('west',west);
- b.setAttribute('south',south);
- b.setAttribute('east',east);
- b.setAttribute('north',north);
-
- var oContext = {
- imgElm: b
- };
-
- this.invoker.go('addImageOverlay', arguments, { context: oContext });
-};
-
-Mapstraction.prototype.setImageOpacity = function(id, opacity) {
- if (opacity < 0) {
- opacity = 0;
- }
- if (opacity >= 100) {
- opacity = 100;
- }
- var c = opacity / 100;
- var d = document.getElementById(id);
- if(typeof(d.style.filter)=='string'){
- d.style.filter='alpha(opacity:'+opacity+')';
- }
- if(typeof(d.style.KHTMLOpacity)=='string'){
- d.style.KHTMLOpacity=c;
- }
- if(typeof(d.style.MozOpacity)=='string'){
- d.style.MozOpacity=c;
- }
- if(typeof(d.style.opacity)=='string'){
- d.style.opacity=c;
- }
-};
-
-Mapstraction.prototype.setImagePosition = function(id) {
- var imgElement = document.getElementById(id);
- var oContext = {
- latLng: {
- top: imgElement.getAttribute('north'),
- left: imgElement.getAttribute('west'),
- bottom: imgElement.getAttribute('south'),
- right: imgElement.getAttribute('east')
- },
- pixels: { top: 0, right: 0, bottom: 0, left: 0 }
- };
-
- this.invoker.go('setImagePosition', arguments, { context: oContext });
-
- imgElement.style.top = oContext.pixels.top.toString() + 'px';
- imgElement.style.left = oContext.pixels.left.toString() + 'px';
- imgElement.style.width = (oContext.pixels.right - oContext.pixels.left).toString() + 'px';
- imgElement.style.height = (oContext.pixels.bottom - oContext.pixels.top).toString() + 'px';
-};
-
-Mapstraction.prototype.addJSON = function(json) {
- var features;
- if (typeof(json) == "string") {
- features = eval('(' + json + ')');
- } else {
- features = json;
- }
- features = features.features;
- var map = this.maps[this.api];
- var html = "";
- var item;
- var polyline;
- var marker;
- var markers = [];
-
- if(features.type == "FeatureCollection") {
- this.addJSON(features.features);
- }
-
- for (var i = 0; i < features.length; i++) {
- item = features[i];
- switch(item.geometry.type) {
- case "Point":
- html = "" + item.title + "
" + item.description + "
";
- marker = new Marker(new LatLonPoint(item.geometry.coordinates[1],item.geometry.coordinates[0]));
- markers.push(marker);
- this.addMarkerWithData(marker,{
- infoBubble : html,
- label : item.title,
- date : "new Date(\""+item.date+"\")",
- iconShadow : item.icon_shadow,
- marker : item.id,
- iconShadowSize : item.icon_shadow_size,
- icon : item.icon,
- iconSize : item.icon_size,
- category : item.source_id,
- draggable : false,
- hover : false
- });
- break;
- case "Polygon":
- var points = [];
- polyline = new Polyline(points);
- mapstraction.addPolylineWithData(polyline,{
- fillColor : item.poly_color,
- date : "new Date(\""+item.date+"\")",
- category : item.source_id,
- width : item.line_width,
- opacity : item.line_opacity,
- color : item.line_color,
- polygon : true
- });
- markers.push(polyline);
- break;
- default:
- // console.log("Geometry: " + features.items[i].geometry.type);
- }
- }
- return markers;
-};
-
-/**
- * Adds a Tile Layer to the map
- *
- * Requires providing a parameterized tile url. Use {Z}, {X}, and {Y} to specify where the parameters
- * should go in the URL.
- *
- * For example, the OpenStreetMap tiles are:
- * m.addTileLayer("http://tile.openstreetmap.org/{Z}/{X}/{Y}.png", 1.0, "OSM", 1, 19, true);
- *
- * @param {tile_url} template url of the tiles.
- * @param {opacity} opacity of the tile layer - 0 is transparent, 1 is opaque. (default=0.6)
- * @param {copyright_text} copyright text to use for the tile layer. (default=Mapstraction)
- * @param {min_zoom} Minimum (furtherest out) zoom level that tiles are available (default=1)
- * @param {max_zoom} Maximum (closest) zoom level that the tiles are available (default=18)
- * @param {map_type} Should the tile layer be a selectable map type in the layers palette (default=false)
- */
-Mapstraction.prototype.addTileLayer = function(tile_url, opacity, copyright_text, min_zoom, max_zoom, map_type) {
- if(!tile_url) {
- return;
- }
-
- opacity = opacity || 0.6;
- copyright_text = copyright_text || "Mapstraction";
- min_zoom = min_zoom || 1;
- max_zoom = max_zoom || 18;
- map_type = map_type || false;
-
- return this.invoker.go('addTileLayer', [ tile_url, opacity, copyright_text, min_zoom, max_zoom, map_type] );
-};
-
-/**
- * addFilter adds a marker filter
- * @param {field} name of attribute to filter on
- * @param {operator} presently only "ge" or "le"
- * @param {value} the value to compare against
- */
-Mapstraction.prototype.addFilter = function(field, operator, value) {
- if (!this.filters) {
- this.filters = [];
- }
- this.filters.push( [field, operator, value] );
-};
-
-/**
- * Remove the specified filter
- * @param {Object} field
- * @param {Object} operator
- * @param {Object} value
- */
-Mapstraction.prototype.removeFilter = function(field, operator, value) {
- if (!this.filters) {
- return;
- }
-
- var del;
- for (var f=0; f f[2]) {
- vis = false;
- }
- break;
- case 'eq':
- if (o.getAttribute( f[0] ) == f[2]) {
- vis = false;
- }
- break;
- }
-
- return vis;
-};
-
-/**
- * getAttributeExtremes returns the minimum/maximum of "field" from all markers
- * @param {field} name of "field" to query
- * @returns {array} of minimum/maximum
- */
-Mapstraction.prototype.getAttributeExtremes = function(field) {
- var min;
- var max;
- for (var m=0; m this.markers[m].getAttribute(field)) {
- min = this.markers[m].getAttribute(field);
- }
- if (! max || max < this.markers[m].getAttribute(field)) {
- max = this.markers[m].getAttribute(field);
- }
- }
- for (var p=0; m this.polylines[p].getAttribute(field)) {
- min = this.polylines[p].getAttribute(field);
- }
- if (! max || max < this.polylines[p].getAttribute(field)) {
- max = this.polylines[p].getAttribute(field);
- }
- }
-
- return [min, max];
-};
-
-/**
- * getMap returns the native map object that mapstraction is talking to
- * @returns the native map object mapstraction is using
- */
-Mapstraction.prototype.getMap = function() {
- // FIXME in an ideal world this shouldn't exist right?
- return this.maps[this.api];
-};
-
-
-//////////////////////////////
-//
-// LatLonPoint
-//
-/////////////////////////////
-
-/**
- * LatLonPoint is a point containing a latitude and longitude with helper methods
- * @name mxn.LatLonPoint
- * @constructor
- * @param {double} lat is the latitude
- * @param {double} lon is the longitude
- * @exports LatLonPoint as mxn.LatLonPoint
- */
-var LatLonPoint = mxn.LatLonPoint = function(lat, lon) {
- this.lat = Number(lat); // force to be numeric
- this.lon = Number(lon);
- this.lng = this.lon; // lets be lon/lng agnostic
-
- this.invoker = new mxn.Invoker(this, 'LatLonPoint');
-};
-
-mxn.addProxyMethods(LatLonPoint, [
- /**
- * Retrieve the lat and lon values from a proprietary point.
- * @name mxn.LatLonPoint#fromProprietary
- * @function
- * @param {String} apiId The API ID of the proprietary point.
- * @param {Object} point The proprietary point.
- */
- 'fromProprietary',
-
- /**
- * Converts the current LatLonPoint to a proprietary one for the API specified by apiId.
- * @name mxn.LatLonPoint#toProprietary
- * @function
- * @param {String} apiId The API ID of the proprietary point.
- * @returns A proprietary point.
- */
- 'toProprietary'
-], true);
-
-/**
- * toString returns a string represntation of a point
- * @returns a string like '51.23, -0.123'
- * @type String
- */
-LatLonPoint.prototype.toString = function() {
- return this.lat + ', ' + this.lon;
-};
-
-/**
- * distance returns the distance in kilometers between two points
- * @param {LatLonPoint} otherPoint The other point to measure the distance from to this one
- * @returns the distance between the points in kilometers
- * @type double
- */
-LatLonPoint.prototype.distance = function(otherPoint) {
- // Uses Haversine formula from http://www.movable-type.co.uk
- var rads = Math.PI / 180;
- var diffLat = (this.lat-otherPoint.lat) * rads;
- var diffLon = (this.lon-otherPoint.lon) * rads;
- var a = Math.sin(diffLat / 2) * Math.sin(diffLat / 2) +
- Math.cos(this.lat*rads) * Math.cos(otherPoint.lat*rads) *
- Math.sin(diffLon/2) * Math.sin(diffLon/2);
- return 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)) * 6371; // Earth's mean radius in km
-};
-
-/**
- * equals tests if this point is the same as some other one
- * @param {LatLonPoint} otherPoint The other point to test with
- * @returns true or false
- * @type boolean
- */
-LatLonPoint.prototype.equals = function(otherPoint) {
- return this.lat == otherPoint.lat && this.lon == otherPoint.lon;
-};
-
-/**
- * Returns latitude conversion based on current projection
- * @returns {Float} conversion
- */
-LatLonPoint.prototype.latConv = function() {
- return this.distance(new LatLonPoint(this.lat + 0.1, this.lon))*10;
-};
-
-/**
- * Returns longitude conversion based on current projection
- * @returns {Float} conversion
- */
-LatLonPoint.prototype.lonConv = function() {
- return this.distance(new LatLonPoint(this.lat, this.lon + 0.1))*10;
-};
-
-
-//////////////////////////
-//
-// BoundingBox
-//
-//////////////////////////
-
-/**
- * BoundingBox creates a new bounding box object
- * @name mxn.BoundingBox
- * @constructor
- * @param {double} swlat the latitude of the south-west point
- * @param {double} swlon the longitude of the south-west point
- * @param {double} nelat the latitude of the north-east point
- * @param {double} nelon the longitude of the north-east point
- * @exports BoundingBox as mxn.BoundingBox
- */
-var BoundingBox = mxn.BoundingBox = function(swlat, swlon, nelat, nelon) {
- //FIXME throw error if box bigger than world
- this.sw = new LatLonPoint(swlat, swlon);
- this.ne = new LatLonPoint(nelat, nelon);
-};
-
-/**
- * getSouthWest returns a LatLonPoint of the south-west point of the bounding box
- * @returns the south-west point of the bounding box
- * @type LatLonPoint
- */
-BoundingBox.prototype.getSouthWest = function() {
- return this.sw;
-};
-
-/**
- * getNorthEast returns a LatLonPoint of the north-east point of the bounding box
- * @returns the north-east point of the bounding box
- * @type LatLonPoint
- */
-BoundingBox.prototype.getNorthEast = function() {
- return this.ne;
-};
-
-/**
- * isEmpty finds if this bounding box has zero area
- * @returns whether the north-east and south-west points of the bounding box are the same point
- * @type boolean
- */
-BoundingBox.prototype.isEmpty = function() {
- return this.ne == this.sw; // is this right? FIXME
-};
-
-/**
- * contains finds whether a given point is within a bounding box
- * @param {LatLonPoint} point the point to test with
- * @returns whether point is within this bounding box
- * @type boolean
- */
-BoundingBox.prototype.contains = function(point){
- return point.lat >= this.sw.lat && point.lat <= this.ne.lat && point.lon >= this.sw.lon && point.lon <= this.ne.lon;
-};
-
-/**
- * toSpan returns a LatLonPoint with the lat and lon as the height and width of the bounding box
- * @returns a LatLonPoint containing the height and width of this bounding box
- * @type LatLonPoint
- */
-BoundingBox.prototype.toSpan = function() {
- return new LatLonPoint( Math.abs(this.sw.lat - this.ne.lat), Math.abs(this.sw.lon - this.ne.lon) );
-};
-
-
-
-/**
- * extend extends the bounding box to include the new point
- */
-BoundingBox.prototype.extend = function(point) {
- if (this.sw.lat > point.lat) {
- this.sw.lat = point.lat;
- }
- if (this.sw.lon > point.lon) {
- this.sw.lon = point.lon;
- }
- if (this.ne.lat < point.lat) {
- this.ne.lat = point.lat;
- }
- if (this.ne.lon < point.lon) {
- this.ne.lon = point.lon;
- }
- return;
-};
-
-//////////////////////////////
-//
-// Marker
-//
-///////////////////////////////
-
-/**
- * Marker create's a new marker pin
- * @name mxn.Marker
- * @constructor
- * @param {LatLonPoint} point the point on the map where the marker should go
- * @exports Marker as mxn.Marker
- */
-var Marker = mxn.Marker = function(point) {
- this.api = null;
- this.location = point;
- this.onmap = false;
- this.proprietary_marker = false;
- this.attributes = [];
- this.invoker = new mxn.Invoker(this, 'Marker', function(){return this.api;});
- mxn.addEvents(this, [
- 'openInfoBubble', // Info bubble opened
- 'closeInfoBubble', // Info bubble closed
- 'click' // Marker clicked
- ]);
-};
-
-mxn.addProxyMethods(Marker, [
- /**
- * Retrieve the settings from a proprietary marker.
- * @name mxn.Marker#fromProprietary
- * @function
- * @param {String} apiId The API ID of the proprietary point.
- * @param {Object} marker The proprietary marker.
- */
- 'fromProprietary',
-
- /**
- * Hide the marker.
- * @name mxn.Marker#hide
- * @function
- */
- 'hide',
-
- /**
- * Open the marker's info bubble.
- * @name mxn.Marker#openBubble
- * @function
- */
- 'openBubble',
-
- /**
- * Closes the marker's info bubble.
- * @name mxn.Marker#closeBubble
- * @function
- */
- 'closeBubble',
-
- /**
- * Show the marker.
- * @name mxn.Marker#show
- * @function
- */
- 'show',
-
- /**
- * Converts the current Marker to a proprietary one for the API specified by apiId.
- * @name mxn.Marker#toProprietary
- * @function
- * @param {String} apiId The API ID of the proprietary marker.
- * @returns A proprietary marker.
- */
- 'toProprietary',
-
- /**
- * Updates the Marker with the location of the attached proprietary marker on the map.
- * @name mxn.Marker#update
- * @function
- */
- 'update'
-]);
-
-Marker.prototype.setChild = function(some_proprietary_marker) {
- this.proprietary_marker = some_proprietary_marker;
- some_proprietary_marker.mapstraction_marker = this;
- this.onmap = true;
-};
-
-Marker.prototype.setLabel = function(labelText) {
- this.labelText = labelText;
-};
-
-/**
- * addData conviniently set a hash of options on a marker
- * @param {Object} options An object literal hash of key value pairs. Keys are: label, infoBubble, icon, iconShadow, infoDiv, draggable, hover, hoverIcon, openBubble, groupName.
- */
-Marker.prototype.addData = function(options){
- for(var sOptKey in options) {
- if(options.hasOwnProperty(sOptKey)){
- switch(sOptKey) {
- case 'label':
- this.setLabel(options.label);
- break;
- case 'infoBubble':
- this.setInfoBubble(options.infoBubble);
- break;
- case 'icon':
- if(options.iconSize && options.iconAnchor) {
- this.setIcon(options.icon, options.iconSize, options.iconAnchor);
- }
- else if(options.iconSize) {
- this.setIcon(options.icon, options.iconSize);
- }
- else {
- this.setIcon(options.icon);
- }
- break;
- case 'iconShadow':
- if(options.iconShadowSize) {
- this.setShadowIcon(options.iconShadow, [ options.iconShadowSize[0], options.iconShadowSize[1] ]);
- }
- else {
- this.setIcon(options.iconShadow);
- }
- break;
- case 'infoDiv':
- this.setInfoDiv(options.infoDiv[0],options.infoDiv[1]);
- break;
- case 'draggable':
- this.setDraggable(options.draggable);
- break;
- case 'hover':
- this.setHover(options.hover);
- this.setHoverIcon(options.hoverIcon);
- break;
- case 'hoverIcon':
- this.setHoverIcon(options.hoverIcon);
- break;
- case 'openBubble':
- this.openBubble();
- break;
- case 'closeBubble':
- this.closeBubble();
- break;
- case 'groupName':
- this.setGroupName(options.groupName);
- break;
- default:
- // don't have a specific action for this bit of
- // data so set a named attribute
- this.setAttribute(sOptKey, options[sOptKey]);
- break;
- }
- }
- }
-};
-
-/**
- * Sets the html/text content for a bubble popup for a marker
- * @param {String} infoBubble the html/text you want displayed
- */
-Marker.prototype.setInfoBubble = function(infoBubble) {
- this.infoBubble = infoBubble;
-};
-
-/**
- * Sets the text and the id of the div element where to the information
- * useful for putting information in a div outside of the map
- * @param {String} infoDiv the html/text you want displayed
- * @param {String} div the element id to use for displaying the text/html
- */
-Marker.prototype.setInfoDiv = function(infoDiv,div){
- this.infoDiv = infoDiv;
- this.div = div;
-};
-
-/**
- * Sets the icon for a marker
- * @param {String} iconUrl The URL of the image you want to be the icon
- */
-Marker.prototype.setIcon = function(iconUrl, iconSize, iconAnchor) {
- this.iconUrl = iconUrl;
- if(iconSize) {
- this.iconSize = iconSize;
- }
- if(iconAnchor) {
- this.iconAnchor = iconAnchor;
- }
-};
-
-/**
- * Sets the size of the icon for a marker
- * @param {Array} iconSize The array size in pixels of the marker image: [ width, height ]
- */
-Marker.prototype.setIconSize = function(iconSize){
- if(iconSize) {
- this.iconSize = iconSize;
- }
-};
-
-/**
- * Sets the anchor point for a marker
- * @param {Array} iconAnchor The array offset in pixels of the anchor point from top left: [ right, down ]
- */
-Marker.prototype.setIconAnchor = function(iconAnchor){
- if(iconAnchor) {
- this.iconAnchor = iconAnchor;
- }
-};
-
-/**
- * Sets the icon for a marker
- * @param {String} iconUrl The URL of the image you want to be the icon
- */
-Marker.prototype.setShadowIcon = function(iconShadowUrl, iconShadowSize){
- this.iconShadowUrl = iconShadowUrl;
- if(iconShadowSize) {
- this.iconShadowSize = iconShadowSize;
- }
-};
-
-Marker.prototype.setHoverIcon = function(hoverIconUrl){
- this.hoverIconUrl = hoverIconUrl;
-};
-
-/**
- * Sets the draggable state of the marker
- * @param {Bool} draggable set to true if marker should be draggable by the user
- */
-Marker.prototype.setDraggable = function(draggable) {
- this.draggable = draggable;
-};
-
-/**
- * Sets that the marker info is displayed on hover
- * @param {Boolean} hover set to true if marker should display info on hover
- */
-Marker.prototype.setHover = function(hover) {
- this.hover = hover;
-};
-
-/**
- * Markers are grouped up by this name. declutterGroup makes use of this.
- */
-Marker.prototype.setGroupName = function(sGrpName) {
- this.groupName = sGrpName;
-};
-
-/**
- * Set an arbitrary key/value pair on a marker
- * @param {String} key
- * @param value
- */
-Marker.prototype.setAttribute = function(key,value) {
- this.attributes[key] = value;
-};
-
-/**
- * getAttribute: gets the value of "key"
- * @param {String} key
- * @returns value
- */
-Marker.prototype.getAttribute = function(key) {
- return this.attributes[key];
-};
-
-
-///////////////
-// Polyline ///
-///////////////
-
-/**
- * Instantiates a new Polyline.
- * @name mxn.Polyline
- * @constructor
- * @param {Point[]} points Points that make up the Polyline.
- * @exports Polyline as mxn.Polyline
- */
-var Polyline = mxn.Polyline = function(points) {
- this.api = null;
- this.points = points;
- this.attributes = [];
- this.onmap = false;
- this.proprietary_polyline = false;
- this.pllID = "mspll-"+new Date().getTime()+'-'+(Math.floor(Math.random()*Math.pow(2,16)));
- this.invoker = new mxn.Invoker(this, 'Polyline', function(){return this.api;});
-};
-
-mxn.addProxyMethods(Polyline, [
-
- /**
- * Retrieve the settings from a proprietary polyline.
- * @name mxn.Polyline#fromProprietary
- * @function
- * @param {String} apiId The API ID of the proprietary polyline.
- * @param {Object} polyline The proprietary polyline.
- */
- 'fromProprietary',
-
- /**
- * Hide the polyline.
- * @name mxn.Polyline#hide
- * @function
- */
- 'hide',
-
- /**
- * Show the polyline.
- * @name mxn.Polyline#show
- * @function
- */
- 'show',
-
- /**
- * Converts the current Polyline to a proprietary one for the API specified by apiId.
- * @name mxn.Polyline#toProprietary
- * @function
- * @param {String} apiId The API ID of the proprietary polyline.
- * @returns A proprietary polyline.
- */
- 'toProprietary',
-
- /**
- * Updates the Polyline with the path of the attached proprietary polyline on the map.
- * @name mxn.Polyline#update
- * @function
- */
- 'update'
-]);
-
-/**
- * addData conviniently set a hash of options on a polyline
- * @param {Object} options An object literal hash of key value pairs. Keys are: color, width, opacity, closed, fillColor.
- */
-Polyline.prototype.addData = function(options){
- for(var sOpt in options) {
- if(options.hasOwnProperty(sOpt)){
- switch(sOpt) {
- case 'color':
- this.setColor(options.color);
- break;
- case 'width':
- this.setWidth(options.width);
- break;
- case 'opacity':
- this.setOpacity(options.opacity);
- break;
- case 'closed':
- this.setClosed(options.closed);
- break;
- case 'fillColor':
- this.setFillColor(options.fillColor);
- break;
- default:
- this.setAttribute(sOpt, options[sOpt]);
- break;
- }
- }
- }
-};
-
-Polyline.prototype.setChild = function(some_proprietary_polyline) {
- this.proprietary_polyline = some_proprietary_polyline;
- this.onmap = true;
-};
-
-/**
- * in the form: #RRGGBB
- * Note map24 insists on upper case, so we convert it.
- */
-Polyline.prototype.setColor = function(color){
- this.color = (color.length==7 && color[0]=="#") ? color.toUpperCase() : color;
-};
-
-/**
- * Stroke width of the polyline
- * @param {Integer} width
- */
-Polyline.prototype.setWidth = function(width){
- this.width = width;
-};
-
-/**
- * A float between 0.0 and 1.0
- * @param {Float} opacity
- */
-Polyline.prototype.setOpacity = function(opacity){
- this.opacity = opacity;
-};
-
-/**
- * Marks the polyline as a closed polygon
- * @param {Boolean} bClosed
- */
-Polyline.prototype.setClosed = function(bClosed){
- this.closed = bClosed;
-};
-
-/**
- * Fill color for a closed polyline as HTML color value e.g. #RRGGBB
- * @param {String} sFillColor HTML color value #RRGGBB
- */
-Polyline.prototype.setFillColor = function(sFillColor) {
- this.fillColor = sFillColor;
-};
-
-
-/**
- * Set an arbitrary key/value pair on a polyline
- * @param {String} key
- * @param value
- */
-Polyline.prototype.setAttribute = function(key,value) {
- this.attributes[key] = value;
-};
-
-/**
- * Gets the value of "key"
- * @param {String} key
- * @returns value
- */
-Polyline.prototype.getAttribute = function(key) {
- return this.attributes[key];
-};
-
-/**
- * Simplifies a polyline, averaging and reducing the points
- * @param {Number} tolerance (1.0 is a good starting point)
- */
-Polyline.prototype.simplify = function(tolerance) {
- var reduced = [];
-
- // First point
- reduced[0] = this.points[0];
-
- var markerPoint = 0;
-
- for (var i = 1; i < this.points.length-1; i++){
- if (this.points[i].distance(this.points[markerPoint]) >= tolerance)
- {
- reduced[reduced.length] = this.points[i];
- markerPoint = i;
- }
- }
-
- // Last point
- reduced[reduced.length] = this.points[this.points.length-1];
-
- // Revert
- this.points = reduced;
-};
-
-///////////////
-// Radius //
-///////////////
-
-/**
- * Creates a new radius object for drawing circles around a point, does a lot of initial calculation to increase load time
- * @name mxn.Radius
- * @constructor
- * @param {LatLonPoint} center LatLonPoint of the radius
- * @param {Number} quality Number of points that comprise the approximated circle (20 is a good starting point)
- * @exports Radius as mxn.Radius
- */
-var Radius = mxn.Radius = function(center, quality) {
- this.center = center;
- var latConv = center.latConv();
- var lonConv = center.lonConv();
-
- // Create Radian conversion constant
- var rad = Math.PI / 180;
- this.calcs = [];
-
- for(var i = 0; i < 360; i += quality){
- this.calcs.push([Math.cos(i * rad) / latConv, Math.sin(i * rad) / lonConv]);
- }
-};
-
-/**
- * Returns polyline of a circle around the point based on new radius
- * @param {Radius} radius
- * @param {Color} color
- * @returns {Polyline} Polyline
- */
-Radius.prototype.getPolyline = function(radius, color) {
- var points = [];
-
- for(var i = 0; i < this.calcs.length; i++){
- var point = new LatLonPoint(
- this.center.lat + (radius * this.calcs[i][0]),
- this.center.lon + (radius * this.calcs[i][1])
- );
- points.push(point);
- }
-
- // Add first point
- points.push(points[0]);
-
- var line = new Polyline(points);
- line.setColor(color);
-
- return line;
-};
-
-
-})();
diff --git a/demoplanner/js/mapstraction/mxn.geocoder-min.js b/demoplanner/js/mapstraction/mxn.geocoder-min.js
deleted file mode 100644
index 49173b6072..0000000000
--- a/demoplanner/js/mapstraction/mxn.geocoder-min.js
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
-MAPSTRACTION v2.0.18 http://www.mapstraction.com
-
-Copyright (c) 2012 Tom Carden, Steve Coast, Mikel Maron, Andrew Turner, Henri Bergius, Rob Moran, Derek Fowler, Gary Gale
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- * Neither the name of the Mapstraction nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-(function(){var b=function(){this.invoker.go("init")};var a=mxn.Geocoder=function(d,e,c){this.api=d;this.geocoders={};this.callback=e;this.error_callback=c||function(){};this.invoker=new mxn.Invoker(this,"Geocoder",function(){return this.api});b.apply(this)};mxn.addProxyMethods(a,["geocode","geocode_callback"]);a.prototype.swap=function(c){if(this.api==c){return}this.api=c;if(!this.geocoders.hasOwnProperty(this.api)){b.apply(this)}}})();
\ No newline at end of file
diff --git a/demoplanner/js/mapstraction/mxn.geocoder.js b/demoplanner/js/mapstraction/mxn.geocoder.js
deleted file mode 100644
index 5f370c91eb..0000000000
--- a/demoplanner/js/mapstraction/mxn.geocoder.js
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
-MAPSTRACTION v2.0.18 http://www.mapstraction.com
-
-Copyright (c) 2012 Tom Carden, Steve Coast, Mikel Maron, Andrew Turner, Henri Bergius, Rob Moran, Derek Fowler, Gary Gale
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- * Neither the name of the Mapstraction nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-(function(){
-
-/**
- * Initialise our provider. This function should only be called
- * from within mapstraction code, not exposed as part of the API.
- * @private
- */
-var init = function() {
- this.invoker.go('init');
-};
-
-/**
- * Geocoder instantiates a geocoder with some API choice
- * @name mxn.Geocoder
- * @constructor
- * @param {String} api The API to use, currently only 'mapquest' is supported
- * @param {Function} callback The function to call when a geocode request returns (function(waypoint))
- * @param {Function} error_callback The optional function to call when a geocode request fails
- * @exports Geocoder as mxn.Geocoder
- */
-var Geocoder = mxn.Geocoder = function (api, callback, error_callback) {
- this.api = api;
- this.geocoders = {};
- this.callback = callback;
- this.error_callback = error_callback || function(){};
-
- // set up our invoker for calling API methods
- this.invoker = new mxn.Invoker(this, 'Geocoder', function(){ return this.api; });
- init.apply(this);
-};
-
-mxn.addProxyMethods(Geocoder, [
-
- /**
- * Geocodes the provided address.
- * @name mxn.Geocoder#geocode
- * @function
- * @param {Object} address Address hash, keys are: street, locality, region, country.
- */
- 'geocode',
-
- 'geocode_callback'
-
-]);
-
-/**
- * Change the geocoding API in use
- * @name mxn.Geocoder#swap
- * @param {String} api The API to swap to
- */
-Geocoder.prototype.swap = function(api) {
- if (this.api == api) { return; }
-
- this.api = api;
- if (!this.geocoders.hasOwnProperty(this.api)) {
- init.apply(this);
- }
-};
-
-})();
\ No newline at end of file
diff --git a/demoplanner/js/mapstraction/mxn.geocommons.core-min.js b/demoplanner/js/mapstraction/mxn.geocommons.core-min.js
deleted file mode 100644
index 0fb4b53056..0000000000
--- a/demoplanner/js/mapstraction/mxn.geocommons.core-min.js
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
-MAPSTRACTION v2.0.18 http://www.mapstraction.com
-
-Copyright (c) 2012 Tom Carden, Steve Coast, Mikel Maron, Andrew Turner, Henri Bergius, Rob Moran, Derek Fowler, Gary Gale
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- * Neither the name of the Mapstraction nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-mxn.register("geocommons",{Mapstraction:{init:function(a,b){var c=this;this.element=a;this.loaded[this.api]=false;this.maps[b]=new F1.Maker.Map({dom_id:this.element.id,map_id:143049,uiLayers:false,flashvars:{},onMapLoaded:function(e){c.loaded[c.api]=true;var f=c.onload[c.api].length;for(var d=0;d0){var j=a.splice(0,k);var i;while((i=j.shift())){i()}}});google.maps.event.addListener(g,"click",function(i){f.click.fire({location:new mxn.LatLonPoint(i.latLng.lat(),i.latLng.lng())})});google.maps.event.addListener(g,"zoom_changed",function(){a.push(function(){f.changeZoom.fire()})});google.maps.event.addListener(g,"dragend",function(){f.moveendHandler(f);f.endPan.fire()});var h=google.maps.event.addListener(g,"tilesloaded",function(){f.load.fire();google.maps.event.removeListener(h)});this.maps[e]=g;this.loaded[e]=true}else{alert(e+" map script not imported")}},applyOptions:function(){var b=this.maps[this.api];var a=[];if(this.options.enableDragging){a.draggable=true}if(this.options.enableScrollWheelZoom){a.scrollwheel=true}b.setOptions(a)},resizeTo:function(b,a){this.currentElement.style.width=b;this.currentElement.style.height=a;var c=this.maps[this.api];google.maps.event.trigger(c,"resize")},addControls:function(b){var c=this.maps[this.api];var a;if(b.zoom||b.pan){if(b.zoom=="large"){this.addLargeControls()}else{this.addSmallControls()}}if(b.scale){a={scaleControl:true,scaleControlOptions:{style:google.maps.ScaleControlStyle.DEFAULT}};c.setOptions(a);this.addControlsArgs.scale=true}if(b.map_type){this.addMapTypeControls()}if(b.overview){a={overviewMapControl:true,overviewMapControlOptions:{opened:true}};c.setOptions(a);this.addControlsArgs.overview=true}},addSmallControls:function(){var b=this.maps[this.api];var a={navigationControl:true,navigationControlOptions:{style:google.maps.NavigationControlStyle.SMALL}};b.setOptions(a);this.addControlsArgs.pan=false;this.addControlsArgs.scale=false;this.addControlsArgs.zoom="small"},addLargeControls:function(){var b=this.maps[this.api];var a={navigationControl:true,navigationControlOptions:{style:google.maps.NavigationControlStyle.DEFAULT}};b.setOptions(a);this.addControlsArgs.pan=true;this.addControlsArgs.zoom="large"},addMapTypeControls:function(){var b=this.maps[this.api];var a={mapTypeControl:true,mapTypeControlOptions:{style:google.maps.MapTypeControlStyle.DEFAULT}};b.setOptions(a);this.addControlsArgs.map_type=true},setCenterAndZoom:function(a,b){var d=this.maps[this.api];var c=a.toProprietary(this.api);d.setCenter(c);d.setZoom(b)},addMarker:function(b,a){return b.toProprietary(this.api)},removeMarker:function(a){a.hide()},declutterMarkers:function(a){var b=this.maps[this.api]},addPolyline:function(c,b){var d=this.maps[this.api];var a=c.toProprietary(this.api);a.setMap(d);return a},removePolyline:function(a){var b=this.maps[this.api];a.proprietary_polyline.setMap(null)},getCenter:function(){var b=this.maps[this.api];var a=b.getCenter();return new mxn.LatLonPoint(a.lat(),a.lng())},setCenter:function(a,b){var d=this.maps[this.api];var c=a.toProprietary(this.api);if(b&&b.pan){d.panTo(c)}else{d.setCenter(c)}},setZoom:function(a){var b=this.maps[this.api];b.setZoom(a)},getZoom:function(){var a=this.maps[this.api];return a.getZoom()},getZoomLevelForBoundingBox:function(e){var d=this.maps[this.api];var a=e.getSouthWest().toProprietary(this.api);var c=e.getNorthEast().toProprietary(this.api);var b=new google.maps.LatLngBounds(a,c);d.fitBounds(b);return d.getZoom()},setMapType:function(a){var b=this.maps[this.api];switch(a){case mxn.Mapstraction.ROAD:b.setMapTypeId(google.maps.MapTypeId.ROADMAP);break;case mxn.Mapstraction.SATELLITE:b.setMapTypeId(google.maps.MapTypeId.SATELLITE);break;case mxn.Mapstraction.HYBRID:b.setMapTypeId(google.maps.MapTypeId.HYBRID);break;case mxn.Mapstraction.PHYSICAL:b.setMapTypeId(google.maps.MapTypeId.TERRAIN);break;default:b.setMapTypeId(google.maps.MapTypeId.ROADMAP)}},getMapType:function(){var b=this.maps[this.api];var a=b.getMapTypeId();switch(a){case google.maps.MapTypeId.ROADMAP:return mxn.Mapstraction.ROAD;case google.maps.MapTypeId.SATELLITE:return mxn.Mapstraction.SATELLITE;case google.maps.MapTypeId.HYBRID:return mxn.Mapstraction.HYBRID;case google.maps.MapTypeId.TERRAIN:return mxn.Mapstraction.PHYSICAL;default:return null}},getBounds:function(){var d=this.maps[this.api];var c=d.getBounds();if(!c){throw"Bounds not available, map must be initialized"}var a=c.getSouthWest();var b=c.getNorthEast();return new mxn.BoundingBox(a.lat(),a.lng(),b.lat(),b.lng())},setBounds:function(b){var e=this.maps[this.api];var a=b.getSouthWest().toProprietary(this.api);var d=b.getNorthEast().toProprietary(this.api);var c=new google.maps.LatLngBounds(a,d);e.fitBounds(c)},addImageOverlay:function(c,a,f,k,g,i,e,j){var b=this.maps[this.api];var h=new google.maps.LatLngBounds(new google.maps.LatLng(g,k),new google.maps.LatLng(e,i));var d=new google.maps.GroundOverlay(a,h);d.setMap(b)},setImagePosition:function(b,a){},addOverlay:function(a,d){var e=this.maps[this.api];var c={preserveViewport:(!d)};var b=new google.maps.KmlLayer(a,c);b.setMap(e)},addTileLayer:function(l,g,d,k,h,m){var a=this.maps[this.api];var j=[];var i=this.tileLayers.length||0;j[0]={getTileUrl:function(o,f){url=l;url=url.replace(/\{Z\}/g,f);url=url.replace(/\{X\}/g,o.x);url=url.replace(/\{Y\}/g,o.y);return url},tileSize:new google.maps.Size(256,256),isPng:true,minZoom:k,maxZoom:h,opacity:g,name:d};var n=new google.maps.ImageMapType(j[0]);if(m){a.mapTypes.set("tile"+i,n);var c=[google.maps.MapTypeId.ROADMAP,google.maps.MapTypeId.HYBRID,google.maps.MapTypeId.SATELLITE,google.maps.MapTypeId.TERRAIN];for(var e=0;e 0) {
- var fireList = fireOnNextIdle.splice(0, fireListCount);
- var handler;
- while((handler = fireList.shift())){
- handler();
- }
- }
- });
-
- // deal with click
- google.maps.event.addListener(map, 'click', function(location){
- me.click.fire({'location':
- new mxn.LatLonPoint(location.latLng.lat(),location.latLng.lng())
- });
- });
-
- // deal with zoom change
- google.maps.event.addListener(map, 'zoom_changed', function(){
- // zoom_changed fires before the zooming has finished so we
- // wait for the next idle event before firing our changezoom
- // so that method calls report the correct values
- fireOnNextIdle.push(function() {
- me.changeZoom.fire();
- });
- });
-
- // deal with map movement
- google.maps.event.addListener(map, 'dragend', function(){
- me.moveendHandler(me);
- me.endPan.fire();
- });
-
- // deal with initial tile loading
- var loadListener = google.maps.event.addListener(map, 'tilesloaded', function(){
- me.load.fire();
- google.maps.event.removeListener( loadListener );
- });
-
- this.maps[api] = map;
- this.loaded[api] = true;
- }
- else {
- alert(api + ' map script not imported');
- }
- },
-
- applyOptions: function(){
- var map = this.maps[this.api];
- var myOptions = [];
- if (this.options.enableDragging) {
- myOptions.draggable = true;
- }
- if (this.options.enableScrollWheelZoom){
- myOptions.scrollwheel = true;
- }
- map.setOptions(myOptions);
- },
-
- resizeTo: function(width, height){
- this.currentElement.style.width = width;
- this.currentElement.style.height = height;
- var map = this.maps[this.api];
- google.maps.event.trigger(map,'resize');
- },
-
- addControls: function( args ) {
- var map = this.maps[this.api];
- var myOptions;
- // remove old controls
-
- // Google has a combined zoom and pan control.
- if (args.zoom || args.pan) {
- if (args.zoom == 'large'){
- this.addLargeControls();
- } else {
- this.addSmallControls();
- }
- }
- if (args.scale){
- myOptions = {
- scaleControl:true,
- scaleControlOptions: {style:google.maps.ScaleControlStyle.DEFAULT}
- };
- map.setOptions(myOptions);
- this.addControlsArgs.scale = true;
- }
- if (args.map_type){
- this.addMapTypeControls();
- }
- if (args.overview) {
- myOptions = {
- overviewMapControl: true,
- overviewMapControlOptions: {opened: true}
- };
- map.setOptions(myOptions);
- this.addControlsArgs.overview = true;
- }
- },
-
- addSmallControls: function() {
- var map = this.maps[this.api];
- var myOptions = {
- navigationControl: true,
- navigationControlOptions: {style: google.maps.NavigationControlStyle.SMALL}
- };
- map.setOptions(myOptions);
-
- this.addControlsArgs.pan = false;
- this.addControlsArgs.scale = false;
- this.addControlsArgs.zoom = 'small';
- },
-
- addLargeControls: function() {
- var map = this.maps[this.api];
- var myOptions = {
- navigationControl: true,
- navigationControlOptions: {style:google.maps.NavigationControlStyle.DEFAULT}
- };
- map.setOptions(myOptions);
- this.addControlsArgs.pan = true;
- this.addControlsArgs.zoom = 'large';
- },
-
- addMapTypeControls: function() {
- var map = this.maps[this.api];
- var myOptions = {
- mapTypeControl: true,
- mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DEFAULT}
- };
- map.setOptions(myOptions);
- this.addControlsArgs.map_type = true;
- },
-
- setCenterAndZoom: function(point, zoom) {
- var map = this.maps[this.api];
- var pt = point.toProprietary(this.api);
- map.setCenter(pt);
- map.setZoom(zoom);
- },
-
- addMarker: function(marker, old) {
- return marker.toProprietary(this.api);
- },
-
- removeMarker: function(marker) {
- // doesn't really remove them, just hides them
- marker.hide();
- },
-
- declutterMarkers: function(opts) {
- var map = this.maps[this.api];
- // TODO: Add provider code
- },
-
- addPolyline: function(polyline, old) {
- var map = this.maps[this.api];
- var propPolyline = polyline.toProprietary(this.api);
- propPolyline.setMap(map);
- return propPolyline;
- },
-
- removePolyline: function(polyline) {
- var map = this.maps[this.api];
- polyline.proprietary_polyline.setMap(null);
- },
-
- getCenter: function() {
- var map = this.maps[this.api];
- var pt = map.getCenter();
- return new mxn.LatLonPoint(pt.lat(),pt.lng());
- },
-
- setCenter: function(point, options) {
- var map = this.maps[this.api];
- var pt = point.toProprietary(this.api);
- if (options && options.pan) {
- map.panTo(pt);
- }
- else {
- map.setCenter(pt);
- }
- },
-
- setZoom: function(zoom) {
- var map = this.maps[this.api];
- map.setZoom(zoom);
- },
-
- getZoom: function() {
- var map = this.maps[this.api];
- return map.getZoom();
- },
-
- getZoomLevelForBoundingBox: function( bbox ) {
- var map = this.maps[this.api];
- var sw = bbox.getSouthWest().toProprietary(this.api);
- var ne = bbox.getNorthEast().toProprietary(this.api);
- var gLatLngBounds = new google.maps.LatLngBounds(sw, ne);
- map.fitBounds(gLatLngBounds);
- return map.getZoom();
- },
-
- setMapType: function(type) {
- var map = this.maps[this.api];
- switch(type) {
- case mxn.Mapstraction.ROAD:
- map.setMapTypeId(google.maps.MapTypeId.ROADMAP);
- break;
- case mxn.Mapstraction.SATELLITE:
- map.setMapTypeId(google.maps.MapTypeId.SATELLITE);
- break;
- case mxn.Mapstraction.HYBRID:
- map.setMapTypeId(google.maps.MapTypeId.HYBRID);
- break;
- case mxn.Mapstraction.PHYSICAL:
- map.setMapTypeId(google.maps.MapTypeId.TERRAIN);
- break;
- default:
- map.setMapTypeId(google.maps.MapTypeId.ROADMAP);
- }
- },
-
- getMapType: function() {
- var map = this.maps[this.api];
- var type = map.getMapTypeId();
- switch(type) {
- case google.maps.MapTypeId.ROADMAP:
- return mxn.Mapstraction.ROAD;
- case google.maps.MapTypeId.SATELLITE:
- return mxn.Mapstraction.SATELLITE;
- case google.maps.MapTypeId.HYBRID:
- return mxn.Mapstraction.HYBRID;
- case google.maps.MapTypeId.TERRAIN:
- return mxn.Mapstraction.PHYSICAL;
- default:
- return null;
- }
- },
-
- getBounds: function () {
- var map = this.maps[this.api];
- var gLatLngBounds = map.getBounds();
- if (!gLatLngBounds) {
- throw 'Bounds not available, map must be initialized';
- }
- var sw = gLatLngBounds.getSouthWest();
- var ne = gLatLngBounds.getNorthEast();
- return new mxn.BoundingBox(sw.lat(), sw.lng(), ne.lat(), ne.lng());
- },
-
- setBounds: function(bounds){
- var map = this.maps[this.api];
- var sw = bounds.getSouthWest().toProprietary(this.api);
- var ne = bounds.getNorthEast().toProprietary(this.api);
- var gLatLngBounds = new google.maps.LatLngBounds(sw, ne);
- map.fitBounds(gLatLngBounds);
- },
-
- addImageOverlay: function(id, src, opacity, west, south, east, north, oContext) {
- var map = this.maps[this.api];
-
- var imageBounds = new google.maps.LatLngBounds(
- new google.maps.LatLng(south,west),
- new google.maps.LatLng(north,east));
-
- var groundOverlay = new google.maps.GroundOverlay(src, imageBounds);
- groundOverlay.setMap(map);
- },
-
- setImagePosition: function(id, oContext) {
- // do nothing
- },
-
- addOverlay: function(url, autoCenterAndZoom) {
- var map = this.maps[this.api];
-
- var opt = {preserveViewport: (!autoCenterAndZoom)};
- var layer = new google.maps.KmlLayer(url, opt);
- layer.setMap(map);
- },
-
- addTileLayer: function(tile_url, opacity, copyright_text, min_zoom, max_zoom, map_type) {
- var map = this.maps[this.api];
- var tilelayers = [];
- var z_index = this.tileLayers.length || 0;
- tilelayers[0] = {
- getTileUrl: function (coord, zoom) {
- url = tile_url;
- url = url.replace(/\{Z\}/g, zoom);
- url = url.replace(/\{X\}/g, coord.x);
- url = url.replace(/\{Y\}/g, coord.y);
- return url;
- },
- tileSize: new google.maps.Size(256, 256),
- isPng: true,
- minZoom: min_zoom,
- maxZoom: max_zoom,
- opacity: opacity,
- name: copyright_text
- };
- var tileLayerOverlay = new google.maps.ImageMapType(tilelayers[0]);
- if (map_type) {
- map.mapTypes.set('tile' + z_index, tileLayerOverlay);
- var mapTypeIds = [
- google.maps.MapTypeId.ROADMAP,
- google.maps.MapTypeId.HYBRID,
- google.maps.MapTypeId.SATELLITE,
- google.maps.MapTypeId.TERRAIN
- ];
- for (var f = 0; f < this.tileLayers.length; f++) {
- mapTypeIds.push('tile' + f);
- }
- var optionsUpdate = {mapTypeControlOptions: {mapTypeIds: mapTypeIds}};
- map.setOptions(optionsUpdate);
- }
- else {
- map.overlayMapTypes.insertAt(z_index, tileLayerOverlay);
- }
- this.tileLayers.push( [tile_url, tileLayerOverlay, true, z_index] );
- return tileLayerOverlay;
- },
-
- toggleTileLayer: function(tile_url) {
- var map = this.maps[this.api];
- for (var f = 0; f < this.tileLayers.length; f++) {
- var tileLayer = this.tileLayers[f];
- if (tileLayer[0] == tile_url) {
- if (tileLayer[2]) {
- map.overlayMapTypes.removeAt(tileLayer[3]);
- tileLayer[2] = false;
- }
- else {
- map.overlayMapTypes.insertAt(tileLayer[3], tileLayer[1]);
- tileLayer[2] = true;
- }
- }
- }
- },
-
- getPixelRatio: function() {
- var map = this.maps[this.api];
-
- // TODO: Add provider code
- },
-
- mousePosition: function(element) {
- var map = this.maps[this.api];
- var locDisp = document.getElementById(element);
- if (locDisp !== null) {
- google.maps.event.addListener(map, 'mousemove', function (point) {
- var loc = point.latLng.lat().toFixed(4) + ' / ' + point.latLng.lng().toFixed(4);
- locDisp.innerHTML = loc;
- });
- locDisp.innerHTML = '0.0000 / 0.0000';
- }
- }
-},
-
-LatLonPoint: {
-
- toProprietary: function() {
- return new google.maps.LatLng(this.lat, this.lon);
- },
-
- fromProprietary: function(googlePoint) {
- this.lat = googlePoint.lat();
- this.lon = googlePoint.lng();
- }
-
-},
-
-Marker: {
-
- toProprietary: function() {
- var options = {};
-
- // do we have an Anchor?
- var ax = 0; // anchor x
- var ay = 0; // anchor y
-
- if (this.iconAnchor) {
- ax = this.iconAnchor[0];
- ay = this.iconAnchor[1];
- }
- var gAnchorPoint = new google.maps.Point(ax,ay);
-
- if (this.iconUrl) {
- options.icon = new google.maps.MarkerImage(
- this.iconUrl,
- new google.maps.Size(this.iconSize[0], this.iconSize[1]),
- new google.maps.Point(0, 0),
- gAnchorPoint
- );
-
- // do we have a Shadow?
- if (this.iconShadowUrl) {
- if (this.iconShadowSize) {
- var x = this.iconShadowSize[0];
- var y = this.iconShadowSize[1];
- options.shadow = new google.maps.MarkerImage(
- this.iconShadowUrl,
- new google.maps.Size(x,y),
- new google.maps.Point(0,0),
- gAnchorPoint
- );
- }
- else {
- options.shadow = new google.maps.MarkerImage(this.iconShadowUrl);
- }
- }
- }
- if (this.draggable) {
- options.draggable = this.draggable;
- }
- if (this.labelText) {
- options.title = this.labelText;
- }
- if (this.imageMap) {
- options.shape = {
- coord: this.imageMap,
- type: 'poly'
- };
- }
-
- options.position = this.location.toProprietary(this.api);
- options.map = this.map;
-
- var marker = new google.maps.Marker(options);
-
- if (this.infoBubble) {
- var event_action = "click";
- if (this.hover) {
- event_action = "mouseover";
- }
- google.maps.event.addListener(marker, event_action, function() {
- marker.mapstraction_marker.openBubble();
- });
- }
-
- if (this.hoverIconUrl) {
- var gSize = new google.maps.Size(this.iconSize[0], this.iconSize[1]);
- var zerozero = new google.maps.Point(0,0);
- var hIcon = new google.maps.MarkerImage(
- this.hoverIconUrl,
- gSize,
- zerozero,
- gAnchorPoint
- );
- var Icon = new google.maps.MarkerImage(
- this.iconUrl,
- gSize,
- zerozero,
- gAnchorPoint
- );
- google.maps.event.addListener(
- marker,
- "mouseover",
- function(){
- marker.setIcon(hIcon);
- }
- );
- google.maps.event.addListener(
- marker,
- "mouseout",
- function(){ marker.setIcon(Icon); }
- );
- }
-
- google.maps.event.addListener(marker, 'click', function() {
- marker.mapstraction_marker.click.fire();
- });
-
- return marker;
- },
-
- openBubble: function() {
- var infowindow, marker = this;
- if (!this.hasOwnProperty('proprietary_infowindow') || this.proprietary_infowindow === null) {
- infowindow = new google.maps.InfoWindow({
- content: this.infoBubble
- });
- google.maps.event.addListener(infowindow, 'closeclick', function(closedWindow) {
- marker.closeBubble();
- });
- }
- else {
- infowindow = this.proprietary_infowindow;
- }
- this.openInfoBubble.fire( { 'marker': this } );
- infowindow.open(this.map, this.proprietary_marker);
- this.proprietary_infowindow = infowindow; // Save so we can close it later
- },
-
- closeBubble: function() {
- if (this.hasOwnProperty('proprietary_infowindow') && this.proprietary_infowindow !== null) {
- this.proprietary_infowindow.close();
- this.proprietary_infowindow = null;
- this.closeInfoBubble.fire( { 'marker': this } );
- }
- },
-
- hide: function() {
- this.proprietary_marker.setOptions( { visible: false } );
- },
-
- show: function() {
- this.proprietary_marker.setOptions( { visible: true } );
- },
-
- update: function() {
- var point = new mxn.LatLonPoint();
- point.fromProprietary('googlev3', this.proprietary_marker.getPosition());
- this.location = point;
- }
-
-},
-
-Polyline: {
-
- toProprietary: function() {
- var points = [];
- for (var i = 0, length = this.points.length; i < length; i++) {
- points.push(this.points[i].toProprietary('googlev3'));
- }
-
- var polyOptions = {
- path: points,
- strokeColor: this.color || '#000000',
- strokeOpacity: this.opacity || 1.0,
- strokeWeight: this.width || 3
- };
-
- if (this.closed) {
- polyOptions.fillColor = this.fillColor || '#000000';
- polyOptions.fillOpacity = polyOptions.strokeOpacity;
-
- return new google.maps.Polygon(polyOptions);
- }
- else {
- return new google.maps.Polyline(polyOptions);
- }
- },
-
- show: function() {
- throw 'Not implemented';
- },
-
- hide: function() {
- throw 'Not implemented';
- }
-
-}
-
-});
diff --git a/demoplanner/js/mapstraction/mxn.googlev3.geocoder-min.js b/demoplanner/js/mapstraction/mxn.googlev3.geocoder-min.js
deleted file mode 100644
index a59209230e..0000000000
--- a/demoplanner/js/mapstraction/mxn.googlev3.geocoder-min.js
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
-MAPSTRACTION v2.0.18 http://www.mapstraction.com
-
-Copyright (c) 2012 Tom Carden, Steve Coast, Mikel Maron, Andrew Turner, Henri Bergius, Rob Moran, Derek Fowler, Gary Gale
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- * Neither the name of the Mapstraction nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-mxn.register("googlev3",{Geocoder:{init:function(){this.geocoders[this.api]=new google.maps.Geocoder()},geocode:function(b){var a=this;var c={};if(typeof(b)=="object"){if(b.hasOwnProperty("lat")&&b.hasOwnProperty("lon")){c.latLng=b.toProprietary(this.api)}else{c.address=[b.street,b.locality,b.region,b.country].join(", ")}}else{c.address=b}this.geocoders[this.api].geocode(c,function(e,d){a.geocode_callback(e,d)})},geocode_callback:function(f,e){var k={};if(e!=google.maps.GeocoderStatus.OK){this.error_callback(e)}else{k.street="";k.locality="";k.postcode="";k.region="";k.country="";var c=f[0];var h=[];for(var g=0;g0){k.street=h.join(" ")}k.point=new mxn.LatLonPoint(c.geometry.location.lat(),c.geometry.location.lng());this.callback(k)}}}});
\ No newline at end of file
diff --git a/demoplanner/js/mapstraction/mxn.googlev3.geocoder.js b/demoplanner/js/mapstraction/mxn.googlev3.geocoder.js
deleted file mode 100644
index 0c4bb80252..0000000000
--- a/demoplanner/js/mapstraction/mxn.googlev3.geocoder.js
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
-MAPSTRACTION v2.0.18 http://www.mapstraction.com
-
-Copyright (c) 2012 Tom Carden, Steve Coast, Mikel Maron, Andrew Turner, Henri Bergius, Rob Moran, Derek Fowler, Gary Gale
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- * Neither the name of the Mapstraction nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-mxn.register('googlev3', {
-
-Geocoder: {
-
- init: function() {
- this.geocoders[this.api] = new google.maps.Geocoder();
- },
-
- geocode: function(query){
- var me = this;
- var geocode_request_object = {};
- if (typeof(query) == 'object') {
- // query is a LatLonPoint object (reverse geocode)
- if (query.hasOwnProperty('lat') && query.hasOwnProperty('lon')) {
- geocode_request_object.latLng = query.toProprietary(this.api);
- }
- // query is an address object
- else{
- geocode_request_object.address = [ query.street, query.locality, query.region, query.country ].join(', ');
- }
- }
- // query is an address string
- else {
- geocode_request_object.address = query;
- }
- this.geocoders[this.api].geocode(geocode_request_object, function(results, status) {
- me.geocode_callback(results, status);
- });
- },
-
- geocode_callback: function(results, status){
- var return_location = {};
-
- if (status != google.maps.GeocoderStatus.OK) {
- this.error_callback(status);
- }
- else {
- return_location.street = '';
- return_location.locality = '';
- return_location.postcode = '';
- return_location.region = '';
- return_location.country = '';
-
- var place = results[0];
- var streetparts = [];
-
- for (var i = 0; i < place.address_components.length; i++) {
- var addressComponent = place.address_components[i];
- for (var j = 0; j < addressComponent.types.length; j++) {
- var componentType = addressComponent.types[j];
- switch (componentType) {
- case 'country':
- return_location.country = addressComponent.long_name;
- break;
- case 'administrative_area_level_1':
- return_location.region = addressComponent.long_name;
- break;
- case 'locality':
- return_location.locality = addressComponent.long_name;
- break;
- case 'street_address':
- return_location.street = addressComponent.long_name;
- break;
- case 'postal_code':
- return_location.postcode = addressComponent.long_name;
- break;
- case 'street_number':
- streetparts.unshift(addressComponent.long_name);
- break;
- case 'route':
- streetparts.push(addressComponent.long_name);
- break;
- }
- }
- }
-
- if (return_location.street === '' && streetparts.length > 0) {
- return_location.street = streetparts.join(' ');
- }
-
- return_location.point = new mxn.LatLonPoint(place.geometry.location.lat(), place.geometry.location.lng());
-
- this.callback(return_location);
- }
- }
-}
-});
\ No newline at end of file
diff --git a/demoplanner/js/mapstraction/mxn.js b/demoplanner/js/mapstraction/mxn.js
deleted file mode 100644
index 7b4f88b6de..0000000000
--- a/demoplanner/js/mapstraction/mxn.js
+++ /dev/null
@@ -1,581 +0,0 @@
-/*
-MAPSTRACTION v2.0.18 http://www.mapstraction.com
-
-Copyright (c) 2012 Tom Carden, Steve Coast, Mikel Maron, Andrew Turner, Henri Bergius, Rob Moran, Derek Fowler, Gary Gale
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- * Neither the name of the Mapstraction nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-// Auto-load scripts
-//
-// specify which map providers to load by using
-// ';
- var scriptsAry = [];
- for (i = 0; i < modules.length; i++) {
- scriptsAry.push(scriptTagStart + modules[i] + scriptTagEnd);
- for (var j = 0; j < providers.length; j++) {
- scriptsAry.push(scriptTagStart + providers[j] + '.' + modules[i] + scriptTagEnd);
- }
- }
- document.write(scriptsAry.join(''));
-})();
-
-(function(){
-
-// holds all our implementing functions
-var apis = {};
-
-// Our special private methods
-/**
- * Calls the API specific implementation of a particular method.
- * Deferrable: If the API implmentation includes a deferable hash such as { getCenter: true, setCenter: true},
- * then the methods calls mentioned with in it will be queued until runDeferred is called.
- *
- * @private
- */
-var invoke = function(sApiId, sObjName, sFnName, oScope, args){
- if(!hasImplementation(sApiId, sObjName, sFnName)) {
- throw 'Method ' + sFnName + ' of object ' + sObjName + ' is not supported by API ' + sApiId + '. Are you missing a script tag?';
- }
- if(typeof(apis[sApiId][sObjName].deferrable) != 'undefined' && apis[sApiId][sObjName].deferrable[sFnName] === true) {
- mxn.deferUntilLoaded.call(oScope, function() {return apis[sApiId][sObjName][sFnName].apply(oScope, args);} );
- }
- else {
- return apis[sApiId][sObjName][sFnName].apply(oScope, args);
- }
-};
-
-/**
- * Determines whether the specified API provides an implementation for the
- * specified object and function name.
- * @private
- */
-var hasImplementation = function(sApiId, sObjName, sFnName){
- if(typeof(apis[sApiId]) == 'undefined') {
- throw 'API ' + sApiId + ' not loaded. Are you missing a script tag?';
- }
- if(typeof(apis[sApiId][sObjName]) == 'undefined') {
- throw 'Object definition ' + sObjName + ' in API ' + sApiId + ' not loaded. Are you missing a script tag?';
- }
- return typeof(apis[sApiId][sObjName][sFnName]) == 'function';
-};
-
-/**
- * @name mxn
- * @namespace
- */
-var mxn = window.mxn = /** @lends mxn */ {
-
- /**
- * Registers a set of provider specific implementation functions.
- * @function
- * @param {String} sApiId The API ID to register implementing functions for.
- * @param {Object} oApiImpl An object containing the API implementation.
- */
- register: function(sApiId, oApiImpl){
- if(!apis.hasOwnProperty(sApiId)){
- apis[sApiId] = {};
- }
- mxn.util.merge(apis[sApiId], oApiImpl);
- },
-
- /**
- * Adds a list of named proxy methods to the prototype of a
- * specified constructor function.
- * @function
- * @param {Function} func Constructor function to add methods to
- * @param {Array} aryMethods Array of method names to create
- * @param {Boolean} bWithApiArg Optional. Whether the proxy methods will use an API argument
- */
- addProxyMethods: function(func, aryMethods, bWithApiArg){
- for(var i = 0; i < aryMethods.length; i++) {
- var sMethodName = aryMethods[i];
- if(bWithApiArg){
- func.prototype[sMethodName] = new Function('return this.invoker.go(\'' + sMethodName + '\', arguments, { overrideApi: true } );');
- }
- else {
- func.prototype[sMethodName] = new Function('return this.invoker.go(\'' + sMethodName + '\', arguments);');
- }
- }
- },
-
- checkLoad: function(funcDetails){
- if(this.loaded[this.api] === false) {
- var scope = this;
- this.onload[this.api].push( function() { funcDetails.callee.apply(scope, funcDetails); } );
- return true;
- }
- return false;
- },
-
- deferUntilLoaded: function(fnCall) {
- if(this.loaded[this.api] === false) {
- var scope = this;
- this.onload[this.api].push( fnCall );
- } else {
- fnCall.call(this);
- }
- },
-
- /**
- * Bulk add some named events to an object.
- * @function
- * @param {Object} oEvtSrc The event source object.
- * @param {String[]} aEvtNames Event names to add.
- */
- addEvents: function(oEvtSrc, aEvtNames){
- for(var i = 0; i < aEvtNames.length; i++){
- var sEvtName = aEvtNames[i];
- if(sEvtName in oEvtSrc){
- throw 'Event or method ' + sEvtName + ' already declared.';
- }
- oEvtSrc[sEvtName] = new mxn.Event(sEvtName, oEvtSrc);
- }
- }
-
-};
-
-/**
- * Instantiates a new Event
- * @constructor
- * @param {String} sEvtName The name of the event.
- * @param {Object} oEvtSource The source object of the event.
- */
-mxn.Event = function(sEvtName, oEvtSource){
- var handlers = [];
- if(!sEvtName){
- throw 'Event name must be provided';
- }
- /**
- * Add a handler to the Event.
- * @param {Function} fn The handler function.
- * @param {Object} ctx The context of the handler function.
- */
- this.addHandler = function(fn, ctx){
- handlers.push({context: ctx, handler: fn});
- };
- /**
- * Remove a handler from the Event.
- * @param {Function} fn The handler function.
- * @param {Object} ctx The context of the handler function.
- */
- this.removeHandler = function(fn, ctx){
- for(var i = 0; i < handlers.length; i++){
- if(handlers[i].handler == fn && handlers[i].context == ctx){
- handlers.splice(i, 1);
- }
- }
- };
- /**
- * Remove all handlers from the Event.
- */
- this.removeAllHandlers = function(){
- handlers = [];
- };
- /**
- * Fires the Event.
- * @param {Object} oEvtArgs Event arguments object to be passed to the handlers.
- */
- this.fire = function(oEvtArgs){
- var args = [sEvtName, oEvtSource, oEvtArgs];
- for(var i = 0; i < handlers.length; i++){
- handlers[i].handler.apply(handlers[i].context, args);
- }
- };
-};
-
-/**
- * Creates a new Invoker, a class which helps with on-the-fly
- * invocation of the correct API methods.
- * @constructor
- * @param {Object} aobj The core object whose methods will make cals to go()
- * @param {String} asClassName The name of the Mapstraction class to be invoked, normally the same name as aobj's constructor function
- * @param {Function} afnApiIdGetter The function on object aobj which will return the active API ID
- */
-mxn.Invoker = function(aobj, asClassName, afnApiIdGetter){
- var obj = aobj;
- var sClassName = asClassName;
- var fnApiIdGetter = afnApiIdGetter;
- var defOpts = {
- overrideApi: false, // {Boolean} API ID is overridden by value in first argument
- context: null, // {Object} Local vars can be passed from the body of the method to the API method within this object
- fallback: null // {Function} If an API implementation doesn't exist this function is run instead
- };
-
- /**
- * Invoke the API implementation of a specific method.
- * @param {String} sMethodName The method name to invoke
- * @param {Array} args Arguments to pass on
- * @param {Object} oOptions Optional. Extra options for invocation
- * @param {Boolean} oOptions.overrideApi When true the first argument is used as the API ID.
- * @param {Object} oOptions.context A context object for passing extra information on to the provider implementation.
- * @param {Function} oOptions.fallback A fallback function to run if the provider implementation is missing.
- */
- this.go = function(sMethodName, args, oOptions){
-
- // make sure args is an array
- args = typeof(args) != 'undefined' ? Array.prototype.slice.apply(args) : [];
-
- if(typeof(oOptions) == 'undefined'){
- oOptions = defOpts;
- }
-
- var sApiId;
- if(oOptions.overrideApi){
- sApiId = args.shift();
- }
- else {
- sApiId = fnApiIdGetter.apply(obj);
- }
-
- if(typeof(sApiId) != 'string'){
- throw 'API ID not available.';
- }
-
- if(typeof(oOptions.context) != 'undefined' && oOptions.context !== null){
- args.push(oOptions.context);
- }
-
- if(typeof(oOptions.fallback) == 'function' && !hasImplementation(sApiId, sClassName, sMethodName)){
- // we've got no implementation but have got a fallback function
- return oOptions.fallback.apply(obj, args);
- }
- else {
- return invoke(sApiId, sClassName, sMethodName, obj, args);
- }
-
- };
-
-};
-
-/**
- * @namespace
- */
-mxn.util = {
-
- /**
- * Merges properties of one object into another recursively.
- * @param {Object} oRecv The object receiveing properties
- * @param {Object} oGive The object donating properties
- */
- merge: function(oRecv, oGive){
- for (var sPropName in oGive){
- if (oGive.hasOwnProperty(sPropName)) {
- if(!oRecv.hasOwnProperty(sPropName) || typeof(oRecv[sPropName]) !== 'object' || typeof(oGive[sPropName]) !== 'object'){
- oRecv[sPropName] = oGive[sPropName];
- }
- else {
- mxn.util.merge(oRecv[sPropName], oGive[sPropName]);
- }
- }
- }
- },
-
- /**
- * $m, the dollar function, elegantising getElementById()
- * @return An HTML element or array of HTML elements
- */
- $m: function() {
- var elements = [];
- for (var i = 0; i < arguments.length; i++) {
- var element = arguments[i];
- if (typeof(element) == 'string') {
- element = document.getElementById(element);
- }
- if (arguments.length == 1) {
- return element;
- }
- elements.push(element);
- }
- return elements;
- },
-
- /**
- * loadScript is a JSON data fetcher
- * @param {String} src URL to JSON file
- * @param {Function} callback Callback function
- */
- loadScript: function(src, callback) {
- var script = document.createElement('script');
- script.type = 'text/javascript';
- script.src = src;
- if (callback) {
- if(script.addEventListener){
- script.addEventListener('load', callback, true);
- }
- else if(script.attachEvent){
- var done = false;
- script.attachEvent("onreadystatechange",function(){
- if ( !done && document.readyState === "complete" ) {
- done = true;
- callback();
- }
- });
- }
- }
- var h = document.getElementsByTagName('head')[0];
- h.appendChild( script );
- return;
- },
-
- /**
- *
- * @param {Object} point
- * @param {Object} level
- */
- convertLatLonXY_Yahoo: function(point, level) { //Mercator
- var size = 1 << (26 - level);
- var pixel_per_degree = size / 360.0;
- var pixel_per_radian = size / (2 * Math.PI);
- var origin = new YCoordPoint(size / 2 , size / 2);
- var answer = new YCoordPoint();
- answer.x = Math.floor(origin.x + point.lon * pixel_per_degree);
- var sin = Math.sin(point.lat * Math.PI / 180.0);
- answer.y = Math.floor(origin.y + 0.5 * Math.log((1 + sin) / (1 - sin)) * -pixel_per_radian);
- return answer;
- },
-
- /**
- * Load a stylesheet from a remote file.
- * @param {String} href URL to the CSS file
- */
- loadStyle: function(href) {
- var link = document.createElement('link');
- link.type = 'text/css';
- link.rel = 'stylesheet';
- link.href = href;
- document.getElementsByTagName('head')[0].appendChild(link);
- return;
- },
-
- /**
- * getStyle provides cross-browser access to css
- * @param {Object} el HTML Element
- * @param {String} prop Style property name
- */
- getStyle: function(el, prop) {
- var y;
- if (el.currentStyle) {
- y = el.currentStyle[prop];
- }
- else if (window.getComputedStyle) {
- y = window.getComputedStyle( el, '').getPropertyValue(prop);
- }
- return y;
- },
-
- /**
- * Convert longitude to metres
- * http://www.uwgb.edu/dutchs/UsefulData/UTMFormulas.HTM
- * "A degree of longitude at the equator is 111.2km... For other latitudes,
- * multiply by cos(lat)"
- * assumes the earth is a sphere but good enough for our purposes
- * @param {Float} lon
- * @param {Float} lat
- */
- lonToMetres: function(lon, lat) {
- return lon * (111200 * Math.cos(lat * (Math.PI / 180)));
- },
-
- /**
- * Convert metres to longitude
- * @param {Object} m
- * @param {Object} lat
- */
- metresToLon: function(m, lat) {
- return m / (111200 * Math.cos(lat * (Math.PI / 180)));
- },
-
- /**
- * Convert kilometres to miles
- * @param {Float} km
- * @returns {Float} miles
- */
- KMToMiles: function(km) {
- return km / 1.609344;
- },
-
- /**
- * Convert miles to kilometres
- * @param {Float} miles
- * @returns {Float} km
- */
- milesToKM: function(miles) {
- return miles * 1.609344;
- },
-
- // stuff to convert google zoom levels to/from degrees
- // assumes zoom 0 = 256 pixels = 360 degrees
- // zoom 1 = 256 pixels = 180 degrees
- // etc.
-
- /**
- *
- * @param {Object} pixels
- * @param {Object} zoom
- */
- getDegreesFromGoogleZoomLevel: function(pixels, zoom) {
- return (360 * pixels) / (Math.pow(2, zoom + 8));
- },
-
- /**
- *
- * @param {Object} pixels
- * @param {Object} degrees
- */
- getGoogleZoomLevelFromDegrees: function(pixels, degrees) {
- return mxn.util.logN((360 * pixels) / degrees, 2) - 8;
- },
-
- /**
- *
- * @param {Object} number
- * @param {Object} base
- */
- logN: function(number, base) {
- return Math.log(number) / Math.log(base);
- },
-
- /**
- * Returns array of loaded provider apis
- * @returns {Array} providers
- */
- getAvailableProviders : function () {
- var providers = [];
- for (var propertyName in apis){
- if (apis.hasOwnProperty(propertyName)) {
- providers.push(propertyName);
- }
- }
- return providers;
- },
-
- /**
- * Formats a string, inserting values of subsequent parameters at specified
- * locations. e.g. stringFormat('{0} {1}', 'hello', 'world');
- */
- stringFormat: function(strIn){
- var replaceRegEx = /\{\d+\}/g;
- var args = Array.prototype.slice.apply(arguments);
- args.shift();
- return strIn.replace(replaceRegEx, function(strVal){
- var num = strVal.slice(1, -1);
- return args[num];
- });
- },
-
- /**
- * Traverses an object graph using a series of map functions provided as arguments
- * 2 to n. Map functions are only called if the working object is not undefined/null.
- * For usage see mxn.google.geocoder.js.
- */
- traverse: function(start) {
- var args = Array.prototype.slice.apply(arguments);
- args.shift();
- var working = start;
- while(typeof(working) != 'undefined' && working !== null && args.length > 0){
- var op = args.shift();
- working = op(working);
- }
- }
-};
-
-/**
- * Class for converting between HTML and RGB integer color formats.
- * Accepts either a HTML color string argument or three integers for R, G and B.
- * @constructor
- */
-mxn.util.Color = function() {
- if(arguments.length == 3) {
- this.red = arguments[0];
- this.green = arguments[1];
- this.blue = arguments[2];
- }
- else if(arguments.length == 1) {
- this.setHexColor(arguments[0]);
- }
-};
-
-mxn.util.Color.prototype.reHex = /^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;
-
-/**
- * Set the color from the supplied HTML hex string.
- * @param {String} strHexColor A HTML hex color string e.g. '#00FF88'.
- */
-mxn.util.Color.prototype.setHexColor = function(strHexColor) {
- var match = strHexColor.match(this.reHex);
- if(match) {
- // grab the code - strips off the preceding # if there is one
- strHexColor = match[1];
- }
- else {
- throw 'Invalid HEX color format, expected #000, 000, #000000 or 000000';
- }
- // if a three character hex code was provided, double up the values
- if(strHexColor.length == 3) {
- strHexColor = strHexColor.replace(/\w/g, function(str){return str.concat(str);});
- }
- this.red = parseInt(strHexColor.substr(0,2), 16);
- this.green = parseInt(strHexColor.substr(2,2), 16);
- this.blue = parseInt(strHexColor.substr(4,2), 16);
-};
-
-/**
- * Retrieve the color value as an HTML hex string.
- * @returns {String} Format '#00FF88'.
- */
-mxn.util.Color.prototype.getHexColor = function() {
- var rgb = this.blue | (this.green << 8) | (this.red << 16);
- var hexString = rgb.toString(16).toUpperCase();
- if(hexString.length < 6){
- hexString = '0' + hexString;
- }
- return '#' + hexString;
-};
-
-})();
diff --git a/demoplanner/js/planner.js b/demoplanner/js/planner.js
deleted file mode 100644
index a9de7cc894..0000000000
--- a/demoplanner/js/planner.js
+++ /dev/null
@@ -1,238 +0,0 @@
-var map;
-
-var depart_arrivee = {
- depart : { lat : -1, lon : -1},
- arrivee : { lat : -1, lon : -1}
-};
-
-var planner;
-
-
-var destination_idx = -1;
-var departure_idx = -1;
-var debut_requete = -1;
-var fin_requete = -1;
-String.prototype.trim = function() {
- return this.replace(/^\s+|\s+$/g, "");
-};
-
-function format(datetime){
-
- datetime.trim();
-
- var year = datetime.slice(0, 4);
- var mounth = datetime.slice(4,6);
- var day = datetime.slice(6,8);
- var hour = datetime.slice(9, 13);
- var str = "";
- var hours = datetime.slice(9,11);
- var mins = datetime.slice(11,13);
- str += hours + "h";
- str += mins;
-
- str += " le " + day + "-" + mounth + "-" + year;
- return str;
-}
-
-function aff_planning(idPlanning) {
-
- if(!planner.journey_list[idPlanning].section_list){
- $("#details").html("Pas d'itinéraire trouvé :'(");
- } else {
- map.removeAllPolylines();
- map.removeAllMarkers();
-
- var feuille = "
";
- for(i=0;i < planner.journey_list[idPlanning].section_list.length; i++) {
- var item = planner.journey_list[idPlanning].section_list[i];
- if(item.type === "PUBLIC_TRANSPORT"){
- var arraypolys = new Array();
- feuille += "
Trajet en " + item.mode + " " + item.code + " vers " + item.direction + "
Marche à pied sur " + item.street_network.length +" mètres
";
- var arraypolys = new Array();
- for(j=0 ; j < item.street_network.coordinate_list.length; j++){
- arraypolys.push(new mxn.LatLonPoint(item.street_network.coordinate_list[j].lon, item.street_network.coordinate_list[j].lat));
- }
- var myPoly = new mxn.Polyline(arraypolys);
- myPoly.setWidth(2);
- map.addPolyline(myPoly);
- }
- }
- feuille += "
";
- $("#details").html(feuille);
- }
-}
-
-function aff_data(data) {
- fin_requete = new Date().getTime();
- planner = data.planner;
-
-
- $("#infos").text("");
- $("div#listecontainer ul").empty();
- if(planner.journey_list){
- for(i=0;iItineraire "+(i+1)+""));
- }
- } else {
- $("#details").append("On a trouvé aucun trajet ");
- }
-
- aff_planning(0);
-
- $("#details").append("timer : "+(fin_requete - debut_requete));
-
-}
-
-function planner() {
-
- if((departure_idx !== -1) && (destination_idx !== -1)) {
- debut_requete = new Date().getTime();
- $.getJSON("../journeys?format=json&origin="+departure_idx+"&destination="+destination_idx+"&datetime="+$("#date").val()+"T"+$("#timeheure").val()+""+$("#timemin").val()+"&date="+
- +"&clockwise="+$("#typeitineraire option:selected'").val(),
- aff_data
- );
-
-
-
- } else {
- alert("Selectionnez une ville");
- }
-}
-
-function clickmap(event_name, event_source, event_args) {
- var p = event_args.location;
-
- if(depart_arrivee.depart.lat === -1) {
- depart_arrivee.depart.lat = p.lat;
- depart_arrivee.depart.lon = p.lon;
- $("#infos").text("Choisissez maintenant une destination");
- } else {
- depart_arrivee.arrivee.lat = p.lat;
- depart_arrivee.arrivee.lon = p.lon;
- $("#infos").text("Calcul en cours ... ");
- debut_requete = new Date().getTime();
-
- $.getJSON("../journeys?format=json&origin=coord:"+depart_arrivee.depart.lon+":"+depart_arrivee.depart.lat+
- "&destination=coord:"+depart_arrivee.arrivee.lon+":"+depart_arrivee.arrivee.lat+"&datetime="+$("#date").val()
- +"T"+$("#timeheure").val()+""+$("#timemin").val()+"&clockwise="+$("#typeitineraire option:selected'").val(),
- aff_data
- );
-
-
- depart_arrivee.depart.lat = -1;
- }
-
-}
-
-function debug(event_name, event_source, event_args) {
- $.getJSON($("#url_debug").val(), aff_data);
-}
-
-
-
-window.onload= function() {
-
- map = new mxn.Mapstraction('mapdiv', 'openlayers');
- map.click.addHandler(clickmap);
- $("#go").click(planner);
- $("#debug").click(debug);
- $("#centrer").change(function() {
- var sels = $("#centrer option:selected");
- var sel = sels[0].value;
- centrer(sel);
- } );
- centrer("paris");
-}
-
-function centrer(ville) {
- var villes = {
- "paris" : {"x" :48.85341 ,"y": 2.3488, "zoom" : 13},
- "lille" : {"x" :50.6367, "y" : 3.0373, "zoom" : 13},
- "lyon" : {"x" :45.74846, "y" : 4.84671, "zoom" : 13}
- };
-
- var latlon = new mxn.LatLonPoint(villes[ville].x, villes[ville].y);
- map.setCenterAndZoom(latlon, villes[ville].zoom);
-
-}
-
-$(function() {
- $( "#departure" ).autocomplete({
- source: function( request, response ) {
- $.ajax({
- url: "http://127.0.0.1/firstletter",
- dataType: "json",
- data: {
- format : "json",
- name: request.term,
- },
- success: function( data ) {
- response( $.map( data.firstletter.items, function( item ) {
- return {
- label: item.name,
- value: item.uri
- }
- }));
- }
- });
- },
- minLength: 2,
- select: function( event, ui ) {
- departure_idx = ui.item.value;
- },
- open: function() {
- $( this ).removeClass( "ui-corner-all" ).addClass( "ui-corner-top" );
- },
- close: function() {
- $( this ).removeClass( "ui-corner-top" ).addClass( "ui-corner-all" );
- }
- });
-
- $( "#destination" ).autocomplete({
- source: function( request, response ) {
- $.ajax({
- url: "http://127.0.0.1/firstletter",
- dataType: "json",
- data: {
- format : "json",
- name: request.term,
- },
- success: function( data ) {
- response( $.map( data.firstletter.items, function( item ) {
- return {
- label: item.name,
- value: item.uri
- }
-
-
- }));
- }
- });
- },
- minLength: 2,
- select: function( event, ui ) {
- destination_idx = ui.item.value;
- },
- open: function() {
- $( this ).removeClass( "ui-corner-all" ).addClass( "ui-corner-top" );
- },
- close: function() {
- $( this ).removeClass( "ui-corner-top" ).addClass( "ui-corner-all" );
- }
- });
-
-});
diff --git a/Doxyfile b/documentation/Doxyfile
similarity index 100%
rename from Doxyfile
rename to documentation/Doxyfile
diff --git a/documentation/examples/config/kraken.ini b/documentation/examples/config/kraken.ini
new file mode 100644
index 0000000000..10cf048090
--- /dev/null
+++ b/documentation/examples/config/kraken.ini
@@ -0,0 +1,18 @@
+[GENERAL]
+database = data.nav.lz4
+zmq_socket = ipc:///tmp/default_kraken
+nb_threads = 1
+[LOG]
+log4cplus.rootLogger= DEBUG, ALL_MSGS, CONSOLE
+
+log4cplus.appender.ALL_MSGS=log4cplus::FileAppender
+#log4cplus.appender.ALL_MSGS=log4cplus::ConsoleAppender
+log4cplus.appender.ALL_MSGS.File=kraken.log
+log4cplus.appender.ALL_MSGS.MaxBackupIndex=5
+#log4cplus.appender.ALL_MSGS.MaxFileSize=20MB
+log4cplus.appender.ALL_MSGS.layout=log4cplus::PatternLayout
+log4cplus.appender.ALL_MSGS.layout.ConversionPattern=[%D{%y-%m-%d %H:%M:%S,%q}] %b:%L [%-5p] - %m %n
+
+log4cplus.appender.CONSOLE=log4cplus::ConsoleAppender
+log4cplus.appender.CONSOLE.layout=log4cplus::PatternLayout
+log4cplus.appender.CONSOLE.layout.ConversionPattern=[%D{%y-%m-%d %H:%M:%S,%q}] %b:%L [%-5p] - %m %n
diff --git a/documentation_integration/Makefile b/documentation/integration/Makefile
similarity index 100%
rename from documentation_integration/Makefile
rename to documentation/integration/Makefile
diff --git a/documentation_integration/source/_static/bootstrap.css b/documentation/integration/source/_static/bootstrap.css
similarity index 100%
rename from documentation_integration/source/_static/bootstrap.css
rename to documentation/integration/source/_static/bootstrap.css
diff --git a/documentation_integration/source/conf.py b/documentation/integration/source/conf.py
similarity index 100%
rename from documentation_integration/source/conf.py
rename to documentation/integration/source/conf.py
diff --git a/documentation_integration/source/index.rst b/documentation/integration/source/index.rst
similarity index 100%
rename from documentation_integration/source/index.rst
rename to documentation/integration/source/index.rst
diff --git a/doc_navitia.io/Makefile b/documentation/navitia.io/Makefile
similarity index 100%
rename from doc_navitia.io/Makefile
rename to documentation/navitia.io/Makefile
diff --git a/doc_navitia.io/source/_static/raptor/jquery.raptorize.1.0.js b/documentation/navitia.io/source/_static/raptor/jquery.raptorize.1.0.js
similarity index 100%
rename from doc_navitia.io/source/_static/raptor/jquery.raptorize.1.0.js
rename to documentation/navitia.io/source/_static/raptor/jquery.raptorize.1.0.js
diff --git a/doc_navitia.io/source/_static/raptor/raptor-sound.mp3 b/documentation/navitia.io/source/_static/raptor/raptor-sound.mp3
similarity index 100%
rename from doc_navitia.io/source/_static/raptor/raptor-sound.mp3
rename to documentation/navitia.io/source/_static/raptor/raptor-sound.mp3
diff --git a/doc_navitia.io/source/_static/raptor/raptor-sound.ogg b/documentation/navitia.io/source/_static/raptor/raptor-sound.ogg
similarity index 100%
rename from doc_navitia.io/source/_static/raptor/raptor-sound.ogg
rename to documentation/navitia.io/source/_static/raptor/raptor-sound.ogg
diff --git a/doc_navitia.io/source/_static/raptor/raptor.png b/documentation/navitia.io/source/_static/raptor/raptor.png
similarity index 100%
rename from doc_navitia.io/source/_static/raptor/raptor.png
rename to documentation/navitia.io/source/_static/raptor/raptor.png
diff --git a/doc_navitia.io/source/_templates/layout.html b/documentation/navitia.io/source/_templates/layout.html
similarity index 100%
rename from doc_navitia.io/source/_templates/layout.html
rename to documentation/navitia.io/source/_templates/layout.html
diff --git a/doc_navitia.io/source/conf.py b/documentation/navitia.io/source/conf.py
similarity index 100%
rename from doc_navitia.io/source/conf.py
rename to documentation/navitia.io/source/conf.py
diff --git a/doc_navitia.io/source/details.rst b/documentation/navitia.io/source/details.rst
similarity index 100%
rename from doc_navitia.io/source/details.rst
rename to documentation/navitia.io/source/details.rst
diff --git a/doc_navitia.io/source/index.rst b/documentation/navitia.io/source/index.rst
similarity index 100%
rename from doc_navitia.io/source/index.rst
rename to documentation/navitia.io/source/index.rst
diff --git a/doc_navitia.io/source/ptref_grammar/around.png b/documentation/navitia.io/source/ptref_grammar/around.png
similarity index 100%
rename from doc_navitia.io/source/ptref_grammar/around.png
rename to documentation/navitia.io/source/ptref_grammar/around.png
diff --git a/doc_navitia.io/source/ptref_grammar/attribute.png b/documentation/navitia.io/source/ptref_grammar/attribute.png
similarity index 100%
rename from doc_navitia.io/source/ptref_grammar/attribute.png
rename to documentation/navitia.io/source/ptref_grammar/attribute.png
diff --git a/doc_navitia.io/source/ptref_grammar/bin_op.png b/documentation/navitia.io/source/ptref_grammar/bin_op.png
similarity index 100%
rename from doc_navitia.io/source/ptref_grammar/bin_op.png
rename to documentation/navitia.io/source/ptref_grammar/bin_op.png
diff --git a/doc_navitia.io/source/ptref_grammar/coord.png b/documentation/navitia.io/source/ptref_grammar/coord.png
similarity index 100%
rename from doc_navitia.io/source/ptref_grammar/coord.png
rename to documentation/navitia.io/source/ptref_grammar/coord.png
diff --git a/doc_navitia.io/source/ptref_grammar/escaped_value.png b/documentation/navitia.io/source/ptref_grammar/escaped_value.png
similarity index 100%
rename from doc_navitia.io/source/ptref_grammar/escaped_value.png
rename to documentation/navitia.io/source/ptref_grammar/escaped_value.png
diff --git a/doc_navitia.io/source/ptref_grammar/filter.png b/documentation/navitia.io/source/ptref_grammar/filter.png
similarity index 100%
rename from doc_navitia.io/source/ptref_grammar/filter.png
rename to documentation/navitia.io/source/ptref_grammar/filter.png
diff --git a/doc_navitia.io/source/ptref_grammar/object.png b/documentation/navitia.io/source/ptref_grammar/object.png
similarity index 100%
rename from doc_navitia.io/source/ptref_grammar/object.png
rename to documentation/navitia.io/source/ptref_grammar/object.png
diff --git a/doc_navitia.io/source/ptref_grammar/selector.png b/documentation/navitia.io/source/ptref_grammar/selector.png
similarity index 100%
rename from doc_navitia.io/source/ptref_grammar/selector.png
rename to documentation/navitia.io/source/ptref_grammar/selector.png
diff --git a/doc_navitia.io/source/ptref_grammar/value.png b/documentation/navitia.io/source/ptref_grammar/value.png
similarity index 100%
rename from doc_navitia.io/source/ptref_grammar/value.png
rename to documentation/navitia.io/source/ptref_grammar/value.png
diff --git a/doc_navitia.io/source/ptref_grammar/within_args.png b/documentation/navitia.io/source/ptref_grammar/within_args.png
similarity index 100%
rename from doc_navitia.io/source/ptref_grammar/within_args.png
rename to documentation/navitia.io/source/ptref_grammar/within_args.png
diff --git a/doc_navitia.io/source/public_transport.rst b/documentation/navitia.io/source/public_transport.rst
similarity index 100%
rename from doc_navitia.io/source/public_transport.rst
rename to documentation/navitia.io/source/public_transport.rst
diff --git a/documentation/Makefile b/documentation/technique/Makefile
similarity index 100%
rename from documentation/Makefile
rename to documentation/technique/Makefile
diff --git a/documentation/annexe/model.architect b/documentation/technique/annexe/model.architect
similarity index 100%
rename from documentation/annexe/model.architect
rename to documentation/technique/annexe/model.architect
diff --git a/documentation/annexe/realtime.vpp b/documentation/technique/annexe/realtime.vpp
similarity index 100%
rename from documentation/annexe/realtime.vpp
rename to documentation/technique/annexe/realtime.vpp
diff --git a/documentation/source/_static/.gitignore b/documentation/technique/source/_static/.gitignore
similarity index 100%
rename from documentation/source/_static/.gitignore
rename to documentation/technique/source/_static/.gitignore
diff --git a/documentation/source/_static/Archi_applicative_complete.png b/documentation/technique/source/_static/Archi_applicative_complete.png
similarity index 100%
rename from documentation/source/_static/Archi_applicative_complete.png
rename to documentation/technique/source/_static/Archi_applicative_complete.png
diff --git a/documentation/source/_static/Archi_fonctionelle.png b/documentation/technique/source/_static/Archi_fonctionelle.png
similarity index 100%
rename from documentation/source/_static/Archi_fonctionelle.png
rename to documentation/technique/source/_static/Archi_fonctionelle.png
diff --git a/documentation/source/_static/Archi_logicielle.png b/documentation/technique/source/_static/Archi_logicielle.png
similarity index 100%
rename from documentation/source/_static/Archi_logicielle.png
rename to documentation/technique/source/_static/Archi_logicielle.png
diff --git a/documentation/source/_static/Archi_navitia2.png b/documentation/technique/source/_static/Archi_navitia2.png
similarity index 100%
rename from documentation/source/_static/Archi_navitia2.png
rename to documentation/technique/source/_static/Archi_navitia2.png
diff --git a/documentation/source/_static/ArretPrefCorr.png b/documentation/technique/source/_static/ArretPrefCorr.png
similarity index 100%
rename from documentation/source/_static/ArretPrefCorr.png
rename to documentation/technique/source/_static/ArretPrefCorr.png
diff --git a/documentation/source/_static/CorrInterStopPoint.png b/documentation/technique/source/_static/CorrInterStopPoint.png
similarity index 100%
rename from documentation/source/_static/CorrInterStopPoint.png
rename to documentation/technique/source/_static/CorrInterStopPoint.png
diff --git a/documentation/source/_static/CorrIntraStopPoint.png b/documentation/technique/source/_static/CorrIntraStopPoint.png
similarity index 100%
rename from documentation/source/_static/CorrIntraStopPoint.png
rename to documentation/technique/source/_static/CorrIntraStopPoint.png
diff --git a/documentation/source/_static/ITL.png b/documentation/technique/source/_static/ITL.png
similarity index 100%
rename from documentation/source/_static/ITL.png
rename to documentation/technique/source/_static/ITL.png
diff --git a/documentation/source/_static/InegalitesTriangulaires.png b/documentation/technique/source/_static/InegalitesTriangulaires.png
similarity index 100%
rename from documentation/source/_static/InegalitesTriangulaires.png
rename to documentation/technique/source/_static/InegalitesTriangulaires.png
diff --git a/documentation/source/_static/MinimisationNumCorr.png b/documentation/technique/source/_static/MinimisationNumCorr.png
similarity index 100%
rename from documentation/source/_static/MinimisationNumCorr.png
rename to documentation/technique/source/_static/MinimisationNumCorr.png
diff --git a/documentation/source/_static/MinimisationTempsAttenteA.png b/documentation/technique/source/_static/MinimisationTempsAttenteA.png
similarity index 100%
rename from documentation/source/_static/MinimisationTempsAttenteA.png
rename to documentation/technique/source/_static/MinimisationTempsAttenteA.png
diff --git a/documentation/source/_static/MinimisationTempsAttenteB.png b/documentation/technique/source/_static/MinimisationTempsAttenteB.png
similarity index 100%
rename from documentation/source/_static/MinimisationTempsAttenteB.png
rename to documentation/technique/source/_static/MinimisationTempsAttenteB.png
diff --git a/documentation/source/_static/MinimisationTempsAttenteC.png b/documentation/technique/source/_static/MinimisationTempsAttenteC.png
similarity index 100%
rename from documentation/source/_static/MinimisationTempsAttenteC.png
rename to documentation/technique/source/_static/MinimisationTempsAttenteC.png
diff --git a/documentation/source/_static/NumMinuteByInterchange.png b/documentation/technique/source/_static/NumMinuteByInterchange.png
similarity index 100%
rename from documentation/source/_static/NumMinuteByInterchange.png
rename to documentation/technique/source/_static/NumMinuteByInterchange.png
diff --git a/documentation/source/_static/ProlongementService.png b/documentation/technique/source/_static/ProlongementService.png
similarity index 100%
rename from documentation/source/_static/ProlongementService.png
rename to documentation/technique/source/_static/ProlongementService.png
diff --git a/documentation/source/_static/SousCheminOptimauxA.png b/documentation/technique/source/_static/SousCheminOptimauxA.png
similarity index 100%
rename from documentation/source/_static/SousCheminOptimauxA.png
rename to documentation/technique/source/_static/SousCheminOptimauxA.png
diff --git a/documentation/source/_static/SousCheminOptimauxB.png b/documentation/technique/source/_static/SousCheminOptimauxB.png
similarity index 100%
rename from documentation/source/_static/SousCheminOptimauxB.png
rename to documentation/technique/source/_static/SousCheminOptimauxB.png
diff --git a/documentation/source/_static/VPTranslator.png b/documentation/technique/source/_static/VPTranslator.png
similarity index 100%
rename from documentation/source/_static/VPTranslator.png
rename to documentation/technique/source/_static/VPTranslator.png
diff --git a/documentation/source/_static/alim_donnees/alim-AJN++.png b/documentation/technique/source/_static/alim_donnees/alim-AJN++.png
similarity index 100%
rename from documentation/source/_static/alim_donnees/alim-AJN++.png
rename to documentation/technique/source/_static/alim_donnees/alim-AJN++.png
diff --git a/documentation/source/_static/alim_donnees/alim-NLY++.png b/documentation/technique/source/_static/alim_donnees/alim-NLY++.png
similarity index 100%
rename from documentation/source/_static/alim_donnees/alim-NLY++.png
rename to documentation/technique/source/_static/alim_donnees/alim-NLY++.png
diff --git a/documentation/source/_static/decoupage_cs.png b/documentation/technique/source/_static/decoupage_cs.png
similarity index 100%
rename from documentation/source/_static/decoupage_cs.png
rename to documentation/technique/source/_static/decoupage_cs.png
diff --git a/documentation/source/_static/ex_journey_folded.png b/documentation/technique/source/_static/ex_journey_folded.png
similarity index 100%
rename from documentation/source/_static/ex_journey_folded.png
rename to documentation/technique/source/_static/ex_journey_folded.png
diff --git a/documentation/source/_static/ex_journey_noresponse.png b/documentation/technique/source/_static/ex_journey_noresponse.png
similarity index 100%
rename from documentation/source/_static/ex_journey_noresponse.png
rename to documentation/technique/source/_static/ex_journey_noresponse.png
diff --git a/documentation/source/_static/ex_journey_publictransport_unfolded.png b/documentation/technique/source/_static/ex_journey_publictransport_unfolded.png
similarity index 100%
rename from documentation/source/_static/ex_journey_publictransport_unfolded.png
rename to documentation/technique/source/_static/ex_journey_publictransport_unfolded.png
diff --git a/documentation/source/_static/ex_journey_roadnetwork_unfolded.png b/documentation/technique/source/_static/ex_journey_roadnetwork_unfolded.png
similarity index 100%
rename from documentation/source/_static/ex_journey_roadnetwork_unfolded.png
rename to documentation/technique/source/_static/ex_journey_roadnetwork_unfolded.png
diff --git a/documentation/source/_static/ex_journey_stoppointlist_unfolded.png b/documentation/technique/source/_static/ex_journey_stoppointlist_unfolded.png
similarity index 100%
rename from documentation/source/_static/ex_journey_stoppointlist_unfolded.png
rename to documentation/technique/source/_static/ex_journey_stoppointlist_unfolded.png
diff --git a/documentation/source/_static/example_journeys.json b/documentation/technique/source/_static/example_journeys.json
similarity index 100%
rename from documentation/source/_static/example_journeys.json
rename to documentation/technique/source/_static/example_journeys.json
diff --git a/documentation/source/_static/logo_ro.png b/documentation/technique/source/_static/logo_ro.png
similarity index 100%
rename from documentation/source/_static/logo_ro.png
rename to documentation/technique/source/_static/logo_ro.png
diff --git a/documentation/source/_static/raptor.pdf b/documentation/technique/source/_static/raptor.pdf
similarity index 100%
rename from documentation/source/_static/raptor.pdf
rename to documentation/technique/source/_static/raptor.pdf
diff --git a/documentation/source/_static/raptor.png b/documentation/technique/source/_static/raptor.png
similarity index 100%
rename from documentation/source/_static/raptor.png
rename to documentation/technique/source/_static/raptor.png
diff --git a/documentation/source/_static/raptor.tex b/documentation/technique/source/_static/raptor.tex
similarity index 100%
rename from documentation/source/_static/raptor.tex
rename to documentation/technique/source/_static/raptor.tex
diff --git a/documentation/source/admin/alimentation_en_donnees.rst b/documentation/technique/source/admin/alimentation_en_donnees.rst
similarity index 100%
rename from documentation/source/admin/alimentation_en_donnees.rst
rename to documentation/technique/source/admin/alimentation_en_donnees.rst
diff --git a/documentation/source/admin/metadata.rst b/documentation/technique/source/admin/metadata.rst
similarity index 100%
rename from documentation/source/admin/metadata.rst
rename to documentation/technique/source/admin/metadata.rst
diff --git a/documentation/source/administration.rst b/documentation/technique/source/administration.rst
similarity index 100%
rename from documentation/source/administration.rst
rename to documentation/technique/source/administration.rst
diff --git a/documentation/source/archi_fonctionnelle.rst b/documentation/technique/source/archi_fonctionnelle.rst
similarity index 100%
rename from documentation/source/archi_fonctionnelle.rst
rename to documentation/technique/source/archi_fonctionnelle.rst
diff --git a/documentation/source/conf.py b/documentation/technique/source/conf.py
similarity index 100%
rename from documentation/source/conf.py
rename to documentation/technique/source/conf.py
diff --git a/documentation/source/dev.rst b/documentation/technique/source/dev.rst
similarity index 100%
rename from documentation/source/dev.rst
rename to documentation/technique/source/dev.rst
diff --git a/documentation/source/fonctions.rst b/documentation/technique/source/fonctions.rst
similarity index 100%
rename from documentation/source/fonctions.rst
rename to documentation/technique/source/fonctions.rst
diff --git a/documentation/source/help/Sphinx documentation contents Sphinx 1.1.3 documentation.URL (codage non valide) b/documentation/technique/source/help/Sphinx documentation contents Sphinx 1.1.3 documentation.URL (codage non valide)
similarity index 100%
rename from documentation/source/help/Sphinx documentation contents Sphinx 1.1.3 documentation.URL (codage non valide)
rename to documentation/technique/source/help/Sphinx documentation contents Sphinx 1.1.3 documentation.URL (codage non valide)
diff --git a/documentation/source/index.rst b/documentation/technique/source/index.rst
similarity index 100%
rename from documentation/source/index.rst
rename to documentation/technique/source/index.rst
diff --git a/documentation/source/interface/interface_firstletter.rst b/documentation/technique/source/interface/interface_firstletter.rst
similarity index 100%
rename from documentation/source/interface/interface_firstletter.rst
rename to documentation/technique/source/interface/interface_firstletter.rst
diff --git a/documentation/source/interface/interface_geodispatch.rst b/documentation/technique/source/interface/interface_geodispatch.rst
similarity index 100%
rename from documentation/source/interface/interface_geodispatch.rst
rename to documentation/technique/source/interface/interface_geodispatch.rst
diff --git a/documentation/source/interface/interface_introduction.rst b/documentation/technique/source/interface/interface_introduction.rst
similarity index 100%
rename from documentation/source/interface/interface_introduction.rst
rename to documentation/technique/source/interface/interface_introduction.rst
diff --git a/documentation/source/interface/interface_journeys.rst b/documentation/technique/source/interface/interface_journeys.rst
similarity index 100%
rename from documentation/source/interface/interface_journeys.rst
rename to documentation/technique/source/interface/interface_journeys.rst
diff --git a/documentation/source/interface/interface_ptreferential.rst b/documentation/technique/source/interface/interface_ptreferential.rst
similarity index 100%
rename from documentation/source/interface/interface_ptreferential.rst
rename to documentation/technique/source/interface/interface_ptreferential.rst
diff --git a/documentation/source/interface/interface_timetables.rst b/documentation/technique/source/interface/interface_timetables.rst
similarity index 100%
rename from documentation/source/interface/interface_timetables.rst
rename to documentation/technique/source/interface/interface_timetables.rst
diff --git a/documentation/source/introduction.rst b/documentation/technique/source/introduction.rst
similarity index 100%
rename from documentation/source/introduction.rst
rename to documentation/technique/source/introduction.rst
diff --git a/documentation/source/modules/archi.rst b/documentation/technique/source/modules/archi.rst
similarity index 100%
rename from documentation/source/modules/archi.rst
rename to documentation/technique/source/modules/archi.rst
diff --git a/documentation/source/modules/autocomplete.rst b/documentation/technique/source/modules/autocomplete.rst
similarity index 100%
rename from documentation/source/modules/autocomplete.rst
rename to documentation/technique/source/modules/autocomplete.rst
diff --git a/documentation/source/modules/fare.rst b/documentation/technique/source/modules/fare.rst
similarity index 100%
rename from documentation/source/modules/fare.rst
rename to documentation/technique/source/modules/fare.rst
diff --git a/documentation/source/modules/georef.rst b/documentation/technique/source/modules/georef.rst
similarity index 100%
rename from documentation/source/modules/georef.rst
rename to documentation/technique/source/modules/georef.rst
diff --git a/documentation/source/modules/line_schedule.rst b/documentation/technique/source/modules/line_schedule.rst
similarity index 100%
rename from documentation/source/modules/line_schedule.rst
rename to documentation/technique/source/modules/line_schedule.rst
diff --git a/documentation/source/modules/planner.rst b/documentation/technique/source/modules/planner.rst
similarity index 100%
rename from documentation/source/modules/planner.rst
rename to documentation/technique/source/modules/planner.rst
diff --git a/documentation/source/modules/planner_algo.rst b/documentation/technique/source/modules/planner_algo.rst
similarity index 100%
rename from documentation/source/modules/planner_algo.rst
rename to documentation/technique/source/modules/planner_algo.rst
diff --git a/documentation/source/modules/planner_general_function.rst b/documentation/technique/source/modules/planner_general_function.rst
similarity index 100%
rename from documentation/source/modules/planner_general_function.rst
rename to documentation/technique/source/modules/planner_general_function.rst
diff --git a/documentation/source/modules/proximity_list.rst b/documentation/technique/source/modules/proximity_list.rst
similarity index 100%
rename from documentation/source/modules/proximity_list.rst
rename to documentation/technique/source/modules/proximity_list.rst
diff --git a/documentation/source/modules/ptref.rst b/documentation/technique/source/modules/ptref.rst
similarity index 100%
rename from documentation/source/modules/ptref.rst
rename to documentation/technique/source/modules/ptref.rst
diff --git a/documentation/source/modules/raptor.rst b/documentation/technique/source/modules/raptor.rst
similarity index 100%
rename from documentation/source/modules/raptor.rst
rename to documentation/technique/source/modules/raptor.rst
diff --git a/documentation/source/modules/streetnetwork.rst b/documentation/technique/source/modules/streetnetwork.rst
similarity index 100%
rename from documentation/source/modules/streetnetwork.rst
rename to documentation/technique/source/modules/streetnetwork.rst
diff --git a/documentation/source/modules/temps_reel.rst b/documentation/technique/source/modules/temps_reel.rst
similarity index 100%
rename from documentation/source/modules/temps_reel.rst
rename to documentation/technique/source/modules/temps_reel.rst
diff --git a/documentation/source/modules/vptranslate.rst b/documentation/technique/source/modules/vptranslate.rst
similarity index 100%
rename from documentation/source/modules/vptranslate.rst
rename to documentation/technique/source/modules/vptranslate.rst
diff --git a/documentation/source/pre_requis.rst b/documentation/technique/source/pre_requis.rst
similarity index 100%
rename from documentation/source/pre_requis.rst
rename to documentation/technique/source/pre_requis.rst
diff --git a/install.rst b/install.rst
index cdb727078d..3ba8eca375 100644
--- a/install.rst
+++ b/install.rst
@@ -5,7 +5,7 @@ How to build kraken and run it
Dependencies
============
-* gcc 4.7 or newer
+* gcc 4.6 or newer
* cmake
* log4cplus
* osmpbf (https://github.com/scrosby/OSM-binary)
@@ -26,10 +26,10 @@ We hope you got the source code from git.
``git submodule update --init``
-2. Create a directory where everything will be built and eter it
+2. Create a directory where everything will be built and enter it
- ``mkdir build``
- ``cd build``
+ ``mkdir release``
+ ``cd release``
3. Run cmake
@@ -48,32 +48,50 @@ We hope you got the source code from git.
Testing
=======
-#. Testing everything
+#. Data configuration
+
+ The data manager is called *ed*. It relies on GTFS and Open Street Map data centralized in a postgres database
+
+ #. Configure the postgres database
+
+ #. TODO
#. Get some GTFS data. For instance from http://data.navitia.io
- #. We suppose you create a data directory at the root of the kraken directory where you unziped the data
+ Import them using the gtfs2ed tool
+
+ #. Get some Open Street Map data. For instance from http://metro.teczno.com/
+
+ Import them using the osm2ed tool
- #. Transform the data : ``./navimake -i ../data/ -o ../data/data.nav.lz4``
+ #. Once *ed* has been loaded with all the data, you have to export the data for *Kraken* with the ed2nav tool
- #. Go to the navitia directory cd navitia
+ This step will generate a ziped nav file that can be given as input to *Kraken*
- #. Create the navitia.ini file with the following content ::
+#. Running the *Kraken* backend
- [GENERAL]
- database=../../data/data.nav.lz4
+ #. To run *Kraken*, you need to supply some parameters. You can give those parameters either via a file or via the command-line. By default you can take the documentation/examples/config/kraken.ini configuration file. The configuration file needs at least the path of the exported nav file and the zmq socket used to communicate with Jörmungandr. Run ``kraken --help`` to see the list of arguments
- #. Run navitia ./navitia it should tell you what data it tries to load, and give some figures about the data
+ #. Run *Kraken*. It should tell you what data it tries to load, and give some figures about the data
-#. Running the "frontend". Note : this frontend is an API, and not oriented towards final users
+#. Running the *Jörmungandr* front-end. Note : this front-end is an API, and not oriented towards final users
#. Dependencies : python2 and the following python libraries werkzeug, shapely, zmq, protobuf
- #. Create the Jörmungandr.ini file with the following content: ::
+ #. Edit if you want the Jormungandr.ini file.
+
+ Note: If you want to put the file elsewhere, you can change the INSTANCES_DIR variable
+
+ example file : ::
+
+ [instance]
+ # name of the kraken
+ key = some_region
+ # zmq socket used to talk to the kraken, should be the same as the one defined by the zmq_socket param in kraken
+ socket = ipc:///tmp/default_kraken
+
+ #. Give him the configuration file (by default it uses source/jormungandr/default_settings.py) and run it
- [instance]
- key = some_region
- socket = ipc:///tmp/default_navitia
+ ``JORMUNGANDR_CONFIG_FILE=your_config.py python jormungandr.py``
- #. Run-it python2 navitia.py
- #. Grab a browser and open http://localhost:8088/some_region/stop_areas.txt
+ #. Grab a browser and open http://localhost:5000/v1/coverage/default_region
diff --git a/readme.rst b/readme.rst
new file mode 100644
index 0000000000..2615f79a54
--- /dev/null
+++ b/readme.rst
@@ -0,0 +1,40 @@
+********
+Navitia
+********
+
+Presentation
+============
+Navitia is a service providing:
+
+ #. journeys computation
+
+ #. line schedules
+
+ #. next departures
+
+ #. explore public transport data
+
+ #. sexy things such as isochrones
+
+For more information see http://www.navitia.io/
+
+Organisation
+============
+At the root of the repository, several directories can be found:
+ #. source: contains the navitia source code
+
+ #. third_party: third party developped modules
+
+ #. documentation: all the navitia documentation
+
+ #. (debug|release): by convention, the build repositories
+
+Tools
+======
+ #. Gcc as the C++ compiler (g++)
+
+ #. Cmake for the build system
+
+ #. Python for the api
+
+ #. Doxygen and swagger for the automated documentation
diff --git a/source/jormungandr/Jormungandr.ini b/source/jormungandr/Jormungandr.ini
new file mode 100644
index 0000000000..5c9b4cfc6a
--- /dev/null
+++ b/source/jormungandr/Jormungandr.ini
@@ -0,0 +1,6 @@
+[instance]
+key=default_region
+socket=ipc:///tmp/default_region
+
+#[instances]
+#dir = /etc/jormungandr.d
diff --git a/source/jormungandr/default_settings.py b/source/jormungandr/default_settings.py
index 0a4525adee..a3fbdc0731 100644
--- a/source/jormungandr/default_settings.py
+++ b/source/jormungandr/default_settings.py
@@ -3,7 +3,7 @@
import logging
#emplacement ou charger les fichier de configuration par instances
-INSTANCES_DIR = '/etc/jormungandr.d'
+INSTANCES_DIR = '.'
#chaine de connnection à postgresql pour la base jormungandr
PG_CONNECTION_STRING = 'postgresql://navitia:navitia@localhost/jormun'
diff --git a/source/jormungandr/jormungandr.py b/source/jormungandr/jormungandr.py
index 702e16f56a..35a7e477e1 100755
--- a/source/jormungandr/jormungandr.py
+++ b/source/jormungandr/jormungandr.py
@@ -44,8 +44,7 @@ def output_jsonp(data, code, headers=None):
def kill_thread(signal, frame):
InstanceManager().stop()
sys.exit(0)
-config_file = 'Jormungandr.ini' if not os.environ.has_key('JORMUNGANDR_CONFIG_FILE')\
- else os.environ['JORMUNGANDR_CONFIG_FILE']
+
if __name__ == '__main__':
signal.signal(signal.SIGINT, kill_thread)
signal.signal(signal.SIGTERM, kill_thread)
diff --git a/source/readme.rst b/source/readme.rst
new file mode 100644
index 0000000000..d00eb2c14e
--- /dev/null
+++ b/source/readme.rst
@@ -0,0 +1,26 @@
+********
+Navitia
+********
+
+Used libs
+=========
+#. Boost
+
+#. Protocol buffers
+
+#. Fastlz
+
+TODO presentation of the python libs
+
+CMake use
+=========
+With CMake you can build in a repository different than the source directory.
+By convention, you can have one build repository for each kind of build :
+
+ #. Debug directory
+
+ ``mkdir debug; cd debug; cmake -D BUILD_TYPE=Debug ../source``
+
+ #. Release directory
+
+ ``mkdir release; cd release; cmake -D BUILD_TYPE=Release ../source``
diff --git a/source/readme.txt b/source/readme.txt
deleted file mode 100644
index cdd6d0927d..0000000000
--- a/source/readme.txt
+++ /dev/null
@@ -1,51 +0,0 @@
-/** \mainpage NAViTiA C++
- *
- * \section orga Organisation du dépot
- *
- * À la racine du dépot se trouvent différents repertoires :
- * - source : contient le code source produit par Canal TP
- * - third_party : modules complémentaires développés par des tiers
- * - Doc : la documentation (que vous êtes en train de lire) qui est générée à partir du code source avec Doxygen
- * - (debug) : conventionnellement, le repertoire de build de la version debug
- * - (release) : conventionnellement, le repertoire de build de la version release
- *
- * \section outils Outils utilisés
- * - GCC pour son compilateur C++ (g++)
- * - Visual Studio pour la compilation sous windows
- * - Doxygen pour générer la documentation à partir du code source
- * - CMake pour gérer le système de build
- *
- * \section libs Bibliothèques utilisées
- * - Boost : très largement utilisé pour de nombreux besoins en C++
- * - serialize pour "binariser" les données
- * - graph pour la représentation de graphes et des calculs simples type Dijkstra
- * - thread
- * - iostream pour compresser à la volée des flux
- * - date_time
- * - spirit pour parser du texte
- * - cURL : pour les requêtes http
- * - protocol buffers : sérialisation pour échanger des données entre différents services
- * - fastlz : compression extrèmement rapide mais pas nécessairement très performante
- *
- * \section cmake_use Utilisation de CMake
- * CMake permet de compiler dans un repertoire différent des sources pour ne pas les mélanger.
- * La convention veut que l'on mette deux repertoires pour chaque type de build à la racine :
- * - mkdir debug; cd debug; cmake -D BUILD_TYPE=Debug ../source
- * - mkdir release; cd release; cmake -D BUILD_TYPE=Release ../source
- *
- * Sous Visual Studio, le fonctionnement est un peu différent puisque VS génère des sous-repertoires pour chaque type de compilation
- *
- * \section modules Modules
- * Chaque module existe dans un sous-repertoire de source
- * - \ref WS_Commons : squelette pour construire un webservice fcgi/isapi
- * - \ref fare : calcul des tarifs d'un trajet
- * - \ref autocomplete : indexation de chaînes de caractères pour retrouver rapidement un élément
- * - \ref gateway : une passerelle plus modulaire adaptée au cloud
- * - log : expérimentations des logs
- * - \ref navimake : transformer des exports fusion .csv dans le format interne
- * - \ref ptreferential : effectuer des requêtes sur le référentiel de données
- * - \ref type : structures de données liées au référentiel de transports en communs
- * - \ref street_network : référentiel de données et algorithmes sur le filaire de voirie
- * - utils : petits outils qui peuvent servir (lire un CSV, soucis d'encodage…)
- *
- */