Skip to content

Commit

Permalink
Resolved comments
Browse files Browse the repository at this point in the history
  • Loading branch information
maartenplieger committed Oct 18, 2021
1 parent 01cdae0 commit 3918909
Show file tree
Hide file tree
Showing 22 changed files with 296 additions and 235 deletions.
33 changes: 33 additions & 0 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"configurations": [
{
"name": "ADAGUC",
"includePath": [
"/usr/include/cairo/",
"/usr/include/freetype2/",
"/usr/include/freetype2/",
"/usr/include/hdf5/serial/",
"./hclasses/",
"./CCDFDataModel/",
"./adagucserverEC/",
"${default}",
"${workspaceRoot}"
],
"defines": ["${default}"],
"macFrameworkPath": ["${default}"],
"forcedInclude": ["${default}"],
"compileCommands": "${default}",
"browse": {
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": "${default}",
"path": ["${default}"]
},
// "intelliSenseMode": "${default}",
"cStandard": "${default}",
"cppStandard": "${default}",
"compilerPath": "${default}"
// "configurationProvider": "go2sh.cmake-integration"
}
],
"version": 4
}
20 changes: 20 additions & 0 deletions .vscode/cmake_configurations.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"configurations": [
{
"name": "Debug",
"buildType": "Debug"
},
{
"name": "Release",
"buildType": "Release"
},
{
"name": "RelWithDebInfo",
"buildType": "RelWithDebInfo"
},
{
"name": "MinSizeRel",
"buildType": "MinSizeRel"
}
]
}
69 changes: 69 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
"files.associations": {
"random": "cpp",
"cctype": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"cstdarg": "cpp",
"cstddef": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"cwctype": "cpp",
"array": "cpp",
"atomic": "cpp",
"bit": "cpp",
"*.tcc": "cpp",
"bitset": "cpp",
"chrono": "cpp",
"complex": "cpp",
"condition_variable": "cpp",
"cstdint": "cpp",
"deque": "cpp",
"forward_list": "cpp",
"list": "cpp",
"map": "cpp",
"set": "cpp",
"unordered_map": "cpp",
"unordered_set": "cpp",
"vector": "cpp",
"exception": "cpp",
"algorithm": "cpp",
"functional": "cpp",
"iterator": "cpp",
"memory": "cpp",
"memory_resource": "cpp",
"numeric": "cpp",
"optional": "cpp",
"ratio": "cpp",
"string": "cpp",
"string_view": "cpp",
"system_error": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"utility": "cpp",
"fstream": "cpp",
"initializer_list": "cpp",
"iomanip": "cpp",
"iosfwd": "cpp",
"iostream": "cpp",
"istream": "cpp",
"limits": "cpp",
"mutex": "cpp",
"new": "cpp",
"ostream": "cpp",
"sstream": "cpp",
"stdexcept": "cpp",
"streambuf": "cpp",
"thread": "cpp",
"cinttypes": "cpp",
"typeindex": "cpp",
"typeinfo": "cpp",
"valarray": "cpp",
"variant": "cpp"
},
"cmake.buildDirectory": "${workspaceFolder}/bin",
"cmake.configureOnOpen": true
}
13 changes: 6 additions & 7 deletions adagucserverEC/CCDFPNGIO.cpp → CCDFDataModel/CCDFPNGIO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,11 @@ int CDFPNGReader::open(const char *fileName){
try{
CT::string infoFile = fileName;
infoFile.concat(".info");
CDBDebug("Trying info file %s", infoFile.c_str());
CT::string infoData=CReadFile::open(infoFile);
CDBDebug("Found info file %s", infoData.c_str());
CT::StackList<CT::string> lines = infoData.splitToStack("\n");
CDBDebug("Numlines %d", lines.size());

for (size_t l = 0; l < lines.size(); l++) {
CDBDebug("line %s", lines[l].c_str());
CDBDebug("Info file line %s", lines[l].c_str());
if (lines[l].startsWith("proj4_params=")) {
CT::string proj4Params = lines[l];
proj4Params.substringSelf(13, -1);
Expand All @@ -113,7 +110,6 @@ int CDFPNGReader::open(const char *fileName){

}
}catch(int e){
CDBDebug("No .info file present for PNG (%d)", e);
}

if(isSlippyMapFormat == true){
Expand All @@ -134,7 +130,9 @@ int CDFPNGReader::open(const char *fileName){
/* Put in headers from PNG */
double bbox[] = {0, 0, 0, 0};
for(size_t j=0;j<pngRaster->headers.size();j++) {
#ifdef CCDFPNGIO_DEBUG
CDBDebug("HEADERS [%s]=[%s]", pngRaster->headers[j].name.c_str(), pngRaster->headers[j].value.c_str());
#endif

/* Proj4 params */
if (pngRaster->headers[j].name.equals("proj4_params")) {
Expand Down Expand Up @@ -365,7 +363,8 @@ int CDFPNGReader::_readVariableData(CDF::Variable *var, CDFType type){
CDBDebug("Warning: reusing pngdata variable");
} else {
if(pngRaster !=NULL && pngRaster->data){
CDBDebug("Info: reusing pngdata");
// CDBDebug("Info: reusing pngdata");
// return 0;
// delete pngRaster;
} else {
if (pngRaster != NULL) delete pngRaster;
Expand All @@ -379,7 +378,7 @@ int CDFPNGReader::_readVariableData(CDF::Variable *var, CDFType type){
// ((unsigned int*)var->data)[x+y*rasterWidth] = 255*256*256 + 255*(256*256*256);
}
}
CDBDebug("Info: pngdata read");
// CDBDebug("Info: pngdata read");
}
}
return 0;
Expand Down
File renamed without changes.
8 changes: 4 additions & 4 deletions CCDFDataModel/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ find_package(HDF5 REQUIRED)
add_library(CCDFDataModel
CCDFDataModel.h
CCDFNetCDFIO.h
CReadPNG.h
CReadPNG.cpp
CCDFPNGIO.h
CCDFPNGIO.cpp
CTime.h
CCDFHDF5IO.h
CProj4ToCF.h
Expand Down Expand Up @@ -32,7 +36,3 @@ add_library(CCDFDataModel

target_include_directories(CCDFDataModel PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${LIBXML2_INCLUDE_DIR} ${HDF5_INCLUDE_DIR})
target_link_libraries(CCDFDataModel hclasses ${NetCDF_LIBRARIES} ${HDF5_LIBRARIES})

# add_executable(cmake-adaguc test.cpp)

# target_link_libraries(cmake-adaguc PRIVATE hclasses)
2 changes: 1 addition & 1 deletion adagucserverEC/CReadPNG.cpp → CCDFDataModel/CReadPNG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ CReadPNG::CPNGRaster * CReadPNG::read_png_file(const char* file_name, bool pngRe

pngRaster->width = png_get_image_width(png_ptr, info_ptr);
pngRaster->height = png_get_image_height(png_ptr, info_ptr);
CDBDebug("CReadPNG::open PNG of size [%dx%d]", pngRaster->width, pngRaster->height );
// CDBDebug("CReadPNG::open PNG of size [%dx%d]", pngRaster->width, pngRaster->height );
color_type = png_get_color_type(png_ptr, info_ptr);
bit_depth = png_get_bit_depth(png_ptr, info_ptr);

Expand Down
1 change: 0 additions & 1 deletion adagucserverEC/CReadPNG.h → CCDFDataModel/CReadPNG.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ class CReadPNG {
hasOnlyHeaders = true;
}
~CPNGRaster() {
CDBDebug("~CPNGRaster");
if(data!=NULL){
delete[] data;
data = NULL;
Expand Down
30 changes: 0 additions & 30 deletions CCDFDataModel/Makefile

This file was deleted.

15 changes: 3 additions & 12 deletions CCDFDataModel/anydump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include "CCDFHDF5IO.h"
#include "CCDFGeoJSONIO.h"
#include "CCDFCSVReader.h"
#include "utils.h"

DEF_ERRORMAIN();

Expand Down Expand Up @@ -81,18 +82,8 @@ int main(int argCount,char **argVars){
int status = 0;
try{
cdfObject=new CDFObject();
if(inputFile.endsWith(".nc")){
cdfReader = new CDFNetCDFReader() ;
}
if(inputFile.endsWith(".h5")){
cdfReader = new CDFHDF5Reader();
}
if(inputFile.endsWith(".geojson")){
cdfReader = new CDFGeoJSONReader();
}
if(inputFile.endsWith(".csv")){
cdfReader = new CDFCSVReader();
}
cdfReader= findReaderByFileName(inputFile);

if (cdfReader == NULL){
CDBError("Unrecognized extension");
throw __LINE__;
Expand Down
36 changes: 36 additions & 0 deletions CCDFDataModel/utils.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@

#include <stdio.h>
#include <vector>
#include <iostream>
#include <CTypes.h>
#include "CDebugger.h"
#include "CCDFDataModel.h"
#include "CCDFNetCDFIO.h"
#include "CCDFHDF5IO.h"
#include "CCDFGeoJSONIO.h"
#include "CCDFCSVReader.h"
#include "CCDFPNGIO.h"

#ifndef ADAGUCUTILS_H
#define ADAGUCUTILS_H

CDFReader*findReaderByFileName(CT::string fileName){
if(fileName.endsWith(".nc")){
return new CDFNetCDFReader() ;
}
if(fileName.endsWith(".h5")){
return new CDFHDF5Reader();
}
if(fileName.endsWith(".geojson")){
return new CDFGeoJSONReader();
}
if(fileName.endsWith(".csv")){
return new CDFCSVReader();
}
if(fileName.endsWith(".png")){
return new CDFPNGReader();
}
return NULL;
}

#endif
7 changes: 7 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ endif()
set(CMAKE_CXX_FLAGS_DEBUG "-g")
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -msse2")

# The additional / is important to remove the last character from the path.
# Note that it does not matter if the OS uses / or \, because we are only
# saving the path size.
string(LENGTH "${CMAKE_SOURCE_DIR}/" SOURCE_PATH_SIZE)
add_definitions("-DSOURCE_PATH_SIZE=${SOURCE_PATH_SIZE}")



add_definitions(-DENABLE_CURL -DADAGUC_USE_GDAL -DADAGUC_USE_SQLITE -DADAGUC_USE_POSTGRESQL -DADAGUC_USE_WEBP)

Expand Down
4 changes: 2 additions & 2 deletions Docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ services:
environment:
- "EXTERNALADDRESS=${EXTERNALADDRESS}"
- 'ADAGUC_DB=host=adaguc-db port=5432 user=adaguc password=adaguc dbname=adaguc'
- 'ADAGUC_ENABLELOGBUFFER=DISABLELOGGING'
- 'ADAGUC_ENABLELOGBUFFER=FALSE'
env_file:
- .env
restart: unless-stopped
Expand Down Expand Up @@ -98,5 +98,5 @@ networks:
# bash docker-compose-generate-env.sh -a ~/adaguc-server-docker/adaguc-autowms/ -d ~/adaguc-server-docker/adaguc-datasets/ -f ~/adaguc-server-docker/adaguc-data -p 443
# docker-compose pull
# docker-compose build
# docker-compose up -d
# docker-compose up -d --build
# wait 10 seconds for the services to start
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ bash docker-compose-generate-env.sh \
docker-compose pull
docker-compose build
docker-compose up -d && sleep 10
docker-compose up -d --build && sleep 10
# Visit the url as configured in the .env file under EXTERNALADDRESS
# The server runs with a self signed certificate, this means you get a warning. Add an exception.
Expand Down
Loading

0 comments on commit 3918909

Please sign in to comment.