addOverlay() публичный метод

public addOverlay ( $overlay )
$overlay
Пример #1
3
 public function actionViewAdvert($id)
 {
     $model = Advert::findOne($id);
     $data = ['name', 'email', 'text'];
     $model_feedback = new DynamicModel($data);
     $model_feedback->addRule('name', 'required');
     $model_feedback->addRule('email', 'required');
     $model_feedback->addRule('text', 'required');
     $model_feedback->addRule('email', 'email');
     if (Yii::$app->request->isPost) {
         if ($model_feedback->load(Yii::$app->request->post()) && $model_feedback->validate()) {
             Yii::$app->common->sendMail('Subject Advert', $model_feedback->text);
         }
     }
     $user = $model->user;
     $images = Common::getImageAdvert($model, false);
     $current_user = ['email' => '', 'username' => ''];
     if (!Yii::$app->user->isGuest) {
         $current_user['email'] = Yii::$app->user->identity->email;
         $current_user['username'] = Yii::$app->user->identity->username;
     }
     $coords = str_replace(['(', ')'], '', $model->location);
     $coords = explode(',', $coords);
     $coord = new LatLng(['lat' => $coords[0], 'lng' => $coords[1]]);
     $map = new Map(['center' => $coord, 'zoom' => 15]);
     $marker = new Marker(['position' => $coord, 'title' => Common::getTitleAdvert($model)]);
     $map->addOverlay($marker);
     return $this->render('view_advert', ['model' => $model, 'model_feedback' => $model_feedback, 'user' => $user, 'images' => $images, 'current_user' => $current_user, 'map' => $map]);
 }
Пример #2
0
 /**
  * @inheritdoc
  */
 public function run()
 {
     $coord = new LatLng(['lat' => $this->model->latitude, 'lng' => $this->model->longitude]);
     $this->mapOptions['center'] = $coord;
     $map = new Map($this->mapOptions);
     $marker = new Marker(array_merge($this->markerOptions, ['position' => $coord]));
     $map->addOverlay($marker);
     echo Html::tag('div', $map->display(), ['class' => 'map-canvas']);
 }
Пример #3
0
$map->width = '100%';
$map->height = '431';
// Lets add a marker now
$marker = new Marker(['position' => $coord, 'title' => 'My Home Town']);
// Lets add a marker now
$circle = new Circle(['center' => $coord, 'radius' => 3000]);
// Add marker to the map
$map->addOverlay($marker);
$map->addOverlay($circle);
$map2 = new Map(['center' => $coord, 'zoom' => 14]);
$map2->width = '100%';
$map2->height = '176';
// Lets add a marker now
$marker2 = new Marker(['position' => $coord, 'title' => 'My Home Town']);
// Add marker to the map
$map2->addOverlay($marker2);
echo distance($model->location->lat, $model->location->lng, $model2->location->lat, $model2->location->lng);
?>

<?php 
echo Yii::$app->request->url == '/index' ? 'yes' : 'no';
?>

<div class="site-index">
<div class="body-content">
    <div class="card_container record-md grid-item fadeInUp animated" id="card_container" style="float:none;">
        <a href="<?php 
echo Url::to('/services');
?>
">
            <div class="media-area">                
Пример #4
0
use dosamigos\google\maps\Map;
use dosamigos\google\maps\services\DirectionsRequest;
use dosamigos\google\maps\overlays\Polygon;
use dosamigos\google\maps\layers\BicyclingLayer;
$map = new Map(['center' => new LatLng(['lat' => 39.720089311812096, 'lng' => 2.91165944519042]), 'zoom' => 1]);
$map->containerOptions = ["id" => "main_map", "style" => "width:100%; height:500px;padding:20px;"];
$map->width = "100%";
$map->height = "500px";
foreach ($reports as $report) {
    $coord = new LatLng(['lat' => $report->lat, 'lng' => $report->long]);
    // Lets add a marker now
    ${$report->idmain} = new Marker(['position' => $coord]);
    // Provide a shared InfoWindow to the marker
    ${$report->idmain}->attachInfoWindow(new InfoWindow(['content' => '<p>' . $report->problem_prose . '</p>']));
    // Add marker to the map
    $map->addOverlay(${$report->idmain});
}
/*
$js = "$(checkbox).onChange(function() {";

foreach($reports as $report) {
    $js .=  "gmarker".$report->idmain.".setVisibility(false)";
}

$js .= "}";

$map->appendScript($js); */
// Display the map -finally :)
echo $map->display();
?>
Пример #5
0
 public function map($width = 400, $height = 420, $lw = null, $m = true)
 {
     $coord = new LatLng(['lat' => $this->lat, 'lng' => $this->lng]);
     $map = new Map(['center' => $coord, 'zoom' => $this->mapZoom($lw)]);
     $map->width = $width;
     $map->height = $height;
     if ($m) {
         // Lets add a marker now
         $marker = new Marker(['position' => $coord, 'title' => 'Mesto gde vršimo uslugu']);
         // Add marker to the map
         $map->addOverlay($marker);
     }
     if ($lw) {
         // Lets add a marker now
         $circle = new Circle(['center' => $coord, 'radius' => $lw * 1000, 'strokeColor' => '#2196F3', 'strokeWeight' => 1, 'fillOpacity' => 0.08]);
         $map->addOverlay($circle);
     }
     return $map;
 }
Пример #6
0
<?php 
$this->beginBody();
?>
    <!-- main body, remove div for height compability -->
    <?php 
echo $content;
?>

    <div id="map">
        <?php 
$coord = new LatLng(['lat' => 48.751678, 'lng' => 44.478525]);
$marker = new Marker(['position' => $coord, 'title' => 'My Home Town', 'icon' => '/img/map-pin.png']);
$marker->attachInfoWindow(new InfoWindow(['content' => '<div>' . '<h2>Унико</h2>' . '<b>Адрес</b>: г.Волгоград, ул. Землячки 30а, 5 подъезд, код домофона 42<br>' . '<b>Унико</b> &ndash; интернет &dash; провайдер и оператор связи в Волгоградской области.' . '</div>']));
$map = new Map(['width' => '100%', 'height' => '100%', 'center' => $coord, 'zoom' => 17, 'scrollwheel' => false, 'panControl' => false, 'mapTypeControl' => false, 'streetViewControl' => false, 'styles' => '[{"stylers":[{"saturation":-100},{"gamma":1}]},{"elementType":"labels.text.stroke","stylers":[{"visibility":"off"}]},{"featureType":"poi.business","elementType":"labels.text","stylers":[{"visibility":"off"}]},{"featureType":"poi.business","elementType":"labels.icon","stylers":[{"visibility":"off"}]},{"featureType":"poi.place_of_worship","elementType":"labels.text","stylers":[{"visibility":"off"}]},{"featureType":"poi.place_of_worship","elementType":"labels.icon","stylers":[{"visibility":"off"}]},{"featureType":"road","elementType":"geometry","stylers":[{"visibility":"simplified"}]},{"featureType":"water","stylers":[{"visibility":"on"},{"saturation":50},{"gamma":0},{"hue":"#50a5d1"}]},{"featureType":"administrative.neighborhood","elementType":"labels.text.fill","stylers":[{"color":"#333333"}]},{"featureType":"road.local","elementType":"labels.text","stylers":[{"weight":0.5},{"color":"#333333"}]},{"featureType":"transit.station","elementType":"labels.icon","stylers":[{"gamma":1},{"saturation":50}]}]']);
$map->addOverlay($marker);
echo $map->display();
?>
    </div>
    <footer class="main-footer">
        <div>
            <div class="row">
                <div class="col-lg-5">
                    <h3>О нас</h3>
                    <p>
                        Компания УНИКО является <strong>интернет-провайдером в Волгоградской области</strong>. На базе собственной волоконно-оптической и
                        широкополосной беспроводной сети мы предлагаем интегрированные телекоммуникационные решения для разных категорий
                        клиентов.
                    </p>
                </div>
                <div class="col-lg-4">
Пример #7
0
$waypoints = [new DirectionsWayPoint(['location' => $santo_domingo])];
$directionsRequest = new DirectionsRequest(['origin' => $home, 'destination' => $school, 'waypoints' => $waypoints, 'travelMode' => TravelMode::DRIVING]);
// Lets configure the polyline that renders the direction
$polylineOptions = new PolylineOptions(['strokeColor' => '#FFAA00', 'draggable' => true]);
// Now the renderer
$directionsRenderer = new DirectionsRenderer(['map' => $map->getName(), 'polylineOptions' => $polylineOptions]);
// Finally the directions service
$directionsService = new DirectionsService(['directionsRenderer' => $directionsRenderer, 'directionsRequest' => $directionsRequest]);
// Thats it, append the resulting script to the map
$map->appendScript($directionsService->getJs());
// Lets add a marker now
$marker = new Marker(['position' => $coord, 'title' => 'My Home Town']);
// Provide a shared InfoWindow to the marker
$marker->attachInfoWindow(new InfoWindow(['content' => '<p>ทดสอบ</p>']));
// Add marker to the map
$map->addOverlay($marker);
// Now lets write a polygon
$coords = [new LatLng(['lat' => 25.774252, 'lng' => -80.190262]), new LatLng(['lat' => 18.466465, 'lng' => -66.118292]), new LatLng(['lat' => 32.321384, 'lng' => -64.75736999999999]), new LatLng(['lat' => 25.774252, 'lng' => -80.190262])];
$polygon = new Polygon(['paths' => $coords]);
// Add a shared info window
$polygon->attachInfoWindow(new InfoWindow(['content' => '<p>This is my super cool Polygon</p>']));
// Add it now to the map
$map->addOverlay($polygon);
// Lets show the BicyclingLayer :)
$bikeLayer = new BicyclingLayer(['map' => $map->getName()]);
// Append its resulting script
$map->appendScript($bikeLayer->getJs());
$map->height = 450;
$map->width = 800;
// Display the map -finally :)
echo $map->display();
Пример #8
0
use dosamigos\google\maps\overlays\Marker;
use dosamigos\google\maps\Map;
use dosamigos\google\maps\overlays\Circle;
/* items */
/* maps */
$coord = new LatLng(['lat' => $model->loc->lat, 'lng' => $model->loc->lng]);
$map = new Map(['center' => $coord, 'zoom' => $model->loc_within ? 10 : 15]);
$map->width = '100%';
$map->height = '420';
// Lets add a marker now
$marker = new Marker(['position' => $coord, 'title' => 'My Home Town']);
// Lets add a marker now
$circle = new Circle(['center' => $coord, 'radius' => $model->loc_within ? $model->loc_within * 1000 : 500, 'strokeColor' => '#2196F3', 'strokeWeight' => 1, 'fillOpacity' => 0.08]);
// Add marker to the map
//$map->addOverlay($marker);
$map->addOverlay($circle);
/*$map->appendScript("google.maps.event.addDomListener(mapShowTrigger, 'click', function() {
      $(this).closest('.hidden-content-container').find('div.hidden-content').toggleClass('hidden');
      initialize();
  });");*/
?>
<div class="card_container record-full" id="service-location" style="float:none;">
    <?php 
/* time/loc */
?>
    <div class="hidden-content-container">
        <div class="header-context">                    
            <div class="avatar center gray-color">
                <i class="fa fa-map-marker fa-3x"></i>    
            </div>
            <div class="title">
Пример #9
0
 public function pushMarkers()
 {
     foreach ($this->markers as $marker) {
         $this->map->addOverlay($marker);
     }
 }