提交 239ca98b12abda48d6646c03d5930cab086220a4

作者 LJH 李佳桓
1 个父辈 699adcbf

add

  1 +#include <iostream>
  2 +#include <boost/property_tree/ptree.hpp>
  3 +#include <boost/property_tree/xml_parser.hpp>
  4 +#include <boost/typeof/typeof.hpp>
  5 +#include <string>
  6 +#include <fstream>
  7 +#include "dmpcapabilitiesoperation.h"
  8 +#include "dmpserverresponse.h"
  9 +
  10 +using namespace std;
  11 +namespace DmpWmts
  12 +{
  13 + DmpCapabiliTilesOperation::DmpCapabiliTilesOperation()
  14 + {
  15 + file_rootPath="/mnt/d/wmts.xml";
  16 + }
  17 + void DmpCapabiliTilesOperation::WriteCapabilities(DmpServerResponse& response)
  18 + {
  19 + //获取能力文档
  20 + std::ifstream fread(file_rootPath, std::ifstream::binary);
  21 + if(!fread)
  22 + {
  23 + response.SendError(500, "找不到文件:(");
  24 + return;
  25 + }
  26 + fread.seekg(0,fread.end);
  27 + int length = fread.tellg();
  28 + if(length>0)
  29 + {
  30 + fread.seekg(0,fread.beg);
  31 + char* buff = new char[length];
  32 + fread.read(buff,length);
  33 +
  34 + response.SetHeader("Content-Type", "application/xml");
  35 + response.WriteContent(buff, length);
  36 +
  37 + delete buff;
  38 + }
  39 + else
  40 + {
  41 + response.SendError(500, "找不到文件:(");
  42 + return;
  43 + }
  44 + }
  45 + void DmpCapabiliTilesOperation::GetCapabilitiesDocument(DmpServerResponse& response)
  46 + {
  47 + //获取能力文档
  48 + std::ifstream fread(file_rootPath, std::ifstream::binary);
  49 + if(!fread)
  50 + {
  51 + response.SendError(500, "找不到文件:(");
  52 + return;
  53 + }
  54 + fread.seekg(0,fread.end);
  55 + int length = fread.tellg();
  56 + if(length>0)
  57 + {
  58 + fread.seekg(0,fread.beg);
  59 + char* buff = new char[length];
  60 + fread.read(buff,length);
  61 +
  62 + response.SetHeader("Content-Type", "application/xml");
  63 + response.WriteContent(buff, length);
  64 +
  65 + delete buff;
  66 + }
  67 + else
  68 + {
  69 + response.SendError(500, "找不到文件:(");
  70 + return;
  71 + }
  72 +
  73 + }
  74 + void DmpCapabiliTilesOperation::CreateGetCapabilitiesDocument(string requestPath)
  75 + {
  76 + //boost::property_tree::ptree pt;
  77 + }
  78 +
  79 + void DmpCapabiliTilesOperation:: GetServiceIdentificationElement(){}
  80 +
  81 + void DmpCapabiliTilesOperation:: GetServiceProviderElement(string provider){}
  82 +
  83 + void DmpCapabiliTilesOperation:: GetServiceMetadataElement(string requestPath){}
  84 +
  85 +}
... ...
注册登录 后发表评论