Bringing back the pre-r7652 behavior that allows changing the node type for features that have already been rendered. This is important when re-rendering a feature with a new style, e.g. when switching from externalGraphic to graphicName point symbolizers. r=elemoine (closes #1662)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@7944 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -506,44 +506,34 @@ OpenLayers.Renderer.Elements = OpenLayers.Class(OpenLayers.Renderer, {
|
|||||||
*/
|
*/
|
||||||
redrawNode: function(id, geometry, style, featureId) {
|
redrawNode: function(id, geometry, style, featureId) {
|
||||||
// Get the node if it's already on the map.
|
// Get the node if it's already on the map.
|
||||||
var currentNode = OpenLayers.Util.getElement(id);
|
var node = this.nodeFactory(id, this.getNodeType(geometry, style));
|
||||||
|
|
||||||
// Create a new node, or use the current one if it's
|
|
||||||
// already there.
|
|
||||||
var newNode;
|
|
||||||
if (!currentNode) {
|
|
||||||
var nodeType = this.getNodeType(geometry, style);
|
|
||||||
newNode = this.createNode(nodeType, id);
|
|
||||||
} else {
|
|
||||||
newNode = currentNode;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set the data for the node, then draw it.
|
// Set the data for the node, then draw it.
|
||||||
newNode._featureId = featureId;
|
node._featureId = featureId;
|
||||||
newNode._geometry = geometry;
|
node._geometry = geometry;
|
||||||
newNode._geometryClass = geometry.CLASS_NAME;
|
node._geometryClass = geometry.CLASS_NAME;
|
||||||
newNode._style = style;
|
node._style = style;
|
||||||
|
|
||||||
var drawResult = this.drawGeometryNode(newNode, geometry, style);
|
var drawResult = this.drawGeometryNode(node, geometry, style);
|
||||||
if(drawResult === false) {
|
if(drawResult === false) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
newNode = drawResult.node;
|
node = drawResult.node;
|
||||||
|
|
||||||
// Insert the node into the indexer so it can show us where to
|
// Insert the node into the indexer so it can show us where to
|
||||||
// place it. Note that this operation is O(log(n)). If there's a
|
// place it. Note that this operation is O(log(n)). If there's a
|
||||||
// performance problem (when dragging, for instance) this is
|
// performance problem (when dragging, for instance) this is
|
||||||
// likely where it would be.
|
// likely where it would be.
|
||||||
var insert = this.indexer ? this.indexer.insert(newNode) : null;
|
var insert = this.indexer ? this.indexer.insert(node) : null;
|
||||||
|
|
||||||
if(insert) {
|
if(insert) {
|
||||||
this.root.insertBefore(newNode, insert);
|
this.root.insertBefore(node, insert);
|
||||||
} else {
|
} else {
|
||||||
this.root.appendChild(newNode);
|
this.root.appendChild(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.postDraw(newNode);
|
this.postDraw(node);
|
||||||
|
|
||||||
return drawResult.complete;
|
return drawResult.complete;
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user