File: PlanarPartition.h

package info (click to toggle)
pprepair 0.0~20170614-dd91a21-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 344 kB
  • sloc: cpp: 2,853; xml: 295; makefile: 16; sh: 11; ansic: 10
file content (80 lines) | stat: -rw-r--r-- 2,335 bytes parent folder | download | duplicates (3)
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
/*
 Copyright (c) 2009-2013,
 Ken Arroyo Ohori    g.a.k.arroyoohori@tudelft.nl
 Hugo Ledoux         h.ledoux@tudelft.nl
 Martijn Meijers     b.m.meijers@tudelft.nl
 All rights reserved.
 
 This file is part of pprepair: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation, either version 3 of the License, or
 (at your option) any later version.
 
 Licensees holding a valid commercial license may use this file in
 accordance with the commercial license agreement provided with
 the software.
 
 This file 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.
 */

#ifndef PLANARPARTITION_H
#define PLANARPARTITION_H

#include "IOWorker.h"

class PlanarPartition {
public:
  // Constructors and destructors, initialisation
	PlanarPartition();
	~PlanarPartition();
  
  // Operations
  bool addToTriangulation(const char *file, unsigned int schemaIndex = 0);
  
  bool tagTriangulation();
  bool makeAllHolesValid();
  bool addAllowedHole(Point p);
  bool addAllowedHoles(const char *file);
  bool splitRegions(double ratio);
  
  bool checkValidity();
  bool repairTrianglesByNumberOfNeighbours(bool alsoUniverse);
	bool repairTrianglesByAbsoluteMajority(bool alsoUniverse);
	bool repairTrianglesByLongestBoundary(bool alsoUniverse);
	bool repairRegionsByLongestBoundary(bool alsoUniverse);
	bool repairRegionsByRandomNeighbour(bool alsoUniverse);
	bool repairByPriorityList(const char *file);
  bool repairEdgeMatching(const char *file);
  
  bool matchSchemata();
  
  bool reconstructPolygons(bool removeVertices = false);
  
  bool exportPolygons(const char *file, bool withProvenance);
  bool exportTriangulation(const char *file, bool withNumberOfTags, bool withFields, bool withProvenance);
  
  void printInfo();
  
private:  // Comment to have access to the triangulation and other data structures from outside
	// Internal states
	enum State {
		CREATED,
		TRIANGULATED,
		TAGGED,
		REPAIRED,
		RECONSTRUCTED
	};
  State state;
  
  // I/O handler
  IOWorker io;
  
  // Generated stuff
	Triangulation triangulation;
  TaggingVector edgesToTag;
  std::vector<std::pair<PolygonHandle *, Polygon> > outputPolygons;
};

#endif