[2] | 1 | // %flair:license{
|
---|
[15] | 2 | // This file is part of the Flair framework distributed under the
|
---|
| 3 | // CECILL-C License, Version 1.0.
|
---|
[2] | 4 | // %flair:license}
|
---|
| 5 | // created: 2013/07/29
|
---|
| 6 | // filename: GeoCoordinate.cpp
|
---|
| 7 | //
|
---|
| 8 | // author: Guillaume Sanahuja
|
---|
| 9 | // Copyright Heudiasyc UMR UTC/CNRS 7253
|
---|
| 10 | //
|
---|
| 11 | // version: $Id: $
|
---|
| 12 | //
|
---|
| 13 | // purpose: Class defining a point by its lla coordinates
|
---|
| 14 | //
|
---|
| 15 | //
|
---|
| 16 | /*********************************************************************/
|
---|
| 17 |
|
---|
| 18 | #include "GeoCoordinate.h"
|
---|
| 19 |
|
---|
| 20 | using std::string;
|
---|
| 21 |
|
---|
[15] | 22 | namespace flair {
|
---|
| 23 | namespace core {
|
---|
[2] | 24 |
|
---|
[15] | 25 | GeoCoordinate::GeoCoordinate(const Object *parent, string name,
|
---|
| 26 | const GeoCoordinate *point, int n)
|
---|
| 27 | : io_data(parent, name, n) {
|
---|
| 28 | if (n > 1)
|
---|
| 29 | Warn("n>1 not supported\n");
|
---|
| 30 | CopyFrom(point);
|
---|
[2] | 31 | }
|
---|
| 32 |
|
---|
[15] | 33 | GeoCoordinate::GeoCoordinate(const Object *parent, string name, double latitude,
|
---|
| 34 | double longitude, double altitude, int n)
|
---|
| 35 | : io_data(parent, name, n) {
|
---|
| 36 | this->latitude = latitude;
|
---|
| 37 | this->longitude = longitude;
|
---|
| 38 | this->altitude = altitude;
|
---|
[2] | 39 | }
|
---|
| 40 |
|
---|
[15] | 41 | GeoCoordinate::~GeoCoordinate() {}
|
---|
[2] | 42 |
|
---|
[15] | 43 | void GeoCoordinate::CopyFrom(const GeoCoordinate *point) {
|
---|
| 44 | double latitude, longitude, altitude;
|
---|
| 45 | point->GetCoordinates(&latitude, &longitude, &altitude);
|
---|
| 46 | GetMutex();
|
---|
| 47 | this->latitude = latitude;
|
---|
| 48 | this->longitude = longitude;
|
---|
| 49 | this->altitude = altitude;
|
---|
| 50 | ReleaseMutex();
|
---|
[2] | 51 | }
|
---|
| 52 |
|
---|
[15] | 53 | void GeoCoordinate::SetCoordinates(double latitude, double longitude,
|
---|
| 54 | double altitude) {
|
---|
| 55 | GetMutex();
|
---|
| 56 | this->latitude = latitude;
|
---|
| 57 | this->longitude = longitude;
|
---|
| 58 | this->altitude = altitude;
|
---|
| 59 | ReleaseMutex();
|
---|
[2] | 60 | }
|
---|
| 61 |
|
---|
[15] | 62 | void GeoCoordinate::GetCoordinates(double *latitude, double *longitude,
|
---|
| 63 | double *altitude) const {
|
---|
| 64 | GetMutex();
|
---|
| 65 | *latitude = this->latitude;
|
---|
| 66 | *longitude = this->longitude;
|
---|
| 67 | *altitude = this->altitude;
|
---|
| 68 | ReleaseMutex();
|
---|
[2] | 69 | }
|
---|
| 70 |
|
---|
[252] | 71 | void GeoCoordinate::RawRead(char *ptr) const { Warn("a ecrire"); }
|
---|
[2] | 72 |
|
---|
| 73 | } // end namespace core
|
---|
| 74 | } // end namespace flair
|
---|