// Char * mapno: Image number
// Int lon_deg: longitude-degree
// Lon_min: longitude-Score
// Lon_sec: longitude-second
// Lat_deg: latitude-degree
// Lat_min: latitude-Score
// Lat_sec: latitude-second
// Long lscale: Scale
Bool trans (char * mapno, int lon_deg, lon_min, lon_sec, lat_deg, lat_min, lat_sec, long lscale)
{
Int scaleid;
Char Buf [10];
Char s [] = "abcdefghijklmnopqrstuv"; // the latitude of the am topographic map is subject to a QR code.
Long Scale [] = {,}; // image Scale
Double DF [] = {14400,7200, 3600,1200, 600,300,150, 75}; // width and latitude difference, in seconds
Double Dr [] = {21600,10800, 5400,1800, 900,450,225,112.5}; // frame longitude difference in seconds
Long r = lon_deg * 3600 + lon_min * 60 + lon_sec; // longitude, in seconds
Long F = lat_deg * 3600 + lat_min * 60 + lat_sec; // latitude unit: seconds
For (scaleid = 0; scaleid <8; scaleid ++ ){
If (scale [scaleid] = lscale ){
Break;
}
}
If (scaleid = 8 ){
Return false;
}
Int A = f/(4*3600 );
Int B = r/(6*3600) + 31;
Int c = (INT) (4*3600/DF [scaleid])-(INT) (F % (4*3600)/DF [scaleid]);
Int d = (INT) (R % (6*3600)/DR [scaleid]) + 1;
Mapno [0] = s [a];
Strcpy (mapno + 1, ITOA (B, Buf, 10 ));
If (scaleid = 0 ){
Return true;
}
Mapno [3] = s [scaleid];
ITOA (C, Buf, 10 );
If (C <10 ){
Mapno [4] = mapno [5] = '0 ';
Strcpy (mapno + 6, Buf );
} Else if (C <100 ){
Mapno [4] = '0 ';
Strcpy (mapno + 5, Buf );}
Else if (C <1000 ){
Strcpy (mapno + 4, Buf );
} Else {
Return false;
}
ITOA (D, Buf, 10 );
If (d <10 ){
Mapno [7] = mapno [8] = '0 ';
Strcpy (mapno + 9, Buf );
} Else if (d <100 ){
Mapno [7] = '0 ';
Strcpy (mapno + 8, Buf );
} Else if (d <1000 ){
Strcpy (mapno + 7, Buf );
} Else {
Return false;
}
Mapno [10] = '"0 ';
Return true;
}