forked from ExternalVendorCode/Signal-Server
2.91 Landcover tweaks
This commit is contained in:
33
inputs.cc
33
inputs.cc
@@ -15,8 +15,8 @@ int loadClutter(char *filename, double radius, struct site tx)
|
|||||||
AddElevation(lat, lon, height);
|
AddElevation(lat, lon, height);
|
||||||
If tiles are standard 2880 x 3840 then cellsize is constant at 0.004166
|
If tiles are standard 2880 x 3840 then cellsize is constant at 0.004166
|
||||||
*/
|
*/
|
||||||
int x, y, z, clh, result, h, w;
|
int x, y, z, result, h, w;
|
||||||
double xll, yll, xur, yur, cellsize, cellsize2, xOffset, yOffset, lat, lon, i, j;
|
double clh, xll, yll, xur, yur, cellsize, cellsize2, xOffset, yOffset, lat, lon, i, j;
|
||||||
char line[50000];
|
char line[50000];
|
||||||
char * pch;
|
char * pch;
|
||||||
FILE *fd;
|
FILE *fd;
|
||||||
@@ -73,22 +73,22 @@ int loadClutter(char *filename, double radius, struct site tx)
|
|||||||
|
|
||||||
// Apply ITU-R P.452-11
|
// Apply ITU-R P.452-11
|
||||||
// Treat classes 0, 9, 10, 11, 15, 16 as water, (Water, savanna, grassland, wetland, snow, barren)
|
// Treat classes 0, 9, 10, 11, 15, 16 as water, (Water, savanna, grassland, wetland, snow, barren)
|
||||||
clh = 0;
|
clh = 0.0;
|
||||||
|
|
||||||
// evergreen, evergreen, urban
|
// evergreen, evergreen, urban
|
||||||
if(z == 1 || z == 2 || z == 13)
|
if(z == 1 || z == 2 || z == 13)
|
||||||
clh = 20;
|
clh = 20.0;
|
||||||
|
|
||||||
// deciduous, deciduous, mixed
|
// deciduous, deciduous, mixed
|
||||||
if(z==3 || z==4 || z==5)
|
if(z==3 || z==4 || z==5)
|
||||||
clh = 15;
|
clh = 15.0;
|
||||||
if(z==6)
|
// woody shrublands & savannas
|
||||||
clh = 4;
|
if(z==6 || z==8)
|
||||||
if(z==7 || z==12 || z==14)
|
clh = 4.0;
|
||||||
clh = 2;
|
// shurblands, savannas, croplands...
|
||||||
|
if(z==7 || z==9 || z==10 || z==12 || z==14)
|
||||||
|
clh = 2.0;
|
||||||
|
|
||||||
if(clh>1){
|
if(clh>1){
|
||||||
clh/=2; // Because heights are deliberately conservative
|
|
||||||
xOffset=x*cellsize; // 12 deg wide
|
xOffset=x*cellsize; // 12 deg wide
|
||||||
yOffset=y*cellsize; // 16 deg high
|
yOffset=y*cellsize; // 16 deg high
|
||||||
|
|
||||||
@@ -105,15 +105,8 @@ int loadClutter(char *filename, double radius, struct site tx)
|
|||||||
|
|
||||||
// not in near field
|
// not in near field
|
||||||
if((lat > tx.lat+cellsize2 || lat < tx.lat-cellsize2) || (lon > tx.lon + cellsize2 || lon < tx.lon - cellsize2)){
|
if((lat > tx.lat+cellsize2 || lat < tx.lat-cellsize2) || (lon > tx.lon + cellsize2 || lon < tx.lon - cellsize2)){
|
||||||
AddElevation(lat,lon,clh);
|
AddElevation(lat,lon,clh,3);
|
||||||
|
|
||||||
// Create rectangle of dimensions cellsize x cellsize
|
|
||||||
for(i=cellsize*-1; i < cellsize; i=i+0.0005){
|
|
||||||
for(j=cellsize*-1; j < cellsize; j=j+0.0005){
|
|
||||||
AddElevation(lat+i,lon+j,clh);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1757,7 +1750,7 @@ void LoadUDT(char *filename)
|
|||||||
/* No duplicate found */
|
/* No duplicate found */
|
||||||
//fprintf(stdout,"%lf, %lf \n",xpix*dpp, ypix*dpp);
|
//fprintf(stdout,"%lf, %lf \n",xpix*dpp, ypix*dpp);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
AddElevation(xpix * dpp, ypix * dpp, height);
|
AddElevation(xpix * dpp, ypix * dpp, height, 1);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
|
||||||
n = fscanf(fd1, "%d, %d, %lf", &xpix, &ypix, &height);
|
n = fscanf(fd1, "%d, %d, %lf", &xpix, &ypix, &height);
|
||||||
|
20
main.cc
20
main.cc
@@ -1,4 +1,4 @@
|
|||||||
double version = 2.9;
|
double version = 2.91;
|
||||||
/****************************************************************************\
|
/****************************************************************************\
|
||||||
* Signal Server: Radio propagation simulator by Alex Farrant QCVS, 2E0TDW *
|
* Signal Server: Radio propagation simulator by Alex Farrant QCVS, 2E0TDW *
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
@@ -309,7 +309,7 @@ double GetElevation(struct site location)
|
|||||||
return elevation;
|
return elevation;
|
||||||
}
|
}
|
||||||
|
|
||||||
int AddElevation(double lat, double lon, double height)
|
int AddElevation(double lat, double lon, double height, int size)
|
||||||
{
|
{
|
||||||
/* This function adds a user-defined terrain feature
|
/* This function adds a user-defined terrain feature
|
||||||
(in meters AGL) to the digital elevation model data
|
(in meters AGL) to the digital elevation model data
|
||||||
@@ -317,7 +317,7 @@ int AddElevation(double lat, double lon, double height)
|
|||||||
not found in memory. */
|
not found in memory. */
|
||||||
|
|
||||||
char found;
|
char found;
|
||||||
int x = 0, y = 0, indx;
|
int i,j,x = 0, y = 0, indx;
|
||||||
|
|
||||||
for (indx = 0, found = 0; indx < MAXPAGES && found == 0;) {
|
for (indx = 0, found = 0; indx < MAXPAGES && found == 0;) {
|
||||||
x = (int)rint(ppd * (lat - dem[indx].min_north));
|
x = (int)rint(ppd * (lat - dem[indx].min_north));
|
||||||
@@ -329,9 +329,21 @@ int AddElevation(double lat, double lon, double height)
|
|||||||
indx++;
|
indx++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (found)
|
if (found && size<2)
|
||||||
dem[indx].data[x][y] += (short)rint(height);
|
dem[indx].data[x][y] += (short)rint(height);
|
||||||
|
|
||||||
|
// Make surrounding area bigger for wide area landcover. Should enhance 3x3 pixels including c.p
|
||||||
|
if (found && size>1){
|
||||||
|
for(i=size*-1; i <= size; i=i+1){
|
||||||
|
for(j=size*-1; j <= size; j=j+1){
|
||||||
|
if(x+j >= 0 && x+j <=IPPD && y+i >= 0 && y+i <=IPPD)
|
||||||
|
dem[indx].data[x+j][y+i] += (short)rint(height);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
main.hh
2
main.hh
@@ -13,7 +13,7 @@ int GetMask(double lat, double lon);
|
|||||||
int PutSignal(double lat, double lon, unsigned char signal);
|
int PutSignal(double lat, double lon, unsigned char signal);
|
||||||
unsigned char GetSignal(double lat, double lon);
|
unsigned char GetSignal(double lat, double lon);
|
||||||
double GetElevation(struct site location);
|
double GetElevation(struct site location);
|
||||||
int AddElevation(double lat, double lon, double height);
|
int AddElevation(double lat, double lon, double height, int size);
|
||||||
double Distance(struct site site1, struct site site2);
|
double Distance(struct site site1, struct site site2);
|
||||||
double Azimuth(struct site source, struct site destination);
|
double Azimuth(struct site source, struct site destination);
|
||||||
double ElevationAngle(struct site source, struct site destination);
|
double ElevationAngle(struct site source, struct site destination);
|
||||||
|
Reference in New Issue
Block a user