コード例 #1
0
ファイル: Cart.php プロジェクト: rgnevashev/cart
 /**
  * Return a specific item object by identifier
  * 
  * @param  string $itemIdentifier The unique item identifier
  * @return Item                   Item object
  */
 public function item($itemIdentifier)
 {
     return $this->store->item($itemIdentifier);
 }
コード例 #2
0
 /**
  * Reads Footprint from geolocation grid point
  * 
  * @param unknown $geolocationGridPoint
  * @param unknown $orbitDirection
  */
 private function readFootprintFromGeolocationGridPoint($geolocationGridPoint, $orbitDirection)
 {
     /*
      * On Ascending orbit, we are:
      * ll : pt(0, 0) i.e pixel 0, line 0 in geolocation grid point
      * lr : pt(max, 0)
      * ul : pt(0, max)
      * ur : pt(max, max),
      * 
      * On Descending orbit, we are:
      * ul : pt(0, 0) i.e pixel 0, line 0 in geolocation grid point
      * ur : pt(max, 0)
      * ll : pt(0, max)
      * lr : pt(max, max), 
      */
     $ll = array();
     $lr = array();
     $ul = array();
     $ur = array();
     $lineMax = 0;
     $lineMin = 0;
     $lineMinStatus = 0;
     $pixelMax = 0;
     for ($i = 0, $ii = $geolocationGridPoint->length; $i < $ii; $i++) {
         $line = (int) $geolocationGridPoint->item($i)->getElementsByTagName('line')->item(0)->nodeValue;
         $pixel = (int) $geolocationGridPoint->item($i)->getElementsByTagName('pixel')->item(0)->nodeValue;
         $coordinates = array($geolocationGridPoint->item($i)->getElementsByTagName('longitude')->item(0)->nodeValue, $geolocationGridPoint->item($i)->getElementsByTagName('latitude')->item(0)->nodeValue);
         if ($lineMinStatus == 0) {
             $lineMinStatus = 1;
             $lineMin = $line;
         }
         if ($line === $lineMin) {
             if ($pixel === 0) {
                 $ll = $coordinates;
             } else {
                 if ($pixel >= $pixelMax) {
                     $pixelMax = $pixel;
                     $lr = $coordinates;
                 }
             }
         } else {
             if ($line >= $lineMax) {
                 $lineMax = $line;
                 if ($pixel === 0) {
                     $ul = $coordinates;
                 } else {
                     if ($pixel >= $pixelMax) {
                         $pixelMax = $pixel;
                         $ur = $coordinates;
                     }
                 }
             }
         }
     }
     /*
      * On descending orbit, the North and South are inverted
      */
     if (strtolower($orbitDirection) === "descending") {
         /*
          * Temporary coordinates
          */
         $ll_ = $ll;
         $lr_ = $lr;
         $ur_ = $ur;
         $ul_ = $ul;
         /*
          * Inverts North and South
          */
         $lr = $ul_;
         $ll = $ur_;
         $ul = $lr_;
         $ur = $ll_;
     }
     $polygon = array($ll, $lr, $ur, $ul, $ll);
     return $polygon;
 }