remove magic enum

This commit is contained in:
Filip Sykala 2021-04-26 11:23:53 +02:00 committed by Lukas Matena
parent 74ab00eff5
commit 26ec836c12
6 changed files with 29 additions and 1162 deletions

View File

@ -11,7 +11,6 @@
#include "LineUtils.hpp"
#include "PointUtils.hpp"
#include <magic_enum/magic_enum.hpp>
#include <libslic3r/VoronoiVisualUtils.hpp>
#include <libslic3r/ClipperUtils.hpp> // allign
@ -1309,7 +1308,7 @@ void SampleIslandUtils::draw(SVG & svg,
for (const auto &p : supportIslandPoints) {
svg.draw(p->point, color, size);
if (write_type && p->type != SupportIslandPoint::Type::undefined) {
auto type_name = magic_enum::enum_name(p->type);
auto type_name = SupportIslandPoint::to_string(p->type);
Point start = p->point + Point(size, 0.);
svg.draw_text(start, std::string(type_name).c_str(), color);
}

View File

@ -44,6 +44,27 @@ coord_t SupportIslandPoint::move(const Point &destination)
return diff.x() + diff.y(); // Manhatn distance
}
std::string SupportIslandPoint::to_string(const Type &type)
{
static std::map<Type, std::string> type_to_tring=
{{Type::one_center_point, "one_center_point"},
{Type::two_points,"two_points"},
{Type::center_line, "center_line"},
{Type::center_line_end, "center_line_end"},
{Type::center_line_end2, "center_line_end2"},
{Type::center_line_end3, "center_line_end3"},
{Type::center_line_start, "center_line_start"},
{Type::center_circle, "center_circle"},
{Type::center_circle_end, "center_circle_end"},
{Type::center_circle_end2, "center_circle_end2"},
{Type::outline, "outline"},
{Type::inner, "inner"},
{Type::undefined, "undefined"}};
auto it = type_to_tring.find(type);
if (it == type_to_tring.end()) return "UNDEFINED";
return it->second;
}
///////////////
// Point on VD
///////////////

View File

@ -71,6 +71,13 @@ public:
/// <param name="destination">Wanted position</param>
/// <returns>Move distance</returns>
virtual coord_t move(const Point &destination);
/// <summary>
/// Convert type to string value
/// </summary>
/// <param name="type">Input type</param>
/// <returns>String type</returns>
static std::string to_string(const Type &type);
};
using SupportIslandPointPtr = std::unique_ptr<SupportIslandPoint>;

View File

@ -1,21 +0,0 @@
MIT License
Copyright (c) 2019 - 2021 Daniil Goncharov
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -1,8 +0,0 @@
source: https://github.com/Neargye/magic_enum
version: 0.7.2
commit: c1e7c1475a3db038380a2102cc4ac9c1774b911c
last change date: 22.2.2021 17:10 SEC
Licensed under the MIT License <http://opensource.org/licenses/MIT>
Header-only C++17 library provides static reflection for enums,
work with any enum type without any macro or boilerplate code.

File diff suppressed because it is too large Load Diff