Changeset 2731

Show
Ignore:
Timestamp:
07/23/09 21:47:41 (3 years ago)
Author:
elemoine
Message:

Protocol.Map Fish? "bbox" property, r=bbinet (closes #496)

Location:
trunk/MapFish
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • trunk/MapFish/client/mfbase/mapfish/core/Protocol/MapFish.js

    r2729 r2731  
    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'); 
     
    189189                            return false; 
    190190                        } 
    191                         params["box"] = filter.value.toBBOX(); 
     191                        params["bbox"] = filter.value.toBBOX(); 
    192192                        break; 
    193193                    case OpenLayers.Filter.Spatial.DWITHIN: 
  • trunk/MapFish/client/mfbase/mapfish/tests/core/Protocol/MapFish.html

    r2729 r2731  
    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"); 
     
    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"); 
  • trunk/MapFish/server/python/mapfish/lib/protocol.py

    r2711 r2731  
    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 
  • trunk/MapFish/server/python/mapfish/tests/test_protocol.py

    r2705 r2731  
    5757    request = FakeRequest( 
    5858        {"box": "-45,-5,40,0", "tolerance": "1", "epsg": "900913"} 
     59    ) 
     60    filter = create_geom_filter(request, MappedClass) 
     61    assert isinstance(filter, spatial.Spatial) 
     62    assert filter.type == spatial.Spatial.BOX 
     63    assert filter.values["tolerance"] == 1 
     64    assert filter.values["epsg"] == 900913 
     65 
     66    request = FakeRequest( 
     67        {"bbox": "-45,-5,40,0", "tolerance": "1", "epsg": "900913"} 
    5968    ) 
    6069    filter = create_geom_filter(request, MappedClass)