46 double GetDifferences(
const double& min,
const double& max);
60 tmRealRect(
double xmin,
double ymin,
double xmax,
double ymax)
69 return wxIsSameDouble(x_min, pt.x_min) && wxIsSameDouble(y_min, pt.y_min) && wxIsSameDouble(x_max, pt.x_max) &&
70 wxIsSameDouble(y_max, pt.y_max);
74 if (!wxIsSameDouble(x_min, pt.x_min)) {
77 if (!wxIsSameDouble(y_min, pt.y_min)) {
80 if (!wxIsSameDouble(x_max, pt.x_max)) {
83 if (!wxIsSameDouble(y_max, pt.y_max)) {
90 return GetDifferences(x_min, x_max);
94 return GetDifferences(y_min, y_max);
97 OGRGeometry* GetPolygonGeometry();
106 wxSize m_ExtentWndMM;
108 double m_WidthDistanceInM;
110 PRJDEF_UNIT_TYPE m_ProjectUnit;
111 PRJDEF_PROJ_TYPE m_ProjectProjection;
113 void InitMemberValues();
115 void _ComputeUnitScale();
126 void SetPPI(
const wxSize& ppi) {
130 void SetUnitAndProj(PRJDEF_PROJ_TYPE proj, PRJDEF_UNIT_TYPE units);
132 PRJDEF_PROJ_TYPE GetProjection() {
133 return m_ProjectProjection;
137 void SetExtentWndReal(
const tmRealRect& ExtentWndReal) {
138 m_ExtentWndReal = ExtentWndReal;
141 void SetWidthDistanceInM(
double WidthDistanceInM) {
142 m_WidthDistanceInM = WidthDistanceInM;
146 void SetMaxLayersExtentAsExisting(
const tmRealRect& r);
148 void SetMaxLayersExtent(
const tmRealRect& r) {
149 m_ExtentMaxLayers = r;
153 return m_ExtentMaxLayers;
156 double GetLayersExtentWidth();
158 double GetLayersExtentHeight();
160 double GetPixelSize() {
164 wxPoint2DDouble GetTopLeftValue() {
165 return wxPoint2DDouble(m_ExtentWndReal.x_min, m_ExtentWndReal.y_max);
169 void SetWindowExtent(
const wxRect& extent) {
170 m_ExtentWnd = extent;
173 wxRect GetWindowExtent() {
178 return m_ExtentWndReal;
181 void SetWindowExtentMM(
const wxSize& size) {
182 m_ExtentWndMM = size;
186 long GetActualScale() {
190 wxString GetVisibleWidthText();
192 double GetWindowRealWidth();
194 double GetwindowRealHeight();
197 double ComputeDivFactor(wxSize wnd_extent = wxDefaultSize);
199 bool ComputeMaxExtent();
201 wxSize ComputeCenterPxWnd(
double divratio, wxSize wnd_extent = wxDefaultSize);
203 bool ComputeMaxExtentReal(wxSize wnd_offset = wxDefaultSize);
209 void ComputeNewScaleExtent(
const long& scale);
212 double GetBestDivFactor(
const wxRect& selected_rect);
214 void ComputeNewRealZoomExtent(
const wxRect& calc_wnd_extent,
const wxPoint& top_left);
216 void ComputePrevZoomExtent(
double pixelsize,
const wxPoint2DDouble& topleft);
219 void ComputeNewRealPanExtent(
const wxPoint& offsetxtop);
227 double MetersToPixels(
int meters);
229 double MetersToRealUnits(
int meters);
232 inline wxRealPoint PixelToReal(wxPoint pt) {
233 return (wxRealPoint(m_ExtentWndReal.x_min + (((
double)pt.x) * m_PixelSize),
234 m_ExtentWndReal.y_max - (((
double)pt.y) * m_PixelSize)));
237 wxPoint RealToPixel(wxRealPoint realpt);
241 static inline double DifferenceDouble(
const double& d1,
const double& d2) {
242 if (wxIsSameDouble(d1, d2))
return 0;
249 static inline double DifferenceCoord(
const double& coordmax,
const double& coordmin) {
250 if (wxIsSameDouble(coordmax, coordmin))
return 0;
251 if (coordmax <= 0 && coordmin >= 0)
return coordmax + coordmin;
253 return coordmax - coordmin;
256 wxString sFunction = wxString::FromAscii(__FUNCTION__);
257 wxString sFunctionLineError = wxString::Format(_T(
"%s line %d : "), sFunction.c_str(), __LINE__);
258 wxString sErrMsg = wxString::Format(_T(
"%s values are coord min-max : %.*f - %.*f "),
259 sFunctionLineError.c_str(), 2, coordmin, 2, coordmax);
260 wxASSERT_MSG(0, sErrMsg);
265 static inline double RemoveFromCoord(
const double& coord1,
const double& value) {
267 return coord1 - value;
269 return coord1 + value;
272 static inline double AppendToCoord(
const double& coord1,
const double& value) {
274 return coord1 + value;
280 bool IsLayerExtentValid();
bool ComptuteNewWindowSize(const wxSize &oldsize, const wxSize &newsize)
Compute new real extend when windows size change.
Definition tmgisscale.cpp:231
bool Clip(const tmRealRect &src, tmRealRect &result)
Clip rectangle with another.
Definition tmgisscale.cpp:40