source: sipes/libraries/openlayers/examples/navtoolbar-alwaysZoom.html @ 92f109b

stableversion-3.0
Last change on this file since 92f109b was 307d09d, checked in by José Gregorio Puentes <jpuentes@…>, 8 años ago

se agregaron las librerias

  • Propiedad mode establecida a 100644
File size: 2.8 KB
Línea 
1<!DOCTYPE html>
2<html>
3        <head>
4        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
6        <meta name="apple-mobile-web-app-capable" content="yes">
7                <title>A navToolbar with an alwaysZoom ZoomBox</title>
8                <link rel="stylesheet" href="../theme/default/style.css" type="text/css">
9            <link rel="stylesheet" href="style.css" type="text/css">
10                <!-- Override the position of the toolbar to make it fit in a small map -->
11                <style type='text/css'>     
12                        .olControlNavToolbar {
13                          top: 150px;
14                        }
15        </style> 
16                <script src="../lib/OpenLayers.js"></script>
17                <script type="text/javascript">
18                        function init() {
19                                               
20                                //Creation of a custom panel with a ZoomBox control with the alwaysZoom option sets to true                             
21                                OpenLayers.Control.CustomNavToolbar = OpenLayers.Class(OpenLayers.Control.Panel, {
22       
23                                    /**
24                                     * Constructor: OpenLayers.Control.NavToolbar
25                                     * Add our two mousedefaults controls.
26                                     *
27                                     * Parameters:
28                                     * options - {Object} An optional object whose properties will be used
29                                     *     to extend the control.
30                                     */
31                                       
32                                       
33                                    initialize: function(options) {
34                                        OpenLayers.Control.Panel.prototype.initialize.apply(this, [options]);
35                                        this.addControls([
36                                          new OpenLayers.Control.Navigation(),
37                                                  //Here it come
38                                          new OpenLayers.Control.ZoomBox({alwaysZoom:true})
39                                        ]);
40                                                // To make the custom navtoolbar use the regular navtoolbar style
41                                                this.displayClass = 'olControlNavToolbar'
42                                    },
43                                       
44                                       
45                               
46                                    /**
47                                     * Method: draw
48                                     * calls the default draw, and then activates mouse defaults.
49                                     */
50                                    draw: function() {
51                                        var div = OpenLayers.Control.Panel.prototype.draw.apply(this, arguments);
52                        this.defaultControl = this.controls[0];
53                                        return div;
54                                    }
55                                });
56                               
57                                var map;
58                               
59                                map = new OpenLayers.Map('map');
60
61                    var wms = new OpenLayers.Layer.WMS(
62                        "OpenLayers WMS",
63                        "http://vmap0.tiles.osgeo.org/wms/vmap0",
64                        {layers: 'basic'}
65                    );                                   
66                                                               
67                                map.addLayers([wms]);
68                                map.zoomToMaxExtent();
69                               
70                                var panel = new OpenLayers.Control.CustomNavToolbar();
71                    map.addControl(panel);     
72                                }       
73                </script>
74        </head>
75        <body onload="init()">
76                <h1 id="title">A navToolbar with an alwaysZoom ZoomBox</h1>
77        <div id="tags">
78            navigation toolbar
79        </div>
80                <p id="shortdesc">
81                Demo of a custom NavToolbar which uses a zoomBox tool that always zoom in even when the zoom box is too big.
82        </p> 
83                <div id="map" class="smallmap">  </div>
84        </body>
85</html>
Nota: Vea TracBrowser para ayuda de uso del navegador del repositorio.