Skip to content

Commit

Permalink
GDAL and PROJ environment variables are no longer used.
Browse files Browse the repository at this point in the history
  • Loading branch information
estebanrdo committed Oct 3, 2023
1 parent 9281602 commit dea43d6
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 12 deletions.
25 changes: 15 additions & 10 deletions src/graphos/components/images/impl/ImageLoaderTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,16 +194,21 @@ void LoadImagesTask::loadImage(size_t imageId)
epsg_out = mEPSG.toStdString();
}

bool bTrfCrs = mCrsIn->isValid() && mCrsOut->isValid();
tl::CrsTransform crs_trf(mCrsIn, mCrsOut);
tl::Point3<double> pt_in(longitude_degrees.value(), latitude_degrees.value(), altitude);
tl::Point3<double> pt_out = crs_trf.transform(pt_in);

CameraPose camera_pose;
camera_pose.setPosition(pt_out);
camera_pose.setCrs(epsg_out.c_str());
camera_pose.setSource("EXIF");
(*mImages)[imageId].setCameraPose(camera_pose);
try {

bool bTrfCrs = mCrsIn->isValid() && mCrsOut->isValid();
tl::CrsTransform crs_trf(mCrsIn, mCrsOut);
tl::Point3<double> pt_in(longitude_degrees.value(), latitude_degrees.value(), altitude);
tl::Point3<double> pt_out = crs_trf.transform(pt_in);

CameraPose camera_pose;
camera_pose.setPosition(pt_out);
camera_pose.setCrs(epsg_out.c_str());
camera_pose.setSource("EXIF");
(*mImages)[imageId].setCameraPose(camera_pose);
} catch (std::exception &e) {
tl::printException(e);
}
}

tl::Message::instance().resumeMessages();
Expand Down
8 changes: 6 additions & 2 deletions src/graphos/components/properties/impl/PropertiesModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -813,8 +813,12 @@ std::unordered_map<QString, std::list<std::pair<QString, QString>>> PropertiesMo

std::unordered_map<QString, std::list<std::pair<QString, QString>>> PropertiesModelImp::parse(const QString &parser, const QString &file) const
{
auto properties_parser = PropertiesParserFactory::create(parser);
return properties_parser->parse(file);
try {
auto properties_parser = PropertiesParserFactory::create(parser);
return properties_parser->parse(file);
} catch (...) {
TL_THROW_EXCEPTION_WITH_NESTED("");
}
}

void PropertiesModelImp::init()
Expand Down
2 changes: 2 additions & 0 deletions src/graphos/core/Application.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@


class QMainWindow;
class ccGenericPrimitive;

namespace tl
{
Expand Down Expand Up @@ -101,6 +102,7 @@ class Viewer3D
double y,
double z,
const std::array<std::array<float, 3>, 3> &rot) = 0;
virtual void addPrimitive(ccGenericPrimitive *primitive) = 0;
virtual bool isEDL() const = 0;

protected:
Expand Down
17 changes: 17 additions & 0 deletions src/graphos/gui/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,10 @@
#include <tidop/core/log.h>
#include <tidop/core/msg/message.h>

#include <gdal.h>
#include <cpl_conv.h>
#include <ogr_srs_api.h>

#include <QAction>

#ifdef HAVE_VLD
Expand All @@ -138,6 +142,19 @@ using namespace graphos;

int main(int argc, char *argv[])
{
tl::Path app_path(argv[0]);
tl::Path graphos_path = app_path.parentPath().parentPath();
tl::Path gdal_data_path(graphos_path);
gdal_data_path.append("gdal\\data");
tl::Path proj_data_path(graphos_path);
proj_data_path.append("proj");
CPLSetConfigOption( "GDAL_DATA", gdal_data_path.toString().c_str());
#if GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION(3,7,0)
CPLSetConfigOption( "PROJ_DATA", proj_data_path.toString().c_str());
#else
const char *proj_data[] {proj_data_path.toString().c_str(), nullptr};
OSRSetPROJSearchPaths(proj_data);
#endif

Application app(argc, argv);
app.setApplicationName("GRAPHOS");
Expand Down
6 changes: 6 additions & 0 deletions src/graphos/widgets/Viewer3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ TL_DISABLE_WARNINGS
#include <ccCameraSensor.h>
#include <cc2DLabel.h>
#include <cc2DViewportLabel.h>
#include <ccGenericPrimitive.h>

/* Qt */
#include <QMouseEvent>
Expand Down Expand Up @@ -462,6 +463,11 @@ void CCViewer3D::addCamera(const QString &id,
addToDB(camera);
}

void CCViewer3D::addPrimitive(ccGenericPrimitive *primitive)
{
addToDB(primitive);
}

void CCViewer3D::activatePicker(PickingMode pickerMode)
{
deactivatePicker();
Expand Down
1 change: 1 addition & 0 deletions src/graphos/widgets/Viewer3d.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ class CCViewer3D
double y,
double z,
const std::array<std::array<float, 3>, 3> &rot) override;
void addPrimitive(ccGenericPrimitive *primitive) override;

void activatePicker(PickingMode pickerMode);
void deactivatePicker();
Expand Down

0 comments on commit dea43d6

Please sign in to comment.