File indexing completed on 2024-12-29 05:27:43

0001 <?php
0002 
0003 /**
0004  * Zend Framework
0005  *
0006  * LICENSE
0007  *
0008  * This source file is subject to the new BSD license that is bundled
0009  * with this package in the file LICENSE.txt.
0010  * It is also available through the world-wide-web at this URL:
0011  * http://framework.zend.com/license/new-bsd
0012  * If you did not receive a copy of the license and are unable to
0013  * obtain it through the world-wide-web, please send an email
0014  * to license@zend.com so we can send you a copy immediately.
0015  *
0016  * @category   Zend
0017  * @package    Zend_Gdata
0018  * @subpackage Geo
0019  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0020  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0021  * @version    $Id$
0022  */
0023 
0024 /**
0025  * @see Zend_Gdata_Extension
0026  */
0027 // require_once 'Zend/Gdata/Extension.php';
0028 
0029 /**
0030  * @see Zend_Gdata_Geo
0031  */
0032 // require_once 'Zend/Gdata/Geo.php';
0033 
0034 /**
0035  * @see Zend_Gdata_Geo_Extension_GmlPoint
0036  */
0037 // require_once 'Zend/Gdata/Geo/Extension/GmlPoint.php';
0038 
0039 
0040 /**
0041  * Represents the georss:where element used by the Gdata Geo extensions.
0042  *
0043  * @category   Zend
0044  * @package    Zend_Gdata
0045  * @subpackage Geo
0046  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0047  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0048  */
0049 class Zend_Gdata_Geo_Extension_GeoRssWhere extends Zend_Gdata_Extension
0050 {
0051 
0052     protected $_rootNamespace = 'georss';
0053     protected $_rootElement = 'where';
0054 
0055     /**
0056      * The point location for this geo element
0057      *
0058      * @var Zend_Gdata_Geo_Extension_GmlPoint
0059      */
0060     protected $_point = null;
0061 
0062     /**
0063      * Create a new instance.
0064      *
0065      * @param Zend_Gdata_Geo_Extension_GmlPoint $point (optional) Point to which
0066      *          object should be initialized.
0067      */
0068     public function __construct($point = null)
0069     {
0070         $this->registerAllNamespaces(Zend_Gdata_Geo::$namespaces);
0071         parent::__construct();
0072         $this->setPoint($point);
0073     }
0074 
0075     /**
0076      * Retrieves a DOMElement which corresponds to this element and all
0077      * child properties.  This is used to build an entry back into a DOM
0078      * and eventually XML text for application storage/persistence.
0079      *
0080      * @param DOMDocument $doc The DOMDocument used to construct DOMElements
0081      * @return DOMElement The DOMElement representing this element and all
0082      *          child properties.
0083      */
0084     public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
0085     {
0086         $element = parent::getDOM($doc, $majorVersion, $minorVersion);
0087         if ($this->_point !== null) {
0088             $element->appendChild($this->_point->getDOM($element->ownerDocument));
0089         }
0090         return $element;
0091     }
0092 
0093     /**
0094      * Creates individual Entry objects of the appropriate type and
0095      * stores them as members of this entry based upon DOM data.
0096      *
0097      * @param DOMNode $child The DOMNode to process
0098      */
0099     protected function takeChildFromDOM($child)
0100     {
0101         $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
0102 
0103         switch ($absoluteNodeName) {
0104             case $this->lookupNamespace('gml') . ':' . 'Point';
0105                 $point = new Zend_Gdata_Geo_Extension_GmlPoint();
0106                 $point->transferFromDOM($child);
0107                 $this->_point = $point;
0108                 break;
0109         }
0110     }
0111 
0112     /**
0113      * Get the value for this element's point attribute.
0114      *
0115      * @see setPoint
0116      * @return Zend_Gdata_Geo_Extension_GmlPoint The requested attribute.
0117      */
0118     public function getPoint()
0119     {
0120         return $this->_point;
0121     }
0122 
0123     /**
0124      * Set the value for this element's point attribute.
0125      *
0126      * @param Zend_Gdata_Geo_Extension_GmlPoint $value The desired value for this attribute.
0127      * @return Zend_Gdata_Geo_Extension_GeoRssWhere Provides a fluent interface
0128      */
0129     public function setPoint($value)
0130     {
0131         $this->_point = $value;
0132         return $this;
0133     }
0134 
0135 }