/********************************************************************** jldem_lib.cc: perform digital elevation model operations on image Author(s): Pieter.Kempeneers@ec.europa.eu Copyright (C) 2016-2022 European Union (Joint Research Centre) This file is part of jiplib. jiplib is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. jiplib is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with jiplib. If not, see . ***********************************************************************/ #include #include #include #include #include #include "imageclasses/Jim.h" #include "jldem_lib.h" using namespace std; using namespace app; shared_ptr Jim::hillShade(Jim& sza, Jim& saa){ shared_ptr imgWriter=Jim::createImg(); hillShade(*imgWriter, sza, saa); return(imgWriter); } void Jim::hillShade(Jim& imgWriter, Jim& sza, Jim& saa){ assert(sza.getDataType() == saa.getDataType()); imgWriter.open(nrOfCol(),nrOfRow(), 1, 1, GDT_Byte); imgWriter.copyGeoTransform(*this); imgWriter.setProjection(this->getProjection()); switch(getDataType()){ case(GDT_Byte): switch(sza.getDataType()){ case(GDT_Byte): hillShade_t(imgWriter, sza, saa); break; case(GDT_Int16): hillShade_t(imgWriter, sza, saa); break; case(GDT_UInt16): hillShade_t(imgWriter, sza, saa); break; case(GDT_Int32): hillShade_t(imgWriter, sza, saa); break; case(GDT_UInt32): hillShade_t(imgWriter, sza, saa); break; case(GDT_Float32): hillShade_t(imgWriter, sza, saa); break; case(GDT_Float64): hillShade_t(imgWriter, sza, saa); break; default: std::string errorString="Error: data type not supported"; throw(errorString); break; } break; case(GDT_Int16): switch(sza.getDataType()){ case(GDT_Byte): hillShade_t(imgWriter, sza, saa); break; case(GDT_Int16): hillShade_t(imgWriter, sza, saa); break; case(GDT_UInt16): hillShade_t(imgWriter, sza, saa); break; case(GDT_Int32): hillShade_t(imgWriter, sza, saa); break; case(GDT_UInt32): hillShade_t(imgWriter, sza, saa); break; case(GDT_Float32): hillShade_t(imgWriter, sza, saa); break; case(GDT_Float64): hillShade_t(imgWriter, sza, saa); break; default: std::string errorString="Error: data type not supported"; throw(errorString); break; } break; case(GDT_UInt16): switch(sza.getDataType()){ case(GDT_Byte): hillShade_t(imgWriter, sza, saa); break; case(GDT_Int16): hillShade_t(imgWriter, sza, saa); break; case(GDT_UInt16): hillShade_t(imgWriter, sza, saa); break; case(GDT_Int32): hillShade_t(imgWriter, sza, saa); break; case(GDT_UInt32): hillShade_t(imgWriter, sza, saa); break; case(GDT_Float32): hillShade_t(imgWriter, sza, saa); break; case(GDT_Float64): hillShade_t(imgWriter, sza, saa); break; default: std::string errorString="Error: data type not supported"; throw(errorString); break; } break; case(GDT_Int32): switch(sza.getDataType()){ case(GDT_Byte): hillShade_t(imgWriter, sza, saa); break; case(GDT_Int16): hillShade_t(imgWriter, sza, saa); break; case(GDT_UInt16): hillShade_t(imgWriter, sza, saa); break; case(GDT_Int32): hillShade_t(imgWriter, sza, saa); break; case(GDT_UInt32): hillShade_t(imgWriter, sza, saa); break; case(GDT_Float32): hillShade_t(imgWriter, sza, saa); break; case(GDT_Float64): hillShade_t(imgWriter, sza, saa); break; default: std::string errorString="Error: data type not supported"; throw(errorString); break; } break; case(GDT_UInt32): switch(sza.getDataType()){ case(GDT_Byte): hillShade_t(imgWriter, sza, saa); break; case(GDT_Int16): hillShade_t(imgWriter, sza, saa); break; case(GDT_UInt16): hillShade_t(imgWriter, sza, saa); break; case(GDT_Int32): hillShade_t(imgWriter, sza, saa); break; case(GDT_UInt32): hillShade_t(imgWriter, sza, saa); break; case(GDT_Float32): hillShade_t(imgWriter, sza, saa); break; case(GDT_Float64): hillShade_t(imgWriter, sza, saa); break; default: std::string errorString="Error: data type not supported"; throw(errorString); break; } break; case(GDT_Float32): switch(sza.getDataType()){ case(GDT_Byte): hillShade_t(imgWriter, sza, saa); break; case(GDT_Int16): hillShade_t(imgWriter, sza, saa); break; case(GDT_UInt16): hillShade_t(imgWriter, sza, saa); break; case(GDT_Int32): hillShade_t(imgWriter, sza, saa); break; case(GDT_UInt32): hillShade_t(imgWriter, sza, saa); break; case(GDT_Float32): hillShade_t(imgWriter, sza, saa); break; case(GDT_Float64): hillShade_t(imgWriter, sza, saa); break; default: std::string errorString="Error: data type not supported"; throw(errorString); break; } break; case(GDT_Float64): switch(sza.getDataType()){ case(GDT_Byte): hillShade_t(imgWriter, sza, saa); break; case(GDT_Int16): hillShade_t(imgWriter, sza, saa); break; case(GDT_UInt16): hillShade_t(imgWriter, sza, saa); break; case(GDT_Int32): hillShade_t(imgWriter, sza, saa); break; case(GDT_UInt32): hillShade_t(imgWriter, sza, saa); break; case(GDT_Float32): hillShade_t(imgWriter, sza, saa); break; case(GDT_Float64): hillShade_t(imgWriter, sza, saa); break; default: std::string errorString="Error: data type not supported"; throw(errorString); break; } break; default: std::string errorString="Error: data type not supported"; throw(errorString); break; } }