Sony
Sony

Reputation: 11

how to add raster image in Qt creator using ArcGisRuntime SDK

This is the code i have written, but not able to display a raster image.

#include "Map.h"
#include "MapGraphicsView.h"
#include "Raster.h"
#include "RasterLayer.h"


using namespace Esri:: ArcGISRuntime;

Raster_example::Raster_example(QWidget* parent /*=nullptr*/):
    QMainWindow(parent)
{

    Raster* raster = new Raster("D:/Sony/blr.tif", this);
     // Raster* raster = new Raster(buildRasterPath,this);
     RasterLayer rasterLayer = new RasterLayer(raster);

     // m_map.getOperationalLayers().add(rasterLayer);
    // Create the Widget view
    m_mapView = new MapGraphicsView(this);

following are the errors I'm getting when i run my code:

  1. error: no viable conversion from 'Esri::ArcGISRuntime::RasterLayer *' to 'Esri::ArcGISRuntime::RasterLayer'

  2. candidate constructor not viable: no known conversion from 'Esri::ArcGISRuntime::RasterLayer *' to 'const Esri::ArcGISRuntime::RasterLayer &' for 1st argument; dereference the argument with *

  3. C:\Qt\Qt5.13.0\5.13.0\msvc2017_64\include\QtCore\qglobal.h:372: expanded from macro 'Q_DISABLE_COPY'

  4. error: C2440: 'initializing': cannot convert from 'Esri::ArcGISRuntime::RasterLayer *' to 'Esri::ArcGISRuntime::RasterLayer'

  5. No constructor could take the source type, or constructor overload resolution was ambiguous

Upvotes: 1

Views: 191

Answers (1)

Soheil Armin
Soheil Armin

Reputation: 2795

new SomeClass(...) creates an instance of someClass and returns a pointer to that class. So it should be like

RasterLayer *rasterLayer = new RasterLayer(raster);

Upvotes: 1

Related Questions