Pullup r2999:3087 for RC2.
svn merge trunk/openlayers/@2999 trunk/openlayers/@HEAD branches/openlayers/2.4/ git-svn-id: http://svn.openlayers.org/branches/openlayers/2.4@3088 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -13,10 +13,11 @@
|
|||||||
<script src="../lib/OpenLayers.js"></script>
|
<script src="../lib/OpenLayers.js"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
<!--
|
<!--
|
||||||
|
var map;
|
||||||
function init(){
|
function init(){
|
||||||
var map = new OpenLayers.Map('map');
|
map = new OpenLayers.Map('map');
|
||||||
|
|
||||||
var options = {maxResolution: 'auto', numZoomLevels: 3};
|
var options = {numZoomLevels: 3};
|
||||||
|
|
||||||
var graphic = new OpenLayers.Layer.Image(
|
var graphic = new OpenLayers.Layer.Image(
|
||||||
'City Lights',
|
'City Lights',
|
||||||
|
|||||||
@@ -99,25 +99,19 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var displayedGeom = null;
|
var displayedFeature = null;
|
||||||
function feature_info_hover(geometry) {
|
function feature_info_hover(feature) {
|
||||||
if(geometry.parent) {
|
if (displayedFeature != feature &&
|
||||||
geometry = geometry.parent;
|
(!feature.layer.selectedFeatures.length ||
|
||||||
}
|
(feature.layer.selectedFeatures[0] == feature))) {
|
||||||
if (displayedGeom != geometry &&
|
feature_info(feature);
|
||||||
(!geometry.feature.layer.selectedFeatures.length ||
|
displayedFeature = feature;
|
||||||
(geometry.feature.layer.selectedFeatures[0].geometry == geometry))) {
|
|
||||||
feature_info(geometry);
|
|
||||||
displaydGeom = geometry;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function feature_info(geometry) {
|
function feature_info(feature) {
|
||||||
if(geometry.parent) {
|
|
||||||
geometry = geometry.parent;
|
|
||||||
}
|
|
||||||
var html = "<ul>";
|
var html = "<ul>";
|
||||||
for(var i in geometry.feature.attributes)
|
for(var i in feature.attributes)
|
||||||
html += "<li><b>" + i + "</b>: "+ geometry.feature.attributes[i] + "</li>";
|
html += "<li><b>" + i + "</b>: "+ feature.attributes[i] + "</li>";
|
||||||
html += "</ul>";
|
html += "</ul>";
|
||||||
$('feature_info').innerHTML = html;
|
$('feature_info').innerHTML = html;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<script src="../lib/OpenLayers.js"></script>
|
<script src="../lib/OpenLayers.js"></script>
|
||||||
<script src="../lib/Firebug/debug.js"></script>
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
<!--
|
<!--
|
||||||
var map;
|
var map;
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
df.featureAdded = function(feature) {
|
df.featureAdded = function(feature) {
|
||||||
feature.state = OpenLayers.State.INSERT;
|
feature.state = OpenLayers.State.INSERT;
|
||||||
feature.style['strokeColor'] = "#ff0000";
|
feature.style['strokeColor'] = "#ff0000";
|
||||||
feature.layer.renderer.drawGeometry(feature.geometry, feature.style);
|
feature.layer.drawFeature(feature);
|
||||||
}
|
}
|
||||||
p.addControls([ new OpenLayers.Control.Navigation(), df ]);
|
p.addControls([ new OpenLayers.Control.Navigation(), df ]);
|
||||||
|
|
||||||
@@ -47,7 +47,7 @@
|
|||||||
for(var i = 0; i < map.layers[1].features.length; i++) {
|
for(var i = 0; i < map.layers[1].features.length; i++) {
|
||||||
var f = map.layers[1].features[i];
|
var f = map.layers[1].features[i];
|
||||||
f.style['strokeColor'] = '#ee9900';
|
f.style['strokeColor'] = '#ee9900';
|
||||||
map.layers[1].renderer.drawGeometry(f.geometry, f.style);
|
map.layers[1].drawFeature(f);
|
||||||
}
|
}
|
||||||
map.layers[1].commit();
|
map.layers[1].commit();
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
featureNS: 'http://www.openplans.org/topp',
|
featureNS: 'http://www.openplans.org/topp',
|
||||||
extractAttributes: false
|
extractAttributes: false
|
||||||
} );
|
} );
|
||||||
rlayer.onFeatureInsert=function(feature) { feature.style.strokeColor = "#ff0000"; feature.layer.renderer.drawGeometry(feature.geometry, feature.style); }
|
rlayer.onFeatureInsert=function(feature) { feature.style.strokeColor = "#ff0000"; feature.layer.drawFeature(feature); }
|
||||||
map.addLayer(rlayer);
|
map.addLayer(rlayer);
|
||||||
layer = new OpenLayers.Layer.WFS( "Cities",
|
layer = new OpenLayers.Layer.WFS( "Cities",
|
||||||
"http://dev.openlayers.org/geoserver/wfs", {typename: 'topp:tasmania_cities'},
|
"http://dev.openlayers.org/geoserver/wfs", {typename: 'topp:tasmania_cities'},
|
||||||
@@ -44,7 +44,7 @@
|
|||||||
df.featureAdded = function(feature) {
|
df.featureAdded = function(feature) {
|
||||||
feature.state = OpenLayers.State.INSERT;
|
feature.state = OpenLayers.State.INSERT;
|
||||||
feature.style['strokeColor'] = "#0000ff";
|
feature.style['strokeColor'] = "#0000ff";
|
||||||
feature.layer.renderer.drawGeometry(feature.geometry, feature.style);
|
feature.layer.drawFeature(feature);
|
||||||
}
|
}
|
||||||
dp = new OpenLayers.Control.DrawFeature(layer, OpenLayers.Handler.Point, {handlerOptions: {'freehand': false}, 'displayClass': 'olControlDrawFeaturePoint'});
|
dp = new OpenLayers.Control.DrawFeature(layer, OpenLayers.Handler.Point, {handlerOptions: {'freehand': false}, 'displayClass': 'olControlDrawFeaturePoint'});
|
||||||
dp.featureAdded = function(feature) {
|
dp.featureAdded = function(feature) {
|
||||||
@@ -53,7 +53,7 @@
|
|||||||
feature.geometry = new OpenLayers.Geometry.MultiPoint(oldgeom);
|
feature.geometry = new OpenLayers.Geometry.MultiPoint(oldgeom);
|
||||||
feature.state = OpenLayers.State.INSERT;
|
feature.state = OpenLayers.State.INSERT;
|
||||||
feature.style['strokeColor'] = "#0000ff";
|
feature.style['strokeColor'] = "#0000ff";
|
||||||
feature.layer.renderer.drawGeometry(feature.geometry, feature.style);
|
feature.layer.drawFeature(feature);
|
||||||
}
|
}
|
||||||
p.addControls([ new OpenLayers.Control.Navigation(), df, dp ]);
|
p.addControls([ new OpenLayers.Control.Navigation(), df, dp ]);
|
||||||
|
|
||||||
|
|||||||
@@ -77,8 +77,8 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function displayWKT(geometry) {
|
function displayWKT(feature) {
|
||||||
var str = wkt.write(geometry);
|
var str = wkt.write(feature.geometry);
|
||||||
// not a good idea in general, just for this demo
|
// not a good idea in general, just for this demo
|
||||||
str = str.replace(/,/g, ', ');
|
str = str.replace(/,/g, ', ');
|
||||||
document.getElementById('info').innerHTML = str;
|
document.getElementById('info').innerHTML = str;
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ OpenLayers.Control.DrawFeature.prototype =
|
|||||||
/**
|
/**
|
||||||
* @type {Object} The functions that are sent to the handler for callback
|
* @type {Object} The functions that are sent to the handler for callback
|
||||||
*/
|
*/
|
||||||
callbacks: {},
|
callbacks: null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {Function} Called after each feature is added
|
* @type {Function} Called after each feature is added
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ OpenLayers.Control.KeyboardDefaults.prototype =
|
|||||||
OpenLayers.Class.inherit( OpenLayers.Control, {
|
OpenLayers.Class.inherit( OpenLayers.Control, {
|
||||||
|
|
||||||
/** @type int */
|
/** @type int */
|
||||||
slideFactor: 50,
|
slideFactor: 75,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
@@ -50,26 +50,48 @@ OpenLayers.Control.KeyboardDefaults.prototype =
|
|||||||
defaultKeyPress: function (code) {
|
defaultKeyPress: function (code) {
|
||||||
switch(code) {
|
switch(code) {
|
||||||
case OpenLayers.Event.KEY_LEFT:
|
case OpenLayers.Event.KEY_LEFT:
|
||||||
this.map.pan(-50, 0);
|
this.map.pan(-this.slideFactor, 0);
|
||||||
break;
|
break;
|
||||||
case OpenLayers.Event.KEY_RIGHT:
|
case OpenLayers.Event.KEY_RIGHT:
|
||||||
this.map.pan(50, 0);
|
this.map.pan(this.slideFactor, 0);
|
||||||
break;
|
break;
|
||||||
case OpenLayers.Event.KEY_UP:
|
case OpenLayers.Event.KEY_UP:
|
||||||
this.map.pan(0, -50);
|
this.map.pan(0, -this.slideFactor);
|
||||||
break;
|
break;
|
||||||
case OpenLayers.Event.KEY_DOWN:
|
case OpenLayers.Event.KEY_DOWN:
|
||||||
this.map.pan(0, 50);
|
this.map.pan(0, this.slideFactor);
|
||||||
break;
|
break;
|
||||||
case 33: // Page Up
|
|
||||||
case 43: // +
|
case 33: // Page Up
|
||||||
|
var size = this.map.getSize();
|
||||||
|
this.map.pan(0, -0.75*size.h);
|
||||||
|
break;
|
||||||
|
case 34: // Page Down
|
||||||
|
var size = this.map.getSize();
|
||||||
|
this.map.pan(0, 0.75*size.h);
|
||||||
|
break;
|
||||||
|
case 35: // End
|
||||||
|
var size = this.map.getSize();
|
||||||
|
this.map.pan(0.75*size.w, 0);
|
||||||
|
break;
|
||||||
|
case 36: // Pos1
|
||||||
|
var size = this.map.getSize();
|
||||||
|
this.map.pan(-0.75*size.w, 0);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 43: // +
|
||||||
|
this.map.zoomIn();
|
||||||
|
break;
|
||||||
|
case 45: // -
|
||||||
|
this.map.zoomOut();
|
||||||
|
break;
|
||||||
|
case 107: // + (IE only)
|
||||||
this.map.zoomIn();
|
this.map.zoomIn();
|
||||||
break;
|
break;
|
||||||
case 45: // -
|
case 109: // - (IE only)
|
||||||
case 34: // Page Down
|
|
||||||
this.map.zoomOut();
|
this.map.zoomOut();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/** @final @type String */
|
/** @final @type String */
|
||||||
|
|||||||
@@ -336,7 +336,7 @@ OpenLayers.Control.LayerSwitcher.prototype =
|
|||||||
|
|
||||||
//configure main div
|
//configure main div
|
||||||
this.div.style.position = "absolute";
|
this.div.style.position = "absolute";
|
||||||
this.div.style.top = "10px";
|
this.div.style.top = "25px";
|
||||||
this.div.style.right = "0px";
|
this.div.style.right = "0px";
|
||||||
this.div.style.left = "";
|
this.div.style.left = "";
|
||||||
this.div.style.fontFamily = "sans-serif";
|
this.div.style.fontFamily = "sans-serif";
|
||||||
|
|||||||
@@ -181,7 +181,7 @@ OpenLayers.Control.MouseDefaults.prototype =
|
|||||||
}
|
}
|
||||||
document.onselectstart=null;
|
document.onselectstart=null;
|
||||||
this.mouseDragStart = null;
|
this.mouseDragStart = null;
|
||||||
this.map.div.style.cursor = "default";
|
this.map.div.style.cursor = "";
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -239,7 +239,7 @@ OpenLayers.Control.MouseToolbar.prototype =
|
|||||||
this.map.div.style.cursor = "crosshair";
|
this.map.div.style.cursor = "crosshair";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
this.map.div.style.cursor = "default";
|
this.map.div.style.cursor = "";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ OpenLayers.Control.OverviewMap.prototype =
|
|||||||
*
|
*
|
||||||
* @type Array(OpenLayers.Layer)
|
* @type Array(OpenLayers.Layer)
|
||||||
*/
|
*/
|
||||||
layers: [],
|
layers: null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The ratio of the overview map resolution to the main map resolution
|
* The ratio of the overview map resolution to the main map resolution
|
||||||
@@ -68,13 +68,14 @@ OpenLayers.Control.OverviewMap.prototype =
|
|||||||
* options that the main map was constructed with.
|
* options that the main map was constructed with.
|
||||||
* @type: Object
|
* @type: Object
|
||||||
*/
|
*/
|
||||||
mapOptions: {},
|
mapOptions: null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
* @param {Object} options Hashtable of options to set on the overview map
|
* @param {Object} options Hashtable of options to set on the overview map
|
||||||
*/
|
*/
|
||||||
initialize: function(options) {
|
initialize: function(options) {
|
||||||
|
this.layers = new Array();
|
||||||
OpenLayers.Control.prototype.initialize.apply(this, [options]);
|
OpenLayers.Control.prototype.initialize.apply(this, [options]);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -104,6 +104,8 @@ OpenLayers.Control.PanZoom.prototype =
|
|||||||
this.doubleClick.bindAsEventListener(btn));
|
this.doubleClick.bindAsEventListener(btn));
|
||||||
OpenLayers.Event.observe(btn, "dblclick",
|
OpenLayers.Event.observe(btn, "dblclick",
|
||||||
this.doubleClick.bindAsEventListener(btn));
|
this.doubleClick.bindAsEventListener(btn));
|
||||||
|
OpenLayers.Event.observe(btn, "click",
|
||||||
|
this.doubleClick.bindAsEventListener(btn));
|
||||||
btn.action = id;
|
btn.action = id;
|
||||||
btn.map = this.map;
|
btn.map = this.map;
|
||||||
btn.slideFactor = this.slideFactor;
|
btn.slideFactor = this.slideFactor;
|
||||||
|
|||||||
@@ -228,7 +228,7 @@ OpenLayers.Control.PanZoomBar.prototype =
|
|||||||
zoomBarUp:function(evt) {
|
zoomBarUp:function(evt) {
|
||||||
if (!OpenLayers.Event.isLeftClick(evt)) return;
|
if (!OpenLayers.Event.isLeftClick(evt)) return;
|
||||||
if (this.zoomStart) {
|
if (this.zoomStart) {
|
||||||
this.div.style.cursor="default";
|
this.div.style.cursor="";
|
||||||
this.map.events.unregister("mouseup", this, this.passEventToSlider);
|
this.map.events.unregister("mouseup", this, this.passEventToSlider);
|
||||||
this.map.events.unregister("mousemove", this, this.passEventToSlider);
|
this.map.events.unregister("mousemove", this, this.passEventToSlider);
|
||||||
var deltaY = this.zoomStart.y - evt.xy.y
|
var deltaY = this.zoomStart.y - evt.xy.y
|
||||||
|
|||||||
@@ -27,13 +27,13 @@ OpenLayers.Control.SelectFeature.prototype =
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {Function} Optional function to be called when a feature is selected.
|
* @type {Function} Optional function to be called when a feature is selected.
|
||||||
* The function should expect to be called with a geometry.
|
* The function should expect to be called with a feature.
|
||||||
*/
|
*/
|
||||||
onSelect: function() {},
|
onSelect: function() {},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {Function} Optional function to be called when a feature is unselected.
|
* @type {Function} Optional function to be called when a feature is unselected.
|
||||||
* The function should expect to be called with a geometry.
|
* The function should expect to be called with a feature.
|
||||||
*/
|
*/
|
||||||
onUnselect: function() {},
|
onUnselect: function() {},
|
||||||
|
|
||||||
@@ -45,7 +45,7 @@ OpenLayers.Control.SelectFeature.prototype =
|
|||||||
/**
|
/**
|
||||||
* @type {Object} The functions that are sent to the handler for callback
|
* @type {Object} The functions that are sent to the handler for callback
|
||||||
*/
|
*/
|
||||||
callbacks: {},
|
callbacks: null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {Object} Hash of styles
|
* @type {Object} Hash of styles
|
||||||
@@ -76,31 +76,28 @@ OpenLayers.Control.SelectFeature.prototype =
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the feature handler detects a mouse-down on a feature
|
* Called when the feature handler detects a mouse-down on a feature
|
||||||
* @param {OpenLayers.Geometry}
|
* @param {OpenLayers.Vector.Feature}
|
||||||
*/
|
*/
|
||||||
downFeature: function(geometry) {
|
downFeature: function(feature) {
|
||||||
if(this.hover) {
|
if(this.hover) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(geometry.parent) {
|
|
||||||
geometry = geometry.parent;
|
|
||||||
}
|
|
||||||
if (this.multiple) {
|
if (this.multiple) {
|
||||||
if(OpenLayers.Util.indexOf(this.layer.selectedFeatures, geometry.feature) > -1) {
|
if(OpenLayers.Util.indexOf(this.layer.selectedFeatures, feature) > -1) {
|
||||||
this.unselect(geometry);
|
this.unselect(feature);
|
||||||
} else {
|
} else {
|
||||||
this.select(geometry);
|
this.select(feature);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(OpenLayers.Util.indexOf(this.layer.selectedFeatures, geometry.feature) > -1) {
|
if(OpenLayers.Util.indexOf(this.layer.selectedFeatures, feature) > -1) {
|
||||||
this.unselect(geometry);
|
this.unselect(feature);
|
||||||
} else {
|
} else {
|
||||||
if (this.layer.selectedFeatures) {
|
if (this.layer.selectedFeatures) {
|
||||||
for (var i = 0; i < this.layer.selectedFeatures.length; i++) {
|
for (var i = 0; i < this.layer.selectedFeatures.length; i++) {
|
||||||
this.unselect(this.layer.selectedFeatures[i].geometry);
|
this.unselect(this.layer.selectedFeatures[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.select(geometry);
|
this.select(feature);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -108,63 +105,57 @@ OpenLayers.Control.SelectFeature.prototype =
|
|||||||
/**
|
/**
|
||||||
* Called when the feature handler detects a mouse-over on a feature.
|
* Called when the feature handler detects a mouse-over on a feature.
|
||||||
* Only responds if this.hover is true.
|
* Only responds if this.hover is true.
|
||||||
* @param {OpenLayers.Geometry}
|
* @param {OpenLayers.Feature.Vector}
|
||||||
*/
|
*/
|
||||||
overFeature: function(geometry) {
|
overFeature: function(feature) {
|
||||||
if(!this.hover) {
|
if(!this.hover) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(geometry.parent) {
|
if(!(OpenLayers.Util.indexOf(this.layer.selectedFeatures, feature) > -1)) {
|
||||||
geometry = geometry.parent;
|
this.select(feature);
|
||||||
}
|
|
||||||
if(!(OpenLayers.Util.indexOf(this.layer.selectedFeatures, geometry.feature) > -1)) {
|
|
||||||
this.select(geometry);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the feature handler detects a mouse-out on a feature.
|
* Called when the feature handler detects a mouse-out on a feature.
|
||||||
* Only responds if this.hover is true.
|
* Only responds if this.hover is true.
|
||||||
* @param {OpenLayers.Geometry}
|
* @param {OpenLayers.Feature.Vector}
|
||||||
*/
|
*/
|
||||||
outFeature: function(geometry) {
|
outFeature: function(feature) {
|
||||||
if(!this.hover) {
|
if(!this.hover) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(geometry.parent) {
|
this.unselect(feature);
|
||||||
geometry = geometry.parent;
|
|
||||||
}
|
|
||||||
this.unselect(geometry);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add feature to the layer's selectedFeature array, render the feature as
|
* Add feature to the layer's selectedFeature array, render the feature as
|
||||||
* selected, and call the onSelect function.
|
* selected, and call the onSelect function.
|
||||||
* @param {OpenLayers.Geometry} geometry
|
* @param {OpenLayers.Feature.Vector} feature
|
||||||
*/
|
*/
|
||||||
select: function(geometry) {
|
select: function(feature) {
|
||||||
// Store feature style for restoration later
|
// Store feature style for restoration later
|
||||||
if(geometry.feature.originalStyle == null) {
|
if(feature.originalStyle == null) {
|
||||||
geometry.feature.originalStyle = geometry.feature.style;
|
feature.originalStyle = feature.style;
|
||||||
}
|
}
|
||||||
this.layer.selectedFeatures.push(geometry.feature);
|
this.layer.selectedFeatures.push(feature);
|
||||||
this.layer.renderer.drawGeometry(geometry, this.selectStyle);
|
this.layer.drawFeature(feature, this.selectStyle);
|
||||||
this.onSelect(geometry);
|
this.onSelect(feature);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove feature from the layer's selectedFeature array, render the feature as
|
* Remove feature from the layer's selectedFeature array, render the feature as
|
||||||
* normal, and call the onUnselect function.
|
* normal, and call the onUnselect function.
|
||||||
* @param {OpenLayers.Geometry} geometry
|
* @param {OpenLayers.Feature.Vector} feature
|
||||||
*/
|
*/
|
||||||
unselect: function(geometry) {
|
unselect: function(feature) {
|
||||||
// Store feature style for restoration later
|
// Store feature style for restoration later
|
||||||
if(geometry.feature.originalStyle == null) {
|
if(feature.originalStyle == null) {
|
||||||
geometry.feature.originalStyle = geometry.feature.style;
|
feature.originalStyle = feature.style;
|
||||||
}
|
}
|
||||||
this.layer.renderer.drawGeometry(geometry, geometry.feature.originalStyle);
|
this.layer.drawFeature(feature, feature.originalStyle);
|
||||||
OpenLayers.Util.removeItem(this.layer.selectedFeatures, geometry.feature);
|
OpenLayers.Util.removeItem(this.layer.selectedFeatures, feature);
|
||||||
this.onUnselect(geometry);
|
this.onUnselect(feature);
|
||||||
},
|
},
|
||||||
|
|
||||||
/** Set the map property for the control.
|
/** Set the map property for the control.
|
||||||
|
|||||||
@@ -27,10 +27,10 @@ OpenLayers.Feature.Vector.prototype =
|
|||||||
/** @type OpenLayers.Geometry */
|
/** @type OpenLayers.Geometry */
|
||||||
geometry:null,
|
geometry:null,
|
||||||
|
|
||||||
/** @type array */
|
/** @type Object */
|
||||||
attributes: {},
|
attributes: null,
|
||||||
|
|
||||||
/** @type strinng */
|
/** @type String */
|
||||||
state: null,
|
state: null,
|
||||||
|
|
||||||
/** @type Object */
|
/** @type Object */
|
||||||
@@ -46,11 +46,12 @@ OpenLayers.Feature.Vector.prototype =
|
|||||||
initialize: function(geometry, data, style) {
|
initialize: function(geometry, data, style) {
|
||||||
OpenLayers.Feature.prototype.initialize.apply(this, [null, null, data]);
|
OpenLayers.Feature.prototype.initialize.apply(this, [null, null, data]);
|
||||||
this.lonlat = null;
|
this.lonlat = null;
|
||||||
this.setGeometry(geometry);
|
this.geometry = geometry;
|
||||||
this.state = null;
|
this.state = null;
|
||||||
|
this.attributes = new Object();
|
||||||
if (data) {
|
if (data) {
|
||||||
OpenLayers.Util.extend(this.attributes, data);
|
this.attributes = OpenLayers.Util.extend(this.attributes, data);
|
||||||
}
|
}
|
||||||
this.style = style ? style : null;
|
this.style = style ? style : null;
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -125,56 +126,6 @@ OpenLayers.Feature.Vector.prototype =
|
|||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
|
||||||
* Set a feature id to the feature
|
|
||||||
*
|
|
||||||
* @param {String} feature id to set
|
|
||||||
*/
|
|
||||||
setFid: function(fid) {
|
|
||||||
this.fid = fid;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set a geometry to the feature
|
|
||||||
*
|
|
||||||
* @param {OpenLayers.Geometry} geometry to set
|
|
||||||
* @param {Boolean} recurse Recursively set feature (for components)
|
|
||||||
*/
|
|
||||||
setGeometry: function(geometry, recurse) {
|
|
||||||
if(geometry) {
|
|
||||||
this.geometry = geometry;
|
|
||||||
this.geometry.feature = this;
|
|
||||||
if (recurse != false) {
|
|
||||||
this._setGeometryFeatureReference(this.geometry, this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets recursively the reference to the feature in the geometry
|
|
||||||
*
|
|
||||||
* @param {OpenLayers.Geometry}
|
|
||||||
* @param {OpenLayers.Feature}
|
|
||||||
*/
|
|
||||||
_setGeometryFeatureReference: function(geometry, feature) {
|
|
||||||
geometry.feature = feature;
|
|
||||||
if (geometry.components) {
|
|
||||||
for (var i = 0; i < geometry.components.length; i++) {
|
|
||||||
this._setGeometryFeatureReference(geometry.components[i], feature);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds attributes an attributes object to the feature.
|
|
||||||
* (should not be in geometry but in feature class)
|
|
||||||
*
|
|
||||||
* @param {Attributes} attributes
|
|
||||||
*/
|
|
||||||
setAttributes: function(attributes) {
|
|
||||||
this.attributes=attributes;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {OpenLayers.LonLat} lonlat
|
* @param {OpenLayers.LonLat} lonlat
|
||||||
* @param {float} toleranceLon Optional tolerance in Geometric Coords
|
* @param {float} toleranceLon Optional tolerance in Geometric Coords
|
||||||
@@ -277,7 +228,8 @@ OpenLayers.Feature.Vector.style = {
|
|||||||
pointRadius: 6,
|
pointRadius: 6,
|
||||||
hoverPointRadius: 1,
|
hoverPointRadius: 1,
|
||||||
hoverPointUnit: "%",
|
hoverPointUnit: "%",
|
||||||
pointerEvents: "visiblePainted"
|
pointerEvents: "visiblePainted",
|
||||||
|
cursor: "pointer"
|
||||||
},
|
},
|
||||||
'temporary': {
|
'temporary': {
|
||||||
fillColor: "yellow",
|
fillColor: "yellow",
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ OpenLayers.Format.GML.prototype =
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
feature.setGeometry(geom, false);
|
feature.geometry = geom;
|
||||||
if (this.extractAttributes) {
|
if (this.extractAttributes) {
|
||||||
feature.attributes = this.parseAttributes(xmlNode);
|
feature.attributes = this.parseAttributes(xmlNode);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ OpenLayers.Format.KML.prototype =
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
feature.setGeometry(geom);
|
feature.geometry = geom;
|
||||||
feature.attributes = this.parseAttributes(xmlNode);
|
feature.attributes = this.parseAttributes(xmlNode);
|
||||||
|
|
||||||
return feature;
|
return feature;
|
||||||
|
|||||||
@@ -19,14 +19,6 @@ OpenLayers.Geometry.prototype = {
|
|||||||
|
|
||||||
/** @type OpenLayers.Bounds */
|
/** @type OpenLayers.Bounds */
|
||||||
bounds: null,
|
bounds: null,
|
||||||
|
|
||||||
/**
|
|
||||||
* Cross reference back to the feature that owns this geometry so
|
|
||||||
* that that the feature can be identified after the geometry has been
|
|
||||||
* selected by a mouse click.
|
|
||||||
*
|
|
||||||
* @type OpenLayers.Feature */
|
|
||||||
feature: null,
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
@@ -42,7 +34,6 @@ OpenLayers.Geometry.prototype = {
|
|||||||
this.id = null;
|
this.id = null;
|
||||||
|
|
||||||
this.bounds = null;
|
this.bounds = null;
|
||||||
this.feature = null;
|
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -70,14 +70,6 @@ OpenLayers.Geometry.Collection.prototype =
|
|||||||
return geometry;
|
return geometry;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
|
||||||
* @returns the components of the geometry
|
|
||||||
* @type Array(OpenLayers.Geometry)
|
|
||||||
*/
|
|
||||||
getComponents: function(){
|
|
||||||
return this.components;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns the components of the geometry
|
* @returns the components of the geometry
|
||||||
* @type String
|
* @type String
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ OpenLayers.Handler.Box.prototype = OpenLayers.Class.inherit( OpenLayers.Handler,
|
|||||||
this.removeBox();
|
this.removeBox();
|
||||||
|
|
||||||
// TBD: use CSS classes instead
|
// TBD: use CSS classes instead
|
||||||
this.map.div.style.cursor = "default";
|
this.map.div.style.cursor = "";
|
||||||
|
|
||||||
this.callback("done", [result]);
|
this.callback("done", [result]);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -76,11 +76,9 @@ OpenLayers.Handler.Drag.prototype = OpenLayers.Class.inherit( OpenLayers.Handler
|
|||||||
if (this.started) {
|
if (this.started) {
|
||||||
this.dragging = true;
|
this.dragging = true;
|
||||||
this.callback("move", [evt.xy]);
|
this.callback("move", [evt.xy]);
|
||||||
if(document.onselectstart) {
|
if(!this.oldOnselectstart) {
|
||||||
if(!this.oldOnselectstart) {
|
this.oldOnselectstart = document.onselectstart;
|
||||||
this.oldOnselectstart = document.onselectstart;
|
document.onselectstart = function() {return false;}
|
||||||
document.onselectstart = function() {return false;}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -95,13 +93,10 @@ OpenLayers.Handler.Drag.prototype = OpenLayers.Class.inherit( OpenLayers.Handler
|
|||||||
mouseup: function (evt) {
|
mouseup: function (evt) {
|
||||||
if (this.started) {
|
if (this.started) {
|
||||||
this.started = false;
|
this.started = false;
|
||||||
this.dragging = false;
|
|
||||||
// TBD replace with CSS classes
|
// TBD replace with CSS classes
|
||||||
this.map.div.style.cursor = "default";
|
this.map.div.style.cursor = "";
|
||||||
this.callback("up", [evt.xy]);
|
this.callback("up", [evt.xy]);
|
||||||
if(document.onselectstart) {
|
document.onselectstart = this.oldOnselectstart;
|
||||||
document.onselectstart = this.oldOnselectstart;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
@@ -117,7 +112,7 @@ OpenLayers.Handler.Drag.prototype = OpenLayers.Class.inherit( OpenLayers.Handler
|
|||||||
this.started = false;
|
this.started = false;
|
||||||
this.dragging = false;
|
this.dragging = false;
|
||||||
// TBD replace with CSS classes
|
// TBD replace with CSS classes
|
||||||
this.map.div.style.cursor = "default";
|
this.map.div.style.cursor = "";
|
||||||
this.callback("out", []);
|
this.callback("out", []);
|
||||||
if(document.onselectstart) {
|
if(document.onselectstart) {
|
||||||
document.onselectstart = this.oldOnselectstart;
|
document.onselectstart = this.oldOnselectstart;
|
||||||
@@ -136,8 +131,8 @@ OpenLayers.Handler.Drag.prototype = OpenLayers.Class.inherit( OpenLayers.Handler
|
|||||||
*/
|
*/
|
||||||
click: function (evt) {
|
click: function (evt) {
|
||||||
// throw away the first left click event that happens after a mouse up
|
// throw away the first left click event that happens after a mouse up
|
||||||
if (OpenLayers.Event.isLeftClick(evt) && this.dragging) {
|
if (this.dragging) {
|
||||||
this.dragging = true;
|
this.dragging = false;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
this.started = false;
|
this.started = false;
|
||||||
|
|||||||
@@ -21,9 +21,9 @@ OpenLayers.Handler.Feature.prototype =
|
|||||||
layerIndex: null,
|
layerIndex: null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {OpenLayers.Geometry}
|
* @type {OpenLayers.Feature.Vector}
|
||||||
*/
|
*/
|
||||||
geometry: null,
|
feature: null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
@@ -33,7 +33,7 @@ OpenLayers.Handler.Feature.prototype =
|
|||||||
* @param {Array} callbacks An object with a 'over' property whos value is
|
* @param {Array} callbacks An object with a 'over' property whos value is
|
||||||
* a function to be called when the mouse is over
|
* a function to be called when the mouse is over
|
||||||
* a feature. The callback should expect to recieve
|
* a feature. The callback should expect to recieve
|
||||||
* a single argument, the geometry.
|
* a single argument, the feature.
|
||||||
* @param {Object} options
|
* @param {Object} options
|
||||||
*/
|
*/
|
||||||
initialize: function(control, layer, callbacks, options) {
|
initialize: function(control, layer, callbacks, options) {
|
||||||
@@ -75,7 +75,7 @@ OpenLayers.Handler.Feature.prototype =
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Capture double-clicks. Let the event continue propagating if the
|
* Capture double-clicks. Let the event continue propagating if the
|
||||||
* double-click doesn't hit a geometry. Otherwise call the dblclick
|
* double-click doesn't hit a feature. Otherwise call the dblclick
|
||||||
* callback.
|
* callback.
|
||||||
*
|
*
|
||||||
* @param {Event} evt
|
* @param {Event} evt
|
||||||
@@ -92,26 +92,26 @@ OpenLayers.Handler.Feature.prototype =
|
|||||||
* @type {Boolean} A feature was selected
|
* @type {Boolean} A feature was selected
|
||||||
*/
|
*/
|
||||||
select: function(type, evt) {
|
select: function(type, evt) {
|
||||||
var geometry = this.layer.renderer.getGeometryFromEvent(evt);
|
var feature = this.layer.getFeatureFromEvent(evt);
|
||||||
if(geometry) {
|
if(feature) {
|
||||||
// three cases:
|
// three cases:
|
||||||
// over a new, out of the last and over a new, or still on the last
|
// over a new, out of the last and over a new, or still on the last
|
||||||
if(!this.geometry) {
|
if(!this.feature) {
|
||||||
// over a new geometry
|
// over a new feature
|
||||||
this.callback('over', [geometry]);
|
this.callback('over', [feature]);
|
||||||
} else if(this.geometry != geometry) {
|
} else if(this.feature != feature) {
|
||||||
// out of the last and over a new
|
// out of the last and over a new
|
||||||
this.callback('out', [this.geometry]);
|
this.callback('out', [this.feature]);
|
||||||
this.callback('over', [geometry]);
|
this.callback('over', [feature]);
|
||||||
}
|
}
|
||||||
this.geometry = geometry;
|
this.feature = feature;
|
||||||
this.callback(type, [geometry]);
|
this.callback(type, [feature]);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
if(this.geometry) {
|
if(this.feature) {
|
||||||
// out of the last
|
// out of the last
|
||||||
this.callback('out', [this.geometry]);
|
this.callback('out', [this.feature]);
|
||||||
this.geometry = null;
|
this.feature = null;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ OpenLayers.Handler.Path.prototype =
|
|||||||
OpenLayers.Class.inherit(OpenLayers.Handler.Point, {
|
OpenLayers.Class.inherit(OpenLayers.Handler.Point, {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type OpenLayers.Geometry.LineString
|
* @type OpenLayers.Feature.Vector
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
line: null,
|
line: null,
|
||||||
@@ -65,15 +65,17 @@ OpenLayers.Handler.Path.prototype =
|
|||||||
/**
|
/**
|
||||||
* Add temporary geometries
|
* Add temporary geometries
|
||||||
*/
|
*/
|
||||||
createGeometry: function() {
|
createFeature: function() {
|
||||||
this.line = new OpenLayers.Geometry.LineString();
|
this.line = new OpenLayers.Feature.Vector(
|
||||||
this.point = new OpenLayers.Geometry.Point();
|
new OpenLayers.Geometry.LineString());
|
||||||
|
this.point = new OpenLayers.Feature.Vector(
|
||||||
|
new OpenLayers.Geometry.Point());
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destroy temporary geometries
|
* Destroy temporary geometries
|
||||||
*/
|
*/
|
||||||
destroyGeometry: function() {
|
destroyFeature: function() {
|
||||||
this.line.destroy();
|
this.line.destroy();
|
||||||
this.point.destroy();
|
this.point.destroy();
|
||||||
},
|
},
|
||||||
@@ -83,7 +85,9 @@ OpenLayers.Handler.Path.prototype =
|
|||||||
* the behavior of LinearRing that disregards adding duplicate points.
|
* the behavior of LinearRing that disregards adding duplicate points.
|
||||||
*/
|
*/
|
||||||
addPoint: function() {
|
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
|
* Modify the existing geometry given the new point
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
modifyGeometry: function() {
|
modifyFeature: function() {
|
||||||
var index = this.line.components.length - 1;
|
var index = this.line.geometry.components.length - 1;
|
||||||
this.line.components[index].x = this.point.x;
|
this.line.geometry.components[index].x = this.point.geometry.x;
|
||||||
this.line.components[index].y = this.point.y;
|
this.line.geometry.components[index].y = this.point.geometry.y;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Render geometries on the temporary layer.
|
* Render geometries on the temporary layer.
|
||||||
*/
|
*/
|
||||||
drawGeometry: function() {
|
drawFeature: function() {
|
||||||
this.layer.renderer.drawGeometry(this.line, this.style);
|
this.layer.drawFeature(this.line, this.style);
|
||||||
this.layer.renderer.drawGeometry(this.point, this.style);
|
this.layer.drawFeature(this.point, this.style);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -120,7 +124,7 @@ OpenLayers.Handler.Path.prototype =
|
|||||||
* @type OpenLayers.Geometry.LineString
|
* @type OpenLayers.Geometry.LineString
|
||||||
*/
|
*/
|
||||||
geometryClone: function() {
|
geometryClone: function() {
|
||||||
return this.line.clone();
|
return this.line.geometry.clone();
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -136,17 +140,17 @@ OpenLayers.Handler.Path.prototype =
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if(this.lastDown == null) {
|
if(this.lastDown == null) {
|
||||||
this.createGeometry();
|
this.createFeature();
|
||||||
}
|
}
|
||||||
this.mouseDown = true;
|
this.mouseDown = true;
|
||||||
this.lastDown = evt.xy;
|
this.lastDown = evt.xy;
|
||||||
var lonlat = this.control.map.getLonLatFromPixel(evt.xy);
|
var lonlat = this.control.map.getLonLatFromPixel(evt.xy);
|
||||||
this.point.x = lonlat.lon;
|
this.point.geometry.x = lonlat.lon;
|
||||||
this.point.y = lonlat.lat;
|
this.point.geometry.y = lonlat.lat;
|
||||||
if((this.lastUp == null) || !this.lastUp.equals(evt.xy)) {
|
if((this.lastUp == null) || !this.lastUp.equals(evt.xy)) {
|
||||||
this.addPoint();
|
this.addPoint();
|
||||||
}
|
}
|
||||||
this.drawGeometry();
|
this.drawFeature();
|
||||||
this.drawing = true;
|
this.drawing = true;
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
@@ -161,14 +165,14 @@ OpenLayers.Handler.Path.prototype =
|
|||||||
mousemove: function (evt) {
|
mousemove: function (evt) {
|
||||||
if(this.drawing) {
|
if(this.drawing) {
|
||||||
var lonlat = this.map.getLonLatFromPixel(evt.xy);
|
var lonlat = this.map.getLonLatFromPixel(evt.xy);
|
||||||
this.point.x = lonlat.lon;
|
this.point.geometry.x = lonlat.lon;
|
||||||
this.point.y = lonlat.lat;
|
this.point.geometry.y = lonlat.lat;
|
||||||
if(this.mouseDown && this.freehandMode(evt)) {
|
if(this.mouseDown && this.freehandMode(evt)) {
|
||||||
this.addPoint();
|
this.addPoint();
|
||||||
} else {
|
} else {
|
||||||
this.modifyGeometry();
|
this.modifyFeature();
|
||||||
}
|
}
|
||||||
this.drawGeometry();
|
this.drawFeature();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
@@ -190,7 +194,6 @@ OpenLayers.Handler.Path.prototype =
|
|||||||
this.addPoint();
|
this.addPoint();
|
||||||
}
|
}
|
||||||
this.lastUp = evt.xy;
|
this.lastUp = evt.xy;
|
||||||
this.callback("point", [this.point]);
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -205,9 +208,9 @@ OpenLayers.Handler.Path.prototype =
|
|||||||
*/
|
*/
|
||||||
dblclick: function(evt) {
|
dblclick: function(evt) {
|
||||||
if(!this.freehandMode(evt)) {
|
if(!this.freehandMode(evt)) {
|
||||||
var index = this.line.components.length - 1;
|
var index = this.line.geometry.components.length - 1;
|
||||||
this.line.removeComponent(this.line.components[index]);
|
this.line.geometry.removeComponent(this.line.geometry.components[index]);
|
||||||
this.finalize(this.line);
|
this.finalize();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ OpenLayers.Handler.Point.prototype =
|
|||||||
OpenLayers.Class.inherit(OpenLayers.Handler, {
|
OpenLayers.Class.inherit(OpenLayers.Handler, {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type OpenLayers.Geometry.Point
|
* @type OpenLayers.Feature.Vector
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
point: null,
|
point: null,
|
||||||
@@ -87,10 +87,11 @@ OpenLayers.Handler.Point.prototype =
|
|||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add temporary geometries
|
* Add temporary features
|
||||||
*/
|
*/
|
||||||
createGeometry: function() {
|
createFeature: function() {
|
||||||
this.point = new OpenLayers.Geometry.Point();
|
this.point = new OpenLayers.Feature.Vector(
|
||||||
|
new OpenLayers.Geometry.Point());
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -112,7 +113,7 @@ OpenLayers.Handler.Point.prototype =
|
|||||||
/**
|
/**
|
||||||
* Destroy the temporary geometries
|
* Destroy the temporary geometries
|
||||||
*/
|
*/
|
||||||
destroyGeometry: function() {
|
destroyFeature: function() {
|
||||||
this.point.destroy();
|
this.point.destroy();
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -122,7 +123,7 @@ OpenLayers.Handler.Point.prototype =
|
|||||||
finalize: function() {
|
finalize: function() {
|
||||||
this.layer.renderer.clear();
|
this.layer.renderer.clear();
|
||||||
this.callback("done", [this.geometryClone()]);
|
this.callback("done", [this.geometryClone()]);
|
||||||
this.destroyGeometry();
|
this.destroyFeature();
|
||||||
this.drawing = false;
|
this.drawing = false;
|
||||||
this.mouseDown = false;
|
this.mouseDown = false;
|
||||||
this.lastDown = null;
|
this.lastDown = null;
|
||||||
@@ -135,7 +136,7 @@ OpenLayers.Handler.Point.prototype =
|
|||||||
cancel: function() {
|
cancel: function() {
|
||||||
this.layer.renderer.clear();
|
this.layer.renderer.clear();
|
||||||
this.callback("cancel", [this.geometryClone()]);
|
this.callback("cancel", [this.geometryClone()]);
|
||||||
this.destroyGeometry();
|
this.destroyFeature();
|
||||||
this.drawing = false;
|
this.drawing = false;
|
||||||
this.mouseDown = false;
|
this.mouseDown = false;
|
||||||
this.lastDown = null;
|
this.lastDown = null;
|
||||||
@@ -151,10 +152,10 @@ OpenLayers.Handler.Point.prototype =
|
|||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Render geometries on the temporary layer.
|
* Render features on the temporary layer.
|
||||||
*/
|
*/
|
||||||
drawGeometry: function() {
|
drawFeature: function() {
|
||||||
this.layer.renderer.drawGeometry(this.point, this.style);
|
this.layer.drawFeature(this.point, this.style);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -163,7 +164,7 @@ OpenLayers.Handler.Point.prototype =
|
|||||||
* @type OpenLayers.Geometry.Point
|
* @type OpenLayers.Geometry.Point
|
||||||
*/
|
*/
|
||||||
geometryClone: function() {
|
geometryClone: function() {
|
||||||
return this.point.clone();
|
return this.point.geometry.clone();
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -183,14 +184,14 @@ OpenLayers.Handler.Point.prototype =
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if(this.lastDown == null) {
|
if(this.lastDown == null) {
|
||||||
this.createGeometry();
|
this.createFeature();
|
||||||
}
|
}
|
||||||
this.lastDown = evt.xy;
|
this.lastDown = evt.xy;
|
||||||
this.drawing = true;
|
this.drawing = true;
|
||||||
var lonlat = this.map.getLonLatFromPixel(evt.xy);
|
var lonlat = this.map.getLonLatFromPixel(evt.xy);
|
||||||
this.point.x = lonlat.lon;
|
this.point.geometry.x = lonlat.lon;
|
||||||
this.point.y = lonlat.lat;
|
this.point.geometry.y = lonlat.lat;
|
||||||
this.drawGeometry();
|
this.drawFeature();
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -204,9 +205,9 @@ OpenLayers.Handler.Point.prototype =
|
|||||||
mousemove: function (evt) {
|
mousemove: function (evt) {
|
||||||
if(this.drawing) {
|
if(this.drawing) {
|
||||||
var lonlat = this.map.getLonLatFromPixel(evt.xy);
|
var lonlat = this.map.getLonLatFromPixel(evt.xy);
|
||||||
this.point.x = lonlat.lon;
|
this.point.geometry.x = lonlat.lon;
|
||||||
this.point.y = lonlat.lat;
|
this.point.geometry.y = lonlat.lat;
|
||||||
this.drawGeometry();
|
this.drawFeature();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
@@ -220,7 +221,7 @@ OpenLayers.Handler.Point.prototype =
|
|||||||
*/
|
*/
|
||||||
mouseup: function (evt) {
|
mouseup: function (evt) {
|
||||||
if(this.drawing) {
|
if(this.drawing) {
|
||||||
this.finalize(this.point);
|
this.finalize();
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ OpenLayers.Handler.Polygon.prototype =
|
|||||||
OpenLayers.Class.inherit(OpenLayers.Handler.Path, {
|
OpenLayers.Class.inherit(OpenLayers.Handler.Path, {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type OpenLayers.Geometry.Polygon
|
* @type OpenLayers.Feature.Vector
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
polygon: null,
|
polygon: null,
|
||||||
@@ -44,17 +44,20 @@ OpenLayers.Handler.Polygon.prototype =
|
|||||||
/**
|
/**
|
||||||
* Add temporary geometries
|
* Add temporary geometries
|
||||||
*/
|
*/
|
||||||
createGeometry: function() {
|
createFeature: function() {
|
||||||
this.polygon = new OpenLayers.Geometry.Polygon();
|
this.polygon = new OpenLayers.Feature.Vector(
|
||||||
this.line = new OpenLayers.Geometry.LinearRing();
|
new OpenLayers.Geometry.Polygon());
|
||||||
this.polygon.addComponent(this.line);
|
this.line = new OpenLayers.Feature.Vector(
|
||||||
this.point = new OpenLayers.Geometry.Point();
|
new OpenLayers.Geometry.LinearRing());
|
||||||
|
this.polygon.geometry.addComponent(this.line.geometry);
|
||||||
|
this.point = new OpenLayers.Feature.Vector(
|
||||||
|
new OpenLayers.Geometry.Point());
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destroy temporary geometries
|
* Destroy temporary geometries
|
||||||
*/
|
*/
|
||||||
destroyGeometry: function() {
|
destroyFeature: function() {
|
||||||
this.polygon.destroy();
|
this.polygon.destroy();
|
||||||
this.point.destroy();
|
this.point.destroy();
|
||||||
},
|
},
|
||||||
@@ -63,18 +66,18 @@ OpenLayers.Handler.Polygon.prototype =
|
|||||||
* Modify the existing geometry given the new point
|
* Modify the existing geometry given the new point
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
modifyGeometry: function() {
|
modifyFeature: function() {
|
||||||
var index = this.line.components.length - 2;
|
var index = this.line.geometry.components.length - 2;
|
||||||
this.line.components[index].x = this.point.x;
|
this.line.geometry.components[index].x = this.point.geometry.x;
|
||||||
this.line.components[index].y = this.point.y;
|
this.line.geometry.components[index].y = this.point.geometry.y;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Render geometries on the temporary layer.
|
* Render geometries on the temporary layer.
|
||||||
*/
|
*/
|
||||||
drawGeometry: function() {
|
drawFeature: function() {
|
||||||
this.layer.renderer.drawGeometry(this.polygon, this.style);
|
this.layer.drawFeature(this.polygon, this.style);
|
||||||
this.layer.renderer.drawGeometry(this.point, this.style);
|
this.layer.drawFeature(this.point, this.style);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -83,7 +86,7 @@ OpenLayers.Handler.Polygon.prototype =
|
|||||||
* @type OpenLayers.Geometry.Polygon
|
* @type OpenLayers.Geometry.Polygon
|
||||||
*/
|
*/
|
||||||
geometryClone: function() {
|
geometryClone: function() {
|
||||||
return this.polygon.clone();
|
return this.polygon.geometry.clone();
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -95,9 +98,9 @@ OpenLayers.Handler.Polygon.prototype =
|
|||||||
dblclick: function(evt) {
|
dblclick: function(evt) {
|
||||||
if(!this.freehandMode(evt)) {
|
if(!this.freehandMode(evt)) {
|
||||||
// remove the penultimate point
|
// remove the penultimate point
|
||||||
var index = this.line.components.length - 2;
|
var index = this.line.geometry.components.length - 2;
|
||||||
this.line.removeComponent(this.line.components[index]);
|
this.line.geometry.removeComponent(this.line.geometry.components[index]);
|
||||||
this.finalize(this.line);
|
this.finalize();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -148,24 +148,23 @@ OpenLayers.Layer.prototype = {
|
|||||||
* @param {Object} options Hashtable of extra options to tag onto the layer
|
* @param {Object} options Hashtable of extra options to tag onto the layer
|
||||||
*/
|
*/
|
||||||
initialize: function(name, options) {
|
initialize: function(name, options) {
|
||||||
//store a copy of the custom options for later cloning
|
|
||||||
this.options = OpenLayers.Util.extend(new Object(), options);
|
this.addOptions(options);
|
||||||
|
|
||||||
//add options to layer
|
|
||||||
OpenLayers.Util.extend(this, this.options);
|
|
||||||
|
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
|
||||||
this.id = OpenLayers.Util.createUniqueID(this.CLASS_NAME + "_");
|
if (this.id == null) {
|
||||||
|
|
||||||
if (this.div == null) {
|
this.id = OpenLayers.Util.createUniqueID(this.CLASS_NAME + "_");
|
||||||
|
|
||||||
this.div = OpenLayers.Util.createDiv();
|
this.div = OpenLayers.Util.createDiv();
|
||||||
this.div.style.width = "100%";
|
this.div.style.width = "100%";
|
||||||
this.div.style.height = "100%";
|
this.div.style.height = "100%";
|
||||||
this.div.id = this.id;
|
this.div.id = this.id;
|
||||||
}
|
|
||||||
|
|
||||||
this.events = new OpenLayers.Events(this, this.div, this.EVENT_TYPES);
|
this.events = new OpenLayers.Events(this, this.div,
|
||||||
|
this.EVENT_TYPES);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -187,8 +186,10 @@ OpenLayers.Layer.prototype = {
|
|||||||
this.name = null;
|
this.name = null;
|
||||||
this.div = null;
|
this.div = null;
|
||||||
this.options = null;
|
this.options = null;
|
||||||
|
|
||||||
this.events.destroy();
|
if (this.events) {
|
||||||
|
this.events.destroy();
|
||||||
|
}
|
||||||
this.events = null;
|
this.events = null;
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -216,9 +217,12 @@ OpenLayers.Layer.prototype = {
|
|||||||
* @param {String} newName
|
* @param {String} newName
|
||||||
*/
|
*/
|
||||||
setName: function(newName) {
|
setName: function(newName) {
|
||||||
this.name = newName;
|
if (newName != this.name) {
|
||||||
if (this.map != null)
|
this.name = newName;
|
||||||
this.map.events.triggerEvent("changelayer");
|
if (this.map != null) {
|
||||||
|
this.map.events.triggerEvent("changelayer");
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -226,6 +230,10 @@ OpenLayers.Layer.prototype = {
|
|||||||
*/
|
*/
|
||||||
addOptions: function (newOptions) {
|
addOptions: function (newOptions) {
|
||||||
|
|
||||||
|
if (this.options == null) {
|
||||||
|
this.options = new Object();
|
||||||
|
}
|
||||||
|
|
||||||
// update our copy for clone
|
// update our copy for clone
|
||||||
OpenLayers.Util.extend(this.options, newOptions);
|
OpenLayers.Util.extend(this.options, newOptions);
|
||||||
|
|
||||||
@@ -264,22 +272,25 @@ OpenLayers.Layer.prototype = {
|
|||||||
* @param {OpenLayers.Map} map
|
* @param {OpenLayers.Map} map
|
||||||
*/
|
*/
|
||||||
setMap: function(map) {
|
setMap: function(map) {
|
||||||
this.map = map;
|
if (this.map == null) {
|
||||||
|
|
||||||
// grab some essential layer data from the map if it hasn't already
|
this.map = map;
|
||||||
// been set
|
|
||||||
this.maxExtent = this.maxExtent || this.map.maxExtent;
|
// grab some essential layer data from the map if it hasn't already
|
||||||
this.projection = this.projection || this.map.projection;
|
// been set
|
||||||
this.units = this.units || this.map.units;
|
this.maxExtent = this.maxExtent || this.map.maxExtent;
|
||||||
|
this.projection = this.projection || this.map.projection;
|
||||||
this.initResolutions();
|
this.units = this.units || this.map.units;
|
||||||
|
|
||||||
if (!this.isBaseLayer) {
|
this.initResolutions();
|
||||||
this.inRange = this.calculateInRange();
|
|
||||||
|
if (!this.isBaseLayer) {
|
||||||
|
this.inRange = this.calculateInRange();
|
||||||
|
}
|
||||||
|
|
||||||
|
// deal with gutters
|
||||||
|
this.setTileSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
// deal with gutters
|
|
||||||
this.setTileSize();
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -336,7 +347,7 @@ OpenLayers.Layer.prototype = {
|
|||||||
if (visibility != this.visibility) {
|
if (visibility != this.visibility) {
|
||||||
this.visibility = visibility;
|
this.visibility = visibility;
|
||||||
this.display(visibility);
|
this.display(visibility);
|
||||||
if (this.map != null) {
|
if (visibility && this.map != null) {
|
||||||
var extent = this.map.getExtent();
|
var extent = this.map.getExtent();
|
||||||
if (extent != null) {
|
if (extent != null) {
|
||||||
this.moveTo(extent, true);
|
this.moveTo(extent, true);
|
||||||
@@ -378,9 +389,11 @@ OpenLayers.Layer.prototype = {
|
|||||||
* @param {Boolean} isBaseLayer
|
* @param {Boolean} isBaseLayer
|
||||||
*/
|
*/
|
||||||
setIsBaseLayer: function(isBaseLayer) {
|
setIsBaseLayer: function(isBaseLayer) {
|
||||||
this.isBaseLayer = isBaseLayer;
|
if (isBaseLayer != this.isBaseLayer) {
|
||||||
if (this.map != null) {
|
this.isBaseLayer = isBaseLayer;
|
||||||
this.map.events.triggerEvent("changelayer");
|
if (this.map != null) {
|
||||||
|
this.map.events.triggerEvent("changelayer");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -646,11 +659,13 @@ OpenLayers.Layer.prototype = {
|
|||||||
* @param {Float} opacity
|
* @param {Float} opacity
|
||||||
*/
|
*/
|
||||||
setOpacity: function(opacity) {
|
setOpacity: function(opacity) {
|
||||||
this.opacity = opacity;
|
if (opacity != this.opacity) {
|
||||||
for(var i=0; i<this.div.childNodes.length; ++i) {
|
this.opacity = opacity;
|
||||||
var element = this.div.childNodes[i].firstChild;
|
for(var i=0; i<this.div.childNodes.length; ++i) {
|
||||||
OpenLayers.Util.modifyDOMElement(element, null, null, null,
|
var element = this.div.childNodes[i].firstChild;
|
||||||
null, null, null, opacity);
|
OpenLayers.Util.modifyDOMElement(element, null, null, null,
|
||||||
|
null, null, null, opacity);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -15,8 +15,11 @@ OpenLayers.Layer.Boxes.prototype =
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
|
*
|
||||||
|
* @param {String} name
|
||||||
|
* @param {Object} options Hashtable of extra options to tag onto the layer
|
||||||
*/
|
*/
|
||||||
initialize: function () {
|
initialize: function (name, options) {
|
||||||
OpenLayers.Layer.Markers.prototype.initialize.apply(this, arguments);
|
OpenLayers.Layer.Markers.prototype.initialize.apply(this, arguments);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -15,8 +15,7 @@ OpenLayers.Layer.HTTPRequest.prototype =
|
|||||||
/** Used to hash URL param strings for multi-WMS server selection.
|
/** Used to hash URL param strings for multi-WMS server selection.
|
||||||
* Set to the Golden Ratio per Knuth's recommendation.
|
* Set to the Golden Ratio per Knuth's recommendation.
|
||||||
*
|
*
|
||||||
* @type Numeric
|
* @final @type Numeric
|
||||||
* @private
|
|
||||||
*/
|
*/
|
||||||
URL_HASH_FACTOR: (Math.sqrt(5) - 1) / 2,
|
URL_HASH_FACTOR: (Math.sqrt(5) - 1) / 2,
|
||||||
|
|
||||||
|
|||||||
@@ -24,17 +24,23 @@ OpenLayers.Layer.Image.prototype =
|
|||||||
/** @type String */
|
/** @type String */
|
||||||
url: null,
|
url: null,
|
||||||
|
|
||||||
/** @type OpenLayers.Bounds */
|
/**
|
||||||
|
* The image bounds in map units
|
||||||
|
* @type OpenLayers.Bounds
|
||||||
|
*/
|
||||||
extent: null,
|
extent: null,
|
||||||
|
|
||||||
/** @type OpenLayers.Size */
|
/**
|
||||||
|
* The image size in pixels
|
||||||
|
* @type OpenLayers.Size
|
||||||
|
*/
|
||||||
size: null,
|
size: null,
|
||||||
|
|
||||||
/** @type OpenLayers.Tile.Image */
|
/** @type OpenLayers.Tile.Image */
|
||||||
tile: null,
|
tile: null,
|
||||||
|
|
||||||
/** The ratio of height/width represented by a single pixel in the graphic
|
/**
|
||||||
*
|
* The ratio of height/width represented by a single pixel in the graphic
|
||||||
* @type Float */
|
* @type Float */
|
||||||
aspectRatio: null,
|
aspectRatio: null,
|
||||||
|
|
||||||
@@ -94,10 +100,16 @@ OpenLayers.Layer.Image.prototype =
|
|||||||
* @param {OpenLayers.Map} map
|
* @param {OpenLayers.Map} map
|
||||||
*/
|
*/
|
||||||
setMap: function(map) {
|
setMap: function(map) {
|
||||||
// If nothing to do with resolutions has been set, assume a single
|
/**
|
||||||
// resolution determined by extent/size
|
* If nothing to do with resolutions has been set, assume a single
|
||||||
|
* resolution determined by ratio*extent/size - if an image has a
|
||||||
|
* pixel aspect ratio different than one (as calculated above), the
|
||||||
|
* image will be stretched in one dimension only.
|
||||||
|
*/
|
||||||
if( this.options.maxResolution == null ) {
|
if( this.options.maxResolution == null ) {
|
||||||
this.options.maxResolution = this.extent.getWidth() / this.size.w;
|
this.options.maxResolution = this.aspectRatio *
|
||||||
|
this.extent.getWidth() /
|
||||||
|
this.size.w;
|
||||||
}
|
}
|
||||||
OpenLayers.Layer.prototype.setMap.apply(this, arguments);
|
OpenLayers.Layer.prototype.setMap.apply(this, arguments);
|
||||||
},
|
},
|
||||||
@@ -116,11 +128,8 @@ OpenLayers.Layer.Image.prototype =
|
|||||||
if(zoomChanged || firstRendering) {
|
if(zoomChanged || firstRendering) {
|
||||||
|
|
||||||
//determine new tile size
|
//determine new tile size
|
||||||
var tileWidth = this.extent.getWidth() / this.map.getResolution();
|
this.setTileSize();
|
||||||
var tileHeight = this.extent.getHeight() /
|
|
||||||
(this.map.getResolution() * this.aspectRatio);
|
|
||||||
var tileSize = new OpenLayers.Size(tileWidth, tileHeight);
|
|
||||||
|
|
||||||
//determine new position (upper left corner of new bounds)
|
//determine new position (upper left corner of new bounds)
|
||||||
var ul = new OpenLayers.LonLat(this.extent.left, this.extent.top);
|
var ul = new OpenLayers.LonLat(this.extent.left, this.extent.top);
|
||||||
var ulPx = this.map.getLayerPxFromLonLat(ul);
|
var ulPx = this.map.getLayerPxFromLonLat(ul);
|
||||||
@@ -128,16 +137,28 @@ OpenLayers.Layer.Image.prototype =
|
|||||||
if(firstRendering) {
|
if(firstRendering) {
|
||||||
//create the new tile
|
//create the new tile
|
||||||
this.tile = new OpenLayers.Tile.Image(this, ulPx, this.extent,
|
this.tile = new OpenLayers.Tile.Image(this, ulPx, this.extent,
|
||||||
this.url, tileSize);
|
this.url, this.tileSize);
|
||||||
} else {
|
} else {
|
||||||
//just resize the tile and set it's new position
|
//just resize the tile and set it's new position
|
||||||
this.tile.size = tileSize.clone();
|
this.tile.size = this.tileSize.clone();
|
||||||
this.tile.position = ulPx.clone();
|
this.tile.position = ulPx.clone();
|
||||||
}
|
}
|
||||||
this.tile.draw();
|
this.tile.draw();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the tile size based on the map size. This also sets layer.imageSize
|
||||||
|
* and layer.imageOffset for use by Tile.Image.
|
||||||
|
*/
|
||||||
|
setTileSize: function() {
|
||||||
|
var tileWidth = this.extent.getWidth() / this.map.getResolution();
|
||||||
|
var tileHeight = this.extent.getHeight() / this.map.getResolution();
|
||||||
|
this.tileSize = new OpenLayers.Size(tileWidth, tileHeight);
|
||||||
|
this.imageSize = this.tileSize;
|
||||||
|
this.imageOffset = new OpenLayers.Pixel(0, 0);
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {String} newUrl
|
* @param {String} newUrl
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -145,6 +145,36 @@ OpenLayers.Layer.KaMap.prototype =
|
|||||||
this.spiralTileLoad();
|
this.spiralTileLoad();
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {Object} obj
|
||||||
|
*
|
||||||
|
* @returns An exact clone of this OpenLayers.Layer.Grid
|
||||||
|
* @type OpenLayers.Layer.Grid
|
||||||
|
*/
|
||||||
|
clone: function (obj) {
|
||||||
|
|
||||||
|
if (obj == null) {
|
||||||
|
obj = new OpenLayers.Layer.KaMap(this.name,
|
||||||
|
this.url,
|
||||||
|
this.params,
|
||||||
|
this.options);
|
||||||
|
}
|
||||||
|
|
||||||
|
//get all additions from superclasses
|
||||||
|
obj = OpenLayers.Layer.Grid.prototype.clone.apply(this, [obj]);
|
||||||
|
|
||||||
|
// copy/set any non-init, non-simple values here
|
||||||
|
if (this.tileSize != null) {
|
||||||
|
obj.tileSize = this.tileSize.clone();
|
||||||
|
}
|
||||||
|
|
||||||
|
// we do not want to copy reference to grid, so we make a new array
|
||||||
|
obj.grid = new Array();
|
||||||
|
|
||||||
|
return obj;
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
/** @final @type String */
|
/** @final @type String */
|
||||||
CLASS_NAME: "OpenLayers.Layer.KaMap"
|
CLASS_NAME: "OpenLayers.Layer.KaMap"
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
*
|
*
|
||||||
* @requires OpenLayers/Layer.js
|
* @requires OpenLayers/Layer.js
|
||||||
* @requires OpenLayers/Renderer.js
|
* @requires OpenLayers/Renderer.js
|
||||||
|
* @requires OpenLayers/Feature/Vector.js
|
||||||
*/
|
*/
|
||||||
OpenLayers.Layer.Vector = OpenLayers.Class.create();
|
OpenLayers.Layer.Vector = OpenLayers.Class.create();
|
||||||
OpenLayers.Layer.Vector.prototype =
|
OpenLayers.Layer.Vector.prototype =
|
||||||
@@ -21,17 +22,11 @@ OpenLayers.Layer.Vector.prototype =
|
|||||||
/** @type Boolean */
|
/** @type Boolean */
|
||||||
isVector: true,
|
isVector: true,
|
||||||
|
|
||||||
/** @type {Array(OpenLayer.Feature.Vector)} */
|
/** @type Array(OpenLayer.Feature.Vector) */
|
||||||
features: null,
|
features: null,
|
||||||
|
|
||||||
/** @type {Array(OpenLayers.Feature.Vector)} */
|
/** @type Array(OpenLayers.Feature.Vector) */
|
||||||
selectedFeatures: [],
|
selectedFeatures: null,
|
||||||
|
|
||||||
/** @type {Boolean} */
|
|
||||||
editing: false,
|
|
||||||
|
|
||||||
/** @type {Boolean} */
|
|
||||||
editable: false,
|
|
||||||
|
|
||||||
/** @type {Boolean} */
|
/** @type {Boolean} */
|
||||||
reportError: true,
|
reportError: true,
|
||||||
@@ -75,6 +70,10 @@ OpenLayers.Layer.Vector.prototype =
|
|||||||
* Options renderer {Object}: Typically SVGRenderer or VMLRenderer.
|
* Options renderer {Object}: Typically SVGRenderer or VMLRenderer.
|
||||||
*/
|
*/
|
||||||
initialize: function(name, options) {
|
initialize: function(name, options) {
|
||||||
|
|
||||||
|
var defaultStyle = OpenLayers.Feature.Vector.style['default'];
|
||||||
|
this.style = OpenLayers.Util.extend({}, defaultStyle);
|
||||||
|
|
||||||
OpenLayers.Layer.prototype.initialize.apply(this, arguments);
|
OpenLayers.Layer.prototype.initialize.apply(this, arguments);
|
||||||
|
|
||||||
// allow user-set renderer, otherwise assign one
|
// allow user-set renderer, otherwise assign one
|
||||||
@@ -102,8 +101,6 @@ OpenLayers.Layer.Vector.prototype =
|
|||||||
// calling feature[i].destroy() here.
|
// calling feature[i].destroy() here.
|
||||||
this.features = null;
|
this.features = null;
|
||||||
this.selectedFeatures = null;
|
this.selectedFeatures = null;
|
||||||
this.editing = null;
|
|
||||||
this.editable = null;
|
|
||||||
if (this.renderer) {
|
if (this.renderer) {
|
||||||
this.renderer.destroy();
|
this.renderer.destroy();
|
||||||
}
|
}
|
||||||
@@ -172,7 +169,7 @@ OpenLayers.Layer.Vector.prototype =
|
|||||||
/** Reset the vector layer's div so that it once again is lined up with
|
/** Reset the vector layer's div so that it once again is lined up with
|
||||||
* the map. Notify the renderer of the change of extent, and in the
|
* the map. Notify the renderer of the change of extent, and in the
|
||||||
* case of a change of zoom level (resolution), have the
|
* case of a change of zoom level (resolution), have the
|
||||||
* renderer reproject.
|
* renderer redraw features.
|
||||||
*
|
*
|
||||||
* If the layer has not yet been drawn, cycle through the layer's
|
* If the layer has not yet been drawn, cycle through the layer's
|
||||||
* features and draw each one.
|
* features and draw each one.
|
||||||
@@ -191,15 +188,11 @@ OpenLayers.Layer.Vector.prototype =
|
|||||||
this.renderer.setExtent(extent);
|
this.renderer.setExtent(extent);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (zoomChanged) {
|
if (!this.drawn || zoomChanged) {
|
||||||
this.renderer.reproject();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!this.drawn) {
|
|
||||||
this.drawn = true;
|
this.drawn = true;
|
||||||
for(var i = 0; i < this.features.length; i++) {
|
for(var i = 0; i < this.features.length; i++) {
|
||||||
var feature = this.features[i];
|
var feature = this.features[i];
|
||||||
this.renderer.drawGeometry(feature.geometry, feature.style);
|
this.drawFeature(feature);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -228,17 +221,13 @@ OpenLayers.Layer.Vector.prototype =
|
|||||||
feature.layer = this;
|
feature.layer = this;
|
||||||
|
|
||||||
if (!feature.style) {
|
if (!feature.style) {
|
||||||
if (this.style) {
|
feature.style = OpenLayers.Util.extend({}, this.style);
|
||||||
feature.style = OpenLayers.Util.extend({}, this.style);
|
|
||||||
} else {
|
|
||||||
feature.style = OpenLayers.Util.extend({}, OpenLayers.Feature.Vector.style['default']);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.preFeatureInsert(feature);
|
this.preFeatureInsert(feature);
|
||||||
|
|
||||||
if (this.drawn) {
|
if (this.drawn) {
|
||||||
this.renderer.drawGeometry(feature.geometry, feature.style);
|
this.drawFeature(feature);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.onFeatureInsert(feature);
|
this.onFeatureInsert(feature);
|
||||||
@@ -254,7 +243,7 @@ OpenLayers.Layer.Vector.prototype =
|
|||||||
features = [features];
|
features = [features];
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var i = 0; i < features.length; i++) {
|
for (var i = features.length - 1; i >= 0; i--) {
|
||||||
var feature = features[i];
|
var feature = features[i];
|
||||||
this.features = OpenLayers.Util.removeItem(this.features, feature);
|
this.features = OpenLayers.Util.removeItem(this.features, feature);
|
||||||
|
|
||||||
@@ -263,53 +252,76 @@ OpenLayers.Layer.Vector.prototype =
|
|||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Destroy all features on the layer and empty the selected features array.
|
||||||
*/
|
*/
|
||||||
destroyFeatures: function () {
|
destroyFeatures: function () {
|
||||||
|
this.selectedFeatures = new Array();
|
||||||
for (var i = this.features.length - 1; i >= 0; i--) {
|
for (var i = this.features.length - 1; i >= 0; i--) {
|
||||||
this.features[i].destroy();
|
this.features[i].destroy();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {String} fid
|
* Draw (or redraw) a feature on the layer. If the optional style argument
|
||||||
|
* is included, this style will be used. If no style is included, the
|
||||||
|
* feature's style will be used. If the feature doesn't have a style,
|
||||||
|
* the layer's style will be used.
|
||||||
|
*
|
||||||
|
* @param {OpenLayers.Feature.Vector} feature
|
||||||
* @param {Object} style
|
* @param {Object} style
|
||||||
*/
|
*/
|
||||||
redrawFeature: function(fid, style) {
|
drawFeature: function(feature, style) {
|
||||||
for (var i = 0; i < this.features.length; i++) {
|
if(style == null) {
|
||||||
var feature = this.features[i];
|
if(feature.style) {
|
||||||
if (feature.fid == fid) {
|
style = feature.style;
|
||||||
this.renderer.drawGeometry(feature.geometry, style);
|
} else {
|
||||||
|
style = this.style;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
this.renderer.drawFeature(feature, style);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start editing the layer
|
* Erase features from the layer.
|
||||||
*
|
*
|
||||||
* @returns Whether or not the layer is editable
|
* @param {Array(OpenLayers.Feature.Vector)} features
|
||||||
* @type Boolean
|
|
||||||
*/
|
*/
|
||||||
unlock: function() {
|
eraseFeatures: function(features) {
|
||||||
if(this.editable) {
|
this.renderer.eraseFeatures(features);
|
||||||
this.editing = true;
|
|
||||||
}
|
|
||||||
return this.editable;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stop editing the layer
|
* Given an event, return a feature if the event occurred over one.
|
||||||
*
|
* Otherwise, return null.
|
||||||
* @return Whether or not the layer *was* editing
|
*
|
||||||
* HACK HACK This return value seems wierd to me.
|
* @param {Event}
|
||||||
* @type Boolean
|
* @type OpenLayers.Feature.Vector
|
||||||
|
* @return A feature if one was under the event
|
||||||
*/
|
*/
|
||||||
lock: function() {
|
getFeatureFromEvent: function(evt) {
|
||||||
if(this.editing) {
|
var featureId = this.renderer.getFeatureIdFromEvent(evt);
|
||||||
this.editing = false;
|
return this.getFeatureById(featureId);
|
||||||
}
|
|
||||||
return this.editing;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Given a feature id, return the feature if it exists in the features array
|
||||||
|
*
|
||||||
|
* @param String featureId
|
||||||
|
* @type OpenLayers.Feature.Vector
|
||||||
|
* @return A feature corresponding to the given featureId
|
||||||
|
*/
|
||||||
|
getFeatureById: function(featureId) {
|
||||||
|
//TBD - would it be more efficient to use a hash for this.features?
|
||||||
|
var feature = null;
|
||||||
|
for(var i=0; i<this.features.length; ++i) {
|
||||||
|
if(this.features[i].id == featureId) {
|
||||||
|
feature = this.features[i];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return feature;
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unselect the selected features
|
* Unselect the selected features
|
||||||
* i.e. clears the featureSelection array
|
* i.e. clears the featureSelection array
|
||||||
@@ -319,8 +331,7 @@ OpenLayers.Layer.Vector.prototype =
|
|||||||
var vectorLayer = this.map.vectorLayer;
|
var vectorLayer = this.map.vectorLayer;
|
||||||
for (var i = 0; i < this.map.featureSelection.length; i++) {
|
for (var i = 0; i < this.map.featureSelection.length; i++) {
|
||||||
var featureSelection = this.map.featureSelection[i];
|
var featureSelection = this.map.featureSelection[i];
|
||||||
vectorLayer.renderer.drawGeometry(featureSelection.geometry,
|
vectorLayer.drawFeature(featureSelection, vectorLayer.style);
|
||||||
vectorLayer.style);
|
|
||||||
}
|
}
|
||||||
this.map.featureSelection = [];
|
this.map.featureSelection = [];
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -202,7 +202,18 @@ OpenLayers.Layer.WFS.prototype =
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Call the onMapResize method of the appropriate parent class.
|
||||||
|
*/
|
||||||
|
onMapResize: function() {
|
||||||
|
if(this.vectorMode) {
|
||||||
|
OpenLayers.Layer.Vector.prototype.onMapResize.apply(this, arguments);
|
||||||
|
} else {
|
||||||
|
OpenLayers.Layer.Markers.prototype.onMapResize.apply(this, arguments);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Object} obj
|
* @param {Object} obj
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -33,6 +33,17 @@ OpenLayers.Marker.Box.prototype =
|
|||||||
this.setBorder(borderColor, borderWidth);
|
this.setBorder(borderColor, borderWidth);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
destroy: function() {
|
||||||
|
|
||||||
|
this.bounds = null;
|
||||||
|
this.div = null;
|
||||||
|
|
||||||
|
OpenLayers.Marker.prototype.destroy.apply(this, arguments);
|
||||||
|
},
|
||||||
|
|
||||||
/** Allow the user to change the box's color and border width
|
/** Allow the user to change the box's color and border width
|
||||||
*
|
*
|
||||||
* @param {String} color Default is "red"
|
* @param {String} color Default is "red"
|
||||||
|
|||||||
@@ -104,8 +104,12 @@ OpenLayers.Popup.prototype = {
|
|||||||
closeImg.style.top = this.padding + "px";
|
closeImg.style.top = this.padding + "px";
|
||||||
this.div.appendChild(closeImg);
|
this.div.appendChild(closeImg);
|
||||||
|
|
||||||
var closeEvents = new OpenLayers.Events(this, closeImg);
|
var closePopup = function(e) {
|
||||||
closeEvents.register("mousedown", this, this.hide);
|
this.hide();
|
||||||
|
OpenLayers.Event.stop(e);
|
||||||
|
}
|
||||||
|
OpenLayers.Event.observe(closeImg, "click",
|
||||||
|
closePopup.bindAsEventListener(this));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -106,36 +106,72 @@ OpenLayers.Renderer.prototype =
|
|||||||
return this.resolution;
|
return this.resolution;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draw the feature. The optional style argument can be used
|
||||||
|
* to override the feature's own style. This method should only
|
||||||
|
* be called from layer.drawFeature().
|
||||||
|
*
|
||||||
|
* @param {OpenLayers.Feature.Vector} feature
|
||||||
|
* @param {Object} style
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
drawFeature: function(feature, style) {
|
||||||
|
if(style == null) {
|
||||||
|
style = feature.style;
|
||||||
|
}
|
||||||
|
this.drawGeometry(feature.geometry, style, feature.id);
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* virtual function
|
* virtual function
|
||||||
*
|
*
|
||||||
* Draw a geometry on the specified layer.
|
* Draw a geometry. This should only be called from the renderer itself.
|
||||||
|
* Use layer.drawFeature() from outside the renderer.
|
||||||
*
|
*
|
||||||
* @param geometry {OpenLayers.Geometry}
|
* @param geometry {OpenLayers.Geometry}
|
||||||
* @param style {Object}
|
* @param style {Object}
|
||||||
|
* @param {String} featureId
|
||||||
|
* @private
|
||||||
*/
|
*/
|
||||||
drawGeometry: function(geometry, style) {},
|
drawGeometry: function(geometry, style, featureId) {},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* virtual function
|
* virtual function
|
||||||
*
|
*
|
||||||
* Clear all vectors from the renderer
|
* Clear all vectors from the renderer
|
||||||
*
|
* @private
|
||||||
*/
|
*/
|
||||||
clear: function() {},
|
clear: function() {},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* virtual function
|
* virtual function
|
||||||
*
|
*
|
||||||
* Returns a geometry from an event that happened on a layer.
|
* Returns a feature id from an event on the renderer.
|
||||||
* How this happens is specific to the renderer.
|
* How this happens is specific to the renderer. This should be
|
||||||
|
* called from layer.getFeatureFromEvent().
|
||||||
*
|
*
|
||||||
* @param evt {OpenLayers.Event}
|
* @param evt {OpenLayers.Event}
|
||||||
*
|
*
|
||||||
* @returns A geometry from an event that happened on a layer
|
* @returns A feature id or null
|
||||||
* @type OpenLayers.Geometry
|
* @type String
|
||||||
|
* @private
|
||||||
*/
|
*/
|
||||||
getGeometryFromEvent: function(evt) {},
|
getFeatureIdFromEvent: function(evt) {},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is called by the layer to erase features
|
||||||
|
* @param {Array(OpenLayers.Feature.Vector)} features
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
eraseFeatures: function(features) {
|
||||||
|
if(!(features instanceof Array)) {
|
||||||
|
features = [features];
|
||||||
|
}
|
||||||
|
for(var i=0; i<features.length; ++i) {
|
||||||
|
this.eraseGeometry(features[i].geometry);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* virtual function
|
* virtual function
|
||||||
@@ -143,6 +179,7 @@ OpenLayers.Renderer.prototype =
|
|||||||
* Remove a geometry from the renderer (by id)
|
* Remove a geometry from the renderer (by id)
|
||||||
*
|
*
|
||||||
* @param geometry {OpenLayers.Geometry}
|
* @param geometry {OpenLayers.Geometry}
|
||||||
|
* @private
|
||||||
*/
|
*/
|
||||||
eraseGeometry: function(geometry) {},
|
eraseGeometry: function(geometry) {},
|
||||||
|
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ OpenLayers.Renderer.Elements.prototype =
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove all the elements from the root
|
* Remove all the elements from the root
|
||||||
*
|
* @private
|
||||||
*/
|
*/
|
||||||
clear: function() {
|
clear: function() {
|
||||||
if (this.root) {
|
if (this.root) {
|
||||||
@@ -71,24 +71,6 @@ OpenLayers.Renderer.Elements.prototype =
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
|
||||||
* Cycle through the rendered nodes and reproject them (this should be
|
|
||||||
* called when the extent or size has changed);
|
|
||||||
*
|
|
||||||
* @param {OpenLayers.Bounds} extent
|
|
||||||
*/
|
|
||||||
reproject: function(extent) {
|
|
||||||
|
|
||||||
for (var i = 0; i < this.root.childNodes.length; i++) {
|
|
||||||
var node = this.root.childNodes[i];
|
|
||||||
//reproject node
|
|
||||||
// for the moment, this only really happens so as to reset
|
|
||||||
// the heaviness of the line relative to the resolution and
|
|
||||||
// the size of the circle for the Point object
|
|
||||||
this.reprojectNode(node);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
/** This function is in charge of asking the specific renderer which type
|
/** This function is in charge of asking the specific renderer which type
|
||||||
* of node to create for the given geometry. All geometries in an
|
* of node to create for the given geometry. All geometries in an
|
||||||
* Elements-based renderer consist of one node and some attributes. We
|
* Elements-based renderer consist of one node and some attributes. We
|
||||||
@@ -100,23 +82,27 @@ OpenLayers.Renderer.Elements.prototype =
|
|||||||
*
|
*
|
||||||
* @returns The corresponding node type for the specified geometry
|
* @returns The corresponding node type for the specified geometry
|
||||||
* @type String
|
* @type String
|
||||||
|
* @private
|
||||||
*/
|
*/
|
||||||
getNodeType: function(geometry) { },
|
getNodeType: function(geometry) { },
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Draw the geometry on the specified layer, creating new nodes,
|
* Draw the geometry, creating new nodes, setting paths, setting style,
|
||||||
* setting paths, setting style.
|
* setting featureId on the node. This method should only be called
|
||||||
|
* by the renderer itself.
|
||||||
*
|
*
|
||||||
* @param {OpenLayers.Geometry} geometry
|
* @param {OpenLayers.Geometry} geometry
|
||||||
* @param {Object} style
|
* @param {Object} style
|
||||||
|
* @param {String} featureId
|
||||||
|
* @private
|
||||||
*/
|
*/
|
||||||
drawGeometry: function(geometry, style) {
|
drawGeometry: function(geometry, style, featureId) {
|
||||||
|
|
||||||
if ((geometry.CLASS_NAME == "OpenLayers.Geometry.MultiPoint") ||
|
if ((geometry.CLASS_NAME == "OpenLayers.Geometry.MultiPoint") ||
|
||||||
(geometry.CLASS_NAME == "OpenLayers.Geometry.MultiLineString") ||
|
(geometry.CLASS_NAME == "OpenLayers.Geometry.MultiLineString") ||
|
||||||
(geometry.CLASS_NAME == "OpenLayers.Geometry.MultiPolygon")) {
|
(geometry.CLASS_NAME == "OpenLayers.Geometry.MultiPolygon")) {
|
||||||
for (var i = 0; i < geometry.components.length; i++) {
|
for (var i = 0; i < geometry.components.length; i++) {
|
||||||
this.drawGeometry(geometry.components[i], style);
|
this.drawGeometry(geometry.components[i], style, featureId);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
@@ -124,24 +110,27 @@ OpenLayers.Renderer.Elements.prototype =
|
|||||||
//first we create the basic node and add it to the root
|
//first we create the basic node and add it to the root
|
||||||
var nodeType = this.getNodeType(geometry);
|
var nodeType = this.getNodeType(geometry);
|
||||||
var node = this.nodeFactory(geometry.id, nodeType, geometry);
|
var node = this.nodeFactory(geometry.id, nodeType, geometry);
|
||||||
node.geometry = geometry;
|
node._featureId = featureId;
|
||||||
node.olStyle = style;
|
node._geometryClass = geometry.CLASS_NAME;
|
||||||
|
node._style = style;
|
||||||
this.root.appendChild(node);
|
this.root.appendChild(node);
|
||||||
|
|
||||||
//now actually draw the node, and style it
|
//now actually draw the node, and style it
|
||||||
this.drawGeometryNode(node);
|
this.drawGeometryNode(node, geometry);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Given a node, draw a geometry on the specified layer.
|
* Given a node, draw a geometry on the specified layer.
|
||||||
|
* node and geometry are required arguments, style is optional.
|
||||||
|
* This method is only called by the render itself.
|
||||||
*
|
*
|
||||||
* @param {DOMElement} node
|
* @param {DOMElement} node
|
||||||
* @param {OpenLayers.Geometry} geometry
|
* @param {OpenLayers.Geometry} geometry
|
||||||
* @param {Object} style
|
* @param {Object} style
|
||||||
|
* @private
|
||||||
*/
|
*/
|
||||||
drawGeometryNode: function(node, geometry, style) {
|
drawGeometryNode: function(node, geometry, style) {
|
||||||
geometry = geometry || node.geometry;
|
style = style || node._style;
|
||||||
style = style || node.olStyle;
|
|
||||||
|
|
||||||
var options = {
|
var options = {
|
||||||
'isFilled': true,
|
'isFilled': true,
|
||||||
@@ -171,19 +160,22 @@ OpenLayers.Renderer.Elements.prototype =
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
node.olStyle = style;
|
node._style = style;
|
||||||
node.olOptions = options;
|
node._options = options;
|
||||||
|
|
||||||
//set style
|
//set style
|
||||||
this.setStyle(node);
|
//TBD simplify this
|
||||||
|
this.setStyle(node, style, options, geometry);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* virtual functions for drawing different Geometries.
|
* virtual functions for drawing different Geometries.
|
||||||
* These should all be implemented by subclasses.
|
* These should all be implemented by subclasses.
|
||||||
|
* These methods are only called by the render itself.
|
||||||
*
|
*
|
||||||
* @param {DOMElement} node
|
* @param {DOMElement} node
|
||||||
* @param {OpenLayers.Geometry} geometry
|
* @param {OpenLayers.Geometry} geometry
|
||||||
|
* @private
|
||||||
*/
|
*/
|
||||||
drawPoint: function(node, geometry) {},
|
drawPoint: function(node, geometry) {},
|
||||||
drawLineString: function(node, geometry) {},
|
drawLineString: function(node, geometry) {},
|
||||||
@@ -199,11 +191,11 @@ OpenLayers.Renderer.Elements.prototype =
|
|||||||
*
|
*
|
||||||
* @returns A geometry from an event that happened on a layer
|
* @returns A geometry from an event that happened on a layer
|
||||||
* @type OpenLayers.Geometry
|
* @type OpenLayers.Geometry
|
||||||
|
* @private
|
||||||
*/
|
*/
|
||||||
getGeometryFromEvent: function(evt) {
|
getFeatureIdFromEvent: function(evt) {
|
||||||
var node = evt.target || evt.srcElement;
|
var node = evt.target || evt.srcElement;
|
||||||
var geometry = node.geometry ? node.geometry : null
|
return node._featureId;
|
||||||
return geometry;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/** Erase a geometry from the renderer. In the case of a multi-geometry,
|
/** Erase a geometry from the renderer. In the case of a multi-geometry,
|
||||||
@@ -212,6 +204,7 @@ OpenLayers.Renderer.Elements.prototype =
|
|||||||
* the DOM.
|
* the DOM.
|
||||||
*
|
*
|
||||||
* @param {OpenLayers.Geometry} geometry
|
* @param {OpenLayers.Geometry} geometry
|
||||||
|
* @private
|
||||||
*/
|
*/
|
||||||
eraseGeometry: function(geometry) {
|
eraseGeometry: function(geometry) {
|
||||||
if ((geometry.CLASS_NAME == "OpenLayers.Geometry.MultiPoint") ||
|
if ((geometry.CLASS_NAME == "OpenLayers.Geometry.MultiPoint") ||
|
||||||
@@ -246,6 +239,7 @@ OpenLayers.Renderer.Elements.prototype =
|
|||||||
*
|
*
|
||||||
* @returns A new node of the given type and id
|
* @returns A new node of the given type and id
|
||||||
* @type DOMElement
|
* @type DOMElement
|
||||||
|
* @private
|
||||||
*/
|
*/
|
||||||
nodeFactory: function(id, type, geometry) {
|
nodeFactory: function(id, type, geometry) {
|
||||||
var node = $(id);
|
var node = $(id);
|
||||||
|
|||||||
@@ -13,7 +13,17 @@ OpenLayers.Renderer.SVG.prototype =
|
|||||||
|
|
||||||
/** @type String */
|
/** @type String */
|
||||||
xmlns: "http://www.w3.org/2000/svg",
|
xmlns: "http://www.w3.org/2000/svg",
|
||||||
|
|
||||||
|
// Firefox has a limitation where values larger or smaller than about
|
||||||
|
// 15000 in an SVG document lock the browser up. This works around it.
|
||||||
|
/** @type Integer */
|
||||||
|
maxPixel: 15000,
|
||||||
|
|
||||||
|
|
||||||
|
/** @type Float
|
||||||
|
@private */
|
||||||
|
localResolution: null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
*
|
*
|
||||||
@@ -46,6 +56,7 @@ OpenLayers.Renderer.SVG.prototype =
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {OpenLayers.Bounds} extent
|
* @param {OpenLayers.Bounds} extent
|
||||||
|
* @private
|
||||||
*/
|
*/
|
||||||
setExtent: function(extent) {
|
setExtent: function(extent) {
|
||||||
OpenLayers.Renderer.Elements.prototype.setExtent.apply(this,
|
OpenLayers.Renderer.Elements.prototype.setExtent.apply(this,
|
||||||
@@ -53,8 +64,33 @@ OpenLayers.Renderer.SVG.prototype =
|
|||||||
|
|
||||||
var resolution = this.getResolution();
|
var resolution = this.getResolution();
|
||||||
|
|
||||||
var extentString = extent.left / resolution + " " + -extent.top / resolution + " " +
|
|
||||||
|
// If the resolution has changed, start over changing the corner, because
|
||||||
|
// the features will redraw.
|
||||||
|
if (!this.localResolution || resolution != this.localResolution) {
|
||||||
|
this.left = -extent.left / resolution;
|
||||||
|
this.top = extent.top / resolution;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var left = 0;
|
||||||
|
var top = 0;
|
||||||
|
|
||||||
|
// If the resolution has not changed, we already have features, and we need
|
||||||
|
// to adjust the viewbox to fit them.
|
||||||
|
if (this.localResolution && resolution == this.localResolution) {
|
||||||
|
left = (this.left) - (-extent.left / resolution);
|
||||||
|
top = (this.top) - (extent.top / resolution);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Store resolution for use later.
|
||||||
|
this.localResolution = resolution;
|
||||||
|
|
||||||
|
// Set the viewbox -- the left/top will be pixels-dragged-since-res change,
|
||||||
|
// the width/height will be pixels.
|
||||||
|
var extentString = left + " " + top + " " +
|
||||||
extent.getWidth() / resolution + " " + extent.getHeight() / resolution;
|
extent.getWidth() / resolution + " " + extent.getHeight() / resolution;
|
||||||
|
//var extentString = extent.left / resolution + " " + -extent.top / resolution + " " +
|
||||||
this.rendererRoot.setAttributeNS(null, "viewBox", extentString);
|
this.rendererRoot.setAttributeNS(null, "viewBox", extentString);
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -64,6 +100,7 @@ OpenLayers.Renderer.SVG.prototype =
|
|||||||
* sets the size of the drawing surface
|
* sets the size of the drawing surface
|
||||||
*
|
*
|
||||||
* @param size {OpenLayers.Size} the size of the drawing surface
|
* @param size {OpenLayers.Size} the size of the drawing surface
|
||||||
|
* @private
|
||||||
*/
|
*/
|
||||||
setSize: function(size) {
|
setSize: function(size) {
|
||||||
OpenLayers.Renderer.prototype.setSize.apply(this, arguments);
|
OpenLayers.Renderer.prototype.setSize.apply(this, arguments);
|
||||||
@@ -80,6 +117,7 @@ OpenLayers.Renderer.SVG.prototype =
|
|||||||
*
|
*
|
||||||
* @returns The corresponding node type for the specified geometry
|
* @returns The corresponding node type for the specified geometry
|
||||||
* @type String
|
* @type String
|
||||||
|
* @private
|
||||||
*/
|
*/
|
||||||
getNodeType: function(geometry) {
|
getNodeType: function(geometry) {
|
||||||
var nodeType = null;
|
var nodeType = null;
|
||||||
@@ -106,14 +144,7 @@ OpenLayers.Renderer.SVG.prototype =
|
|||||||
}
|
}
|
||||||
return nodeType;
|
return nodeType;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {DOMElement} node
|
|
||||||
*/
|
|
||||||
reprojectNode: function(node) {
|
|
||||||
this.drawGeometryNode(node);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use to set all the style attributes to a SVG node.
|
* Use to set all the style attributes to a SVG node.
|
||||||
*
|
*
|
||||||
@@ -125,12 +156,13 @@ OpenLayers.Renderer.SVG.prototype =
|
|||||||
* @param {Object} options
|
* @param {Object} options
|
||||||
* @option isFilled {boolean}
|
* @option isFilled {boolean}
|
||||||
* @option isStroked {boolean}
|
* @option isStroked {boolean}
|
||||||
|
* @private
|
||||||
*/
|
*/
|
||||||
setStyle: function(node, style, options) {
|
setStyle: function(node, style, options) {
|
||||||
style = style || node.olStyle;
|
style = style || node._style;
|
||||||
options = options || node.olOptions;
|
options = options || node._options;
|
||||||
|
|
||||||
if (node.geometry.CLASS_NAME == "OpenLayers.Geometry.Point") {
|
if (node._geometryClass == "OpenLayers.Geometry.Point") {
|
||||||
node.setAttributeNS(null, "r", style.pointRadius);
|
node.setAttributeNS(null, "r", style.pointRadius);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -152,6 +184,10 @@ OpenLayers.Renderer.SVG.prototype =
|
|||||||
if (style.pointerEvents) {
|
if (style.pointerEvents) {
|
||||||
node.setAttributeNS(null, "pointer-events", style.pointerEvents);
|
node.setAttributeNS(null, "pointer-events", style.pointerEvents);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (style.cursor) {
|
||||||
|
node.setAttributeNS(null, "cursor", style.cursor);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -187,6 +223,7 @@ OpenLayers.Renderer.SVG.prototype =
|
|||||||
/**
|
/**
|
||||||
* @returns The specific render engine's root element
|
* @returns The specific render engine's root element
|
||||||
* @type DOMElement
|
* @type DOMElement
|
||||||
|
* @private
|
||||||
*/
|
*/
|
||||||
createRenderRoot: function() {
|
createRenderRoot: function() {
|
||||||
var id = this.container.id + "_svgRoot";
|
var id = this.container.id + "_svgRoot";
|
||||||
@@ -197,6 +234,7 @@ OpenLayers.Renderer.SVG.prototype =
|
|||||||
/**
|
/**
|
||||||
* @returns The main root element to which we'll add vectors
|
* @returns The main root element to which we'll add vectors
|
||||||
* @type DOMElement
|
* @type DOMElement
|
||||||
|
* @private
|
||||||
*/
|
*/
|
||||||
createRoot: function() {
|
createRoot: function() {
|
||||||
var id = this.container.id + "_root";
|
var id = this.container.id + "_root";
|
||||||
@@ -219,6 +257,7 @@ OpenLayers.Renderer.SVG.prototype =
|
|||||||
/**
|
/**
|
||||||
* @param {DOMElement} node
|
* @param {DOMElement} node
|
||||||
* @param {OpenLayers.Geometry} geometry
|
* @param {OpenLayers.Geometry} geometry
|
||||||
|
* @private
|
||||||
*/
|
*/
|
||||||
drawPoint: function(node, geometry) {
|
drawPoint: function(node, geometry) {
|
||||||
this.drawCircle(node, geometry, 1);
|
this.drawCircle(node, geometry, 1);
|
||||||
@@ -228,17 +267,32 @@ OpenLayers.Renderer.SVG.prototype =
|
|||||||
* @param {DOMElement} node
|
* @param {DOMElement} node
|
||||||
* @param {OpenLayers.Geometry} geometry
|
* @param {OpenLayers.Geometry} geometry
|
||||||
* @param {float} radius
|
* @param {float} radius
|
||||||
|
* @private
|
||||||
*/
|
*/
|
||||||
drawCircle: function(node, geometry, radius) {
|
drawCircle: function(node, geometry, radius) {
|
||||||
var resolution = this.getResolution();
|
var resolution = this.getResolution();
|
||||||
node.setAttributeNS(null, "cx", geometry.x / resolution);
|
var x = (geometry.x / resolution + this.left);
|
||||||
node.setAttributeNS(null, "cy", geometry.y / resolution);
|
var y = (geometry.y / resolution - this.top);
|
||||||
node.setAttributeNS(null, "r", radius);
|
var draw = true;
|
||||||
|
if (x < -this.maxPixel || x > this.maxPixel) { draw = false; }
|
||||||
|
if (y < -this.maxPixel || y > this.maxPixel) { draw = false; }
|
||||||
|
|
||||||
|
if (draw) {
|
||||||
|
node.setAttributeNS(null, "cx", x);
|
||||||
|
node.setAttributeNS(null, "cy", y);
|
||||||
|
node.setAttributeNS(null, "r", radius);
|
||||||
|
} else {
|
||||||
|
node.setAttributeNS(null, "cx", "");
|
||||||
|
node.setAttributeNS(null, "cy", "");
|
||||||
|
node.setAttributeNS(null, "r", 0);
|
||||||
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {DOMElement} node
|
* @param {DOMElement} node
|
||||||
* @param {OpenLayers.Geometry} geometry
|
* @param {OpenLayers.Geometry} geometry
|
||||||
|
* @private
|
||||||
*/
|
*/
|
||||||
drawLineString: function(node, geometry) {
|
drawLineString: function(node, geometry) {
|
||||||
node.setAttributeNS(null, "points", this.getComponentsString(geometry.components));
|
node.setAttributeNS(null, "points", this.getComponentsString(geometry.components));
|
||||||
@@ -247,6 +301,7 @@ OpenLayers.Renderer.SVG.prototype =
|
|||||||
/**
|
/**
|
||||||
* @param {DOMElement} node
|
* @param {DOMElement} node
|
||||||
* @param {OpenLayers.Geometry} geometry
|
* @param {OpenLayers.Geometry} geometry
|
||||||
|
* @private
|
||||||
*/
|
*/
|
||||||
drawLinearRing: function(node, geometry) {
|
drawLinearRing: function(node, geometry) {
|
||||||
node.setAttributeNS(null, "points", this.getComponentsString(geometry.components));
|
node.setAttributeNS(null, "points", this.getComponentsString(geometry.components));
|
||||||
@@ -255,80 +310,132 @@ OpenLayers.Renderer.SVG.prototype =
|
|||||||
/**
|
/**
|
||||||
* @param {DOMElement} node
|
* @param {DOMElement} node
|
||||||
* @param {OpenLayers.Geometry} geometry
|
* @param {OpenLayers.Geometry} geometry
|
||||||
|
* @private
|
||||||
*/
|
*/
|
||||||
drawPolygon: function(node, geometry) {
|
drawPolygon: function(node, geometry) {
|
||||||
var d = "";
|
var d = "";
|
||||||
|
var draw = true;
|
||||||
for (var j = 0; j < geometry.components.length; j++) {
|
for (var j = 0; j < geometry.components.length; j++) {
|
||||||
var linearRing = geometry.components[j];
|
var linearRing = geometry.components[j];
|
||||||
d += " M";
|
d += " M";
|
||||||
for (var i = 0; i < linearRing.components.length; i++) {
|
for (var i = 0; i < linearRing.components.length; i++) {
|
||||||
d += " " + this.getShortString(linearRing.components[i]);
|
var component = this.getShortString(linearRing.components[i])
|
||||||
|
if (component) {
|
||||||
|
d += " " + component;
|
||||||
|
} else {
|
||||||
|
draw = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
d += " z";
|
d += " z";
|
||||||
|
if (draw) {
|
||||||
node.setAttributeNS(null, "d", d);
|
node.setAttributeNS(null, "d", d);
|
||||||
node.setAttributeNS(null, "fill-rule", "evenodd");
|
node.setAttributeNS(null, "fill-rule", "evenodd");
|
||||||
|
} else {
|
||||||
|
node.setAttributeNS(null, "d", "");
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {DOMElement} node
|
* @param {DOMElement} node
|
||||||
* @param {OpenLayers.Geometry} geometry
|
* @param {OpenLayers.Geometry} geometry
|
||||||
|
* @private
|
||||||
*/
|
*/
|
||||||
drawRectangle: function(node, geometry) {
|
drawRectangle: function(node, geometry) {
|
||||||
node.setAttributeNS(null, "x", geometry.x / resolution);
|
// This needs to be reworked
|
||||||
node.setAttributeNS(null, "y", geometry.y / resolution);
|
var x = (geometry.x / resolution + this.left);
|
||||||
node.setAttributeNS(null, "width", geometry.width);
|
var y = (geometry.y / resolution - this.top);
|
||||||
node.setAttributeNS(null, "height", geometry.height);
|
var draw = true;
|
||||||
|
if (x < -this.maxPixel || x > this.maxPixel) { draw = false; }
|
||||||
|
if (y < -this.maxPixel || y > this.maxPixel) { draw = false; }
|
||||||
|
if (draw) {
|
||||||
|
node.setAttributeNS(null, "x", x);
|
||||||
|
node.setAttributeNS(null, "y", y);
|
||||||
|
node.setAttributeNS(null, "width", geometry.width);
|
||||||
|
node.setAttributeNS(null, "height", geometry.height);
|
||||||
|
} else {
|
||||||
|
node.setAttributeNS(null, "x", "");
|
||||||
|
node.setAttributeNS(null, "y", "");
|
||||||
|
node.setAttributeNS(null, "width", 0);
|
||||||
|
node.setAttributeNS(null, "height", 0);
|
||||||
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {DOMElement} node
|
* @param {DOMElement} node
|
||||||
* @param {OpenLayers.Geometry} geometry
|
* @param {OpenLayers.Geometry} geometry
|
||||||
|
* @private
|
||||||
*/
|
*/
|
||||||
drawCurve: function(node, geometry) {
|
drawCurve: function(node, geometry) {
|
||||||
var d = null;
|
var d = null;
|
||||||
|
var draw = true;
|
||||||
for (var i = 0; i < geometry.components.length; i++) {
|
for (var i = 0; i < geometry.components.length; i++) {
|
||||||
if ((i%3) == 0 && (i/3) == 0) {
|
if ((i%3) == 0 && (i/3) == 0) {
|
||||||
d = "M " + this.getShortString(geometry.components[i]);
|
var component = this.getShortString(geometry.components[i]);
|
||||||
|
if (!component) { draw = false; }
|
||||||
|
d = "M " + component;
|
||||||
} else if ((i%3) == 1) {
|
} else if ((i%3) == 1) {
|
||||||
d += " C " + this.getShortString(geometry.components[i]);
|
var component = this.getShortString(geometry.components[i]);
|
||||||
|
if (!component) { draw = false; }
|
||||||
|
d += " C " + component;
|
||||||
} else {
|
} else {
|
||||||
d += " " + this.getShortString(geometry.components[i]);
|
var component = this.getShortString(geometry.components[i]);
|
||||||
|
if (!component) { draw = false; }
|
||||||
|
d += " " + component;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
node.setAttributeNS(null, "d", d);
|
if (draw) {
|
||||||
|
node.setAttributeNS(null, "d", d);
|
||||||
|
} else {
|
||||||
|
node.setAttributeNS(null, "d", "");
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {DOMElement} node
|
* @param {DOMElement} node
|
||||||
* @param {OpenLayers.Geometry} geometry
|
* @param {OpenLayers.Geometry} geometry
|
||||||
|
* @private
|
||||||
*/
|
*/
|
||||||
drawSurface: function(node, geometry) {
|
drawSurface: function(node, geometry) {
|
||||||
|
|
||||||
// create the svg path string representation
|
// create the svg path string representation
|
||||||
var d = null;
|
var d = null;
|
||||||
|
var draw = true;
|
||||||
for (var i = 0; i < geometry.components.length; i++) {
|
for (var i = 0; i < geometry.components.length; i++) {
|
||||||
if ((i%3) == 0 && (i/3) == 0) {
|
if ((i%3) == 0 && (i/3) == 0) {
|
||||||
d = "M " + this.getShortString(geometry.components[i]);
|
var component = this.getShortString(geometry.components[i]);
|
||||||
|
if (!component) { draw = false; }
|
||||||
|
d = "M " + component;
|
||||||
} else if ((i%3) == 1) {
|
} else if ((i%3) == 1) {
|
||||||
d += " C " + this.getShortString(geometry.components[i]);
|
var component = this.getShortString(geometry.components[i]);
|
||||||
|
if (!component) { draw = false; }
|
||||||
|
d += " C " + component;
|
||||||
} else {
|
} else {
|
||||||
d += " " + this.getShortString(geometry.components[i]);
|
var component = this.getShortString(geometry.components[i]);
|
||||||
|
if (!component) { draw = false; }
|
||||||
|
d += " " + component;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
d += " Z";
|
d += " Z";
|
||||||
node.setAttributeNS(null, "d", d);
|
if (draw) {
|
||||||
|
node.setAttributeNS(null, "d", d);
|
||||||
|
} else {
|
||||||
|
node.setAttributeNS(null, "d", "");
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Array} components array of points
|
* @param {Array} components array of points
|
||||||
|
* @private
|
||||||
*/
|
*/
|
||||||
getComponentsString: function(components) {
|
getComponentsString: function(components) {
|
||||||
var strings = [];
|
var strings = [];
|
||||||
for(var i = 0; i < components.length; i++) {
|
for(var i = 0; i < components.length; i++) {
|
||||||
strings.push(this.getShortString(components[i]));
|
var component = this.getShortString(components[i]);
|
||||||
|
if (!component) { return false; }
|
||||||
|
strings.push(component);
|
||||||
}
|
}
|
||||||
return strings.join(",");
|
return strings.join(",");
|
||||||
},
|
},
|
||||||
@@ -336,10 +443,16 @@ OpenLayers.Renderer.SVG.prototype =
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {OpenLayers.Geometry.Point} point
|
* @param {OpenLayers.Geometry.Point} point
|
||||||
|
* @private
|
||||||
*/
|
*/
|
||||||
getShortString: function(point) {
|
getShortString: function(point) {
|
||||||
var resolution = this.getResolution();
|
var resolution = this.getResolution();
|
||||||
return point.x / resolution + "," + point.y / resolution;
|
var x = (point.x / resolution + this.left);
|
||||||
|
var y = (point.y / resolution - this.top);
|
||||||
|
if (x < -this.maxPixel || x > this.maxPixel) { return false; }
|
||||||
|
if (y < -this.maxPixel || y > this.maxPixel) { return false; }
|
||||||
|
var string = x + "," + y;
|
||||||
|
return string;
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -89,6 +89,7 @@ OpenLayers.Renderer.VML.prototype =
|
|||||||
*
|
*
|
||||||
* @returns The corresponding node type for the specified geometry
|
* @returns The corresponding node type for the specified geometry
|
||||||
* @type String
|
* @type String
|
||||||
|
* @private
|
||||||
*/
|
*/
|
||||||
getNodeType: function(geometry) {
|
getNodeType: function(geometry) {
|
||||||
var nodeType = null;
|
var nodeType = null;
|
||||||
@@ -112,16 +113,6 @@ OpenLayers.Renderer.VML.prototype =
|
|||||||
return nodeType;
|
return nodeType;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {DOMElement} node
|
|
||||||
*/
|
|
||||||
reprojectNode: function(node) {
|
|
||||||
//we have to reprojectNode the entire node since the coordinates
|
|
||||||
// system has changed
|
|
||||||
this.drawGeometryNode(node);
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use to set all the style attributes to a VML node.
|
* Use to set all the style attributes to a VML node.
|
||||||
*
|
*
|
||||||
@@ -129,14 +120,16 @@ OpenLayers.Renderer.VML.prototype =
|
|||||||
* @param {Object} style
|
* @param {Object} style
|
||||||
* @param {Object} options
|
* @param {Object} options
|
||||||
* @option isFilled {boolean}
|
* @option isFilled {boolean}
|
||||||
* @option isStroked {boolean}
|
* @option isStroked {boolean}
|
||||||
|
* @param {OpenLayers.Geometry} geometry
|
||||||
|
* @private
|
||||||
*/
|
*/
|
||||||
setStyle: function(node, style, options) {
|
setStyle: function(node, style, options, geometry) {
|
||||||
style = style || node.olStyle;
|
style = style || node._style;
|
||||||
options = options || node.olOptions;
|
options = options || node._options;
|
||||||
|
|
||||||
if (node.geometry.CLASS_NAME == "OpenLayers.Geometry.Point") {
|
if (node._geometryClass == "OpenLayers.Geometry.Point") {
|
||||||
this.drawCircle(node, node.geometry, style.pointRadius);
|
this.drawCircle(node, geometry, style.pointRadius);
|
||||||
}
|
}
|
||||||
|
|
||||||
//fill
|
//fill
|
||||||
@@ -174,6 +167,10 @@ OpenLayers.Renderer.VML.prototype =
|
|||||||
}
|
}
|
||||||
stroke.setAttribute("opacity", style.strokeOpacity);
|
stroke.setAttribute("opacity", style.strokeOpacity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (style.cursor) {
|
||||||
|
node.style.cursor = style.cursor;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
@@ -182,6 +179,7 @@ OpenLayers.Renderer.VML.prototype =
|
|||||||
*
|
*
|
||||||
* @param {DOMElement} node
|
* @param {DOMElement} node
|
||||||
* @param {OpenLayers.Geometry} geometry
|
* @param {OpenLayers.Geometry} geometry
|
||||||
|
* @private
|
||||||
*/
|
*/
|
||||||
setNodeDimension: function(node, geometry) {
|
setNodeDimension: function(node, geometry) {
|
||||||
|
|
||||||
@@ -253,6 +251,7 @@ OpenLayers.Renderer.VML.prototype =
|
|||||||
/**
|
/**
|
||||||
* @returns The specific render engine's root element
|
* @returns The specific render engine's root element
|
||||||
* @type DOMElement
|
* @type DOMElement
|
||||||
|
* @private
|
||||||
*/
|
*/
|
||||||
createRenderRoot: function() {
|
createRenderRoot: function() {
|
||||||
var id = this.container.id + "_vmlRoot";
|
var id = this.container.id + "_vmlRoot";
|
||||||
@@ -263,6 +262,7 @@ OpenLayers.Renderer.VML.prototype =
|
|||||||
/**
|
/**
|
||||||
* @returns The main root element to which we'll add vectors
|
* @returns The main root element to which we'll add vectors
|
||||||
* @type DOMElement
|
* @type DOMElement
|
||||||
|
* @private
|
||||||
*/
|
*/
|
||||||
createRoot: function() {
|
createRoot: function() {
|
||||||
var id = this.container.id + "_root";
|
var id = this.container.id + "_root";
|
||||||
@@ -278,10 +278,11 @@ OpenLayers.Renderer.VML.prototype =
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {DOMElement} node
|
* @param {DOMElement} node
|
||||||
* @param {OpenLayers.Geometry} geometry
|
* @param {OpenLayers.Geometry} geometry
|
||||||
|
* @private
|
||||||
*/
|
*/
|
||||||
drawPoint: function(node, geometry) {
|
drawPoint: function(node, geometry) {
|
||||||
this.drawCircle(node, node.geometry, 1);
|
this.drawCircle(node, geometry, 1);
|
||||||
},
|
},
|
||||||
|
|
||||||
/** Size and Center a circle given geometry (x,y center) and radius
|
/** Size and Center a circle given geometry (x,y center) and radius
|
||||||
@@ -289,6 +290,7 @@ OpenLayers.Renderer.VML.prototype =
|
|||||||
* @param {DOMElement} node
|
* @param {DOMElement} node
|
||||||
* @param {OpenLayers.Geometry} geometry
|
* @param {OpenLayers.Geometry} geometry
|
||||||
* @param {float} radius
|
* @param {float} radius
|
||||||
|
* @private
|
||||||
*/
|
*/
|
||||||
drawCircle: function(node, geometry, radius) {
|
drawCircle: function(node, geometry, radius) {
|
||||||
|
|
||||||
@@ -307,6 +309,7 @@ OpenLayers.Renderer.VML.prototype =
|
|||||||
/**
|
/**
|
||||||
* @param {DOMElement} node
|
* @param {DOMElement} node
|
||||||
* @param {OpenLayers.Geometry} geometry
|
* @param {OpenLayers.Geometry} geometry
|
||||||
|
* @private
|
||||||
*/
|
*/
|
||||||
drawLineString: function(node, geometry) {
|
drawLineString: function(node, geometry) {
|
||||||
this.drawLine(node, geometry, false);
|
this.drawLine(node, geometry, false);
|
||||||
@@ -315,6 +318,7 @@ OpenLayers.Renderer.VML.prototype =
|
|||||||
/**
|
/**
|
||||||
* @param {DOMElement} node
|
* @param {DOMElement} node
|
||||||
* @param {OpenLayers.Geometry} geometry
|
* @param {OpenLayers.Geometry} geometry
|
||||||
|
* @private
|
||||||
*/
|
*/
|
||||||
drawLinearRing: function(node, geometry) {
|
drawLinearRing: function(node, geometry) {
|
||||||
this.drawLine(node, geometry, true);
|
this.drawLine(node, geometry, true);
|
||||||
@@ -324,6 +328,7 @@ OpenLayers.Renderer.VML.prototype =
|
|||||||
* @param {DOMElement} node
|
* @param {DOMElement} node
|
||||||
* @param {OpenLayers.Geometry} geometry
|
* @param {OpenLayers.Geometry} geometry
|
||||||
* @param {Boolean} closeLine Close the line? (make it a ring?)
|
* @param {Boolean} closeLine Close the line? (make it a ring?)
|
||||||
|
* @private
|
||||||
*/
|
*/
|
||||||
drawLine: function(node, geometry, closeLine) {
|
drawLine: function(node, geometry, closeLine) {
|
||||||
|
|
||||||
@@ -348,6 +353,7 @@ OpenLayers.Renderer.VML.prototype =
|
|||||||
/**
|
/**
|
||||||
* @parm {DOMElement} node
|
* @parm {DOMElement} node
|
||||||
* @param {OpenLayers.Geometry} geometry
|
* @param {OpenLayers.Geometry} geometry
|
||||||
|
* @private
|
||||||
*/
|
*/
|
||||||
drawPolygon: function(node, geometry) {
|
drawPolygon: function(node, geometry) {
|
||||||
this.setNodeDimension(node, geometry);
|
this.setNodeDimension(node, geometry);
|
||||||
@@ -376,6 +382,7 @@ OpenLayers.Renderer.VML.prototype =
|
|||||||
/**
|
/**
|
||||||
* @parm {DOMElement} node
|
* @parm {DOMElement} node
|
||||||
* @param {OpenLayers.Geometry} geometry
|
* @param {OpenLayers.Geometry} geometry
|
||||||
|
* @private
|
||||||
*/
|
*/
|
||||||
drawRectangle: function(node, geometry) {
|
drawRectangle: function(node, geometry) {
|
||||||
var resolution = this.getResolution();
|
var resolution = this.getResolution();
|
||||||
@@ -391,6 +398,7 @@ OpenLayers.Renderer.VML.prototype =
|
|||||||
/**
|
/**
|
||||||
* @parm {DOMElement} node
|
* @parm {DOMElement} node
|
||||||
* @param {OpenLayers.Geometry} geometry
|
* @param {OpenLayers.Geometry} geometry
|
||||||
|
* @private
|
||||||
*/
|
*/
|
||||||
drawCurve: function(node, geometry) {
|
drawCurve: function(node, geometry) {
|
||||||
this.setNodeDimension(node, geometry);
|
this.setNodeDimension(node, geometry);
|
||||||
@@ -417,6 +425,7 @@ OpenLayers.Renderer.VML.prototype =
|
|||||||
/**
|
/**
|
||||||
* @parm {DOMElement} node
|
* @parm {DOMElement} node
|
||||||
* @param {OpenLayers.Geometry} geometry
|
* @param {OpenLayers.Geometry} geometry
|
||||||
|
* @private
|
||||||
*/
|
*/
|
||||||
drawSurface: function(node, geometry) {
|
drawSurface: function(node, geometry) {
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,9 @@
|
|||||||
* about themselves -- such as the URL that they are related to, and their
|
* about themselves -- such as the URL that they are related to, and their
|
||||||
* size - but do not add themselves to the layer div automatically, for
|
* size - but do not add themselves to the layer div automatically, for
|
||||||
* example.
|
* example.
|
||||||
|
*
|
||||||
|
* TBD 3.0 - remove reference to url in above paragraph
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
OpenLayers.Tile = OpenLayers.Class.create();
|
OpenLayers.Tile = OpenLayers.Class.create();
|
||||||
OpenLayers.Tile.prototype = {
|
OpenLayers.Tile.prototype = {
|
||||||
@@ -22,7 +25,11 @@ OpenLayers.Tile.prototype = {
|
|||||||
/** @type OpenLayers.Layer */
|
/** @type OpenLayers.Layer */
|
||||||
layer: null,
|
layer: null,
|
||||||
|
|
||||||
/** @type String url of the request */
|
/** TBD 3.0
|
||||||
|
* @deprecated The base tile class does not need an url. This should be
|
||||||
|
* handled in subclasses. Does not belong here.
|
||||||
|
*
|
||||||
|
* @type String url of the request */
|
||||||
url:null,
|
url:null,
|
||||||
|
|
||||||
/** @type OpenLayers.Bounds */
|
/** @type OpenLayers.Bounds */
|
||||||
@@ -38,7 +45,9 @@ OpenLayers.Tile.prototype = {
|
|||||||
/** @type Boolean */
|
/** @type Boolean */
|
||||||
drawn: false,
|
drawn: false,
|
||||||
|
|
||||||
/**
|
/** TBD 3.0 -- remove 'url' from the list of parameters to the constructor.
|
||||||
|
* there is no need for the base tile class to have a url.
|
||||||
|
*
|
||||||
* @constructor
|
* @constructor
|
||||||
*
|
*
|
||||||
* @param {OpenLayers.Layer} layer
|
* @param {OpenLayers.Layer} layer
|
||||||
|
|||||||
@@ -11,6 +11,9 @@
|
|||||||
OpenLayers.Tile.Image = OpenLayers.Class.create();
|
OpenLayers.Tile.Image = OpenLayers.Class.create();
|
||||||
OpenLayers.Tile.Image.prototype =
|
OpenLayers.Tile.Image.prototype =
|
||||||
OpenLayers.Class.inherit( OpenLayers.Tile, {
|
OpenLayers.Class.inherit( OpenLayers.Tile, {
|
||||||
|
|
||||||
|
/** @type String */
|
||||||
|
url: null,
|
||||||
|
|
||||||
/** @type DOMElement img */
|
/** @type DOMElement img */
|
||||||
imgDiv: null,
|
imgDiv: null,
|
||||||
@@ -22,7 +25,10 @@ OpenLayers.Tile.Image.prototype =
|
|||||||
* @type DOMElement div */
|
* @type DOMElement div */
|
||||||
frame: null,
|
frame: null,
|
||||||
|
|
||||||
/**
|
/** TBD 3.0 - reorder the parameters to the init function to put URL
|
||||||
|
* as last, so we can continue to call tile.initialize()
|
||||||
|
* without changing the arguments.
|
||||||
|
*
|
||||||
* @constructor
|
* @constructor
|
||||||
*
|
*
|
||||||
* @param {OpenLayers.Grid} layer
|
* @param {OpenLayers.Grid} layer
|
||||||
@@ -33,6 +39,9 @@ OpenLayers.Tile.Image.prototype =
|
|||||||
*/
|
*/
|
||||||
initialize: function(layer, position, bounds, url, size) {
|
initialize: function(layer, position, bounds, url, size) {
|
||||||
OpenLayers.Tile.prototype.initialize.apply(this, arguments);
|
OpenLayers.Tile.prototype.initialize.apply(this, arguments);
|
||||||
|
|
||||||
|
this.url = url;
|
||||||
|
|
||||||
this.frame = document.createElement('div');
|
this.frame = document.createElement('div');
|
||||||
this.frame.style.overflow = 'hidden';
|
this.frame.style.overflow = 'hidden';
|
||||||
this.frame.style.position = 'absolute';
|
this.frame.style.position = 'absolute';
|
||||||
|
|||||||
@@ -18,19 +18,20 @@ OpenLayers.Tile.WFS.prototype =
|
|||||||
/** @type Array(String) */
|
/** @type Array(String) */
|
||||||
url: null,
|
url: null,
|
||||||
|
|
||||||
/**
|
/** TBD 3.0 - reorder the parameters to the init function to put URL
|
||||||
|
* as last, so we can continue to call tile.initialize()
|
||||||
|
* without changing the arguments.
|
||||||
|
*
|
||||||
* @constructor
|
* @constructor
|
||||||
*
|
*
|
||||||
* @param {OpenLayers.Layer} layer
|
* @param {OpenLayers.Layer} layer
|
||||||
* @param {OpenLayers.Pixel} position
|
* @param {OpenLayers.Pixel} position
|
||||||
* @param {OpenLayers.Bounds} bounds
|
* @param {OpenLayers.Bounds} bounds
|
||||||
* @param {Array} urls
|
* @param {String} url
|
||||||
* @param {OpenLayers.Size} size
|
* @param {OpenLayers.Size} size
|
||||||
*/
|
*/
|
||||||
initialize: function(layer, position, bounds, url, size) {
|
initialize: function(layer, position, bounds, url, size) {
|
||||||
var newArguments = arguments;
|
OpenLayers.Tile.prototype.initialize.apply(this, arguments);
|
||||||
newArguments = [layer, position, bounds, null, size];
|
|
||||||
OpenLayers.Tile.prototype.initialize.apply(this, newArguments);
|
|
||||||
this.url = url;
|
this.url = url;
|
||||||
this.features = new Array();
|
this.features = new Array();
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -173,7 +173,7 @@ OpenLayers.Util.createDiv = function(id, px, sz, imgURL, position,
|
|||||||
OpenLayers.Util.createImage = function(id, px, sz, imgURL, position, border,
|
OpenLayers.Util.createImage = function(id, px, sz, imgURL, position, border,
|
||||||
opacity, delayDisplay) {
|
opacity, delayDisplay) {
|
||||||
|
|
||||||
image = document.createElement("img");
|
var image = document.createElement("img");
|
||||||
|
|
||||||
//set generic properties
|
//set generic properties
|
||||||
if (!id) {
|
if (!id) {
|
||||||
|
|||||||
107
tests/Control/test_KeyboardDefaults.html
Normal file
107
tests/Control/test_KeyboardDefaults.html
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<script src="../../lib/OpenLayers.js"></script>
|
||||||
|
<script type="text/javascript"><!--
|
||||||
|
var map;
|
||||||
|
function test_01_Control_KeyboardDefaults_constructor (t) {
|
||||||
|
t.plan( 1 );
|
||||||
|
|
||||||
|
control = new OpenLayers.Control.KeyboardDefaults();
|
||||||
|
t.ok( control instanceof OpenLayers.Control.KeyboardDefaults,
|
||||||
|
"new OpenLayers.Control.KeyboardDefaults returns object" );
|
||||||
|
}
|
||||||
|
|
||||||
|
function test_02_Control_KeyboardDefaults_addControl (t) {
|
||||||
|
t.plan( 4 );
|
||||||
|
|
||||||
|
map = new OpenLayers.Map('map');
|
||||||
|
control = new OpenLayers.Control.KeyboardDefaults();
|
||||||
|
t.ok( control instanceof OpenLayers.Control.KeyboardDefaults,
|
||||||
|
"new OpenLayers.Control.KeyboardDefaults returns object" );
|
||||||
|
t.ok( map instanceof OpenLayers.Map,
|
||||||
|
"new OpenLayers.Map creates map" );
|
||||||
|
map.addControl(control);
|
||||||
|
t.ok( control.map === map, "Control.map is set to the map object" );
|
||||||
|
t.ok( map.controls[3] === control, "map.controls contains control" );
|
||||||
|
}
|
||||||
|
|
||||||
|
function test_03_Control_KeyboardDefaults_KeyDownEvent (t) {
|
||||||
|
t.plan( 10 );
|
||||||
|
|
||||||
|
var evt = {which: 1};
|
||||||
|
map = new OpenLayers.Map('map');
|
||||||
|
var layer = new OpenLayers.Layer.WMS("Test Layer",
|
||||||
|
"http://octo.metacarta.com/cgi-bin/mapserv?",
|
||||||
|
{map: "/mapdata/vmap_wms.map", layers: "basic"});
|
||||||
|
map.addLayer(layer);
|
||||||
|
control = new OpenLayers.Control.KeyboardDefaults();
|
||||||
|
map.addControl(control);
|
||||||
|
|
||||||
|
var centerLL = new OpenLayers.LonLat(0,0);
|
||||||
|
map.setCenter(centerLL,4);
|
||||||
|
|
||||||
|
|
||||||
|
evt.keyCode = OpenLayers.Event.KEY_LEFT;
|
||||||
|
control.defaultKeyDown(evt);
|
||||||
|
t.delay_call(
|
||||||
|
1, function() {
|
||||||
|
t.ok( map.getCenter().lon < centerLL.lon, "key left works correctly" );
|
||||||
|
evt.keyCode = OpenLayers.Event.KEY_RIGHT;
|
||||||
|
control.defaultKeyDown(evt);
|
||||||
|
},
|
||||||
|
1, function() {
|
||||||
|
t.ok( map.getCenter().lon == centerLL.lon, "key right works correctly" );
|
||||||
|
evt.keyCode = OpenLayers.Event.KEY_UP;
|
||||||
|
control.defaultKeyDown(evt);
|
||||||
|
},
|
||||||
|
1, function() {
|
||||||
|
t.ok( map.getCenter().lat > centerLL.lat, "key up works correctly" );
|
||||||
|
evt.keyCode = OpenLayers.Event.KEY_DOWN;
|
||||||
|
control.defaultKeyDown(evt);
|
||||||
|
},
|
||||||
|
1, function() {
|
||||||
|
t.ok( map.getCenter().lat == centerLL.lat, "key down works correctly" );
|
||||||
|
evt.keyCode = 33; //page up
|
||||||
|
control.defaultKeyDown(evt);
|
||||||
|
},
|
||||||
|
1, function() {
|
||||||
|
t.ok( map.getCenter().lat > centerLL.lat, "key page up works correctly" );
|
||||||
|
evt.keyCode = 34; //page down
|
||||||
|
control.defaultKeyDown(evt);
|
||||||
|
},
|
||||||
|
1, function() {
|
||||||
|
t.ok( map.getCenter().lat == centerLL.lat, "key page down works correctly" );
|
||||||
|
evt.keyCode = 35; //end
|
||||||
|
control.defaultKeyDown(evt);
|
||||||
|
},
|
||||||
|
1, function() {
|
||||||
|
t.ok( map.getCenter().lon > centerLL.lon, "key end works correctly" );
|
||||||
|
evt.keyCode = 36; //pos1
|
||||||
|
control.defaultKeyDown(evt);
|
||||||
|
},
|
||||||
|
1, function() {
|
||||||
|
t.ok( map.getCenter().lon == centerLL.lon, "key pos1 works correctly" );
|
||||||
|
evt.charCode = 43; //+
|
||||||
|
control.defaultKeyDown(evt);
|
||||||
|
},
|
||||||
|
1, function() {
|
||||||
|
t.eq( map.getZoom(), 5, "key + works correctly" );
|
||||||
|
// set zoomanimation flag manually,
|
||||||
|
// reason: loadend event in layers.js will not achieved in unittests
|
||||||
|
map.zoomanimationActive = false;
|
||||||
|
evt.charCode = 45; //-
|
||||||
|
control.defaultKeyDown(evt);
|
||||||
|
},
|
||||||
|
1, function() {
|
||||||
|
t.eq( map.getZoom(), 4, "key - works correctly" );
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// -->
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="map" style="width: 1024px; height: 512px;"/>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -36,29 +36,84 @@
|
|||||||
//ie can't simulate mouseclicks
|
//ie can't simulate mouseclicks
|
||||||
t.plan(0)
|
t.plan(0)
|
||||||
} else {
|
} else {
|
||||||
t.plan( 7 );
|
t.plan(35);
|
||||||
t.open_window( "Control/test_PanZoom.html", function( wnd ) {
|
t.open_window( "Control/test_PanZoom.html", function( wnd ) {
|
||||||
t.delay_call( 3, function() {
|
t.delay_call( 3, function() {
|
||||||
simulateClick(wnd, wnd.control.buttons[0]);
|
var flag;
|
||||||
|
function setFlag(evt) {
|
||||||
|
flag[evt.type] = true;
|
||||||
|
}
|
||||||
|
function resetFlags() {
|
||||||
|
flag = {
|
||||||
|
mousedown: false,
|
||||||
|
mouseup: false,
|
||||||
|
click: false,
|
||||||
|
dblclick: false
|
||||||
|
};
|
||||||
|
}
|
||||||
|
resetFlags();
|
||||||
|
|
||||||
|
wnd.mapper.events.register("mousedown", mapper, setFlag);
|
||||||
|
wnd.mapper.events.register("mouseup", mapper, setFlag);
|
||||||
|
wnd.mapper.events.register("click", mapper, setFlag);
|
||||||
|
wnd.mapper.events.register("dblclick", mapper, setFlag);
|
||||||
|
|
||||||
|
simulateClick(wnd, wnd.control.buttons[0]);
|
||||||
t.ok( wnd.mapper.getCenter().lat > wnd.centerLL.lat, "Pan up works correctly" );
|
t.ok( wnd.mapper.getCenter().lat > wnd.centerLL.lat, "Pan up works correctly" );
|
||||||
|
t.ok(!flag.mousedown, "mousedown does not get to the map");
|
||||||
|
t.ok(!flag.mouseup, "mouseup does not get to the map");
|
||||||
|
t.ok(!flag.click, "click does not get to the map");
|
||||||
|
t.ok(!flag.dblclick, "dblclick does not get to the map");
|
||||||
|
resetFlags();
|
||||||
|
|
||||||
simulateClick(wnd, wnd.control.buttons[1]);
|
simulateClick(wnd, wnd.control.buttons[1]);
|
||||||
t.ok( wnd.mapper.getCenter().lon < wnd.centerLL.lon, "Pan left works correctly" );
|
t.ok( wnd.mapper.getCenter().lon < wnd.centerLL.lon, "Pan left works correctly" );
|
||||||
|
t.ok(!flag.mousedown, "mousedown does not get to the map");
|
||||||
|
t.ok(!flag.mouseup, "mouseup does not get to the map");
|
||||||
|
t.ok(!flag.click, "click does not get to the map");
|
||||||
|
t.ok(!flag.dblclick, "dblclick does not get to the map");
|
||||||
|
resetFlags();
|
||||||
|
|
||||||
simulateClick(wnd, wnd.control.buttons[2]);
|
simulateClick(wnd, wnd.control.buttons[2]);
|
||||||
t.ok( wnd.mapper.getCenter().lon == wnd.centerLL.lon, "Pan right works correctly" );
|
t.ok( wnd.mapper.getCenter().lon == wnd.centerLL.lon, "Pan right works correctly" );
|
||||||
|
t.ok(!flag.mousedown, "mousedown does not get to the map");
|
||||||
|
t.ok(!flag.mouseup, "mouseup does not get to the map");
|
||||||
|
t.ok(!flag.click, "click does not get to the map");
|
||||||
|
t.ok(!flag.dblclick, "dblclick does not get to the map");
|
||||||
|
resetFlags();
|
||||||
|
|
||||||
simulateClick(wnd, wnd.control.buttons[3]);
|
simulateClick(wnd, wnd.control.buttons[3]);
|
||||||
t.ok( wnd.mapper.getCenter().lat == wnd.centerLL.lat, "Pan down works correctly" );
|
t.ok( wnd.mapper.getCenter().lat == wnd.centerLL.lat, "Pan down works correctly" );
|
||||||
|
t.ok(!flag.mousedown, "mousedown does not get to the map");
|
||||||
|
t.ok(!flag.mouseup, "mouseup does not get to the map");
|
||||||
|
t.ok(!flag.click, "click does not get to the map");
|
||||||
|
t.ok(!flag.dblclick, "dblclick does not get to the map");
|
||||||
|
resetFlags();
|
||||||
|
|
||||||
simulateClick(wnd, wnd.control.buttons[4]);
|
simulateClick(wnd, wnd.control.buttons[4]);
|
||||||
t.eq( wnd.mapper.getZoom(), 6, "zoomin works correctly" );
|
t.eq( wnd.mapper.getZoom(), 6, "zoomin works correctly" );
|
||||||
|
t.ok(!flag.mousedown, "mousedown does not get to the map");
|
||||||
|
t.ok(!flag.mouseup, "mouseup does not get to the map");
|
||||||
|
t.ok(!flag.click, "click does not get to the map");
|
||||||
|
t.ok(!flag.dblclick, "dblclick does not get to the map");
|
||||||
|
resetFlags();
|
||||||
|
|
||||||
simulateClick(wnd, wnd.control.buttons[6]);
|
simulateClick(wnd, wnd.control.buttons[6]);
|
||||||
t.eq( wnd.mapper.getZoom(), 5, "zoomout works correctly" );
|
t.eq( wnd.mapper.getZoom(), 5, "zoomout works correctly" );
|
||||||
|
t.ok(!flag.mousedown, "mousedown does not get to the map");
|
||||||
|
t.ok(!flag.mouseup, "mouseup does not get to the map");
|
||||||
|
t.ok(!flag.click, "click does not get to the map");
|
||||||
|
t.ok(!flag.dblclick, "dblclick does not get to the map");
|
||||||
|
resetFlags();
|
||||||
|
|
||||||
simulateClick(wnd, wnd.control.buttons[5]);
|
simulateClick(wnd, wnd.control.buttons[5]);
|
||||||
t.eq( wnd.mapper.getZoom(), 2, "zoomworld works correctly" );
|
t.eq( wnd.mapper.getZoom(), 2, "zoomworld works correctly" );
|
||||||
|
t.ok(!flag.mousedown, "mousedown does not get to the map");
|
||||||
|
t.ok(!flag.mouseup, "mouseup does not get to the map");
|
||||||
|
t.ok(!flag.click, "click does not get to the map");
|
||||||
|
t.ok(!flag.dblclick, "dblclick does not get to the map");
|
||||||
|
resetFlags();
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -67,7 +122,19 @@
|
|||||||
function simulateClick(wnd, elem) {
|
function simulateClick(wnd, elem) {
|
||||||
var evt = wnd.document.createEvent("MouseEvents");
|
var evt = wnd.document.createEvent("MouseEvents");
|
||||||
evt.initMouseEvent("mousedown", true, true, wnd, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
|
evt.initMouseEvent("mousedown", true, true, wnd, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
|
||||||
var canceled = !elem.dispatchEvent(evt);
|
elem.dispatchEvent(evt);
|
||||||
|
|
||||||
|
evt = wnd.document.createEvent("MouseEvents");
|
||||||
|
evt.initMouseEvent("mouseup", true, true, wnd, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
|
||||||
|
elem.dispatchEvent(evt);
|
||||||
|
|
||||||
|
evt = wnd.document.createEvent("MouseEvents");
|
||||||
|
evt.initMouseEvent("click", true, true, wnd, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
|
||||||
|
elem.dispatchEvent(evt);
|
||||||
|
|
||||||
|
evt = wnd.document.createEvent("MouseEvents");
|
||||||
|
evt.initMouseEvent("dblclick", true, true, wnd, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
|
||||||
|
elem.dispatchEvent(evt);
|
||||||
}
|
}
|
||||||
|
|
||||||
function loader() {
|
function loader() {
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
<head>
|
<head>
|
||||||
<script src="../../lib/OpenLayers.js"></script>
|
<script src="../../lib/OpenLayers.js"></script>
|
||||||
<script type="text/javascript"><!--
|
<script type="text/javascript"><!--
|
||||||
var isMozilla = (navigator.userAgent.indexOf("compatible") == -1);
|
|
||||||
var map;
|
var map;
|
||||||
var feature;
|
var feature;
|
||||||
|
|
||||||
|
|||||||
@@ -83,7 +83,7 @@
|
|||||||
coll.addComponents(new OpenLayers.Geometry.Point(10,10));
|
coll.addComponents(new OpenLayers.Geometry.Point(10,10));
|
||||||
coll2 = coll.clone();
|
coll2 = coll.clone();
|
||||||
t.ok( coll2 instanceof OpenLayers.Geometry.Collection, "coll.clone() returns collection object" );
|
t.ok( coll2 instanceof OpenLayers.Geometry.Collection, "coll.clone() returns collection object" );
|
||||||
t.eq( coll2.getComponents().length, 2, "coll2.components.length is set correctly");
|
t.eq( coll2.components.length, 2, "coll2.components.length is set correctly");
|
||||||
t.ok( coll2.components[0] instanceof OpenLayers.Geometry.Point,
|
t.ok( coll2.components[0] instanceof OpenLayers.Geometry.Point,
|
||||||
"coll2.components.length is set correctly");
|
"coll2.components.length is set correctly");
|
||||||
}
|
}
|
||||||
@@ -95,21 +95,12 @@
|
|||||||
coll.addComponents(point);
|
coll.addComponents(point);
|
||||||
coll.addComponents(new OpenLayers.Geometry.Point(10,10));
|
coll.addComponents(new OpenLayers.Geometry.Point(10,10));
|
||||||
coll.removeComponents(coll.components[0]);
|
coll.removeComponents(coll.components[0]);
|
||||||
t.eq( coll.getComponents().length, 1, "coll.components.length is smaller after removeComponent" );
|
t.eq( coll.components.length, 1, "coll.components.length is smaller after removeComponent" );
|
||||||
t.ok( coll.bounds == null, "bounds are nullified after call to remove (to trigger recalc on getBounds()");
|
t.ok( coll.bounds == null, "bounds are nullified after call to remove (to trigger recalc on getBounds()");
|
||||||
bounds = coll.getBounds();
|
bounds = coll.getBounds();
|
||||||
t.eq( bounds.left, 10, "left bound is 10 after removeComponent" );
|
t.eq( bounds.left, 10, "left bound is 10 after removeComponent" );
|
||||||
t.eq( bounds.bottom, 10, "bottom bound is 10 after removeComponent" );
|
t.eq( bounds.bottom, 10, "bottom bound is 10 after removeComponent" );
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_05_Collection_getComponents (t) {
|
|
||||||
t.plan(1);
|
|
||||||
|
|
||||||
coll = new OpenLayers.Geometry.Collection();
|
|
||||||
coll.components = {};
|
|
||||||
|
|
||||||
t.eq( coll.getComponents(), coll.components, "getComponents returns great");
|
|
||||||
}
|
|
||||||
|
|
||||||
function test_06_Collection_calculateBounds(t) {
|
function test_06_Collection_calculateBounds(t) {
|
||||||
t.plan( 9 );
|
t.plan( 9 );
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
t.eq( layer.name, "Test Layer", "layer.name is correct" );
|
t.eq( layer.name, "Test Layer", "layer.name is correct" );
|
||||||
t.ok( layer.id != null, "Layer is given an id");
|
t.ok( layer.id != null, "Layer is given an id");
|
||||||
t.ok( layer.projection, "none", "default layer projection correctly set");
|
t.eq( layer.projection, "none", "default layer projection correctly set");
|
||||||
t.ok( ((layer.chicken == 151) && (layer.foo == "bar")), "layer.options correctly set to Layer Object" );
|
t.ok( ((layer.chicken == 151) && (layer.foo == "bar")), "layer.options correctly set to Layer Object" );
|
||||||
t.ok( ((layer.options["chicken"] == 151) && (layer.options["foo"] == "bar")), "layer.options correctly backed up" );
|
t.ok( ((layer.options["chicken"] == 151) && (layer.options["foo"] == "bar")), "layer.options correctly backed up" );
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function test_50_Layer_Image_tileTests (t) {
|
function test_50_Layer_Image_tileTests (t) {
|
||||||
t.plan(4);
|
t.plan(9);
|
||||||
var map = new OpenLayers.Map('map');
|
var map = new OpenLayers.Map('map');
|
||||||
|
|
||||||
layer = new OpenLayers.Layer.Image('Test Layer',
|
layer = new OpenLayers.Layer.Image('Test Layer',
|
||||||
@@ -49,8 +49,20 @@
|
|||||||
|
|
||||||
map.addLayer(layer);
|
map.addLayer(layer);
|
||||||
map.zoomToMaxExtent();
|
map.zoomToMaxExtent();
|
||||||
t.eq(layer.tile.position.x,-40, "Tile x positioned correctly at maxextent");
|
t.ok(layer.imageSize, "layer.imageSize is set");
|
||||||
t.eq(layer.tile.position.y,107, "Tile y positioned correctly at maxextent");
|
t.ok(layer.tileSize, "layer.tileSize is set");
|
||||||
|
t.ok(layer.tileSize.equals(layer.imageSize), "tileSize equals imageSize");
|
||||||
|
|
||||||
|
// no resolution info was sent, so maxResolution should be calculated
|
||||||
|
// by aspectRatio*extent/size (this is the pixel aspect ratio)
|
||||||
|
var aspectRatio = (layer.extent.getHeight() / layer.size.h) /
|
||||||
|
(layer.extent.getWidth() / layer.size.w);
|
||||||
|
t.eq(aspectRatio, layer.aspectRatio, "aspectRatio is properly set");
|
||||||
|
var maxExtent = aspectRatio * layer.extent.getWidth() / layer.size.w;
|
||||||
|
t.eq(maxExtent, layer.maxResolution, "maxResolution is properly set");
|
||||||
|
|
||||||
|
t.eq(layer.tile.position.x,-42, "Tile x positioned correctly at maxextent");
|
||||||
|
t.eq(layer.tile.position.y,106, "Tile y positioned correctly at maxextent");
|
||||||
t.eq(layer.tile.imgDiv.src, "http://earthtrends.wri.org/images/maps/4_m_citylights_lg.gif", "URL is correct");
|
t.eq(layer.tile.imgDiv.src, "http://earthtrends.wri.org/images/maps/4_m_citylights_lg.gif", "URL is correct");
|
||||||
map.zoomIn();
|
map.zoomIn();
|
||||||
t.eq(layer.tile.imgDiv.src, "http://earthtrends.wri.org/images/maps/4_m_citylights_lg.gif", "URL is correct");
|
t.eq(layer.tile.imgDiv.src, "http://earthtrends.wri.org/images/maps/4_m_citylights_lg.gif", "URL is correct");
|
||||||
|
|||||||
@@ -147,7 +147,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
function test_10_Layer_KaMap_clone(t) {
|
function test_10_Layer_KaMap_clone(t) {
|
||||||
t.plan(4);
|
t.plan(5);
|
||||||
|
|
||||||
var options = {tileSize: new OpenLayers.Size(500,50)};
|
var options = {tileSize: new OpenLayers.Size(500,50)};
|
||||||
var map = new OpenLayers.Map('map', options);
|
var map = new OpenLayers.Map('map', options);
|
||||||
@@ -168,6 +168,8 @@
|
|||||||
t.eq( clone.tileSize.w, 500, "changing layer.tileSize does not change clone.tileSize -- a fresh copy was made, not just copied reference");
|
t.eq( clone.tileSize.w, 500, "changing layer.tileSize does not change clone.tileSize -- a fresh copy was made, not just copied reference");
|
||||||
|
|
||||||
t.eq( clone.alpha, layer.alpha, "alpha copied correctly");
|
t.eq( clone.alpha, layer.alpha, "alpha copied correctly");
|
||||||
|
|
||||||
|
t.eq( clone.CLASS_NAME, "OpenLayers.Layer.KaMap", "Clone is a ka-map layer");
|
||||||
|
|
||||||
layer.grid = null;
|
layer.grid = null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,8 +21,7 @@
|
|||||||
var layer = new OpenLayers.Layer.Vector(name);
|
var layer = new OpenLayers.Layer.Vector(name);
|
||||||
|
|
||||||
var point = new OpenLayers.Geometry.Point(-111.04, 45.68);
|
var point = new OpenLayers.Geometry.Point(-111.04, 45.68);
|
||||||
var pointFeature = new OpenLayers.Feature.Vector(layer, point);
|
var pointFeature = new OpenLayers.Feature.Vector(point);
|
||||||
|
|
||||||
layer.addFeatures([pointFeature]);
|
layer.addFeatures([pointFeature]);
|
||||||
|
|
||||||
t.eq(layer.features.length, 1, "OpenLayers.Layer.Vector.addFeatures adds something to the array");
|
t.eq(layer.features.length, 1, "OpenLayers.Layer.Vector.addFeatures adds something to the array");
|
||||||
@@ -30,7 +29,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function test_03_Layer_Vector_removeFeatures(t) {
|
function test_03_Layer_Vector_removeFeatures(t) {
|
||||||
t.plan(1);
|
t.plan(2);
|
||||||
|
|
||||||
var layer = new OpenLayers.Layer.Vector(name);
|
var layer = new OpenLayers.Layer.Vector(name);
|
||||||
|
|
||||||
@@ -43,6 +42,11 @@
|
|||||||
var features = layer.removeFeatures([pointFeature1]);
|
var features = layer.removeFeatures([pointFeature1]);
|
||||||
|
|
||||||
t.ok(layer.features.length == 1, "OpenLayers.Layer.Vector.removeFeatures removes a feature from the features array");
|
t.ok(layer.features.length == 1, "OpenLayers.Layer.Vector.removeFeatures removes a feature from the features array");
|
||||||
|
layer.addFeatures([pointFeature1.clone(), pointFeature2.clone()]);
|
||||||
|
var features = layer.removeFeatures(layer.features);
|
||||||
|
|
||||||
|
t.ok(layer.features.length == 0,
|
||||||
|
"OpenLayers.Layer.Vector.removeFeatures(layer.features) removes all feature from the features array");
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_Layer_Vector_addStyle (t) {
|
function test_Layer_Vector_addStyle (t) {
|
||||||
@@ -55,9 +59,70 @@
|
|||||||
layer.addFeatures(f);
|
layer.addFeatures(f);
|
||||||
t.ok( f.style != null, "Feature style is set by layer.");
|
t.ok( f.style != null, "Feature style is set by layer.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function test_Layer_Vector_drawFeature(t) {
|
||||||
|
t.plan(4);
|
||||||
|
var layer = new OpenLayers.Layer.Vector("Test Layer");
|
||||||
|
var map = new OpenLayers.Map('map');
|
||||||
|
map.addLayer(layer);
|
||||||
|
var geometry = new OpenLayers.Geometry.Point(10, 10);
|
||||||
|
var feature = new OpenLayers.Feature.Vector(geometry);
|
||||||
|
|
||||||
|
var f, s;
|
||||||
|
layer.renderer = {
|
||||||
|
drawFeature: function(feature, style) {
|
||||||
|
f = feature;
|
||||||
|
s = style;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
layer.drawFeature(feature);
|
||||||
|
t.ok(geometry.equals(f.geometry),
|
||||||
|
"calls layer.renderer.drawFeature() with feature.geometry");
|
||||||
|
|
||||||
|
feature.style = 'exists';
|
||||||
|
layer.drawFeature(feature);
|
||||||
|
t.eq(feature.style, s,
|
||||||
|
"calls layer.renderer.drawFeature() with feature.style");
|
||||||
|
|
||||||
|
feature.style = null;
|
||||||
|
layer.style = 'exists';
|
||||||
|
layer.drawFeature(feature);
|
||||||
|
t.eq(layer.style, s,
|
||||||
|
"given null feature style, uses layer style");
|
||||||
|
|
||||||
|
feature.style = 'exists';
|
||||||
|
layer.style = 'exists';
|
||||||
|
var customStyle = 'custom';
|
||||||
|
layer.drawFeature(feature, customStyle);
|
||||||
|
t.eq(customStyle, s,
|
||||||
|
"given a custom style, renders with that");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function test_Layer_Vector_eraseFeatures(t) {
|
||||||
|
t.plan(2);
|
||||||
|
var layer = new OpenLayers.Layer.Vector("Test Layer");
|
||||||
|
var map = new OpenLayers.Map('map');
|
||||||
|
map.addLayer(layer);
|
||||||
|
var geometry = new OpenLayers.Geometry.Point(10, 10);
|
||||||
|
var feature = new OpenLayers.Feature.Vector(geometry);
|
||||||
|
|
||||||
|
var f;
|
||||||
|
layer.renderer = {
|
||||||
|
eraseFeatures: function(features) {
|
||||||
|
f = features[0];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
layer.eraseFeatures([feature]);
|
||||||
|
t.ok(f, "calls layer.renderer.eraseFeatures");
|
||||||
|
t.ok(geometry.equals(f.geometry),
|
||||||
|
"calls layer.renderer.eraseFeatures() given an array of features");
|
||||||
|
}
|
||||||
|
|
||||||
function test_Layer_Vector_destroyFeatures (t) {
|
function test_Layer_Vector_destroyFeatures (t) {
|
||||||
t.plan(2);
|
t.plan(3);
|
||||||
layer = new OpenLayers.Layer.Vector(name);
|
layer = new OpenLayers.Layer.Vector(name);
|
||||||
var map = new OpenLayers.Map('map');
|
var map = new OpenLayers.Map('map');
|
||||||
map.addLayer(layer);
|
map.addLayer(layer);
|
||||||
@@ -68,8 +133,10 @@
|
|||||||
}
|
}
|
||||||
layer.addFeatures(features);
|
layer.addFeatures(features);
|
||||||
t.eq(layer.features.length, 5, "addFeatures adds 5 features");
|
t.eq(layer.features.length, 5, "addFeatures adds 5 features");
|
||||||
|
layer.selectedFeatures.push(features[0]);
|
||||||
layer.destroyFeatures();
|
layer.destroyFeatures();
|
||||||
t.eq(layer.features.length, 0, "destroyFeatures triggers removal");
|
t.eq(layer.features.length, 0, "destroyFeatures triggers removal");
|
||||||
|
t.eq(layer.selectedFeatures, [], "Destroy features removes selected features");
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_99_Layer_Vector_destroy (t) {
|
function test_99_Layer_Vector_destroy (t) {
|
||||||
|
|||||||
37
tests/Layer/test_WFS.html
Normal file
37
tests/Layer/test_WFS.html
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<script src="../../lib/OpenLayers.js"></script>
|
||||||
|
<script type="text/javascript"><!--
|
||||||
|
|
||||||
|
var name = "Vector Layer";
|
||||||
|
|
||||||
|
function test_01_Layer_WFS_constructor(t) {
|
||||||
|
t.plan(3);
|
||||||
|
|
||||||
|
var layer = new OpenLayers.Layer.WFS(name, "url", {});
|
||||||
|
t.ok(layer instanceof OpenLayers.Layer.WFS, "new OpenLayers.Layer.Vector returns correct object" );
|
||||||
|
t.eq(layer.name, name, "layer name is correctly set");
|
||||||
|
t.ok(layer.renderer.CLASS_NAME, "layer has a renderer");
|
||||||
|
|
||||||
|
}
|
||||||
|
function test_02_Layer_WFS_mapresizevector(t) {
|
||||||
|
t.plan(2);
|
||||||
|
|
||||||
|
var map = new OpenLayers.Map("map");
|
||||||
|
map.addLayer(new OpenLayers.Layer.WMS("WMS", "url", {}));
|
||||||
|
var layer = new OpenLayers.Layer.WFS(name, "url", {});
|
||||||
|
t.ok(layer.renderer.CLASS_NAME, "layer has a renderer");
|
||||||
|
map.addLayer(layer);
|
||||||
|
setSize = false;
|
||||||
|
layer.renderer.setSize = function() { setSize = true; }
|
||||||
|
layer.onMapResize();
|
||||||
|
t.eq(setSize, true, "Renderer resize called on map size change.");
|
||||||
|
|
||||||
|
}
|
||||||
|
// -->
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="map" style="width:500px;height:550px"></div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
362
tests/Marker/test_Box.html
Normal file
362
tests/Marker/test_Box.html
Normal file
@@ -0,0 +1,362 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<script src="../../lib/OpenLayers.js"></script>
|
||||||
|
<script type="text/javascript"><!--
|
||||||
|
var box;
|
||||||
|
|
||||||
|
function test_01_Box_constructor (t) {
|
||||||
|
t.plan( 7 );
|
||||||
|
|
||||||
|
OpenLayers.Marker.Box.prototype._setBorder =
|
||||||
|
OpenLayers.Marker.Box.prototype.setBorder;
|
||||||
|
OpenLayers.Marker.Box.prototype.setBorder = function (x,y) {
|
||||||
|
g_Color = x;
|
||||||
|
g_Width = y;
|
||||||
|
};
|
||||||
|
|
||||||
|
var bounds = new OpenLayers.Bounds(1,2,3,4);
|
||||||
|
var borderColor = "blue";
|
||||||
|
var borderWidth = 55;
|
||||||
|
|
||||||
|
|
||||||
|
g_Color = g_Width = null;
|
||||||
|
box = new OpenLayers.Marker.Box(bounds, borderColor, borderWidth);
|
||||||
|
|
||||||
|
t.ok( box instanceof OpenLayers.Marker.Box, "new OpenLayers.Marker.Box returns Box object" );
|
||||||
|
t.ok( box.bounds.equals(bounds), "bounds object correctly set");
|
||||||
|
t.ok( box.div != null, "div created");
|
||||||
|
t.eq( box.div.style.overflow, "hidden", "div style overflow hidden");
|
||||||
|
t.ok( box.events != null, "events object created");
|
||||||
|
t.eq( g_Color, borderColor, "setBorder called with correct border color");
|
||||||
|
t.eq( g_Width, borderWidth, "setBorder called with correct border width");
|
||||||
|
|
||||||
|
|
||||||
|
OpenLayers.Marker.Box.prototype.setBorder =
|
||||||
|
OpenLayers.Marker.Box.prototype._setBorder;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function test_02_Box_setBorder(t) {
|
||||||
|
t.plan( 2 );
|
||||||
|
|
||||||
|
var box = {
|
||||||
|
div: {
|
||||||
|
style: {}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
//defaults
|
||||||
|
var args = [];
|
||||||
|
OpenLayers.Marker.Box.prototype.setBorder.apply(box, args);
|
||||||
|
t.eq(box.div.style.border, "2px solid red", "style correctly set with no good values (defaults work)");
|
||||||
|
|
||||||
|
//good vals
|
||||||
|
var borderColor = "blue";
|
||||||
|
var borderWidth = 55;
|
||||||
|
|
||||||
|
args = [borderColor, borderWidth];
|
||||||
|
OpenLayers.Marker.Box.prototype.setBorder.apply(box, args);
|
||||||
|
t.eq(box.div.style.border, borderWidth + "px solid " + borderColor, "style correctly set with both good values");
|
||||||
|
|
||||||
|
}
|
||||||
|
function test_03_Box_draw(t) {
|
||||||
|
t.plan( 5 );
|
||||||
|
|
||||||
|
OpenLayers.Util._modifyDOMElement =
|
||||||
|
OpenLayers.Util.modifyDOMElement;
|
||||||
|
OpenLayers.Util.modifyDOMElement =
|
||||||
|
function (element, id, px, sz) {
|
||||||
|
g_Element = element;
|
||||||
|
g_Id = id;
|
||||||
|
g_Px = px;
|
||||||
|
g_Sz = sz;
|
||||||
|
};
|
||||||
|
|
||||||
|
var box = {
|
||||||
|
div: {}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
var px = {};
|
||||||
|
var sz = {};
|
||||||
|
var args = [px, sz];
|
||||||
|
|
||||||
|
g_Element = g_Id = g_Px = g_Sz = null;
|
||||||
|
var retVal = OpenLayers.Marker.Box.prototype.draw.apply(box, args);
|
||||||
|
|
||||||
|
t.eq(g_Element, box.div, "modifyDOMElement passes box's div for element");
|
||||||
|
t.eq(g_Id, null, "modifyDOMElement passes null for id");
|
||||||
|
t.eq(g_Px, px, "modifyDOMElement passes new px value for px");
|
||||||
|
t.eq(g_Sz, sz, "modifyDOMElement passes new sz value for sz");
|
||||||
|
t.ok(retVal == box.div, "draw returns box's div");
|
||||||
|
|
||||||
|
OpenLayers.Util.modifyDOMElement =
|
||||||
|
OpenLayers.Util._modifyDOMElement;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function test_04_Box_onScreen(t) {
|
||||||
|
t.plan( 2 );
|
||||||
|
|
||||||
|
var map = new OpenLayers.Map("map");
|
||||||
|
|
||||||
|
var url = "http://octo.metacarta.com/cgi-bin/mapserv";
|
||||||
|
layer = new OpenLayers.Layer.WMS(name, url);
|
||||||
|
|
||||||
|
map.addLayer(layer);
|
||||||
|
|
||||||
|
mlayer = new OpenLayers.Layer.Boxes('Test Layer');
|
||||||
|
map.addLayer(mlayer);
|
||||||
|
|
||||||
|
map.zoomToExtent(new OpenLayers.Bounds(-50,-50,50,50));
|
||||||
|
|
||||||
|
//onscreen box
|
||||||
|
var bounds = new OpenLayers.Bounds(-1,-1,1,1);
|
||||||
|
var box = new OpenLayers.Marker.Box(bounds);
|
||||||
|
mlayer.addMarker(box);
|
||||||
|
|
||||||
|
t.ok( box.onScreen(), "box knows it's onscreen" );
|
||||||
|
|
||||||
|
//offscreen box
|
||||||
|
var bounds = new OpenLayers.Bounds(100,100,150,150);
|
||||||
|
var box2 = new OpenLayers.Marker.Box(bounds);
|
||||||
|
mlayer.addMarker(box2);
|
||||||
|
|
||||||
|
t.ok( !box2.onScreen(), "box knows it's offscreen" );
|
||||||
|
map.destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
function test_05_Box_display(t) {
|
||||||
|
t.plan( 2 );
|
||||||
|
|
||||||
|
var box = {
|
||||||
|
div: {
|
||||||
|
style: {}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
//display(true)
|
||||||
|
var args = [true];
|
||||||
|
OpenLayers.Marker.Box.prototype.display.apply(box, args);
|
||||||
|
t.eq(box.div.style.display, "", "style.display correctly set to '' when display(true)");
|
||||||
|
|
||||||
|
//display(false)
|
||||||
|
var args = [false];
|
||||||
|
OpenLayers.Marker.Box.prototype.display.apply(box, args);
|
||||||
|
t.eq(box.div.style.display, "none", "style.display correctly set to 'none' when display(false)");
|
||||||
|
}
|
||||||
|
|
||||||
|
function test_99_Box_destroy(t) {
|
||||||
|
t.plan(3);
|
||||||
|
|
||||||
|
OpenLayers.Marker.prototype._destroy =
|
||||||
|
OpenLayers.Marker.prototype.destroy;
|
||||||
|
OpenLayers.Marker.prototype.destroy = function() {
|
||||||
|
g_Destroy = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
var bounds = new OpenLayers.Bounds(1,2,3,4);
|
||||||
|
var borderColor = "blue";
|
||||||
|
var borderWidth = 55;
|
||||||
|
|
||||||
|
g_Destroy = null;
|
||||||
|
box = new OpenLayers.Marker.Box(bounds, borderColor, borderWidth);
|
||||||
|
box.destroy();
|
||||||
|
|
||||||
|
t.eq(box.bounds, null, "bounds nullified");
|
||||||
|
t.eq(box.div, null, "div nullified");
|
||||||
|
t.ok(g_Destroy == true, "OpenLayers.Marker.destroy() called");
|
||||||
|
|
||||||
|
|
||||||
|
OpenLayers.Marker.prototype.destroy =
|
||||||
|
OpenLayers.Marker.prototype._destroy;
|
||||||
|
}
|
||||||
|
|
||||||
|
// -->
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="map" style="width:500px;height:550px"></div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<script src="../../lib/OpenLayers.js"></script>
|
||||||
|
<script type="text/javascript"><!--
|
||||||
|
var box;
|
||||||
|
|
||||||
|
function test_01_Box_constructor (t) {
|
||||||
|
t.plan( 7 );
|
||||||
|
|
||||||
|
OpenLayers.Marker.Box.prototype._setBorder =
|
||||||
|
OpenLayers.Marker.Box.prototype.setBorder;
|
||||||
|
OpenLayers.Marker.Box.prototype.setBorder = function (x,y) {
|
||||||
|
g_Color = x;
|
||||||
|
g_Width = y;
|
||||||
|
};
|
||||||
|
|
||||||
|
var bounds = new OpenLayers.Bounds(1,2,3,4);
|
||||||
|
var borderColor = "blue";
|
||||||
|
var borderWidth = 55;
|
||||||
|
|
||||||
|
|
||||||
|
g_Color = g_Width = null;
|
||||||
|
box = new OpenLayers.Marker.Box(bounds, borderColor, borderWidth);
|
||||||
|
|
||||||
|
t.ok( box instanceof OpenLayers.Marker.Box, "new OpenLayers.Marker.Box returns Box object" );
|
||||||
|
t.ok( box.bounds.equals(bounds), "bounds object correctly set");
|
||||||
|
t.ok( box.div != null, "div created");
|
||||||
|
t.eq( box.div.style.overflow, "hidden", "div style overflow hidden");
|
||||||
|
t.ok( box.events != null, "events object created");
|
||||||
|
t.eq( g_Color, borderColor, "setBorder called with correct border color");
|
||||||
|
t.eq( g_Width, borderWidth, "setBorder called with correct border width");
|
||||||
|
|
||||||
|
|
||||||
|
OpenLayers.Marker.Box.prototype.setBorder =
|
||||||
|
OpenLayers.Marker.Box.prototype._setBorder;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function test_02_Box_setBorder(t) {
|
||||||
|
t.plan( 2 );
|
||||||
|
|
||||||
|
var box = {
|
||||||
|
div: {
|
||||||
|
style: {}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
//defaults
|
||||||
|
var args = [];
|
||||||
|
OpenLayers.Marker.Box.prototype.setBorder.apply(box, args);
|
||||||
|
t.eq(box.div.style.border, "2px solid red", "style correctly set with no good values (defaults work)");
|
||||||
|
|
||||||
|
//good vals
|
||||||
|
var borderColor = "blue";
|
||||||
|
var borderWidth = 55;
|
||||||
|
|
||||||
|
args = [borderColor, borderWidth];
|
||||||
|
OpenLayers.Marker.Box.prototype.setBorder.apply(box, args);
|
||||||
|
t.eq(box.div.style.border, borderWidth + "px solid " + borderColor, "style correctly set with both good values");
|
||||||
|
|
||||||
|
}
|
||||||
|
function test_03_Box_draw(t) {
|
||||||
|
t.plan( 5 );
|
||||||
|
|
||||||
|
OpenLayers.Util._modifyDOMElement =
|
||||||
|
OpenLayers.Util.modifyDOMElement;
|
||||||
|
OpenLayers.Util.modifyDOMElement =
|
||||||
|
function (element, id, px, sz) {
|
||||||
|
g_Element = element;
|
||||||
|
g_Id = id;
|
||||||
|
g_Px = px;
|
||||||
|
g_Sz = sz;
|
||||||
|
};
|
||||||
|
|
||||||
|
var box = {
|
||||||
|
div: {}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
var px = {};
|
||||||
|
var sz = {};
|
||||||
|
var args = [px, sz];
|
||||||
|
|
||||||
|
g_Element = g_Id = g_Px = g_Sz = null;
|
||||||
|
var retVal = OpenLayers.Marker.Box.prototype.draw.apply(box, args);
|
||||||
|
|
||||||
|
t.eq(g_Element, box.div, "modifyDOMElement passes box's div for element");
|
||||||
|
t.eq(g_Id, null, "modifyDOMElement passes null for id");
|
||||||
|
t.eq(g_Px, px, "modifyDOMElement passes new px value for px");
|
||||||
|
t.eq(g_Sz, sz, "modifyDOMElement passes new sz value for sz");
|
||||||
|
t.ok(retVal == box.div, "draw returns box's div");
|
||||||
|
|
||||||
|
OpenLayers.Util.modifyDOMElement =
|
||||||
|
OpenLayers.Util._modifyDOMElement;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function test_04_Box_onScreen(t) {
|
||||||
|
t.plan( 2 );
|
||||||
|
|
||||||
|
var map = new OpenLayers.Map("map");
|
||||||
|
|
||||||
|
var url = "http://octo.metacarta.com/cgi-bin/mapserv";
|
||||||
|
layer = new OpenLayers.Layer.WMS(name, url);
|
||||||
|
|
||||||
|
map.addLayer(layer);
|
||||||
|
|
||||||
|
mlayer = new OpenLayers.Layer.Boxes('Test Layer');
|
||||||
|
map.addLayer(mlayer);
|
||||||
|
|
||||||
|
map.zoomToExtent(new OpenLayers.Bounds(-50,-50,50,50));
|
||||||
|
|
||||||
|
//onscreen box
|
||||||
|
var bounds = new OpenLayers.Bounds(-1,-1,1,1);
|
||||||
|
var box = new OpenLayers.Marker.Box(bounds);
|
||||||
|
mlayer.addMarker(box);
|
||||||
|
|
||||||
|
t.ok( box.onScreen(), "box knows it's onscreen" );
|
||||||
|
|
||||||
|
//offscreen box
|
||||||
|
var bounds = new OpenLayers.Bounds(100,100,150,150);
|
||||||
|
var box2 = new OpenLayers.Marker.Box(bounds);
|
||||||
|
mlayer.addMarker(box2);
|
||||||
|
|
||||||
|
t.ok( !box2.onScreen(), "box knows it's offscreen" );
|
||||||
|
map.destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
function test_05_Box_display(t) {
|
||||||
|
t.plan( 2 );
|
||||||
|
|
||||||
|
var box = {
|
||||||
|
div: {
|
||||||
|
style: {}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
//display(true)
|
||||||
|
var args = [true];
|
||||||
|
OpenLayers.Marker.Box.prototype.display.apply(box, args);
|
||||||
|
t.eq(box.div.style.display, "", "style.display correctly set to '' when display(true)");
|
||||||
|
|
||||||
|
//display(false)
|
||||||
|
var args = [false];
|
||||||
|
OpenLayers.Marker.Box.prototype.display.apply(box, args);
|
||||||
|
t.eq(box.div.style.display, "none", "style.display correctly set to 'none' when display(false)");
|
||||||
|
}
|
||||||
|
|
||||||
|
function test_99_Box_destroy(t) {
|
||||||
|
t.plan(3);
|
||||||
|
|
||||||
|
OpenLayers.Marker.prototype._destroy =
|
||||||
|
OpenLayers.Marker.prototype.destroy;
|
||||||
|
OpenLayers.Marker.prototype.destroy = function() {
|
||||||
|
g_Destroy = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
var bounds = new OpenLayers.Bounds(1,2,3,4);
|
||||||
|
var borderColor = "blue";
|
||||||
|
var borderWidth = 55;
|
||||||
|
|
||||||
|
g_Destroy = null;
|
||||||
|
box = new OpenLayers.Marker.Box(bounds, borderColor, borderWidth);
|
||||||
|
box.destroy();
|
||||||
|
|
||||||
|
t.eq(box.bounds, null, "bounds nullified");
|
||||||
|
t.eq(box.div, null, "div nullified");
|
||||||
|
t.ok(g_Destroy == true, "OpenLayers.Marker.destroy() called");
|
||||||
|
|
||||||
|
|
||||||
|
OpenLayers.Marker.prototype.destroy =
|
||||||
|
OpenLayers.Marker.prototype._destroy;
|
||||||
|
}
|
||||||
|
|
||||||
|
// -->
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="map" style="width:500px;height:550px"></div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -20,6 +20,7 @@
|
|||||||
<li>Format/test_WKT.html</li>
|
<li>Format/test_WKT.html</li>
|
||||||
<li>test_Icon.html</li>
|
<li>test_Icon.html</li>
|
||||||
<li>test_Marker.html</li>
|
<li>test_Marker.html</li>
|
||||||
|
<li>Marker/test_Box.html</li>
|
||||||
<li>test_Popup.html</li>
|
<li>test_Popup.html</li>
|
||||||
<li>test_Feature.html</li>
|
<li>test_Feature.html</li>
|
||||||
<li>Feature/test_Vector.html</li>
|
<li>Feature/test_Vector.html</li>
|
||||||
@@ -41,6 +42,7 @@
|
|||||||
<li>Layer/test_MapServer_Untiled.html</li>
|
<li>Layer/test_MapServer_Untiled.html</li>
|
||||||
<li>Layer/test_Text.html</li>
|
<li>Layer/test_Text.html</li>
|
||||||
<li>Layer/test_WMS.html</li>
|
<li>Layer/test_WMS.html</li>
|
||||||
|
<li>Layer/test_WFS.html</li>
|
||||||
<li>Layer/test_TMS.html</li>
|
<li>Layer/test_TMS.html</li>
|
||||||
<li>Layer/test_Vector.html</li>
|
<li>Layer/test_Vector.html</li>
|
||||||
<li>Layer/test_GML.html</li>
|
<li>Layer/test_GML.html</li>
|
||||||
|
|||||||
@@ -178,11 +178,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function test_99_Geometry_destroy(t) {
|
function test_99_Geometry_destroy(t) {
|
||||||
t.plan( 3 );
|
t.plan( 2 );
|
||||||
|
|
||||||
var g = new OpenLayers.Geometry();
|
var g = new OpenLayers.Geometry();
|
||||||
g.bounds = new OpenLayers.Bounds();
|
g.bounds = new OpenLayers.Bounds();
|
||||||
g.feature = new Object();
|
|
||||||
|
|
||||||
g_style_destroy = null;
|
g_style_destroy = null;
|
||||||
g.destroy();
|
g.destroy();
|
||||||
@@ -190,7 +189,6 @@
|
|||||||
t.eq(g.id, null, "id nullified");
|
t.eq(g.id, null, "id nullified");
|
||||||
|
|
||||||
t.eq(g.bounds, null, "bounds nullified");
|
t.eq(g.bounds, null, "bounds nullified");
|
||||||
t.eq(g.feature, null, "feature reference nullified");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -118,7 +118,7 @@
|
|||||||
|
|
||||||
function test_05_Layer_visibility(t) {
|
function test_05_Layer_visibility(t) {
|
||||||
|
|
||||||
t.plan(3)
|
t.plan(5)
|
||||||
|
|
||||||
var layer = new OpenLayers.Layer('Test Layer');
|
var layer = new OpenLayers.Layer('Test Layer');
|
||||||
|
|
||||||
@@ -129,6 +129,22 @@
|
|||||||
|
|
||||||
layer.setVisibility(true);
|
layer.setVisibility(true);
|
||||||
t.eq(layer.getVisibility(), true, "setVisibility true works");
|
t.eq(layer.getVisibility(), true, "setVisibility true works");
|
||||||
|
|
||||||
|
// Need a map in order to have moveTo called.
|
||||||
|
// Tests added for #654.
|
||||||
|
var layer = new OpenLayers.Layer.WMS('Test Layer','http://example.com');
|
||||||
|
var m = new OpenLayers.Map('map');
|
||||||
|
m.addLayer(layer);
|
||||||
|
m.zoomToMaxExtent();
|
||||||
|
|
||||||
|
layermoved = false;
|
||||||
|
layer.moveTo = function() { layermoved = true; }
|
||||||
|
|
||||||
|
layer.setVisibility(false);
|
||||||
|
t.eq(layermoved, false, "Layer didn't move when calling setvis false");
|
||||||
|
|
||||||
|
layer.setVisibility(true);
|
||||||
|
t.eq(layermoved, true, "Layer moved when calling setvis true.");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -89,16 +89,20 @@ div.olControlMousePosition {
|
|||||||
|
|
||||||
.olControlNavToolbar .olControlNavigationItemActive {
|
.olControlNavToolbar .olControlNavigationItemActive {
|
||||||
background-image: url("img/panning-hand-on.png");
|
background-image: url("img/panning-hand-on.png");
|
||||||
|
background-repeat: no-repeat;
|
||||||
}
|
}
|
||||||
.olControlNavToolbar .olControlNavigationItemInactive {
|
.olControlNavToolbar .olControlNavigationItemInactive {
|
||||||
background-image: url("img/panning-hand-off.png");
|
background-image: url("img/panning-hand-off.png");
|
||||||
|
background-repeat: no-repeat;
|
||||||
}
|
}
|
||||||
.olControlNavToolbar .olControlZoomBoxItemActive {
|
.olControlNavToolbar .olControlZoomBoxItemActive {
|
||||||
background-image: url("img/drag-rectangle-on.png");
|
background-image: url("img/drag-rectangle-on.png");
|
||||||
background-color: orange;
|
background-color: orange;
|
||||||
|
background-repeat: no-repeat;
|
||||||
}
|
}
|
||||||
.olControlNavToolbar .olControlZoomBoxItemInactive {
|
.olControlNavToolbar .olControlZoomBoxItemInactive {
|
||||||
background-image: url("img/drag-rectangle-off.png");
|
background-image: url("img/drag-rectangle-off.png");
|
||||||
|
background-repeat: no-repeat;
|
||||||
}
|
}
|
||||||
.olControlEditingToolbar {
|
.olControlEditingToolbar {
|
||||||
float:right;
|
float:right;
|
||||||
@@ -114,25 +118,33 @@ div.olControlMousePosition {
|
|||||||
}
|
}
|
||||||
.olControlEditingToolbar .olControlNavigationItemActive {
|
.olControlEditingToolbar .olControlNavigationItemActive {
|
||||||
background-image: url("img/pan_on.png");
|
background-image: url("img/pan_on.png");
|
||||||
|
background-repeat: no-repeat;
|
||||||
}
|
}
|
||||||
.olControlEditingToolbar .olControlNavigationItemInactive {
|
.olControlEditingToolbar .olControlNavigationItemInactive {
|
||||||
background-image: url("img/pan_off.png");
|
background-image: url("img/pan_off.png");
|
||||||
|
background-repeat: no-repeat;
|
||||||
}
|
}
|
||||||
.olControlEditingToolbar .olControlDrawFeaturePointItemActive {
|
.olControlEditingToolbar .olControlDrawFeaturePointItemActive {
|
||||||
background-image: url("img/draw_point_on.png");
|
background-image: url("img/draw_point_on.png");
|
||||||
|
background-repeat: no-repeat;
|
||||||
}
|
}
|
||||||
.olControlEditingToolbar .olControlDrawFeaturePointItemInactive {
|
.olControlEditingToolbar .olControlDrawFeaturePointItemInactive {
|
||||||
background-image: url("img/draw_point_off.png");
|
background-image: url("img/draw_point_off.png");
|
||||||
|
background-repeat: no-repeat;
|
||||||
}
|
}
|
||||||
.olControlEditingToolbar .olControlDrawFeaturePathItemInactive {
|
.olControlEditingToolbar .olControlDrawFeaturePathItemInactive {
|
||||||
background-image: url("img/draw_line_off.png");
|
background-image: url("img/draw_line_off.png");
|
||||||
|
background-repeat: no-repeat;
|
||||||
}
|
}
|
||||||
.olControlEditingToolbar .olControlDrawFeaturePathItemActive {
|
.olControlEditingToolbar .olControlDrawFeaturePathItemActive {
|
||||||
background-image: url("img/draw_line_on.png");
|
background-image: url("img/draw_line_on.png");
|
||||||
|
background-repeat: no-repeat;
|
||||||
}
|
}
|
||||||
.olControlEditingToolbar .olControlDrawFeaturePolygonItemInactive {
|
.olControlEditingToolbar .olControlDrawFeaturePolygonItemInactive {
|
||||||
background-image: url("img/draw_polygon_off.png");
|
background-image: url("img/draw_polygon_off.png");
|
||||||
|
background-repeat: no-repeat;
|
||||||
}
|
}
|
||||||
.olControlEditingToolbar .olControlDrawFeaturePolygonItemActive {
|
.olControlEditingToolbar .olControlDrawFeaturePolygonItemActive {
|
||||||
background-image: url("img/draw_polygon_on.png");
|
background-image: url("img/draw_polygon_on.png");
|
||||||
|
background-repeat: no-repeat;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -117,9 +117,9 @@ class Config:
|
|||||||
"""
|
"""
|
||||||
Parses the content of the named file and stores the values.
|
Parses the content of the named file and stores the values.
|
||||||
"""
|
"""
|
||||||
lines = [line[:-1] # Assumes end-of-line character is present
|
lines = [line.strip() # Assumes end-of-line character is present
|
||||||
for line in open(filename)
|
for line in open(filename)
|
||||||
if line != "\n"] # Skip blank lines
|
if line.strip()] # Skip blank lines
|
||||||
|
|
||||||
self.forceFirst = lines[lines.index("[first]") + 1:lines.index("[last]")]
|
self.forceFirst = lines[lines.index("[first]") + 1:lines.index("[last]")]
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ VERSION=$1
|
|||||||
echo "Building OpenLayers $VERSION"
|
echo "Building OpenLayers $VERSION"
|
||||||
svn export http://svn.openlayers.org/tags/openlayers/release-$VERSION OpenLayers-$VERSION
|
svn export http://svn.openlayers.org/tags/openlayers/release-$VERSION OpenLayers-$VERSION
|
||||||
cd OpenLayers-$VERSION/build
|
cd OpenLayers-$VERSION/build
|
||||||
./build.sh
|
./build.py full
|
||||||
mkdir /www/openlayers/htdocs/api/$VERSION
|
mkdir /www/openlayers/htdocs/api/$VERSION
|
||||||
cp OpenLayers.js /www/openlayers/htdocs/api/$VERSION
|
cp OpenLayers.js /www/openlayers/htdocs/api/$VERSION
|
||||||
cd ..
|
cd ..
|
||||||
|
|||||||
Reference in New Issue
Block a user