Loading ArcGIS map into exisitng UI project

3798
5
Jump to solution
04-21-2015 10:20 AM
MiguelValencia1
New Contributor

Hi Everyone,

I'm trying to load a map into an existing UI project but I get errors whenever I try to compile.  At the moment, I can load a map if I just stick to using the ArcGIS template when I create a new project, but when I try to use #include "ArcGISRuntime.h" in my UI project, I get errors.  I tried to add the ArcGIS include directory in my .pro file by adding INCLUDEPATH += "C:\Program Files (x86)\ArcGIS SDKs\Qt10.2.5\sdk\windows\include" but I still get errors.

Is there no other way to try to load a map into an existing UI project that has a ui form, or am I forced to use the ArcGIS templates to load a map?

Thanks,

Miguel

0 Kudos
1 Solution

Accepted Solutions
LucasDanzinger
Esri Frequent Contributor

Hey Miguel-

I'm not sure I know exactly what your issue is, but in general, the map needs to be bound to a MapGraphicsView. This is one of our classes, and it derives from QGraphicsView. Read more about this here - EsriRuntimeQt::MapGraphicsView Class Reference

Once you initialize your MapGraphicsView with your Map, you should be able to treat it like a QGraphicsView, and add it as a widget into your application.

Thanks,

Luke

View solution in original post

0 Kudos
5 Replies
LucasDanzinger
Esri Frequent Contributor

Hey Miguel-

I suggest you take a look at the pro file in one of the ArcGIS Template apps. One of the things it sets is to use the prf file called esri_runtime_qt. I tried creating a new Qt Widgets app (non ArcGIS Template), and by adding the below line to the pro file, I was able to include ArcGISRuntime.h.

CONFIG += c++11 esri_runtime_qt

If that doesn't work, I would try comparing your .pro files and see what the difference is between the two.

Thanks,

Luke

0 Kudos
MiguelValencia1
New Contributor

Hi Luke,

Thank you very much for the response.  I'll try to implement that as soon as I can and will let you know if I still have issues.

Thanks again,

Miguel

0 Kudos
MiguelValencia1
New Contributor

Hi Luke,

I tried this and it worked!  The problem now is that when I try to add the sample Map, It gives me another error that it can't find the include files for the ones found in the MSVC 64 OpenGL but I'm sure I can figure that out.  The point that I want to make is that I have an existing UI that I created when I made a Qt Widgets application and I want to load a map into that UI instead of creating the map as the MainWidow.  I'm really new to both Qt and ArcGIS so I'm not sure what the correct way to go about it is.  I've tried looking at the examples but all of them seem to load the map as the application window, rather than as a separate window within the MainWindow.  Can you point me in the right direction?  The documentation that I have found so far hasn't been very helpful.

Thanks,

Miguel

0 Kudos
LucasDanzinger
Esri Frequent Contributor

Hey Miguel-

I'm not sure I know exactly what your issue is, but in general, the map needs to be bound to a MapGraphicsView. This is one of our classes, and it derives from QGraphicsView. Read more about this here - EsriRuntimeQt::MapGraphicsView Class Reference

Once you initialize your MapGraphicsView with your Map, you should be able to treat it like a QGraphicsView, and add it as a widget into your application.

Thanks,

Luke

0 Kudos
MiguelValencia1
New Contributor

Hi Luke,

Sorry for the late response but thank you for the information.  It worked!!

Miguel

0 Kudos