Changeset 2104
- Timestamp:
- 12/28/06 04:30:30 (2 years ago)
- Files:
-
- sandbox/camptocamp/advancedcontrol/examples/vector.html (modified) (2 diffs)
- sandbox/camptocamp/advancedcontrol/lib/OpenLayers.js (modified) (1 diff)
- sandbox/camptocamp/advancedcontrol/lib/OpenLayers/Control.js (modified) (4 diffs)
- sandbox/camptocamp/advancedcontrol/lib/OpenLayers/Control/Button.js (modified) (3 diffs)
- sandbox/camptocamp/advancedcontrol/lib/OpenLayers/Control/Checkbox.js (modified) (3 diffs)
- sandbox/camptocamp/advancedcontrol/lib/OpenLayers/Control/Choice.js (modified) (3 diffs)
- sandbox/camptocamp/advancedcontrol/lib/OpenLayers/Control/Container.js (modified) (1 diff)
- sandbox/camptocamp/advancedcontrol/lib/OpenLayers/Control/EditingTool/Selection.js (modified) (7 diffs)
- sandbox/camptocamp/advancedcontrol/lib/OpenLayers/Control/Image.js (modified) (3 diffs)
- sandbox/camptocamp/advancedcontrol/lib/OpenLayers/Control/Label.js (modified) (3 diffs)
- sandbox/camptocamp/advancedcontrol/lib/OpenLayers/Control/LayerSwitcher.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
sandbox/camptocamp/advancedcontrol/examples/vector.html
r1981 r2104 16 16 17 17 function init() { 18 //console.log(OpenLayers.Event);19 20 var toolbar = new OpenLayers.Control.EditingToolbar();21 18 var navigation = new OpenLayers.Control.MouseDefaults(); 22 19 23 // the info is an option of the selection. 24 var selection = new OpenLayers.Control.EditingTool.Selection(); 25 var movePathPoint = new OpenLayers.Control.EditingTool.MovePathPoint(); 26 var editingAttributes = new OpenLayers.Control.EditingAttributes(); 27 var rotate = new OpenLayers.Control.EditingTool.Rotate(); 28 var drawPoint = new OpenLayers.Control.EditingTool.DrawPoint(); 29 var drawLineString = new OpenLayers.Control.EditingTool.DrawLineString(); 30 var drawLinearRing = new OpenLayers.Control.EditingTool.DrawLinearRing(); 31 var removePathPoint = new OpenLayers.Control.EditingTool.RemovePathPoint(); 32 var addPathPoint = new OpenLayers.Control.EditingTool.AddPathPoint(); 33 toolbar.addTools([navigation, selection, editingAttributes, movePathPoint, drawPoint, drawLineString, drawLinearRing, addPathPoint, removePathPoint, rotate]); 34 35 map = new OpenLayers.Map('map', {controls: [ 36 toolbar, 37 editingAttributes, 38 new OpenLayers.Control.LayerSwitcher(), 39 new OpenLayers.Control.PanZoom() 40 ]}); 20 map = new OpenLayers.Map('map', {theme: "tango"}); 41 21 42 22 vector = new OpenLayers.Layer.Vector("Vector Layer"); … … 44 24 45 25 map.addLayers([vector, ol_wms]); 26 27 map.resetMouseListeners(); 28 map.addMouseListener(new OpenLayers.Control.MouseListener.Selection()); 46 29 47 30 //map.addControl(new OpenLayers.Control.LayerSwitcher()); sandbox/camptocamp/advancedcontrol/lib/OpenLayers.js
r2081 r2104 111 111 "OpenLayers/Control/MouseListener.js", 112 112 "OpenLayers/Control/MouseDefaults.js", 113 "OpenLayers/Control/EditingTool/Selection.js", 113 114 "OpenLayers/Control/PanZoom.js", 114 115 "OpenLayers/Control/ArgParser.js", sandbox/camptocamp/advancedcontrol/lib/OpenLayers/Control.js
r2081 r2104 12 12 id: null, 13 13 14 /** this gets set in the addControl() function in OpenLayers.Map 15 * @type OpenLayers.Map */ 14 /** @type OpenLayers.Map */ 16 15 map: null, 17 16 18 17 /** @type DOMElement */ 19 18 div: null, 20 21 /** @type OpenLayers.Pixel */22 position: null,23 24 /** @type OpenLayers.Pixel */25 mouseDragStart: null,26 27 /** @type String */28 theme: null,29 19 30 20 /** … … 36 26 this.id = this.id?this.id:OpenLayers.Util.createUniqueID(this.CLASS_NAME + "_"); 37 27 this.controlName = this.controlName?this.controlName:"olControl"; 28 29 options = options || []; 38 30 OpenLayers.Util.extend(this, options); 39 31 }, … … 63 55 * @type DOMElement 64 56 */ 65 draw: function ( px) {57 draw: function () { 66 58 if (this.div == null) { 67 59 this.div = document.createElement("div"); … … 70 62 this.div.className = this.controlName; 71 63 } 72 if (px != null) {73 this.position = px.clone();74 }75 this.moveTo(this.position);76 64 return this.div; 77 65 }, 78 79 /**80 * @param {OpenLayers.Pixel} px81 */82 moveTo: function (px) {83 if ((px != null) && (this.div != null)) {84 this.div.style.left = px.x + "px";85 this.div.style.top = px.y + "px";86 }87 },88 66 89 67 /** sandbox/camptocamp/advancedcontrol/lib/OpenLayers/Control/Button.js
r2085 r2104 14 14 15 15 icon: null, 16 17 actionListeners: null,18 16 19 17 /** … … 37 35 * @type DOMElement 38 36 */ 39 draw: function ( px) {37 draw: function () { 40 38 if (this.div == null) { 41 39 this.div = document.createElement("button"); … … 51 49 } 52 50 53 if (px != null) {54 this.position = px.clone();55 }56 57 this.moveTo(this.position);58 59 51 return this.div; 60 52 }, sandbox/camptocamp/advancedcontrol/lib/OpenLayers/Control/Checkbox.js
r2085 r2104 12 12 13 13 name: null, 14 15 icon: null,16 17 actionListeners: null,18 14 19 15 /** … … 37 33 * @type DOMElement 38 34 */ 39 draw: function ( px) {35 draw: function () { 40 36 if (this.div == null) { 41 37 this.div = document.createElement("input"); … … 44 40 this.div.id = this.id; 45 41 this.div.className = this.controlName; 46 } 47 if (px != null) { 48 this.position = px.clone(); 49 } 50 this.moveTo(this.position); 51 42 } 52 43 return this.div; 53 44 }, sandbox/camptocamp/advancedcontrol/lib/OpenLayers/Control/Choice.js
r2085 r2104 13 13 name: null, 14 14 15 icon: null,15 group: null, 16 16 17 17 actionListeners: null, … … 38 38 * @type DOMElement 39 39 */ 40 draw: function ( px) {40 draw: function () { 41 41 if (this.div == null) { 42 42 this.div = document.createElement("input"); … … 46 46 this.div.name = this.group; 47 47 this.div.className = this.controlName; 48 } 49 if (px != null) { 50 this.position = px.clone(); 51 } 52 this.moveTo(this.position); 53 48 } 54 49 return this.div; 55 50 }, sandbox/camptocamp/advancedcontrol/lib/OpenLayers/Control/Container.js
r2081 r2104 12 12 13 13 contentDiv: null, 14 15 controls: null,16 14 17 15 /** sandbox/camptocamp/advancedcontrol/lib/OpenLayers/Control/EditingTool/Selection.js
r2041 r2104 9 9 */ 10 10 11 OpenLayers.Control. EditingTool.Selection = OpenLayers.Class.create();12 OpenLayers.Control. EditingTool.Selection.prototype = OpenLayers.Class.inherit( OpenLayers.Control.EditingTool, {11 OpenLayers.Control.MouseListener.Selection = OpenLayers.Class.create(); 12 OpenLayers.Control.MouseListener.Selection.prototype = OpenLayers.Class.inherit( OpenLayers.Control.MouseListener, { 13 13 14 14 /** @type String */ … … 27 27 */ 28 28 initialize: function() { 29 OpenLayers.Control. EditingTool.prototype.initialize.apply(this, arguments);29 OpenLayers.Control.MouseListener.prototype.initialize.apply(this, arguments); 30 30 this.style = OpenLayers.Style.DefaultRendererSelectionStyle; 31 31 this.editingModes = []; … … 58 58 * @param {Event} evt 59 59 */ 60 defaultMouseDown: function(evt) {60 mouseDown: function(evt) { 61 61 // Double click manager 62 62 if (this.lastDown && this.lastDown.x == evt.xy.x && this.lastDown.y == evt.xy.y) { … … 65 65 this.lastDown = evt.xy; 66 66 67 OpenLayers.Control.EditingTool.prototype. defaultMouseDown.apply(this, arguments);67 OpenLayers.Control.EditingTool.prototype.mouseDown.apply(this, arguments); 68 68 69 69 // Display Feature attributes … … 115 115 * @param {Event} evt 116 116 */ 117 defaultMouseMove: function (evt) {118 OpenLayers.Control.EditingTool.prototype. defaultMouseMove.apply(this, arguments);117 mouseMove: function (evt) { 118 OpenLayers.Control.EditingTool.prototype.mouseMove.apply(this, arguments); 119 119 120 120 this.eraseTmpElements(); … … 161 161 * @param {Event} evt 162 162 */ 163 defaultMouseUp: function (evt) {164 OpenLayers.Control.EditingTool.prototype. defaultMouseUp.apply(this, arguments);163 mouseUp: function (evt) { 164 OpenLayers.Control.EditingTool.prototype.mouseUp.apply(this, arguments); 165 165 166 166 // TBD check if this is working … … 173 173 * @param {Event} evt 174 174 */ 175 defaultKeyDown: function(evt){175 keyDown: function(evt){ 176 176 OpenLayers.Control.EditingTool.prototype.defaultKeyDown.apply(this, arguments); 177 177 sandbox/camptocamp/advancedcontrol/lib/OpenLayers/Control/Image.js
r2081 r2104 27 27 this.alt = alt; 28 28 29 if (options) { 30 OpenLayers.Control.prototype.initialize.apply(this, options); 31 } 29 options = options || []; 30 OpenLayers.Control.prototype.initialize.apply(this, options); 32 31 }, 33 32 … … 38 37 * @type DOMElement 39 38 */ 40 draw: function ( px) {39 draw: function () { 41 40 if (this.div == null) { 42 41 this.div = OpenLayers.Util.createImagesDomElement(this.image, this.map.theme); … … 45 44 this.div.alt = this.alt; 46 45 this.div.className = this.controlName; 47 } 48 49 if (px != null) { 50 this.position = px.clone(); 51 } 52 53 this.moveTo(this.position); 54 46 } 55 47 return this.div; 56 48 }, sandbox/camptocamp/advancedcontrol/lib/OpenLayers/Control/Label.js
r2085 r2104 12 12 13 13 name: null, 14 15 icon: null,16 14 17 15 actionListeners: null, … … 36 34 * @type DOMElement 37 35 */ 38 draw: function ( px) {36 draw: function () { 39 37 if (this.div == null) { 40 38 this.div = document.createElement("label"); … … 46 44 this.div.appendChild(document.createTextNode(this.name)); 47 45 this.div.className = this.controlName; 48 } 49 if (px != null) { 50 this.position = px.clone(); 51 } 52 this.moveTo(this.position); 53 46 } 54 47 return this.div; 55 48 }, sandbox/camptocamp/advancedcontrol/lib/OpenLayers/Control/LayerSwitcher.js
r2085 r2104 33 33 this.background.className = this.controlName+"Background"; 34 34 this.div.insertBefore(this.background, this.div.childNodes[0]); 35 35 36 36 this.header = document.createElement("div"); 37 37 this.header.className = this.controlName+"Header";
