Changeset 4352


Ignore:
Timestamp:
22/10/08 10:52:13 (11 years ago)
Author:
domlowe
Message:

Removing old bbox aggregator code

Location:
cows/trunk/cows
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • cows/trunk/cows/bbox_util.py

    r4072 r4352  
    44@note: This has no connection with the cows data model.  This module 
    55    will probably move eventually. 
    6  
     6     
    77""" 
    88 
     
    2020 
    2121    return llx, lly, urx, ury 
     22 
     23def union(bbox1, bbox2): 
     24    """ 
     25    @ivar bbox1: bounding box tuple (llx, lly, urx, ury). 
     26    @ivar bbox2: bounding box tuple (llx, lly, urx, ury) to aggregate with bbox1  
     27    @return: union of bbox1 and bbox2 as tuple, (llx, lly, urx, ury) 
     28    """ 
     29    llx = min(bbox1[0], bbox2[0]) 
     30    lly = min(bbox1[1], bbox2[1]) 
     31    urx = max(bbox1[2], bbox2[2]) 
     32    ury = max(bbox1[3], bbox2[3]) 
     33    return llx, lly, urx, ury     
    2234 
    2335def relativeSize(bbox1, bbox2): 
  • cows/trunk/cows/model/filterencoding.py

    r4345 r4352  
    7373        resultset=set(featureset.getFeaturesByBBox(bbtuple, srsname))                               
    7474        return resultset         
    75  
     75     
     76class PropertyIsBetween(Filter): 
     77    def evaluate(self, featureset): 
     78        #TODO for time ranges 
     79        resultset=set(featureset.featuresByPropertyBetween(propertyname, lowerbound, upperbound)) 
     80         
     81                       
    7682class FEQueryProcessor(object): 
    7783    def __init__(self): 
  • cows/trunk/cows/service/imps/csmlbackend/csmlcommon.py

    r4351 r4352  
    8686        return d 
    8787     
    88 class BboxAggregator(object): 
    89     """ class to handle aggregations of bounding boxes (in the same crs) and store state for further comparisons""" 
    90     def __init__(self, initialbbox): 
    91         """  
    92         @ivar wgs84bbox: bounding box tuple (llx, lly, urx, ury) """ 
    93         self.bbox=initialbbox 
    94          
    95     def aggregate(self, newbbox): 
    96         """ 
    97         @ivar newbbox: bounding box tuple (llx, lly, urx, ury) to compare against current bbox.  
    98         @return: aggregated bbox tuple, (llx, lly, urx, ury) 
    99         """ 
    100 #        log.debug('Comparing new bbox %s with old bbox %s'%(newbbox, self.bbox)) 
    101         #compare new box with old. 
    102         return union(self.bbox, newbbox) 
  • cows/trunk/cows/service/imps/csmlbackend/wfs_csmllayer.py

    r4351 r4352  
    44""" 
    55 
    6 from cows.service.imps.csmlbackend.csmlcommon import CSMLLayerMapper, CSMLConnector, BboxAggregator 
     6from cows.service.imps.csmlbackend.csmlcommon import CSMLLayerMapper, CSMLConnector 
    77from cows.service.wfs_iface import * 
    88import csml 
    99from xml.etree import ElementTree as etree 
    1010from shapely.geometry import Polygon 
     11from cows.bbox_util import union 
    1112 
    1213import logging 
     
    5051        featureset=CSMLFeatureSet() #holds feature instances                 
    5152        layermap={} #feature types        
    52         bboxAggregators={}#for aggregations of bounding boxes. 
     53        aggregatedBBoxes={}#for aggregations of bounding boxes. 
     54         
    5355 
    5456        for feature in csml.csmllibs.csmlextra.listify(ds.featureCollection.featureMembers): 
     
    6062                layermap[ftype]=CSMLwfsLayer(ftype, instance.wgs84BBox) 
    6163                #instantiate an aggregator to compare future bounding boxes with. 
    62                 bboxAggregators[ftype]= BboxAggregator(instance.wgs84BBox)                
     64                aggregatedBBoxes[ftype]= instance.wgs84BBox                
    6365            else: 
    6466                #the featuretype has already been stored in the dictionary. 
    6567                #but, the bounding box may need changing to accommodate this new feature instance. 
    6668#                log.debug('Checking bbox for feature id: %s and title: %s'%(instance._feature.id, instance.title)) 
    67                 aggregator=bboxAggregators[ftype] 
    68                 aggregator.aggregate(instance.wgs84BBox) 
    69                 layermap[ftype]=CSMLwfsLayer(ftype, aggregator.bbox) 
     69                currentbbox=aggregatedBBoxes[ftype] 
     70                newbbox=union(currentbbox, instance.wgs84BBox) 
     71                aggregatedBBoxes[ftype]= newbbox 
     72                layermap[ftype]=CSMLwfsLayer(ftype, newbbox) 
    7073             
    7174 
Note: See TracChangeset for help on using the changeset viewer.