QGIS API Documentation  2.12.0-Lyon
qgsserver.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsserver.h
3  QGIS Server main class.
4  -------------------
5  begin : June 05, 2015
6  copyright : (C) 2015 by Alessandro Pasotti
7  email : a dot pasotti at itopen dot it
8 
9  Based on previous work from:
10 
11  begin : July 04, 2006
12  copyright : (C) 2006 by Marco Hugentobler & Ionut Iosifescu Enescu
13  email : marco dot hugentobler at karto dot baug dot ethz dot ch
14 
15  ***************************************************************************/
16 
17 /***************************************************************************
18  * *
19  * This program is free software; you can redistribute it and/or modify *
20  * it under the terms of the GNU General Public License as published by *
21  * the Free Software Foundation; either version 2 of the License, or *
22  * (at your option) any later version. *
23  * *
24  ***************************************************************************/
25 
26 
27 #ifndef QGSSERVER_H
28 #define QGSSERVER_H
29 
30 #include <QFileInfo>
31 #include "qgsrequesthandler.h"
32 #include "qgsapplication.h"
33 #include "qgsmaprenderer.h"
34 #include "qgsconfigcache.h"
35 #include "qgscapabilitiescache.h"
36 
37 #ifdef HAVE_SERVER_PYTHON_PLUGINS
38 #include "qgsserverplugins.h"
39 #include "qgsserverfilter.h"
40 #include "qgsserverinterfaceimpl.h"
41 #endif
42 
43 
47 class SERVER_EXPORT QgsServer
48 {
49  public:
50  QgsServer();
51  ~QgsServer();
57  static bool init( int & argc, char ** argv );
59  static bool init();
60 
72  QPair<QByteArray, QByteArray> handleRequest( const QString queryString = QString( ) );
73  /* The following code was used to test type conversion in python bindings
74  QPair<QByteArray, QByteArray> testQPair( QPair<QByteArray, QByteArray> pair );
75  */
76 
78 #ifdef HAVE_SERVER_PYTHON_PLUGINS
79  QgsServerInterfaceImpl* serverInterface( ) { return mServerInterface; }
80 #endif
81 
82  private:
83  // All functions that where previously in the main file are now
84  // static methods of this class
85  static QString configPath( const QString& defaultConfigPath,
86  const QMap<QString, QString>& parameters );
87  // Mainly for debug
88  static void dummyMessageHandler( QtMsgType type, const char *msg );
89  // Mainly for debug
90  static void printRequestInfos();
91  // Mainly for debug
92  static void printRequestParameters(
93  const QMap< QString, QString>& parameterMap,
94  int logLevel );
95  static QFileInfo defaultProjectFile();
96  static QFileInfo defaultAdminSLD();
97  static void setupNetworkAccessManager();
99  static QgsRequestHandler* createRequestHandler(
100  const bool captureOutput = FALSE );
101 
102  // Server status
103  static QString mConfigFilePath;
104  static QgsCapabilitiesCache* mCapabilitiesCache;
105  static QgsMapRenderer* mMapRenderer;
106 #ifdef HAVE_SERVER_PYTHON_PLUGINS
107  static QgsServerInterfaceImpl* mServerInterface;
108  static bool mInitPython;
109 #endif
110  static bool mInitialised;
111  static QString mServerName;
112  static char* mArgv[1];
113  static int mArgc;
114  static QgsApplication* mQgsApplication;
115  static bool mCaptureOutput;
116 };
117 #endif // QGSSERVER_H
118 
Extends QApplication to provide access to QGIS specific resources such as theme paths, database paths etc.
A non GUI class for rendering a map layer set onto a QPainter.
This class is an interface hiding the details of reading input and writing output from/to a wms reque...
The QgsServer class provides OGC web services.
Definition: qgsserver.h:47
A cache for capabilities xml documents (by configuration file path)