Resonator on map

Change:
Add "RESONATOR_DISPLAY_ZOOM_LEVEL" to control minimum zoom level resonator will display
Add layerGroup "resonatorsLayers" to draw resonators on it.
Add "window.resonators" to store references to resonators on map

Resonator will have guid of portal with ".11" or ".12" replaced with ".r0"~".r7"
Add function "window.renderResontor" to draw resonators (use sorgo's code [sorgo](https://github.com/sorgo))
"window.renderPortal" will call "window.renderResontor" before add portal to portalsLayers
Change "window.removeByGuid" to handle resonators
Change "window.cleanUp" to handle resonators cleanup
This commit is contained in:
Xelio
2013-02-10 13:25:39 +08:00
parent 6fdfac2923
commit c34d7ee3a2
4 changed files with 109 additions and 3 deletions

View File

@ -139,11 +139,14 @@ var NOMINATIM = 'http://nominatim.openstreetmap.org/search?format=json&limit=1&q
var DEG2RAD = Math.PI / 180;
var TEAM_NONE = 0, TEAM_RES = 1, TEAM_ENL = 2;
var TEAM_TO_CSS = ['none', 'res', 'enl'];
var TYPE_UNKNOWN = 0, TYPE_PORTAL = 1, TYPE_LINK = 2, TYPE_FIELD = 3, TYPE_PLAYER = 4, TYPE_CHAT = 5;
var TYPE_UNKNOWN = 0, TYPE_PORTAL = 1, TYPE_LINK = 2, TYPE_FIELD = 3, TYPE_PLAYER = 4, TYPE_CHAT = 5, TYPE_RESONATOR = 6;
// make PLAYER variable available in site context
var PLAYER = window.PLAYER;
var CHAT_SHRINKED = 60;
// Minimum zoom level resonator will display
var RESONATOR_DISPLAY_ZOOM_LEVEL = 16;
// STORAGE ///////////////////////////////////////////////////////////
// global variables used for storage. Most likely READ ONLY. Proper
// way would be to encapsulate them in an anonymous function and write
@ -156,7 +159,7 @@ window.selectedPortal = null;
window.portalRangeIndicator = null;
window.portalAccessIndicator = null;
window.mapRunsUserAction = false;
var portalsLayers, linksLayer, fieldsLayer;
var portalsLayers, linksLayer, fieldsLayer, resonatorsLayers;
// contain references to all entities shown on the map. These are
// automatically kept in sync with the items on *sLayer, so never ever
@ -164,6 +167,7 @@ var portalsLayers, linksLayer, fieldsLayer;
window.portals = {};
window.links = {};
window.fields = {};
window.resonators = {};
// plugin framework. Plugins may load earlier than iitc, so dont
// overwrite data