PageRenderTime 47ms CodeModel.GetById 11ms app.highlight 26ms RepoModel.GetById 1ms app.codeStats 1ms

/examples/MarkerManagerDemo/bin-release/srcview/source/com/google/maps/examples/MarkerManager.as.html

http://gmaps-utility-library-flash.googlecode.com/
HTML | 727 lines | 643 code | 83 blank | 1 comment | 0 complexity | f9b25b2c778f7d42552e7fa30b6dfba8 MD5 | raw file

Large files files are truncated, but you can click here to view the full file

  1<!-- saved from url=(0014)about:internet -->
  2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3<html xmlns="http://www.w3.org/1999/xhtml">
  4<head>
  5<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  6<title>MarkerManager.as</title>
  7<link rel="stylesheet" type="text/css" href="../../../../../SourceStyles.css"/>
  8</head>
  9
 10<body><pre><span class="ActionScriptComment">/* 
 11 * MarkerManager, v1.0
 12 * Copyright (c) 2007 Google Inc.
 13 * Author: Doug Ricket, others
 14 *  Ported to AS3 by Pamela Fox 
 15 *
 16 * Licensed under the Apache License, Version 2.0:
 17 *     http://www.apache.org/licenses/LICENSE-2.0
 18 *
 19 * Marker manager is an interface between the map and the user, designed
 20 * to manage adding and removing many points when the viewport changes.
 21 *
 22 * Algorithm: The MM places its markers onto a grid, similar to the map tiles.
 23 * When the user moves the viewport, the MM computes which grid cells have
 24 * entered or left the viewport, and shows or hides all the markers in those
 25 * cells.
 26 * (If the users scrolls the viewport beyond the markers that are loaded,
 27 * no markers will be visible until the EVENT_moveend triggers an update.)
 28 *
 29 * In practical consequences, this allows 10,000 markers to be distributed over
 30 * a large area, and as long as only 100-200 are visible in any given viewport,
 31 * the user will see good performance corresponding to the 100 visible markers,
 32 * rather than poor performance corresponding to the total 10,000 markers.
 33 *
 34 * Note that some code is optimized for speed over space,
 35 * with the goal of accommodating thousands of markers.
 36 *
 37 */</span>
 38<span class="ActionScriptpackage">package</span> <span class="ActionScriptDefault_Text">com</span>.<span class="ActionScriptDefault_Text">google</span>.<span class="ActionScriptDefault_Text">maps</span>.<span class="ActionScriptDefault_Text">examples</span> <span class="ActionScriptBracket/Brace">{</span>
 39<span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">flash</span>.<span class="ActionScriptDefault_Text">events</span>.<span class="ActionScriptDefault_Text">Event</span>;
 40<span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">flash</span>.<span class="ActionScriptDefault_Text">events</span>.<span class="ActionScriptDefault_Text">MouseEvent</span>;
 41<span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">flash</span>.<span class="ActionScriptDefault_Text">geom</span>.<span class="ActionScriptDefault_Text">Point</span>;
 42<span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">flash</span>.<span class="ActionScriptDefault_Text">display</span>.<span class="ActionScriptDefault_Text">DisplayObject</span>;
 43<span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">flash</span>.<span class="ActionScriptDefault_Text">display</span>.<span class="ActionScriptDefault_Text">Sprite</span>;
 44<span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">flash</span>.<span class="ActionScriptDefault_Text">display</span>.<span class="ActionScriptDefault_Text">Shape</span>;
 45<span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">flash</span>.<span class="ActionScriptDefault_Text">text</span>.<span class="ActionScriptDefault_Text">TextField</span>;
 46<span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">flash</span>.<span class="ActionScriptDefault_Text">text</span>.<span class="ActionScriptDefault_Text">TextFieldAutoSize</span>;
 47<span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">flash</span>.<span class="ActionScriptDefault_Text">text</span>.<span class="ActionScriptDefault_Text">TextFormat</span>;
 48<span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">com</span>.<span class="ActionScriptDefault_Text">google</span>.<span class="ActionScriptDefault_Text">maps</span>.<span class="ActionScriptDefault_Text">MapEvent</span>;
 49<span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">com</span>.<span class="ActionScriptDefault_Text">google</span>.<span class="ActionScriptDefault_Text">maps</span>.<span class="ActionScriptDefault_Text">MapMoveEvent</span>;
 50<span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">com</span>.<span class="ActionScriptDefault_Text">google</span>.<span class="ActionScriptDefault_Text">maps</span>.<span class="ActionScriptDefault_Text">Map</span>;
 51<span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">com</span>.<span class="ActionScriptDefault_Text">google</span>.<span class="ActionScriptDefault_Text">maps</span>.<span class="ActionScriptDefault_Text">LatLng</span>;
 52<span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">com</span>.<span class="ActionScriptDefault_Text">google</span>.<span class="ActionScriptDefault_Text">maps</span>.<span class="ActionScriptDefault_Text">LatLngBounds</span>;
 53<span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">com</span>.<span class="ActionScriptDefault_Text">google</span>.<span class="ActionScriptDefault_Text">maps</span>.<span class="ActionScriptDefault_Text">examples</span>.<span class="ActionScriptDefault_Text">GridBounds</span>;
 54<span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">com</span>.<span class="ActionScriptDefault_Text">google</span>.<span class="ActionScriptDefault_Text">maps</span>.<span class="ActionScriptDefault_Text">overlays</span>.<span class="ActionScriptDefault_Text">Marker</span>;
 55<span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">com</span>.<span class="ActionScriptDefault_Text">google</span>.<span class="ActionScriptDefault_Text">maps</span>.<span class="ActionScriptDefault_Text">interfaces</span>.<span class="ActionScriptDefault_Text">IMap</span>;
 56<span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">com</span>.<span class="ActionScriptDefault_Text">google</span>.<span class="ActionScriptDefault_Text">maps</span>.<span class="ActionScriptDefault_Text">interfaces</span>.<span class="ActionScriptDefault_Text">IProjection</span>;
 57
 58<span class="ActionScriptReserved">public</span> <span class="ActionScriptclass">class</span> <span class="ActionScriptDefault_Text">MarkerManager</span> <span class="ActionScriptBracket/Brace">{</span>
 59     
 60<span class="ActionScriptComment">// Static constants:
 61</span><span class="ActionScriptReserved">public</span> <span class="ActionScriptReserved">static</span> <span class="ActionScriptReserved">const</span> <span class="ActionScriptDefault_Text">DEFAULT_TILE_SIZE</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Number</span> <span class="ActionScriptOperator">=</span> 1024;
 62<span class="ActionScriptReserved">public</span> <span class="ActionScriptReserved">static</span> <span class="ActionScriptReserved">const</span> <span class="ActionScriptDefault_Text">DEFAULT_MAX_ZOOM</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Number</span> <span class="ActionScriptOperator">=</span> 17;
 63<span class="ActionScriptReserved">public</span> <span class="ActionScriptReserved">static</span> <span class="ActionScriptReserved">const</span> <span class="ActionScriptDefault_Text">DEFAULT_BORDER_PADDING</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Number</span> <span class="ActionScriptOperator">=</span> 100;
 64<span class="ActionScriptReserved">public</span> <span class="ActionScriptReserved">static</span> <span class="ActionScriptReserved">const</span> <span class="ActionScriptDefault_Text">MERCATOR_ZOOM_LEVEL_ZERO_RANGE</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Number</span> <span class="ActionScriptOperator">=</span> 256;
 65
 66<span class="ActionScriptReserved">private</span> <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">map_</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">IMap</span>;
 67<span class="ActionScriptReserved">private</span> <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">mapZoom_</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Number</span>;
 68<span class="ActionScriptReserved">private</span> <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">maxZoom_</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Number</span>;
 69<span class="ActionScriptReserved">private</span> <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">projection_</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">IProjection</span>;
 70<span class="ActionScriptReserved">private</span> <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">trackMarkers_</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Boolean</span>;
 71<span class="ActionScriptReserved">private</span> <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">swPadding_</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Point</span>;
 72<span class="ActionScriptReserved">private</span> <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">nePadding_</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Point</span>;
 73<span class="ActionScriptReserved">private</span> <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">borderPadding_</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Number</span>;
 74<span class="ActionScriptReserved">private</span> <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">gridWidth_</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Array</span>;
 75<span class="ActionScriptReserved">private</span> <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">grid_</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Array</span>;
 76<span class="ActionScriptReserved">private</span> <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">numMarkers_</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Array</span>;
 77<span class="ActionScriptReserved">private</span> <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">shownBounds_</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">GridBounds</span>;
 78<span class="ActionScriptReserved">private</span> <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">shownMarkers_</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Number</span>;
 79<span class="ActionScriptReserved">private</span> <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">tileSize_</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Number</span>;
 80
 81<span class="ActionScriptASDoc">/**
 82 * Creates a new MarkerManager that will show/hide markers on a map.
 83 *
 84 * @constructor
 85 * @param {Map} map The map to manage.
 86 * @param {Object} opt_opts A container for optional arguments:
 87 *   {Number} maxZoom The maximum zoom level for which to create tiles.
 88 *   {Number} borderPadding The width in pixels beyond the map border,
 89 *                   where markers should be display.
 90 *   {Boolean} trackMarkers Whether or not this manager should track marker
 91 *                   movements.
 92 */</span>
 93<span class="ActionScriptReserved">public</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">MarkerManager</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">map</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">IMap</span>, <span class="ActionScriptDefault_Text">opt_opts</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Object</span><span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptBracket/Brace">{</span>
 94  <span class="ActionScriptReserved">this</span>.<span class="ActionScriptDefault_Text">map_</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">map</span>;
 95  <span class="ActionScriptReserved">this</span>.<span class="ActionScriptDefault_Text">mapZoom_</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">map</span>.<span class="ActionScriptDefault_Text">getZoom</span><span class="ActionScriptBracket/Brace">()</span>;
 96  <span class="ActionScriptReserved">this</span>.<span class="ActionScriptDefault_Text">projection_</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">map</span>.<span class="ActionScriptDefault_Text">getCurrentMapType</span><span class="ActionScriptBracket/Brace">()</span>.<span class="ActionScriptDefault_Text">getProjection</span><span class="ActionScriptBracket/Brace">()</span>;
 97
 98  <span class="ActionScriptDefault_Text">opt_opts</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">opt_opts</span> <span class="ActionScriptOperator">||</span> <span class="ActionScriptBracket/Brace">{}</span>;
 99  <span class="ActionScriptReserved">this</span>.<span class="ActionScriptDefault_Text">tileSize_</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">DEFAULT_TILE_SIZE</span>;
100  
101  <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">maxZoom</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Number</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">DEFAULT_MAX_ZOOM</span>;
102  <span class="ActionScriptReserved">if</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">opt_opts</span>.<span class="ActionScriptDefault_Text">maxZoom</span> <span class="ActionScriptOperator">!=</span> <span class="ActionScriptReserved">undefined</span><span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptBracket/Brace">{</span>
103    <span class="ActionScriptDefault_Text">maxZoom</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">opt_opts</span>.<span class="ActionScriptDefault_Text">maxZoom</span>;
104  <span class="ActionScriptBracket/Brace">}</span>
105  <span class="ActionScriptReserved">this</span>.<span class="ActionScriptDefault_Text">maxZoom_</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">maxZoom</span>;
106
107  <span class="ActionScriptReserved">this</span>.<span class="ActionScriptDefault_Text">trackMarkers_</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">opt_opts</span>.<span class="ActionScriptDefault_Text">trackMarkers</span>;
108
109  <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">padding</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Number</span>;
110  <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">opt_opts</span>.<span class="ActionScriptDefault_Text">borderPadding</span><span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptBracket/Brace">{</span>
111    <span class="ActionScriptDefault_Text">padding</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">opt_opts</span>.<span class="ActionScriptDefault_Text">borderPadding</span>;
112  <span class="ActionScriptBracket/Brace">}</span> <span class="ActionScriptReserved">else</span> <span class="ActionScriptBracket/Brace">{</span>
113    <span class="ActionScriptDefault_Text">padding</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">DEFAULT_BORDER_PADDING</span>;
114  <span class="ActionScriptBracket/Brace">}</span>
115  <span class="ActionScriptComment">// The padding in pixels beyond the viewport, where we will pre-load markers.
116</span>  <span class="ActionScriptReserved">this</span>.<span class="ActionScriptDefault_Text">swPadding_</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">new</span> <span class="ActionScriptDefault_Text">Point</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptOperator">-</span><span class="ActionScriptDefault_Text">padding</span>, <span class="ActionScriptDefault_Text">padding</span><span class="ActionScriptBracket/Brace">)</span>;
117  <span class="ActionScriptReserved">this</span>.<span class="ActionScriptDefault_Text">nePadding_</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">new</span> <span class="ActionScriptDefault_Text">Point</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">padding</span>, <span class="ActionScriptOperator">-</span><span class="ActionScriptDefault_Text">padding</span><span class="ActionScriptBracket/Brace">)</span>;
118  <span class="ActionScriptReserved">this</span>.<span class="ActionScriptDefault_Text">borderPadding_</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">padding</span>;
119
120  <span class="ActionScriptReserved">this</span>.<span class="ActionScriptDefault_Text">gridWidth_</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">new</span> <span class="ActionScriptDefault_Text">Array</span><span class="ActionScriptBracket/Brace">()</span>;
121
122  <span class="ActionScriptReserved">this</span>.<span class="ActionScriptDefault_Text">grid_</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">new</span> <span class="ActionScriptDefault_Text">Array</span><span class="ActionScriptBracket/Brace">()</span>;
123  <span class="ActionScriptReserved">this</span>.<span class="ActionScriptDefault_Text">grid_</span><span class="ActionScriptBracket/Brace">[</span><span class="ActionScriptDefault_Text">maxZoom</span><span class="ActionScriptBracket/Brace">]</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">new</span> <span class="ActionScriptDefault_Text">Array</span><span class="ActionScriptBracket/Brace">()</span>;
124  <span class="ActionScriptReserved">this</span>.<span class="ActionScriptDefault_Text">numMarkers_</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">new</span> <span class="ActionScriptDefault_Text">Array</span><span class="ActionScriptBracket/Brace">()</span>;
125  <span class="ActionScriptReserved">this</span>.<span class="ActionScriptDefault_Text">numMarkers_</span><span class="ActionScriptBracket/Brace">[</span><span class="ActionScriptDefault_Text">maxZoom</span><span class="ActionScriptBracket/Brace">]</span> <span class="ActionScriptOperator">=</span> 0;
126
127  <span class="ActionScriptReserved">this</span>.<span class="ActionScriptDefault_Text">map_</span>.<span class="ActionScriptDefault_Text">addEventListener</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">MapMoveEvent</span>.<span class="ActionScriptDefault_Text">MOVE_END</span>, <span class="ActionScriptReserved">this</span>.<span class="ActionScriptDefault_Text">onMapMoveEnd_</span><span class="ActionScriptBracket/Brace">)</span>;
128
129  <span class="ActionScriptReserved">this</span>.<span class="ActionScriptDefault_Text">resetManager_</span><span class="ActionScriptBracket/Brace">()</span>;
130  <span class="ActionScriptReserved">this</span>.<span class="ActionScriptDefault_Text">shownMarkers_</span> <span class="ActionScriptOperator">=</span> 0;
131
132  <span class="ActionScriptReserved">this</span>.<span class="ActionScriptDefault_Text">shownBounds_</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">this</span>.<span class="ActionScriptDefault_Text">getMapGridBounds_</span><span class="ActionScriptBracket/Brace">()</span>;
133<span class="ActionScriptBracket/Brace">}</span>;
134
135
136<span class="ActionScriptComment">// NOTE: These two closures provide easy access to the map.
137</span><span class="ActionScriptComment">// They are used as callbacks, not as methods.
138</span><span class="ActionScriptReserved">private</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">removeOverlay_</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">marker</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Marker</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptReserved">void</span> <span class="ActionScriptBracket/Brace">{</span>
139  <span class="ActionScriptReserved">this</span>.<span class="ActionScriptDefault_Text">map_</span>.<span class="ActionScriptDefault_Text">removeOverlay</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">marker</span><span class="ActionScriptBracket/Brace">)</span>;
140  <span class="ActionScriptReserved">this</span>.<span class="ActionScriptDefault_Text">shownMarkers_</span><span class="ActionScriptOperator">--</span>;
141<span class="ActionScriptBracket/Brace">}</span>
142
143<span class="ActionScriptReserved">private</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">addOverlay_</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">marker</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Marker</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptReserved">void</span> <span class="ActionScriptBracket/Brace">{</span>
144  <span class="ActionScriptReserved">this</span>.<span class="ActionScriptDefault_Text">map_</span>.<span class="ActionScriptDefault_Text">addOverlay</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">marker</span><span class="ActionScriptBracket/Brace">)</span>;
145  <span class="ActionScriptReserved">this</span>.<span class="ActionScriptDefault_Text">shownMarkers_</span><span class="ActionScriptOperator">++</span>;
146<span class="ActionScriptBracket/Brace">}</span>
147
148<span class="ActionScriptASDoc">/**
149 * Initializes MarkerManager arrays for all zoom levels
150 * Called by constructor and by clearAllMarkers
151 */</span> 
152<span class="ActionScriptReserved">private</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">resetManager_</span><span class="ActionScriptBracket/Brace">()</span><span class="ActionScriptOperator">:</span><span class="ActionScriptReserved">void</span> <span class="ActionScriptBracket/Brace">{</span>
153  <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">mapWidth</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Number</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">MERCATOR_ZOOM_LEVEL_ZERO_RANGE</span>;
154  <span class="ActionScriptReserved">for</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">zoom</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Number</span> <span class="ActionScriptOperator">=</span> 0; <span class="ActionScriptDefault_Text">zoom</span> <span class="ActionScriptOperator">&lt;=</span> <span class="ActionScriptReserved">this</span>.<span class="ActionScriptDefault_Text">maxZoom_</span>; <span class="ActionScriptOperator">++</span><span class="ActionScriptDefault_Text">zoom</span><span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptBracket/Brace">{</span>
155    <span class="ActionScriptReserved">this</span>.<span class="ActionScriptDefault_Text">grid_</span><span class="ActionScriptBracket/Brace">[</span><span class="ActionScriptDefault_Text">zoom</span><span class="ActionScriptBracket/Brace">]</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">new</span> <span class="ActionScriptDefault_Text">Array</span><span class="ActionScriptBracket/Brace">()</span>;
156    <span class="ActionScriptReserved">this</span>.<span class="ActionScriptDefault_Text">numMarkers_</span><span class="ActionScriptBracket/Brace">[</span><span class="ActionScriptDefault_Text">zoom</span><span class="ActionScriptBracket/Brace">]</span> <span class="ActionScriptOperator">=</span> 0;
157    <span class="ActionScriptReserved">this</span>.<span class="ActionScriptDefault_Text">gridWidth_</span><span class="ActionScriptBracket/Brace">[</span><span class="ActionScriptDefault_Text">zoom</span><span class="ActionScriptBracket/Brace">]</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">Math</span>.<span class="ActionScriptDefault_Text">ceil</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">mapWidth</span><span class="ActionScriptOperator">/</span><span class="ActionScriptReserved">this</span>.<span class="ActionScriptDefault_Text">tileSize_</span><span class="ActionScriptBracket/Brace">)</span>;
158    <span class="ActionScriptDefault_Text">mapWidth</span> <span class="ActionScriptOperator">&lt;&lt;=</span> 1;
159  <span class="ActionScriptBracket/Brace">}</span>
160<span class="ActionScriptBracket/Brace">}</span>
161
162<span class="ActionScriptASDoc">/**
163 * Removes all currently displayed markers
164 * and calls resetManager to clear arrays
165 */</span>
166<span class="ActionScriptReserved">public</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">clearMarkers</span><span class="ActionScriptBracket/Brace">()</span><span class="ActionScriptOperator">:</span><span class="ActionScriptReserved">void</span> <span class="ActionScriptBracket/Brace">{</span>
167  <span class="ActionScriptReserved">this</span>.<span class="ActionScriptDefault_Text">processAll_</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptReserved">this</span>.<span class="ActionScriptDefault_Text">shownBounds_</span>, <span class="ActionScriptReserved">this</span>.<span class="ActionScriptDefault_Text">removeOverlay_</span><span class="ActionScriptBracket/Brace">)</span>;
168  <span class="ActionScriptReserved">this</span>.<span class="ActionScriptDefault_Text">resetManager_</span><span class="ActionScriptBracket/Brace">()</span>;
169<span class="ActionScriptBracket/Brace">}</span>
170
171
172<span class="ActionScriptASDoc">/**
173 * Gets the tile coordinate for a given latlng point.
174 *
175 * @param {LatLng} latlng The geographical point.
176 * @param {Number} zoom The zoom level.
177 * @param {GSize} padding The padding used to shift the pixel coordinate.
178 *               Used for expanding a bounds to include an extra padding
179 *               of pixels surrounding the bounds.
180 * @return {GPoint} The point in tile coordinates.
181 *
182 */</span>
183<span class="ActionScriptReserved">private</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">getTilePoint_</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">latlng</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">LatLng</span>, <span class="ActionScriptDefault_Text">zoom</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Number</span>, <span class="ActionScriptDefault_Text">padding</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Point</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Point</span> <span class="ActionScriptBracket/Brace">{</span>
184  <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">pixelPoint</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Point</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">this</span>.<span class="ActionScriptDefault_Text">projection_</span>.<span class="ActionScriptDefault_Text">fromLatLngToPixel</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">latlng</span>, <span class="ActionScriptDefault_Text">zoom</span><span class="ActionScriptBracket/Brace">)</span>;
185  <span class="ActionScriptReserved">return</span> <span class="ActionScriptReserved">new</span> <span class="ActionScriptDefault_Text">Point</span><span class="ActionScriptBracket/Brace">(</span>
186      <span class="ActionScriptDefault_Text">Math</span>.<span class="ActionScriptDefault_Text">floor</span><span class="ActionScriptBracket/Brace">((</span><span class="ActionScriptDefault_Text">pixelPoint</span>.<span class="ActionScriptDefault_Text">x</span> <span class="ActionScriptOperator">+</span> <span class="ActionScriptDefault_Text">padding</span>.<span class="ActionScriptDefault_Text">x</span><span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptOperator">/</span> <span class="ActionScriptReserved">this</span>.<span class="ActionScriptDefault_Text">tileSize_</span><span class="ActionScriptBracket/Brace">)</span>,
187      <span class="ActionScriptDefault_Text">Math</span>.<span class="ActionScriptDefault_Text">floor</span><span class="ActionScriptBracket/Brace">((</span><span class="ActionScriptDefault_Text">pixelPoint</span>.<span class="ActionScriptDefault_Text">y</span> <span class="ActionScriptOperator">+</span> <span class="ActionScriptDefault_Text">padding</span>.<span class="ActionScriptDefault_Text">y</span><span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptOperator">/</span> <span class="ActionScriptReserved">this</span>.<span class="ActionScriptDefault_Text">tileSize_</span><span class="ActionScriptBracket/Brace">))</span>;
188<span class="ActionScriptBracket/Brace">}</span>;
189
190
191<span class="ActionScriptASDoc">/**
192 * Finds the appropriate place to add the marker to the grid.
193 * Optimized for speed; does not actually add the marker to the map.
194 * Designed for batch-processing thousands of markers.
195 *
196 * @param {Marker} marker The marker to add.
197 * @param {Number} minZoom The minimum zoom for displaying the marker.
198 * @param {Number} maxZoom The maximum zoom for displaying the marker.
199 */</span>
200<span class="ActionScriptReserved">private</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">addMarkerBatch_</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">marker</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Marker</span>, <span class="ActionScriptDefault_Text">minZoom</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Number</span>, <span class="ActionScriptDefault_Text">maxZoom</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Number</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptReserved">void</span> <span class="ActionScriptBracket/Brace">{</span>
201  <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">mPoint</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">LatLng</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">marker</span>.<span class="ActionScriptDefault_Text">getLatLng</span><span class="ActionScriptBracket/Brace">()</span>;
202  <span class="ActionScriptComment">// Tracking markers is expensive, so we do this only if the
203</span>  <span class="ActionScriptComment">// user explicitly requested it when creating marker manager.
204</span>  <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptReserved">this</span>.<span class="ActionScriptDefault_Text">trackMarkers_</span><span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptBracket/Brace">{</span>
205    <span class="ActionScriptDefault_Text">marker</span>.<span class="ActionScriptDefault_Text">addEventListener</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">&quot;changed&quot;</span>, <span class="ActionScriptReserved">this</span>.<span class="ActionScriptDefault_Text">onMarkerMoved_</span><span class="ActionScriptBracket/Brace">)</span>;
206  <span class="ActionScriptBracket/Brace">}</span>
207
208  <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">gridPoint</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Point</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">this</span>.<span class="ActionScriptDefault_Text">getTilePoint_</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">mPoint</span>, <span class="ActionScriptDefault_Text">maxZoom</span>, <span class="ActionScriptReserved">new</span> <span class="ActionScriptDefault_Text">Point</span><span class="ActionScriptBracket/Brace">(</span>0, 0<span class="ActionScriptBracket/Brace">))</span>;
209
210  <span class="ActionScriptReserved">for</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">zoom</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Number</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">maxZoom</span>; <span class="ActionScriptDefault_Text">zoom</span> <span class="ActionScriptOperator">&gt;=</span> <span class="ActionScriptDefault_Text">minZoom</span>; <span class="ActionScriptDefault_Text">zoom</span><span class="ActionScriptOperator">--</span><span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptBracket/Brace">{</span>
211    <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">cell</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Array</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">this</span>.<span class="ActionScriptDefault_Text">getGridCellCreate_</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">gridPoint</span>.<span class="ActionScriptDefault_Text">x</span>, <span class="ActionScriptDefault_Text">gridPoint</span>.<span class="ActionScriptDefault_Text">y</span>, <span class="ActionScriptDefault_Text">zoom</span><span class="ActionScriptBracket/Brace">)</span>;
212    <span class="ActionScriptDefault_Text">cell</span>.<span class="ActionScriptDefault_Text">push</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">marker</span><span class="ActionScriptBracket/Brace">)</span>;
213
214    <span class="ActionScriptDefault_Text">gridPoint</span>.<span class="ActionScriptDefault_Text">x</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">gridPoint</span>.<span class="ActionScriptDefault_Text">x</span> <span class="ActionScriptOperator">&gt;&gt;</span> 1;
215    <span class="ActionScriptDefault_Text">gridPoint</span>.<span class="ActionScriptDefault_Text">y</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">gridPoint</span>.<span class="ActionScriptDefault_Text">y</span> <span class="ActionScriptOperator">&gt;&gt;</span> 1;
216  <span class="ActionScriptBracket/Brace">}</span>
217<span class="ActionScriptBracket/Brace">}</span>;
218
219
220<span class="ActionScriptASDoc">/**
221 * Returns whether or not the given point is visible in the shown bounds. This
222 * is a helper method that takes care of the corner case, when shownBounds have
223 * negative minX value.
224 *
225 * @param {Point} point a point on a grid.
226 * @return {Boolean} Whether or not the given point is visible in the currently
227 * shown bounds.
228 */</span>
229<span class="ActionScriptReserved">private</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">isGridPointVisible_</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">point</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Point</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Boolean</span> <span class="ActionScriptBracket/Brace">{</span>
230  <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">vertical</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Boolean</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">this</span>.<span class="ActionScriptDefault_Text">shownBounds_</span>.<span class="ActionScriptDefault_Text">minY</span> <span class="ActionScriptOperator">&lt;=</span> <span class="ActionScriptDefault_Text">point</span>.<span class="ActionScriptDefault_Text">y</span> <span class="ActionScriptOperator">&amp;&amp;</span>
231      <span class="ActionScriptDefault_Text">point</span>.<span class="ActionScriptDefault_Text">y</span> <span class="ActionScriptOperator">&lt;=</span> <span class="ActionScriptReserved">this</span>.<span class="ActionScriptDefault_Text">shownBounds_</span>.<span class="ActionScriptDefault_Text">maxY</span>;
232  <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">minX</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Number</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">this</span>.<span class="ActionScriptDefault_Text">shownBounds_</span>.<span class="ActionScriptDefault_Text">minX</span>;
233  <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">horizontal</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Boolean</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">minX</span> <span class="ActionScriptOperator">&lt;=</span> <span class="ActionScriptDefault_Text">point</span>.<span class="ActionScriptDefault_Text">x</span> <span class="ActionScriptOperator">&amp;&amp;</span> <span class="ActionScriptDefault_Text">point</span>.<span class="ActionScriptDefault_Text">x</span> <span class="ActionScriptOperator">&lt;=</span> <span class="ActionScriptReserved">this</span>.<span class="ActionScriptDefault_Text">shownBounds_</span>.<span class="ActionScriptDefault_Text">maxX</span>;
234  <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(!</span><span class="ActionScriptDefault_Text">horizontal</span> <span class="ActionScriptOperator">&amp;&amp;</span> <span class="ActionScriptDefault_Text">minX</span> <span class="ActionScriptOperator">&lt;</span> 0<span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptBracket/Brace">{</span>
235    <span class="ActionScriptComment">// Shifts the negative part of the rectangle. As point.x is always less
236</span>    <span class="ActionScriptComment">// than grid width, only test shifted minX .. 0 part of the shown bounds.
237</span>    <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">width</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Number</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">this</span>.<span class="ActionScriptDefault_Text">gridWidth_</span><span class="ActionScriptBracket/Brace">[</span><span class="ActionScriptReserved">this</span>.<span class="ActionScriptDefault_Text">shownBounds_</span>.<span class="ActionScriptDefault_Text">z</span><span class="ActionScriptBracket/Brace">]</span>;
238    <span class="ActionScriptDefault_Text">horizontal</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">minX</span> <span class="ActionScriptOperator">+</span> <span class="ActionScriptDefault_Text">width</span> <span class="ActionScriptOperator">&lt;=</span> <span class="ActionScriptDefault_Text">point</span>.<span class="ActionScriptDefault_Text">x</span> <span class="ActionScriptOperator">&amp;&amp;</span> <span class="ActionScriptDefault_Text">point</span>.<span class="ActionScriptDefault_Text">x</span> <span class="ActionScriptOperator">&lt;=</span> <span class="ActionScriptDefault_Text">width</span> <span class="ActionScriptOperator">-</span> 1;
239  <span class="ActionScriptBracket/Brace">}</span>
240  <span class="ActionScriptReserved">return</span> <span class="ActionScriptDefault_Text">vertical</span> <span class="ActionScriptOperator">&amp;&amp;</span> <span class="ActionScriptDefault_Text">horizontal</span>;
241<span class="ActionScriptBracket/Brace">}</span>
242
243
244<span class="ActionScriptASDoc">/**
245 * Reacts to a notification from a marker that it has moved to a new location.
246 * It scans the grid all all zoom levels and moves the marker from the old grid
247 * location to a new grid location.
248 *
249 * @param {Marker} marker The marker that moved.
250 * @param {LatLng} oldLatLng The old position of the marker.
251 * @param {LatLng} newLatLng The new position of the marker.
252 */</span>
253<span class="ActionScriptReserved">private</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">onMarkerMoved_</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">marker</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Marker</span>, <span class="ActionScriptDefault_Text">oldLatLng</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">LatLng</span>, <span class="ActionScriptDefault_Text">newLatLng</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">LatLng</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptReserved">void</span> <span class="ActionScriptBracket/Brace">{</span>
254  <span class="ActionScriptComment">// NOTE: We do not know the minimum or maximum zoom the marker was
255</span>  <span class="ActionScriptComment">// added at, so we start at the absolute maximum. Whenever we successfully
256</span>  <span class="ActionScriptComment">// remove a marker at a given zoom, we add it at the new grid coordinates.
257</span>  <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">zoom</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Number</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">this</span>.<span class="ActionScriptDefault_Text">maxZoom_</span>;
258  <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">changed</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Boolean</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">false</span>;
259  <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">oldGrid</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Point</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">this</span>.<span class="ActionScriptDefault_Text">getTilePoint_</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">oldLatLng</span>, <span class="ActionScriptDefault_Text">zoom</span>, <span class="ActionScriptReserved">new</span> <span class="ActionScriptDefault_Text">Point</span><span class="ActionScriptBracket/Brace">(</span>0, 0<span class="ActionScriptBracket/Brace">))</span>;
260  <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">newGrid</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Point</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">this</span>.<span class="ActionScriptDefault_Text">getTilePoint_</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">newLatLng</span>, <span class="ActionScriptDefault_Text">zoom</span>, <span class="ActionScriptReserved">new</span> <span class="ActionScriptDefault_Text">Point</span><span class="ActionScriptBracket/Brace">(</span>0, 0<span class="ActionScriptBracket/Brace">))</span>;
261  <span class="ActionScriptReserved">while</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">zoom</span> <span class="ActionScriptOperator">&gt;=</span> 0 <span class="ActionScriptOperator">&amp;&amp;</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">oldGrid</span>.<span class="ActionScriptDefault_Text">x</span> <span class="ActionScriptOperator">!=</span> <span class="ActionScriptDefault_Text">newGrid</span>.<span class="ActionScriptDefault_Text">x</span> <span class="ActionScriptOperator">||</span> <span class="ActionScriptDefault_Text">oldGrid</span>.<span class="ActionScriptDefault_Text">y</span> <span class="ActionScriptOperator">!=</span> <span class="ActionScriptDefault_Text">newGrid</span>.<span class="ActionScriptDefault_Text">y</span><span class="ActionScriptBracket/Brace">))</span> <span class="ActionScriptBracket/Brace">{</span>
262    <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">cell</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Array</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">this</span>.<span class="ActionScriptDefault_Text">getGridCellNoCreate_</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">oldGrid</span>.<span class="ActionScriptDefault_Text">x</span>, <span class="ActionScriptDefault_Text">oldGrid</span>.<span class="ActionScriptDefault_Text">y</span>, <span class="ActionScriptDefault_Text">zoom</span><span class="ActionScriptBracket/Brace">)</span>;
263    <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">cell</span><span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptBracket/Brace">{</span>
264      <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptReserved">this</span>.<span class="ActionScriptDefault_Text">removeFromArray</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">cell</span>, <span class="ActionScriptDefault_Text">marker</span><span class="ActionScriptBracket/Brace">))</span> <span class="ActionScriptBracket/Brace">{</span>
265        <span class="ActionScriptReserved">this</span>.<span class="ActionScriptDefault_Text">getGridCellCreate_</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">newGrid</span>.<span class="ActionScriptDefault_Text">x</span>, <span class="ActionScriptDefault_Text">newGrid</span>.<span class="ActionScriptDefault_Text">y</span>, <span class="ActionScriptDefault_Text">zoom</span><span class="ActionScriptBracket/Brace">)</span>.<span class="ActionScriptDefault_Text">push</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">marker</span><span class="ActionScriptBracket/Brace">)</span>;
266      <span class="ActionScriptBracket/Brace">}</span>
267    <span class="ActionScriptBracket/Brace">}</span>
268    <span class="ActionScriptComment">// For the current zoom we also need to update the map. Markers that no
269</span>    <span class="ActionScriptComment">// longer are visible are removed from the map. Markers that moved into
270</span>    <span class="ActionScriptComment">// the shown bounds are added to the map. This also lets us keep the count
271</span>    <span class="ActionScriptComment">// of visible markers up to date.
272</span>    <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">zoom</span> <span class="ActionScriptOperator">==</span> <span class="ActionScriptReserved">this</span>.<span class="ActionScriptDefault_Text">mapZoom_</span><span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptBracket/Brace">{</span>
273      <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptReserved">this</span>.<span class="ActionScriptDefault_Text">isGridPointVisible_</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">oldGrid</span><span class="ActionScriptBracket/Brace">))</span> <span class="ActionScriptBracket/Brace">{</span>
274        <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(!</span><span class="ActionScriptReserved">this</span>.<span class="ActionScriptDefault_Text">isGridPointVisible_</span><span class="ActionScriptBrack…

Large files files are truncated, but you can click here to view the full file