]> git.basschouten.com Git - openhab-addons.git/blob
be2d6fcd5c24861367d9b986283cca7bc0c52ddd
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2021 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.openhab.core.library.types.QuantityType;
18 import org.openhab.core.library.unit.Units;
19
20 /**
21  * Holds the calculated azimuth and elevation.
22  *
23  * @author Gerhard Riegler - Initial contribution
24  * @author GaĆ«l L'hopital - Added shade length
25  * @author Christoph Weitkamp - Introduced UoM
26  */
27 public class Position {
28
29     private double azimuth;
30     private double elevation;
31     private double shadeLength;
32
33     public Position() {
34     }
35
36     public Position(double azimuth, double elevation, double shadeLength) {
37         this.azimuth = azimuth;
38         this.elevation = elevation;
39         this.shadeLength = shadeLength;
40     }
41
42     /**
43      * Returns the azimuth.
44      */
45     public QuantityType<Angle> getAzimuth() {
46         return new QuantityType<>(azimuth, Units.DEGREE_ANGLE);
47     }
48
49     /**
50      * Sets the azimuth.
51      */
52     public void setAzimuth(double azimuth) {
53         this.azimuth = azimuth;
54     }
55
56     /**
57      * Returns the elevation.
58      */
59     public QuantityType<Angle> getElevation() {
60         return new QuantityType<>(elevation, Units.DEGREE_ANGLE);
61     }
62
63     public double getElevationAsDouble() {
64         return elevation;
65     }
66
67     /**
68      * Sets the elevation.
69      */
70     public void setElevation(double elevation) {
71         this.elevation = elevation;
72     }
73
74     /**
75      * Returns the shade length.
76      */
77     public double getShadeLength() {
78         return shadeLength;
79     }
80
81     /**
82      * Sets the shade length.
83      */
84     public void setShadeLength(double shadeLength) {
85         this.shadeLength = shadeLength;
86     }
87 }