File: config.hpp

package info (click to toggle)
mapnik 4.0.7%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 18,408 kB
  • sloc: cpp: 160,934; python: 1,221; sh: 687; xml: 161; makefile: 122; perl: 28; lisp: 13
file content (87 lines) | stat: -rw-r--r-- 2,326 bytes parent folder | download
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
/*****************************************************************************
 *
 * This file is part of Mapnik (c++ mapping toolkit)
 *
 * Copyright (C) 2024 Artem Pavlenko
 *
 * 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., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *
 *****************************************************************************/

#ifndef CONFIG_HPP
#define CONFIG_HPP

// stl
#include <vector>
#include <set>
#include <string>
#include <chrono>
#include <mapnik/filesystem.hpp>
#include <mapnik/geometry/box2d.hpp>

namespace visual_tests {

struct map_size
{
    map_size(std::size_t _width, std::size_t _height)
        : width(_width)
        , height(_height)
    {}
    map_size() {}
    std::size_t width = 0;
    std::size_t height = 0;
};

struct config
{
    config()
        : status(true)
        , scales({1.0, 2.0})
        , sizes({{500, 100}})
        , tiles({{1, 1}})
        , bbox()
        , ignored_renderers()
    {}

    bool status;
    std::vector<double> scales;
    std::vector<map_size> sizes;
    std::vector<map_size> tiles;
    mapnik::box2d<double> bbox;
    std::set<std::string> ignored_renderers;
};

enum result_state : std::uint8_t { STATE_OK, STATE_FAIL, STATE_ERROR, STATE_OVERWRITE };

struct result
{
    std::string name;
    result_state state;
    std::string renderer_name;
    map_size size;
    map_size tiles;
    double scale_factor;
    mapnik::fs::path actual_image_path;
    mapnik::fs::path reference_image_path;
    std::string error_message;
    unsigned diff;
    std::chrono::high_resolution_clock::duration duration;
};

using result_list = std::vector<result>;

} // namespace visual_tests

#endif