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

- File List
- File Members

# src/sim/Sector.h

Go to the documentation of this file.

    00001 #ifndef SECTOR_H_
    00002 #define SECTOR_H_
    00003
    00004 #include <iostream>
    00005 #include <string>
    00006
    00007 #include "../config.h"
    00008 #include <ode/ode.h>
    00009 #include "../typedefs.h"
    00010 #include "../iface/Visualized.h"
    00011
    00012 class ConfigurationParser;
    00013 class Car;
    00014
    00015 class Sector: public Visualized {
    00016 public:
    00021     enum SectorType {LANE, JUNCTION};
    00022
    00023     Sector(int id);
    00024     virtual ~Sector();
    00025
    00027     int getID() const { return _id; };
    00029     dReal getMaxSpeed() const { return _maxSpeed; };
    00031     SectorType getType() const { return _type; };
    00033     void visualize();
    00035     bool hasCarSink() const { return _hasCarSink; };
    00037     bool hasEntrySector(Sector* sector) const;
    00039     bool hasExitSector(Sector* sector) const;
    00041     bool hasParallelSector(Sector* sector) const;
    00043     SectorVector &getEntrySectors() { return _entrySectors; };
    00045     SectorVector &getExitSectors() { return _exitSectors; };
    00047     SectorVector &getParallelSectors() { return _parallelSectors; };
    00049     Line getTransitLine(Sector* s);
    00051     PolygonVector &getPolygons() { return _polygons; };
    00053     void registerCar(Car* car);
    00055     void deregisterCar(Car* car);
    00057     void addCarEventListener(Car* car);
    00059     void removeCarEventListener(Car* car);
    00061     bool hasCarEventListener(Car* car) const;
    00063     CarVector &getCars() { return _cars; };
    00065     unsigned getNumOfCars() const { return _cars.size(); };
    00069     bool circularize();
    00071     bool containsPoint(const Vector3r &point) const;
    00073     std::string describeLinks() const;
    00075     std::string toString() const;
    00076
    00077 private:
    00079     int _id;
    00081     dReal _maxSpeed;
    00083     SectorType _type;
    00085     bool _hasCarSink;
    00087     PolygonVector _polygons;
    00089     SectorVector _entrySectors;
    00091     SectorVector _exitSectors;
    00093     SectorVector _parallelSectors;
    00095     SectorPolygonMapping _s2pmapping;
    00096
    00098     CarVector _cars;
    00100     CarVector _carEventListeners;
    00101
    00102     friend class ConfigurationParser;
    00103     friend std::ostream& operator<<(std::ostream& os, const Sector* s);
    00104 };
    00105
    00106 #endif /*SECTOR_H_*/