Commit f9f5df68 authored by Cédric Traizet's avatar Cédric Traizet
Browse files

Merge branch '2040-RPC_model' of...

Merge branch '2040-RPC_model' of https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb into 2040-RPC_model
parents 04b9160a 7cbd515c
...@@ -111,7 +111,6 @@ public: ...@@ -111,7 +111,6 @@ public:
/** /**
* Set/Get input & output projections. * Set/Get input & output projections.
* Set/Get input & output keywordlist
* The macro are not used here cause the input and the output are * The macro are not used here cause the input and the output are
* inversed. * inversed.
*/ */
...@@ -140,21 +139,21 @@ public: ...@@ -140,21 +139,21 @@ public:
/** Set/Get ImageMetadata*/ /** Set/Get ImageMetadata*/
const ImageMetadata* GetInputImageMetadata() const const ImageMetadata* GetInputImageMetadata() const
{ {
return m_Transform->GetInputImageMetadata(); return m_Transform->GetOutputImageMetadata();
} }
void SetInputImageMetadata(const ImageMetadata* imd) void SetInputImageMetadata(const ImageMetadata* imd)
{ {
m_Transform->SetInputImageMetadata(imd); m_Transform->SetOutputImageMetadata(imd);
this->Modified(); this->Modified();
} }
const ImageMetadata* GetOutputImageMetadata() const const ImageMetadata* GetOutputImageMetadata() const
{ {
return m_Transform->GetOutputImageMetadata(); return m_Transform->GetInputImageMetadata();
} }
void SetOutputImageMetadata(const ImageMetadata* imd) void SetOutputImageMetadata(const ImageMetadata* imd)
{ {
m_Transform->SetOutputImageMetadata(imd); m_Transform->SetInputImageMetadata(imd);
this->Modified(); this->Modified();
} }
......
...@@ -111,7 +111,6 @@ int otbDEMToImageGeneratorFromImageTest(int argc, char* argv[]) ...@@ -111,7 +111,6 @@ int otbDEMToImageGeneratorFromImageTest(int argc, char* argv[])
{ {
char* outputName2 = argv[4]; char* outputName2 = argv[4];
generatorFilter2->SetOutputParametersFromImage(reader->GetOutput()); generatorFilter2->SetOutputParametersFromImage(reader->GetOutput());
generatorFilter2->InstantiateTransform();
extract2->SetInput(generatorFilter2->GetOutput()); extract2->SetInput(generatorFilter2->GetOutput());
extract2->SetSizeX(atoi(argv[7])); extract2->SetSizeX(atoi(argv[7]));
......
...@@ -133,6 +133,7 @@ bool GDALRPCTransformer::ForwardTransform(double* x, double* y, double* z, int n ...@@ -133,6 +133,7 @@ bool GDALRPCTransformer::ForwardTransform(double* x, double* y, double* z, int n
if (this->m_Modified) if (this->m_Modified)
this->Update(); this->Update();
std::vector<int> success(nPointCount); std::vector<int> success(nPointCount);
const std::lock_guard<std::mutex> lock(m_Mutex);
GDALRPCTransform(this->m_TransformArg, false, nPointCount, x, y, z, success.data()); GDALRPCTransform(this->m_TransformArg, false, nPointCount, x, y, z, success.data());
bool finalSuccess = std::all_of(success.begin(), success.end(), [](int i){return i;}); bool finalSuccess = std::all_of(success.begin(), success.end(), [](int i){return i;});
return finalSuccess; return finalSuccess;
...@@ -143,6 +144,7 @@ GDALRPCTransformer::PointType GDALRPCTransformer::ForwardTransform(GDALRPCTransf ...@@ -143,6 +144,7 @@ GDALRPCTransformer::PointType GDALRPCTransformer::ForwardTransform(GDALRPCTransf
if (m_Modified) if (m_Modified)
this->Update(); this->Update();
int success; int success;
const std::lock_guard<std::mutex> lock(m_Mutex);
GDALRPCTransform(this->m_TransformArg, false, 1, &p[0], &p[1], &p[2], &success); GDALRPCTransform(this->m_TransformArg, false, 1, &p[0], &p[1], &p[2], &success);
if (!success) if (!success)
throw std::runtime_error("GDALRPCTransform was not able to process the ForwardTransform."); throw std::runtime_error("GDALRPCTransform was not able to process the ForwardTransform.");
...@@ -158,6 +160,7 @@ bool GDALRPCTransformer::InverseTransform(double* x, double* y, double* z, int n ...@@ -158,6 +160,7 @@ bool GDALRPCTransformer::InverseTransform(double* x, double* y, double* z, int n
if (this->m_Modified) if (this->m_Modified)
this->Update(); this->Update();
std::vector<int> success(nPointCount); std::vector<int> success(nPointCount);
const std::lock_guard<std::mutex> lock(m_Mutex);
GDALRPCTransform(this->m_TransformArg, true, nPointCount, x, y, z, success.data()); GDALRPCTransform(this->m_TransformArg, true, nPointCount, x, y, z, success.data());
bool finalSuccess = std::all_of(success.begin(), success.end(), [](int i){return i;}); bool finalSuccess = std::all_of(success.begin(), success.end(), [](int i){return i;});
return finalSuccess; return finalSuccess;
...@@ -168,6 +171,7 @@ GDALRPCTransformer::PointType GDALRPCTransformer::InverseTransform(GDALRPCTransf ...@@ -168,6 +171,7 @@ GDALRPCTransformer::PointType GDALRPCTransformer::InverseTransform(GDALRPCTransf
if (m_Modified) if (m_Modified)
this->Update(); this->Update();
int success; int success;
const std::lock_guard<std::mutex> lock(m_Mutex);
GDALRPCTransform(this->m_TransformArg, true, 1, &p[0], &p[1], &p[2], &success); GDALRPCTransform(this->m_TransformArg, true, 1, &p[0], &p[1], &p[2], &success);
if (!success) if (!success)
throw std::runtime_error("GDALRPCTransform was not able to process the InverseTransform."); throw std::runtime_error("GDALRPCTransform was not able to process the InverseTransform.");
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment