OpenLayers OpenLayers

Changeset 6277

Show
Ignore:
Timestamp:
02/14/08 23:02:14 (1 year ago)
Author:
achipa
Message:

example of rendering points as rectangles

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • sandbox/achipa/openlayers/lib/OpenLayers/Layer/TimedPointTrack.js

    r6270 r6277  
    5757     *           strokeLinecap: "round", 
    5858     *           pointRadius: 6, 
    59      *           pointStyle: "dot" 
     59     *           pointStyle: "square" 
     60     * 
     61     *    note the extra pointStyle attribute, which define the appearance of the 
     62     *    highlight, available values are 'square' and 'circle' 
     63     * 
    6064     */ 
    6165    defaultStyle: { 
     
    8690        ); 
    8791        this.events.register("datetimechanged", this, this.updateHighlight); 
     92//        this.map.events.register("zoomend", this, this.updateHighlight); 
    8893    }, 
    8994 
     
    123128        // this is good for a two point {OpenLayers.LineString} only, but that's what our superclass uses 
    124129        // if PointTrack was to work with something else, this would have to be adapted, too 
    125         alert(" " + this.currentDateTime.from + " " + closestfeature.dateTime.from + " " + closestfeature.dateTime.to + " " + closestfeature.dateTime.getPlaceInInterval(this.currentDateTime.from)); 
    126130            closestpoint = new OpenLayers.Geometry.Point( 
    127131                 closestgeom.components[0].x + (closestgeom.components[1].x - closestgeom.components[0].x) * closestfeature.dateTime.getPlaceInInterval(this.currentDateTime.from), 
  • sandbox/achipa/openlayers/lib/OpenLayers/Renderer/SVG.js

    r6270 r6277  
    154154            case "OpenLayers.Geometry.Point": 
    155155                nodeType = style.externalGraphic ? "image" : "circle"; 
     156        if (nodeType == "circle" && style.pointStyle == "square") nodeType = "rect"; 
    156157                break; 
    157158            case "OpenLayers.Geometry.Rectangle": 
     
    319320    drawPoint: function(node, geometry) { 
    320321        if (node._style.pointStyle == "square") { 
    321        alert('ZQVARE'); 
    322             this.drawRectangle(node, {x: geometry.x, y: geometry.y, width: node.getAttributeNS(null, "r"), height: node.getAttributeNS(null, "r")})  
     322            var size = node._style.pointRadius * this.getResolution(); 
     323            this.drawRectangle(node, {x: (geometry.x - size/2), y: (geometry.y + size/2), width: size, height: size})  
    323324     } else { 
    324325            this.drawCircle(node, geometry, 1); 
     
    422423        var x = (geometry.x / resolution + this.left); 
    423424        var y = (this.top - geometry.y / resolution); 
    424  
    425425        if (this.inValidRange(x, y)) {  
    426426            node.setAttributeNS(null, "x", x);