/* Generated by XDS Modula-2 to ANSI C v4.20 translator */ #define X2C_int32 #define X2C_index32 #ifndef X2C_H_ #include "X2C.h" #endif #define panorama_C_ #ifndef osi_H_ #include "osi.h" #endif #include #ifndef libsrtm_H_ #include "libsrtm.h" #endif #ifndef aprsstr_H_ #include "aprsstr.h" #endif #ifndef pngwrite_H_ #include "pngwrite.h" #endif #ifndef pngread_H_ #include "pngread.h" #endif #ifndef imagetext_H_ #include "imagetext.h" #endif #include /* make panorama image with srtm data by oe5dxl */ #define panorama_TESTX 2 #define panorama_TESTY 359 #define panorama_PI 3.1415926535 #define panorama_PI2 6.283185307 #define panorama_RAD 1.7453292519444E-2 #define panorama_EARTH 6370.0 #define panorama_NOALT 20000 #define panorama_NL "\012" #define panorama_LF "\012" #define panorama_REFRACC 7.85E-8 #define panorama_MAXSYMSIZE 48 /* max input symbol size */ #define panorama_SUNSIZE 4.7996554428472E-3 #define panorama_SHOWTREEDIST 20 /* show trees m from cam */ #define panorama_ZEROTREEALT 2600 #define panorama_FULLTREEALT 1200 #define panorama_TREERASTERSIZE 8.0 /* default m full treesize */ #define panorama_STAMTHICKNESS 0.015 #define panorama_TREEFORM 0.9 /* 0.9 */ #define panorama_STAMLEN 0.35 #define panorama_MINTREESIZE 3 #define panorama_NOISESIZE 1024 #define panorama_MAXHIST 250 #define panorama_MINHIST 10 #define panorama_MAXLUM 16383 #define panorama_TREERAND 3 /* tree position noise */ #define panorama_LUMMUL 8.0 /* real to cardinal colour values in main image */ #define panorama_ALTICOLORANG 1000 /* colourized altitude */ #define panorama_WATERMIRRORGAP 0.2 /* m over water start ray path */ #define panorama_WATERSURFACEDUST 0.6 #define panorama_WAVLEN 5.E+6 #define panorama_TREENOTCH 0.3 /* random tree kill */ #define panorama_cFOGLUMr 900.0 /* low elevation heaven light */ #define panorama_cFOGLUMg 1250.0 #define panorama_cFOGLUMb 2300.0 #define panorama_SUNLUM 5000.0 #define panorama_cMAXCHROMr 1.0 /* sun passed thu air */ #define panorama_cMAXCHROMg 0.9 #define panorama_cMAXCHROMb 0.6 /*0.8*/ #define panorama_cFARCHROMr 1.0 /* sun in space */ #define panorama_cFARCHROMg 1.0 #define panorama_cFARCHROMb 1.0 #define panorama_cMEADOWr 248.0 #define panorama_cMEADOWg 344.0 #define panorama_cMEADOWb 172.0 /* 235 */ #define panorama_cMEADOWVOIDr 412.2 #define panorama_cMEADOWVOIDg 412.2 #define panorama_cMEADOWVOIDb 386.1 #define panorama_cCOASTSANDr 380.0 #define panorama_cCOASTSANDg 450.0 #define panorama_cCOASTSANDb 450.0 #define panorama_cSNOWr 840.0 /*940 930 920 */ #define panorama_cSNOWg 830.0 #define panorama_cSNOWb 820.0 #define panorama_cSNOWSHADOWr 79.0 /*100 145 280*/ #define panorama_cSNOWSHADOWg 115.0 #define panorama_cSNOWSHADOWb 220.0 #define panorama_cSTAMr 98.0 /* 292 271 249 */ #define panorama_cSTAMg 91.0 #define panorama_cSTAMb 84.0 #define panorama_cSTAMVAR 15.0 #define panorama_cTREEr 151.2 /* 200 245 190 *0.85 */ #define panorama_cTREEg 194.4 #define panorama_cTREEb 162.0 #define panorama_cCITYCOL 400.0 #define panorama_cCITYMEADOWr 258.0 #define panorama_cCITYMEADOWg 366.0 #define panorama_cCITYMEADOWb 292.0 #define panorama_cCITYSTREETr 249.0 #define panorama_cCITYSTREETg 282.0 #define panorama_cCITYSTREETb 282.0 #define panorama_cCITYDUSTr 0.18 #define panorama_cCITYDUSTg 0.15 #define panorama_cCITYDUSTb 0.1 #define panorama_cROCKr 418 #define panorama_cROCKg 458 #define panorama_cROCKb 448 #define panorama_cUNDERWATERr 180.0 /* 360 360 330 * 0.6 */ #define panorama_cUNDERWATERg 160.0 #define panorama_cUNDERWATERb 150.0 #define panorama_cWATERALIASr 120.0 /* basic watercolour 33 81 99 *0.9 */ #define panorama_cWATERALIASg 170.0 #define panorama_cWATERALIASb 220.0 #define panorama_cHEAVENr 150.0 #define panorama_cHEAVENg 300.0 #define panorama_cHEAVENb 3500.0 #define panorama_cLAMPHr 0.3 #define panorama_cLAMPHg 0.24 #define panorama_cLAMPHb 0.2 #define panorama_cLAMPWr 0.3 #define panorama_cLAMPWg 0.3 #define panorama_cLAMPWb 0.3 #define panorama_cLAMPTr 0.4 #define panorama_cLAMPTg 0.1 #define panorama_cLAMPTb 0.0 struct COL; struct COL { float r; float g; float b; }; struct CCOL; struct CCOL { uint32_t r; uint32_t g; uint32_t b; }; enum SCREENTYPE {panorama_eCURVED, panorama_eFLAT, panorama_eCAMERA}; struct POSITIONL; struct POSITIONL { double long0; double lat; }; struct PANOWIN; struct PANOWIN { uint8_t flatscreen0; struct POSITIONL eye; struct POSITIONL horizon; float eyealt; float eyeog; float angle0; float elevation; float yzoom0; float refract; int32_t hx; /* mouse pos on panwin and fullwin */ int32_t hy; int32_t mx; int32_t my; uint32_t minlum; /* hint for text contrast */ uint32_t maxlum; float sunazi; float sunele; float hseg; /* poi fast preselect circular segment */ float dist; imagetext_pIMAGE image0; }; struct PIX8A; struct PIX8A { uint8_t r8; /* colour pixel with alpha */ uint8_t g8; uint8_t b8; uint8_t alpha; }; typedef struct PIX8A SYMBOL[48][48]; struct POI; typedef struct POI * pPOI; struct POI { pPOI next; uint32_t r; uint32_t g; uint32_t b; uint32_t alpha; SYMBOL symbol; SYMBOL woodsymbol; uint32_t xs; uint32_t ys; char altIsOG; char withwoodicon; uint8_t prio; char poifn[1024]; char iconfn[1024]; char iconwoodfn[1024]; char iconhint[1024]; }; struct POISTORE; typedef struct POISTORE * pPOISTORE; struct POISTORE { pPOISTORE next; pPOI pp; float x; float y; uint32_t prio; float dist; char thrutree; int32_t textposx; char text[51]; }; struct WAYPOINTS; typedef struct WAYPOINTS * pWAYPOINTS; struct _0; struct _0 { struct POSITIONL pos; float alt; }; struct WAYPOINTS { struct _0 wps[64]; pWAYPOINTS next; }; struct POIMAP { uint32_t * Adr; size_t Len0; }; typedef struct POIMAP * pPOIMAP; /* store image columns with poi text */ struct TRACK; typedef struct TRACK * pTRACK; struct TRACK { pTRACK next; uint32_t r; uint32_t g; uint32_t b; uint32_t altmode; int32_t width; int32_t fd; uint32_t cnt; char fn[100]; }; struct NORMVEC; struct NORMVEC { float x; float y; float z; }; struct LVEC { double x; double y; double z; }; struct ROTVEC; struct ROTVEC { double sx; double cx; double sy; double cy; }; struct RGB; struct RGB { float r; float g; float b; }; struct GLANCESET { struct NORMVEC sunvec; struct NORMVEC eyevec; struct NORMVEC surfacevec; }; struct TREEHINT; struct TREEHINT { float hith; float hitx; float hity; float sx; float sy; float peakh; float areapeak; float regionpeak; float hitradius; float stamtoeye; float og; float passdist; float aliasm; float missspace; int32_t nx; int32_t ny; char treepass; char isstam; float tslant; float varh; float rooth; struct libsrtm_METAINFO meta; struct NORMVEC nvec; uint8_t water; uint8_t wood; uint8_t urban; }; typedef struct TREEHINT TREEHINTS[2]; typedef float NOISEMAP[1024][1024]; struct ALTCOLTAB; struct ALTCOLTAB { struct CCOL c[1024]; struct CCOL tag[6]; uint32_t len; }; struct DROPSHADOW; typedef struct DROPSHADOW * pDROPSHADOW; struct DROPSHADOW { pDROPSHADOW next; double dist; double alt; int32_t colum; }; struct DDSTACK; struct DDSTACK { float startdist; float stoppalt; }; static imagetext_pIMAGE image; static pPOI poifiles; static pTRACK trackfiles; static char dateh[1024]; static char timeh[1024]; static char imagefn[1024]; static char csvfn[1024]; static char colfn[1024]; static int32_t xsize; static int32_t ysize; static struct POSITIONL posa; static struct POSITIONL posb; static struct POSITIONL teye; static float refraction; static float igamma; static float elev; static float angle; static float yzoom; static float wavelength; static float waterslant; static char gammatab[16384]; static uint32_t millisec; static uint32_t altcolstep; static uint32_t rastercsv; static uint32_t poisize; static uint32_t scalesize; static uint32_t whitelim; static uint32_t blacklim; static uint32_t poilabel; static uint32_t fonttypfoot; static uint32_t fonttyp; static struct COL watercol; static struct COL heavencol; static struct RGB desertcol; static char dropshadows; static char alticolour; static char defaultocean; static char verb; static char flatwater; static uint8_t flatscreen; static double treeraster; static double coslat; static double treerasterlat; static double treerasterlong; static double treescramblat; static double treescramblong; static double maxmountain; static double rndseed; static float surfacedust; static float waterglance; static float watertransparency; static float treerastersize; static float abscolmin; static float abscolmax; static float alticolmin; static float alticolmax; static float zerotreealt; static float fulltreealt; static float treeshrink; static float camog; static float camalt; static float sunaz; static float sunel; static float snowalt; static float slowaltslant; static float newsnow; static float waveamp; static float dusthighpass; static float treesize; static float botanicslant; static float ignorblack; static float ignorwhite; static float showstamdist; static float videolat; static float logfilm; static float urbanoff; static float sandgranularity; static float minpoialt; static int32_t csvfd; struct _1; struct _2; struct _2 { struct aprsstr_POSITION p; float a; }; struct _1 { uint32_t act; struct _2 v[1000]; }; static struct _1 csvvec; static struct aprsstr_POSITION poirect0; static struct aprsstr_POSITION poirect1; /* poi fast preselect rectangle */ static uint8_t CRCL[256]; static uint8_t CRCH[256]; static uint16_t CRC[65536]; static NOISEMAP noisemap; static float noisevec[8192]; static struct ALTCOLTAB altcoltab; static pDROPSHADOW freeshadow; static pDROPSHADOW newshadow; static pPOISTORE poistore; static pPOIMAP poimap; static int32_t debugxi; static int32_t debugyi; static float debugx; static float debugy; #define panorama_M (X2C_max_longreal*0.01) static char StrToFixL(double * x, const char s[], uint32_t s_len) { uint32_t i; double p; char ok0; char neg; i = 0UL; neg = 0; ok0 = 0; while (i<=s_len-1 && s[i]==' ') ++i; if (s[i]=='-') { neg = 1; ++i; } *x = 0.0; while ((i<=s_len-1 && (uint8_t)s[i]>='0') && (uint8_t)s[i]<='9') { if (*x='0') && (uint8_t)s[i]<='9') { *x = *x+p*(double)((uint32_t)(uint8_t)s[i]-48UL); p = p*0.1; ++i; ok0 = 1; } } if (neg) *x = -*x; return ok0 && (i>s_len-1 || s[i]==0); } /* end StrToFixL() */ static void Error(char text[], uint32_t text_len) { X2C_PCOPY((void **)&text,text_len); osi_Werr(text, text_len); osi_Werr(" error abort\012", 14ul); X2C_ABORT(); X2C_PFREE(text); } /* end Error() */ static double Random(void) { rndseed = rndseed+3.1415926535; rndseed = rndseed*rndseed; rndseed = rndseed*rndseed; rndseed = rndseed*rndseed; rndseed = rndseed-(double)(uint32_t)X2C_TRUNCC(rndseed,0UL, X2C_max_longcard); return rndseed; } /* end Random() */ static uint32_t truncc(float r) { if (r<=0.0f) return 0UL; else if (r>=2.E+9f) return 2000000000UL; else return (uint32_t)X2C_TRUNCC(r,0UL,X2C_max_longcard); return 0; } /* end truncc() */ #define panorama_POLINOM 0x8408 static void Gencrctab(void) { uint32_t c; uint32_t crc; uint32_t i; for (c = 0UL; c<=255UL; c++) { crc = 255UL-c; for (i = 0UL; i<=7UL; i++) { if ((crc&1)) crc = (uint32_t)((uint32_t)(crc>>1)^0x8408UL); else crc = crc>>1; } /* end for */ CRCL[c] = (uint8_t)crc; CRCH[c] = (uint8_t)(255UL-(crc>>8)); } /* end for */ crc = 1UL; for (i = 0UL; i<=65535UL; i++) { if ((crc&1)) crc = (uint32_t)((uint32_t)(crc>>1)^0x8408UL); else crc = crc>>1; CRC[i] = (uint16_t)crc; } /* end for */ } /* end Gencrctab() */ static float frac(double r) { return (float)(r-floor(r)); } /* end frac() */ static float fracint(double r, int32_t * i) { double ri; ri = floor(r); *i = (int32_t)X2C_TRUNCI(ri,X2C_min_longint,X2C_max_longint); return (float)(r-ri); } /* end fracint() */ static float min0(float a, float b) { if (ab) return a; return b; } /* end max() */ static int32_t imin(int32_t a, int32_t b) { if (ab) return a; return b; } /* end imax() */ static float sqr(float x) { return x*x; } /* end sqr() */ static float plus(float x) { if (x>=0.0f) return x; return 0.0f; } /* end plus() */ #define panorama_LIM 1.57069632675 static float satan(float x) /* satturating tan at +-pi/2 */ { if (x>=1.57069632675f) x = 1.57069632675f; else if (x<=(-1.57069632675f)) x = (-1.57069632675f); return (float)tan((double)x); } /* end satan() */ static float one(float x) { if (x<0.0f) x = 0.0f; else if (x>1.0f) x = 1.0f; return x; } /* end one() */ static float atang2(float x, float y) { float w; if ((float)fabs(x)>(float)fabs(y)) { w = osic_arctan(X2C_DIVR(y,x)); if (x<0.0f) { if (y>0.0f) w = 3.1415926535f+w; else w = w-3.1415926535f; } } else if (y!=0.0f) { w = 1.57079632675f-osic_arctan(X2C_DIVR(x,y)); if (y<0.0f) w = w-3.1415926535f; } else w = 0.0f; return w; } /* end atang2() */ static double atang2l(double x, double y) { double w; if (fabs(x)>fabs(y)) { w = atan(X2C_DIVL(y,x)); if (x<0.0) { if (y>0.0) w = 3.1415926535+w; else w = w-3.1415926535; } } else if (y!=0.0) { w = 1.57079632675-atan(X2C_DIVL(x,y)); if (y<0.0) w = w-3.1415926535; } else w = 0.0; return w; } /* end atang2l() */ static char posvalidl(const struct POSITIONL pos) { return pos.lat!=0.0 || pos.long0!=0.0; } /* end posvalidl() */ static float distancel(struct POSITIONL home, struct POSITIONL dist) { float y; float x; x = (float)fabs(dist.long0-home.long0); y = (float)fabs(dist.lat-home.lat); if (x==0.0f && y==0.0f) return 0.0f; else if (x+y<0.04f) { /* near */ x = (float)((double)x*cos((home.lat+dist.lat)*0.5)); return (float)(6370.0*sqrt((double)(x*x+y*y))); } else { /* far */ if (x>6.283185307f) x = 6.283185307f-x; x = (float)(sin(dist.lat)*sin(home.lat)+cos(dist.lat)*cos(home.lat) *cos((double)x)); if ((float)fabs(x)>=1.0f) return 0.0f; return 6370.0f*osic_arccos(x); } return 0; } /* end distancel() */ static float azimuthl(struct POSITIONL home, struct POSITIONL dist) { float ldiff; float h; ldiff = (float)(dist.long0-home.long0); if ((ldiff==0.0f || cos(home.lat)==0.0) || cos(dist.lat)==0.0) { if (home.lat<=dist.lat) return 0.0f; else return 180.0f; } else { h = 5.729577951472E+1f*osic_arctan((float)(cos(home.lat) *(X2C_DIVL(tan(home.lat)*cos((double)ldiff) -tan(dist.lat),sin((double)ldiff))))); if (ldiff<0.0f) return h+270.0f; else return h+90.0f; } return 0; } /* end azimuthl() */ static void makenoise(void) { uint32_t y; uint32_t x; float v; memset((char *)noisemap,(char)0,sizeof(NOISEMAP)); for (y = 0UL; y<=1024UL; y++) { for (x = 0UL; x<=1023UL; x++) { v = (float)(Random()-0.5); noisemap[y&1023UL][x] = noisemap[y&1023UL][x]*0.7f+v; noisemap[y&1023UL][x] = noisemap[y&1023UL][x] *0.3333f+noisemap[y+1023UL&1023UL][x] *0.3333f+noisemap[y+1UL&1023UL][x]*0.3333f; } /* end for */ } /* end for */ memset((char *)noisevec,(char)0,sizeof(float [8192])); for (x = 0UL; x<=65535UL; x++) { noisevec[x&8191UL] = (noisevec[x&8191UL]*0.7f+(float) CRC[x]*1.52587890625E-5f)-0.5f; noisevec[x&8191UL] = noisevec[x+8191UL&8191UL] *0.3333f+noisevec[x&8191UL]*0.3333f+noisevec[x+1UL&8191UL] *0.3333f; } /* end for */ v = 0.0f; for (x = 1UL; x<=8191UL; x++) { v = noisevec[x]-noisevec[x-1UL]; if (v>0.1f) v = 0.1f; else if (v<(-0.1f)) v = (-0.1f); noisevec[x] = noisevec[x-1UL]+v; } /* end for */ /* IF noisevec[x]>0.0 THEN noisevec[x]:=sqrt(noisevec[x]) ELSIF noisevec[x]<0.0 THEN noisevec[x]:=-sqrt(-noisevec[x]) END; v:=v+(noisevec[x]-v)*0.2; noisevec[x]:=noisevec[x]-v; */ v = 0.0f; /* normalize level */ for (x = 0UL; x<=1023UL; x++) { for (y = 0UL; y<=1023UL; y++) { v = v+(float)fabs(noisemap[y][x]); } /* end for */ } /* end for */ v = X2C_DIVR(sqr(1024.0f),v); for (x = 0UL; x<=1023UL; x++) { for (y = 0UL; y<=1023UL; y++) { noisemap[y][x] = noisemap[y][x]*v; } /* end for */ } /* end for */ /* WrFixed(v/sqr(FLOAT(HIGH(noisemap)+1)), 3, 10); WrStrLn(""); */ } /* end makenoise() */ /* PROCEDURE rndx(x:LONGREAL):REAL; BEGIN x:=x*10.0; RETURN (sin(x*072030.0)*0.0020-sin(x*1721560.0)*0.0014+sin(x*5303500.0) *0.0033 -sin(x*787666.0)*0.0044+sin(x*1287666.0)*0.0051-sin(x*2355636.0) *0.0065)*5.5; END rndx; PROCEDURE rndy(x:LONGREAL):REAL; BEGIN x:=x*10.0; RETURN (sin(x*104830.0)*0.0014-sin(x*2741560.0)*0.0026-sin(x*6373800.0) *0.0035 +sin(x*986626.0)*0.0032-sin(x*2247676.0)*0.0053+sin(x*3254666.0) *0.0047)*5.5; END rndy; */ static void posinval(struct POSITIONL * pos) { pos->long0 = 0.0; pos->lat = 0.0; } /* end posinval() */ static char posvalid(const struct aprsstr_POSITION pos) { return pos.lat!=0.0f || pos.long0!=0.0f; } /* end posvalid() */ static struct aprsstr_POSITION radtodeg(struct aprsstr_POSITION p) { p.lat = p.lat*5.729577951472E+1f; p.long0 = p.long0*5.729577951472E+1f; return p; } /* end radtodeg() */ static float radmod(float w) { while (w>3.1415926535f) w = w-6.283185307f; while (w<(-3.1415926535f)) w = w+6.283185307f; return w; } /* end radmod() */ static void wgs84sl(double lat, double long0, double nn, double * x, double * y, double * z) { double c; double h; h = nn+6.37E+6; *z = h*sin(lat); c = cos(lat); *y = h*sin(long0)*c; *x = h*cos(long0)*c; } /* end wgs84sl() */ static void wgs84rl(double x, double y, double z, double * lat, double * long0, double * heig) { double h; h = x*x+y*y; if (fabs(x)>fabs(y)) { *long0 = atan(X2C_DIVL(y,x)); if (x<0.0) { if (y>0.0) *long0 = 3.1415926535+*long0; else *long0 = *long0-3.1415926535; } } else { *long0 = 1.57079632675-atan(X2C_DIVL(x,y)); if (y<0.0) *long0 = *long0-3.1415926535; } *lat = atan(X2C_DIVL(z,sqrt(h))); *heig = sqrt(h+z*z)-6.37E+6; } /* end wgs84rl() */ static float distnear(const struct POSITIONL a, const struct POSITIONL b) { float y; float x; x = (float)((a.long0-b.long0)*coslat); y = (float)(a.lat-b.lat); return 6.37E+6f*osic_sqrt(x*x+y*y); } /* end distnear() */ #define panorama_BYTESPERPIX 4 typedef struct PIX8A * pROWS; static void readsymbol(SYMBOL img, uint32_t * x, uint32_t * y, const char fn[], uint32_t fn_len) { pROWS rows[48]; int32_t i; int32_t res; int32_t maxxbyte; int32_t maxy; int32_t maxx; maxx = 48L; maxy = 48L; maxxbyte = maxx*4L; /* maxxbyte = maxx*4: switch on alpha channel */ for (i = 0L; i<=47L; i++) { rows[i] = (pROWS) &img[i][0U]; } /* end for */ res = readpng(fn, (char * *)rows, &maxx, &maxy, &maxxbyte); if (res==0L) { *x = (uint32_t)maxx; *y = (uint32_t)maxy; } else Error("icon image not readable", 24ul); /* x:=0; */ /* y:=0; */ /*WrInt(res, 5); WrInt(maxx, 5); WrInt(maxy, 5); WrStrLn(""); */ } /* end readsymbol() */ static void makegammatab(uint32_t min1, uint32_t max1) { uint32_t span; uint32_t c; float g; if (max1<=min1) { min1 = 0UL; max1 = 16383UL; } span = max1-min1; g = X2C_DIVR(1.0f,igamma); for (c = 0UL; c<=16383UL; c++) { if (c>min1) { if (c<=max1) { gammatab[c] = (char)(uint32_t) X2C_TRUNCC(exp(log((double)(X2C_DIVR((float)(c-min1) ,(float)span)))*(double)g)*255.5,0UL, X2C_max_longcard); } else gammatab[c] = '\377'; } else gammatab[c] = 0; } /* end for */ } /* end makegammatab() */ static void histogram(imagetext_pIMAGE img, char nosat, uint32_t * min1, uint32_t * max1) { uint32_t maxe; uint32_t ib; uint32_t iw; uint32_t pixc; uint32_t pc; uint32_t y; uint32_t x; float llog; float ilog; float rw; float w; float fb; float fg; float fr; float mul; float fmin; uint32_t hh[16384]; /* hr:ARRAY[0..MAXLUM] OF REAL; */ uint32_t h[16384]; struct imagetext_PIX * anonym; /* pc:=(VAL(CARDINAL, r)*3 + VAL(CARDINAL, g)*5 + VAL(CARDINAL, b)*2) DIV 10; (* PAL luma *) */ struct imagetext_PIX * anonym0; uint32_t tmp; uint32_t tmp0; memset((char *)h,(char)0,65536UL); memset((char *)hh,(char)0,65536UL); tmp = img->Len0-1; y = 0UL; if (y<=tmp) for (;; y++) { tmp0 = img->Len1-1; x = 0UL; if (x<=tmp0) for (;; x++) { { /* with */ struct imagetext_PIX * anonym = &img->Adr[(x)*img->Len0+y]; pc = ((uint32_t)anonym->r*3UL+(uint32_t) anonym->g*5UL+(uint32_t)anonym->b*1UL)/9UL; /* snow shadow blue, dust blue dimms */ if (nosat) { if ((uint32_t)anonym->r>pc) { pc = (uint32_t)anonym->r; /* saturated single colours */ } if ((uint32_t)anonym->g>pc) pc = (uint32_t)anonym->g; if ((uint32_t)anonym->b>pc) pc = (uint32_t)anonym->b; } if (pc>16383UL) pc = 16383UL; ++hh[pc]; /* whole image */ if (!(anonym->b&1)) ++h[pc]; } if (x==tmp0) break; } /* end for */ if (y==tmp) break; } /* end for */ pixc = ((img->Len1-1)+1UL)*((img->Len0-1)+1UL); ib = truncc((float)pixc*(float)fabs(ignorblack)*0.01f); *min1 = 1UL; /* dont use unfilled black stripes */ while (ib>=h[*min1] && *min1<16383UL) { ib -= h[*min1]; ++*min1; } iw = truncc((float)pixc*ignorwhite*0.01f); *max1 = 16383UL; while (iw>=hh[*max1] && *max1>0UL) { iw -= hh[*max1]; --*max1; } iw = (uint32_t)X2C_TRUNCC((float)pixc*ignorwhite*0.01f,0UL, X2C_max_longcard); maxe = 16383UL; while (iw>=h[maxe] && maxe>0UL) { iw -= h[maxe]; --maxe; } maxe = (uint32_t)imax((int32_t)maxe, (int32_t)whitelim); *min1 = (uint32_t)imin((int32_t)*min1, (int32_t)blacklim); *max1 = (uint32_t)imax((int32_t)*max1, (int32_t)whitelim); /* with heaven */ /*- check contrast for auto filmlinearity */ llog = logfilm; if (logfilm<0.0f) { /* contrast auto */ llog = 2.E+5f; while (llog>100.0f && llog*osic_ln(1.0f+X2C_DIVR((float)*max1, llog))>(float)maxe) llog = llog*0.95f; } if (llog>0.0f) { ilog = X2C_DIVR(1.0f,llog); *max1 = (uint32_t)X2C_TRUNCC(llog*osic_ln(1.0f+(float)*max1*ilog), 0UL,X2C_max_longcard); } if (ignorblack<0.0f) { *min1 = truncc((float)*max1*(float)fabs(ignorblack)); } if (*min1>=*max1) *max1 = *min1+1UL; fmin = (float)*min1; mul = X2C_DIVR(16383.0f,(float)*max1-fmin); if (verb) { osi_WrStr("min..allmax, earthmax, log: ", 29ul); osic_WrINT32(*min1, 6UL); osic_WrINT32(*max1, 6UL); osic_WrINT32(maxe, 6UL); osic_WrFixed(llog, 1L, 10UL); osi_WrStrLn("", 1ul); } tmp = img->Len0-1; y = 0UL; if (y<=tmp) for (;; y++) { tmp0 = img->Len1-1; x = 0UL; if (x<=tmp0) for (;; x++) { { /* with */ struct imagetext_PIX * anonym0 = &img->Adr[(x)*img->Len0+y]; fr = (float)anonym0->r; fg = (float)anonym0->g; fb = (float)anonym0->b; w = fr*0.3f+fg*0.5f+fb*0.2f+0.1f; rw = X2C_DIVR(1.0f,w); fr = fr*rw; fg = fg*rw; fb = fb*rw; w = w-fmin; if (w<0.1f) w = 0.1f; if (llog!=0.0f) w = llog*osic_ln(1.0f+w*ilog); w = mul*w; fr = fr*w; if (fr>16382.0f) fr = 16382.0f; fg = fg*w; if (fg>16382.0f) fg = 16382.0f; fb = fb*w; if (fb>16382.0f) fb = 16382.0f; anonym0->r = (uint16_t)(uint32_t)X2C_TRUNCC(fr,0UL, X2C_max_longcard); anonym0->g = (uint16_t)(uint32_t)X2C_TRUNCC(fg,0UL, X2C_max_longcard); anonym0->b = (uint16_t)(uint32_t)X2C_TRUNCC(fb,0UL, X2C_max_longcard); } if (x==tmp0) break; } /* end for */ if (y==tmp) break; } /* end for */ /* r:=TRUNC(w*fr); g:=TRUNC(w*fg); b:=TRUNC(w*fb); IF r>MAXLUM THEN r:=MAXLUM END; IF g>MAXLUM THEN g:=MAXLUM END; IF b>MAXLUM THEN b:=MAXLUM END; */ *min1 = 0UL; *max1 = 16383UL; } /* end histogram() */ static uint8_t pngc(uint16_t c) { if (c<=16383U) return gammatab[c]; else return 255U; return 0; } /* end pngc() */ static int32_t wrpng(void) { struct PNGPIXMAP pngimg; int32_t ret; /* min, max:CARDINAL; */ int32_t y; int32_t x; struct imagetext_PIX * anonym; struct PNGPIXEL * anonym0; int32_t tmp; int32_t tmp0; ret = -2L; osic_alloc((char * *) &pngimg.image, (uint32_t)(xsize*ysize*3L)); if (pngimg.image) { /* histogram(image, min, max); makegammatab(min, max); */ tmp = ysize-1L; y = 0L; if (y<=tmp) for (;; y++) { tmp0 = xsize-1L; x = 0L; if (x<=tmp0) for (;; x++) { { /* with */ struct imagetext_PIX * anonym = &image->Adr[(x) *image->Len0+((ysize-1L)-y)]; { /* with */ struct PNGPIXEL * anonym0 = &pngimg.image[x+y*xsize]; anonym0->red = pngc(anonym->r); anonym0->green = pngc(anonym->g); anonym0->blue = pngc(anonym->b); } } if (x==tmp0) break; } /* end for */ if (y==tmp) break; } /* end for */ pngimg.width = (uint32_t)xsize; pngimg.height = (uint32_t)ysize; ret = writepng(imagefn, &pngimg); osic_free((char * *) &pngimg.image, (uint32_t)(xsize*ysize*3L)); } else osi_Werr("png write out of memory\012", 25ul); return ret; } /* end wrpng() */ /* ------- moon CONST E=RAD*23.4397; (* obliquity of the Earth *) PROCEDURE fdeclination(l, b:LONGREAL):LONGREAL; BEGIN RETURN asin(sin(b)*cos(E) + cos(b)*sin(E)*sin(l)) END fdeclination; PROCEDURE frightascension(l, b:LONGREAL):LONGREAL; BEGIN RETURN atang2(sin(l)*cos(E)-tan(b)*sin(E), cos(l)) END frightascension; PROCEDURE siderealtime(d, lw:LONGREAL):LONGREAL; BEGIN RETURN RAD*(280.16 + 360.9856235*d) - lw END siderealtime; PROCEDURE faltitude(h, phi, dec:REAL):REAL; BEGIN RETURN asin(sin(phi)*sin(dec) + cos(phi)*cos(dec)*cos(h)) END faltitude; PROCEDURE fazimuth(h, phi, dec:REAL):REAL; BEGIN RETURN atang2(sin(h), cos(h)*sin(phi) - tan(dec)*cos(phi)) END fazimuth; PROCEDURE mooncoords(d:LONGREAL; VAR declination, distance, rightascension:REAL); VAR el, m, f, l, b:LONGREAL; BEGIN el:=(218.316 + 13.176396*d)*RAD; m:= (134.963 + 13.064993*d)*RAD; f:= (93.272 + 13.229350*d)*RAD; l:=el + 6.289*RAD*sin(m); (* latitude *) b:=5.128*RAD*sin(f); (* longitude *) distance:=385001 - 20905*cos(m); (* distance to the moon in km *) declination:=fdeclination(l, b); rightascension:=frightascension(l, b); END mooncoords; PROCEDURE moonposition(lat, long:LONGREAL; time:CARDINAL; VAR az, el, distance:REAL); VAR lw, phi, declination, bigh, rightascension, h:REAL; d:LONGREAL; s:ARRAY[0..30] OF CHAR; BEGIN lw:=-long; phi:=lat; d:=(LFLOAT(time) - LFLOAT(86400*((2000-1970)*1461 DIV 4))) /86400.0 - 0.5 (*49925*); WrFixed(d, 5, 15);WrStrLn("=jd"); mooncoords(d, declination, distance, rightascension); bigh:=siderealtime(d, lw) - rightascension; h:=faltitude(bigh, phi, declination); (* Altitude correction for refraction *) h:=h + (RAD*0.017)/tan(h + (RAD*10.26)/(h + RAD*5.10)); az:=fazimuth(bigh, phi, declination); el:=h; END moonposition; PROCEDURE time2moon(t:CARDINAL; mypos:POSITIONL; VAR moonaz, moonel:REAL); BEGIN moonposition(mypos.lat, mypos.long, t, moonaz, moonel, moondist); moonaz:=moonaz+PI; IF moonaz>2*PI THEN moonaz:=moonaz-2*PI END; WrStr("moon az el:"); WrFixed(moonaz/RAD, 2, 7); WrFixed(moonel/RAD, 2, 7); WrFixed(moondist, 0, 12);WrStrLn(""); END time2moon; ------- moon */ /*---- sun */ static void wrsun(float sunaz0, float sunel0) { if (verb) { osic_WrFixed(sunaz0, 2L, 7UL); osi_WrStrLn(" sunaz", 7ul); osic_WrFixed(sunel0, 2L, 7UL); osi_WrStrLn(" sunel", 7ul); } } /* end wrsun() */ static uint32_t dig(char c, char * err) { if ((uint8_t)c<'0' || (uint8_t)c>'9') { *err = 1; return 0UL; } else return (uint32_t)(uint8_t)c-48UL; return 0; } /* end dig() */ static char StrToDate(char s[], uint32_t s_len, uint32_t * time0) /* */ { uint32_t k; uint32_t d; uint32_t m; uint32_t y; char err; char StrToDate_ret; X2C_PCOPY((void **)&s,s_len); err = 0; y = dig(s[0UL], &err)*1000UL+dig(s[1UL], &err)*100UL+dig(s[2UL], &err)*10UL+dig(s[3UL], &err); if (y<1970UL || y>2100UL) { StrToDate_ret = 0; goto label; } *time0 = (y-1970UL)*365UL+(y-1969UL)/4UL; m = dig(s[4UL], &err)*10UL+dig(s[5UL], &err); d = dig(s[6UL], &err)*10UL+dig(s[7UL], &err); if (d<1UL || d>31UL) { StrToDate_ret = 0; goto label; } k = (uint32_t)((y&3UL)==0UL); *time0 += d-1UL; if (m>2UL) *time0 += k; switch (m) { case 1UL: break; case 2UL: if (d>28UL+k) err = 1; *time0 += 31UL; break; case 3UL: *time0 += 59UL; break; case 4UL: if (d>30UL) err = 1; *time0 += 90UL; break; case 5UL: *time0 += 120UL; break; case 6UL: if (d>30UL) err = 1; *time0 += 151UL; break; case 7UL: *time0 += 181UL; break; case 8UL: *time0 += 212UL; break; case 9UL: if (d>30UL) err = 1; *time0 += 243UL; break; case 10UL: *time0 += 273UL; break; case 11UL: if (d>30UL) err = 1; *time0 += 304UL; break; case 12UL: *time0 += 334UL; break; default:; err = 1; break; } /* end switch */ StrToDate_ret = !err; label:; X2C_PFREE(s); return StrToDate_ret; } /* end StrToDate() */ static char StrToDaytime(char s[], uint32_t s_len, uint32_t * time0) /* */ { uint32_t se; uint32_t mi; uint32_t h; char err; char StrToDaytime_ret; X2C_PCOPY((void **)&s,s_len); err = 0; h = dig(s[0UL], &err)*10UL+dig(s[1UL], &err); if (h>24UL) { StrToDaytime_ret = 0; goto label; } mi = dig(s[2UL], &err)*10UL+dig(s[3UL], &err); if (mi>=60UL) { StrToDaytime_ret = 0; goto label; } se = dig(s[4UL], &err)*10UL+dig(s[5UL], &err); if (se>=60UL) { StrToDaytime_ret = 0; goto label; } *time0 = h*3600UL+mi*60UL+se; StrToDaytime_ret = !err; label:; X2C_PFREE(s); return StrToDaytime_ret; } /* end StrToDaytime() */ static float arcsin(float x) { return osic_arctan((float)(X2C_DIVL((double)x, sqrt((double)(1.0f-x*x))))); } /* end arcsin() */ static float modrad(float w) { return w-(float)((uint32_t)X2C_TRUNCC(X2C_DIVR(w,360.0f),0UL, X2C_max_longcard)*360UL); } /* end modrad() */ static void sunpos(uint32_t tt, float lat, float long0, float * azi, float * ele) { float ta; float fl; float fg; float fhg; float n; float t0; float ga; float c; float alpha; float e; float aa; float r; float g; float l; n = X2C_DIVR((float)(tt-946684800UL),86400.0f)-0.5f; l = 280.46f+9.856474E-1f*n; l = modrad(l); g = 357.528f+9.856003E-1f*n; g = modrad(g)*1.7453292519444E-2f; aa = (float)((double)l+1.915*sin((double)g) +0.02*sin((double)(g*2.0f))); e = 23.439f-4.E-7f*n; c = (float)cos((double)(aa*1.7453292519444E-2f)); alpha = X2C_DIVR(osic_arctan((float)(X2C_DIVL(cos((double) (e*1.7453292519444E-2f))*sin((double) (aa*1.7453292519444E-2f)),(double)c))), 1.7453292519444E-2f); if (c<0.0f) alpha = alpha+180.0f; ga = X2C_DIVR(arcsin((float)(sin((double)(e*1.7453292519444E-2f)) *sin((double)(aa*1.7453292519444E-2f)))), 1.7453292519444E-2f); t0 = X2C_DIVR((float)(int32_t)X2C_TRUNCI(n,X2C_min_longint, X2C_max_longint)+0.5f,36525.0f); fhg = 6.697376f+2.40005134E+3f*t0+X2C_DIVR(1.002738f*(float) (tt%86400UL),3600.0f); fhg = fhg-(float)(uint32_t)X2C_TRUNCC(X2C_DIVR(fhg,24.0f),0UL, X2C_max_longcard)*24.0f; fg = fhg*15.0f; fl = fg+long0; ta = fl-alpha; c = (float)(cos((double)(ta*1.7453292519444E-2f)) *sin((double)(lat*1.7453292519444E-2f)) -tan((double)(ga*1.7453292519444E-2f)) *cos((double)(lat*1.7453292519444E-2f))); *azi = X2C_DIVR(osic_arctan((float)(X2C_DIVL(sin((double) (ta*1.7453292519444E-2f)),(double)c))), 1.7453292519444E-2f)+360.0f+180.0f; if (c<0.0f) *azi = *azi+180.0f; *azi = *azi-(float)(uint32_t)X2C_TRUNCC(X2C_DIVR(*azi,360.0f),0UL, X2C_max_longcard)*360.0f; *ele = X2C_DIVR(arcsin((float)(cos((double) (ga*1.7453292519444E-2f))*cos((double) (ta*1.7453292519444E-2f))*cos((double) (lat*1.7453292519444E-2f))+sin((double) (ga*1.7453292519444E-2f))*sin((double) (lat*1.7453292519444E-2f)))),1.7453292519444E-2f); r = (float)(X2C_DIVL(0.017,tan((double)((*ele+X2C_DIVR(10.3f, *ele+5.11f))*1.7453292519444E-2f)))); *ele = *ele+r; } /* end sunpos() */ static float Refraction(float el) /* in rad */ { return (X2C_DIVR((1.57079632675f-el)-arcsin((float) (9.9811853245532E-1*cos((double)el))), 1.7453292519444E-2f))*0.15f; } /* end Refraction() */ static char time2sun(char date[], uint32_t date_len, char time0[], uint32_t time_len, struct POSITIONL mypos, float * sunaz0, float * sunel0) { uint32_t day; uint32_t t; char time2sun_ret; X2C_PCOPY((void **)&date,date_len); X2C_PCOPY((void **)&time0,time_len); if (StrToDate(date, date_len, &day) && StrToDaytime(time0, time_len, &t)) { sunpos(t+day*86400UL, (float)(X2C_DIVL(mypos.lat, 1.7453292519444E-2)), (float)(X2C_DIVL(mypos.long0, 1.7453292519444E-2)), sunaz0, sunel0); /* sunaz:=sunaz*RAD; sunel:=sunel*RAD; day:=25568+t DIV (60*60*24); day:=1 + day*4 MOD 1461 DIV 4; AzimutHoehe(mypos.lat, day, FLOAT(t MOD 86400)/3600.0 + mypos.long/(RAD*15.0) - 12.0+zeitgleichung(day), sunaz, sunel); */ /*WrFixed(sunel,5,10);WrFixed(Refraction(sunel*RAD),5,10); WrStrLn("=sunrefrac"); */ *sunel0 = *sunel0+Refraction( *sunel0*1.7453292519444E-2f); wrsun(*sunaz0, *sunel0); /* time2moon(t+day*86400, mypos, moonazim, moonelev); */ time2sun_ret = 1; goto label; } time2sun_ret = 0; label:; X2C_PFREE(date); X2C_PFREE(time0); return time2sun_ret; } /* end time2sun() */ static void autosun(float * az, float * el, struct POSITIONL pos, float pan) { if (pos.lat>0.0==pan<180.0f) *az = 90.0f; else *az = (-90.0f); *az = pan+*az; if (*az<0.0f) *az = *az+360.0f; else if (*az>360.0f) *az = *az-360.0f; *el = (float)(15.0+0.58*(90.0-X2C_DIVL(fabs(pos.lat), 1.7453292519444E-2))*fabs(cos((double) ( *az*1.7453292519444E-2f)))); /*WrFixed(ABS(pos.lat)/RAD, 3, 9); WrStrLn("=r"); */ } /* end autosun() */ /*----- sun */ static void getpos(char h[1024], struct POSITIONL * p, const char e[], uint32_t e_len) { struct aprsstr_POSITION ps; osi_NextArg(h, 1024ul); aprsstr_loctopos(&ps, h, 1024ul); if (posvalid(ps)) { p->lat = (double)ps.lat; p->long0 = (double)ps.long0; } else { if (!StrToFixL(&p->lat, h, 1024ul) || fabs(p->lat)>=90.0) { Error(e, e_len); } osi_NextArg(h, 1024ul); if (!StrToFixL(&p->long0, h, 1024ul) || fabs(p->long0)>180.0) { Error(e, e_len); } p->lat = p->lat*1.7453292519444E-2; p->long0 = p->long0*1.7453292519444E-2; } } /* end getpos() */ static void Parms(void) { char err; char altOG; char iconhint[1024]; char iconwoodfn[1024]; char iconfn[1024]; char h[1024]; float sunelev; float sunazim; float rn; float dist; float pan; uint32_t pri; uint32_t label; int32_t p; pPOI ppoi; pTRACK ptrk; int32_t col; err = 0; label = 0UL; iconfn[0] = 0; iconwoodfn[0] = 0; iconhint[0] = 0; pan = 0.0f; dist = 0.0f; dateh[0] = 0; timeh[0] = 0; altOG = 0; millisec = 0UL; pri = 0UL; for (;;) { osi_NextArg(h, 1024ul); if (h[0U]==0) break; if ((h[0U]=='-' && h[1U]) && h[2U]==0) { if (h[1U]=='i') { osi_NextArg(imagefn, 1024ul); if (imagefn[0U]==0 || imagefn[0U]=='-') { Error("-i ", 19ul); } } else if (h[1U]=='P') { osic_alloc((char * *) &ppoi, sizeof(struct POI)); if (ppoi==0) Error("poifile, out of memory", 23ul); ppoi->r = 255UL; ppoi->g = 255UL; ppoi->b = 255UL; ppoi->alpha = 255UL; osi_NextArg(h, 1024ul); ppoi->prio = (uint8_t)pri; /* prefer first pois if no place for text */ ++pri; if (aprsstr_StrToInt(h, 1024ul, &col)) { ppoi->r = (uint32_t)col; osi_NextArg(h, 1024ul); if (aprsstr_StrToInt(h, 1024ul, &col)) { ppoi->g = (uint32_t)col; osi_NextArg(h, 1024ul); if (aprsstr_StrToInt(h, 1024ul, &col)) { ppoi->b = (uint32_t)col; osi_NextArg(h, 1024ul); if (aprsstr_StrToInt(h, 1024ul, &col)) { ppoi->alpha = (uint32_t)col; osi_NextArg(h, 1024ul); } } } } aprsstr_Assign(ppoi->poifn, 1024ul, h, 1024ul); if (ppoi->poifn[0U]==0 || ppoi->poifn[0U]=='-') { Error("-P ", 18ul); } aprsstr_Assign(ppoi->iconfn, 1024ul, iconfn, 1024ul); aprsstr_Assign(ppoi->iconwoodfn, 1024ul, iconwoodfn, 1024ul); aprsstr_Assign(ppoi->iconhint, 1024ul, iconhint, 1024ul); ppoi->altIsOG = altOG; altOG = 0; ppoi->next = poifiles; poifiles = ppoi; } else if (h[1U]=='E') { osic_alloc((char * *) &ptrk, sizeof(struct TRACK)); if (ptrk==0) Error("trackfile, out of memory", 25ul); ptrk->r = 200UL; ptrk->g = 100UL; ptrk->b = 50UL; ptrk->width = 2L; ptrk->altmode = 0UL; osi_NextArg(h, 1024ul); if (aprsstr_StrToInt(h, 1024ul, &col)) { ptrk->r = (uint32_t)col; osi_NextArg(h, 1024ul); if (aprsstr_StrToInt(h, 1024ul, &col)) { ptrk->g = (uint32_t)col; osi_NextArg(h, 1024ul); if (aprsstr_StrToInt(h, 1024ul, &col)) { ptrk->b = (uint32_t)col; osi_NextArg(h, 1024ul); if (aprsstr_StrToInt(h, 1024ul, &col)) { ptrk->width = col; osi_NextArg(h, 1024ul); if (aprsstr_StrToInt(h, 1024ul, &col)) { ptrk->altmode = (uint32_t)col; osi_NextArg(h, 1024ul); } } } } } aprsstr_Assign(ptrk->fn, 100ul, h, 1024ul); /* for -v */ ptrk->fd = osi_OpenRead(h, 1024ul); if (ptrk->fd<0L) Error("-E trackfile not readable", 26ul); if (h[0U]==0 || h[0U]=='-') Error("-E ", 19ul); ptrk->next = trackfiles; trackfiles = ptrk; } else if (h[1U]=='c') { osi_NextArg(csvfn, 1024ul); if (csvfn[0U]==0 || csvfn[0U]=='-') { Error("-c ", 18ul); } } else if (h[1U]=='C') { osi_NextArg(h, 1024ul); if (!aprsstr_StrToInt(h, 1024ul, &col) || col<0L) { Error("-C ", 12ul); } rastercsv = (uint32_t)col; } else if (h[1U]=='I') { osi_NextArg(iconfn, 1024ul); if (iconfn[0U]==0 || iconfn[0U]=='-') { Error("-I (png)", 49ul); } osi_NextArg(iconwoodfn, 1024ul); if (iconwoodfn[0U]=='-') { Error("-I (png)", 49ul); } } else if (h[1U]=='J') { osi_NextArg(iconhint, 1024ul); if (iconhint[0U]==0 || iconhint[0U]=='-') { Error("-J ", 15ul); } if (iconhint[0U]==',') iconhint[0U] = 0; } else if (h[1U]=='v') verb = 1; else if (h[1U]=='O') altOG = 1; else if (h[1U]=='Z') defaultocean = 1; else if (h[1U]=='j') dropshadows = 1; else if (h[1U]=='u') { osi_NextArg(h, 1024ul); if (!aprsstr_StrToFix(&urbanoff, h, 1024ul)) { Error("-u ", 21ul); } } else if (h[1U]=='f') { osi_NextArg(h, 1024ul); if (h[0U]=='0') flatscreen = panorama_eFLAT; else if (h[0U]=='1') flatscreen = panorama_eCAMERA; else Error("-f ", 7ul); } else if (h[1U]=='x') { osi_NextArg(h, 1024ul); if ((!aprsstr_StrToInt(h, 1024ul, &xsize) || xsize<20L) || xsize>=32000L) { Error("-x ", 10ul); } } else if (h[1U]=='y') { osi_NextArg(h, 1024ul); if ((!aprsstr_StrToInt(h, 1024ul, &ysize) || ysize<20L) || ysize>=8192L) { Error("-y ", 10ul); } } else if (h[1U]=='M') { osi_NextArg(h, 1024ul); if (!aprsstr_StrToCard(h, 1024ul, &libsrtm_srtmmaxmem)) { Error("-M ", 11ul); } } else if (h[1U]=='p') { osi_NextArg(libsrtm_srtmdir, 1024ul); if (libsrtm_srtmdir[0U]==0 || libsrtm_srtmdir[0U]=='-') { Error("-p ", 22ul); } } else if (h[1U]=='a') { getpos(h, &posa, "-a or ", 29ul); } else if (h[1U]=='b') { getpos(h, &posb, "-b or ", 29ul); } else if (h[1U]=='A') { osi_NextArg(h, 1024ul); if ((!aprsstr_StrToFix(&camog, h, 1024ul) || camog<0.0f) || camog>5.E+5f) { Error("-A (0..500000)", 23ul); } } else if (h[1U]=='d') { osi_NextArg(h, 1024ul); if (!aprsstr_StrToFix(&pan, h, 1024ul)) { Error("-d ", 14ul); } osi_NextArg(h, 1024ul); if (!aprsstr_StrToFix(&dist, h, 1024ul)) { Error("-d ", 14ul); } } else if (h[1U]=='S') { osi_NextArg(dateh, 1024ul); osi_NextArg(timeh, 1024ul); } else if (h[1U]=='V') { osi_NextArg(h, 1024ul); if (!aprsstr_StrToCard(h, 1024ul, &poilabel)) { Error("-V ", 7ul); } ++poilabel; } else if (h[1U]=='W') { flatwater = 1; osi_NextArg(h, 1024ul); if ((!aprsstr_StrToFix(&waveamp, h, 1024ul) || waveamp<0.0f) || waveamp>10.0f) { Error("-W ", 39ul); } waveamp = waveamp*0.01f; osi_NextArg(h, 1024ul); if (!aprsstr_StrToFix(&wavelength, h, 1024ul)) { Error("-W ", 39ul); } osi_NextArg(h, 1024ul); if (!aprsstr_StrToFix(&waterslant, h, 1024ul)) { Error("-W ", 39ul); } } else if (h[1U]=='m') { osi_NextArg(h, 1024ul); if (!aprsstr_StrToFix(&rn, h, 1024ul)) { Error("-m ", 22ul); } maxmountain = (double)rn; } else if (h[1U]=='N') { osi_NextArg(h, 1024ul); if (!aprsstr_StrToFix(&abscolmin, h, 1024ul)) { aprsstr_Assign(colfn, 1024ul, h, 1024ul); osi_NextArg(h, 1024ul); if (!aprsstr_StrToFix(&abscolmin, h, 1024ul)) { Error("-N [] ", 42ul); } } osi_NextArg(h, 1024ul); if (!aprsstr_StrToFix(&abscolmax, h, 1024ul)) { Error("-N [] ", 42ul); } osi_NextArg(h, 1024ul); if (!aprsstr_StrToCard(h, 1024ul, &altcolstep)) { Error("-N [] ", 42ul); } alticolour = 1; } else if (h[1U]=='t') { osi_NextArg(h, 1024ul); if (!aprsstr_StrToFix(&treesize, h, 1024ul)) { Error("-t ", 40ul); } osi_NextArg(h, 1024ul); if (!aprsstr_StrToFix(&botanicslant, h, 1024ul)) { Error("-t ", 40ul); } osi_NextArg(h, 1024ul); if ((!aprsstr_StrToFix(&treerastersize, h, 1024ul) || treerastersize<1.0f) || treerastersize>100.0f) { Error("-t [1..100m]", 50ul); } } else if (h[1U]=='T') { osi_NextArg(h, 1024ul); if (!aprsstr_StrToFix(&zerotreealt, h, 1024ul)) { Error("-T ", 33ul); } osi_NextArg(h, 1024ul); if (!aprsstr_StrToFix(&fulltreealt, h, 1024ul)) { Error("-T ", 33ul); } if (zerotreealt<=fulltreealt) { Error("-T no_tree_alt <= full_tree_alt ?", 34ul); } } else if (h[1U]=='l') { osi_NextArg(h, 1024ul); if (!aprsstr_StrToFix(&ignorblack, h, 1024ul)) { Error("-l ", 21ul); } osi_NextArg(h, 1024ul); if (!aprsstr_StrToFix(&ignorwhite, h, 1024ul)) { Error("-l ", 21ul); } } else if (h[1U]=='D') { osi_NextArg(h, 1024ul); if (!aprsstr_StrToFix(&desertcol.r, h, 1024ul)) { Error("-D ", 26ul); } osi_NextArg(h, 1024ul); if (!aprsstr_StrToFix(&desertcol.g, h, 1024ul)) { Error("-D ", 26ul); } osi_NextArg(h, 1024ul); if (!aprsstr_StrToFix(&desertcol.b, h, 1024ul)) { Error("-D ", 26ul); } osi_NextArg(h, 1024ul); if (!aprsstr_StrToFix(&sandgranularity, h, 1024ul)) { Error("-D ", 26ul); } } else if (h[1U]=='o') { /* desertcol.r:=desertcol.r*16.0; desertcol.g:=desertcol.g*16.0; desertcol.b:=desertcol.b*16.0; */ osi_NextArg(h, 1024ul); if ((!aprsstr_StrToFix(&minpoialt, h, 1024ul) || minpoialt<(-2.E+4f)) || minpoialt>20000.0f) { Error("-o (0..20000)", 22ul); } } else if (h[1U]=='K') { osi_NextArg(h, 1024ul); if (!aprsstr_StrToFix(&logfilm, h, 1024ul)) { Error("-K ", 19ul); } } else if (h[1U]=='G') { osi_NextArg(h, 1024ul); if (!aprsstr_StrToFix(&snowalt, h, 1024ul)) { Error("-G ", 19ul); } osi_NextArg(h, 1024ul); if (!aprsstr_StrToFix(&slowaltslant, h, 1024ul)) { Error("-G ", 19ul); } if (slowaltslant<1.0f) slowaltslant = 1.0f; } else if (h[1U]=='r') { osi_NextArg(h, 1024ul); if ((!aprsstr_StrToFix(&refraction, h, 1024ul) || refraction<0.0f) || refraction>1.0f) { Error("-r [0.0..1.0]", 27ul); } } else if (h[1U]=='e') { osi_NextArg(h, 1024ul); if ((!aprsstr_StrToFix(&elev, h, 1024ul) || elev<(-90.0f)) || elev>90.0f) { Error("-e [-90.0..90.0]", 29ul); } } else if (h[1U]=='w') { osi_NextArg(h, 1024ul); if ((!aprsstr_StrToFix(&angle, h, 1024ul) || angle<0.1f) || angle>360.0f) { Error("-w [0.1..360.0]", 26ul); } } else if (h[1U]=='L') { osi_NextArg(h, 1024ul); if (!aprsstr_StrToCard(h, 1024ul, &blacklim)) { Error("-L ", 25ul); } osi_NextArg(h, 1024ul); if (!aprsstr_StrToCard(h, 1024ul, &whitelim)) { Error("-L ", 25ul); } } else if (h[1U]=='Q') { osi_NextArg(h, 1024ul); if ((!aprsstr_StrToFix(&videolat, h, 1024ul) || videolat<(-89.0f)) || videolat>89.0f) { Error("-Q [-89..89]", 23ul); } } else if (h[1U]=='z') { osi_NextArg(h, 1024ul); if ((!aprsstr_StrToFix(&yzoom, h, 1024ul) || yzoom<0.001f) || yzoom>10.0f) { Error("-z [0.0..10.0]", 24ul); } } else if (h[1U]=='s') { osi_NextArg(h, 1024ul); if (!aprsstr_StrToCard(h, 1024ul, &poisize) || poisize>20UL) { Error("-s 1..20", 16ul); } } else if (h[1U]=='g') { osi_NextArg(h, 1024ul); if ((!aprsstr_StrToFix(&igamma, h, 1024ul) || igamma<0.1f) || igamma>10.0f) { Error("-g [0.1..10] (1.0)", 27ul); } } else if (h[1U]=='H') { osi_NextArg(h, 1024ul); if (!aprsstr_StrToFix(&heavencol.r, h, 1024ul) || heavencol.r>=256.0f) { Error("-H 0..255", 22ul); } osi_NextArg(h, 1024ul); if (!aprsstr_StrToFix(&heavencol.g, h, 1024ul) || heavencol.g>=256.0f) { Error("-H 0..255", 22ul); } osi_NextArg(h, 1024ul); if (!aprsstr_StrToFix(&heavencol.b, h, 1024ul) || heavencol.b>=256.0f) { Error("-H 0..255", 22ul); } heavencol.r = heavencol.r*16.0f; heavencol.g = heavencol.g*16.0f; heavencol.b = heavencol.b*16.0f; } else if (h[1U]=='R') { osi_NextArg(h, 1024ul); if (!aprsstr_StrToFix(&watercol.r, h, 1024ul) || watercol.r>=1024.0f) { Error("-R ", 43ul); } osi_NextArg(h, 1024ul); if (!aprsstr_StrToFix(&watercol.g, h, 1024ul) || watercol.g>=1024.0f) { Error("-R ", 43ul); } osi_NextArg(h, 1024ul); if (!aprsstr_StrToFix(&watercol.b, h, 1024ul) || watercol.b>=1024.0f) { Error("-R ", 43ul); } osi_NextArg(h, 1024ul); if (!aprsstr_StrToFix(&waterglance, h, 1024ul)) { Error("-R >", 44ul); } osi_NextArg(h, 1024ul); if (!aprsstr_StrToFix(&watertransparency, h, 1024ul)) { Error("-R ", 43ul); } osi_NextArg(h, 1024ul); if (!aprsstr_StrToFix(&surfacedust, h, 1024ul)) { Error("-R ", 43ul); } } else if (h[1U]=='F') { osi_NextArg(h, 1024ul); if (h[0U]=='1') fonttyp = 6UL; else if (h[0U]=='2') fonttyp = 8UL; else if (h[0U]=='3') fonttyp = 10UL; else Error("-F [,] (1:6x10 2:8x14 3:10x20)", 43ul); if (h[1U]==',') { if (h[2U]=='1') fonttypfoot = 6UL; else if (h[2U]=='2') fonttypfoot = 8UL; else if (h[2U]=='3') fonttypfoot = 10UL; else { Error("-F [,] (1:6x10 2:8x14 3:10x20)", 43ul); } } } else { if (h[1U]=='h') { osi_WrStrLn("", 1ul); osi_WrStrLn("Panorama", 9ul); osi_WrStrLn(" -A Camera over gr\ ound or over NN [m] (10)", 74ul); osi_WrStrLn(" -a | [locator] Camera positio\ n lat long (degrees) or qth locator", 85ul); osi_WrStrLn(" -b | [locator] Pan to point l\ at long (degrees) or qth locator", 82ul); osi_WrStrLn(" -C write CSV line\ for every N\'th column", 72ul); osi_WrStrLn(" -c CSV file name", 49ul); osi_WrStrLn(" -D Sand/Rock colo\ ur and granularity (with -t 0 0 -u 0)", 87ul); osi_WrStrLn(" -d Relative to po\ sition a (alternativ to -b)", 77ul); osi_WrStrLn(" km distance \ sight limit", 61ul); osi_WrStrLn(" -E [ ] draw\ track (lat,long[,altNN]) mode=0: always on ground,", 101ul); osi_WrStrLn(" mode=1: use \ alt if above ground, mode=2: no track if alt under gnd", 104ul); osi_WrStrLn(" mode=3: use \ altOG with minimum -o ", 75ul); osi_WrStrLn(" blank csv li\ ne starts a new track (same colour/mode)", 90ul); osi_WrStrLn(" -e Camera Elevati\ on (degrees) (0.0)", 68ul); osi_WrStrLn(" speed optimi\ zer, surface contrast and dust calculation", 92ul); osi_WrStrLn(" are able to \ handle only small elevations!", 79ul); osi_WrStrLn(" -F [,] Font Size POI,\ footline (1) 1: 6x10, 2: 8x14, 3: 10x20", 89ul); osi_WrStrLn(" -f 0 Flat screen \ perpendicular, 1 screen normal to sight (no latitude scale)", 109ul); osi_WrStrLn(" default cour\ ved projection area (needed at >=180deg sight)", 96ul); osi_WrStrLn(" -G Glazier/Snow a\ ltitude and fade out (5000 500)", 81ul); osi_WrStrLn(" -g Image Gamma 0.\ 1..10 (1.0)", 61ul); osi_WrStrLn(" -H Heaven colour \ (50 70 300)", 61ul); osi_WrStrLn(" -h this", 40ul); osi_WrStrLn(" -I | \"\" Symbol Image\ File Name with, w/o wood, set before -P", 88ul); osi_WrStrLn(" -i Image File Nam\ e", 51ul); osi_WrStrLn(" -j dropshadows on\ (test implementation, very slow)", 83ul); osi_WrStrLn(" -J text appended \ to csv lines, set before -P, off with -J ,", 92ul); osi_WrStrLn(" -K compress sunli\ ght/dust to fit in image brightness (4000) 0=linear else auto", 111ul); osi_WrStrLn(" -l <%> <%> fit image cont\ rast to saturate % of all black/white pixels (-0.1 1.0)", 105ul); osi_WrStrLn(" negative black\ level use -level of while", 76ul); osi_WrStrLn(" -L limit contrast\ expansion black white (400 1000)", 83ul); osi_WrStrLn(" -M SRTM-Cache Lim\ it (100000000)", 64ul); osi_WrStrLn(" -m limit searchin\ g montain size in viewed area for speed on long distance (8900)", 113ul); osi_WrStrLn(" -N [] Colou\ rize altitude m, 0 is autoscale", 98ul); osi_WrStrLn(" file: []\ ... min to max (0..255)", 86ul); osi_WrStrLn(" : w wate\ r, t trees, u urban, x ?, y ?", 79ul); osi_WrStrLn(" -O POI File altit\ ude is over ground not NN, set before -P", 90ul); osi_WrStrLn(" -o min. POI altit\ ude over ground (1)", 69ul); osi_WrStrLn(" if given in \ POI file and higher use this", 78ul); osi_WrStrLn(" -P [ []] optional\ icon colours (0..255) POI File Name", 86ul); osi_WrStrLn(" repeat for m\ ore files add -V for labeling", 79ul); osi_WrStrLn(" -p folder with /s\ rtm1 /srtm3 /srtm30", 69ul); osi_WrStrLn(" -Q for video ente\ r raw latitude for squarish tree raster (default camera lat)", 110ul); osi_WrStrLn(" camera altit\ ude now over NN", 65ul); osi_WrStrLn(" -R Water Col\ our mirroring sight (350 300 200 1 1)", 88ul); osi_WrStrLn(" -r 0.0(vacuum)..1\ .0(earth is a disk) (0.13)", 76ul); osi_WrStrLn(" -S [+] |