Project

General

Profile

Download (2.22 KB) Statistics
| Branch: | Tag: | Revision:
1
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
2
 * full list of contributors). Published under the 2-clause BSD license.
3
 * See license.txt in the OpenLayers distribution or repository for the
4
 * full text of the license. */
5

    
6

    
7
/**
8
 * @requires OpenLayers/BaseTypes/Class.js
9
 * @requires OpenLayers/Util.js
10
 * @requires OpenLayers/Style.js
11
 */
12

    
13
/**
14
 * Class: OpenLayers.Filter
15
 * This class represents an OGC Filter.
16
 */
17
OpenLayers.Filter = OpenLayers.Class({
18
    
19
    /** 
20
     * Constructor: OpenLayers.Filter
21
     * This class represents a generic filter.
22
     *
23
     * Parameters:
24
     * options - {Object} Optional object whose properties will be set on the
25
     *     instance.
26
     * 
27
     * Returns:
28
     * {<OpenLayers.Filter>}
29
     */
30
    initialize: function(options) {
31
        OpenLayers.Util.extend(this, options);
32
    },
33

    
34
    /** 
35
     * APIMethod: destroy
36
     * Remove reference to anything added.
37
     */
38
    destroy: function() {
39
    },
40

    
41
    /**
42
     * APIMethod: evaluate
43
     * Evaluates this filter in a specific context.  Instances or subclasses
44
     * are supposed to override this method.
45
     * 
46
     * Parameters:
47
     * context - {Object} Context to use in evaluating the filter.  If a vector
48
     *     feature is provided, the feature.attributes will be used as context.
49
     * 
50
     * Returns:
51
     * {Boolean} The filter applies.
52
     */
53
    evaluate: function(context) {
54
        return true;
55
    },
56
    
57
    /**
58
     * APIMethod: clone
59
     * Clones this filter. Should be implemented by subclasses.
60
     * 
61
     * Returns:
62
     * {<OpenLayers.Filter>} Clone of this filter.
63
     */
64
    clone: function() {
65
        return null;
66
    },
67
    
68
    /**
69
     * APIMethod: toString
70
     *
71
     * Returns:
72
     * {String} Include <OpenLayers.Format.CQL> in your build to get a CQL
73
     *     representation of the filter returned. Otherwise "[Object object]"
74
     *     will be returned.
75
     */
76
    toString: function() {
77
        var string;
78
        if (OpenLayers.Format && OpenLayers.Format.CQL) {
79
            string = OpenLayers.Format.CQL.prototype.write(this);
80
        } else {
81
            string = Object.prototype.toString.call(this);
82
        }
83
        return string;
84
    },
85
    
86
    CLASS_NAME: "OpenLayers.Filter"
87
});
(7-7/35)