| 18 | } |
| 19 | |
| 20 | bool Annotation::isClockwise() const { |
| 21 | if (!_coordinates.empty()) { |
| 22 | std::vector<Point> coords = _coordinates; |
| 23 | coords.push_back(coords[0]); |
| 24 | double cwise = 0; |
| 25 | for (unsigned int pt = 0; pt < coords.size() - 1; ++pt) { |
| 26 | double toAdd = (coords[pt + 1].getX() - coords[pt].getX()) * ((coords[pt + 1].getY() + coords[pt].getY())); |
| 27 | cwise += toAdd; |
| 28 | } |
| 29 | return cwise < 0; |
| 30 | } |
| 31 | else { |
| 32 | return false; |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | void Annotation::setTypeFromString(const std::string& type) { |
| 37 | for (unsigned int i = 0; i < 7; ++i) { |