OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright (C) 2009 Apple Inc. All rights reserved. | |
3 * | |
4 * Redistribution and use in source and binary forms, with or without | |
5 * modification, are permitted provided that the following conditions | |
6 * are met: | |
7 * 1. Redistributions of source code must retain the above copyright | |
8 * notice, this list of conditions and the following disclaimer. | |
9 * 2. Redistributions in binary form must reproduce the above copyright | |
10 * notice, this list of conditions and the following disclaimer in the | |
11 * documentation and/or other materials provided with the distribution. | |
12 * | |
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' | |
14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | |
15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS | |
17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | |
23 * THE POSSIBILITY OF SUCH DAMAGE. | |
24 */ | |
25 | |
26 #ifndef GeolocationPosition_h | |
27 #define GeolocationPosition_h | |
28 | |
29 #include "platform/heap/Handle.h" | |
30 | |
31 namespace blink { | |
32 | |
33 class GeolocationPosition : public GarbageCollected<GeolocationPosition> { | |
34 public: | |
35 static GeolocationPosition* create(double timestamp, double latitude, double
longitude, double accuracy) | |
36 { | |
37 return new GeolocationPosition(timestamp, latitude, longitude, accuracy)
; | |
38 } | |
39 static GeolocationPosition* create(double timestamp, double latitude, double
longitude, double accuracy, bool providesAltitude, double altitude, bool provid
esAltitudeAccuracy, double altitudeAccuracy, bool providesHeading, double headin
g, bool providesSpeed, double speed) | |
40 { | |
41 return new GeolocationPosition(timestamp, latitude, longitude, accuracy,
providesAltitude, altitude, providesAltitudeAccuracy, altitudeAccuracy, provide
sHeading, heading, providesSpeed, speed); | |
42 } | |
43 DEFINE_INLINE_TRACE() { } | |
44 | |
45 double timestamp() const { return m_timestamp; } | |
46 | |
47 double latitude() const { return m_latitude; } | |
48 double longitude() const { return m_longitude; } | |
49 double accuracy() const { return m_accuracy; } | |
50 double altitude() const { return m_altitude; } | |
51 double altitudeAccuracy() const { return m_altitudeAccuracy; } | |
52 double heading() const { return m_heading; } | |
53 double speed() const { return m_speed; } | |
54 | |
55 bool canProvideAltitude() const { return m_canProvideAltitude; } | |
56 bool canProvideAltitudeAccuracy() const { return m_canProvideAltitudeAccurac
y; } | |
57 bool canProvideHeading() const { return m_canProvideHeading; } | |
58 bool canProvideSpeed() const { return m_canProvideSpeed; } | |
59 | |
60 private: | |
61 GeolocationPosition(double timestamp, double latitude, double longitude, dou
ble accuracy) | |
62 : m_timestamp(timestamp) | |
63 , m_latitude(latitude) | |
64 , m_longitude(longitude) | |
65 , m_accuracy(accuracy) | |
66 , m_altitude(0) | |
67 , m_altitudeAccuracy(0) | |
68 , m_heading(0) | |
69 , m_speed(0) | |
70 , m_canProvideAltitude(false) | |
71 , m_canProvideAltitudeAccuracy(false) | |
72 , m_canProvideHeading(false) | |
73 , m_canProvideSpeed(false) | |
74 { | |
75 } | |
76 | |
77 GeolocationPosition(double timestamp, double latitude, double longitude, dou
ble accuracy, bool providesAltitude, double altitude, bool providesAltitudeAccur
acy, double altitudeAccuracy, bool providesHeading, double heading, bool provide
sSpeed, double speed) | |
78 : m_timestamp(timestamp) | |
79 , m_latitude(latitude) | |
80 , m_longitude(longitude) | |
81 , m_accuracy(accuracy) | |
82 , m_altitude(altitude) | |
83 , m_altitudeAccuracy(altitudeAccuracy) | |
84 , m_heading(heading) | |
85 , m_speed(speed) | |
86 , m_canProvideAltitude(providesAltitude) | |
87 , m_canProvideAltitudeAccuracy(providesAltitudeAccuracy) | |
88 , m_canProvideHeading(providesHeading) | |
89 , m_canProvideSpeed(providesSpeed) | |
90 { | |
91 } | |
92 | |
93 double m_timestamp; | |
94 | |
95 double m_latitude; | |
96 double m_longitude; | |
97 double m_accuracy; | |
98 double m_altitude; | |
99 double m_altitudeAccuracy; | |
100 double m_heading; | |
101 double m_speed; | |
102 | |
103 bool m_canProvideAltitude; | |
104 bool m_canProvideAltitudeAccuracy; | |
105 bool m_canProvideHeading; | |
106 bool m_canProvideSpeed; | |
107 }; | |
108 | |
109 } // namespace blink | |
110 | |
111 #endif // GeolocationPosition_h | |
OLD | NEW |