27 #include <QProgressDialog>
32 , mTriangleInterpolator( 0 )
33 , mIsInitialized( false )
34 , mShowProgressDialog( showProgressDialog )
35 , mExportTriangulationToFile( false )
36 , mInterpolation( interpolation )
83 int nProcessedFeatures = 0;
86 QList<LayerData>::iterator layerDataIt =
mLayerData.begin();
87 for ( ; layerDataIt !=
mLayerData.end(); ++layerDataIt )
89 if ( layerDataIt->vectorLayer )
91 nFeatures += layerDataIt->vectorLayer->featureCount();
96 QProgressDialog* theProgressDialog = 0;
99 theProgressDialog =
new QProgressDialog(
QObject::tr(
"Building triangulation..." ),
QObject::tr(
"Abort" ), 0, nFeatures, 0 );
100 theProgressDialog->setWindowModality( Qt::WindowModal );
105 QList<LayerData>::iterator layerDataIt =
mLayerData.begin();
106 for ( ; layerDataIt !=
mLayerData.end(); ++layerDataIt )
108 if ( layerDataIt->vectorLayer )
111 if ( !layerDataIt->zCoordInterpolation )
113 attList.push_back( layerDataIt->interpolationAttribute );
122 if ( theProgressDialog->wasCanceled() )
126 theProgressDialog->setValue( nProcessedFeatures );
128 insertData( &f, layerDataIt->zCoordInterpolation, layerDataIt->interpolationAttribute, layerDataIt->mInputType );
129 ++nProcessedFeatures;
134 delete theProgressDialog;
142 QProgressDialog* progressDialog = 0;
145 progressDialog =
new QProgressDialog();
146 progressDialog->setLabelText(
QObject::tr(
"Estimating normal derivatives..." ) );
149 delete progressDialog;
184 double attributeValue = 0;
185 bool attributeConversionOk =
false;
188 QVariant attributeVariant = f->
attribute( attr );
189 if ( !attributeVariant.isValid() )
193 attributeValue = attributeVariant.toDouble( &attributeConversionOk );
194 if ( !attributeConversionOk || qIsNaN( attributeValue ) )
201 bool hasZValue =
false;
203 const unsigned char* currentWkbPtr = g->
asWkb();
214 currentWkbPtr += ( 1 +
sizeof( int ) );
215 x = *((
double * )( currentWkbPtr ) );
216 currentWkbPtr +=
sizeof( double );
217 y = *((
double * )( currentWkbPtr ) );
218 if ( zCoord && hasZValue )
220 currentWkbPtr +=
sizeof( double );
221 z = *((
double * )( currentWkbPtr ) );
238 currentWkbPtr += ( 1 +
sizeof( int ) );
239 int* npoints = (
int* )currentWkbPtr;
240 currentWkbPtr +=
sizeof( int );
241 for (
int index = 0; index < *npoints; ++index )
243 currentWkbPtr += ( 1 +
sizeof( int ) );
244 x = *((
double* )currentWkbPtr );
245 currentWkbPtr +=
sizeof( double );
246 y = *((
double* )currentWkbPtr );
247 currentWkbPtr +=
sizeof( double );
250 z = *((
double* )currentWkbPtr );
251 currentWkbPtr +=
sizeof( double );
268 currentWkbPtr += ( 1 +
sizeof( int ) );
269 int* npoints = (
int* )currentWkbPtr;
270 currentWkbPtr +=
sizeof( int );
271 for (
int index = 0; index < *npoints; ++index )
273 x = *((
double * )( currentWkbPtr ) );
274 currentWkbPtr +=
sizeof( double );
275 y = *((
double * )( currentWkbPtr ) );
276 currentWkbPtr +=
sizeof( double );
277 if ( zCoord && hasZValue )
279 z = *((
double * )( currentWkbPtr ) );
287 currentWkbPtr +=
sizeof( double );
311 currentWkbPtr += ( 1 +
sizeof( int ) );
312 int* nlines = (
int* )currentWkbPtr;
314 currentWkbPtr +=
sizeof( int );
315 for (
int index = 0; index < *nlines; ++index )
321 currentWkbPtr += (
sizeof( int ) + 1 );
322 npoints = (
int* )currentWkbPtr;
323 currentWkbPtr +=
sizeof( int );
324 for (
int index2 = 0; index2 < *npoints; ++index2 )
326 x = *((
double* )currentWkbPtr );
327 currentWkbPtr +=
sizeof( double );
328 y = *((
double* )currentWkbPtr );
329 currentWkbPtr +=
sizeof( double );
333 z = *((
double* ) currentWkbPtr );
334 currentWkbPtr +=
sizeof( double );
362 currentWkbPtr += ( 1 +
sizeof( int ) );
363 int* nrings = (
int* )currentWkbPtr;
364 currentWkbPtr +=
sizeof( int );
366 for (
int index = 0; index < *nrings; ++index )
373 npoints = (
int* )currentWkbPtr;
374 currentWkbPtr +=
sizeof( int );
375 for (
int index2 = 0; index2 < *npoints; ++index2 )
377 x = *((
double* )currentWkbPtr );
378 currentWkbPtr +=
sizeof( double );
379 y = *((
double* )currentWkbPtr );
380 currentWkbPtr +=
sizeof( double );
383 z = *((
double* )currentWkbPtr );;
384 currentWkbPtr +=
sizeof( double );
413 currentWkbPtr += ( 1 +
sizeof( int ) );
414 int* npolys = (
int* )currentWkbPtr;
417 currentWkbPtr +=
sizeof( int );
418 for (
int index = 0; index < *npolys; ++index )
420 currentWkbPtr += ( 1 +
sizeof( int ) );
421 nrings = (
int* )currentWkbPtr;
422 currentWkbPtr +=
sizeof( int );
423 for (
int index2 = 0; index2 < *nrings; ++index2 )
429 npoints = (
int* )currentWkbPtr;
430 currentWkbPtr +=
sizeof( int );
431 for (
int index3 = 0; index3 < *npoints; ++index3 )
433 x = *((
double* )currentWkbPtr );
434 currentWkbPtr +=
sizeof( double );
435 y = *((
double* )currentWkbPtr );
436 currentWkbPtr +=
sizeof( double );
439 z = *((
double* )currentWkbPtr );
440 currentWkbPtr +=
sizeof( double );