5 #include "Coordinates.h" 7 enum State{is_undefined= -1, is_usable, is_unusable, is_road, is_in_out, max_state};
36 Field(
unsigned width,
unsigned height);
98 { parcels[coords.
row][coords.
col]= is_road; }
105 { parcels[row][col]= is_road; }
113 void addRoads(std::list<Coordinates>* roads,
unsigned serveDistance);
120 void removeRoads(std::list<Coordinates>* roads,
unsigned serveDistance);
222 std::ostream&
print(std::ostream& out)
const;
231 {
return field.
print(out); }
270 inline bool isRoad(
const Coordinates& neighbour)
const;
276 inline bool isParcel(
const Coordinates &neighbour)
const;
282 inline bool isUnusableParcel(
const Coordinates &neighbour)
const;
290 bool isRoadAndNeighbourOf(
const Coordinates& neighbour,
const Coordinates& coord,
unsigned servingDistance)
const;
309 std::list<Coordinates> *getClose(
const Coordinates &coord,
unsigned maxDist,
bool (
Field::*neighbourVerif)(
const Coordinates &)
const)
const;
int row
Definition: Coordinates.h:24
unsigned nb_rows
nb_rows Nombre de lignes de la surface
Definition: field.h:23
unsigned get_height() const
Definition: field.h:55
void set_width(unsigned width)
Definition: field.h:75
std::list< Coordinates > * getServingRoads(const Coordinates &coord, unsigned servingDistance) const
Definition: field.cpp:338
bool hasServingRoad(const Coordinates &coord, unsigned servingDistance) const
Definition: field.cpp:375
Field(unsigned width, unsigned height)
Definition: field.cpp:10
std::list< Coordinates > * getCloseRoads(const Coordinates &coord, unsigned maxDist) const
Definition: field.cpp:330
void generateInsAndOuts(unsigned nb)
Definition: field.cpp:198
void updateUsables(unsigned servingDistance)
Definition: field.cpp:446
bool nextCoordinates(Coordinates *coord) const
Definition: field.cpp:158
static Coordinates & first()
begin
Definition: field.h:207
std::list< Coordinates > * getNeighbourRoads(const Coordinates &coord) const
Definition: field.cpp:246
unsigned getNbParcels() const
Definition: field.h:68
Classe représentant la surface -le terrain- et contenant les opérations que l'on effectue sur celui-c...
Definition: field.h:15
void add_road(const Coordinates &coords)
Definition: field.h:97
unsigned get_width() const
Definition: field.h:50
Field & operator=(const Field &other)
Definition: field.h:168
bool tryAdd_in_out(const Coordinates &coords)
Definition: field.cpp:89
void add_undefined(unsigned col, unsigned row)
Definition: field.h:146
void add_road(unsigned col, unsigned row)
Definition: field.h:104
State operator[](const Coordinates &pos) const
Definition: field.h:163
std::list< Coordinates > & get_insOuts()
Definition: field.h:61
void set_height(unsigned height)
Definition: field.h:81
void addRoads(std::list< Coordinates > *roads, unsigned serveDistance)
Definition: field.cpp:68
int col
Definition: Coordinates.h:20
std::list< Coordinates > ins_outs
ins_outs Liste des entrées-sorties de la surface
Definition: field.h:25
friend std::ostream & operator<<(std::ostream &out, const Field &field)
Definition: field.h:230
bool tryAdd_in_out(unsigned col, unsigned row)
Definition: field.h:132
bool contains(int x, int y) const
Definition: field.cpp:146
void deleteOldMatrix()
Definition: field.cpp:45
State at(const Coordinates &pos) const
Definition: field.h:156
void add_undefined(const Coordinates &coords)
Definition: field.cpp:100
State ** parcels
Matrice d'états des cellules.
Definition: field.h:28
void show_ins_and_outs() const
Definition: field.cpp:117
unsigned nb_cols
nb_cols Nombre de colonnes de la surface
Definition: field.h:21
void resizeWithDimensions()
Definition: field.cpp:56
std::ostream & print(std::ostream &out) const
Definition: field.cpp:125
std::list< Coordinates > * getCloseParcels(const Coordinates &coord, unsigned maxDist) const
Definition: field.cpp:322
void removeRoads(std::list< Coordinates > *roads, unsigned serveDistance)
Definition: field.cpp:79
void resetUsables(unsigned servingDistance)
Definition: field.cpp:424
std::list< Coordinates > * getCloseUnusableParcels(const Coordinates &coord, unsigned servingDistance) const
Definition: field.cpp:314
Représentation et opérations simple sur des coordonnées dans un plan.
Definition: Coordinates.h:13
void setUsables(unsigned servingDistance)
Definition: field.cpp:402
void createExample()
createExample
Definition: field_others.cpp:10