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. ``AS IS'' AND ANY 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 */ 25 26 #ifndef Coordinates_h 27 #define Coordinates_h 28 29 #include "Event.h" 30 #include "PlatformString.h" 31 #include <wtf/RefCounted.h> 32 33 namespace WebCore { 34 35 typedef int ExceptionCode; 36 37 class Coordinates : public RefCounted<Coordinates> { 38 public: create(double latitude,double longitude,bool providesAltitude,double altitude,double accuracy,bool providesAltitudeAccuracy,double altitudeAccuracy,bool providesHeading,double heading,bool providesSpeed,double speed)39 static PassRefPtr<Coordinates> create(double latitude, double longitude, bool providesAltitude, double altitude, double accuracy, bool providesAltitudeAccuracy, double altitudeAccuracy, bool providesHeading, double heading, bool providesSpeed, double speed) { return adoptRef(new Coordinates(latitude, longitude, providesAltitude, altitude, accuracy, providesAltitudeAccuracy, altitudeAccuracy, providesHeading, heading, providesSpeed, speed)); } 40 latitude()41 double latitude() const { return m_latitude; } longitude()42 double longitude() const { return m_longitude; } altitude()43 double altitude() const { return m_altitude; } accuracy()44 double accuracy() const { return m_accuracy; } altitudeAccuracy()45 double altitudeAccuracy() const { return m_altitudeAccuracy; } heading()46 double heading() const { return m_heading; } speed()47 double speed() const { return m_speed; } 48 canProvideAltitude()49 bool canProvideAltitude() const { return m_canProvideAltitude; } canProvideAltitudeAccuracy()50 bool canProvideAltitudeAccuracy() const { return m_canProvideAltitudeAccuracy; } canProvideHeading()51 bool canProvideHeading() const { return m_canProvideHeading; } canProvideSpeed()52 bool canProvideSpeed() const { return m_canProvideSpeed; } 53 54 private: Coordinates(double latitude,double longitude,bool providesAltitude,double altitude,double accuracy,bool providesAltitudeAccuracy,double altitudeAccuracy,bool providesHeading,double heading,bool providesSpeed,double speed)55 Coordinates(double latitude, double longitude, bool providesAltitude, double altitude, double accuracy, bool providesAltitudeAccuracy, double altitudeAccuracy, bool providesHeading, double heading, bool providesSpeed, double speed) 56 : m_latitude(latitude) 57 , m_longitude(longitude) 58 , m_altitude(altitude) 59 , m_accuracy(accuracy) 60 , m_altitudeAccuracy(altitudeAccuracy) 61 , m_heading(heading) 62 , m_speed(speed) 63 , m_canProvideAltitude(providesAltitude) 64 , m_canProvideAltitudeAccuracy(providesAltitudeAccuracy) 65 , m_canProvideHeading(providesHeading) 66 , m_canProvideSpeed(providesSpeed) 67 { 68 } 69 70 double m_latitude; 71 double m_longitude; 72 double m_altitude; 73 double m_accuracy; 74 double m_altitudeAccuracy; 75 double m_heading; 76 double m_speed; 77 78 bool m_canProvideAltitude; 79 bool m_canProvideAltitudeAccuracy; 80 bool m_canProvideHeading; 81 bool m_canProvideSpeed; 82 }; 83 84 } // namespace WebCore 85 86 #endif // Coordinates_h 87