📄 qgswmsprovider.h
字号:
/*************************************************************************** qgswmsprovider.h - QGIS Data provider for OGC Web Map Service layers ------------------- begin : 17 Mar, 2005 copyright : (C) 2005 by Brendan Morley email : morb at ozemail dot com dot au ***************************************************************************//*************************************************************************** * * * 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. * * * ***************************************************************************/ /* $Id: qgswmsprovider.h 6879 2007-04-11 11:46:35Z wonder $ */#ifndef QGSWMSPROVIDER_H#define QGSWMSPROVIDER_H#include <map>#include <vector>#include "qgsrasterdataprovider.h"#include "qgsrect.h"#include <QString>#include <QStringList>#include <QDomElement>class QgsCoordinateTransform;/* * The following structs reflect the WMS XML schema, * as illustrated in Appendix E of the Web Map Service standard, version 1.3, 2004-08-02. */ /** OnlineResource Attribute structure */ // TODO: Fill to WMS specifications struct QgsWmsOnlineResourceAttribute { QString xlinkHref; }; /** Get Property structure */ // TODO: Fill to WMS specifications struct QgsWmsGetProperty { QgsWmsOnlineResourceAttribute onlineResource; }; /** Post Property structure */ // TODO: Fill to WMS specifications struct QgsWmsPostProperty { QgsWmsOnlineResourceAttribute onlineResource; }; /** HTTP Property structure */ // TODO: Fill to WMS specifications struct QgsWmsHttpProperty { QgsWmsGetProperty get; QgsWmsPostProperty post; // can be null }; /** DCP Type Property structure */ // TODO: Fill to WMS specifications struct QgsWmsDcpTypeProperty { QgsWmsHttpProperty http; }; /** Operation Type structure (for GetMap and GetFeatureInfo) */ // TODO: Fill to WMS specifications struct QgsWmsOperationType { QStringList format; std::vector<QgsWmsDcpTypeProperty> dcpType; }; /** Request Property structure */ // TODO: Fill to WMS specifications struct QgsWmsRequestProperty { // QgsWmsGetCapabilitiesProperty ... // -- don't include since if we can get the capabilities, // we already know what's in this part. QgsWmsOperationType getMap; QgsWmsOperationType getFeatureInfo; }; /** Exception Property structure */ // TODO: Fill to WMS specifications struct QgsWmsExceptionProperty { QStringList format; // text formats supported. }; /** Primary Contact Person Property structure */ struct QgsWmsContactPersonPrimaryProperty { QString contactPerson; QString contactOrganization; }; /** Contact Address Property structure */ struct QgsWmsContactAddressProperty { QString addressType; QString address; QString city; QString stateOrProvince; QString postCode; QString country; }; /** Contact Information Property structure */ struct QgsWmsContactInformationProperty { QgsWmsContactPersonPrimaryProperty contactPersonPrimary; QString contactPosition; QgsWmsContactAddressProperty contactAddress; QString contactVoiceTelephone; QString contactFacsimileTelephone; QString contactElectronicMailAddress; }; /** Service Property structure */ // TODO: Fill to WMS specifications struct QgsWmsServiceProperty { // QString name; // Should always be "WMS" QString title; QString abstract; QStringList keywordList; QgsWmsOnlineResourceAttribute onlineResource; QgsWmsContactInformationProperty contactInformation; QString fees; QString accessConstraints; uint layerLimit; uint maxWidth; uint maxHeight; }; /** Bounding Box Property structure */ // TODO: Fill to WMS specifications struct QgsWmsBoundingBoxProperty { QString crs; QgsRect box; // consumes minx, miny, maxx, maxy. double resx; // spatial resolution (in CRS units) double resy; // spatial resolution (in CRS units) }; /** Dimension Property structure */ // TODO: Fill to WMS specifications struct QgsWmsDimensionProperty { QString name; QString units; QString unitSymbol; QString defaultValue; // plain "default" is a reserved word bool multipleValues; bool nearestValue; bool current; }; /** Logo URL Property structure */ // TODO: Fill to WMS specifications struct QgsWmsLogoUrlProperty { QString format; QgsWmsOnlineResourceAttribute onlineResource; int width; int height; }; /** Attribution Property structure */ // TODO: Fill to WMS specifications struct QgsWmsAttributionProperty { QString title; QgsWmsOnlineResourceAttribute onlineResource; QgsWmsLogoUrlProperty logoUrl; }; /** Legend URL Property structure */ // TODO: Fill to WMS specifications struct QgsWmsLegendUrlProperty { QString format; QgsWmsOnlineResourceAttribute onlineResource; int width; int height; }; /** StyleSheet URL Property structure */ // TODO: Fill to WMS specifications struct QgsWmsStyleSheetUrlProperty { QString format; QgsWmsOnlineResourceAttribute onlineResource; }; /** Style URL Property structure */ // TODO: Fill to WMS specifications struct QgsWmsStyleUrlProperty { QString format; QgsWmsOnlineResourceAttribute onlineResource; }; /** Style Property structure */ // TODO: Fill to WMS specifications struct QgsWmsStyleProperty { QString name; QString title; QString abstract; std::vector<QgsWmsLegendUrlProperty> legendUrl; QgsWmsStyleSheetUrlProperty styleSheetUrl; QgsWmsStyleUrlProperty styleUrl; }; /** Authority URL Property structure */ // TODO: Fill to WMS specifications struct QgsWmsAuthorityUrlProperty { QgsWmsOnlineResourceAttribute onlineResource; QString name; // XML "NMTOKEN" type }; /** Identifier Property structure */ // TODO: Fill to WMS specifications struct QgsWmsIdentifierProperty { QString authority; }; /** Metadata URL Property structure */ // TODO: Fill to WMS specifications struct QgsWmsMetadataUrlProperty { QString format; QgsWmsOnlineResourceAttribute onlineResource; QString type; // XML "NMTOKEN" type }; /** Data List URL Property structure */ // TODO: Fill to WMS specifications struct QgsWmsDataListUrlProperty { QString format; QgsWmsOnlineResourceAttribute onlineResource; }; /** Feature List URL Property structure */ // TODO: Fill to WMS specifications struct QgsWmsFeatureListUrlProperty { QString format; QgsWmsOnlineResourceAttribute onlineResource; }; /** Layer Property structure */ // TODO: Fill to WMS specifications struct QgsWmsLayerProperty { // WMS layer properties QString name; QString title; QString abstract; QStringList keywordList; std::vector<QString> crs; // coord ref sys QgsRect ex_GeographicBoundingBox; std::vector<QgsWmsBoundingBoxProperty> boundingBox; std::vector<QgsWmsDimensionProperty> dimension; QgsWmsAttributionProperty attribution; std::vector<QgsWmsAuthorityUrlProperty> authorityUrl; std::vector<QgsWmsIdentifierProperty> identifier; std::vector<QgsWmsMetadataUrlProperty> metadataUrl; std::vector<QgsWmsDataListUrlProperty> dataListUrl; std::vector<QgsWmsFeatureListUrlProperty> featureListUrl; std::vector<QgsWmsStyleProperty> style; double minScaleDenominator; double maxScaleDenominator; std::vector<QgsWmsLayerProperty> layer; // nested layers // WMS layer attributes bool queryable; int cascaded; bool opaque; bool noSubsets; int fixedWidth; int fixedHeight; }; /** Capability Property structure */ // TODO: Fill to WMS specifications struct QgsWmsCapabilityProperty { QgsWmsRequestProperty request; QgsWmsExceptionProperty exception; QgsWmsLayerProperty layer; }; /** Capabilities Property structure */ // TODO: Fill to WMS specifications struct QgsWmsCapabilitiesProperty { QgsWmsServiceProperty service; QgsWmsCapabilityProperty capability; QString version; };/** \brief Data provider for OGC WMS layers. This provider implements the interface defined in the QgsDataProvider class to provide access to spatial data residing in a OGC Web Map Service. TODO: Make it work */class QgsWmsProvider : public QgsRasterDataProvider{ Q_OBJECTpublic: /** * Constructor for the provider. * * \param uri HTTP URL of the Web Server. If setProxy() is not also called then we will * contact the host directly. * */ QgsWmsProvider(QString const & uri = 0); //! Destructor virtual ~QgsWmsProvider(); /** * Gets the HTTP proxy host used for this connection */ virtual QString proxyHost() const; /** * Gets the HTTP proxy port used for this connection */ virtual int proxyPort() const; /** * Gets the HTTP proxy user name used for this connection */ virtual QString proxyUser() const; /** * Gets the HTTP proxy user password used for this connection */ virtual QString proxyPass() const; /** * * Sets an HTTP proxy for the URL given in the constructor * */ virtual bool setProxy(QString const & host = 0, int port = 80, QString const & user = 0, QString const & pass = 0); /** * \brief Returns a list of the supported layers of the WMS server * * \param[out] layers The list of layers will be placed here. * * \retval FALSE if the layers could not be retreived or parsed - * see errorString() for more info * * \todo Document this better, make static */ virtual bool supportedLayers(std::vector<QgsWmsLayerProperty> & layers); // TODO: Document this better /** \brief Returns a list of the supported CRSs of the given layers * \note Since WMS can specify CRSs per layer, this may change depending on which layers are specified! The "lowest common denominator" between all specified layers is returned. */ virtual QSet<QString> supportedCrsForLayers(QStringList const & layers); /*! Get the QgsSpatialRefSys for this layer * @note Must be reimplemented by each provider. * If the provider isn't capable of returning * its projection an empty srs will be return, ti will return 0 */ virtual QgsSpatialRefSys getSRS(); /** * Add the list of WMS layer names to be rendered by this server */ void addLayers(QStringList const & layers, QStringList const & styles = QStringList()); /** return the number of layers for the current data source @note Should this be subLayerCount() instead? */ size_t layerCount() const; /** * Reorder the list of WMS layer names to be rendered by this server * (in order from bottom to top) * \note layers must have been previously added. */ void setLayerOrder(QStringList const & layers);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -