Пример #1
0
 /**
  * @param array $labels
  */
 public function loadLabels($labels)
 {
     $this->labels = array();
     foreach ($labels as $parent => $childs) {
         foreach ($childs as $id => $zone) {
             try {
                 $type = $zone['lmtype'];
                 $latLng = new Point($zone['pos'][0], $zone['pos'][1]);
                 $p = $this->proj->project($latLng);
                 if ($this->useRegionForce) {
                     $color = $this->getRegionForceColor($zone['regionforce']);
                 } else {
                     $color = $this->defaultColor;
                 }
                 $label = new Label();
                 $label->point = $p;
                 $label->color = $color;
                 $label->text = $zone['text'];
                 $label->type = $type;
                 $this->labels[$parent][$type][$id] = $label;
             } catch (\InvalidArgumentException $e) {
                 /* unknown zone coords */
             }
         }
     }
 }
Пример #2
0
 public function testUnknownZone()
 {
     $this->setExpectedException('\\InvalidArgumentException', 'Coordinates outside known server zone');
     $this->proj->project(new Point(0, 1));
 }