QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
qgsdxfwriter.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgsdxfexport.cpp
3  -------------------------------------------------------------------
4 Date : 20 December 2016
5 Copyright : (C) 2015 by
6 email : marco.hugentobler at sourcepole dot com (original code)
7 Copyright : (C) 2016 by
8 email : david dot marteau at 3liz dot com
9  ***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 #include "qgsmodule.h"
18 #include "qgsdxfwriter.h"
19 #include "qgsdxfexport.h"
20 #include "qgswmsrenderer.h"
21 
22 namespace QgsWms
23 {
24  void writeAsDxf( QgsServerInterface *serverIface, const QgsProject *project,
25  const QString &, const QgsServerRequest &request,
26  QgsServerResponse &response )
27  {
28  // get wms parameters from query
29  QgsWmsParameters parameters( QUrlQuery( request.url() ) );
30 
31  // prepare render context
32  QgsWmsRenderContext context( project, serverIface );
37  context.setParameters( parameters );
38 
39  // Write output
40  QgsRenderer renderer( context );
41  std::unique_ptr<QgsDxfExport> dxf = renderer.getDxf();
42  response.setHeader( "Content-Type", "application/dxf" );
43  dxf->writeToFile( response.io(), parameters.dxfCodec() );
44  }
45 } // namespace QgsWms
qgswmsrenderer.h
QgsWms::QgsWmsParameters
Provides an interface to retrieve and manipulate WMS parameters received from the client.
Definition: qgswmsparameters.h:324
QgsWms::writeAsDxf
void writeAsDxf(QgsServerInterface *serverIface, const QgsProject *project, const QString &, const QgsServerRequest &request, QgsServerResponse &response)
Output GetMap response in DXF format.
Definition: qgsdxfwriter.cpp:24
QgsWms::QgsWmsRenderContext::UseFilter
@ UseFilter
Definition: qgswmsrendercontext.h:42
QgsWms::QgsWmsRenderContext::setFlag
void setFlag(Flag flag, bool on=true)
Sets or unsets a rendering flag according to the on value.
Definition: qgswmsrendercontext.cpp:55
QgsWms::QgsWmsRenderContext::setParameters
void setParameters(const QgsWmsParameters &parameters)
Sets WMS parameters.
Definition: qgswmsrendercontext.cpp:41
QgsServerRequest
QgsServerRequest Class defining request interface passed to services QgsService::executeRequest() met...
Definition: qgsserverrequest.h:39
QgsWms::QgsWmsRenderContext
Rendering context for the WMS renderer.
Definition: qgswmsrendercontext.h:35
QgsProject
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
Definition: qgsproject.h:95
QgsWms::QgsWmsRenderContext::SetAccessControl
@ SetAccessControl
Definition: qgswmsrendercontext.h:46
QgsWms::QgsWmsRenderContext::UseWfsLayersOnly
@ UseWfsLayersOnly
Definition: qgswmsrendercontext.h:48
QgsWms::QgsRenderer::getDxf
std::unique_ptr< QgsDxfExport > getDxf()
Returns the map as DXF data.
Definition: qgswmsrenderer.cpp:832
QgsWms
Median cut implementation.
Definition: qgsdxfwriter.cpp:23
QgsServerResponse::io
virtual QIODevice * io()=0
Returns the underlying QIODevice.
QgsServerRequest::url
QUrl url() const
Definition: qgsserverrequest.cpp:65
qgsdxfwriter.h
qgsdxfexport.h
qgsmodule.h
QgsWms::QgsRenderer
Map renderer for WMS requests.
Definition: qgswmsrenderer.h:64
QgsWms::QgsWmsParameters::dxfCodec
QString dxfCodec() const
Returns the DXF CODEC parameter.
Definition: qgswmsparameters.cpp:2027
QgsServerInterface
QgsServerInterface Class defining interfaces exposed by QGIS Server and made available to plugins.
Definition: qgsserverinterface.h:61
QgsServerResponse
QgsServerResponse Class defining response interface passed to services QgsService::executeRequest() m...
Definition: qgsserverresponse.h:44
QgsServerResponse::setHeader
virtual void setHeader(const QString &key, const QString &value)=0
Set Header entry Add Header entry to the response Note that it is usually an error to set Header afte...
QgsWms::QgsWmsRenderContext::UseOpacity
@ UseOpacity
Definition: qgswmsrendercontext.h:41