OpenLayers OpenLayers

Changeset 5298

Show
Ignore:
Timestamp:
11/30/07 11:58:15 (1 year ago)
Author:
ahocevar
Message:

refactored constants to be like the ones in OpenLayers.Control

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • sandbox/ahocevar/styles/examples/georss-rule-style.html

    r5296 r5298  
    2626        // specific markers 
    2727        var ruleEquals = new OpenLayers.Rule.Comparison({ 
    28                 type: OpenLayers.Rule.Comparison.type.EQUAL_TO, 
     28                type: OpenLayers.Rule.Comparison.EQUAL_TO, 
    2929                property: "title", 
    3030                value: "Darwin's Ltd.", 
    3131                symbolizer: {'Point': {externalGraphic: '../img/marker-blue.png'}}}); 
    3232        var ruleLike = new OpenLayers.Rule.Comparison({ 
    33                 type: OpenLayers.Rule.Comparison.type.LIKE, 
     33                type: OpenLayers.Rule.Comparison.LIKE, 
    3434                property: "title", 
    3535                value: "Hot Springs", 
  • sandbox/ahocevar/styles/lib/OpenLayers/Rule/Comparison.js

    r5274 r5298  
    2020    /** 
    2121     * APIProperty: type 
    22      * {<OpenLayers.Rule.Comparison.type>} type: type of the comparison. 
     22     * {String} type: type of the comparison. This is one of 
     23     * - OpenLayers.Rule.Comparison.EQUAL_TO                 = "="; 
     24     * - OpenLayers.Rule.Comparison.NOT_EQUAL_TO             = "!="; 
     25     * - OpenLayers.Rule.Comparison.LESS_THAN                = "<"; 
     26     * - OpenLayers.Rule.Comparison.GREATER_THAN             = ">"; 
     27     * - OpenLayers.Rule.Comparison.LESS_THAN_OR_EQUAL_TO    = "<="; 
     28     * - OpenLayers.Rule.Comparison.GREATER_THAN_OR_EQUAL_TO = ">="; 
     29     * - OpenLayers.Rule.Comparison.BETWEEN                  = ".."; 
     30     * - OpenLayers.Rule.Comparison.LIKE                     = "~";  
    2331     */ 
    2432    type: null, 
     
    9098        var attributes = feature.attributes || feature.data; 
    9199        switch(this.type) { 
    92             case OpenLayers.Rule.Comparison.type.EQUAL_TO: 
    93             case OpenLayers.Rule.Comparison.type.LESS_THAN: 
    94             case OpenLayers.Rule.Comparison.type.GREATER_THAN: 
    95             case OpenLayers.Rule.Comparison.type.LESS_THAN_OR_EQUAL_TO: 
    96             case OpenLayers.Rule.Comparison.type.GREATER_THAN_OR_EQUAL_TO: 
     100            case OpenLayers.Rule.Comparison.EQUAL_TO: 
     101            case OpenLayers.Rule.Comparison.LESS_THAN: 
     102            case OpenLayers.Rule.Comparison.GREATER_THAN: 
     103            case OpenLayers.Rule.Comparison.LESS_THAN_OR_EQUAL_TO: 
     104            case OpenLayers.Rule.Comparison.GREATER_THAN_OR_EQUAL_TO: 
    97105                return this.binaryCompare(feature, this.property, 
    98106                        OpenLayers.Style.createLiteral(this.value, feature)); 
    99107             
    100             case OpenLayers.Rule.Comparison.type.BETWEEN: 
     108            case OpenLayers.Rule.Comparison.BETWEEN: 
    101109                var result = 
    102110                        attributes[this.property] > 
     
    108116                                        this.upperBoundary, feature); 
    109117                return result; 
    110             case OpenLayers.Rule.Comparison.type.LIKE: 
     118            case OpenLayers.Rule.Comparison.LIKE: 
    111119                var regexp = new RegExp( 
    112120                        OpenLayers.Style.createLiteral(this.value, feature), 
     
    161169        var attributes = feature.attributes || feature.data; 
    162170        switch (this.type) { 
    163             case OpenLayers.Rule.Comparison.type.EQUAL_TO: 
     171            case OpenLayers.Rule.Comparison.EQUAL_TO: 
    164172                return attributes[property] == value; 
    165             case OpenLayers.Rule.Comparison.type.NOT_EQUAL_TO: 
     173            case OpenLayers.Rule.Comparison.NOT_EQUAL_TO: 
    166174                return attributes[property] != value; 
    167             case OpenLayers.Rule.Comparison.type.LESS_THAN: 
     175            case OpenLayers.Rule.Comparison.LESS_THAN: 
    168176                return attributes[property] < value; 
    169             case OpenLayers.Rule.Comparison.type.GREATER_THAN: 
     177            case OpenLayers.Rule.Comparison.GREATER_THAN: 
    170178                return attributes[property] > value; 
    171             case OpenLayers.Rule.Comparison.type.LESS_THAN_OR_EQUAL_TO: 
     179            case OpenLayers.Rule.Comparison.LESS_THAN_OR_EQUAL_TO: 
    172180                return attributes[property] <= value; 
    173             case OpenLayers.Rule.Comparison.type.GREATER_THAN_OR_EQUAL_TO: 
     181            case OpenLayers.Rule.Comparison.GREATER_THAN_OR_EQUAL_TO: 
    174182                return attributes[property] >= value; 
    175183        }       
     
    180188 
    181189 
    182 /** 
    183  * Constant: 
    184  * {Object} OpenLayers.Rule.Comparison.type 
    185  */ 
    186 OpenLayers.Rule.Comparison.type = { 
    187         'EQUAL_TO': "=", 
    188         'NOT_EQUAL_TO': "!=", 
    189         'LESS_THAN': "<", 
    190         'GREATER_THAN': ">", 
    191         'LESS_THAN_OR_EQUAL_TO': "<=", 
    192         'GREATER_THAN_OR_EQUAL_TO': ">=", 
    193         'BETWEEN': "..", 
    194         'LIKE': "~"}; 
     190OpenLayers.Rule.Comparison.EQUAL_TO                 = "="; 
     191OpenLayers.Rule.Comparison.NOT_EQUAL_TO             = "!="; 
     192OpenLayers.Rule.Comparison.LESS_THAN                = "<"; 
     193OpenLayers.Rule.Comparison.GREATER_THAN             = ">"; 
     194OpenLayers.Rule.Comparison.LESS_THAN_OR_EQUAL_TO    = "<="; 
     195OpenLayers.Rule.Comparison.GREATER_THAN_OR_EQUAL_TO = ">="; 
     196OpenLayers.Rule.Comparison.BETWEEN                  = ".."; 
     197OpenLayers.Rule.Comparison.LIKE                     = "~"; 
  • sandbox/ahocevar/styles/lib/OpenLayers/Rule/Logical.js

    r5274 r5298  
    2424    /** 
    2525     * APIProperty: type 
    26      * {<OpenLayers.Rule.Logical.type>} type of logical operator. 
     26     * {String} type of logical operator. 
    2727     */ 
    2828    type: null, 
     
    6969    evaluate: function(feature) { 
    7070        switch(this.type) { 
    71             case OpenLayers.Rule.Logical.type.AND: 
     71            case OpenLayers.Rule.Logical.AND: 
    7272                for (var i=0; i<this.children.length; i++) { 
    7373                    if (this.children[i].evaluate(feature) == false) { 
     
    7777                return true; 
    7878                 
    79             case OpenLayers.Rule.Logical.type.OR: 
     79            case OpenLayers.Rule.Logical.OR: 
    8080                for (var i=0; i<this.children.length; i++) { 
    8181                    if (this.children[i].evaluate(feature) == true) { 
     
    8585                return false; 
    8686             
    87             case OpenLayers.Rule.Logical.type.NOT: 
     87            case OpenLayers.Rule.Logical.NOT: 
    8888                return (!this.children[0].evaluate(feature)); 
    8989        } 
     
    9494 
    9595 
    96 /** 
    97  * Constant: 
    98  * {Object} OpenLayers.Rule.Logical.type 
    99  */ 
    100 OpenLayers.Rule.Logical.type = { 
    101         'AND': "&&", 
    102         'OR': "||", 
    103         'NOT': "!"}; 
     96OpenLayers.Rule.Logical.AND = "&&"; 
     97OpenLayers.Rule.Logical.OR  = "||"; 
     98OpenLayers.Rule.Logical.NOT = "!";