- Timestamp:
- 22/10/08 10:52:13 (12 years ago)
- Location:
- cows/trunk/cows
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
cows/trunk/cows/bbox_util.py
r4072 r4352 4 4 @note: This has no connection with the cows data model. This module 5 5 will probably move eventually. 6 6 7 7 """ 8 8 … … 20 20 21 21 return llx, lly, urx, ury 22 23 def 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 22 34 23 35 def relativeSize(bbox1, bbox2): -
cows/trunk/cows/model/filterencoding.py
r4345 r4352 73 73 resultset=set(featureset.getFeaturesByBBox(bbtuple, srsname)) 74 74 return resultset 75 75 76 class PropertyIsBetween(Filter): 77 def evaluate(self, featureset): 78 #TODO for time ranges 79 resultset=set(featureset.featuresByPropertyBetween(propertyname, lowerbound, upperbound)) 80 81 76 82 class FEQueryProcessor(object): 77 83 def __init__(self): -
cows/trunk/cows/service/imps/csmlbackend/csmlcommon.py
r4351 r4352 86 86 return d 87 87 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=initialbbox94 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 4 4 """ 5 5 6 from cows.service.imps.csmlbackend.csmlcommon import CSMLLayerMapper, CSMLConnector , BboxAggregator6 from cows.service.imps.csmlbackend.csmlcommon import CSMLLayerMapper, CSMLConnector 7 7 from cows.service.wfs_iface import * 8 8 import csml 9 9 from xml.etree import ElementTree as etree 10 10 from shapely.geometry import Polygon 11 from cows.bbox_util import union 11 12 12 13 import logging … … 50 51 featureset=CSMLFeatureSet() #holds feature instances 51 52 layermap={} #feature types 52 bboxAggregators={}#for aggregations of bounding boxes. 53 aggregatedBBoxes={}#for aggregations of bounding boxes. 54 53 55 54 56 for feature in csml.csmllibs.csmlextra.listify(ds.featureCollection.featureMembers): … … 60 62 layermap[ftype]=CSMLwfsLayer(ftype, instance.wgs84BBox) 61 63 #instantiate an aggregator to compare future bounding boxes with. 62 bboxAggregators[ftype]= BboxAggregator(instance.wgs84BBox)64 aggregatedBBoxes[ftype]= instance.wgs84BBox 63 65 else: 64 66 #the featuretype has already been stored in the dictionary. 65 67 #but, the bounding box may need changing to accommodate this new feature instance. 66 68 # 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) 70 73 71 74
Note: See TracChangeset
for help on using the changeset viewer.