예제 #1
0
 /**
  * change Wi-Fi object to associative array
  *
  * @param Wifi $wifi
  * @return array
  */
 private function prepareArrayForDB(Wifi $wifi)
 {
     $wifi->synchronizeSecurity();
     $array = array("id_source" => $wifi->getSource(), "date_added" => date("Y-m-d"), "mac" => MyUtils::macSeparator2Colon($wifi->getMac()), "ssid" => $wifi->getSsid(), "sec" => $wifi->getSec(), "latitude" => $wifi->getLatitude(), "longitude" => $wifi->getLongitude(), "altitude" => $wifi->getAltitude(), "comment" => $wifi->getComment(), "name" => $wifi->getName(), "type" => $wifi->getType(), "freenet" => $wifi->getFreenet(), "paynet" => $wifi->getPaynet(), "firsttime" => $wifi->getFirsttime(), "lasttime" => $wifi->getLasttime(), "flags" => $wifi->getFlags(), "wep" => $wifi->getWep(), "lastupdt" => $wifi->getLastupdt(), "channel" => $wifi->getChannel(), "bcninterval" => $wifi->getBcninterval(), "qos" => $wifi->getQos(), "accuracy" => $wifi->getAccuracy(), "calculated" => $wifi->getCalculated());
     return $array;
 }
예제 #2
0
 /**
  * @param Wifi $wifi
  * @return Wifi
  */
 public function getClosestWifiToWifi(Wifi $wifi)
 {
     $coords = Coords::createCoordsRangeByLatLng($wifi->getLatitude(), $wifi->getLongitude(), 0.03);
     return Wifi::createWifiFromDBRow($this->getNetsRangeQuery($coords)->where("id != ?", $wifi->getId())->where('mac != ?', $wifi->getMac())->order("SQRT(POW(latitude-?,2)+POW(longitude-?,2))", $wifi->getLatitude(), $wifi->getLongitude())->limit(1)->fetch());
 }
예제 #3
0
 /**
  * @param Coords $coords
  * @param Wifi[] $nets
  * @param Wifi   $net
  * @return resource
  */
 public function drawCalculated(Coords $coords, $nets, Wifi $net)
 {
     $this->createImage(self::IMAGE_BIGGER, self::IMAGE_BIGGER);
     $op = $this->getConversionRatio($coords);
     foreach ($nets as $w) {
         $xy = $this->latLngToPx($w->getLatitude(), $w->getLongitude(), $coords->getLatStart(), $coords->getLonStart(), $op->onepxlat, $op->onepxlon);
         $this->drawOneNet($xy->getX(), $xy->getY(), 16, 16, array('ssid' => $w->getSsid(), 'mac' => $w->getMac()), $this->imgcolors['one_net'], self::IMG_TYPE_ELLIPSE);
     }
     if ($net->getLatitude() < $coords->getLatEnd() && $net->getLatitude() > $coords->getLatStart() && $net->getLongitude() < $coords->getLonEnd() && $net->getLongitude() > $coords->getLonStart()) {
         $xy = $this->latLngToPx($net->getLatitude(), $net->getLongitude(), $coords->getLatStart(), $coords->getLonStart(), $op->onepxlat, $op->onepxlon);
         $this->drawOneNet($xy->getX(), $xy->getY(), 16, 16, array('ssid' => $net->getSsid(), 'mac' => $net->getMac()), $this->imgcolors[1], self::IMG_TYPE_ELLIPSE, false);
     }
     $this->cropImage();
     return $this->img;
 }