Source for file FeatureServerService.php

Documentation is available at FeatureServerService.php

  1. <?php
  2. /**
  3. * Service de type feature server
  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 feature server
  16. @category   PHP
  17. @package    GeoPrisma
  18. @subpackage Service
  19. @author     Pascal Martin
  20. */  
  21. {
  22.     const FEATURESERVER_SERVICE = 'featureserver';
  23.     const TYPE = 'featureserver';
  24.     const TYPE_ID = 3;
  25.  
  26.     /**
  27.     * Construit un instance de org_geoprisma_service_FeatureServerService
  28.     * 
  29.     * @param array $pobjArray Config
  30.     * 
  31.     * @return org_geoprisma_service_FeatureServerService 
  32.     */
  33.     public function __construct($pobjArray
  34.     {
  35.         if (isset($pobjArray['id'])) 
  36.         {
  37.             $strName = (string)$pobjArray['id'];
  38.         }
  39.         else
  40.         {
  41.             $strName = (string)$pobjArray['name'];
  42.         }
  43.  
  44.         $strSource = (string)$pobjArray['source'];
  45.     
  46.         parent::__construct($strName$strSourceself::TYPE$pobjArray);
  47.     }
  48.  
  49.     /**
  50.     * Return the OpenLayers.Layer default options using this type of service.
  51.     * 
  52.     * @param org_geoprisma_config_Config &$pobjConfig Config object
  53.     *
  54.     * @return array 
  55.     */
  56.     public function getDefaultLayerOptions(&$pobjConfig)
  57.     {
  58.         return array(
  59.             'visibility' => 'false',
  60.             'extractAttributes' => 'true'
  61.         );
  62.     }
  63.     
  64.     /**
  65.     *  Ajout le service courant (this) dans le xml
  66.     * 
  67.     * @param DOMElement  &$pobjDomElementServices Noeud xml ou le service doit ĂȘtre ajouter
  68.     * @param DOMDocument &$pobjDomDocument        Document XMl ou le noeud xml datastore est ajouter, utiliser pour construire les noeuds
  69.     * 
  70.     * @return void 
  71.     */
  72.     public function insertIntoXML(DOMElement &$pobjDomElementServicesDOMDocument &$pobjDomDocument)
  73.     {
  74.         $objDomElementService $pobjDomDocument->createElement('service')
  75.         $pobjDomElementServices->appendChild($objDomElementService);        
  76.         $objDomElementType $pobjDomDocument->createElement('type'self::FEATURESERVER_SERVICE);
  77.         $objDomElementName $pobjDomDocument->createElement('name'$this->getName());
  78.         $objDomElementService->appendChild($objDomElementType);
  79.         $objDomElementService->appendChild($objDomElementName);
  80.  
  81.         // options node
  82.         $objDomElementService->appendChild(
  83.             $this->getDomElements(
  84.                 'options'$this->getOptions()$pobjDomDocument
  85.             )
  86.         );
  87.     }
  88.  
  89.     /**
  90.     * Build and execute a get request given a specific layername.
  91.     * 
  92.     * @param string $pstrLayerName The layer name to use in the request.
  93.     * @param string $pstrValue     Condition value for the request
  94.     * 
  95.     * @return string 
  96.     */
  97.     public function getFeature($pstrLayerName$pstrValue)
  98.     {
  99.         $strFormat "geojson";
  100.         $objCurl curl_init(
  101.             $this->getSource()."/".$pstrLayerName."/".$pstrValue.".".$strFormat
  102.         );
  103.         curl_setopt($objCurlCURLOPT_RETURNTRANSFER1);
  104.         $strContents curl_exec($objCurl);
  105.         curl_close($objCurl);
  106.         ob_clean();
  107.  
  108.         return $strContents;
  109.     }
  110. }
  111.   
  112. ?>

Documentation generated on Mon, 20 Feb 2012 13:46:13 -0500 by phpDocumentor 1.4.1