本文整理汇总了PHP中Map::setPrefixJavascriptVariable方法的典型用法代码示例。如果您正苦于以下问题:PHP Map::setPrefixJavascriptVariable方法的具体用法?PHP Map::setPrefixJavascriptVariable怎么用?PHP Map::setPrefixJavascriptVariable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Map
的用法示例。
在下文中一共展示了Map::setPrefixJavascriptVariable方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: main
$cc = main($_node, $_date, $_ti, $_co);
//echo $cc;
//print_r($myarr);
//print_r($myarr);
$newarr = array();
$newarr = array_unique($myarr);
//print_r($newarr);
$finarr = array();
foreach ($newarr as $s) {
$fin = substr($s, 0, 4);
$finarr[] = $fin;
}
//print_r($finarr);////////////////////////////final array with nodes!!!!!!
$len = count($finarr);
$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');
示例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);
}