A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
building.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Marco Miozzo <marco.miozzo@cttc.es>
18 *
19 */
20#ifndef BUILDING_H
21#define BUILDING_H
22
23#include <ns3/attribute-helper.h>
24#include <ns3/attribute.h>
25#include <ns3/box.h>
26#include <ns3/object.h>
27#include <ns3/simple-ref-count.h>
28#include <ns3/vector.h>
29
30namespace ns3
31{
32
33/**
34 * \defgroup buildings Buildings
35 *
36 * The models to define 3d buildings, associated channel models, and mobility.
37 */
38
39/**
40 * \ingroup buildings
41 * \brief a 3d building block
42 */
43class Building : public Object
44{
45 public:
46 /**
47 * \brief Get the type ID.
48 * \return The object TypeId.
49 */
50 static TypeId GetTypeId();
51 void DoDispose() override;
52
53 /**
54 * Building type enum
55 */
57 {
61 };
62
63 /**
64 * External building wall type enum
65 */
67 {
72 };
73
74 /**
75 * Construct a simple building with 1 room and 1 floor
76 *
77 * \param xMin x coordinates of left boundary.
78 * \param xMax x coordinates of right boundary.
79 * \param yMin y coordinates of bottom boundary.
80 * \param yMax y coordinates of top boundary.
81 * \param zMin z coordinates of down boundary.
82 * \param zMax z coordinates of up boundary.
83 *
84 */
85 Building(double xMin, double xMax, double yMin, double yMax, double zMin, double zMax);
86
87 /**
88 * Create a zero-sized building located at coordinates (0.0,0.0,0.0)
89 * and with 1 floors and 1 room.
90 */
91 Building();
92
93 /**
94 * Destructor
95 *
96 */
97 ~Building() override;
98
99 /**
100 * \return the unique id of this Building. This unique id happens to
101 * be also the index of the Building into the BuildingList.
102 */
103 uint32_t GetId() const;
104
105 /**
106 * Set the boundaries of the building
107 *
108 * \param box the Box defining the boundaries of the building
109 */
110 void SetBoundaries(Box box);
111
112 /**
113 * \param t the type of building (i.e., Residential, Office, Commercial)
114 *
115 * This method allows to set building type (default is Residential)
116 */
118
119 /**
120 * \param t the type of external walls (i.e., Wood, ConcreteWithWindows,
121 * ConcreteWithoutWindows and StoneBlocks), used for evaluating the loss
122 * due to the penetration of external walls in outdoor <-> indoor comm.
123 *
124 * This method allows to set external walls type (default is Residential)
125 */
127
128 /**
129 * \param nfloors the number of floors in the building
130 *
131 * This method allows to set the number of floors in the building
132 * (default is 1)
133 */
134 void SetNFloors(uint16_t nfloors);
135
136 /**
137 * \param nroomx the number of rooms along the x axis
138 *
139 * This method allows to set the number of rooms along the x-axis
140 */
141 void SetNRoomsX(uint16_t nroomx);
142
143 /**
144 * \param nroomy the number of floors in the building
145 *
146 * This method allows to set the number of rooms along the y-axis
147 */
148 void SetNRoomsY(uint16_t nroomy);
149
150 /**
151 *
152 * \return the boundaries of the building
153 */
154 Box GetBoundaries() const;
155
156 /**
157 * \return the type of building
158 */
160
161 /**
162 * \return the type of external walls of the building
163 */
165
166 /**
167 * \return the number of floors of the building
168 */
169 uint16_t GetNFloors() const;
170
171 /**
172 * \return the number of rooms along the x-axis of the building
173 */
174 uint16_t GetNRoomsX() const;
175
176 /**
177 * \return the number of rooms along the y-axis
178 */
179 uint16_t GetNRoomsY() const;
180
181 /**
182 *
183 *
184 * \param position some position
185 *
186 * \return true if the position fall inside the building, false otherwise
187 */
188 bool IsInside(Vector position) const;
189
190 /**
191 *
192 *
193 * \param position a position inside the building
194 *
195 * \return the number of the room along the X axis where the
196 * position falls
197 */
198 uint16_t GetRoomX(Vector position) const;
199
200 /**
201 *
202 *
203 * \param position a position inside the building
204 *
205 * \return the number of the room along the Y axis where the
206 * position falls
207 */
208 uint16_t GetRoomY(Vector position) const;
209
210 /**
211 *
212 * \param position a position inside the building
213 *
214 * \return the floor where the position falls
215 */
216 uint16_t GetFloor(Vector position) const;
217 /**
218 * \brief Checks if a line-segment between position l1 and position l2
219 * intersects a building.
220 *
221 * \param l1 position
222 * \param l2 position
223 * \return true if there is a intersection, false otherwise
224 */
225 bool IsIntersect(const Vector& l1, const Vector& l2) const;
226
227 private:
228 Box m_buildingBounds; //!< Building boundaries
229
230 /**
231 * number of floors, must be greater than 0, and 1 means only one floor
232 * (i.e., groundfloor)
233 */
234 uint16_t m_floors;
235 uint16_t m_roomsX; //!< X Room coordinate
236 uint16_t m_roomsY; //!< Y Room coordinate
237
238 uint32_t m_buildingId; //!< Building ID number
239 BuildingType_t m_buildingType; //!< Building type
240 ExtWallsType_t m_externalWalls; //!< External building wall type
241};
242
243} // namespace ns3
244
245#endif /* BUILDING_H */
a 3d box
Definition: box.h:35
a 3d building block
Definition: building.h:44
Building()
Create a zero-sized building located at coordinates (0.0,0.0,0.0) and with 1 floors and 1 room.
Definition: building.cc:118
uint32_t GetId() const
Definition: building.cc:136
uint16_t GetNRoomsY() const
Definition: building.cc:216
uint32_t m_buildingId
Building ID number.
Definition: building.h:238
BuildingType_t m_buildingType
Building type.
Definition: building.h:239
ExtWallsType_t GetExtWallsType() const
Definition: building.cc:198
ExtWallsType_t
External building wall type enum.
Definition: building.h:67
@ ConcreteWithWindows
Definition: building.h:69
@ ConcreteWithoutWindows
Definition: building.h:70
ExtWallsType_t m_externalWalls
External building wall type.
Definition: building.h:240
void SetBuildingType(Building::BuildingType_t t)
Definition: building.cc:150
uint16_t GetNFloors() const
Definition: building.cc:204
void SetBoundaries(Box box)
Set the boundaries of the building.
Definition: building.cc:143
BuildingType_t GetBuildingType() const
Definition: building.cc:192
void SetNRoomsX(uint16_t nroomx)
Definition: building.cc:171
bool IsIntersect(const Vector &l1, const Vector &l2) const
Checks if a line-segment between position l1 and position l2 intersects a building.
Definition: building.cc:291
uint16_t GetRoomY(Vector position) const
Definition: building.cc:249
void SetExtWallsType(Building::ExtWallsType_t t)
Definition: building.cc:157
uint16_t m_floors
number of floors, must be greater than 0, and 1 means only one floor (i.e., groundfloor)
Definition: building.h:234
void DoDispose() override
Destructor implementation.
Definition: building.cc:130
void SetNRoomsY(uint16_t nroomy)
Definition: building.cc:178
Box GetBoundaries() const
Definition: building.cc:185
uint16_t m_roomsX
X Room coordinate.
Definition: building.h:235
~Building() override
Destructor.
Definition: building.cc:124
uint16_t GetFloor(Vector position) const
Definition: building.cc:270
uint16_t GetNRoomsX() const
Definition: building.cc:210
uint16_t m_roomsY
Y Room coordinate.
Definition: building.h:236
bool IsInside(Vector position) const
Definition: building.cc:222
void SetNFloors(uint16_t nfloors)
Definition: building.cc:164
Box m_buildingBounds
Building boundaries.
Definition: building.h:228
uint16_t GetRoomX(Vector position) const
Definition: building.cc:228
BuildingType_t
Building type enum.
Definition: building.h:57
static TypeId GetTypeId()
Get the type ID.
Definition: building.cc:41
A base class which provides memory management and object aggregation.
Definition: object.h:89
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.