-
Notifications
You must be signed in to change notification settings - Fork 141
Expand file tree
/
Copy pathImageGroup.h
More file actions
104 lines (93 loc) · 2.09 KB
/
ImageGroup.h
File metadata and controls
104 lines (93 loc) · 2.09 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#pragma once
#include "gdiplus.h"
// Content of the image resampled to the screen resolution, as a GDIPlus bitmap
// Used to speed up drawing of grouped images along with mwTiles
struct ScreenBitmap
{
public:
Gdiplus::Bitmap* bitmap;
// position to draw
double left;
double top;
// map scale and position for which it was obtained
Extent extents;
double pixelPerProjectionX;
double pixelPerProjectionY;
long viewWidth;
long viewHeight;
ScreenBitmap()
{
bitmap = NULL;
pixelPerProjectionX = 0.0;
pixelPerProjectionY = 0.0;
viewWidth = 0;
viewHeight = 0;
}
~ScreenBitmap()
{
if (bitmap != NULL)
{
delete bitmap;
bitmap = NULL;
}
}
};
// for grouped images
struct ImageGroup
{
public:
double dx;
double dy;
double xllCenter;
double yllCenter;
int width;
int height;
std::vector<int> imageIndices;
bool isValid;
bool wasDrawn;
IImage* image;
ScreenBitmap* screenBitmap;
ImageGroup(double dX, double dY, double XllCenter, double YllCenter, int Width, int Height)
{
dx = dX;
dy = dY;
width = Width;
height = Height;
xllCenter = XllCenter;
yllCenter = YllCenter;
isValid = true;
wasDrawn = false;
image = NULL;
screenBitmap = NULL;
};
~ImageGroup()
{
if (image != NULL)
{
image->Release();
image = NULL;
}
if (screenBitmap != NULL)
{
delete screenBitmap;
screenBitmap = NULL;
}
}
// comparing 2 groups, their positions and their images
bool ImageGroup::operator==(const ImageGroup& group)
{
if (this->dx != group.dx) return false;
if (this->dy != group.dy) return false;
if (this->height != group.height) return false;
if (this->width != group.width) return false;
if (this->xllCenter != group.xllCenter) return false;
if (this->yllCenter != group.yllCenter) return false;
if (this->imageIndices.size() != group.imageIndices.size()) return false;
for (unsigned int i = 0; i < group.imageIndices.size(); i++)
{
if (this->imageIndices[i] != group.imageIndices[i])
return false;
}
return true;
}
};