Пример #1
0
 def _GetGridPointsWithinRadius(self):
     """ Create a dictionary of GpGridPoints within distanceMeters from a center point.
     
     Scan through the GridPoints in the bounding box region. Add all in-bound points to the dictionary.
     Associate a weight with each GridPoint that is inversely proportional to its distance from the
     center point.
     """
     radiusMeters = self.SearchBoundaryMeters
     self.gpGridPointsInBoundsDic = {}
     stepSize = MAXIMUM_RESOLUTION - self.MaxSearchResolution + 1
     for latInt in range(self.SWCornerGridPoint.LattitudeInt,self.NWCornerGridPoint.LattitudeInt + stepSize, \
                         stepSize):
         for lonInt in range (self.SWCornerGridPoint.LongitudeInt,self.SECornerGridPoint.LongitudeInt + stepSize, \
                              stepSize):
             gridPoint = GpGridPoint()
             gridPoint.InitFromIntLatLon(latInt,lonInt,self.MaxSearchResolution)
             gpPoint = GpPoint(gridPoint.LattitudeFloat,gridPoint.LongitudeFloat)
             distanceMeters = GpMath.distance(self.CenterGpPoint,gpPoint)
             if distanceMeters <= radiusMeters:
                 weight = self._WeightGridPointByDistance(distanceMeters)
                 self.gpGridPointsInBoundsDic[gridPoint.ToShortString()] = weight