-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathslot.cpp
58 lines (44 loc) · 1.11 KB
/
slot.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//
// Created by lenovo on 2018/12/11.
//
#include "slot.h"
const double Slot::width = defWidth;
const double Slot::length = defLength;
void Slot::pushGroup(Group *car) {
vehicle = car;
empty = false;
}
Slot::Slot(Point center, Point datum) {
this->center = center;
this->datum = datum;
vehicle = nullptr;
empty = true;
}
Group *Slot::returnVehicle() {
return vehicle;
}
bool Slot::isEmpty() const {
return empty;
}
const Point &Slot::retCoordinate() const {
return center;
}
const Point &Slot::retDatum() const {
return datum;
}
void Slot::draw() const{
// Strip(center.operator+(Vec(-0.1,-0.1)),center.operator+(Vec(-0.1,0.1))).draw();
Rect(0,0,0,center.operator+(Vec(-0.5*width,0)),0.005,length,0).draw();
Rect(0,0,0,center.operator+(Vec(0.5*width,0)),0.005,length,0).draw();
Rect(0,0,0,center.operator+(Vec(0,-0.5*length)),width,0.005,0).draw();
}
void Slot::setIndex(int i,int j) {
this->i=i;
this->j=j;
}
const int Slot::getI() const {
return i;
}
const int Slot::getJ() const {
return j;
}