当前位置: 首页>>代码示例>>PHP>>正文


PHP Facilities::get方法代码示例

本文整理汇总了PHP中Facilities::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Facilities::get方法的具体用法?PHP Facilities::get怎么用?PHP Facilities::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Facilities的用法示例。


在下文中一共展示了Facilities::get方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: promo2Action

 public function promo2Action()
 {
     header("Content-type: image/png");
     $im = imagecreatefromjpeg('images/continental.jpg');
     imagealphablending($im, true);
     imagesavealpha($im, true);
     $textcolor = imagecolorallocatealpha($im, 0, 0, 0, 0);
     $shadowcolor = imagecolorallocatealpha($im, 255, 255, 255, 64);
     $icon = imagecreatefrompng('images/small_green_ball.png');
     $icon_width = 10;
     $icon_height = 10;
     $model = new Facilities();
     $smodel = new Site();
     $sites = $smodel->getgroupby("facility_id");
     $markers = array();
     foreach ($model->get() as $facility) {
         $site = $sites[$facility->id][0];
         //pick the first site
         //create acronym
         $name = $facility->name;
         $name2 = str_replace("_", " ", $name);
         $tokens = explode(" ", $name2);
         $acro = "";
         foreach ($tokens as $token) {
             if ($token == "The") {
                 continue;
             }
             if ($token == "of") {
                 continue;
             }
             if ($token == "at") {
                 continue;
             }
             $acro .= $token[0];
         }
         $lat = $site->latitude;
         $long = $site->longitude;
         //merge to a site nearby
         $merged = false;
         if (isset($_REQUEST["acro"])) {
             foreach ($markers as &$m) {
                 if (abs($m["longitude"] - $long) < 2.5 and abs($m["latitude"] - $lat) < 0.5) {
                     $m["name"] .= "/" . $name;
                     $m["acronym"] .= "/" . $acro;
                     $m["longitude"] = ($m["longitude"] + $long) / 2;
                     $m["latitude"] = ($m["latitude"] + $lat) / 2;
                     $merged = true;
                     break;
                 }
             }
         } else {
             $acro = "";
         }
         //draw mark
         if (!$merged) {
             $marker = array("name" => $name, "acronym" => $acro, "longitude" => $long, "latitude" => $lat, "sites" => $sites[$facility->id]);
             $markers[] = $marker;
         }
     }
     //draw all markers
     $font = "images/verdanab.ttf";
     $font_size = 9;
     foreach ($markers as $marker) {
         list($x, $y) = $this->ll2xy($marker["longitude"], $marker["latitude"]);
         imagecopy($im, $icon, $x, $y, 0, 0, $icon_width, $icon_height);
         imagettftext($im, $font_size, 0, $x + $icon_width + 1, $y + $icon_height + 1, $shadowcolor, $font, $marker["acronym"]);
         imagettftext($im, $font_size, 0, $x + $icon_width, $y + $icon_height, $textcolor, $font, $marker["acronym"]);
     }
     imagepng($im);
     imagedestroy($im);
     $this->render("none", null, true);
 }
开发者ID:wangfeilong321,项目名称:myosg,代码行数:72,代码来源:MapController.php


注:本文中的Facilities::get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。