Merge pull request #2764 from fredj/remove-rtree-example

Remove rtree example
This commit is contained in:
Frédéric Junod
2014-09-29 14:37:41 +02:00
3 changed files with 0 additions and 179 deletions

View File

@@ -1,51 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
<link rel="stylesheet" href="../css/ol.css" type="text/css">
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap.min.css" type="text/css">
<link rel="stylesheet" href="../resources/layout.css" type="text/css">
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap-responsive.min.css" type="text/css">
<title>R-Tree example</title>
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="./"><img src="../resources/logo.png"> OpenLayers 3 Examples</a>
</div>
</div>
</div>
<div class="container-fluid">
<div class="row-fluid">
<div class="span12">
<div id="map" class="map"></div>
</div>
</div>
<div class="row-fluid">
<div class="span12">
<h4 id="title">R-Tree example</h4>
<p id="shortdesc">R-Tree example. Please note that this example only works locally, it does not work when the examples are hosted. This is because it accesses internals the R-Tree data structure, which are not exported in the API.</p>
<div id="docs">
<p>See the <a href="rtree.js" target="_blank">rtree.js source</a> to see how this is done.</p>
</div>
<div id="tags">vector, rtree</div>
</div>
</div>
</div>
<script src="jquery.min.js" type="text/javascript"></script>
<script src="../resources/example-behaviour.js" type="text/javascript"></script>
<script src="loader.js?id=rtree" type="text/javascript"></script>
</body>
</html>

View File

@@ -1,105 +0,0 @@
// NOCOMPILE
// FIXME this example dives into private members and will never compile :)
goog.require('ol.Feature');
goog.require('ol.Map');
goog.require('ol.View');
goog.require('ol.extent');
goog.require('ol.geom.Point');
goog.require('ol.geom.Polygon');
goog.require('ol.layer.Vector');
goog.require('ol.source.Vector');
goog.require('ol.style.Circle');
goog.require('ol.style.Stroke');
goog.require('ol.style.Style');
var i, ii, j, jj;
var count = 2000;
var features = new Array(count);
var e = 18000000;
for (i = 0; i < count; ++i) {
features[i] = new ol.Feature({
'geometry': new ol.geom.Point(
[2 * e * Math.random() - e, 2 * e * Math.random() - e])
});
}
var vectorSource = new ol.source.Vector({
features: features
});
var styleArray = [new ol.style.Style({
image: new ol.style.Circle({
radius: 3,
fill: null,
stroke: new ol.style.Stroke({color: 'red', width: 1})
})
})];
var colors = ['red', 'orange', 'yellow', 'green', 'blue', 'indigo', 'violet'];
var depthStyle = [];
for (i = 0, ii = colors.length; i < ii; ++i) {
depthStyle[i] = new ol.style.Style({
fill: null,
image: null,
stroke: new ol.style.Stroke({
color: colors[i],
width: (7 - i) / 2
}),
zIndex: i
});
}
var extentsByDepth = [];
vectorSource.rBush_.forEachNode(function(node) {
if (node.height > 0) {
if (goog.isDef(extentsByDepth[node.height])) {
extentsByDepth[node.height].push(node.extent);
} else {
extentsByDepth[node.height] = [node.extent];
}
}
});
var rtreeExtentFeatures = [];
for (i = 0, ii = extentsByDepth.length; i < ii; ++i) {
var extents = extentsByDepth[i];
if (!goog.isDef(extents)) {
continue;
}
for (j = 0, jj = extents.length; j < jj; ++j) {
var extent = extents[j];
var geometry = new ol.geom.Polygon([[
ol.extent.getBottomLeft(extent),
ol.extent.getTopLeft(extent),
ol.extent.getTopRight(extent),
ol.extent.getBottomRight(extent)
]]);
var feature = new ol.Feature({
'geometry': geometry,
'styleArray': [depthStyle[i]]
});
rtreeExtentFeatures.push(feature);
}
}
var vector = new ol.layer.Vector({
source: vectorSource,
style: styleArray
});
var rtree = new ol.layer.Vector({
source: new ol.source.Vector({
features: rtreeExtentFeatures
}),
style: function(feature, resolution) {
return feature.get('styleArray');
}
});
var map = new ol.Map({
layers: [vector, rtree],
target: 'map',
view: new ol.View({
center: [0, 0],
zoom: 2
})
});

View File

@@ -505,29 +505,6 @@ ol.structs.RBush.prototype.forEachInExtent_ =
};
/**
* @param {function(this: S, ol.structs.RBushNode.<T>): *} callback Callback.
* @param {S=} opt_this The object to use as `this` in `callback`.
* @return {*} Callback return value.
* @template S
*/
ol.structs.RBush.prototype.forEachNode = function(callback, opt_this) {
/** @type {Array.<ol.structs.RBushNode.<T>>} */
var toVisit = [this.root_];
while (toVisit.length > 0) {
var node = toVisit.pop();
var result = callback.call(opt_this, node);
if (result) {
return result;
}
if (!node.isLeaf()) {
toVisit.push.apply(toVisit, node.children);
}
}
return undefined;
};
/**
* @return {Array.<T>} All.
*/