-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Moved the painter statistics code to separate files to reduce code size and build time of MapPainter - Tuned clang-tidy configuration
- Loading branch information
Showing
8 changed files
with
400 additions
and
262 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,27 @@ | ||
--- | ||
Checks: '-*,bugprone-*,cert-*,clang-analyzer-*,concurrency-*,cppcoreguidelines,misc-*,modernize-*,performance-*,readability-*,clang-diagnostic-*,-modernize-use-nodiscard,-modernize-use-trailing-return-type,-readability-redundant-access-specifiers,-readability-uppercase-literal-suffix,-readability-magic-numbers,-readability-isolate-declaration,-modernize-use-auto,-misc-non-private-member-variables-in-classes,-cert-dcl21-cpp,-modernize-pass-by-value,-readability-convert-member-functions-to-static,-readability-identifier-length,-bugprone-too-small-loop-variable' | ||
Checks: '-*,bugprone-*,cert-*,clang-analyzer-*,concurrency-*,cppcoreguidelines-*,misc-*,modernize-*,performance-*,readability-*,clang-diagnostic-*,-modernize-use-nodiscard,-modernize-use-trailing-return-type,-readability-redundant-access-specifiers,-readability-uppercase-literal-suffix,-readability-magic-numbers,-readability-isolate-declaration,-modernize-use-auto,-misc-non-private-member-variables-in-classes,-cert-dcl21-cpp,-modernize-pass-by-value,-readability-convert-member-functions-to-static,-readability-identifier-length,-bugprone-too-small-loop-variable,-misc-const-correctness' | ||
WarningsAsErrors: '' | ||
HeaderFilterRegex: '.*/libosmscout.*/.*' | ||
AnalyzeTemporaryDtors: false | ||
FormatStyle: none | ||
CheckOptions: | ||
- key: cert-dcl16-c.NewSuffixes | ||
value: 'L;LL;LU;LLU' | ||
- key: cert-oop54-cpp.WarnOnlyIfThisHasSuspiciousField | ||
value: '0' | ||
- key: cppcoreguidelines-explicit-virtual-functions.IgnoreDestructors | ||
value: '1' | ||
- key: cppcoreguidelines-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic | ||
value: '1' | ||
- key: modernize-loop-convert.MaxCopySize | ||
value: '16' | ||
- key: modernize-loop-convert.MinConfidence | ||
value: reasonable | ||
- key: modernize-loop-convert.NamingStyle | ||
value: CamelCase | ||
- key: modernize-pass-by-value.IncludeStyle | ||
value: llvm | ||
- key: modernize-replace-auto-ptr.IncludeStyle | ||
value: llvm | ||
- key: modernize-use-nullptr.NullMacros | ||
value: 'NULL' | ||
... | ||
- key: cert-dcl16-c.NewSuffixes | ||
value: 'L;LL;LU;LLU' | ||
- key: cert-oop54-cpp.WarnOnlyIfThisHasSuspiciousField | ||
value: '0' | ||
- key: cppcoreguidelines-explicit-virtual-functions.IgnoreDestructors | ||
value: '1' | ||
- key: cppcoreguidelines-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic | ||
value: '1' | ||
- key: modernize-loop-convert.MaxCopySize | ||
value: '16' | ||
- key: modernize-loop-convert.MinConfidence | ||
value: reasonable | ||
- key: modernize-loop-convert.NamingStyle | ||
value: CamelCase | ||
- key: modernize-pass-by-value.IncludeStyle | ||
value: llvm | ||
- key: modernize-replace-auto-ptr.IncludeStyle | ||
value: llvm | ||
- key: modernize-use-nullptr.NullMacros | ||
value: 'NULL' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
94 changes: 94 additions & 0 deletions
94
libosmscout-map/include/osmscoutmap/MapPainterStatistics.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
#ifndef OSMSCOUT_MAP_MAPPAINTERSTATISTICS_H | ||
#define OSMSCOUT_MAP_MAPPAINTERSTATISTICS_H | ||
|
||
/* | ||
This source is part of the libosmscout-map library | ||
Copyright (C) 2023 Tim Teulings | ||
This library is free software; you can redistribute it and/or | ||
modify it under the terms of the GNU Lesser General Public | ||
License as published by the Free Software Foundation; either | ||
version 2.1 of the License, or (at your option) any later version. | ||
This library is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
Lesser General Public License for more details. | ||
You should have received a copy of the GNU Lesser General Public | ||
License along with this library; if not, write to the Free Software | ||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
*/ | ||
|
||
#include <osmscoutmap/MapImportExport.h> | ||
|
||
#include <osmscout/TypeConfig.h> | ||
#include <osmscout/util/Projection.h> | ||
|
||
#include <osmscoutmap/MapParameter.h> | ||
#include <osmscoutmap/MapData.h> | ||
#include <osmscoutmap/StyleConfig.h> | ||
|
||
namespace osmscout { | ||
|
||
class OSMSCOUT_MAP_API MapPainterStatistics | ||
{ | ||
private: | ||
/** | ||
* Structure used for internal statistic collection | ||
*/ | ||
struct OSMSCOUT_MAP_API DataStatistic | ||
{ | ||
TypeInfoRef type; //!< Type | ||
size_t objectCount=0; //!< Sum of nodeCount, wayCount, areaCont | ||
size_t nodeCount =0; //!< Number of Node objects | ||
size_t wayCount =0; //!< Number of Way objects | ||
size_t areaCount =0; //!< Number of Area objects | ||
size_t coordCount =0; //!< Number of coordinates | ||
size_t labelCount =0; //!< Number of labels | ||
size_t iconCount =0; //!< Number of icons | ||
|
||
DataStatistic() = default; | ||
}; | ||
|
||
private: | ||
void DumpDataStatistics(const std::list<DataStatistic>& statistics); | ||
|
||
std::list<DataStatistic> MapToSortedList(const std::unordered_map<TypeInfoRef,DataStatistic>& statistics); | ||
|
||
void DumpDataStatistics(const StyleConfig& styleConfig, | ||
const Projection& projection, | ||
const MapParameter& parameter, | ||
const MapData& data); | ||
|
||
void CalculateStatistics(const Projection& projection, | ||
const MapParameter& parameter, | ||
const StyleConfig& styleConfig, | ||
const NodeRef& node, | ||
DataStatistic& statistic); | ||
|
||
void CalculateStatistics(const Projection& projection, | ||
const MapParameter& parameter, | ||
const StyleConfig& styleConfig, | ||
const WayRef& way, | ||
DataStatistic& statistic); | ||
|
||
void CalculateStatistics(const Projection& projection, | ||
const MapParameter& parameter, | ||
const StyleConfig& styleConfig, | ||
const AreaRef& area, | ||
DataStatistic& statistic); | ||
|
||
void DumpStatisticWarnings(const MapParameter& parameter, | ||
const std::unordered_map<TypeInfoRef,DataStatistic>& statistics); | ||
|
||
public: | ||
MapPainterStatistics() = default; | ||
|
||
void DumpMapPainterStatistics(const StyleConfig& styleConfig, | ||
const Projection& projection, | ||
const MapParameter& parameter, | ||
const MapData& data); | ||
}; | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.