當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Point::from_xy方法代碼示例

本文整理匯總了PHP中Point::from_xy方法的典型用法代碼示例。如果您正苦於以下問題:PHP Point::from_xy方法的具體用法?PHP Point::from_xy怎麽用?PHP Point::from_xy使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Point的用法示例。


在下文中一共展示了Point::from_xy方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: bounding_box

 public function bounding_box()
 {
     $max_x = -INF;
     $max_y = -INF;
     $min_x = INF;
     $min_y = INF;
     if (!$this->with_z) {
         foreach ($this->geometries as $geom) {
             $bbox = $geom->bounding_box();
             $ll = $bbox[0];
             $ur = $bbox[1];
             if ($ll->x < $min_x) {
                 $min_x = $ll->x;
             }
             if ($ll->y < $min_y) {
                 $min_y = $ll->y;
             }
             if ($ur->x > $max_x) {
                 $max_x = $ur->x;
             }
             if ($ur->y > $max_y) {
                 $max_y = $ur->y;
             }
         }
         return array(Point::from_xy($min_x, $min_y), Point::from_xy($max_x, $max_y));
     } else {
         $max_z = INF;
         $min_z = -INF;
         foreach ($this->geometries as $geom) {
             $bbox = $geom->bounding_box();
             $ll = $bbox[0];
             $ur = $bbox[1];
             if ($ll->x < $min_x) {
                 $min_x = $ll->x;
             }
             if ($ll->y < $min_y) {
                 $min_y = $ll->y;
             }
             if ($ll->z < $min_z) {
                 $min_z = $ll->z;
             }
             if ($ur->x > $max_x) {
                 $max_x = $ur->x;
             }
             if ($ur->y > $max_y) {
                 $max_y = $ur->y;
             }
             if ($ur->z > $max_z) {
                 $max_y = $ur->z;
             }
         }
         return array(Point::from_xy($min_x, $min_y), Point::from_xy($max_x, $max_y));
     }
 }
開發者ID:h-sn,項目名稱:geophp,代碼行數:54,代碼來源:GeometryCollection.php

示例2: bounding_box

 public function bounding_box()
 {
     $max_x = -INF;
     $max_y = -INF;
     $min_x = INF;
     $min_y = INF;
     if (!$this->with_z) {
         foreach ($this->points as $p) {
             if ($p->x < $min_x) {
                 $min_x = $p->x;
             }
             if ($p->y < $min_y) {
                 $min_y = $p->y;
             }
             if ($p->x > $max_x) {
                 $max_x = $p->x;
             }
             if ($p->y > $max_y) {
                 $max_y = $p->y;
             }
         }
         return array(Point::from_xy($min_x, $min_y), Point::from_xy($max_x, $max_y));
     } else {
         $max_z = -INF;
         $min_z = INF;
         foreach ($this->points as $p) {
             if ($p->x < $min_x) {
                 $min_x = $p->x;
             }
             if ($p->y < $min_y) {
                 $min_y = $p->y;
             }
             if ($p->z < $min_z) {
                 $min_z = $p->z;
             }
             if ($p->x > $max_x) {
                 $max_x = $p->x;
             }
             if ($p->y > $max_y) {
                 $max_y = $p->y;
             }
             if ($p->z > $max_z) {
                 $max_z = $p->z;
             }
         }
         return array(Point::from_xyz($min_x, $min_y, $min_z), Point::from_xyz($max_x, $max_y, $max_z));
     }
 }
開發者ID:h-sn,項目名稱:geophp,代碼行數:48,代碼來源:LineString.php


注:本文中的Point::from_xy方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。