Skip to content

Commit

Permalink
fixed a few compilation problems
Browse files Browse the repository at this point in the history
  • Loading branch information
csoler committed Sep 11, 2024
1 parent 4670a64 commit 7a7cab0
Show file tree
Hide file tree
Showing 4 changed files with 925 additions and 4 deletions.
27 changes: 23 additions & 4 deletions IGNMapper.cpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
#include <GL/glut.h>
#include <QApplication>

#include "argstream.h"
#include "config.h"
#include "MapGUIWindow.h"
#include "ScreenshotCollectionMapDB.h"
#include "QctMapDB.h"
#include "MapAccessor.h"

int main(int argc,char *argv[])
{
argstream as(argc,argv);

std::string qct_file;

as >> parameter('q',"qct",qct_file,"Qct IGN file",false)
>> help();

as.defaultErrorHandling();

glutInit(&argc,argv);
QApplication IGNMapperApp(argc,argv);

Expand All @@ -16,10 +27,18 @@ int main(int argc,char *argv[])

// now create the map

ScreenshotCollectionMapDB mapdb(MAP_ROOT_DIRECTORY) ;
MapAccessor ma(mapdb) ;

map_gui_win.setMapAccessor(ma);
if(!qct_file.empty())
{
QctMapDB mapdb(QString::fromStdString(qct_file)) ;
MapAccessor ma(mapdb) ;
map_gui_win.setMapAccessor(ma);
}
else
{
ScreenshotCollectionMapDB mapdb(MAP_ROOT_DIRECTORY) ;
MapAccessor ma(mapdb) ;
map_gui_win.setMapAccessor(ma);
}

return IGNMapperApp.exec();
}
64 changes: 64 additions & 0 deletions QctMapDB.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#include <iostream>

#include <QFile>

#include "QctMapDB.h"
#include "QctFile.h"

#define NOT_IMPLEMENTED std::cerr << __PRETTY_FUNCTION__ << ": not implemented yet."

QctMapDB::QctMapDB(const QString& name)
: MapDB(name)
{
if(!QFile(name).exists())
throw std::runtime_error("Specified file " + name.toStdString() + " is not present on disk.");

std::cerr << "Reading Qct file " + name.toStdString() << std::endl;

mQctFile.readFilename(name.toStdString().c_str(),true,nullptr);

double lat_00, lon_00, lat_10, lon_10, lat_01, lon_01, lat_11, lon_11 ;
mQctFile.computeLatLonLimits(lat_00, lon_00, lat_10, lon_10, lat_01, lon_01, lat_11, lon_11 );

std::cerr << "Limits: (" << lat_00 << "," << lon_00 << ")" << std::endl;
std::cerr << "Limits: (" << lat_01 << "," << lon_01 << ")" << std::endl;
std::cerr << "Limits: (" << lat_10 << "," << lon_10 << ")" << std::endl;
std::cerr << "Limits: (" << lat_11 << "," << lon_11 << ")" << std::endl;

if(lat_00 == lat_01 && lon_00 == lon_10)
std::cerr << "Area is axis aligned. Good." << std::endl;
else
std::cerr << "Area is not axis aligned. Not good." << std::endl;
}

const std::map<MapDB::ImageHandle,MapDB::RegisteredImage>& QctMapDB::getFullListOfImages() const
{
NOT_IMPLEMENTED;

return std::map<MapDB::ImageHandle,MapDB::RegisteredImage>();
}
bool QctMapDB::getImageParams(ImageHandle h, MapDB::RegisteredImage& img) const
{
NOT_IMPLEMENTED;

return false;
}
QImage QctMapDB::getImageData(ImageHandle h) const
{
NOT_IMPLEMENTED;

return QImage();
}
bool QctMapDB::imageSpaceCoordinatesToGPSCoordinates(const MapDB::ImageSpaceCoord& ic,MapDB::GPSCoord& g) const
{
NOT_IMPLEMENTED;

return false;
}

const MapDB::ReferencePoint& QctMapDB::getReferencePoint(int i) const
{
NOT_IMPLEMENTED;
return ReferencePoint();
}
int QctMapDB::numberOfReferencePoints() const { return 2 ; }
24 changes: 24 additions & 0 deletions QctMapDB.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#pragma once

#include "QctFile.h"
#include "MapDB.h"

// Manages a collection of maps represented by a single QCT file

class QctMapDB : public MapDB
{
public:
QctMapDB(const QString& qct_filename) ; // initializes the map. Loads the registered images entries from xml file.
virtual ~QctMapDB() {}

virtual const std::map<ImageHandle,MapDB::RegisteredImage>& getFullListOfImages() const override ;
virtual bool getImageParams(ImageHandle h, MapDB::RegisteredImage& img) const override;
virtual QImage getImageData(ImageHandle h) const override;
virtual bool imageSpaceCoordinatesToGPSCoordinates(const MapDB::ImageSpaceCoord& ic,MapDB::GPSCoord& g) const override;
virtual const ReferencePoint& getReferencePoint(int i) const override;
virtual int numberOfReferencePoints() const override;

private:

QctFile mQctFile;
};
Loading

0 comments on commit 7a7cab0

Please sign in to comment.