예제 #1
0
 public function addElement(XMLElement $element)
 {
     $name = $element->name();
     $value = $element->value();
     switch ($name) {
         case 'item':
             $this->items[] = $element;
             break;
         default:
             parent::addElement($element);
             break;
     }
 }
예제 #2
0
파일: KMLPoint.php 프로젝트: nncsang/Kurogo
 public function addElement(XMLElement $element)
 {
     $name = $element->name();
     $value = $element->value();
     switch ($name) {
         // more tags see
         // http://code.google.com/apis/kml/documentation/kmlreference.html#point
         case 'COORDINATES':
             $xyz = explode(',', $value);
             $this->coordinate = array('lon' => trim($xyz[0]), 'lat' => trim($xyz[1]), 'altitude' => isset($xyz[2]) ? trim($xyz[2]) : null);
             break;
         default:
             parent::addElement($element);
             break;
     }
 }
예제 #3
0
 public function addElement(XMLElement $element)
 {
     $name = $element->name();
     $value = $element->value();
     switch ($name) {
         // more tags see
         // http://code.google.com/apis/kml/documentation/kmlreference.html#polygon
         case 'OUTERBOUNDARYIS':
             $this->outerBoundary = $element->getChildElement('LINEARRING');
             break;
         case 'INNERBOUNDARYIS':
             $this->innerBoundaries[] = $element->getChildElement('LINEARRING');
             break;
         default:
             parent::addElement($element);
             break;
     }
 }
예제 #4
0
 public function addElement(XMLElement $element)
 {
     $name = $element->name();
     $value = $element->value();
     switch ($name) {
         // more tags see
         // http://code.google.com/apis/kml/documentation/kmlreference.html#linestring
         case 'COORDINATES':
             foreach (preg_split('/\\s/', trim($value)) as $line) {
                 $xyz = explode(',', trim($line));
                 if (count($xyz) >= 2) {
                     $this->coordinates[] = array('lon' => $xyz[0], 'lat' => $xyz[1], 'altitude' => isset($xyz[2]) ? $xyz[2] : null);
                 }
             }
             break;
         default:
             parent::addElement($element);
             break;
     }
 }
예제 #5
0
 public function addElement(XMLElement $element)
 {
     $name = $element->name();
     $value = $element->value();
     switch ($name) {
         case 'LINK':
             if (!$value) {
                 if ($link = $element->getAttrib('HREF')) {
                     $element->shouldStripTags(true);
                     $element->setValue($link);
                 }
             }
             parent::addElement($element);
             break;
         case 'enclosure':
             $this->enclosure = $element;
             $this->enclosures[] = $element;
             break;
         case 'image':
             $this->images[] = $element;
             break;
         case 'CATEGORY':
             $name = strtolower($name);
             array_push($this->{$name}, $value);
             break;
         case 'PUBDATE':
         case 'DC:DATE':
         case 'PUBLISHED':
         case 'UPDATED':
             if ($value = $element->value()) {
                 try {
                     if ($date = new DateTime($value)) {
                         $this->pubDate = $date;
                     }
                 } catch (Exception $e) {
                 }
             }
             break;
         case 'AUTHOR':
             if ($name = $element->getProperty('name')) {
                 $this->author = $name;
             } else {
                 parent::addElement($element);
             }
             break;
         default:
             parent::addElement($element);
             break;
     }
 }
예제 #6
0
 public function addElement(XMLElement $element)
 {
     $name = $element->name();
     $value = $element->value();
     $map = $this->elementMap();
     
     if (array_key_exists($name, $map)) {
         $this->$map[$name] = $value;
     } elseif (isset($this->properties[$name])) {
         if (!is_array($this->properties[$name])) {
             $this->properties[$name] = array($this->properties[$name]);
         }
         $this->properties[$name][] = $element;
     } else {
         $this->properties[$name] = $element;
     }
 }
예제 #7
0
파일: KMLStyle.php 프로젝트: nncsang/Kurogo
 public function addElement(XMLElement $element)
 {
     $name = $element->name();
     $value = $element->value();
     switch ($name) {
         case 'ICONSTYLE':
             $iconChild = $element->getChildElement('ICON');
             $this->iconStyle = array(MapStyle::ICON => $iconChild->getProperty('HREF'), MapStyle::WIDTH => $element->getProperty('W'), MapStyle::HEIGHT => $element->getProperty('H'), MapStyle::SCALE => $element->getProperty('SCALE'));
             break;
         case 'BALLOONSTYLE':
             $this->balloonStyle = array(MapStyle::FILLCOLOR => $element->getProperty('BGCOLOR'), MapStyle::COLOR => $element->getProperty('TEXTCOLOR'));
             break;
         case 'LINESTYLE':
             $this->lineStyle = array(MapStyle::COLOR => $element->getProperty('COLOR'), MapStyle::WEIGHT => $element->getProperty('WEIGHT'));
             break;
         case 'POLYSTYLE':
             // if OUTLINE == 1, keep track and use lineStyle for outlines
             // if FILL == 1, use supplied color, otherwise just ignore color
             $shouldFill = $element->getProperty('FILL');
             $color = $shouldFill ? $element->getProperty('COLOR') : null;
             $this->polyStyle = array(MapStyle::FILLCOLOR => $color, MapStyle::SHOULD_OUTLINE => $element->getProperty('OUTLINE'));
             break;
         case 'LABELSTYLE':
             $this->labelStyle = array();
             break;
         case 'LISTSTYLE':
             $this->listStyle = array();
             break;
         case 'PAIR':
             $state = $element->getProperty('KEY');
             $styleRef = substr($element->getProperty('STYLEURL'), 1);
             $style = $this->styleContainer->getStyle($styleRef);
             // store the style URL if the parser hasn't yet loaded the associated simple style
             if ($state == 'normal') {
                 $this->normalStyle = $style ? $styleRef : $style;
             } else {
                 if ($state == 'highlighted') {
                     $this->highlightStyle = $style ? $styleRef : $style;
                 }
             }
             break;
         default:
             parent::addElement($element);
             break;
     }
 }
예제 #8
0
 public function addElement(XMLElement $element)
 {
     $name = $element->name();
     $value = $element->value();
     switch ($name) {
         case 'LINK':
             if (!$value) {
                 if ($link = $element->getAttrib('HREF')) {
                     $element->setValue($link, true);
                 }
             }
             parent::addElement($element);
             break;
         case 'enclosure':
             $this->enclosure = $element;
             break;
         case 'image':
             $this->images[] = $element;
             break;
         case 'CATEGORY':
             $name = strtolower($name);
             array_push($this->{$name}, $value);
             break;
         default:
             parent::addElement($element);
             break;
     }
 }
 public function addElement(XMLElement $element)
 {
     $name = $element->name();
     $value = $element->value();
     
     switch ($name)
     {
         case 'NAME':
             $this->styleName = $value;
             break;
         case 'TITLE':
             $this->title = $value;
             break;
         default:
             parent::addElement($element);
             break;
     }
 }