| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
#ifndef _JIMLIST_H_ |
| 22 |
#define _JIMLIST_H_ |
| 23 |
|
| 24 |
#include <string> |
| 25 |
#include <vector> |
| 26 |
#include <list> |
| 27 |
#include <memory> |
| 28 |
|
| 29 |
|
| 30 |
#include "Jim.h" |
| 31 |
#include "VectorOgr.h" |
| 32 |
#include "apps/AppFactory.h" |
| 33 |
|
| 34 |
#include "config_jiplib.h" |
| 35 |
|
| 36 |
#if MIALLIB == 1 |
| 37 |
extern "C" { |
| 38 |
#include "miallib_swig.h" |
| 39 |
#include "miallib_convolve.h" |
| 40 |
#include "miallib_dem.h" |
| 41 |
#include "miallib_dist.h" |
| 42 |
#include "miallib_erodil.h" |
| 43 |
#include "miallib_format.h" |
| 44 |
#include "miallib_geodesy.h" |
| 45 |
#include "miallib_geometry.h" |
| 46 |
#include "miallib_hmt.h" |
| 47 |
#include "miallib_imem.h" |
| 48 |
#include "miallib_io.h" |
| 49 |
#include "miallib_label.h" |
| 50 |
#include "miallib_miscel.h" |
| 51 |
#include "miallib_opclo.h" |
| 52 |
#include "miallib_pointop.h" |
| 53 |
#include "miallib_proj.h" |
| 54 |
#include "miallib_segment.h" |
| 55 |
#include "miallib_stats.h" |
| 56 |
#include "op.h" |
| 57 |
} |
| 58 |
#endif |
| 59 |
|
| 60 |
|
| 61 |
namespace app{ |
| 62 |
class AppFactory; |
| 63 |
} |
| 64 |
|
| 65 |
class Jim; |
| 66 |
class VectorOgr; |
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
class JimList : public std::list<std::shared_ptr<Jim> > |
| 72 |
{ |
| 73 |
public: |
| 74 |
enum CRULE_TYPE {overwrite=0, maxndvi=1, maxband=2, minband=3, validband=4, mean=5, mode=6, median=7,sum=8,minallbands=9,maxallbands=10,stdev=11}; |
| 75 |
|
| 76 |
JimList(){}; |
| 77 |
|
| 78 |
JimList(const JimList &jimlist){ |
| 79 |
|
| 80 |
std::list<std::shared_ptr<Jim> >::const_iterator pimit=jimlist.begin(); |
| 81 |
for(pimit=jimlist.begin();pimit!=jimlist.end();++pimit) |
| 82 |
pushImage(*pimit); |
| 83 |
std::vector<double> nodata; |
| 84 |
jimlist.getNoDataValues(nodata); |
| 85 |
setNoData(nodata); |
| 86 |
} |
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
JimList(unsigned int theSize); |
| 93 |
|
| 94 |
JimList(const std::list<std::shared_ptr<Jim> > &jimlist); |
| 95 |
|
| 96 |
JimList(app::AppFactory& theApp){open(theApp);}; |
| 97 |
|
| 98 |
JimList& open(const std::string& strjson); |
| 99 |
|
| 100 |
JimList& open(app::AppFactory& theApp); |
| 101 |
|
| 102 |
std::string jl2json(); |
| 103 |
|
| 104 |
~JimList(){}; |
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
|
| 109 |
|
| 110 |
void getBoundingBox(double& ulx, double& uly, double& lrx, double& lry) const; |
| 111 |
|
| 112 |
double getUlx() const {double ulx, uly, lrx, lry;getBoundingBox(ulx,uly,lrx,lry);return(ulx);}; |
| 113 |
|
| 114 |
double getUly() const {double ulx, uly, lrx, lry;getBoundingBox(ulx,uly,lrx,lry);return(uly);}; |
| 115 |
|
| 116 |
double getLrx() const {double ulx, uly, lrx, lry;getBoundingBox(ulx,uly,lrx,lry);return(lrx);}; |
| 117 |
|
| 118 |
double getLry() const {double ulx, uly, lrx, lry;getBoundingBox(ulx,uly,lrx,lry);return(lry);}; |
| 119 |
|
| 120 |
|
| 121 |
|
| 122 |
|
| 123 |
|
| 124 |
|
| 125 |
|
| 126 |
|
| 127 |
|
| 128 |
|
| 129 |
|
| 130 |
|
| 131 |
|
| 132 |
|
| 133 |
|
| 134 |
|
| 135 |
|
| 136 |
|
| 137 |
|
| 138 |
|
| 139 |
|
| 140 |
JimList& selectGeo(double ulx, double uly, double lrx, double lry); |
| 141 |
|
| 142 |
JimList& selectGeo(double x, double y); |
| 143 |
|
| 144 |
JimList& pushImage(const std::shared_ptr<Jim> imgRaster){ |
| 145 |
this->emplace_back(imgRaster); |
| 146 |
return(*this); |
| 147 |
}; |
| 148 |
|
| 149 |
JimList& popImage(){ |
| 150 |
this->pop_back(); |
| 151 |
return(*this); |
| 152 |
}; |
| 153 |
|
| 154 |
std::shared_ptr<Jim> getImage(int index) const{ |
| 155 |
if(index>=this->size()){ |
| 156 |
std::cerr << "Error: index>=list size" << std::endl; |
| 157 |
return(0); |
| 158 |
} |
| 159 |
std::list<std::shared_ptr<Jim>>::const_iterator it=begin(); |
| 160 |
std::advance(it,index); |
| 161 |
return(*it); |
| 162 |
} |
| 163 |
size_t getSize() const{return size();}; |
| 164 |
|
| 165 |
|
| 166 |
|
| 167 |
|
| 168 |
|
| 169 |
|
| 170 |
|
| 171 |
|
| 172 |
|
| 173 |
|
| 174 |
|
| 175 |
|
| 176 |
|
| 177 |
|
| 178 |
|
| 179 |
|
| 180 |
|
| 181 |
|
| 182 |
bool covers(double x, double y, OGRCoordinateTransformation *poCT=0) const; |
| 183 |
|
| 184 |
bool covers(double ulx, double uly, double lrx, double lry, bool all=false, OGRCoordinateTransformation *poCT=0) const; |
| 185 |
|
| 186 |
bool covers(const Jim &imgRaster, bool all=false) const; |
| 187 |
|
| 188 |
|
| 189 |
|
| 190 |
|
| 191 |
|
| 192 |
|
| 193 |
|
| 194 |
|
| 195 |
|
| 196 |
|
| 197 |
|
| 198 |
|
| 199 |
|
| 200 |
|
| 201 |
|
| 202 |
|
| 203 |
JimList& clear(){std::list<std::shared_ptr<Jim> >::clear();return(*this);}; |
| 204 |
JimList& close(); |
| 205 |
|
| 206 |
void getNoDataValues(std::vector<double>& noDataValues) const; |
| 207 |
|
| 208 |
bool isNoData(double value) const{if(m_noDataValues.empty()) return false;else return find(m_noDataValues.begin(),m_noDataValues.end(),value)!=m_noDataValues.end();}; |
| 209 |
|
| 210 |
void pushNoDataValue(double noDataValue); |
| 211 |
|
| 212 |
void setNoData(const std::vector<double>& nodata){m_noDataValues=nodata;}; |
| 213 |
|
| 214 |
void clearNoData(){m_noDataValues.clear();} |
| 215 |
|
| 216 |
|
| 217 |
void composite(Jim& imgWriter, app::AppFactory& app); |
| 218 |
|
| 219 |
std::shared_ptr<Jim> composite(app::AppFactory& app); |
| 220 |
|
| 221 |
|
| 222 |
|
| 223 |
|
| 224 |
|
| 225 |
void stackBand(Jim& imgWriter, app::AppFactory& app); |
| 226 |
|
| 227 |
void stackBand(Jim& imgWriter){app::AppFactory app;return stackBand(imgWriter,app);}; |
| 228 |
|
| 229 |
std::shared_ptr<Jim> stackBand(app::AppFactory& app); |
| 230 |
|
| 231 |
std::shared_ptr<Jim> stackBand(){app::AppFactory app;return stackBand(app);}; |
| 232 |
|
| 233 |
void stackPlane(Jim& imgWriter, app::AppFactory& app); |
| 234 |
|
| 235 |
void stackPlane(Jim& imgWriter){app::AppFactory app;return stackPlane(imgWriter,app);}; |
| 236 |
|
| 237 |
std::shared_ptr<Jim> stackPlane(app::AppFactory& app); |
| 238 |
|
| 239 |
std::shared_ptr<Jim> stackPlane(){app::AppFactory app;return stackPlane(app);}; |
| 240 |
|
| 241 |
void statProfile(Jim& imgWriter, app::AppFactory& app); |
| 242 |
|
| 243 |
std::shared_ptr<Jim> statProfile(app::AppFactory& app); |
| 244 |
|
| 245 |
std::multimap<std::string,std::string> getStats(app::AppFactory& app); |
| 246 |
|
| 247 |
|
| 248 |
JimList& validate(app::AppFactory& app); |
| 249 |
|
| 250 |
CPLErr extractOgr(VectorOgr& sampleReader, VectorOgr& ogrWriter, app::AppFactory& app); |
| 251 |
|
| 252 |
std::shared_ptr<VectorOgr> extractOgr(VectorOgr& sampleReader, app::AppFactory& app); |
| 253 |
size_t extractOgrMem(VectorOgr& sampleReader, std::vector<unsigned char> &vbytes, app::AppFactory& app); |
| 254 |
|
| 255 |
|
| 256 |
private: |
| 257 |
std::vector<double> m_noDataValues; |
| 258 |
|
| 259 |
}; |
| 260 |
static JimList createJimList(){JimList alist; return alist;}; |
| 261 |
static JimList createJimList(const std::list<std::shared_ptr<Jim> > &jimlist){JimList alist(jimlist);return alist;}; |
| 262 |
#endif |