Source for file GYMOService.php

Documentation is available at GYMOService.php

  1. <?php
  2. /**
  3. * Service de type gymo
  4. *
  5. * PHP versions 5
  6. @category  PHP
  7. @package   GeoPrisma
  8. @author    Pascal Martin
  9. @copyright 2009, Boreal - Information Strategies
  10. @license   http://www.geoprisma.org/license BSD License
  11. @link      http://www.geoprisma.org
  12. */
  13.  
  14. /**
  15. * Service de type gymo
  16. @category   PHP
  17. @package    GeoPrisma
  18. @subpackage Service
  19. @author     Pascal Martin
  20. */   
  21. {
  22.     const GYMO_SERVICE = 'gymo';
  23.     const TYPE = 'gymo';
  24.     const TYPE_ID = 4;
  25.  
  26.     const OSM_HOST = "tile.openstreetmap.org";
  27.     
  28.     private $m_strProvider null;
  29.     private $m_strAPIKey null;
  30.     
  31.     /**
  32.     * Construit un instance de org_geoprisma_service_GYMOService
  33.     * 
  34.     * @param array $pobjArray Config array
  35.     * 
  36.     * @return org_geoprisma_service_GYMOService 
  37.     */
  38.     public function __construct($pobjArray
  39.     {
  40.         // name (using 'id' or 'name')
  41.         if (isset($pobjArray['id'])) 
  42.         {
  43.             $strName = (string)$pobjArray['id'];
  44.         }
  45.         else if (isset($pobjArray['name'])) 
  46.         {
  47.             $strName = (string)$pobjArray['name'];
  48.         }
  49.  
  50.         // source
  51.         if (isset($pobjArray['source'])) 
  52.         {
  53.             $strSource = (string)$pobjArray['source'];
  54.         }
  55.  
  56.         // provider
  57.         if (isset($pobjArray['provider'])) 
  58.         {
  59.             $this->m_strProvider = (string)$pobjArray['provider'];
  60.         }
  61.         else if (isset($pobjArray['options']['provider'])) 
  62.         {
  63.             $this->m_strProvider = (string)$pobjArray['options']['provider'];
  64.             unset($pobjArray['options']['provider']);
  65.         }
  66.  
  67.         // apikey
  68.         if (isset($pobjArray['apikey'])) 
  69.         {
  70.             $this->m_strAPIKey = (string)$pobjArray['apikey'];
  71.         }
  72.         else if (isset($pobjArray['options']['apikey'])) 
  73.         {
  74.             $this->m_strAPIKey = (string)$pobjArray['options']['apikey'];
  75.             unset($pobjArray['options']['apikey']);
  76.         }
  77.         
  78.         parent::__construct($strName$strSourceself::TYPE$pobjArray);
  79.     }
  80.     
  81.     /**
  82.     * Return the supported provider for the gymo service
  83.     * 
  84.     * @return string 
  85.     */
  86.     public function getProvider()
  87.     {
  88.         return $this->m_strProvider;   
  89.     }
  90.     
  91.     /**
  92.     * Return the apikey
  93.     * 
  94.     * @return string 
  95.     */
  96.     public function getAPIKey()
  97.     {
  98.         return $this->m_strAPIKey;
  99.     }
  100.  
  101.     /**
  102.     * Return the OpenLayers.Layer default options using this type of service.
  103.     * 
  104.     * @param org_geoprisma_config_Config &$pobjConfig Config object
  105.     *
  106.     * @return array 
  107.     */
  108.     public function getDefaultLayerOptions(&$pobjConfig)
  109.     {
  110.         $objArrayDefaultLayerOptions array();
  111.  
  112.         if ($pobjConfig->isUsingLegacyWidgets()) 
  113.         {
  114.             $objArrayDefaultLayerOptions array(
  115.                 'sphericalmercator' => "true",
  116.                 'isbaselayer' => "true"
  117.             );
  118.         }
  119.         else
  120.         {
  121.             $objArrayDefaultLayerOptions array(
  122.                 'sphericalMercator' => "true",
  123.                 'isBaseLayer' => "true"
  124.             );
  125.         }
  126.  
  127.         return $objArrayDefaultLayerOptions;
  128.     }
  129.  
  130.     /**
  131.     *  Ajout le service courant (this) dans le xml
  132.     * 
  133.     * @param DOMElement  &$pobjDomElementServices Noeud xml ou le service doit ĂȘtre ajouter
  134.     * @param DOMDocument &$pobjDomDocument        Document XMl ou le noeud xml datastore est ajouter, utiliser pour construire les noeuds
  135.     * 
  136.     * @return void 
  137.     */
  138.     public function insertIntoXML(DOMElement &$pobjDomElementServicesDOMDocument &$pobjDomDocument)
  139.     {
  140.         $objDomElementService $pobjDomDocument->createElement('service')
  141.         $pobjDomElementServices->appendChild($objDomElementService);        
  142.         $objDomElementType $pobjDomDocument->createElement('type'self::GYMO_SERVICE);
  143.         $objDomElementName $pobjDomDocument->createElement('name'$this->getName());
  144.         $objDomElementAPIKey $pobjDomDocument->createElement('apikey'$this->getAPIKey());
  145.         $objDomElementProvider $pobjDomDocument->createElement('provider'$this->getProvider());
  146.         $objDomElementSource $pobjDomDocument->createElement('source');
  147.         $objDomElementSource->appendChild($pobjDomDocument->createCDATASection($this->getSource()));
  148.         $objDomElementService->appendChild($objDomElementType);
  149.         $objDomElementService->appendChild($objDomElementName)
  150.         $objDomElementService->appendChild($objDomElementAPIKey);
  151.         $objDomElementService->appendChild($objDomElementProvider);
  152.         $objDomElementService->appendChild($objDomElementSource);
  153.  
  154.         // options node
  155.         $objDomElementService->appendChild(
  156.             $this->getDomElements(
  157.                 'options'$this->getOptions()$pobjDomDocument
  158.             )
  159.         );          
  160.     }
  161. }
  162.   
  163. ?>

Documentation generated on Thu, 19 Jan 2012 00:08:35 +0400 by phpDocumentor 1.4.1