- Main Page
- Modules
- Classes
- Files
- Related Pages

- Class List
- Class Hierarchy
- Class Members

# Sector Class Reference

`#include <Sector.h>`

Inheritance diagram for Sector:

List of all members.

## Public Types
| LANE
| JUNCTION
enum | SectorType { LANE, JUNCTION }
## Public Member Functions
| Sector (int id)
virtual | ~Sector ()
int | getID () const
dReal | getMaxSpeed () const
SectorType | getType () const
void | visualize ()
bool | hasCarSink () const
bool | hasEntrySector (Sector *sector) const
bool | hasExitSector (Sector *sector) const
bool | hasParallelSector (Sector *sector) const
SectorVector & | getEntrySectors ()
SectorVector & | getExitSectors ()
SectorVector & | getParallelSectors ()
Line | getTransitLine (Sector *s)
PolygonVector & | getPolygons ()
void | registerCar (Car *car)
void | deregisterCar (Car *car)
void | addCarEventListener (Car *car)
void | removeCarEventListener (Car *car)
bool | hasCarEventListener (Car *car) const
CarVector & | getCars ()
unsigned | getNumOfCars () const
bool | circularize ()
bool | containsPoint (const Vector3r &point) const
std::string | describeLinks () const
std::string | toString () const
## Private Attributes
int | _id
dReal | _maxSpeed
SectorType | _type
bool | _hasCarSink
PolygonVector | _polygons
SectorVector | _entrySectors
SectorVector | _exitSectors
SectorVector | _parallelSectors
SectorPolygonMapping | _s2pmapping
CarVector | _cars
CarVector | _carEventListeners
## Friends
class | ConfigurationParser
std::ostream & | operator<< (std::ostream &os, const Sector *s)

## Member Enumeration Documentation

enum Sector::SectorType

Types of sectors LANE - simple 1-way lane JUNCTION - any kind of junction

Enumerator:

  LANE |
  JUNCTION |

## Constructor & Destructor Documentation

Sector::Sector | ( | int | id | ) |

Sector::~Sector | ( |  | ) | `[virtual]`

## Member Function Documentation

void Sector::addCarEventListener | ( | Car * | car | ) |

Adds new listener for car events happening on the sector

bool Sector::circularize | ( |  | ) |

Reorders the polygons to create a circle and checks for consistency

Returns:
  false if consistency check failed (sector cannot be reordered as a circle), otherwise true

bool Sector::containsPoint | ( | const Vector3r & | point | ) | const

Finds if given point lies inside or outside the sector

void Sector::deregisterCar | ( | Car * | car | ) |

Deregisters car from the current sector

std::string Sector::describeLinks | ( |  | ) | const

Returns links of the sector to other sectors (entry, exit, parallel)

CarVector& Sector::getCars | ( |  | ) | `[inline]`

Gives the list of cars currently associated with this sector

SectorVector& Sector::getEntrySectors | ( |  | ) | `[inline]`

Gives the list of adjacent vectors from which the car can enter the sector

SectorVector& Sector::getExitSectors | ( |  | ) | `[inline]`

Gives the list of adjacent vectors to which the car can drive over to

int Sector::getID | ( |  | ) | const`[inline]`

Gives the ID of the sector

dReal Sector::getMaxSpeed | ( |  | ) | const`[inline]`

Gives the maximum speed allowed in the sector

unsigned Sector::getNumOfCars | ( |  | ) | const`[inline]`

Gives the number of cars currently associated with this sector

SectorVector& Sector::getParallelSectors | ( |  | ) | `[inline]`

Gives the list of adjacent vectors to which the car can change lane to

PolygonVector& Sector::getPolygons | ( |  | ) | `[inline]`

Gives the list of sector borders

Line Sector::getTransitLine | ( | Sector * | s | ) |

Gives the transit polygon for the argument sector (NULL if not transit sector)

SectorType Sector::getType | ( |  | ) | const`[inline]`

Gives the type of the sector

bool Sector::hasCarEventListener | ( | Car * | car | ) | const

True if car has registered a listener with this sector

bool Sector::hasCarSink | ( |  | ) | const`[inline]`

True if the sector is watched by a CarSink

bool Sector::hasEntrySector | ( | Sector * | sector | ) | const

True if the argument sector leads to the sector

bool Sector::hasExitSector | ( | Sector * | sector | ) | const

True if the argument sector can be entered from the sector

bool Sector::hasParallelSector | ( | Sector * | sector | ) | const

True if the argument sector is parallel the sector

void Sector::registerCar | ( | Car * | car | ) |

Registers a new car among those on the current sector

void Sector::removeCarEventListener | ( | Car * | car | ) |

Removes listener for car events

std::string Sector::toString | ( |  | ) | const

Returns string representation of the sector

void Sector::visualize | ( |  | ) | `[virtual]`

Visualizes the sector

Implements Visualized.

## Friends And Related Function Documentation

friend class ConfigurationParser`[friend]`

std::ostream& operator<< | ( | std::ostream & | os,
|  | const Sector * | s |
| ) |  |  | `[friend]`

## Member Data Documentation

CarVector Sector::_carEventListeners`[private]`

Vector of cars currently listening to car events on the sector

CarVector Sector::_cars`[private]`

Vector of cars currently located within the range of the sector

SectorVector Sector::_entrySectors`[private]`

List of adjacent vectors from which the car can enter the sector

SectorVector Sector::_exitSectors`[private]`

List of adjacent vectors to which the car can drive over to

bool Sector::_hasCarSink`[private]`

If the sector has a CarSink attached

int Sector::_id`[private]`

Sector ID

dReal Sector::_maxSpeed`[private]`

Maximum speed allowed in the sector

SectorVector Sector::_parallelSectors`[private]`

List of adjacent vectors to which the car can change lane to

PolygonVector Sector::_polygons`[private]`

The borders of the sector

SectorPolygonMapping Sector::_s2pmapping`[private]`

Mapping table of polygons to sectors

SectorType Sector::_type`[private]`

The type of the sector

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

- src/sim/Sector.h
- src/sim/Sector.cpp