Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
8 changed files
with
221 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from qgis._server import * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
|
||
/**A cache for capabilities xml documents (by configuration file path)*/ | ||
class QgsCapabilitiesCache: public QObject | ||
{ | ||
%TypeHeaderCode | ||
#include <QDomDocument> | ||
#include <QFileSystemWatcher> | ||
#include <QHash> | ||
#include <QObject> | ||
#include "qgscapabilitiescache.h" | ||
%End | ||
public: | ||
|
||
/**Returns cached capabilities document (or 0 if document for configuration file not in cache)*/ | ||
const QDomDocument* searchCapabilitiesDocument( QString configFilePath, QString version ); | ||
/**Inserts new capabilities document (creates a copy of the document, does not take ownership)*/ | ||
void insertCapabilitiesDocument( QString configFilePath, QString version, const QDomDocument* doc ); | ||
|
||
}; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
|
||
/**Exception class for WMS service exceptions. The most important codes are: | ||
"InvalidFormat" | ||
"Invalid CRS" | ||
"LayerNotDefined" / "StyleNotDefined" | ||
"OperationNotSupported"*/ | ||
|
||
class QgsMapServiceException | ||
{ | ||
%TypeHeaderCode | ||
#include <qgsmapserviceexception.h> | ||
%End | ||
public: | ||
QgsMapServiceException( const QString& code, const QString& message ); | ||
QString code() const; | ||
QString message() const; | ||
|
||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/**This class is an interface hiding the details of reading input and writing output from/to a wms request mechanism. | ||
Examples of possible mechanisms are cgi Get, cgi Post, SOAP or the usage as a standalone command line executable*/ | ||
class QgsRequestHandler | ||
{ | ||
%TypeHeaderCode | ||
#include "qgsmapserviceexception.h" | ||
#include "qgsrequesthandler.h" | ||
|
||
%End | ||
|
||
public: | ||
|
||
virtual void parseInput() = 0; | ||
virtual void setGetMapResponse( const QString& service, QImage* img, int imageQuality ) = 0; | ||
virtual void setGetCapabilitiesResponse( const QDomDocument& doc ) = 0; | ||
virtual void setGetFeatureInfoResponse( const QDomDocument& infoDoc, const QString& infoFormat ) = 0; | ||
virtual void setServiceException( QgsMapServiceException ex ) = 0; | ||
virtual void setGetStyleResponse( const QDomDocument& doc ) = 0; | ||
virtual void setGetPrintResponse( QByteArray* ba ) = 0; | ||
virtual bool startGetFeatureResponse( QByteArray* ba, const QString& infoFormat ) = 0; | ||
virtual void setGetFeatureResponse( QByteArray* ba ) = 0; | ||
virtual void endGetFeatureResponse( QByteArray* ba ) = 0; | ||
virtual void setGetCoverageResponse( QByteArray* ba ) = 0; | ||
|
||
/**Set an HTTP header*/ | ||
virtual void setHeader( const QString &name, const QString &value ) = 0; | ||
/**Remove an HTTP header*/ | ||
virtual int removeHeader( const QString &name ) = 0; | ||
/**Delete all HTTP headers*/ | ||
virtual void clearHeaders( ) = 0; | ||
/**Append the bytestream to response body*/ | ||
virtual void appendBody( const QByteArray &body) = 0; | ||
/**Clears the response body*/ | ||
virtual void clearBody( ) = 0; | ||
virtual void setInfoFormat( const QString &format ) = 0; | ||
virtual void sendResponse( ) const = 0; | ||
virtual bool responseReady() const = 0; | ||
/**Pointer to last raised exception*/ | ||
virtual bool exceptionRaised() const = 0; | ||
QMap<QString, QString> parameterMap( ); | ||
/**Set a request parameter*/ | ||
virtual void setParameter(const QString &key, const QString &value) = 0; | ||
/**Remove a request parameter*/ | ||
virtual int removeParameter(const QString &key) = 0; | ||
/**Return a request parameter*/ | ||
virtual QString parameter(const QString &key) const = 0; | ||
QString format() const; | ||
|
||
protected: | ||
|
||
virtual void sendHeaders( ) const = 0; | ||
virtual void sendBody( ) const = 0; | ||
|
||
|
||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/*************************************************************************** | ||
qgsseerverfilter.h | ||
Server I/O filters class for Qgis Mapserver for use by plugins | ||
------------------- | ||
begin : 2014-09-10 | ||
copyright : (C) 2014 by Alessandro Pasotti | ||
email : a dot pasotti at itopen dot it | ||
***************************************************************************/ | ||
|
||
/*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
/** | ||
* QgsServerFilter | ||
* Class defining I/O filters for Qgis Mapserver and | ||
* implemented in plugins | ||
* | ||
*/ | ||
|
||
class QgsServerFilter | ||
{ | ||
%TypeHeaderCode | ||
#include "qgsserverfilter.h" | ||
#include "qgsserverinterface.h" | ||
%End | ||
|
||
public: | ||
|
||
/** Constructor */ | ||
QgsServerFilter( QgsServerInterface* serverInterface /Transfer/); | ||
/** Destructor */ | ||
virtual ~QgsServerFilter(); | ||
QgsServerInterface* serverInterface( ); | ||
virtual void requestReady(); | ||
virtual void responseReady(); | ||
|
||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/** | ||
* \class QgsServerInterface | ||
* \brief Class defining interfaces | ||
* made available to server plugins. | ||
* | ||
* Only functionality exposed by QgisServerInterface can be used in server plugins. | ||
*/ | ||
|
||
|
||
typedef QMultiMap<int, QgsServerFilter*> QgsServerFiltersMap; | ||
|
||
class QgsServerInterface | ||
{ | ||
%TypeHeaderCode | ||
#include "qgsserverinterface.h" | ||
%End | ||
|
||
public: | ||
//virtual void setRequestHandler( QgsRequestHandler* requestHandler) = 0; | ||
virtual QgsCapabilitiesCache* capabiblitiesCache() = 0 /KeepReference/; | ||
virtual QgsRequestHandler* requestHandler( ) = 0 /KeepReference/; | ||
// Tansfer ownership to avoid garbage collector to call dtor | ||
virtual void registerFilter( QgsServerFilter* filter /Transfer/, int priority = 0 ) = 0; | ||
// Commented because of problem with typedef QgsServerFiltersMap | ||
// virtual QgsServerFiltersMap filters( ) = 0; | ||
|
||
private: | ||
/** Constructor */ | ||
QgsServerInterface( ); | ||
|
||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/*************************************************************************** | ||
qgsserverlogger.h | ||
----------------- | ||
begin : May 5, 2014 | ||
copyright : (C) 2014 by Marco Hugentobler | ||
email : marco dot hugentobler at sourcepole dot ch | ||
***************************************************************************/ | ||
|
||
/*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
|
||
/**Writes message log into server logfile*/ | ||
class QgsServerLogger: public QObject | ||
{ | ||
%TypeHeaderCode | ||
#include "qgsserverlogger.h" | ||
%End | ||
|
||
public: | ||
static QgsServerLogger* instance(); | ||
|
||
int logLevel(); | ||
|
||
public slots: | ||
void logMessage( QString message, QString tag, QgsMessageLog::MessageLevel level ); | ||
|
||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
%Module(name=qgis._server, | ||
version=0, | ||
keyword_arguments="Optional") | ||
|
||
|
||
%Import QtCore/QtCoremod.sip | ||
%Import QtGui/QtGuimod.sip | ||
%Import QtXml/QtXmlmod.sip | ||
|
||
%Import core/core.sip | ||
|
||
%Include qgsserverfilter.sip | ||
%Include qgsserverlogger.sip | ||
%Include qgsmapserviceexception.sip | ||
%Include qgscapabilitiescache.sip | ||
%Include qgsrequesthandler.sip | ||
%Include qgsserverinterface.sip |