MCPcopy Create free account
hub / github.com/OSGeo/gdal / RunStep

Method RunStep

apps/gdalalg_raster_tile.cpp:4438–5677  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4436/************************************************************************/
4437
4438bool GDALRasterTileAlgorithm::RunStep(GDALPipelineStepRunContext &ctxt)
4439{
4440 auto pfnProgress = ctxt.m_pfnProgress;
4441 auto pProgressData = ctxt.m_pProgressData;
4442 CPLAssert(m_inputDataset.size() == 1);
4443 m_poSrcDS = m_inputDataset[0].GetDatasetRef();
4444 CPLAssert(m_poSrcDS);
4445
4446 const int nSrcWidth = m_poSrcDS->GetRasterXSize();
4447 const int nSrcHeight = m_poSrcDS->GetRasterYSize();
4448 if (m_poSrcDS->GetRasterCount() == 0 || nSrcWidth == 0 || nSrcHeight == 0)
4449 {
4450 ReportError(CE_Failure, CPLE_AppDefined, "Invalid source dataset");
4451 return false;
4452 }
4453
4454 const bool bIsNamedSource = m_poSrcDS->GetDescription()[0] != 0;
4455 auto poSrcDriver = m_poSrcDS->GetDriver();
4456 const bool bIsMEMSource =
4457 poSrcDriver && EQUAL(poSrcDriver->GetDescription(), "MEM");
4458 m_bIsNamedNonMemSrcDS = bIsNamedSource && !bIsMEMSource;
4459 const bool bSrcIsFineForFork = bIsNamedSource || bIsMEMSource;
4460
4461 if (m_parallelMethod == "spawn")
4462 {
4463 const char *pszErrorMsg = "";
4464 if (!IsCompatibleOfSpawn(pszErrorMsg))
4465 {
4466 if (pszErrorMsg[0])
4467 ReportError(CE_Failure, CPLE_AppDefined, "%s", pszErrorMsg);
4468 return false;
4469 }
4470 }
4471#ifdef FORK_ALLOWED
4472 else if (m_parallelMethod == "fork")
4473 {
4474 if (!bSrcIsFineForFork)
4475 {
4476 ReportError(CE_Failure, CPLE_AppDefined,
4477 "Unnamed non-MEM source are not supported "
4478 "with fork parallelization method");
4479 return false;
4480 }
4481 if (cpl::starts_with(m_outputDir, "/vsimem/"))
4482 {
4483 ReportError(CE_Failure, CPLE_AppDefined,
4484 "/vsimem/ output directory not supported with fork "
4485 "parallelization method");
4486 return false;
4487 }
4488 }
4489#endif
4490
4491 if (m_resampling == "near")
4492 m_resampling = "nearest";
4493 if (m_overviewResampling == "near")
4494 m_overviewResampling = "nearest";
4495 else if (m_overviewResampling.empty())

Callers

nothing calls this directly

Calls 15

CPLSPrintfFunction · 0.85
GetGDALDriverManagerFunction · 0.85
CSLTokenizeString2Function · 0.85
CSLDuplicateFunction · 0.85
IterateNameValueFunction · 0.85
moveFunction · 0.85
GDALTranslateOptionsNewFunction · 0.85
GDALTranslateFunction · 0.85
GDALTranslateOptionsFreeFunction · 0.85
fabsFunction · 0.85
GetTileIndicesFunction · 0.85

Tested by

no test coverage detected