mapBrowser.h 3.57 KB
Newer Older
Pierre Kraemer's avatar
Pierre Kraemer committed
1
2
3
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps  *
* version 0.1                                                                  *
4
* Copyright (C) 2009-2012, IGG Team, LSIIT, University of Strasbourg           *
Pierre Kraemer's avatar
Pierre Kraemer committed
5
*                                                                              *
David Cazier's avatar
David Cazier committed
6
* This library is free software ; you can redistribute it and/or modify it      *
Pierre Kraemer's avatar
Pierre Kraemer committed
7
* under the terms of the GNU Lesser General Public License as published by the *
David Cazier's avatar
David Cazier committed
8
* Free Software Foundation ; either version 2.1 of the License, or (at your     *
Pierre Kraemer's avatar
Pierre Kraemer committed
9
10
11
* option) any later version.                                                   *
*                                                                              *
* This library is distributed in the hope that it will be useful, but WITHOUT  *
David Cazier's avatar
David Cazier committed
12
* ANY WARRANTY ; without even the implied warranty of MERCHANTABILITY or        *
Pierre Kraemer's avatar
Pierre Kraemer committed
13
14
15
16
* 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     *
David Cazier's avatar
David Cazier committed
17
* along with this library ; if not, write to the Free Software Foundation,      *
Pierre Kraemer's avatar
Pierre Kraemer committed
18
19
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.           *
*                                                                              *
20
* Web site: http://cgogn.unistra.fr/                                           *
Pierre Kraemer's avatar
Pierre Kraemer committed
21
22
23
24
25
26
27
28
* Contact information: cgogn@unistra.fr                                        *
*                                                                              *
*******************************************************************************/

#ifndef MAPBROWSER_H_
#define MAPBROWSER_H_

#include "Topology/generic/dart.h"
29
#include "Topology/generic/attribmap.h"
Pierre Kraemer's avatar
Pierre Kraemer committed
30
31
32
33
34
35
36
37
38
39
#include "Topology/generic/attributeHandler.h"
#include "Topology/generic/autoAttributeHandler.h"

namespace CGoGN
{

/**
 * Browser that traverses all darts and jumps over
 * those not selected by the selector
 */
David Cazier's avatar
David Cazier committed
40
class MapBrowserSelector : public MapBrowser
Pierre Kraemer's avatar
Pierre Kraemer committed
41
42
{
protected:
43
	AttribMap& m_map ;
44
	const FunctorSelect* m_selector ;
Sylvain Thery's avatar
Sylvain Thery committed
45

Pierre Kraemer's avatar
Pierre Kraemer committed
46
public:
Sylvain Thery's avatar
Sylvain Thery committed
47
48
	MapBrowserSelector(AttribMap& m, const FunctorSelect& fs);

49
50
	~MapBrowserSelector();

Sylvain Thery's avatar
Sylvain Thery committed
51
52
53
54
55
	Dart begin() const;

	Dart end() const;

	void next(Dart& d) const;
David Cazier's avatar
David Cazier committed
56
} ;
Pierre Kraemer's avatar
Pierre Kraemer committed
57
58
59
60
61
62
63

/**
 * Browser that traverses a "submap" stored in a
 * linked list (an attribute of dart orbit)
 * It inherits from FunctorType to allow the use in
 * a foreach_cell which adds darts in the list
 */
Pierre Kraemer's avatar
Pierre Kraemer committed
64
class MapBrowserLinked : public MapBrowser, public FunctorType
Pierre Kraemer's avatar
Pierre Kraemer committed
65
66
{
protected:
David Cazier's avatar
David Cazier committed
67
	// The browsed map
68
	AttribMap& m_map ;
Pierre Kraemer's avatar
Pierre Kraemer committed
69

David Cazier's avatar
David Cazier committed
70
	// The table attributes of links storing the linking
71
	// The boolean autoAttribute is set if this attribute is managed by the browser
David Cazier's avatar
David Cazier committed
72
	bool autoAttribute ;
73
	DartAttribute<Dart> m_links ;
Pierre Kraemer's avatar
Pierre Kraemer committed
74

David Cazier's avatar
David Cazier committed
75
76
	Dart m_first ;
	Dart m_end ;
Pierre Kraemer's avatar
Pierre Kraemer committed
77

David Cazier's avatar
David Cazier committed
78
public:
Sylvain Thery's avatar
Sylvain Thery committed
79
80
81
	MapBrowserLinked(AttribMap& m);

	MapBrowserLinked(AttribMap& m, DartAttribute<Dart>& links);
Sylvain Thery's avatar
Sylvain Thery committed
82
	
Sylvain Thery's avatar
Sylvain Thery committed
83
84
85
86
	MapBrowserLinked(AttribMap& m, DartAttribute<Dart>& links, Dart first, Dart end);

	~MapBrowserLinked();
	DartAttribute<Dart>& getLinkAttr();
Sylvain Thery's avatar
Sylvain Thery committed
87
	
Sylvain Thery's avatar
Sylvain Thery committed
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
	void clear();

	Dart begin() const;

	Dart end() const;

	void next(Dart& d) const;

	void pushFront(Dart d);

	void pushBack(Dart d);

	void popFront();


	void addSelected(const FunctorSelect& fs);
untereiner's avatar
untereiner committed
104

David Cazier's avatar
David Cazier committed
105
	// operator() for use of foreach_cell
Sylvain Thery's avatar
Sylvain Thery committed
106
107
108
	bool operator()(Dart d);

	void append(MapBrowserLinked& mbl);
David Cazier's avatar
David Cazier committed
109
} ;
Pierre Kraemer's avatar
Pierre Kraemer committed
110

Pierre Kraemer's avatar
Pierre Kraemer committed
111
} // namespace CGoGN
Pierre Kraemer's avatar
Pierre Kraemer committed
112

Sylvain Thery's avatar
Sylvain Thery committed
113
114
#include "mapBrowser.hpp"

Pierre Kraemer's avatar
Pierre Kraemer committed
115
#endif /* MAPBROWSER_H_ */