1 /***************************************************************************
2                               qgswms.h
3 
4   Define WMS service utility functions
5   ------------------------------------
6   begin                : December 20 , 2016
7   copyright            : (C) 2007 by Marco Hugentobler  ( parts from qgswmshandler)
8                          (C) 2014 by Alessandro Pasotti ( parts from qgswmshandler)
9                          (C) 2016 by David Marteau
10   email                : marco dot hugentobler at karto dot baug dot ethz dot ch
11                          a dot pasotti at itopen dot it
12                          david dot marteau at 3liz dot com
13  ***************************************************************************/
14 
15 /***************************************************************************
16  *                                                                         *
17  *   This program is free software; you can redistribute it and/or modify  *
18  *   it under the terms of the GNU General Public License as published by  *
19  *   the Free Software Foundation; either version 2 of the License, or     *
20  *   (at your option) any later version.                                   *
21  *                                                                         *
22  ***************************************************************************/
23 #ifndef QGSWMSUTILS_H
24 #define QGSWMSUTILS_H
25 
26 #include "qgsmodule.h"
27 #include "qgsserversettings.h"
28 
29 class QgsRectangle;
30 
31 /**
32  * \ingroup server
33  * \brief WMS implementation
34  */
35 
36 //! WMS implementation
37 namespace QgsWms
38 {
39   //! Supported image output format
40   enum ImageOutputFormat
41   {
42     UNKN,
43     PNG,
44     PNG8,
45     PNG16,
46     PNG1,
47     JPEG,
48     WEBP
49   };
50 
51   /**
52    * Returns WMS service URL
53    */
54   QUrl serviceUrl( const QgsServerRequest &request, const QgsProject *project, const QgsServerSettings &settings );
55 
56   /**
57    * Parse image format parameter
58    *  \returns OutputFormat
59    */
60   ImageOutputFormat parseImageFormat( const QString &format );
61 
62   /**
63    * Write image response
64    */
65   void writeImage( QgsServerResponse &response, QImage &img, const QString &formatStr,
66                    int imageQuality = -1 );
67 } // namespace QgsWms
68 
69 #endif
70 
71 
72