source:
trunk/workshop-routing-foss4g/web/OpenLayers/lib/OpenLayers/Control/EditingToolbar.js
@
76
Revision 76, 2.1 KB checked in by djay, 12 years ago (diff) | |
---|---|
|
Line | |
---|---|
1 | /* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for |
2 | * full list of contributors). Published under the Clear BSD license. |
3 | * See http://svn.openlayers.org/trunk/openlayers/license.txt for the |
4 | * full text of the license. */ |
5 | |
6 | /** |
7 | * @requires OpenLayers/Control/Panel.js |
8 | * @requires OpenLayers/Control/Navigation.js |
9 | * @requires OpenLayers/Control/DrawFeature.js |
10 | * @requires OpenLayers/Handler/Point.js |
11 | * @requires OpenLayers/Handler/Path.js |
12 | * @requires OpenLayers/Handler/Polygon.js |
13 | */ |
14 | |
15 | /** |
16 | * Class: OpenLayers.Control.EditingToolbar |
17 | * The EditingToolbar is a panel of 4 controls to draw polygons, lines, |
18 | * points, or to navigate the map by panning. By default it appears in the |
19 | * upper right corner of the map. |
20 | * |
21 | * Inherits from: |
22 | * - <OpenLayers.Control.Panel> |
23 | */ |
24 | OpenLayers.Control.EditingToolbar = OpenLayers.Class( |
25 | OpenLayers.Control.Panel, { |
26 | |
27 | /** |
28 | * Constructor: OpenLayers.Control.EditingToolbar |
29 | * Create an editing toolbar for a given layer. |
30 | * |
31 | * Parameters: |
32 | * layer - {<OpenLayers.Layer.Vector>} |
33 | * options - {Object} |
34 | */ |
35 | initialize: function(layer, options) { |
36 | OpenLayers.Control.Panel.prototype.initialize.apply(this, [options]); |
37 | |
38 | this.addControls( |
39 | [ new OpenLayers.Control.Navigation() ] |
40 | ); |
41 | var controls = [ |
42 | new OpenLayers.Control.DrawFeature(layer, OpenLayers.Handler.Point, {'displayClass': 'olControlDrawFeaturePoint'}), |
43 | new OpenLayers.Control.DrawFeature(layer, OpenLayers.Handler.Path, {'displayClass': 'olControlDrawFeaturePath'}), |
44 | new OpenLayers.Control.DrawFeature(layer, OpenLayers.Handler.Polygon, {'displayClass': 'olControlDrawFeaturePolygon'}) |
45 | ]; |
46 | this.addControls(controls); |
47 | }, |
48 | |
49 | /** |
50 | * Method: draw |
51 | * calls the default draw, and then activates mouse defaults. |
52 | * |
53 | * Returns: |
54 | * {DOMElement} |
55 | */ |
56 | draw: function() { |
57 | var div = OpenLayers.Control.Panel.prototype.draw.apply(this, arguments); |
58 | this.activateControl(this.controls[0]); |
59 | return div; |
60 | }, |
61 | |
62 | CLASS_NAME: "OpenLayers.Control.EditingToolbar" |
63 | }); |
Note: See TracBrowser
for help on using the repository browser.