Пример #1
0
 /**
  * Writes the GET response header based on content of the given MgReader
  */
 protected function GetResponseBegin($reader)
 {
     $this->agfRw = new MgAgfReaderWriter();
     $this->wktRw = new MgWktReaderWriter();
     $this->app->response->header("Content-Type", MgMimeType::Xml);
     $schemas = new MgFeatureSchemaCollection();
     $schema = new MgFeatureSchema("TempSchema", "");
     $schemas->Add($schema);
     $classes = $schema->GetClasses();
     $clsDef = $reader->GetClassDefinition();
     $classes->Add($clsDef);
     $output = "<?xml version=\"1.0\" encoding=\"utf-8\"?><FeatureSet>";
     $classXml = $this->featSvc->SchemaToXml($schemas);
     $classXml = substr($classXml, strpos($classXml, "<xs:schema"));
     $output .= $classXml;
     $output .= "<Features>";
     $this->app->response->write($output);
 }
Пример #2
0
 public function Output($format = "xml")
 {
     $schemas = new MgFeatureSchemaCollection();
     $schema = new MgFeatureSchema("TempSchema", "");
     $schemas->Add($schema);
     $classes = $schema->GetClasses();
     $clsDef = $this->reader->GetClassDefinition();
     //We may be plugging in a MgNullFeatureReader here, which may quack
     //like a duck, but is no duck.
     if ($clsDef instanceof MgClassDefinition) {
         $classes->Add($clsDef);
     }
     if ($format === "geojson") {
         $this->OutputGeoJson($schemas);
     } else {
         if ($format === "html") {
             $this->OutputHtml($schemas);
         } else {
             $this->OutputXml($schemas);
         }
     }
 }