MySources/patternIO.hpp

41 lines
875 B
C++

#ifndef PATTERNEXPORTER_HPP
#define PATTERNEXPORTER_HPP
#include <fstream>
#include <string>
#include <vcg/space/deprecated_point2.h>
#include <vector>
enum PatternLabel {
Valid = 0,
MultipleCC,
DanglingEdge,
IntersectingEdges,
ArticulationPoints
};
struct Pattern {
std::vector<vcg::Point2i> edges;
std::vector<PatternLabel> labels;
};
/*
* A set of planar patterns using the same nodes
* */
struct PatternSet {
std::vector<vcg::Point2d> nodes;
std::vector<Pattern> patterns;
};
class PatternIO {
public:
PatternIO();
static void save(const std::string &filepath, const Pattern &pattern);
static void save(const std::string &filepath, const PatternSet &patterns);
static void load(const std::string &filepath, PatternSet &patternSet,
const std::vector<PatternLabel> &targetLabels = {});
};
#endif // PATTERNEXPORTER_HPP