Skip to content
Permalink
Browse files

[ArcGIS REST] Port to Qt5

  • Loading branch information
manisandro authored and nyalldawson committed Sep 20, 2016
1 parent 83ad380 commit ee57c1fc43404471c97a2044f3e24e217049956b
@@ -292,11 +292,6 @@ ENDIF (WITH_TOUCH)
# search for QScintilla2 (C++ lib)
FIND_PACKAGE(QScintilla REQUIRED)

# search for QJSON and decide whether to enable ArcGIS providers

# TODO - needs to be ported to qt5
SET (WITH_ARCGIS FALSE)

# Master password hash and authentication encryption
FIND_PACKAGE(QCA REQUIRED)
# Check for runtime dependency of qca-ossl plugin
@@ -56,7 +56,5 @@

#cmakedefine ENABLE_MODELTEST

#cmakedefine WITH_ARCGIS

#endif

@@ -1732,13 +1732,6 @@ void QgisApp::createActions()
mActionAddPgLayer = 0;
#endif

#ifndef WITH_ARCGIS
delete mActionAddAfsLayer;
mActionAddAfsLayer = 0;
delete mActionAddAmsLayer;
mActionAddAmsLayer = 0;
#endif

#ifndef HAVE_ORACLE
delete mActionAddOracleLayer;
mActionAddOracleLayer = nullptr;
@@ -2188,7 +2181,6 @@ void QgisApp::createToolBars()
newLayerAction->setObjectName( "ActionNewLayer" );
connect( bt, SIGNAL( triggered( QAction * ) ), this, SLOT( toolButtonActionTriggered( QAction * ) ) );

#ifdef WITH_ARCGIS
// map service tool button
bt = new QToolButton();
bt->setPopupMode( QToolButton::MenuButtonPopup );
@@ -2230,9 +2222,6 @@ void QgisApp::createToolBars()
mLayerToolBar->removeAction( mActionAddWfsLayer );
featureServiceAction->setObjectName( "ActionFeatureService" );
connect( bt, SIGNAL( triggered( QAction * ) ), this, SLOT( toolButtonActionTriggered( QAction * ) ) );
#else
QAction* mapServiceAction = mActionAddWmsLayer;
#endif

// add db layer button
bt = new QToolButton();
@@ -2618,10 +2607,8 @@ void QgisApp::setTheme( const QString& theThemeName )
mActionAddWmsLayer->setIcon( QgsApplication::getThemeIcon( "/mActionAddWmsLayer.svg" ) );
mActionAddWcsLayer->setIcon( QgsApplication::getThemeIcon( "/mActionAddWcsLayer.svg" ) );
mActionAddWfsLayer->setIcon( QgsApplication::getThemeIcon( "/mActionAddWfsLayer.svg" ) );
#ifdef WITH_ARCGIS
mActionAddAfsLayer->setIcon( QgsApplication::getThemeIcon( "/mActionAddAfsLayer.svg" ) );
mActionAddAmsLayer->setIcon( QgsApplication::getThemeIcon( "/mActionAddAmsLayer.svg" ) );
#endif
mActionAddToOverview->setIcon( QgsApplication::getThemeIcon( "/mActionInOverview.svg" ) );
mActionAnnotation->setIcon( QgsApplication::getThemeIcon( "/mActionAnnotation.svg" ) );
mActionFormAnnotation->setIcon( QgsApplication::getThemeIcon( "/mActionFormAnnotation.svg" ) );
@@ -2,9 +2,7 @@
SET (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${QGIS_OUTPUT_DIRECTORY}/${QGIS_PLUGIN_SUBDIR})
SET (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${QGIS_OUTPUT_DIRECTORY}/${QGIS_PLUGIN_SUBDIR})

IF(WITH_ARCGIS)
ADD_SUBDIRECTORY(arcgisrest)
ENDIF(WITH_ARCGIS)
ADD_SUBDIRECTORY(arcgisrest)
ADD_SUBDIRECTORY(memory)
ADD_SUBDIRECTORY(ogr)
ADD_SUBDIRECTORY(wms)
@@ -1,5 +1,3 @@
FIND_PACKAGE(QJSON)

INCLUDE_DIRECTORIES(
../../core
../../core/auth
@@ -8,7 +6,6 @@ INCLUDE_DIRECTORIES(
../../gui
../../gui/auth
${GEOS_INCLUDE_DIR}
${QJSON_INCLUDE_DIR}
${QSCINTILLA_INCLUDE_DIR}
${CMAKE_CURRENT_BINARY_DIR}/../../ui
)
@@ -38,8 +35,6 @@ ADD_LIBRARY(arcgisfeatureserverprovider MODULE ${AFS_SRCS} ${AFS_MOC_SRCS})
TARGET_LINK_LIBRARIES(arcgisfeatureserverprovider
qgis_core
qgis_gui
${QJSON_LIBRARIES}
${qjson_LIBRARIES}
)

INSTALL (TARGETS arcgisfeatureserverprovider
@@ -69,8 +64,6 @@ ADD_LIBRARY(arcgismapserverprovider MODULE ${AMS_SRCS} ${AMS_MOC_SRCS})
TARGET_LINK_LIBRARIES(arcgismapserverprovider
qgis_core
qgis_gui
${QJSON_LIBRARIES}
${qjson_LIBRARIES}
)

INSTALL (TARGETS arcgismapserverprovider
@@ -23,7 +23,6 @@
#include "geometry/qgsgeometry.h"
#include "qgsnetworkaccessmanager.h"

#include <qjson/parser.h>
#include <QEventLoop>
#include <QMessageBox>
#include <QNetworkRequest>
@@ -25,7 +25,8 @@
#include "qgsgeometry.h"

#include <cstring>
#include <qjson/parser.h>
#include <QJsonDocument>
#include <QJsonObject>
#include <QNetworkRequest>
#include <QNetworkReply>
#include <QPainter>
@@ -57,13 +58,13 @@ void QgsAmsLegendFetcher::handleError( QString errorTitle, QString errorMsg )
void QgsAmsLegendFetcher::handleFinished()
{
// Parse result
QJson::Parser parser;
bool ok = false;
QVariantMap queryResults = parser.parse( mQueryReply, &ok ).toMap();
if ( !ok )
QJsonParseError err;
QJsonDocument doc = QJsonDocument::fromJson( mQueryReply, &err );
if ( doc.isNull() )
{
emit error( QString( "Parsing error at line %1: %2" ).arg( parser.errorLine() ).arg( parser.errorString() ) );
emit error( QString( "Parsing error:" ).arg( err.errorString() ) );
}
QVariantMap queryResults = doc.object().toVariantMap();
QgsDataSourceUri dataSource( mProvider->dataSourceUri() );
QList< QPair<QString, QImage> > legendEntries;
foreach ( const QVariant& result, queryResults["layers"].toList() )
@@ -32,7 +32,8 @@
#include <QNetworkRequest>
#include <QNetworkReply>
#include <QThread>
#include <qjson/parser.h>
#include <QJsonDocument>
#include <QJsonObject>


QVariant::Type QgsArcGisRestUtils::mapEsriFieldType( const QString &esriFieldType )
@@ -464,17 +465,16 @@ QVariantMap QgsArcGisRestUtils::queryServiceJSON( const QUrl &url, QString &erro
}

// Parse data
QJson::Parser parser;
bool ok = false;
QVariantMap map = parser.parse( reply, &ok ).toMap();
if ( !ok )
QJsonParseError err;
QJsonDocument doc = QJsonDocument::fromJson( reply, &err );
if ( doc.isNull() )
{
errorTitle = "Parsing error";
errorText = QString( "Line %1: %2" ).arg( parser.errorLine() ).arg( parser.errorString() );
QgsDebugMsg( QString( "Parsing error: %1 (line %2" ).arg( parser.errorString() ).arg( parser.errorLine() ) );
errorText = err.errorString();
QgsDebugMsg( QString( "Parsing error: %1" ).arg( err.errorString() ) );
return QVariantMap();
}
return map;
return doc.object().toVariantMap();
}

///////////////////////////////////////////////////////////////////////////////

0 comments on commit ee57c1f

Please sign in to comment.