]> git.basschouten.com Git - openhab-addons.git/blob
f778540968aae54e1a7b18feb2351b706e59b9bc
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
7  * This program and the accompanying materials are made available under the
8  * terms of the Eclipse Public License 2.0 which is available at
9  * http://www.eclipse.org/legal/epl-2.0
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.astro.internal.model;
14
15 import javax.measure.quantity.Angle;
16
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.openhab.core.library.types.QuantityType;
19 import org.openhab.core.library.unit.Units;
20
21 /**
22  * Holds the calculated azimuth and elevation.
23  *
24  * @author Gerhard Riegler - Initial contribution
25  * @author GaĆ«l L'hopital - Added shade length
26  * @author Christoph Weitkamp - Introduced UoM
27  */
28 @NonNullByDefault
29 public class Position {
30
31     private double azimuth;
32     private double elevation;
33     private double shadeLength;
34
35     public Position() {
36     }
37
38     public Position(double azimuth, double elevation, double shadeLength) {
39         this.azimuth = azimuth;
40         this.elevation = elevation;
41         this.shadeLength = shadeLength;
42     }
43
44     /**
45      * Returns the azimuth.
46      */
47     public QuantityType<Angle> getAzimuth() {
48         return new QuantityType<>(azimuth, Units.DEGREE_ANGLE);
49     }
50
51     /**
52      * Sets the azimuth.
53      */
54     public void setAzimuth(double azimuth) {
55         this.azimuth = azimuth;
56     }
57
58     /**
59      * Returns the elevation.
60      */
61     public QuantityType<Angle> getElevation() {
62         return new QuantityType<>(elevation, Units.DEGREE_ANGLE);
63     }
64
65     public double getElevationAsDouble() {
66         return elevation;
67     }
68
69     /**
70      * Sets the elevation.
71      */
72     public void setElevation(double elevation) {
73         this.elevation = elevation;
74     }
75
76     /**
77      * Returns the shade length.
78      */
79     public double getShadeLength() {
80         return shadeLength;
81     }
82
83     /**
84      * Sets the shade length.
85      */
86     public void setShadeLength(double shadeLength) {
87         this.shadeLength = shadeLength;
88     }
89 }