2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
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
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.astro.internal.model;
15 import javax.measure.quantity.Angle;
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.openhab.core.library.types.QuantityType;
19 import org.openhab.core.library.unit.Units;
22 * Holds the calculated azimuth and elevation.
24 * @author Gerhard Riegler - Initial contribution
25 * @author Gaƫl L'hopital - Added shade length
26 * @author Christoph Weitkamp - Introduced UoM
29 public class Position {
31 private double azimuth;
32 private double elevation;
33 private double shadeLength;
38 public Position(double azimuth, double elevation, double shadeLength) {
39 this.azimuth = azimuth;
40 this.elevation = elevation;
41 this.shadeLength = shadeLength;
45 * Returns the azimuth.
47 public QuantityType<Angle> getAzimuth() {
48 return new QuantityType<>(azimuth, Units.DEGREE_ANGLE);
54 public void setAzimuth(double azimuth) {
55 this.azimuth = azimuth;
59 * Returns the elevation.
61 public QuantityType<Angle> getElevation() {
62 return new QuantityType<>(elevation, Units.DEGREE_ANGLE);
65 public double getElevationAsDouble() {
72 public void setElevation(double elevation) {
73 this.elevation = elevation;
77 * Returns the shade length.
79 public double getShadeLength() {
84 * Sets the shade length.
86 public void setShadeLength(double shadeLength) {
87 this.shadeLength = shadeLength;