1 | /*
|
---|
2 | * Indoorhelper is a JOSM plug-in to support users when creating their own indoor maps.
|
---|
3 | * Copyright (C) 2016 Erik Gruschka
|
---|
4 | *
|
---|
5 | * This program is free software: you can redistribute it and/or modify
|
---|
6 | * it under the terms of the GNU General Public License as published by
|
---|
7 | * the Free Software Foundation, either version 3 of the License, or
|
---|
8 | * (at your option) any later version.
|
---|
9 | *
|
---|
10 | * This program is distributed in the hope that it will be useful,
|
---|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
13 | * GNU General Public License for more details.
|
---|
14 | *
|
---|
15 | * You should have received a copy of the GNU General Public License
|
---|
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>.
|
---|
17 | */
|
---|
18 |
|
---|
19 | package model;
|
---|
20 |
|
---|
21 | import org.openstreetmap.josm.data.osm.Tag;
|
---|
22 |
|
---|
23 | /**
|
---|
24 | *
|
---|
25 | * The class to save a level of the building.
|
---|
26 | *
|
---|
27 | * @author egru
|
---|
28 | *
|
---|
29 | */
|
---|
30 |
|
---|
31 | public class IndoorLevel {
|
---|
32 |
|
---|
33 | private Tag levelNumberTag;
|
---|
34 | private Tag nameTag;
|
---|
35 |
|
---|
36 | /**
|
---|
37 | * Constructor which adds the level number.
|
---|
38 | *
|
---|
39 | * @param levelNumber number of the level
|
---|
40 | */
|
---|
41 | public IndoorLevel(int levelNumber) {
|
---|
42 | this.setLevelNumber(levelNumber);
|
---|
43 | }
|
---|
44 |
|
---|
45 | /**
|
---|
46 | * Constructor which adds level number and name tag.
|
---|
47 | *
|
---|
48 | * @param levelNumber number of the level
|
---|
49 | * @param nameTag optional name tag for the level
|
---|
50 | */
|
---|
51 | public IndoorLevel(int levelNumber, String nameTag) {
|
---|
52 | this.setLevelNumber(levelNumber);
|
---|
53 | this.setNameTag(nameTag);
|
---|
54 | }
|
---|
55 |
|
---|
56 | /**
|
---|
57 | * Getter for the level tag
|
---|
58 | *
|
---|
59 | * @return the complete level number tag
|
---|
60 | */
|
---|
61 | public Tag getLevelNumberTag() {
|
---|
62 | return this.levelNumberTag;
|
---|
63 | }
|
---|
64 |
|
---|
65 | /**
|
---|
66 | * Function to get the level number
|
---|
67 | *
|
---|
68 | * @return level number as an Integer
|
---|
69 | */
|
---|
70 | public int getLevelNumber(){
|
---|
71 | return Integer.parseInt(this.levelNumberTag.getValue());
|
---|
72 | }
|
---|
73 |
|
---|
74 | /**
|
---|
75 | * Setter for the level number
|
---|
76 | *
|
---|
77 | * @param levelNumber number of the level
|
---|
78 | */
|
---|
79 | public void setLevelNumber(int levelNumber) {
|
---|
80 | this.levelNumberTag = new Tag("indoor:level", Integer.toString(levelNumber));
|
---|
81 | }
|
---|
82 |
|
---|
83 | /**
|
---|
84 | * Getter for the name tag
|
---|
85 | *
|
---|
86 | * @return the complete name tag
|
---|
87 | */
|
---|
88 | public Tag getNameTag() {
|
---|
89 | return this.nameTag;
|
---|
90 | }
|
---|
91 |
|
---|
92 | /**
|
---|
93 | * Function to get the optional name of the level.
|
---|
94 | *
|
---|
95 | * @return String with the optional name.
|
---|
96 | */
|
---|
97 | public String getName(){
|
---|
98 | return this.nameTag.getValue();
|
---|
99 | }
|
---|
100 |
|
---|
101 | /**
|
---|
102 | * Setter for the name tag
|
---|
103 | *
|
---|
104 | * @param nameTag String which optionally describes the level
|
---|
105 | */
|
---|
106 | public void setNameTag(String nameTag) {
|
---|
107 | this.nameTag = new Tag("indoor:level:name", nameTag);
|
---|
108 | }
|
---|
109 |
|
---|
110 | public boolean hasEmptyName(){
|
---|
111 | if(this.nameTag==null){
|
---|
112 | return true;
|
---|
113 | } else {
|
---|
114 | return false;
|
---|
115 | }
|
---|
116 | }
|
---|
117 |
|
---|
118 | }
|
---|