Welcome to mirror list, hosted at ThFree Co, Russian Federation.

chart_generator.hpp « map - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: e3f5bfc04fcecd03ab955a5aad8ae89866a45faf (plain)
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
#pragma once

#include "indexer/feature_altitude.hpp"
#include "indexer/map_style.hpp"

#include "geometry/point2d.hpp"

#include "std/cstdint.hpp"
#include "std/vector.hpp"

namespace maps
{

uint32_t constexpr kAltitudeChartBPP = 4;

void ScaleChartData(vector<double> & chartData, double scale);
void ShiftChartData(vector<double> & chartData, double shift);
void ReflectChartData(vector<double> & chartData);

/// \brief fills uniformAltitudeDataM with altitude data which evenly distributed by
/// |resultPointCount| points. |distanceDataM| and |altitudeDataM| form a curve of route altitude.
/// This method is used to generalize and evenly distribute points of the chart.
bool NormalizeChartData(vector<double> const & distanceDataM,
                        feature::TAltitudes const & altitudeDataM, size_t resultPointCount,
                        vector<double> & uniformAltitudeDataM);

/// \brief fills |yAxisDataPxl|. |yAxisDataPxl| is formed to pevent displaying
/// big waves on the chart in case of small deviation in absolute values in |yAxisData|.
/// \param height image chart height in pixels.
/// \param minMetersInPixel minimum meter number per height pixel.
/// \param altitudeDataM altitude data vector in meters.
/// \param yAxisDataPxl Y-axis data of altitude chart in pixels.
bool GenerateYAxisChartData(uint32_t height, double minMetersPerPxl,
                            vector<double> const & altitudeDataM, vector<double> & yAxisDataPxl);

/// \brief generates chart image on a canvas with size |width|, |height| with |geometry|.
/// (0, 0) is a left-top corner. X-axis goes down and Y-axis goes right.
/// \param width is result image width in pixels.
/// \param height is result image height in pixels.
/// \param geometry is points which is used to draw a curve of the chart.
/// \param mapStyle is a current map style.
/// \param frameBuffer is a vector for a result image. It's resized in this method.
/// It's filled with RGBA(8888) image date.
bool GenerateChartByPoints(uint32_t width, uint32_t height, vector<m2::PointD> const & geometry,
                           MapStyle mapStyle, vector<uint8_t> & frameBuffer);

bool GenerateChart(uint32_t width, uint32_t height, vector<double> const & distanceDataM,
                   feature::TAltitudes const & altitudeDataM, MapStyle mapStyle,
                   vector<uint8_t> & frameBuffer);
}  // namespace maps