1 /*
2 * Copyright (c) 2002-2025 Gargoyle Software Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 * https://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15 package org.htmlunit.javascript.host.geo;
16
17 import org.htmlunit.javascript.HtmlUnitScriptable;
18 import org.htmlunit.javascript.JavaScriptEngine;
19 import org.htmlunit.javascript.configuration.JsxClass;
20 import org.htmlunit.javascript.configuration.JsxConstructor;
21 import org.htmlunit.javascript.configuration.JsxGetter;
22
23 /**
24 * A JavaScript object for GeolocationCoordinates.
25 *
26 * @author Ahmed Ashour
27 * @author Ronald Brill
28 */
29 @JsxClass
30 public class GeolocationCoordinates extends HtmlUnitScriptable {
31
32 private double latitude_;
33 private double longitude_;
34 private double accuracy_;
35
36 /**
37 * Creates an instance.
38 */
39 public GeolocationCoordinates() {
40 super();
41 }
42
43 GeolocationCoordinates(final double latitude, final double longitude, final double accuracy) {
44 super();
45 latitude_ = latitude;
46 longitude_ = longitude;
47 accuracy_ = accuracy;
48 }
49
50 /**
51 * Creates an instance.
52 */
53 @JsxConstructor
54 public void jsConstructor() {
55 throw JavaScriptEngine.typeErrorIllegalConstructor();
56 }
57
58 /**
59 * Returns the latitude.
60 * @return the latitude
61 */
62 @JsxGetter
63 public double getLatitude() {
64 return latitude_;
65 }
66
67 /**
68 * Returns the longitude.
69 * @return the longitude
70 */
71 @JsxGetter
72 public double getLongitude() {
73 return longitude_;
74 }
75
76 /**
77 * Returns the accuracy.
78 * @return the accuracy
79 */
80 @JsxGetter
81 public double getAccuracy() {
82 return accuracy_;
83 }
84
85 }