GAMS  1.4.0
gams::pose::SearchArea Class Reference

A utility class for search areas. More...

#include <SearchArea.h>

Inheritance diagram for gams::pose::SearchArea:
gams::utility::Containerize

Public Member Functions

 SearchArea ()
 Default constructor. More...
 
 SearchArea (const PrioritizedRegion &region, const std::string &name="")
 Constructor. More...
 
 SearchArea (const std::vector< PrioritizedRegion > &regions, const std::string &name="")
 Constructor. More...
 
 ~SearchArea ()
 Destructor. More...
 
void add_prioritized_region (const PrioritizedRegion &r)
 Add prioritized region to search area. More...
 
bool contains (const Position &p) const
 Determine if Position is in region. More...
 
bool from_container (const std::string &name="")
 Load object from knowledge base. More...
 
bool from_container (madara::knowledge::KnowledgeBase &kb, const std::string &name="")
 Load object from knowledge base. More...
 
Region get_convex_hull () const
 Find the convex hull. More...
 
std::string get_name () const
 Get name of the object. More...
 
madara::knowledge::KnowledgeRecord::Integer get_priority (const Position &pos) const
 Get priority of a gps position. More...
 
const std::vector< PrioritizedRegion > & get_regions () const
 Get region data. More...
 
void modify ()
 Resend the information in the container using same knowledge base as previous to_container. More...
 
bool operator!= (const SearchArea &rhs) const
 Inequality operator, uses Equality operator and inverses it. More...
 
void operator= (const SearchArea &rhs)
 Assignment operator. More...
 
bool operator== (const SearchArea &rhs) const
 Equality operator. More...
 
void set_knowledge_base (madara::knowledge::KnowledgeBase *kb)
 Set knowledge base to use. More...
 
void set_name (const std::string &n)
 Set name of the object. More...
 
void to_container (const std::string &name="")
 Store object in knowledge base used previously. More...
 
void to_container (madara::knowledge::KnowledgeBase &kb, const std::string &name="")
 Store object in knowledge base. More...
 
std::string to_string () const
 Create string representation of SearchArea. More...
 

Public Attributes

double max_alt_
 
double max_lat_
 
double max_lon_
 
double min_alt_
 
double min_lat_
 bounding box More...
 
double min_lon_
 

Protected Types

enum  Class_ID { REGION_TYPE_ID = 0x00000001 , PRIORITIZED_REGION_TYPE_ID = 0x00000002 , SEARCH_AREA_TYPE_ID = 0x00000004 , INVALID = 0x80000000 }
 These are used to check on the type of the object in from_container. More...
 

Protected Member Functions

void calculate_bounding_box ()
 populate bounding box values More...
 
double cross (const Position &gp1, const Position &gp2, const Position &gp3) const
 Helper function for convex hull calculations. More...
 
bool is_valid_type (madara::knowledge::KnowledgeBase &kb, const std::string &name, const Class_ID &expected) const
 Check if the type is correct. More...
 

Static Protected Member Functions

static Class_ID get_type (madara::knowledge::KnowledgeBase &kb, const std::string &name)
 Gets type of object in database. More...
 

Protected Attributes

std::string name_
 name of this object More...
 
madara::knowledge::KnowledgeBase * prev_kb_
 previous knowledge base used for sending objects More...
 
std::vector< PrioritizedRegionregions_
 collection of prioritized regions More...
 

Static Protected Attributes

static const std::string object_type_suffix_
 object type suffix More...
 

Private Member Functions

virtual bool check_valid_type (madara::knowledge::KnowledgeBase &kb, const std::string &name) const
 Check if object is of correct type. More...
 
virtual bool from_container_impl (madara::knowledge::KnowledgeBase &kb, const std::string &name)
 Load object from knowledge base. More...
 
virtual void to_container_impl (madara::knowledge::KnowledgeBase &kb, const std::string &name)
 Store object in knowledge base. More...
 

Detailed Description

A utility class for search areas.

Definition at line 71 of file SearchArea.h.

Member Enumeration Documentation

◆ Class_ID

enum gams::utility::Containerize::Class_ID
protectedinherited

These are used to check on the type of the object in from_container.

When inheriting from this class, add your new class to this list to check for your unique ID. Assign this value in the knowledge base to "prefix + object_type_suffix"

Enumerator
REGION_TYPE_ID 
PRIORITIZED_REGION_TYPE_ID 
SEARCH_AREA_TYPE_ID 
INVALID 

Definition at line 154 of file Containerize.h.

Constructor & Destructor Documentation

◆ SearchArea() [1/3]

gams::pose::SearchArea::SearchArea ( )

Default constructor.

◆ SearchArea() [2/3]

gams::pose::SearchArea::SearchArea ( const PrioritizedRegion region,
const std::string &  name = "" 
)

Constructor.

Parameters
regionthe initial region of the search area
namename for this search area

◆ SearchArea() [3/3]

gams::pose::SearchArea::SearchArea ( const std::vector< PrioritizedRegion > &  regions,
const std::string &  name = "" 
)

Constructor.

Parameters
regionsregions in this search area
namename for this search area

◆ ~SearchArea()

gams::pose::SearchArea::~SearchArea ( )

Destructor.

Member Function Documentation

◆ add_prioritized_region()

void gams::pose::SearchArea::add_prioritized_region ( const PrioritizedRegion r)

Add prioritized region to search area.

Parameters
rprioritized region to add

◆ calculate_bounding_box()

void gams::pose::SearchArea::calculate_bounding_box ( )
protected

populate bounding box values

◆ check_valid_type()

virtual bool gams::pose::SearchArea::check_valid_type ( madara::knowledge::KnowledgeBase &  kb,
const std::string &  name 
) const
privatevirtual

Check if object is of correct type.

Parameters
kbKnowledge Base with object
nameName of object in the KB

Implements gams::utility::Containerize.

◆ contains()

bool gams::pose::SearchArea::contains ( const Position p) const

Determine if Position is in region.

Parameters
ppoint to check if in region
Returns
true if point is in the search area, false otherwise

◆ cross()

double gams::pose::SearchArea::cross ( const Position gp1,
const Position gp2,
const Position gp3 
) const
protected

Helper function for convex hull calculations.

Parameters
gp1start point
gp2pivot point
gp3end point
Returns
cross product of the points

◆ from_container() [1/2]

bool gams::utility::Containerize::from_container ( const std::string &  name = "")
inherited

Load object from knowledge base.

Parameters
namelocation of object in Knowlege Base
Returns
true if object successfully loaded from knowledge base

◆ from_container() [2/2]

bool gams::utility::Containerize::from_container ( madara::knowledge::KnowledgeBase &  kb,
const std::string &  name = "" 
)
inherited

Load object from knowledge base.

Parameters
kbKnowledge Base with object
namelocation of object in Knowlege Base
Returns
true if object successfully loaded from knowledge base

◆ from_container_impl()

virtual bool gams::pose::SearchArea::from_container_impl ( madara::knowledge::KnowledgeBase &  kb,
const std::string &  name 
)
privatevirtual

Load object from knowledge base.

Parameters
kbKnowledge Base with object
namelocation of object in Knowlege Base

Implements gams::utility::Containerize.

◆ get_convex_hull()

Region gams::pose::SearchArea::get_convex_hull ( ) const

Find the convex hull.

Returns
Convex hull of the regions

◆ get_name()

std::string gams::utility::Containerize::get_name ( ) const
inherited

Get name of the object.

Returns
name of the object

◆ get_priority()

madara::knowledge::KnowledgeRecord::Integer gams::pose::SearchArea::get_priority ( const Position pos) const

Get priority of a gps position.

Parameters
posposition to get priority of
Returns
priority of position

◆ get_regions()

const std::vector<PrioritizedRegion>& gams::pose::SearchArea::get_regions ( ) const

Get region data.

Returns
const reference to regions

◆ get_type()

static Class_ID gams::utility::Containerize::get_type ( madara::knowledge::KnowledgeBase &  kb,
const std::string &  name 
)
staticprotectedinherited

Gets type of object in database.

Parameters
kbKnowledge Base with object
namePrefix of object in the KB
Returns
Class_ID of object in kb

◆ is_valid_type()

bool gams::utility::Containerize::is_valid_type ( madara::knowledge::KnowledgeBase &  kb,
const std::string &  name,
const Class_ID expected 
) const
protectedinherited

Check if the type is correct.

Parameters
kbKnowledge Base with object
namePrefix of object in the KB
expectedExpected value
Returns
true if correct type, false otherwise

◆ modify()

void gams::utility::Containerize::modify ( )
inherited

Resend the information in the container using same knowledge base as previous to_container.

◆ operator!=()

bool gams::pose::SearchArea::operator!= ( const SearchArea rhs) const

Inequality operator, uses Equality operator and inverses it.

Parameters
rhsSearchArea to compare against
Returns
false if SearchAreas have same PrioritizedRegion, true otherwise

◆ operator=()

void gams::pose::SearchArea::operator= ( const SearchArea rhs)

Assignment operator.

Parameters
rhsvalues to copy

◆ operator==()

bool gams::pose::SearchArea::operator== ( const SearchArea rhs) const

Equality operator.

Parameters
rhsSearchArea to compare against
Returns
true if SearchAreas have same PrioritizedRegion, false otherwise

◆ set_knowledge_base()

void gams::utility::Containerize::set_knowledge_base ( madara::knowledge::KnowledgeBase *  kb)
inherited

Set knowledge base to use.

◆ set_name()

void gams::utility::Containerize::set_name ( const std::string &  n)
inherited

Set name of the object.

Parameters
nnew name of the object

◆ to_container() [1/2]

void gams::utility::Containerize::to_container ( const std::string &  name = "")
inherited

Store object in knowledge base used previously.

Parameters
namelocation of object in Knowlege Base

◆ to_container() [2/2]

void gams::utility::Containerize::to_container ( madara::knowledge::KnowledgeBase &  kb,
const std::string &  name = "" 
)
inherited

Store object in knowledge base.

Parameters
kbKnowledge Base to store object in
namelocation of object in Knowlege Base

◆ to_container_impl()

virtual void gams::pose::SearchArea::to_container_impl ( madara::knowledge::KnowledgeBase &  kb,
const std::string &  name 
)
privatevirtual

Store object in knowledge base.

Parameters
kbKnowledge Base to store object in
namelocation of object in Knowlege Base

Implements gams::utility::Containerize.

◆ to_string()

std::string gams::pose::SearchArea::to_string ( ) const

Create string representation of SearchArea.

Returns
string representation of this object

Member Data Documentation

◆ max_alt_

double gams::pose::SearchArea::max_alt_

Definition at line 161 of file SearchArea.h.

◆ max_lat_

double gams::pose::SearchArea::max_lat_

Definition at line 159 of file SearchArea.h.

◆ max_lon_

double gams::pose::SearchArea::max_lon_

Definition at line 160 of file SearchArea.h.

◆ min_alt_

double gams::pose::SearchArea::min_alt_

Definition at line 161 of file SearchArea.h.

◆ min_lat_

double gams::pose::SearchArea::min_lat_

bounding box

Definition at line 159 of file SearchArea.h.

◆ min_lon_

double gams::pose::SearchArea::min_lon_

Definition at line 160 of file SearchArea.h.

◆ name_

std::string gams::utility::Containerize::name_
protectedinherited

name of this object

Definition at line 143 of file Containerize.h.

◆ object_type_suffix_

const std::string gams::utility::Containerize::object_type_suffix_
staticprotectedinherited

object type suffix

Definition at line 140 of file Containerize.h.

◆ prev_kb_

madara::knowledge::KnowledgeBase* gams::utility::Containerize::prev_kb_
protectedinherited

previous knowledge base used for sending objects

Definition at line 146 of file Containerize.h.

◆ regions_

std::vector<PrioritizedRegion> gams::pose::SearchArea::regions_
protected

collection of prioritized regions

Definition at line 180 of file SearchArea.h.


The documentation for this class was generated from the following file: