OpenLayers OpenLayers

Ticket #1398: squarepoint-r6376.patch

File squarepoint-r6376.patch, 1.7 kB (added by achipa, 6 months ago)
  • lib/OpenLayers/Renderer/SVG.js

    old new  
    154154        switch (geometry.CLASS_NAME) { 
    155155            case "OpenLayers.Geometry.Point": 
    156156                nodeType = style.externalGraphic ? "image" : "circle"; 
     157        if (nodeType == "circle" && style.pointStyle == "square") nodeType = "rect"; 
    157158                break; 
    158159            case "OpenLayers.Geometry.Rectangle": 
    159160                nodeType = "rect"; 
     
    219220                node.setAttributeNS(null, "style", "opacity: "+opacity); 
    220221            } else { 
    221222                node.setAttributeNS(null, "r", style.pointRadius); 
     223                if (style.pointStyle == "square"){ 
     224                    node.setAttributeNS(null, "pointStyle", "square"); 
     225                } 
    222226            } 
    223227        } 
    224228         
     
    315319     * geometry - {<OpenLayers.Geometry>} 
    316320     */  
    317321    drawPoint: function(node, geometry) { 
    318         this.drawCircle(node, geometry, 1); 
     322        if (node._style.pointStyle == "square") { 
     323            var size = node._style.pointRadius * this.getResolution(); 
     324            this.drawRectangle(node, {x: (geometry.x - size/2), y: (geometry.y + size/2), width: size, height: size})  
     325     } else { 
     326            this.drawCircle(node, geometry, 1); 
     327     } 
    319328    }, 
    320329 
    321330    /** 
     
    414423        var resolution = this.getResolution(); 
    415424        var x = (geometry.x / resolution + this.left); 
    416425        var y = (this.top - geometry.y / resolution); 
    417  
    418426        if (this.inValidRange(x, y)) {  
    419427            node.setAttributeNS(null, "x", x); 
    420428            node.setAttributeNS(null, "y", y);