| 43 | } |
| 44 | |
| 45 | float Annotation::getArea() const { |
| 46 | if (!_coordinates.empty()) { |
| 47 | double area = 0.; |
| 48 | int j = _coordinates.size() - 1; |
| 49 | for (int i = 0; i < _coordinates.size(); i++) { |
| 50 | area += (_coordinates[j].getX() + _coordinates[i].getX())*(_coordinates[j].getY() - _coordinates[i].getY()); |
| 51 | j = i; |
| 52 | } |
| 53 | return std::abs(area*.5); |
| 54 | } |
| 55 | else{ |
| 56 | return 0.0; |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | unsigned int Annotation::getNumberOfPoints() const { |
| 61 | return _coordinates.size(); |
no test coverage detected