World Ocean Simulation System (WOSS) library
location-definitions.h
Go to the documentation of this file.
1/* WOSS - World Ocean Simulation System -
2 *
3 * Copyright (C) 2009 Federico Guerra
4 * and regents of the SIGNET lab, University of Padova
5 *
6 * Author: Federico Guerra - federico@guerra-tlc.com
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation;
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21
22/*
23 * This software has been developed by Federico Guerra and SIGNET lab,
24 * University of Padova, in collaboration with the NATO Centre for
25 * Maritime Research and Experimentation (http://www.cmre.nato.int ;
26 * E-mail: pao@cmre.nato.int), whose support is gratefully acknowledged.
27 */
28
29
40#ifndef LOCATION_DEFINITIONS_H
41#define LOCATION_DEFINITIONS_H
42
43
44#include <cmath>
46#include <iostream>
47
48
49namespace woss {
50
51
52 #define LOCATION_COMPARISON_DISTANCE (0.0)
53
54
60 class Location {
61
62
63 public:
64
65
71 Location( const CoordZ& coordz = CoordZ(), double dist = LOCATION_COMPARISON_DISTANCE );
72
80 Location( double latitude, double longitude, double depth = 0, double dist = LOCATION_COMPARISON_DISTANCE );
81
85 virtual ~Location() { }
86
95 virtual Location* create( double latitude, double longitude, double depth = 0, double dist = LOCATION_COMPARISON_DISTANCE ) const {
96 return new Location(latitude, longitude, depth, dist); }
97
104 virtual Location* create( const CoordZ& coordz = CoordZ(), double dist = LOCATION_COMPARISON_DISTANCE ) const {
105 return new Location(coordz,dist); }
106
111 virtual Location* clone() const { return new Location(*this); }
112
113
118 virtual bool isValid() const { return curr_coordz.isValid(); }
119
120
126 virtual bool isEquivalentTo( const woss::CoordZ& coordz );
127
128
133 virtual void setLocation( const CoordZ& coordz );
134
139 virtual void setLatitude( double lat );
140
145 virtual void setLongitude( double lon );
146
151 virtual void setDepth( double depth );
152
153
159 virtual void setVerticalOrientation( double angle );
160
166 virtual void setHorizontalOrientation( double angle );
167
168
173 virtual CoordZ getLocation();
174
179 virtual double getLatitude();
180
185 virtual double getLongitude();
186
191 virtual double getDepth();
192
193
198 virtual double getX();
199
204 virtual double getY();
205
210 virtual double getZ();
211
217 virtual double getVerticalOrientation();
218
224 virtual double getHorizontalOrientation();
225
230 virtual double getBearing();
231
232
239 friend ::std::ostream& operator<<( ::std::ostream& os, const Location& instance ) {
240 os << "Location, latitude = " << instance.curr_coordz.getLatitude() << "; longitude = " << instance.curr_coordz.getLongitude()
241 << "; depth = " << instance.curr_coordz.getDepth();
242 return os;
243 }
244
245
246 protected:
247
248
253
254
259
260
266
272
276 double bearing;
277
278
279 };
280
281
282}
283
284
285#endif /* LOCATION_DEFINITIONS_H */
286
3D-Coordinates (lat, long, depth) class definitions and functions library
Definition coordinates-definitions.h:403
virtual bool isValid() const
Definition coordinates-definitions.h:645
double getDepth() const
Definition coordinates-definitions.h:525
double getLatitude() const
Definition coordinates-definitions.h:175
double getLongitude() const
Definition coordinates-definitions.h:181
Class that stores the coordinates of moving entity.
Definition location-definitions.h:60
double bearing
Definition location-definitions.h:276
virtual void setVerticalOrientation(double angle)
Definition location-definitions.cpp:90
virtual void setLocation(const CoordZ &coordz)
Definition location-definitions.cpp:70
virtual Location * create(const CoordZ &coordz=CoordZ(), double dist=LOCATION_COMPARISON_DISTANCE) const
Definition location-definitions.h:104
virtual ~Location()
Definition location-definitions.h:85
virtual Location * create(double latitude, double longitude, double depth=0, double dist=LOCATION_COMPARISON_DISTANCE) const
Definition location-definitions.h:95
virtual double getLongitude()
Definition location-definitions.cpp:111
double comparison_distance
Definition location-definitions.h:252
virtual double getY()
Definition location-definitions.cpp:129
virtual double getVerticalOrientation()
Definition location-definitions.cpp:141
virtual double getLatitude()
Definition location-definitions.cpp:105
virtual void setLatitude(double lat)
Definition location-definitions.cpp:75
virtual void setHorizontalOrientation(double angle)
Definition location-definitions.cpp:95
virtual double getX()
Definition location-definitions.cpp:123
virtual double getZ()
Definition location-definitions.cpp:135
friend::std::ostream & operator<<(::std::ostream &os, const Location &instance)
Definition location-definitions.h:239
virtual bool isValid() const
Definition location-definitions.h:118
virtual void setLongitude(double lon)
Definition location-definitions.cpp:80
virtual double getHorizontalOrientation()
Definition location-definitions.cpp:146
virtual CoordZ getLocation()
Definition location-definitions.cpp:100
virtual double getBearing()
Definition location-definitions.cpp:151
double vertical_orientation
Definition location-definitions.h:265
virtual double getDepth()
Definition location-definitions.cpp:117
virtual bool isEquivalentTo(const woss::CoordZ &coordz)
Definition location-definitions.cpp:63
double horizontal_orientation
Definition location-definitions.h:271
virtual void setDepth(double depth)
Definition location-definitions.cpp:85
virtual Location * clone() const
Definition location-definitions.h:111
CoordZ curr_coordz
Definition location-definitions.h:258
Provides the interface for the woss::Coord and woss::CoordZ classes.