-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGeoToScreen.h
More file actions
46 lines (39 loc) · 1.31 KB
/
GeoToScreen.h
File metadata and controls
46 lines (39 loc) · 1.31 KB
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
//Geo2Screen.h
#pragma once
#include <QPolygonF>
#include <QGeocoordinate.h>
#include <QGeopolygon.h>
#include <QPointF>
#include <QSizeF>
#include <proj.h>
class CGeoToScreen
{
// Constructor
public:
CGeoToScreen();
~CGeoToScreen();
//Methods
public:
// return a bounding box given user location and size of step vertically and horizontally
int GetGeoBoundingBox(int stepVertical, int stepHorizontal, QGeoCoordinate& bbBottomLeft, QGeoCoordinate& bbTopRight );
void SetScreenSize(const QSizeF& screenSize);
int CreateProjection(const QGeoCoordinate& centre);
// Method to transform a polygon from SRID 4326 to screen coordinates
int transform(const QGeoPolygon& geoPolygon, QPolygonF& screenPolygon );
int transformPoint(const QGeoCoordinate& geoPoint, QPointF& screenPoint);
//Set the internal bounding box in transformed coordinates from geocoordinates
int setTransformedBoundingBox(const QGeoCoordinate& bottomLeft, const QGeoCoordinate& topRight);
private:
void CreateContext();
void DestroyObjects();
// Member variables
PJ_CONTEXT* m_projContext;
PJ* m_projTransform;
PJ_COORD m_pjGeoCentre;
PJ_COORD m_pjProjBottomLeft;
PJ_COORD m_pjProjTopRight;
QSizeF m_screenSize;
double m_uniformScale;
double m_offsetX;
double m_offsetY;
};