libosmscout
1.1.1
Toggle main menu visibility
Loading...
Searching...
No Matches
libosmscout-map
include
osmscoutmap
BatchMapPainter.h
Go to the documentation of this file.
1
#ifndef OSMSCOUT_MAP_BATCH_MAP_PAINTER_H
2
#define OSMSCOUT_MAP_BATCH_MAP_PAINTER_H
3
4
/*
5
This source is part of the libosmscout-map library
6
Copyright (C) 2023 Tim Teulings
7
8
This library is free software; you can redistribute it and/or
9
modify it under the terms of the GNU Lesser General Public
10
License as published by the Free Software Foundation; either
11
version 2.1 of the License, or (at your option) any later version.
12
13
This library is distributed in the hope that it will be useful,
14
but WITHOUT ANY WARRANTY; without even the implied warranty of
15
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
Lesser General Public License for more details.
17
18
You should have received a copy of the GNU Lesser General Public
19
License along with this library; if not, write to the Free Software
20
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
*/
22
23
#include <vector>
24
25
#include <
osmscoutmap/MapImportExport.h
>
26
27
#include <
osmscout/projection/Projection.h
>
28
29
#include <
osmscoutmap/MapData.h
>
30
#include <
osmscoutmap/MapPainter.h
>
31
#include <
osmscoutmap/MapParameter.h
>
32
33
namespace
osmscout
{
34
41
template
<
class
Pa
int
erType>
42
class
BatchMapPainter
{
43
protected
:
44
std::vector<MapDataRef>
data
;
45
std::vector<PainterType>
painters
;
46
47
protected
:
48
57
bool
BatchPaintInternal
(
const
Projection
& projection,
58
const
MapParameter& parameter)
59
{
60
bool
success=
true
;
61
for
(
auto
step=
static_cast<
size_t
>
(
osmscout::RenderSteps::FirstStep
);
62
step<=static_cast<size_t>(
osmscout::RenderSteps::LastStep
);
63
++step){
64
65
for
(
size_t
i=0;i<
data
.size(); ++i){
66
const
MapData &d=*(
data
[i]);
67
auto
renderStep=
static_cast<
RenderSteps
>
(step);
68
if
(!
painters
[i]->Draw(projection,
69
parameter,
70
d,
71
renderStep,
72
renderStep)) {
73
success=
false
;
74
}
75
}
76
}
77
return
success;
78
}
79
80
public
:
81
explicit
BatchMapPainter
(
size_t
expectedCount)
82
{
83
data
.reserve(expectedCount);
84
painters
.reserve(expectedCount);
85
}
86
87
virtual
~BatchMapPainter
() =
default
;
88
89
void
AddData
(
const
MapDataRef
&d, PainterType &painter)
90
{
91
data
.push_back(d);
92
painters
.push_back(painter);
93
}
94
};
95
101
}
102
103
#endif
MapData.h
MapImportExport.h
MapPainter.h
MapParameter.h
Projection.h
osmscout::BatchMapPainter::data
std::vector< MapDataRef > data
Definition
BatchMapPainter.h:44
osmscout::BatchMapPainter::BatchMapPainter
BatchMapPainter(size_t expectedCount)
Definition
BatchMapPainter.h:81
osmscout::BatchMapPainter::BatchPaintInternal
bool BatchPaintInternal(const Projection &projection, const MapParameter ¶meter)
Definition
BatchMapPainter.h:57
osmscout::BatchMapPainter::AddData
void AddData(const MapDataRef &d, PainterType &painter)
Definition
BatchMapPainter.h:89
osmscout::BatchMapPainter::~BatchMapPainter
virtual ~BatchMapPainter()=default
osmscout::BatchMapPainter::painters
std::vector< PainterType > painters
Definition
BatchMapPainter.h:45
osmscout::Projection
Definition
Projection.h:46
osmscout
Definition
Area.h:39
osmscout::MapDataRef
std::shared_ptr< MapData > MapDataRef
Definition
MapData.h:63
osmscout::RenderSteps
RenderSteps
Definition
MapPainter.h:64
osmscout::LastStep
@ LastStep
Definition
MapPainter.h:92
osmscout::FirstStep
@ FirstStep
Definition
MapPainter.h:65
Generated by
1.17.0