Changes between Version 5 and Version 6 of SettingZoomLevels

Show
Ignore:
Timestamp:
08/19/06 00:04:21 (7 years ago)
Author:
euzuro
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • SettingZoomLevels

    v5 v6  
    5252 * {{{units}}} - ''String'' - The units in which to display the layer. This affects the Scale-Resolution calculation. 
    5353 
    54 Example: 
     54Example Declarations: 
    5555{{{ 
    5656    var options = { scales: [50000000, 30000000, 10000000, 5000000], 
     
    6767                    units: "degrees" 
    6868                  }; 
    69             map = new OpenLayers.Map( $('map') , options); 
     69    map = new OpenLayers.Map( $('map') , options); 
    7070}}} 
    7171 
    7272 
    73 Many of the configuration options listed above can be conflicting, so they have been prioritized, as follows: 
     73Obviously all of the configuration options listed above can not be set at once. Since they can be conflicting, they have been prioritized, as follows: 
    7474 
    7575 * '''Preset zoom levels''' - ''!ZoomLevels are determined by pre-set arrays of scale or resolution'' 
    7676   * {{{scales}}} - The 'resolutions' array is filled with these scales, each directly converted to resolution. 
    7777   * {{{resolutions}}} - The 'resolutions' array is taken directly from the options. 
     78Examples: 
     79{{{ 
     80    var options = { scales: [50000000, 30000000, 10000000, 5000000] }; 
     81    map = new OpenLayers.Map( $('map') , options); 
     82}}} 
     83 
     84{{{ 
     85    var options = { resolutions: [1.40625,0.703125,0.3515625,0.17578125,0.087890625,0.0439453125] }; 
     86    map = new OpenLayers.Map( $('map') , options); 
     87}}} 
     88 
     89 
     90 
    7891 * '''Minimums and Maximums''' - ''!ZoomLevels are determined based on a maximum resolution and the number of desired !ZoomLevels'' 
    7992   * Determining maxResolution 
     
    89102     * {{{numZoomLevels}}} - numZoomLevels value is taken directly from the value specified in the layer options. If no value is specified, the default is taken from the map. 
    90103 
     104Examples: 
    91105 
     106maxResolution: Converted from minScale using specified units  
     107numZoomLevels: Default from map 
     108{{{ 
     109    var options = { minScale: 50000000, 
     110                    units: "degrees" 
     111                  }; 
     112    map = new OpenLayers.Map( $('map') , options); 
     113}}} 
     114 
     115 
     116maxResolution: Calculated based on div size and default maxExtent from map 
     117numZoomLevels: Calculated using ratio of maxResolution/minResolution 
     118{{{ 
     119    var options = { maxResolution: "auto", 
     120                    maxExtent: new OpenLayers.Bounds(-180, -90, 90, 180), 
     121                    minResolution: 0.0439453125 
     122                  }; 
     123    map = new OpenLayers.Map( $('map') , options); 
     124}}} 
     125 
     126maxResolution: Specified 
     127numZoomLevels: Specified 
     128{{{ 
     129    var options = { maxResolution: 0.17578125, 
     130                    numZoomLevels: 15 
     131                  }; 
     132            map = new OpenLayers.Map( $('map') , options); 
     133}}} 
     134 
     135maxResolution: Default from map 
     136numZoomLevels: Converted maxScale (using default units from map) to minResolution, then uses ratio of maxResolution/minResolution to calculate numZoomLevels 
     137{{{ 
     138    var options = { maxScale: 10000000 }; 
     139    map = new OpenLayers.Map( $('map') , options); 
     140}}} 
     141 
     142maxResolution: Specified 
     143numZoomLevels: Calculated minResolution based on div size and default minExtent from map, then uses ratio of  
     144maxResolution/minResolution to calculate numZoomLevels 
     145{{{ 
     146    var options = { maxResolution: 0.17578125, 
     147                    minResolution: "auto", 
     148                    minExtent: new OpenLayers.Bounds(-1, -1, 1, 1), 
     149                  }; 
     150    map = new OpenLayers.Map( $('map') , options); 
     151}}}