Example #1
0
void GeoReverseGeocode::reload()
{
    if (qIsNaN(latitude())) return;
    if (qIsNaN(longitude())) return;
    if (qFuzzyCompare(latitude(), 0.0)) return;
    if (qFuzzyCompare(longitude(), 0.0)) return;

    AbstractTwitterModel::reload();
}
//
// This test checks that a SetLastKnowPosition request
// results in a request to store a position sent to the DB
//
TVerdict CTe_LocMonitorStep11::doTestStepL()
	{
 	if (TestStepResult()==EPass)
 		{
 		TPositionInfo positionInfo;
 		TPosition position;
		TReal64 latitude(11), longitude(21);
		position.SetCoordinate(latitude, longitude);
		positionInfo.SetPosition(position);
			
		RLbsLocMonitorSession locMonSession;
 		User::LeaveIfError(locMonSession.Connect()); 		
 		RLbsLocMonitorAreaPositioner areaPositioner;
 		areaPositioner.OpenL(locMonSession);
 		CleanupClosePushL(areaPositioner);

 		iLocMonDbListener->ListenForLocMonDbFeedback();
 		areaPositioner.SetLastKnownPosition(positionInfo);
 		iLocMonDbListener->WaitForDbFeedback(); 		
		
		// Check that the position received by the DB is the position
		// sent by the test
		TESTL(latitude == iLocMonDbListener->iDbData.iPosition.Latitude());
		TESTL(longitude == iLocMonDbListener->iDbData.iPosition.Longitude());
		
		CleanupStack::PopAndDestroy(&areaPositioner);
 		locMonSession.Close();
 		}

	  return TestStepResult();
	}
void AreaSettingsDialog::loadFromLineEdits()
{
    qDebug() << "void AreaSettingsDialog::loadFromLineEdits()";
    QLineEdit *edit = qobject_cast<QLineEdit *>(sender());
    int position = 5;
    if(edit == ui->lineEdit_p1) position = 0;
    else if(edit == ui->lineEdit_p2) position = 1;
    else if(edit == ui->lineEdit_p3) position = 2;
    else if(edit == ui->lineEdit_p4) position = 3;
    else return;

    QRegExp rx("(\\d{1,3})[°dh,\\s]{1,}(\\d{1,3})['m,\\s]{1,}(\\d{1,3}.\\d{1,})[s,'' ]{1,2}[ x,]{1,}(\\d{1,3})[°dh,\\s]{1,}(\\d{1,3})['m,\\s]{1,}(\\d{1,3}.\\d{1,})[s,']{1,2}");
    rx.exactMatch(edit->text());
    QStringList captured = rx.capturedTexts();

    QPalette palette;

    if(captured.size() == 7 && rx.exactMatch(edit->text()))
    {
        qDebug() << "if(captured.size() == 7 && rx.exactMatch(edit->text())) true";
        DegMinSec longitude(captured.at(1).toInt(),captured.at(2).toInt(),captured.at(3).toFloat());
        DegMinSec latitude(captured.at(4).toInt(),captured.at(5).toInt(),captured.at(6).toFloat());
        qDebug() << "lat: " << latitude.toDMSString();
        qDebug() << "lon: " << longitude.toDMSString();

        points.at(position) = PointWorldCoord(longitude.toDecimalDegress(),latitude.toDecimalDegress());
        createPolygon();
        emit areaChanged(polygon);
        palette.setColor(QPalette::Foreground,Qt::black);;
    }

    else palette.setColor(QPalette::Foreground,Qt::red);
    edit->setPalette(palette);
}
Example #4
0
List maxmind_bindings::lookup(std::vector < std::string >& ip_addresses, MMDB_s *mmdb_set,
                                                     std::vector < std::string > fields){
  
  List output;
  int field_length = fields.size();

  for(int i = 0; i < field_length; i++){
    if(fields[i] == "continent_name"){
      output.push_back(continent_name(mmdb_set, ip_addresses));
    } else if(fields[i] == "country_name"){
      output.push_back(country_name(mmdb_set, ip_addresses));
    } else if(fields[i] == "country_code"){
      output.push_back(country_code(mmdb_set, ip_addresses));
    } else if(fields[i] == "region_name"){
      output.push_back(region_name(mmdb_set, ip_addresses));
    } else if(fields[i] == "city_name"){
      output.push_back(city_name(mmdb_set, ip_addresses));
    } else if(fields[i] == "timezone"){
      output.push_back(timezone(mmdb_set, ip_addresses));
    } else if(fields[i] == "latitude"){
      output.push_back(latitude(mmdb_set, ip_addresses));
    } else if(fields[i] == "longitude"){
      output.push_back(longitude(mmdb_set, ip_addresses));
    } else if(fields[i] == "connection"){
      output.push_back(connection(mmdb_set, ip_addresses));
    }
  }
  
  return output;
}
Example #5
0
//------------------------------------------------------------------------------
//  print true bearing and range to system
//------------------------------------------------------------------------------
void Navaid::printTrueBearingRange(std::ostream& sout, const double aclat, const double aclon, const double acelev) const
{
   double bearing(0.0), range(0.0), grdrange(0.0);
   base::Nav::glla2bd(aclat, aclon, acelev, latitude(), longitude(), elevation(), &bearing, &range, &grdrange);

   sout << "     range " << range << "  grdrange " << grdrange << " true_bearing " << bearing << std::endl;
}
void _set_temperature (const Planet& planet, const Climate_parameters&, Climate_generation_season& season) {
	auto temperature_at_latitude = [](float latitude) {
		return freezing_point() - 25 + 50*cos(latitude);
	};
	
	for (auto& t : tiles(planet)) {
		float temperature = temperature_at_latitude(season.tropical_equator - latitude(planet, vector(t)));
		if (is_land(nth_tile(terrain(planet), id(t)))) {
			if (elevation(nth_tile(terrain(planet), id(t))) > sea_level(planet))
				temperature -= temperature_lapse(elevation(nth_tile(terrain(planet), id(t))) - sea_level(planet));
		}
		else {
			temperature = 0.3*temperature + 0.7*temperature_at_latitude(latitude(planet, vector(t)));
		}
		season.tiles[id(t)].temperature = temperature;
	}
}
Example #7
0
void generate_random_value(grnxx::GeoPoint *value) {
  if ((rng() % 256) == 0) {
    *value = grnxx::GeoPoint::na();
  } else {
    grnxx::Float latitude(-90.0 + (180.0 * rng() / rng.max()));
    grnxx::Float longitude(-180.0 + (360.0 * rng() / rng.max()));
    *value = grnxx::GeoPoint(latitude, longitude);
  }
}
Example #8
0
 /** @brief return cartesian vector from this polar vector
   */
 operator Vec() const
 {
   // get radian latitude
   Coord phi = deg2rad(longitude());
   // get radian longitude
   Coord theta = deg2rad(latitude());
   // calculate and return cartesian vector
   return radius()*Vec(
            sin(theta) * cos(phi),
            sin(theta) * sin(phi),
            cos(theta)
          );
 }
Example #9
0
void loop()
{
  while(1)
  { 
    Serial.print("UTC:");
    UTC();
    Serial.print("Lat:");
    latitude();
    Serial.print("Dir:");
    lat_dir();
    Serial.print("Lon:");
    longitude();
    Serial.print("Dir:");
    lon_dir();
    Serial.print("Alt:");
    altitude();
    Serial.println(' ');
    Serial.println(' ');
  }
}
Example #10
0
void Solution::print(const std::string& output_path) {
    Limits limit;
    Dimension latitude(latitudeLeft, latitudeRight, 0);
    Dimension longitude(longitudeLeft, longitudeRight, 0);

    latitude.to_radian();
    longitude.to_radian();

    const unsigned density = 100;

    for (auto i = static_cast<unsigned>(timeLeft); i < timeRight + 1; ++i) {
        auto path = fmt::format("{}{}{:02}{}", output_path, "time_", i, ".txt");
        std::ofstream out(path);
        for (unsigned x = 0; x <= density; ++x) {
            for (unsigned y = 0; y <= density; ++y) {
                const float phi = latitude.left + (latitude.right - latitude.left) / density * x;
                const float theta = longitude.left + (longitude.right - longitude.left) / density * y;
                const float time = i * 3600;

                float sum = 0;
                for (const auto &item : grids) {
                    sum += item(phi, theta, time);
                }

                limit.update(sum);
                fmt::print(out, "{:.2f}{}", sum, (y != density) ? ' ' : '\n');
            }
        }
        out.close();
    }

    latitude.to_degrees();
    longitude.to_degrees();

    std::ofstream limits(output_path + "limits.txt");
    fmt::print(limits, "{}\n{}\n{}", latitude, longitude, limit);
    limits.close();
}
Example #11
0
//------------------------------------------------------------------------------
// Printing functions
//------------------------------------------------------------------------------
void Airport::printRecord(std::ostream& sout) const
{
   char key1[AP_KEY_LEN+1];
   key(key1);

   char id[AP_IDENT_LEN+1];
   ident(id);

   char ccode[AP_CCODE_LEN+1];
   countryCode(ccode);

   sout << key1;
   sout << ": ";

   sout << id;
   sout << "-";

   sout << ccode;
   sout << "  ";

   sout << char(airportType());
   sout << "  ";

   std::streamoff old = sout.precision();
   sout.precision(12);

   sout << latitude();
   sout << ", ";
   sout << longitude();

   sout.precision(old);

   sout << ", ";
   sout << elevation();
   sout << ", mv=";
   sout << magVariance();

}
Example #12
0
 bool GeoCoords::operator==(const GeoCoords &other) const
 {
     return (longitude() == other.longitude()
             && latitude() == other.latitude()
             && altitude() == other.altitude());
 }
Example #13
0
int QTweetStatusUpdateWithMedia::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QTweetNetBase::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        if (_id < 2)
            qt_static_metacall(this, _c, _id, _a);
        _id -= 2;
    } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
        if (_id < 2)
            *reinterpret_cast<int*>(_a[0]) = -1;
        _id -= 2;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< QString*>(_v) = status(); break;
        case 1: *reinterpret_cast< QString*>(_v) = imageFilename(); break;
        case 2: *reinterpret_cast< bool*>(_v) = isSensitive(); break;
        case 3: *reinterpret_cast< qint64*>(_v) = inReplyToStatusID(); break;
        case 4: *reinterpret_cast< double*>(_v) = latitude(); break;
        case 5: *reinterpret_cast< double*>(_v) = longitude(); break;
        case 6: *reinterpret_cast< QString*>(_v) = placeID(); break;
        case 7: *reinterpret_cast< bool*>(_v) = displayCoordinates(); break;
        }
        _id -= 8;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setStatus(*reinterpret_cast< QString*>(_v)); break;
        case 1: setImageFilename(*reinterpret_cast< QString*>(_v)); break;
        case 2: setSensitive(*reinterpret_cast< bool*>(_v)); break;
        case 3: setReplyToStatusID(*reinterpret_cast< qint64*>(_v)); break;
        case 4: setLatitude(*reinterpret_cast< double*>(_v)); break;
        case 5: setLongitude(*reinterpret_cast< double*>(_v)); break;
        case 6: setPlaceID(*reinterpret_cast< QString*>(_v)); break;
        case 7: setDisplayCoordinates(*reinterpret_cast< bool*>(_v)); break;
        }
        _id -= 8;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 8;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 8;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 8;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 8;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 8;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 8;
    } else if (_c == QMetaObject::RegisterPropertyMetaType) {
        if (_id < 8)
            *reinterpret_cast<int*>(_a[0]) = -1;
        _id -= 8;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
Example #14
0
//------------------------------------------------------------------------------
// serialize true bearing and range to system
//------------------------------------------------------------------------------
void Record::printTrueBearingRange(std::ostream& sout, const double aclat, const double aclon, const double acelev)const
{
   double bearing, range, grdrange;
   Basic::Nav::glla2bd(aclat, aclon, acelev, latitude(), longitude(), elevation(), &bearing, &range, &grdrange);
   sout << "  range " << range << "  grdrange " << grdrange << " true_bearing " << bearing;
}
Example #15
0
void QMapboxGL::setLongitude(double longitude)
{
    d_ptr->mapObj.setLatLng({latitude(), longitude});
}
Example #16
0
double 
Weather::sin_solar_elevation_angle (const Time& time) const // []
{ return Astronomy::SinSolarElevationAngle (time, latitude (), longitude (),
                                            timezone ()); }
Example #17
0
void Solution::add_grid(unsigned spaceIntervals, unsigned timeIntervals) {
    Dimension latitude(latitudeLeft, latitudeRight, spaceIntervals);
    Dimension longitude(longitudeLeft, longitudeRight, spaceIntervals);
    Dimension time(timeLeft * 3600, timeRight * 3600, timeIntervals);
    grids.emplace_back(Grid {latitude, longitude, time});
}
Wind _default_wind (const Planet& p, int i, double tropical_equator) {
	Vector2 pressure_force = _default_pressure_gradient_force(tropical_equator, latitude(p, vector(nth_tile(p,i))));
	double coriolis_coeff = coriolis_coefficient(p, latitude(p, vector(nth_tile(p,i))));
	double friction = is_land(nth_tile(terrain(p), i)) ? 0.000045 : 0.000045;
	return _prevailing_wind(pressure_force, coriolis_coeff, friction);
}
Example #19
0
bool 
Spherical::Test( )
{
    bool ok = true;
    cout << "Testing Spherical" << endl;

    cout << "Spherical( ) [default constructor]" << endl;
    Spherical spherical0;
    cout << "Set( )" << endl;
    spherical0.Set( );
    TESTCHECK( spherical0.Longitude().Radians(), 0., &ok );
    TESTCHECK( spherical0.Latitude().Radians(), 0., &ok );
    TESTCHECK( spherical0.Distance(), 0., &ok );
    Point3D rect0 = spherical0.Rectangular();
    TESTCHECK( rect0.X(), 0., &ok );
    TESTCHECK( rect0.Y(), 0., &ok );
    TESTCHECK( rect0.Z(), 0., &ok );
    double lng = - M_PI / 2;
    Angle longitude( lng );
    double lat = M_PI / 4;
    Angle latitude( lat );
    double dist = sqrt( 2. );
    cout << "Spherical( Angle(" << lng << "), Angle(" << lng << "), " << dist << " ) [longitude, latitude, distance constructor]" << endl;
    Spherical spherical1( longitude, latitude, dist );
    TESTCHECK( spherical1.Longitude().Radians(), lng, &ok );
    TESTCHECK( spherical1.Latitude().Radians(), lat, &ok );
    TESTCHECK( spherical1.Distance(), dist, &ok );
    Point3D rect = spherical1.Rectangular();
    TESTCHECKF( rect.X(), 0., &ok );
    TESTCHECKF( rect.Y(), -1., &ok );
    TESTCHECKF( rect.Z(), 1., &ok );
    lng = 3 * M_PI / 4;
    lat = 0.;
    dist = 4.;
    longitude.Set( lng );
    latitude.Set( lat );
    cout << "Set( Angle(" << lng << "), Angle(" << lng << "),  " << dist << " )" << endl;
    spherical1.Set( longitude, latitude, dist );
    TESTCHECK( spherical1.Longitude().Radians(), lng, &ok );
    TESTCHECK( spherical1.Latitude().Radians(), lat, &ok );
    TESTCHECK( spherical1.Distance(), dist, &ok );
    rect = spherical1.Rectangular();
    TESTCHECKF( rect.X(), - sqrt( 8. ), &ok );
    TESTCHECKF( rect.Y(), sqrt( 8. ), &ok );
    TESTCHECKF( rect.Z(), 0., &ok );
    ostringstream ost;
    cout << "operator<<" << endl;
    ost << spherical1;
    TESTCHECK( ost.str(), string( "( 135°, 0°, 4 )" ), &ok );
    double x = 3.;
    double y = 4.;
    double z = 0.;
    rect.Set( x, y, z );
    cout << "Spherical( Point3D(" << x << ", " << y <<  ", " << z << ") ) [rectangular constructor]" << endl;
    Spherical spherical2( rect );
    TESTCHECKF( spherical2.Longitude().Radians(), 0.927295218, &ok );
    TESTCHECKF( spherical2.Latitude().Radians(), 0., &ok );
    TESTCHECKF( spherical2.Distance(), 5., &ok );
    rect = spherical2.Rectangular();
    TESTCHECKF( rect.X(), x, &ok );
    TESTCHECKF( rect.Y(), y, &ok );
    TESTCHECKF( rect.Z(), z, &ok );
    x = 12.;
    y = 0.;
    z = -5.;
    rect.Set( x, y, z );
    cout << "Set( Point3D(" << x << ", " << y <<  ", " << z << ") )" << endl;
    spherical2.Set( rect );
    TESTCHECKF( spherical2.Longitude().Radians(), 0., &ok );
    TESTCHECKF( spherical2.Latitude().Radians(), -0.39479112, &ok );
    TESTCHECKF( spherical2.Distance(), 13., &ok );
    rect = spherical2.Rectangular();
    TESTCHECKF( rect.X(), x, &ok );
    TESTCHECKF( rect.Y(), y, &ok );
    TESTCHECKF( rect.Z(), z, &ok );
    int h = 14;
    int m = 15;
    double s = 39.7;
    cout << "ra = AngleHMS( " << h << ", " << m << ", " << s << " )" << endl;
    const Angle raArcturus( AngleHMS( h, m, s ) );
    int d = 19;
    m = 10;
    s = 57.;
    cout << "dec = AngleDMS( " << d << ", " << m << ", " << s << " )" << endl;
    const Angle decArcturus( AngleDMS( d, m, s ) );
    cout << "Arcturus: ( ra, dec, 1. )" << endl;
    const Spherical Arcturus( raArcturus, decArcturus );
    h = 13;
    m = 25;
    s = 11.6;
    cout << "ra = AngleHMS( " << h << ", " << m << ", " << s << " )" << endl;
    const Angle raSpica( AngleHMS( h, m, s ) );
    d = -11;
    m = 9;
    s = 41.;
    cout << "dec = AngleDMS( " << d << ", " << m << ", " << s << " )" << endl;
    const Angle decSpica( AngleDMS( d, m, s ) );
    cout << "Spica: ( ra, dec, 1. )" << endl;
    const Spherical Spica( raSpica, decSpica );
    cout << "Separation( Arcturus, Spica )" << endl;
    Angle sep = Separation( Arcturus, Spica );
    TESTCHECKF( sep.Degrees(), 32.7930103, &ok );
    lng = -1.5;
    lat = 0.75;
    dist = 40.;
    longitude.Set( lng );
    latitude.Set( lat );
    cout << "Set( Angle(" << lng << "), Angle(" << lat << "), "
         << dist << " )" << endl;
    spherical1.Set( longitude, latitude, dist );
    TESTCHECK( ToJSON( spherical1 ),
               string( "{\n"
                       "\"distance\": +4.00000000000000e+001,\n"
                       "\"latitude\": +7.50000000000000e-001,\n"
                       "\"longitude\": -1.50000000000000e+000\n"
                       "}"),
               &ok );
    cout << "FromJSON( ToJSON( spherical1 ), &spherical2 )" << endl;
    FromJSON(  ToJSON( spherical1 ), &spherical2 );
    TESTCHECK( spherical2.Longitude().Radians(), lng, &ok );
    TESTCHECK( spherical2.Latitude().Radians(), lat, &ok );
    TESTCHECK( spherical2.Distance(), dist, &ok );

    if ( ok )
        cout << "Spherical PASSED." << endl << endl;
    else
        cout << "Spherical FAILED." << endl << endl;
    return ok;
}
Example #20
0
	QString toStringLonLat() const {return QString("[") + QString::number(longitude()*180./M_PI, 'g', 12) + "," + QString::number(latitude()*180./M_PI, 'g', 12)+"]";}
Example #21
0
void geotag_worker(wc_work_queue &wq, std::vector<GPXPoint> &gpxData) {
    std::string fname;
    // Grab a file from the work queue
    while ((fname = wq.getFile()) != "") {
        try {
            Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(fname.c_str());
            if (image.get() == 0) continue;
            image->readMetadata();

            Exiv2::ExifData &exifData = image->exifData();
            if (exifData.empty()) {
                std::string error = fname;
                error += ": No Exif data found in the file";
                throw Exiv2::Error(1, error);
            }
            std::string tmpTime = exifData["Exif.Photo.DateTimeOriginal"].toString();
            auto tstamp = getImageTimeStamp(tmpTime);

            size_t idx = 0;
            bool foundIt = findClosest(gpxData, tstamp, idx);

            if (!foundIt) {
                std::cout << fname << " is not on the GPX track!\n";
                continue;
            } else {
                std::cout << fname << " was at ("  << std::setprecision(10) << gpxData[idx].lat << ", " << std::setprecision(10) << gpxData[idx].lon << ")\n";
            }
            clearGPSFields(exifData);

            exifData["Exif.GPSInfo.GPSMapDatum"] = "WGS-84";

            exifData["Exif.GPSInfo.GPSAltitude"] = Exiv2::Rational(gpxData[idx].ele * 1000, 1000);
            exifData["Exif.GPSInfo.GPSAltitudeRef"] = Exiv2::byte(0);

            // Convert the latitude to DDD*MM'SS.SSS" and set
            int dd, mm;
            double ss;
            convertToDDMMSS(gpxData[idx].lat, dd, mm, ss);
            if (gpxData[idx].lat<0) {
                exifData["Exif.GPSInfo.GPSLatitudeRef"] = "S";
            } else {
                exifData["Exif.GPSInfo.GPSLatitudeRef"] = "N";
            }

            Exiv2::URationalValue::AutoPtr latitude(new Exiv2::URationalValue);
            latitude->value_.push_back(std::make_pair(dd,1));
            latitude->value_.push_back(std::make_pair(mm,1));
            latitude->value_.push_back(std::make_pair(std::trunc(ss*10000)-1,10000));
            auto latKey = Exiv2::ExifKey("Exif.GPSInfo.GPSLatitude");
            exifData.add(latKey, latitude.get());

            convertToDDMMSS(gpxData[idx].lon, dd, mm, ss);
            Exiv2::URationalValue::AutoPtr longitude(new Exiv2::URationalValue);
            if (gpxData[idx].lon<0) {
                exifData["Exif.GPSInfo.GPSLongitudeRef"] = "W";
            } else {
                exifData["Exif.GPSInfo.GPSLongitudeRef"] = "E";
            }
            longitude->value_.push_back(std::make_pair(dd,1));
            longitude->value_.push_back(std::make_pair(mm,1));
            longitude->value_.push_back(std::make_pair(int(ss*10000)-1,10000));
            auto longKey = Exiv2::ExifKey("Exif.GPSInfo.GPSLongitude");
            exifData.add(longKey, longitude.get());


            Exiv2::URationalValue::AutoPtr timestamp(new Exiv2::URationalValue);
            timestamp->value_.push_back(std::make_pair(gpxData[idx].hour,1));
            timestamp->value_.push_back(std::make_pair(gpxData[idx].minute,1));
            timestamp->value_.push_back(std::make_pair(gpxData[idx].second,1));

            auto timeKey = Exiv2::ExifKey("Exif.GPSInfo.GPSTimeStamp");
            exifData.add(timeKey, timestamp.get());
            
            exifData["Exif.GPSInfo.GPSDateStamp"] = gpxData[idx].dateStamp.c_str();

            image->setExifData(exifData);
            image->writeMetadata();
        }
        catch (Exiv2::AnyError& e) {
            std::cout << "Caught Exiv2 exception '" << e.what() << "'\n";
            continue;
        }
    }
}
Example #22
0
//------------------------------------------------------------------------------
// Printing functions
//------------------------------------------------------------------------------
void Navaid::printRecord(std::ostream& sout) const
{
   char icas[32];
   icaoCode(icas);

   char ikey[32];
   key(ikey);

   char id[12];
   ident(id);

   char ccode[4];
   countryCode(ccode);

   char rc[8];
   radioClass(rc);

   sout << icas << ", ";

   sout << "\"";
   sout << ikey;
   sout << "\", ";

   sout << id;
   sout << "-";
   sout << static_cast<char>(navaidType());
   sout << "-";
   sout << ccode;
   sout << "-";
   sout << keyCode();
   sout << ":";

   std::streamoff old = sout.precision();
   sout.precision(12);

   sout << "  ";
   sout << latitude();
   sout << ", ";
   sout << longitude();

   sout.precision(old);
   sout << ", ";
   sout << elevation();

   sout << "  ";
   sout << frequency();
   sout << "-";
   sout << channel();

   sout << "  ( ";
   sout << magVariance();
   sout << ", ";
   sout << slaveVariance();
   sout << " )";

   sout << " (";
   sout << power();
   sout << "-";
   sout << rc;
   sout << "-";
   sout << range();
   sout << ")";

}
Example #23
0
double 
Weather::extraterrestrial_radiation (const Time& time) const // [W/m2]
{ return Astronomy::ExtraterrestrialRadiation (time, 
                                               latitude (), longitude (),
                                               timezone ()); }
Example #24
0
void GLFWView::onKey(GLFWwindow *window, int key, int /*scancode*/, int action, int mods) {
    auto *view = reinterpret_cast<GLFWView *>(glfwGetWindowUserPointer(window));

    if (action == GLFW_RELEASE) {
        if (key != GLFW_KEY_R || key != GLFW_KEY_S)
            view->animateRouteCallback = nullptr;

        switch (key) {
        case GLFW_KEY_ESCAPE:
            glfwSetWindowShouldClose(window, true);
            break;
        case GLFW_KEY_TAB:
            view->map->cycleDebugOptions();
            break;
        case GLFW_KEY_X:
            if (!mods)
                view->map->resetPosition();
            break;
        case GLFW_KEY_S:
            if (view->changeStyleCallback)
                view->changeStyleCallback();
            break;
#if not MBGL_USE_GLES2
        case GLFW_KEY_B: {
            auto debug = view->map->getDebug();
            if (debug & mbgl::MapDebugOptions::StencilClip) {
                debug &= ~mbgl::MapDebugOptions::StencilClip;
                debug |= mbgl::MapDebugOptions::DepthBuffer;
            } else if (debug & mbgl::MapDebugOptions::DepthBuffer) {
                debug &= ~mbgl::MapDebugOptions::DepthBuffer;
            } else {
                debug |= mbgl::MapDebugOptions::StencilClip;
            }
            view->map->setDebug(debug);
        } break;
#endif // MBGL_USE_GLES2
        case GLFW_KEY_N:
            if (!mods)
                view->map->resetNorth();
            break;
        case GLFW_KEY_Z:
            view->nextOrientation();
            break;
        case GLFW_KEY_Q: {
            auto result = view->map->queryPointAnnotations({ {}, { double(view->getSize().width), double(view->getSize().height) } });
            printf("visible point annotations: %lu\n", result.size());
        } break;
        case GLFW_KEY_P:
            view->pauseResumeCallback();
            break;
        case GLFW_KEY_C:
            view->clearAnnotations();
            break;
        case GLFW_KEY_K:
            view->addRandomCustomPointAnnotations(1);
            break;
        case GLFW_KEY_L:
            view->addRandomLineAnnotations(1);
            break;
        case GLFW_KEY_A: {
            // XXX Fix precision loss in flyTo:
            // https://github.com/mapbox/mapbox-gl-native/issues/4298
            static const std::vector<mbgl::LatLng> places = {
                mbgl::LatLng { -16.796665, -179.999983 },   // Dateline monument
                mbgl::LatLng { 12.9810542, 77.6345551 },    // Mapbox Bengaluru, India
                mbgl::LatLng { -13.15607,-74.21773 },       // Mapbox Peru
                mbgl::LatLng { 37.77572, -122.4158818 },    // Mapbox SF, USA
                mbgl::LatLng { 38.91318,-77.03255 },        // Mapbox DC, USA
            };
            static size_t nextPlace = 0;
            mbgl::CameraOptions cameraOptions;
            cameraOptions.center = places[nextPlace++];
            cameraOptions.zoom = 20;
            cameraOptions.pitch = 30;

            mbgl::AnimationOptions animationOptions(mbgl::Seconds(10));
            view->map->flyTo(cameraOptions, animationOptions);
            nextPlace = nextPlace % places.size();
        } break;
        case GLFW_KEY_R: {
            view->show3DExtrusions = true;
            view->toggle3DExtrusions(view->show3DExtrusions);
            if (view->animateRouteCallback) break;
            view->animateRouteCallback = [](mbgl::Map* routeMap) {
                static mapbox::cheap_ruler::CheapRuler ruler { 40.7 }; // New York
                static mapbox::geojson::geojson route { mapbox::geojson::parse(mbgl::platform::glfw::route) };
                const auto& geometry = route.get<mapbox::geometry::geometry<double>>();
                const auto& lineString = geometry.get<mapbox::geometry::line_string<double>>();

                static double routeDistance = ruler.lineDistance(lineString);
                static double routeProgress = 0;
                routeProgress += 0.0005;
                if (routeProgress > 1.0) routeProgress = 0;

                double distance = routeProgress * routeDistance;
                auto point = ruler.along(lineString, distance);
                auto latLng = routeMap->getLatLng();
                routeMap->setLatLng({ point.y, point.x });
                double bearing = ruler.bearing({ latLng.longitude(), latLng.latitude() }, point);
                double easing = bearing - routeMap->getBearing();
                easing += easing > 180.0 ? -360.0 : easing < -180 ? 360.0 : 0;
                routeMap->setBearing(routeMap->getBearing() + (easing / 20));
                routeMap->setPitch(60.0);
                routeMap->setZoom(18.0);
            };
            view->animateRouteCallback(view->map);
        } break;
        case GLFW_KEY_E:
            view->toggle3DExtrusions(!view->show3DExtrusions);
            break;
        }
    }

    if (action == GLFW_RELEASE || action == GLFW_REPEAT) {
        switch (key) {
        case GLFW_KEY_W: view->popAnnotation(); break;
        case GLFW_KEY_1: view->addRandomPointAnnotations(1); break;
        case GLFW_KEY_2: view->addRandomPointAnnotations(10); break;
        case GLFW_KEY_3: view->addRandomPointAnnotations(100); break;
        case GLFW_KEY_4: view->addRandomPointAnnotations(1000); break;
        case GLFW_KEY_5: view->addRandomPointAnnotations(10000); break;
        case GLFW_KEY_6: view->addRandomPointAnnotations(100000); break;
        case GLFW_KEY_7: view->addRandomShapeAnnotations(1); break;
        case GLFW_KEY_8: view->addRandomShapeAnnotations(10); break;
        case GLFW_KEY_9: view->addRandomShapeAnnotations(100); break;
        case GLFW_KEY_0: view->addRandomShapeAnnotations(1000); break;
        }
    }
}