Changeset 2118

Show
Ignore:
Timestamp:
11/28/07 16:52:27 (5 years ago)
Author:
gyuque
Message:

lang/ruby/RubyESRIShape: updated test script

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/ruby/RubyESRIShape/test/shape-test/sample/jsonp_map.js

    r2116 r2118  
    2020var ShapeColors = {"bnda_1_1": "#897", "trans_rails": "#007", "transp_1_1": "#259"}; 
    2121var ShapeWidths = {"bnda_1_1": 0.5, "trans_rails": 1, "transp_1_1": 1}; 
     22var ShapeFillColors = {"bnda_1_1": "#eeffe0", "trans_rails": null, "transp_1_1": null}; 
    2223 
    2324var OUT; 
     
    132133                g.lineWidth = ShapeWidths[ ShapeName ]; 
    133134                g.strokeStyle = ShapeColors[ ShapeName ]; 
     135                g.fillStyle = ShapeFillColors[ ShapeName ]; 
    134136                var d = new DrawingTask(ShapeData, g, theCanvas.width-0, theCanvas.height-0); 
    135137                var _this = this; 
     
    149151        this.currentPoint = 0; 
    150152        this.data = data; 
     153        this.newPath = true; 
    151154} 
    152155 
    153156DrawingTask.prototype = { 
    154157        start: function() { 
     158                if (ShapeType != "point") 
     159                        this.g.beginPath(); 
     160 
    155161                this.next(); 
    156162        }, 
     
    192198                                        (sx2 < this.width && sx2 >= 0 && sy2 < this.height && sy2 >= 0)) 
    193199                                { 
    194                                         this.g.moveTo(sx1, sy1); 
     200                                        if (this.newPath) 
     201                                        { 
     202                                                this.newPath = false; 
     203                                                this.g.moveTo(sx1, sy1); 
     204                                        } 
    195205                                        this.g.lineTo(sx2, sy2); 
    196206                                } 
     
    226236                        if (ShapeType != "point") 
    227237                        { 
     238                                if (ShapeFillColors[ ShapeName ]) 
     239                                        this.g.fill(); 
    228240                                this.g.stroke(); 
    229241                                this.g.beginPath(); 
    230                         } 
     242                                this.newPath = true; 
     243                        } 
     244 
    231245                        return this.popNextLine(); 
    232246                } 
     
    259273        AirportIcon.src = "apt.png" 
    260274 
     275        document.getElementById("theCanvas").style.background = "#f0f2ff"; 
    261276        AirportLabel = new HTMLLabel(document.body, document.getElementById("theCanvas")); 
    262277