libosmscout
1.1.1
Toggle main menu visibility
Loading...
Searching...
No Matches
libosmscout-map
include
osmscoutmap
LabelProvider.h
Go to the documentation of this file.
1
#ifndef OSMSCOUT_LABELPROVIDER_H
2
#define OSMSCOUT_LABELPROVIDER_H
3
4
/*
5
This source is part of the libosmscout library
6
Copyright (C) 2017 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/TypeConfig.h
>
28
29
#include <
osmscoutmap/MapParameter.h
>
30
31
namespace
osmscout
{
32
38
class
OSMSCOUT_MAP_API
LabelProvider
39
{
40
public
:
41
virtual
~LabelProvider
() =
default
;
42
51
virtual
std::string
GetLabel
(
const
MapParameter& parameter,
52
const
FeatureValueBuffer& buffer)
const
= 0;
53
57
virtual
std::string
GetName
()
const
= 0;
58
};
59
60
using
LabelProviderRef
= std::shared_ptr<LabelProvider>;
61
66
class
OSMSCOUT_MAP_API
LabelProviderFactory
67
{
68
public
:
69
virtual
~LabelProviderFactory
() =
default
;
70
71
virtual
LabelProviderRef
Create
(
const
TypeConfig& typeConfig)
const
= 0;
72
};
73
74
using
LabelProviderFactoryRef
= std::shared_ptr<LabelProviderFactory>;
75
80
class
OSMSCOUT_MAP_API
INameLabelProviderFactory
:
public
LabelProviderFactory
81
{
82
private
:
83
class
INameLabelProvider :
public
LabelProvider
84
{
85
private
:
86
std::vector<size_t> nameLookupTable;
87
std::vector<size_t> nameAltLookupTable;
88
89
public
:
90
explicit
INameLabelProvider(
const
TypeConfig& typeConfig);
91
92
std::string GetLabel(
const
MapParameter& parameter,
93
const
FeatureValueBuffer& buffer)
const override
;
94
95
inline
std::string GetName()
const override
96
{
97
return
"IName"
;
98
}
99
};
100
101
private
:
102
mutable
LabelProviderRef
instance;
103
104
public
:
105
LabelProviderRef
Create
(
const
TypeConfig& typeConfig)
const override
;
106
};
107
116
class
OSMSCOUT_MAP_API
DynamicFeatureLabelReader
:
public
LabelProvider
117
{
118
private
:
119
std::vector<size_t> lookupTable;
120
std::string featureName;
121
std::string labelName;
122
size_t
labelIndex;
123
124
public
:
135
DynamicFeatureLabelReader
(
const
TypeConfig& typeConfig,
136
const
std::string& featureName,
137
const
std::string& labelName);
138
139
std::string
GetLabel
(
const
MapParameter& parameter,
140
const
FeatureValueBuffer& buffer)
const override
;
141
142
inline
std::string
GetName
()
const override
143
{
144
return
featureName +
"."
+ labelName;
145
}
146
};
147
}
148
149
#endif
MapImportExport.h
OSMSCOUT_MAP_API
#define OSMSCOUT_MAP_API
Definition
MapImportExport.h:45
MapParameter.h
TypeConfig.h
osmscout::DynamicFeatureLabelReader::DynamicFeatureLabelReader
DynamicFeatureLabelReader(const TypeConfig &typeConfig, const std::string &featureName, const std::string &labelName)
osmscout::DynamicFeatureLabelReader::GetName
std::string GetName() const override
Definition
LabelProvider.h:142
osmscout::DynamicFeatureLabelReader::GetLabel
std::string GetLabel(const MapParameter ¶meter, const FeatureValueBuffer &buffer) const override
osmscout::INameLabelProviderFactory
Definition
LabelProvider.h:81
osmscout::INameLabelProviderFactory::Create
LabelProviderRef Create(const TypeConfig &typeConfig) const override
osmscout::LabelProviderFactory
Definition
LabelProvider.h:67
osmscout::LabelProviderFactory::Create
virtual LabelProviderRef Create(const TypeConfig &typeConfig) const =0
osmscout::LabelProviderFactory::~LabelProviderFactory
virtual ~LabelProviderFactory()=default
osmscout::LabelProvider
Definition
LabelProvider.h:39
osmscout::LabelProvider::~LabelProvider
virtual ~LabelProvider()=default
osmscout::LabelProvider::GetLabel
virtual std::string GetLabel(const MapParameter ¶meter, const FeatureValueBuffer &buffer) const =0
osmscout::LabelProvider::GetName
virtual std::string GetName() const =0
osmscout
Definition
Area.h:39
osmscout::LabelProviderRef
std::shared_ptr< LabelProvider > LabelProviderRef
Definition
LabelProvider.h:60
osmscout::LabelProviderFactoryRef
std::shared_ptr< LabelProviderFactory > LabelProviderFactoryRef
Definition
LabelProvider.h:74
Generated by
1.17.0