コード例 #1
0
ファイル: GeoGdatFactory.php プロジェクト: kailIII/geoproxy
 protected function makeFromJSON($_json)
 {
     GeoProxy::log(LOG_DEBUG, __CLASS__, __FUNCTION__, "entering");
     $gdat = new GeoGdat();
     $geomfactory = new GeoGeomFactory();
     $gadcfactory = new GeoGadcFactory();
     $gdat->geometry = $geomfactory->make(new JSONGeoGeomFactoryData($_json['geometry']));
     $gdat->formatted_address = $_json['formatted_address'];
     $gdat->types = $_json['types'];
     $gdat->lang = $_json['lang'];
     $gdat->ext = 0;
     foreach ($_json['address_components'] as $ad) {
         $gdat->address_components[] = $gadcfactory->make(new JSONGeoGadcFactoryData($ad));
     }
     return $gdat;
 }
コード例 #2
0
ファイル: RedisQuerier.php プロジェクト: kailIII/geoproxy
 public function gadcInRedis($_gadc)
 {
     GeoProxy::log(LOG_DEBUG, __CLASS__, __FUNCTION__, "entering");
     $index = 'idx:gadcBySerial';
     $serial = $_gadc->computeSerial();
     $key = $index . ':' . $serial;
     if (!$this->readConn->exists($key)) {
         GeoProxy::log(LOG_DEBUG, __CLASS__, __FUNCTION__, "leaving, (false 1)");
         return false;
     }
     // serial exists, deep comparison needed
     $ids = $this->readConn->sMembers($key);
     $gadcfactory = new GeoGadcFactory();
     foreach ($ids as $id) {
         $gadcRedis = $gadcfactory->make(new RedisGeoGadcFactoryData($this->readConn, $id));
         if ($gadcRedis->equals($_gadc)) {
             GeoProxy::log(LOG_DEBUG, __CLASS__, __FUNCTION__, "leaving, (id=" . $id . ")");
             return $id;
         }
     }
     GeoProxy::log(LOG_DEBUG, __CLASS__, __FUNCTION__, "leaving, (false 2)");
     return false;
 }