Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
waynegm committed Jun 1, 2023
1 parent 3bfe4b8 commit 26c6355
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 25 deletions.
7 changes: 5 additions & 2 deletions plugins/uiGeopackageExport/uigeopackageexportpi.cc
Original file line number Diff line number Diff line change
Expand Up @@ -204,11 +204,14 @@ mDefODInitPlugin(uiGeopackageExport)
libnm.add(".0");

FilePath libfp(GetLibPlfDir(), libnm);
if ( GetEnvVarYN("OD_USER_PLUGIN_DIR") )
if ( !libfp.exists() && GetEnvVarYN("OD_USER_PLUGIN_DIR") )
libfp = FilePath(GetEnvVar("OD_USER_PLUGIN_DIR"), "bin", GetPlfSubDir(),
GetBinSubDir(), libnm);

GeopackageIO::setGPKGlib_location(libfp.fullPath());
if ( libfp.exists() )
GeopackageIO::setGPKGlib_location(libfp.fullPath());
else
return BufferString("uiGeopackageExport: cannot find ", libnm);

// uiGeopackageTreeItem::initClass();

Expand Down
29 changes: 8 additions & 21 deletions plugins/uiGeopackageExport/uigeotiffwriter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ uiRetVal uiGeotiffWriter::writeHorizon( uiTaskRunner& taskrunner, bool exportZ,
TIFFSetField(tif_, TIFFTAG_PLANARCONFIG, PLANARCONFIG_SEPARATE);
TIFFSetField(tif_, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISBLACK);
TIFFSetField(tif_, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_IEEEFP);
TIFFSetField(tif_,TIFFTAG_BITSPERSAMPLE, sizeof(float)*8);
TIFFSetField(tif_, TIFFTAG_SAMPLESPERPIXEL, nrBands);
TIFFSetField(tif_,TIFFTAG_BITSPERSAMPLE, sizeof(float)*8);
TIFFSetField(tif_, TIFFTAG_GDAL_NODATA, toString(mUdf(float)));
TIFFSetField(tif_, TIFFTAG_ROWSPERSTRIP, 1L);
if (nrBands>1)
Expand All @@ -175,7 +175,7 @@ uiRetVal uiGeotiffWriter::writeHorizon( uiTaskRunner& taskrunner, bool exportZ,
for (int idx=0; idx<nrBands-1; idx++)
exsamp[idx] = EXTRASAMPLE_UNSPECIFIED;

TIFFSetField(tif_, TIFFTAG_EXTRASAMPLES, nrBands-1, *exsamp);
TIFFSetField(tif_, TIFFTAG_EXTRASAMPLES, nrBands-1, exsamp.ptr());
}

GTIFKeySet(gtif_, GTModelTypeGeoKey, TYPE_SHORT, 1, ModelProjected);
Expand Down Expand Up @@ -231,25 +231,6 @@ uiRetVal uiGeotiffWriter::writeHorizon( uiTaskRunner& taskrunner, bool exportZ,
if ( !TaskRunner::execute(&taskrunner,*loader) )
return uiRetVal(tr("uiGeotiffWriter::writeHorizon - loading 3D horizon failed"));

for ( const auto* nms : attribs )
{
const int idx = sd.valnames.indexOf( *nms );
if ( idx<0 )
continue;

sels.selvalues += idx;
}

if ( !sels.selvalues.isEmpty() )
{
ExecutorGroup exgrp( "Reading aux data" );
for ( int idx=0; idx<sels.selvalues.size(); idx++ )
exgrp.add( hor->auxdata.auxDataLoader(sels.selvalues[idx]) );

if ( !TaskRunner::execute( &taskrunner, exgrp ) )
return uiRetVal(tr("uiGeotiffWriter::writeHorizon - loading 3D horizon attributes failed"));
}

float* rowBuff = (float*) _TIFFmalloc(TIFFScanlineSize(tif_));
BufferString description;
int bandnr = 0;
Expand Down Expand Up @@ -281,8 +262,13 @@ uiRetVal uiGeotiffWriter::writeHorizon( uiTaskRunner& taskrunner, bool exportZ,
{
for (int iatt=0; iatt<attribs.size(); iatt++)
{
PtrMan<Executor> auxloader = hor->auxdata.auxDataLoader(attribs.get(iatt).buf());
if ( !loader || !TaskRunner::execute( &taskrunner, *auxloader ) )
return uiRetVal(tr("uiGeotiffWriter::writeHorizon - loading 3D horizon attributes failed"));

if (hor->auxdata.hasAuxDataName(attribs.get(iatt)))
{

int iaux = hor->auxdata.auxDataIndex(attribs.get(iatt));
description = attribs.get(iatt);
addBandMetadata(bandnr, description);
Expand All @@ -306,6 +292,7 @@ uiRetVal uiGeotiffWriter::writeHorizon( uiTaskRunner& taskrunner, bool exportZ,
return uiRetVal(tr("uiGeotiffWriter::writeHorizon - no data for attribute: %1").arg(attribs.get(iatt)));
}
bandnr++;
hor->auxdata.removeAll();
}
}
setMetadataField();
Expand Down
4 changes: 2 additions & 2 deletions plugins/uiGrid2D3DHorizon/uiinputgrp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ uiInputGrp::uiInputGrp( uiParent* p, bool has2Dhorizon, bool has3Dhorizon )
lines2Dfld_->attach( alignedBelow, hor2Dfld_ );

hor2Dfld_->setSensitive( has2Dhorizon );
hor2Dfld_->setChecked( has2Dhorizon );
hor2Dfld_->setChecked( false );
lines2Dfld_->setSensitive( has2Dhorizon );

su.seltxt( uiStrings::s3DHorizon() );
Expand All @@ -55,7 +55,7 @@ uiInputGrp::uiInputGrp( uiParent* p, bool has2Dhorizon, bool has3Dhorizon )
subsel3Dfld_->attach( alignedBelow, hor3Dfld_ );

hor3Dfld_->setSensitive( has3Dhorizon );
hor3Dfld_->setChecked( has3Dhorizon );
hor3Dfld_->setChecked( false );
subsel3Dfld_->setSensitive( has3Dhorizon );

contpolyfld_ = new WMLib::uiPolygonParSel(this, tr("Contour Polygons/Polylines"), true);
Expand Down

0 comments on commit 26c6355

Please sign in to comment.