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


PHP Map::addEncodedPolyline方法代码示例

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


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

示例1: foreach

             $distance = $leg->getDistance();
             //$dist = (String)$distance;
             print_r($distance);
             // Gets the duration
             $duration = $leg->getDuration();
             print_r($duration);
             //summary
             //$summary = $leg->getSummary();
             //print_r ($summary);
             // Gets the directions steps.
             $steps = $leg->getSteps();
             // Iterate each step
             foreach ($steps as $step) {
                 // Gets the encoded polyline.
                 $encodedPolyline = $step->getEncodedPolyline();
                 $map->addEncodedPolyline($encodedPolyline);
             }
         }
     }
     // end of 1st iteration. found time and distance
     //getMarker($org[0]['latitude'],$org[0]['longitude'],$des[0]['latitude'],$des[0]['longitude']);
 }
 if ($i == 1) {
     $org = array();
     $org = getCoord($finarr[$i]);
     //echo $org[0]['latitude'];
     //echo $org[0]['longitude'];
     $des = array();
     $des = getCoord($finarr[$i + 1]);
     //echo $des[0]['latitude'];
     //echo $des[0]['longitude'];
开发者ID:nandhinee,项目名称:Search-of-Spatio-Temporal-Resources,代码行数:31,代码来源:probabilisticGreedy.php

示例2: getMarker2

function getMarker2($orglat, $orglong, $deslat, $deslong)
{
    //creating map
    $map = new Map();
    $map->setPrefixJavascriptVariable('map_');
    $map->setHtmlContainerId('map_canvas');
    $map->setAsync(false);
    $map->setAutoZoom(false);
    $map->setCenter(37.806381, -122.415468, true);
    $map->setMapOption('zoom', 16);
    $map->setBound(-2.1, -3.9, 2.6, 1.4, true, true);
    $map->setMapOption('mapTypeId', MapTypeId::ROADMAP);
    $map->setMapOption('mapTypeId', 'roadmap');
    $map->setMapOption('disableDefaultUI', true);
    $map->setMapOption('disableDoubleClickZoom', true);
    $map->setMapOptions(array('disableDefaultUI' => true, 'disableDoubleClickZoom' => true));
    $map->setStylesheetOption('width', '600px');
    $map->setStylesheetOption('height', '600px');
    $map->setStylesheetOptions(array('width' => '1000px', 'height' => '800px'));
    $map->setLanguage('en');
    //creating marker
    $marker3 = new Marker();
    $marker3->setPrefixJavascriptVariable('marker_');
    $marker3->setPosition($orglat, $orglong, true);
    $marker3->setAnimation(Animation::DROP);
    $marker3->setOption('clickable', true);
    $marker3->setOption('flat', true);
    $marker3->setOptions(array('clickable' => true, 'flat' => true));
    $map->addMarker($marker);
    $marker4 = new Marker();
    $marker4->setPrefixJavascriptVariable('marker_two');
    $marker4->setPosition($deslat, $deslong, true);
    $marker4->setAnimation(Animation::DROP);
    $marker4->setOption('clickable', true);
    $marker4->setOption('flat', true);
    $marker4->setOptions(array('clickable' => true, 'flat' => true));
    $map->addMarker($marker4);
    // trying directions
    $directions = new Directions(new CurlHttpAdapter());
    $request = new DirectionsRequest();
    // Set your origin
    $request->setOrigin($marker3->getPosition(), true);
    // Set your destination
    $request->setDestination($marker4->getPosition(), true);
    $response = $directions->route($request);
    // Get the routes
    $routes = $response->getRoutes();
    // Iterate each routes
    foreach ($routes as $route) {
        // Get the bound
        $bound = $route->getBound();
        // Get the copyrights
        $copyrights = $route->getCopyrights();
        // Get the legs
        $legs = $route->getLegs();
        // Get the summary
        //$summary = $route->getSummary();
        //print_r ($summary);
        foreach ($legs as $leg) {
            // Gets the distance
            $distance = $leg->getDistance();
            //$dist = (String)$distance;
            print_r($distance);
            // Gets the duration
            $duration = $leg->getDuration();
            print_r($duration);
            //summary
            //$summary = $leg->getSummary();
            //print_r ($summary);
            // Gets the directions steps.
            $steps = $leg->getSteps();
            // Iterate each step
            foreach ($steps as $step) {
                // Gets the encoded polyline.
                $encodedPolyline = $step->getEncodedPolyline();
                $map->addEncodedPolyline($encodedPolyline);
            }
        }
    }
    // end of 1st iteration. found time and distance
    //printing the map
    $mapHelper = new MapHelper();
    echo $mapHelper->renderHtmlContainer($map);
    echo $mapHelper->renderJavascripts($map);
}
开发者ID:nandhinee,项目名称:Search-of-Spatio-Temporal-Resources,代码行数:85,代码来源:probabilisticGrav.php


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