00001 # Copyright (C) 2008-2009 Mark Hanegraaff 00002 # 00003 # This program is free software: you can redistribute it and/or modify 00004 # it under the terms of the GNU General Public License as published by 00005 # the Free Software Foundation, either version 3 of the License, or 00006 # (at your option) any later version. 00007 # 00008 # This program is distributed in the hope that it will be useful, 00009 # but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00011 # GNU General Public License for more details. 00012 # 00013 # You should have received a copy of the GNU General Public License 00014 # along with this program. If not, see <http://www.gnu.org/licenses/>. 00015 00016 00017 from objects.logic.common.logger import logger 00018 00019 ## The Entity Statistics class will contain various useful statistics built from 00020 # either a series of decoded packets or list of entities. This class is really just 00021 # a stub at this point. Nothing much is implemented. 00022 class entityStatistics(): 00023 ## 00024 # 00025 # coordinate based dictionary. Used to keep track of 00026 # of multiple entities at distinct locations (which need to be displayed onto 00027 # the screen differently). This list will essentially contain 00028 # the same information as a filtered entity collection, but it will 00029 # be keyed by location rather than its primary key. 00030 # 00031 # The key of the dictionary is the longitude/latitude pair. 00032 # the value is an small list of all entities at that 00033 # particular location. 00034 # 00035 # 00036 # {(lon, lat): entityList() } 00037 # 00038 # 00039 def __init__(self): 00040 00041 self.coordinateDitc = dict() 00042 """ 00043 # it is assumed that each entity should be unique, giving the same entity over and over again 00044 # will skew the statistics 00045 def computeStatsFromEntity(self, netEnt): 00046 if netEnt == None: 00047 logger.log(__name__ + ": tried to compute statistics using a NULL networked Entity") 00048 return 00049 00050 lon = netEnt.foreignLongitude 00051 lat = netEnt.foreignLatitude 00052 00053 key = (lon, lat) 00054 00055 if not self.coordinateDitc.has_key(key): 00056 self.coordinateDitc[key] = list() 00057 00058 self.coordinateDitc[key].append(netEnt) 00059 00060 00061 def computeStatsFromDecodedPacket(self, decodedPacket): 00062 pass 00063 00064 """ 00065
1.5.8