Skip to content

Commit 0766775

Browse files
author
wonder
committedFeb 22, 2007
Changed inline functions of QgsMapToPixel to normal functions.
This fixes warnings on windows when calling them outside core lib. git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@6655 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent d8b2604 commit 0766775

File tree

2 files changed

+59
-56
lines changed

2 files changed

+59
-56
lines changed
 

‎src/core/qgsmaptopixel.cpp

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,22 @@
2020
#include <qpoint.h>
2121
#include "qgsmaptopixel.h"
2222

23+
QgsMapToPixel::QgsMapToPixel(double mupp,
24+
double ymax,
25+
double ymin,
26+
double xmin)
27+
: mMapUnitsPerPixel(mupp),
28+
yMax(ymax),
29+
yMin(ymin),
30+
xMin(xmin),
31+
xMax(0) // XXX wasn't originally specified? Why?
32+
{
33+
}
34+
35+
QgsMapToPixel::~QgsMapToPixel()
36+
{
37+
}
38+
2339
QgsPoint QgsMapToPixel::toMapPoint(int x, int y)
2440
{
2541
double mx = x * mMapUnitsPerPixel + xMin;
@@ -80,3 +96,46 @@ QString QgsMapToPixel::showParameters()
8096
return rep;
8197

8298
}
99+
100+
101+
QgsPoint QgsMapToPixel::transform(double x, double y)
102+
{
103+
transformInPlace(x,y);
104+
return QgsPoint(x,y);
105+
}
106+
107+
QgsPoint QgsMapToPixel::transform(const QgsPoint& p)
108+
{
109+
double dx = p.x();
110+
double dy = p.y();
111+
transformInPlace(dx, dy);
112+
113+
//std::cerr << "Point to pixel...X : " << p.x() << "-->" << dx << ", Y: " << p.y() << " -->" << dy << std::endl;
114+
return QgsPoint(dx, dy);
115+
}
116+
117+
void QgsMapToPixel::transform(QgsPoint* p)
118+
{
119+
double x = p->x();
120+
double y = p->y();
121+
transformInPlace(x, y);
122+
123+
#ifdef QGISDEBUG
124+
//std::cerr << "Point to pixel...X : " << p->x() << "-->" << x << ", Y: " << p->y() << " -->" << y << std::endl;
125+
#endif
126+
p->set(x,y);
127+
}
128+
129+
void QgsMapToPixel::transformInPlace(double& x, double& y)
130+
{
131+
x = (x - xMin) / mMapUnitsPerPixel;
132+
y = yMax - (y - yMin) / mMapUnitsPerPixel;
133+
}
134+
135+
void QgsMapToPixel::transformInPlace(std::vector<double>& x,
136+
std::vector<double>& y)
137+
{
138+
assert(x.size() == y.size());
139+
for (unsigned int i = 0; i < x.size(); ++i)
140+
transformInPlace(x[i], y[i]);
141+
}

‎src/core/qgsmaptopixel.h

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -114,61 +114,5 @@ class CORE_EXPORT QgsMapToPixel{
114114

115115
};
116116

117-
inline QgsMapToPixel::QgsMapToPixel(double mupp,
118-
double ymax,
119-
double ymin,
120-
double xmin)
121-
: mMapUnitsPerPixel(mupp),
122-
yMax(ymax),
123-
yMin(ymin),
124-
xMin(xmin),
125-
xMax(0) // XXX wasn't originally specified? Why?
126-
{
127-
}
128117

129-
inline QgsMapToPixel::~QgsMapToPixel()
130-
{
131-
}
132-
133-
inline QgsPoint QgsMapToPixel::transform(double x, double y)
134-
{
135-
transformInPlace(x,y);
136-
return QgsPoint(x,y);
137-
}
138-
139-
inline QgsPoint QgsMapToPixel::transform(const QgsPoint& p)
140-
{
141-
double dx = p.x();
142-
double dy = p.y();
143-
transformInPlace(dx, dy);
144-
145-
//std::cerr << "Point to pixel...X : " << p.x() << "-->" << dx << ", Y: " << p.y() << " -->" << dy << std::endl;
146-
return QgsPoint(dx, dy);
147-
}
148-
149-
inline void QgsMapToPixel::transform(QgsPoint* p)
150-
{
151-
double x = p->x();
152-
double y = p->y();
153-
transformInPlace(x, y);
154-
155-
#ifdef QGISDEBUG
156-
//std::cerr << "Point to pixel...X : " << p->x() << "-->" << x << ", Y: " << p->y() << " -->" << y << std::endl;
157-
#endif
158-
p->set(x,y);
159-
}
160-
161-
inline void QgsMapToPixel::transformInPlace(double& x, double& y)
162-
{
163-
x = (x - xMin) / mMapUnitsPerPixel;
164-
y = yMax - (y - yMin) / mMapUnitsPerPixel;
165-
}
166-
167-
inline void QgsMapToPixel::transformInPlace(std::vector<double>& x,
168-
std::vector<double>& y)
169-
{
170-
assert(x.size() == y.size());
171-
for (unsigned int i = 0; i < x.size(); ++i)
172-
transformInPlace(x[i], y[i]);
173-
}
174118
#endif // QGSMAPTOPIXEL

0 commit comments

Comments
 (0)
Please sign in to comment.