OpenLayers OpenLayers

Changeset 7946

Show
Ignore:
Timestamp:
09/04/08 06:57:44 (3 months ago)
Author:
elemoine
Message:

apply changes made to the patch attached to #1699

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • sandbox/camptocamp/unhcr/lib/OpenLayers/Lang/en.js

    r7537 r7946  
    117117        "OpenLayers.Util.pagePosition failed: element with id ${elemId} may be misplaced.", 
    118118                     
    119     'end': '' 
     119    'end': '', 
     120 
     121    // console message 
     122    'evaluateNotImplemented': "evaluate is not implemented for this filter type" 
    120123}; 
  • sandbox/camptocamp/unhcr/lib/OpenLayers/Protocol/SQL.js

    r7877 r7946  
    3030 
    3131    /** 
     32     * Property: postReadFiltering 
     33     * {Boolean} Whether the filter (if there's one) must be applied after 
     34     *      the features have been read from the database; for example the 
     35     *      BBOX strategy passes the read method a BBOX spatial filter, if 
     36     *      postReadFiltering is true every feature read from the database 
     37     *      will go through the BBOX spatial filter, which can be costly; 
     38     *      defaults to true. 
     39     */ 
     40    postReadFiltering: true, 
     41 
     42    /** 
    3243     * Constructor: OpenLayers.Protocol.SQL 
    3344     */ 
     
    5566    }, 
    5667 
     68    /** 
     69     * Method: evaluateFilter 
     70     * If postReadFiltering is true evaluate the filter against the feature 
     71     * and return the result of the evaluation, otherwise return true. 
     72     * 
     73     * Parameters: 
     74     * {<OpenLayers.Feature.Vector>} The feature. 
     75     * {<OpenLayers.Filter>} The filter. 
     76     * 
     77     * Returns: 
     78     * {Boolean} true if postReadFiltering if false, the result of the 
     79     * filter evaluation otherwise. 
     80     */ 
     81    evaluateFilter: function(feature, filter) { 
     82        return filter && this.postReadFiltering ? 
     83            filter.evaluate(feature) : true; 
     84    }, 
     85 
    5786    CLASS_NAME: "OpenLayers.Protocol.SQL" 
    5887}); 
    59  
    60  
    61 /** 
    62  * APIFunction: factory. 
    63  * Alternative constructor 
    64  */ 
    65 OpenLayers.Protocol.SQL.factory = function(options) { 
    66     // Available SQL backends. 
    67     var sqls = ["Gears"]; 
    68  
    69     for (var i = 0; i < sqls.length; i++) { 
    70         var sql = OpenLayers.Protocol.SQL[sqls[i]]; 
    71         if (sql && sql.prototype.supported()) { 
    72             return new sql(options); 
    73         } 
    74         OpenLayers.Console.userError("No SQL backend supported ..."); 
    75     } 
    76 } 
  • sandbox/camptocamp/unhcr/lib/OpenLayers/Protocol/SQL/Gears.js

    r7918 r7946  
    161161        while (rs.isValidRow()) { 
    162162            feature = this.unfreezeFeature(rs); 
    163             if (!options.noFeatureStateReset) { 
    164                 feature.state = null; 
     163            if (this.evaluateFilter(feature, options.filter)) { 
     164                if (!options.noFeatureStateReset) { 
     165                    feature.state = null; 
     166                } 
     167                features.push(feature); 
    165168            } 
    166             features.push(feature); 
    167169            rs.next(); 
    168170        }