Ticket #496: patch-MapFish-496-r2729-A1.diff

File patch-MapFish-496-r2729-A1.diff, 3.9 kB (added by bbinet, 3 years ago)
  • server/python/mapfish/tests/test_protocol.py

     
    6464    assert filter.values["epsg"] == 900913 
    6565 
    6666    request = FakeRequest( 
     67        {"bbox": "-45,-5,40,0", "tolerance": "1", "epsg": "900913"} 
     68    ) 
     69    filter = create_geom_filter(request, MappedClass) 
     70    assert isinstance(filter, spatial.Spatial) 
     71    assert filter.type == spatial.Spatial.BOX 
     72    assert filter.values["tolerance"] == 1 
     73    assert filter.values["epsg"] == 900913 
     74 
     75    request = FakeRequest( 
    6776        {"lon": "-45", "lat": "5", "tolerance": "1", "epsg": "900913"} 
    6877    ) 
    6978    filter = create_geom_filter(request, MappedClass) 
  • server/python/mapfish/lib/protocol.py

     
    7979    if 'epsg' in request.params: 
    8080        epsg = int(request.params['epsg']) 
    8181 
    82     if 'box' in request.params: 
     82    # "box" is an alias to "bbox" 
     83    box = None 
     84    if 'bbox' in request.params: 
     85        box = request.params['bbox'] 
     86    elif 'box' in request.params: 
     87        box = request.params['box'] 
     88 
     89    if box is not None: 
    8390        # box spatial filter 
    8491        filter = Spatial( 
    8592            Spatial.BOX, 
    8693            geom_column, 
    87             box=request.params['box'].split(','), 
     94            box=box.split(','), 
    8895            tolerance=tolerance, 
    8996            epsg=epsg 
    9097        ) 
  • client/mfbase/mapfish/tests/core/Protocol/MapFish.html

     
    106106            } 
    107107        }; 
    108108        protocol.filterAdapter(options); 
    109         t.eq(options.params.box, bbox, 
    110              "filterAdapter sets correct box param if passed a BBOX filter"); 
     109        t.eq(options.params.bbox, bbox, 
     110             "filterAdapter sets correct bbox param if passed a BBOX filter"); 
    111111        t.eq(options.filter, undefined, 
    112112             "filterAdapter deletes filter if passed a BBOX filter"); 
    113113 
     
    196196        }; 
    197197 
    198198        protocol.filterAdapter(options); 
    199         t.eq(options.params.box, "0,0,10,10", 
    200              "filterAdapter sets correct box param if passed a Logical filter containing a BBOX"); 
     199        t.eq(options.params.bbox, "0,0,10,10", 
     200             "filterAdapter sets correct bbox param if passed a Logical filter containing a BBOX"); 
    201201        t.eq(options.filter, undefined, 
    202202             "filterAdapter deletes filter"); 
    203203 
  • client/mfbase/mapfish/core/Protocol/MapFish.js

     
    181181                var type = filter.type; 
    182182                switch (type) { 
    183183                    case OpenLayers.Filter.Spatial.BBOX: 
    184                         if (params["box"]) { 
     184                        if (params["bbox"]) { 
    185185                            OpenLayers.Console.error('Filter contains multiple ' + 
    186186                                                     'Spatial BBOX entries'); 
    187187                            // We should merge with the old bbox, but OL does not 
    188188                            // proving geometry merging. 
    189189                            return false; 
    190190                        } 
    191                         params["box"] = filter.value.toBBOX(); 
     191                        params["bbox"] = filter.value.toBBOX(); 
    192192                        break; 
    193193                    case OpenLayers.Filter.Spatial.DWITHIN: 
    194194                        params["tolerance"] = filter.distance;