File indexing completed on 2025-05-04 05:32:35

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_GmlPos
0036  */
0037 // require_once 'Zend/Gdata/Geo/Extension/GmlPos.php';
0038 
0039 
0040 /**
0041  * Represents the gml:point 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_GmlPoint extends Zend_Gdata_Extension
0050 {
0051 
0052     protected $_rootNamespace = 'gml';
0053     protected $_rootElement = 'Point';
0054 
0055     /**
0056      * The position represented by this GmlPoint
0057      *
0058      * @var Zend_Gdata_Geo_Extension_GmlPos
0059      */
0060     protected $_pos = null;
0061 
0062     /**
0063      * Create a new instance.
0064      *
0065      * @param Zend_Gdata_Geo_Extension_GmlPos $pos (optional) Pos to which this
0066      *          object should be initialized.
0067      */
0068     public function __construct($pos = null)
0069     {
0070         $this->registerAllNamespaces(Zend_Gdata_Geo::$namespaces);
0071         parent::__construct();
0072         $this->setPos($pos);
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->_pos !== null) {
0088             $element->appendChild($this->_pos->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') . ':' . 'pos';
0105                 $pos = new Zend_Gdata_Geo_Extension_GmlPos();
0106                 $pos->transferFromDOM($child);
0107                 $this->_pos = $pos;
0108                 break;
0109         }
0110     }
0111 
0112     /**
0113      * Get the value for this element's pos attribute.
0114      *
0115      * @see setPos
0116      * @return Zend_Gdata_Geo_Extension_GmlPos The requested attribute.
0117      */
0118     public function getPos()
0119     {
0120         return $this->_pos;
0121     }
0122 
0123     /**
0124      * Set the value for this element's distance attribute.
0125      *
0126      * @param Zend_Gdata_Geo_Extension_GmlPos $value The desired value for this attribute
0127      * @return Zend_Gdata_Geo_Extension_GmlPoint Provides a fluent interface
0128      */
0129     public function setPos($value)
0130     {
0131         $this->_pos = $value;
0132         return $this;
0133     }
0134 
0135 
0136 }