Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function MapData(map) {
- this.map = JSON.parse(map);
- this.markers = [];
- this.paths = [];
- };
- MapData.prototype.GetMapData = function (callback) {
- var MapDataEnv = this;
- $.ajax({
- url: '/Maps/GetMapDataByMapId',
- async: true,
- data: { id: MapDataEnv.map.MapId },
- success: function (mapDataResult) {
- $(mapDataResult).each(function (index, value) {
- if (value.IsPoint) {
- MapDataEnv.AddMarker(value);
- }
- if (value.IsPolygon) {
- MapDataEnv.AddPath(value);
- }
- });
- if(callback) callback(mapDataResult);
- }
- });
- };
- MapData.prototype.AddMarker = function (marker) {
- this.markers.push(marker);
- };
- MapData.prototype.AddPath = function (path) {
- this.paths.push(path);
- };
- MapData.prototype.GetMarkers = function () {
- return this.markers;
- };
- //var map1 = new MapData(map);
- map1.GetMapData(function(data) {
- console.log(data);
- console.log(this.GetMarkers());
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement