Gazebo Common

API Reference

6.0.0
SVGLoader.hh
Go to the documentation of this file.
1/*
2 * Copyright (C) 2016 Open Source Robotics Foundation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16 */
17#ifndef GZ_COMMON_SVGLOADER_HH_
18#define GZ_COMMON_SVGLOADER_HH_
19
20#include <memory>
21#include <string>
22#include <vector>
23
24#include <gz/math/Vector2.hh>
25#include <gz/math/Matrix3.hh>
26
27#include <gz/utils/ImplPtr.hh>
28
29#include <gz/common/graphics/Export.hh>
30#include <gz/common/Console.hh>
31
32namespace gz
33{
34 namespace common
35 {
37 class GZ_COMMON_GRAPHICS_VISIBLE SVGCommand
38 {
40 public: SVGCommand() : cmd(' ') {}
41
43 public: virtual ~SVGCommand() = default;
44
46 public: char cmd;
47
48#ifdef _WIN32
49// Disable warning C4251
50#pragma warning(push)
51#pragma warning(disable: 4251)
52#endif
55#ifdef _WIN32
56#pragma warning(pop)
57#endif
58 };
59
61 struct GZ_COMMON_GRAPHICS_VISIBLE SVGPath
62 {
63#ifdef _WIN32
64// Disable warning C4251
65#pragma warning(push)
66#pragma warning(disable: 4251)
67#endif
68
71
74
77
80
83#ifdef _WIN32
84#pragma warning(pop)
85#endif
86 };
87
89 class GZ_COMMON_GRAPHICS_VISIBLE SVGLoader
90 {
95 public: explicit SVGLoader(const unsigned int _samples);
96
98 public: ~SVGLoader();
99
104 public: bool Parse(const std::string &_filename,
105 std::vector<SVGPath> &_paths);
106
112 public: static void PathsToClosedPolylines(
113 const std::vector<common::SVGPath> &_paths,
114 const double _tol,
117
121 public: void DumpPaths(const std::vector<SVGPath> &_paths,
122 std::ostream &_out) const;
123
126 GZ_UTILS_IMPL_PTR(dataPtr)
127 };
128 }
129}
130
131#endif