source: extensions/Google2Piwigo/include/Zend/Gdata/Geo/Extension/GmlPoint.php @ 17475

Last change on this file since 17475 was 17475, checked in by mistic100, 12 years ago

new extension: Google2Piwigo

File size: 3.8 KB
Line 
1<?php
2
3/**
4 * Zend Framework
5 *
6 * LICENSE
7 *
8 * This source file is subject to the new BSD license that is bundled
9 * with this package in the file LICENSE.txt.
10 * It is also available through the world-wide-web at this URL:
11 * http://framework.zend.com/license/new-bsd
12 * If you did not receive a copy of the license and are unable to
13 * obtain it through the world-wide-web, please send an email
14 * to license@zend.com so we can send you a copy immediately.
15 *
16 * @category   Zend
17 * @package    Zend_Gdata
18 * @subpackage Geo
19 * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
20 * @license    http://framework.zend.com/license/new-bsd     New BSD License
21 * @version    $Id: GmlPoint.php 24594 2012-01-05 21:27:01Z matthew $
22 */
23
24/**
25 * @see Zend_Gdata_Extension
26 */
27require_once 'Zend/Gdata/Extension.php';
28
29/**
30 * @see Zend_Gdata_Geo
31 */
32require_once 'Zend/Gdata/Geo.php';
33
34/**
35 * @see Zend_Gdata_Geo_Extension_GmlPos
36 */
37require_once 'Zend/Gdata/Geo/Extension/GmlPos.php';
38
39
40/**
41 * Represents the gml:point element used by the Gdata Geo extensions.
42 *
43 * @category   Zend
44 * @package    Zend_Gdata
45 * @subpackage Geo
46 * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
47 * @license    http://framework.zend.com/license/new-bsd     New BSD License
48 */
49class Zend_Gdata_Geo_Extension_GmlPoint extends Zend_Gdata_Extension
50{
51
52    protected $_rootNamespace = 'gml';
53    protected $_rootElement = 'Point';
54
55    /**
56     * The position represented by this GmlPoint
57     *
58     * @var Zend_Gdata_Geo_Extension_GmlPos
59     */
60    protected $_pos = null;
61
62    /**
63     * Create a new instance.
64     *
65     * @param Zend_Gdata_Geo_Extension_GmlPos $pos (optional) Pos to which this
66     *          object should be initialized.
67     */
68    public function __construct($pos = null)
69    {
70        $this->registerAllNamespaces(Zend_Gdata_Geo::$namespaces);
71        parent::__construct();
72        $this->setPos($pos);
73    }
74
75    /**
76     * Retrieves a DOMElement which corresponds to this element and all
77     * child properties.  This is used to build an entry back into a DOM
78     * and eventually XML text for application storage/persistence.
79     *
80     * @param DOMDocument $doc The DOMDocument used to construct DOMElements
81     * @return DOMElement The DOMElement representing this element and all
82     *          child properties.
83     */
84    public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
85    {
86        $element = parent::getDOM($doc, $majorVersion, $minorVersion);
87        if ($this->_pos !== null) {
88            $element->appendChild($this->_pos->getDOM($element->ownerDocument));
89        }
90        return $element;
91    }
92
93    /**
94     * Creates individual Entry objects of the appropriate type and
95     * stores them as members of this entry based upon DOM data.
96     *
97     * @param DOMNode $child The DOMNode to process
98     */
99    protected function takeChildFromDOM($child)
100    {
101        $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
102
103        switch ($absoluteNodeName) {
104            case $this->lookupNamespace('gml') . ':' . 'pos';
105                $pos = new Zend_Gdata_Geo_Extension_GmlPos();
106                $pos->transferFromDOM($child);
107                $this->_pos = $pos;
108                break;
109        }
110    }
111
112    /**
113     * Get the value for this element's pos attribute.
114     *
115     * @see setPos
116     * @return Zend_Gdata_Geo_Extension_GmlPos The requested attribute.
117     */
118    public function getPos()
119    {
120        return $this->_pos;
121    }
122
123    /**
124     * Set the value for this element's distance attribute.
125     *
126     * @param Zend_Gdata_Geo_Extension_GmlPos $value The desired value for this attribute
127     * @return Zend_Gdata_Geo_Extension_GmlPoint Provides a fluent interface
128     */
129    public function setPos($value)
130    {
131        $this->_pos = $value;
132        return $this;
133    }
134
135
136}
Note: See TracBrowser for help on using the repository browser.