Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
+83
@@ -0,0 +1,83 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Declaration/Definition
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*/
|
||||
|
||||
|
||||
#include <QtWidgets/QApplication>
|
||||
#include <QtWidgets/QGraphicsScene>
|
||||
#include <QtWidgets/QGraphicsView>
|
||||
#include <QtWidgets/QGraphicsProxyWidget>
|
||||
#include <QtWidgets/QPushButton>
|
||||
#include <QtWidgets/QTextEdit>
|
||||
#include <QtWidgets/QHBoxLayout>
|
||||
|
||||
#include "Map.h"
|
||||
#include "MapGraphicsView.h"
|
||||
#include "ArcGISLocalTiledLayer.h"
|
||||
|
||||
#include "event_mouse_navigator.h"
|
||||
|
||||
|
||||
int main (int argc, char* argv[])
|
||||
{
|
||||
QApplication app ( argc, argv );
|
||||
|
||||
// under windows for ArcGIS 10.2.6 and higher
|
||||
#ifdef Q_OS_WIN
|
||||
QCoreApplication::setAttribute( Qt::AA_UseOpenGLES );
|
||||
#endif
|
||||
|
||||
QApplication::setApplicationName(QString("Esri - Map Touch Test"));
|
||||
|
||||
QWidget top;
|
||||
QHBoxLayout * layout = new QHBoxLayout( &top );
|
||||
QTextEdit * console = new QTextEdit( &top );
|
||||
EsriRuntimeQt::Map * map = new EsriRuntimeQt::Map();
|
||||
EsriRuntimeQt::MapGraphicsView * mapGraphicsView = EsriRuntimeQt::MapGraphicsView::create(map);
|
||||
|
||||
QString samplePath = EsriRuntimeQt::ArcGISRuntime::installDirectory();
|
||||
|
||||
samplePath.append("/sdk/samples/data/tpks/Topographic.tpk");
|
||||
|
||||
samplePath = QDir::toNativeSeparators(samplePath);
|
||||
|
||||
if (!QFileInfo::exists(samplePath))
|
||||
{
|
||||
qDebug() << "Load map from not existing file" << samplePath;
|
||||
}
|
||||
|
||||
EsriRuntimeQt::ArcGISLocalTiledLayer * geoMapBaseLayer = new EsriRuntimeQt::ArcGISLocalTiledLayer( samplePath, &top );
|
||||
geoMapBaseLayer -> setName( "Base Map Layer" );
|
||||
|
||||
QObject::connect( geoMapBaseLayer, &EsriRuntimeQt::ArcGISLocalTiledLayer::layerCreateError , []() { qDebug() << "Loading map failed!"; } );
|
||||
QObject::connect( geoMapBaseLayer, &EsriRuntimeQt::ArcGISLocalTiledLayer::layerCreateComplete, []() { qDebug() << "Loading map finished."; } );
|
||||
|
||||
map->setAnimationMode( EsriRuntimeQt::AnimationMode::NoAnimation );
|
||||
map->addLayer(geoMapBaseLayer);
|
||||
map->setWrapAroundEnabled(true);
|
||||
|
||||
map->grid()->setType( EsriRuntimeQt::GridType::Mgrs );
|
||||
map->grid()->setVisible(false);
|
||||
|
||||
mapGraphicsView -> setFixedSize( 600, 400 );
|
||||
|
||||
SituationMap::RB::EventMouseNavigator * eventDispatcher = new SituationMap::RB::EventMouseNavigator( mapGraphicsView->viewport(), map );
|
||||
layout->addWidget( mapGraphicsView );
|
||||
layout->addWidget( console );
|
||||
|
||||
top.show();
|
||||
|
||||
QPushButton * button = new QPushButton( QString("Touch or Click me"), nullptr ); // button must be toplevel widget
|
||||
QGraphicsProxyWidget * widgetProxy = mapGraphicsView->scene()->addWidget( button );
|
||||
|
||||
widgetProxy -> setPos( mapGraphicsView->mapToScene(250,200) );
|
||||
|
||||
QObject::connect( button, &QPushButton::clicked, [console]() { console->append(QString("Button has been clicked.\n")); });
|
||||
QObject::connect( button, &QPushButton::pressed, [console]() { console->append(QString("Button has been pressed.\n")); });
|
||||
|
||||
return app.exec();
|
||||
} // main (int argc, char* argv[])
|
||||
Reference in new issue
Block a user