53 qCritical(
"ERROR[%s]: Unsupported data type (%s)", Q_FUNC_INFO, qPrintable( _rqsFileName ) );
61 for(
int i=1; i<=127; i++ )
qColorTable[i] = qRgba( 0, 48+0.375*i, 96+0.75*i, 255 );
62 for(
int i=128; i<=152; i++ )
qColorTable[i] = qRgba( 4*i-480, 128, 0, 255 );
63 for(
int i=153; i<=183; i++ )
qColorTable[i] = qRgba( 4*i-480, 4*i-480, 8*i-1216, 255 );
64 for(
int i=184; i<=255; i++ )
qColorTable[i] = qRgba( 439-i, 255, 255, 255 );
79 double __fdX = (double)_rqPointFDatPosition.x(), __fdY = (double)_rqPointFDatPosition.y(), __fdZ = 0;
80 int __iSuccess = TRUE;
82 if( __iSuccess != TRUE )
return __oGeoPosition;
84 return __oGeoPosition;
89 uchar* __pqImageBit = _pqImage->bits();
90 const quint16* __pqVectorBit = _rqVector.data();
91 for(
int x=_pqImage->width()-1; x>=0; x-- )
92 for(
int y=_pqImage->height()-1; y>=0; y-- )
98 uchar* __pqImageBit = _pqImage->bits();
99 const qint16* __pqVectorBit = _rqVector.data();
100 for(
int x=_pqImage->width()-1; x>=0; x-- )
101 for(
int y=_pqImage->height()-1; y>=0; y-- )
107 uchar* __pqImageBit = _pqImage->bits();
108 const quint32* __pqVectorBit = _rqVector.data();
109 for(
int x=_pqImage->width()-1; x>=0; x-- )
110 for(
int y=_pqImage->height()-1; y>=0; y-- )
116 uchar* __pqImageBit = _pqImage->bits();
117 const qint32* __pqVectorBit = _rqVector.data();
118 for(
int x=_pqImage->width()-1; x>=0; x-- )
119 for(
int y=_pqImage->height()-1; y>=0; y-- )
125 uchar* __pqImageBit = _pqImage->bits();
126 const float* __pqVectorBit = _rqVector.data();
127 for(
int x=_pqImage->width()-1; x>=0; x-- )
128 for(
int y=_pqImage->height()-1; y>=0; y-- )
134 uchar* __pqImageBit = _pqImage->bits();
135 const double* __pqVectorBit = _rqVector.data();
136 for(
int x=_pqImage->width()-1; x>=0; x-- )
137 for(
int y=_pqImage->height()-1; y>=0; y-- )
153 if( !
qRectGeometry.contains( (
int)( _rqPointFDatPosition.x()+0.5 ), (
int)( _rqPointFDatPosition.y()+0.5 ) ) )
return __fdElevation;
154 double __fdXint, __fdXdec, __fdYint, __fdYdec;
155 __fdXdec = modf( _rqPointFDatPosition.x(), &__fdXint );
156 __fdYdec = modf( _rqPointFDatPosition.y(), &__fdYint );
162 QVector<quint16> __qVector( 4 );
163 GDALRasterBand* __poGDALRasterBand =
poGDALDataset->GetRasterBand( 1 );
164 CPLErr tCPLErr = __poGDALRasterBand->RasterIO( GF_Read,
165 (
int)__fdXint, (
int)__fdYint,
170 sizeof(quint16), 2*
sizeof(quint16) );
171 if( tCPLErr != CE_None )
173 qCritical(
"ERROR[%s]: Failed to rasterize elevation data", Q_FUNC_INFO );
174 return __fdElevation;
176 __fdElevation =
interpolateValue( __qVector[0], __qVector[1], __qVector[2], __qVector[3], __fdXdec, __fdYdec );
182 QVector<qint16> __qVector( 4 );
183 GDALRasterBand* __poGDALRasterBand =
poGDALDataset->GetRasterBand( 1 );
184 CPLErr tCPLErr = __poGDALRasterBand->RasterIO( GF_Read,
185 (
int)__fdXint, (
int)__fdYint,
190 sizeof(qint16), 2*
sizeof(qint16) );
191 if( tCPLErr != CE_None )
193 qCritical(
"ERROR[%s]: Failed to rasterize elevation data", Q_FUNC_INFO );
194 return __fdElevation;
196 __fdElevation =
interpolateValue( __qVector[0], __qVector[1], __qVector[2], __qVector[3], __fdXdec, __fdYdec );
202 QVector<quint32> __qVector( 4 );
203 GDALRasterBand* __poGDALRasterBand =
poGDALDataset->GetRasterBand( 1 );
204 CPLErr tCPLErr = __poGDALRasterBand->RasterIO( GF_Read,
205 (
int)__fdXint, (
int)__fdYint,
210 sizeof(quint32), 2*
sizeof(quint32) );
211 if( tCPLErr != CE_None )
213 qCritical(
"ERROR[%s]: Failed to rasterize elevation data", Q_FUNC_INFO );
214 return __fdElevation;
216 __fdElevation =
interpolateValue( __qVector[0], __qVector[1], __qVector[2], __qVector[3], __fdXdec, __fdYdec );
222 QVector<qint32> __qVector( 4 );
223 GDALRasterBand* __poGDALRasterBand =
poGDALDataset->GetRasterBand( 1 );
224 CPLErr tCPLErr = __poGDALRasterBand->RasterIO( GF_Read,
225 (
int)__fdXint, (
int)__fdYint,
230 sizeof(qint32), 2*
sizeof(qint32) );
231 if( tCPLErr != CE_None )
233 qCritical(
"ERROR[%s]: Failed to rasterize elevation data", Q_FUNC_INFO );
234 return __fdElevation;
236 __fdElevation =
interpolateValue( __qVector[0], __qVector[1], __qVector[2], __qVector[3], __fdXdec, __fdYdec );
242 QVector<float> __qVector( 4 );
243 GDALRasterBand* __poGDALRasterBand =
poGDALDataset->GetRasterBand( 1 );
244 CPLErr tCPLErr = __poGDALRasterBand->RasterIO( GF_Read,
245 (
int)__fdXint, (
int)__fdYint,
250 sizeof(
float), 2*
sizeof(
float) );
251 if( tCPLErr != CE_None )
253 qCritical(
"ERROR[%s]: Failed to rasterize elevation data", Q_FUNC_INFO );
254 return __fdElevation;
256 __fdElevation =
interpolateValue( __qVector[0], __qVector[1], __qVector[2], __qVector[3], __fdXdec, __fdYdec );
262 QVector<double> __qVector( 4 );
263 GDALRasterBand* __poGDALRasterBand =
poGDALDataset->GetRasterBand( 1 );
264 CPLErr tCPLErr = __poGDALRasterBand->RasterIO( GF_Read,
265 (
int)__fdXint, (
int)__fdYint,
270 sizeof(
double), 2*
sizeof(
double) );
271 if( tCPLErr != CE_None )
273 qCritical(
"ERROR[%s]: Failed to rasterize elevation data", Q_FUNC_INFO );
274 return __fdElevation;
276 __fdElevation =
interpolateValue( __qVector[0], __qVector[1], __qVector[2], __qVector[3], __fdXdec, __fdYdec );
284 return __fdElevation;
294 _fdValue = ( _fdValue / 78.125 ) + 128.0;
295 if( _fdValue > 255.0 ) _fdValue = 255.0;
296 else if( _fdValue < 0.0 ) _fdValue = 0.0;
297 return (uchar)(_fdValue+0.5);
302 return _fdP11 * ( 1.0 - _fdX ) * ( 1.0 - _fdY )
303 + _fdP21 * _fdX * ( 1.0 - _fdY )
304 + _fdP12 * ( 1.0 - _fdX ) * _fdY
305 + _fdP22 * _fdX * _fdY;
CChartGDALElevation(const QString &_rqsFileName)
virtual void rasterBuffer(QImage *_pqImage, const QVector< quint16 > &_rqVector) const
Rasterizes UInt16 buffer.
uchar rasterValue(double _fdValue) const
CDataPosition toGeoPosition(const QPointF &_rqPointFDatPosition) const
double interpolateValue(double _fdP11, double _fdP21, double _fdP12, double _fdP22, double _fdX, double _fdY) const
virtual ~CChartGDALElevation()
double getElevation(const QPointF &_rqPointFDatPosition) const
Returns the elevation at the given chart pixel position.
Generic GDAL-based dataset.
void open(const QString &_rqsFileName)
Opens the underlying GDAL dataset.
void * pGDALProjectionTransformer
Underlying GDAL dataset projection transformer (to internal WGS84)
QRect qRectGeometry
Chart (GDAL dataset) geometry (size)
EColorEncoding eColorEncoding
Chart (GDAL dataset) color encoding.
QPointF toDatPosition(const CDataPosition &_roGeoPosition) const
Converts the given (geographical) position [long,lat,elev] to chart (GDAL dataset) point [px].
QVCT::EStatus eStatus
Chart internal status.
GDALDataset * poGDALDataset
Underlying GDAL dataset.
QVector< QRgb > qColorTable
Color table (for GRAY/PALETTE_* color encodings)
(Geographical) Position data [long,lat,elev]
void setPosition(double _fdLongitude, double _fdLatitude, double _fdElevation=UNDEFINED_ELEVATION)
Sets new coordinates.
static constexpr double UNDEFINED_ELEVATION
Specific value for an undefined elevation.