]> rtime.felk.cvut.cz Git - hubacji1/bcar.git/blob - incl/pslot.hh
Refactor pslot
[hubacji1/bcar.git] / incl / pslot.hh
1 /*! \file */
2 #ifndef BCAR_PSLOT_H
3 #define BCAR_PSLOT_H
4
5 #include <ostream>
6 #include "bcar.hh"
7
8 namespace bcar {
9
10 /*! \brief Parking slot basic class.
11  *
12  * This class contains some geometrical computations of parking slot. Parking
13  * slot consists of 4 cartesian coordinates `border` representing the border of
14  * the parking slot.
15  */
16 class ParkingSlot {
17 private:
18         Point border_[4];
19         Line entry_;
20         Line rear_;
21         Line curb_;
22         Line front_;
23 public:
24         /*! \brief Set parking slot.
25
26         \param p Point with `x`, `y` coordinates of entry side's corner.
27         \param h Direction of the entry side.
28         \param W The width of the slot.
29         \param L The length of the slot.
30         */
31         ParkingSlot(Point p, double h, double W, double L);
32
33         /*! Get slot's left front x coordinate. */
34         double lfx() const;
35
36         /*! Get slot's left front y coordinate. */
37         double lfy() const;
38
39         /*! Get slot's left rear x coordinate. */
40         double lrx() const;
41
42         /*! Get slot's left rear y coordinate. */
43         double lry() const;
44
45         /*! Get slot's right rear x coordinate. */
46         double rrx() const;
47
48         /*! Get slot's right rear y coordinate. */
49         double rry() const;
50
51         /*! Get slot's right front x coordinate. */
52         double rfx() const;
53
54         /*! Get slot's right front y coordinate. */
55         double rfy() const;
56
57         /*! Return parking slot's orientation. */
58         double h() const;
59
60         /*! Return `true` for the parallel parking slot. */
61         bool parallel() const;
62
63         /*! Return `true` for the parking slot on the right side. */
64         bool right() const;
65
66         /*! Change side of the parking slot. */
67         void swap_side();
68
69         friend std::ostream& operator<<(std::ostream& o, ParkingSlot const& s);
70 };
71
72 } // namespace bcar
73 #endif /* BCAR_PSLOT_H */