Tag 2.4-RC2.

git-svn-id: http://svn.openlayers.org/tags/openlayers/release-2.4-rc2@3089 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
crschmidt
2007-04-20 01:29:54 +00:00
parent b6fb16153c
commit 9011c8ca0a
118 changed files with 1591 additions and 730 deletions

View File

@@ -1,5 +1,5 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */
@@ -17,7 +17,7 @@ OpenLayers.Handler.Path.prototype =
OpenLayers.Class.inherit(OpenLayers.Handler.Point, {
/**
* @type OpenLayers.Geometry.LineString
* @type OpenLayers.Feature.Vector
* @private
*/
line: null,
@@ -65,15 +65,17 @@ OpenLayers.Handler.Path.prototype =
/**
* Add temporary geometries
*/
createGeometry: function() {
this.line = new OpenLayers.Geometry.LineString();
this.point = new OpenLayers.Geometry.Point();
createFeature: function() {
this.line = new OpenLayers.Feature.Vector(
new OpenLayers.Geometry.LineString());
this.point = new OpenLayers.Feature.Vector(
new OpenLayers.Geometry.Point());
},
/**
* Destroy temporary geometries
*/
destroyGeometry: function() {
destroyFeature: function() {
this.line.destroy();
this.point.destroy();
},
@@ -83,7 +85,9 @@ OpenLayers.Handler.Path.prototype =
* the behavior of LinearRing that disregards adding duplicate points.
*/
addPoint: function() {
this.line.addComponent(this.point.clone(), this.line.components.length);
this.line.geometry.addComponent(this.point.geometry.clone(),
this.line.geometry.components.length);
this.callback("point", [this.point.geometry]);
},
/**
@@ -100,18 +104,18 @@ OpenLayers.Handler.Path.prototype =
* Modify the existing geometry given the new point
*
*/
modifyGeometry: function() {
var index = this.line.components.length - 1;
this.line.components[index].x = this.point.x;
this.line.components[index].y = this.point.y;
modifyFeature: function() {
var index = this.line.geometry.components.length - 1;
this.line.geometry.components[index].x = this.point.geometry.x;
this.line.geometry.components[index].y = this.point.geometry.y;
},
/**
* Render geometries on the temporary layer.
*/
drawGeometry: function() {
this.layer.renderer.drawGeometry(this.line, this.style);
this.layer.renderer.drawGeometry(this.point, this.style);
drawFeature: function() {
this.layer.drawFeature(this.line, this.style);
this.layer.drawFeature(this.point, this.style);
},
/**
@@ -120,7 +124,7 @@ OpenLayers.Handler.Path.prototype =
* @type OpenLayers.Geometry.LineString
*/
geometryClone: function() {
return this.line.clone();
return this.line.geometry.clone();
},
/**
@@ -136,17 +140,17 @@ OpenLayers.Handler.Path.prototype =
return false;
}
if(this.lastDown == null) {
this.createGeometry();
this.createFeature();
}
this.mouseDown = true;
this.lastDown = evt.xy;
var lonlat = this.control.map.getLonLatFromPixel(evt.xy);
this.point.x = lonlat.lon;
this.point.y = lonlat.lat;
this.point.geometry.x = lonlat.lon;
this.point.geometry.y = lonlat.lat;
if((this.lastUp == null) || !this.lastUp.equals(evt.xy)) {
this.addPoint();
}
this.drawGeometry();
this.drawFeature();
this.drawing = true;
return false;
},
@@ -161,14 +165,14 @@ OpenLayers.Handler.Path.prototype =
mousemove: function (evt) {
if(this.drawing) {
var lonlat = this.map.getLonLatFromPixel(evt.xy);
this.point.x = lonlat.lon;
this.point.y = lonlat.lat;
this.point.geometry.x = lonlat.lon;
this.point.geometry.y = lonlat.lat;
if(this.mouseDown && this.freehandMode(evt)) {
this.addPoint();
} else {
this.modifyGeometry();
this.modifyFeature();
}
this.drawGeometry();
this.drawFeature();
}
return true;
},
@@ -190,7 +194,6 @@ OpenLayers.Handler.Path.prototype =
this.addPoint();
}
this.lastUp = evt.xy;
this.callback("point", [this.point]);
}
return false;
}
@@ -205,9 +208,9 @@ OpenLayers.Handler.Path.prototype =
*/
dblclick: function(evt) {
if(!this.freehandMode(evt)) {
var index = this.line.components.length - 1;
this.line.removeComponent(this.line.components[index]);
this.finalize(this.line);
var index = this.line.geometry.components.length - 1;
this.line.geometry.removeComponent(this.line.geometry.components[index]);
this.finalize();
}
return false;
},