2 * Copyright (c) 2010-2020 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.openhab.core.library.types.QuantityType;
18 import org.openhab.core.library.unit.Units;
21 * Holds the calculated azimuth and elevation.
23 * @author Gerhard Riegler - Initial contribution
24 * @author Gaƫl L'hopital - Added shade length
25 * @author Christoph Weitkamp - Introduced UoM
27 public class Position {
29 private double azimuth;
30 private double elevation;
31 private double shadeLength;
36 public Position(double azimuth, double elevation, double shadeLength) {
37 this.azimuth = azimuth;
38 this.elevation = elevation;
39 this.shadeLength = shadeLength;
43 * Returns the azimuth.
45 public QuantityType<Angle> getAzimuth() {
46 return new QuantityType<>(azimuth, Units.DEGREE_ANGLE);
52 public void setAzimuth(double azimuth) {
53 this.azimuth = azimuth;
57 * Returns the elevation.
59 public QuantityType<Angle> getElevation() {
60 return new QuantityType<>(elevation, Units.DEGREE_ANGLE);
63 public double getElevationAsDouble() {
70 public void setElevation(double elevation) {
71 this.elevation = elevation;
75 * Returns the shade length.
77 public double getShadeLength() {
82 * Sets the shade length.
84 public void setShadeLength(double shadeLength) {
85 this.shadeLength = shadeLength;