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
14 package org.openhab.binding.nanoleaf.internal.layout;
16 import org.eclipse.jdt.annotation.NonNullByDefault;
19 * Information about the different Nanoleaf shapes.
21 * @author Jørgen Austvik - Initial contribution
24 public enum ShapeType {
25 // side lengths are taken from https://forum.nanoleaf.me/docs chapter 3.3
26 UNKNOWN("Unknown", -1, 0, 0, 1, DrawingAlgorithm.NONE),
27 TRIANGLE("Triangle", 0, 150, 3, 1, DrawingAlgorithm.TRIANGLE),
28 RHYTHM("Rhythm", 1, 0, 1, 1, DrawingAlgorithm.NONE),
29 SQUARE("Square", 2, 100, 0, 1, DrawingAlgorithm.SQUARE),
30 CONTROL_SQUARE_MASTER("Control Square Master", 3, 100, 0, 1, DrawingAlgorithm.SQUARE),
31 CONTROL_SQUARE_PASSIVE("Control Square Passive", 4, 100, 0, 1, DrawingAlgorithm.SQUARE),
32 SHAPES_HEXAGON("Hexagon (Shapes)", 7, 67, 6, 1, DrawingAlgorithm.HEXAGON),
33 SHAPES_TRIANGLE("Triangle (Shapes)", 8, 134, 3, 1, DrawingAlgorithm.TRIANGLE),
34 SHAPES_MINI_TRIANGLE("Mini Triangle (Shapes)", 9, 67, 3, 1, DrawingAlgorithm.TRIANGLE),
35 SHAPES_CONTROLLER("Controller (Shapes)", 12, 0, 0, 1, DrawingAlgorithm.NONE),
36 ELEMENTS_HEXAGON("Elements Hexagon", 14, 134, 6, 1, DrawingAlgorithm.HEXAGON),
37 ELEMENTS_HEXAGON_CORNER("Elements Hexagon - Corner", 15, 58, 6, 6, DrawingAlgorithm.CORNER),
38 LINES_CONNECTOR("Lines Connector", 16, 11, 1, 1, DrawingAlgorithm.NONE),
39 LIGHT_LINES("Light Lines", 17, 154, 1, 1, DrawingAlgorithm.LINE),
40 LINES_LINES_SINGLE("Light Lines - Single Sone", 18, 77, 2, 2, DrawingAlgorithm.LINE),
41 CONTROLLER_CAP("Controller Cap", 19, 11, 0, 1, DrawingAlgorithm.NONE),
42 POWER_CONNECTOR("Power Connector", 20, 11, 0, 1, DrawingAlgorithm.NONE);
44 private final String name;
46 private final int sideLength;
47 private final int numSides;
48 private final int numLights;
49 private final DrawingAlgorithm drawingAlgorithm;
51 ShapeType(String name, int id, int sideLenght, int numSides, int numLights, DrawingAlgorithm drawingAlgorithm) {
54 this.sideLength = sideLenght;
55 this.numSides = numSides;
56 this.numLights = numLights;
57 this.drawingAlgorithm = drawingAlgorithm;
60 public String getName() {
68 public int getSideLength() {
72 public int getNumSides() {
76 public int getNumLightsPerShape() {
80 public DrawingAlgorithm getDrawingAlgorithm() {
81 return drawingAlgorithm;
84 public static ShapeType valueOf(int id) {
85 for (ShapeType shapeType : values()) {
86 if (shapeType.getId() == id) {
91 return ShapeType.UNKNOWN;