コード例 #1
0
bool SrtmHgtFile::determineSrtmInfo(const std::string& srtmFilename, std::streamoff size)
{
    // Extract the number of latitude and longitude lines
    unsigned int num_lat;
    unsigned int num_lon;
    // Extract the data intervals for latitude and longitude
    switch (size) {
       case 2884802:
         latSpacing = 3.0 / 3600.0;
         lonSpacing = 3.0 / 3600.0;
         num_lat = 1201;
         num_lon = 1201;
         break;
      case 25934402:
         latSpacing = 1.0 / 3600.0;
         lonSpacing = 1.0 / 3600.0;
         num_lat = 3601;
         num_lon = 3601;
         break;
      default:
         return false;
    }

    // valid SRTM file extensions
    std::string ext1(".hgt");
    std::string ext2(".HGT");
    if (srtmFilename.substr(7, 4) != ".hgt" && srtmFilename.substr(7, 4) != ".HGT") {
        return false;
    }

    // nXXwXXX.hgt   srtm1 srtm3
    int swcLatitude = std::atoi(srtmFilename.substr(1, 2).c_str());
    int swcLongitude = std::atoi(srtmFilename.substr(4, 3).c_str());
    char ns = (char)tolower(srtmFilename[0]);
    char ew = (char)tolower(srtmFilename[3]);
    if ((ns != 'n' && ns != 's') || (ew != 'e' && ew != 'w')) {
        return false;
    }
    if (ns == 's') {
        swcLatitude = -swcLatitude;
    }
    if (ew == 'w') {
        swcLongitude = -swcLongitude;
    }
    setLatitudeSW( swcLatitude );
    setLongitudeSW( swcLongitude );
    setLatitudeNE( swcLatitude + 1 );
    setLongitudeNE( swcLongitude + 1 );

    nptlat = num_lat;
    nptlong = num_lon;

    return true;
}
コード例 #2
0
ファイル: vcompdlg.cpp プロジェクト: jossk/open-watcom-v2
bool VCompDialog::legalExt()
{
    MTarget             *curtarg;
    int i = _imagelist->selected();
    if( i >= 0 ) {
        curtarg = (MTarget *)_tgList[i];
        WString ext1( curtarg->tgtMask().ext() );
        WString ext2( _fn->ext() );
        if( ext2.size() == 0 ) {
            _fn->setExt( ext1 );
            return TRUE;
        }
        if( ext1 == ext2 ) {
            return TRUE;
        }
        WString n; curtarg->name( n );
        WMessageDialog::messagef( this, MsgError, MsgOk, _viperError, "'%s' is not a legal file extension for '%s'", (const char*)ext2, (const char*)n );
    } else {
        WMessageDialog::messagef( this, MsgError, MsgOk, _viperError, "Select an image type." );
    }
    return FALSE;
}
コード例 #3
0
ファイル: imu.c プロジェクト: ghw103/nextcopterplus
void ExtractEulerAngles(void)
{
	EulerAngleRoll = ext2(VectorX);
	EulerAnglePitch = ext2(VectorY);
}