diff src/djol/VectorStoreQuery.js @ 34:27e8e9e38e07 default tip

Слияние
author nickolay
date Wed, 05 Jun 2019 20:44:15 +0300
parents 8af8e840dd49 1dc2fd263b90
children
line wrap: on
line diff
--- a/src/djol/VectorStoreQuery.js	Wed Jun 05 17:44:17 2019 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +0,0 @@
-define([ "ol" ], function(ol) {
-
-    function buildFilter(filter) {
-        if (filter instanceof Function)
-            return filter;
-        if (filter) {
-            var match = function(str) {
-                return {
-                    test : function(x) {
-                        if (x === null || x === undefined)
-                            return false;
-                        return x.toString().startsWith(str);
-                    }
-                };
-            };
-
-            for ( var p in filter) {
-                if (typeof (filter[p]) == "string" && filter[p].endsWith("*"))
-                    filter[p] = match(filter[p].substr(0, filter[p].length));
-            }
-            return function(ft) {
-                for ( var p in filter) {
-                    if (filter[p] && filter[p].test ? !filter[p]
-                        .test(ft.get(p)) : ft.get(p) != filter[p])
-                        return false;
-                }
-                return true;
-            };
-        }
-        throw new Error("Unsupported filter");
-    }
-
-    /**
-     * @constructor
-     * @example
-     * 
-     * <pre>
-     * var store = new VectorStore({
-     *     source : vectorSource
-     * });
-     * 
-     * var req = new VectorStoreQuery({
-     *     city : &quot;Moscow&quot;
-     * }, [ 30, 50, 40, 60 ]);
-     * 
-     * store.query(req).then(showResults);
-     * </pre>
-     */
-    return function(filter, extent) {
-        var match = filter && buildFilter(filter);
-
-        var query = function(ft) {
-            if (extent) {
-                var g = gt.getGeometry();
-                if (!g || !ol.extent.intersects(extent, g.getExtent()))
-                    return false;
-            }
-
-            return !match || match(ft);
-        };
-
-        query.extent = extent;
-        query.predicate = match;
-
-        return query;
-    };
-});
\ No newline at end of file