1 | // %flair:license{
|
---|
2 | // This file is part of the Flair framework distributed under the
|
---|
3 | // CECILL-C License, Version 1.0.
|
---|
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 |
|
---|
22 | namespace flair {
|
---|
23 | namespace core {
|
---|
24 |
|
---|
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);
|
---|
31 | }
|
---|
32 |
|
---|
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;
|
---|
39 | }
|
---|
40 |
|
---|
41 | GeoCoordinate::~GeoCoordinate() {}
|
---|
42 |
|
---|
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();
|
---|
51 | }
|
---|
52 |
|
---|
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();
|
---|
60 | }
|
---|
61 |
|
---|
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();
|
---|
69 | }
|
---|
70 |
|
---|
71 | void GeoCoordinate::CopyDatas(char *ptr) const { Warn("a ecrire"); }
|
---|
72 |
|
---|
73 | } // end namespace core
|
---|
74 | } // end namespace flair
|
---|