当前位置: 首页>>代码示例>>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;未经允许,请勿转载。