Reputation: 11
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:
error: no viable conversion from 'Esri::ArcGISRuntime::RasterLayer *' to 'Esri::ArcGISRuntime::RasterLayer'
candidate constructor not viable: no known conversion from 'Esri::ArcGISRuntime::RasterLayer *' to 'const Esri::ArcGISRuntime::RasterLayer &' for 1st argument; dereference the argument with *
C:\Qt\Qt5.13.0\5.13.0\msvc2017_64\include\QtCore\qglobal.h:372: expanded from macro 'Q_DISABLE_COPY'
error: C2440: 'initializing': cannot convert from 'Esri::ArcGISRuntime::RasterLayer *' to 'Esri::ArcGISRuntime::RasterLayer'
No constructor could take the source type, or constructor overload resolution was ambiguous
Upvotes: 1
Views: 191
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