Source for file MapFishPrintService.php

Documentation is available at MapFishPrintService.php

  1. <?php
  2. /**
  3. * MapFishPrint service type
  4. *
  5. * PHP versions 5
  6. @category  PHP
  7. @package   GeoPrisma
  8. @author    Alexandre Dube
  9. @copyright 2010, Centre de Geomatique du Quebec
  10. @license   http://www.geoprisma.org/license BSD License
  11. @link      http://www.geoprisma.org
  12. */
  13.  
  14. /**
  15. * MapFishPrint service type
  16. @category   PHP
  17. @package    GeoPrisma
  18. @subpackage Service
  19. @author     Alexandre Dube
  20. */
  21. {
  22.     const WMS_SERVICE = 'mapfishprint';
  23.     const TYPE = 'mapfishprint';
  24.     const TYPE_ID = 7;
  25.  
  26.     private $m_strFormat null;
  27.     private $m_strSRS null;
  28.     
  29.     /**
  30.     * Creates a new instance of org_geoprisma_service_MapFishPrintService
  31.     * 
  32.     * @param array $pobjArray Config array
  33.     * 
  34.     * @return org_geoprisma_service_MapFishPrintService 
  35.     */
  36.     public function __construct($pobjArray
  37.     {
  38.         if (isset($pobjArray['id'])) 
  39.         {
  40.             $strName = (string)$pobjArray['id'];
  41.         }
  42.         else
  43.         {
  44.             $strName = (string)$pobjArray['name'];
  45.         }
  46.  
  47.         $strSource = (string)$pobjArray['source'];
  48.         
  49.         parent::__construct($strName$strSourceself::TYPE$pobjArray);
  50.     }
  51.  
  52.     /**
  53.     * Return the OpenLayers.Layer default options using this type of service.
  54.     * Since this service won't create any layers, it returns an empty array.
  55.     * 
  56.     * @param org_geoprisma_config_Config &$pobjConfig Config object
  57.     *
  58.     * @return array 
  59.     */
  60.     public function getDefaultLayerOptions(&$pobjConfig)
  61.     {
  62.         return array();
  63.     }
  64.     
  65.     /**
  66.     * Add current service in XML document.
  67.     * 
  68.     * @param DOMElement  &$pobjDomElementServices XML node where this service
  69.     *                                              must be added
  70.     * @param DOMDocument &$pobjDomDocument        DOMDocument XMl used to create
  71.     *                                              new nodes.
  72.     * 
  73.     * @return void 
  74.     */
  75.     public function insertIntoXML(
  76.         DOMElement &$pobjDomElementServices,
  77.         DOMDocument &$pobjDomDocument
  78.     {
  79.         $objDomElementService $pobjDomDocument->createElement('service')
  80.         $pobjDomElementServices->appendChild($objDomElementService);        
  81.         $objDomElementType $pobjDomDocument->createElement('type'self::WMS_SERVICE);
  82.         $objDomElementName $pobjDomDocument->createElement('name'$this->getName());
  83.         $objDomElementService->appendChild($objDomElementType);
  84.         $objDomElementService->appendChild($objDomElementName)
  85.  
  86.         // options node
  87.         $objDomElementService->appendChild(
  88.             $this->getDomElements(
  89.                 'options'$this->getOptions()$pobjDomDocument
  90.             )
  91.         );
  92.     }
  93.  
  94.     /**
  95.     * Get the print capabilities using the source url of the service.  Response
  96.     *     returned is a json string.
  97.     * 
  98.     * @return string 
  99.     */
  100.     public function getCapabilities()
  101.     {
  102.         ob_start();
  103.         $objCurl curl_init($this->getSource());
  104.         curl_exec($objCurl);
  105.         curl_close($objCurl);
  106.         $strContents ob_get_contents();
  107.         ob_clean();
  108.  
  109.         return $strContents;
  110.     }
  111.  
  112.     /**
  113.     * Get the print capabilities using the source url of the service.  Response
  114.     *     returned is a json string.  Replaces the 'printURL' and 'createURL'
  115.     *     parameters to point to the proxy url instead.
  116.     * 
  117.     * @return string 
  118.     */
  119.     public function getCapabilitiesWithProxyURL()
  120.     {
  121.         $objArrayCapabilities json_decode($this->getCapabilities()true);
  122.  
  123.         $objArrayCapabilities['printURL'$this->urlAppend(
  124.             org_geoprisma_SettingImpl::getProxyURL(),
  125.             array("osmservice" => $this->getName())
  126.         );
  127.  
  128.         $objArrayCapabilities['createURL'$this->urlAppend(
  129.             org_geoprisma_SettingImpl::getProxyURL(),
  130.             array("osmservice" => $this->getName())
  131.         );
  132.  
  133.         return json_encode($objArrayCapabilities);
  134.     }
  135. }
  136.   
  137. ?>

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