SourceXtractorPlusPlus 1.0.3
SourceXtractor++, the next generation SExtractor
Loading...
Searching...
No Matches
MeasurementFrameRectangle.h
Go to the documentation of this file.
1
17/*
18 * MeasurementFrameRectangle.h
19 *
20 * Created on: Sep 24, 2018
21 * Author: Alejandro Alvarez Ayllon
22 */
23
24#ifndef _SEIMPLEMENTATION_PLUGIN_MEASUREMENTFRAMERECTANGLE_MEASUREMENTFRAMERECTANGLE_H_
25#define _SEIMPLEMENTATION_PLUGIN_MEASUREMENTFRAMERECTANGLE_MEASUREMENTFRAMERECTANGLE_H_
26
28
31
32namespace SourceXtractor {
33
35public:
36 virtual ~MeasurementFrameRectangle() = default;
37
38 explicit MeasurementFrameRectangle(bool bad_projection):
39 m_min_coord{-1, -1}, m_max_coord{-1, -1}, m_bad_projection{bad_projection}{}
40
42 m_min_coord{min_coord}, m_max_coord{max_coord}, m_bad_projection{false} {
43 assert(min_coord.m_x <= max_coord.m_x && min_coord.m_y <= max_coord.m_y);
44 }
45
47 assert(m_max_coord.m_x >= 0);
48 return m_min_coord;
49 }
50
52 assert(m_max_coord.m_x >= 0);
53 return m_max_coord;
54 }
55
56 int getWidth() const {
57 if (m_max_coord.m_x < 0)
58 return 0;
59 return m_max_coord.m_x - m_min_coord.m_x + 1;
60 }
61
62 int getHeight() const {
63 if (m_max_coord.m_x < 0)
64 return 0;
65 return m_max_coord.m_y - m_min_coord.m_y + 1;
66 }
67
71
72 bool badProjection() const {
73 return m_bad_projection;
74 }
75
76private:
79};
80
81} // end SourceXtractor
82
83#endif // _SEIMPLEMENTATION_PLUGIN_MEASUREMENTFRAMERECTANGLE_MEASUREMENTFRAMERECTANGLE_H_
MeasurementFrameRectangle(PixelCoordinate min_coord, PixelCoordinate max_coord)
Base class for all Properties. (has no actual content).
Definition Property.h:33
A pixel coordinate made of two integers m_x and m_y.