Example #1
0
 /**
  * Add circle to map
  * @param string $value
  * @return boolean
  */
 public function addElementCircle($value)
 {
     $return = true;
     $stringscircle = explode($GLOBALS['egMultiMaps_SeparatorItems'], $value);
     foreach ($stringscircle as $circlevalue) {
         if (trim($circlevalue) == '') {
             continue;
         }
         $circle = new Circle();
         if (!$circle->parse($circlevalue, $this->classname)) {
             $return = false;
             $this->errormessages = array_merge($this->errormessages, $circle->getErrorMessages());
         }
         if (!$circle->isValid()) {
             continue;
         }
         $this->circles[] = $circle;
         $circlescount = count($circle->pos);
         for ($index = 0; $index < $circlescount; $index++) {
             $ne = new Point($circle->pos[$index]->lat, $circle->pos[$index]->lon);
             $sw = new Point($circle->pos[$index]->lat, $circle->pos[$index]->lon);
             $ne->move($circle->radiuses[$index], $circle->radiuses[$index]);
             $sw->move(-$circle->radiuses[$index], -$circle->radiuses[$index]);
             $this->elementsBounds->extend(array($ne, $sw));
         }
     }
     return $return;
 }