Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
David Cazier
CGoGN
Commits
10cf0a32
Commit
10cf0a32
authored
Jun 13, 2013
by
Sylvain Thery
Browse files
forgotten files
parent
eb332a77
Changes
2
Hide whitespace changes
Inline
Side-by-side
include/Container/containerBrowser.h
0 → 100644
View file @
10cf0a32
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009-2012, IGG Team, LSIIT, University of Strasbourg *
* *
* This library is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation; either version 2.1 of the License, or (at your *
* option) any later version. *
* *
* This library 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. See the GNU Lesser General Public License *
* for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this library; if not, write to the Free Software Foundation, *
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
* *
* Web site: http://cgogn.unistra.fr/ *
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
#ifndef __CONTAINER_BROWSER__
#define __CONTAINER_BROWSER__
#include
"Container/attributeContainer.h"
#include
"Topology/generic/functor.h"
class
AttribMap
;
namespace
CGoGN
{
/**
* Browser that traverses all darts and jumps over
* those not selected by the selector
*/
class
DartContainerBrowserSelector
:
public
ContainerBrowser
{
protected:
AttributeContainer
*
m_cont
;
const
FunctorSelect
*
m_selector
;
public:
DartContainerBrowserSelector
(
AttribMap
&
m
,
const
FunctorSelect
&
fs
);
~
DartContainerBrowserSelector
();
unsigned
int
begin
()
const
;
unsigned
int
end
()
const
;
void
next
(
unsigned
int
&
it
)
const
;
void
enable
();
void
disable
();
}
;
template
<
unsigned
int
CELL
>
class
ContainerBrowserCellMarked
:
public
ContainerBrowser
{
protected:
AttributeContainer
*
m_cont
;
CellMarker
<
CELL
>&
m_marker
;
public:
ContainerBrowserCellMarked
(
AttribMap
&
m
,
CellMarker
<
CELL
>&
cm
);
~
ContainerBrowserCellMarked
();
unsigned
int
begin
()
const
;
unsigned
int
end
()
const
;
void
next
(
unsigned
int
&
it
)
const
;
void
enable
();
void
disable
();
}
;
class
ContainerBrowserLinked
:
public
ContainerBrowser
{
protected:
// The browsed map
AttributeContainer
*
m_cont
;
AttributeMultiVector
<
unsigned
int
>*
m_links
;
bool
autoAttribute
;
unsigned
int
m_first
;
unsigned
int
m_end
;
public:
ContainerBrowserLinked
(
AttribMap
&
m
,
unsigned
int
orbit
);
ContainerBrowserLinked
(
AttributeContainer
&
c
);
ContainerBrowserLinked
(
AttributeContainer
&
c
,
AttributeMultiVector
<
unsigned
int
>*
links
);
/**
* @brief ContainerBrowserLinked contructor that share the container and links
* @param cbl the ContainerBrowserLinked
*/
ContainerBrowserLinked
(
ContainerBrowserLinked
&
cbl
);
~
ContainerBrowserLinked
();
unsigned
int
begin
()
const
;
unsigned
int
end
()
const
;
void
next
(
unsigned
int
&
it
)
const
;
void
enable
();
void
disable
();
void
clear
();
void
pushBack
(
unsigned
int
it
);
// void popFront();
// void addSelected(const FunctorSelect& fs);
// void append(MapBrowserLinked& mbl);
}
;
class
MapBrowserLinked
:
public
FunctorType
{
protected:
ContainerBrowserLinked
m_cbrowser
;
public:
MapBrowserLinked
(
AttribMap
&
m
);
Dart
begin
()
const
;
Dart
end
()
const
;
void
next
(
Dart
&
d
)
const
;
bool
operator
()(
Dart
d
);
ContainerBrowserLinked
&
getContainerBrowser
();
};
}
// namespace CGoGN
#include
"containerBrowser.hpp"
#endif
include/Container/containerBrowser.hpp
0 → 100644
View file @
10cf0a32
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009-2012, IGG Team, LSIIT, University of Strasbourg *
* *
* This library is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation; either version 2.1 of the License, or (at your *
* option) any later version. *
* *
* This library 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. See the GNU Lesser General Public License *
* for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this library; if not, write to the Free Software Foundation, *
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
* *
* Web site: http://cgogn.unistra.fr/ *
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
#include
"Topology/generic/dart.h"
#include
"Topology/generic/attribmap.h"
namespace
CGoGN
{
inline
DartContainerBrowserSelector
::
DartContainerBrowserSelector
(
AttribMap
&
m
,
const
FunctorSelect
&
fs
)
{
m_cont
=
&
(
m
.
getAttributeContainer
<
DART
>
());
m_selector
=
fs
.
copy
();
}
inline
DartContainerBrowserSelector
::~
DartContainerBrowserSelector
()
{
delete
m_selector
;
}
inline
unsigned
int
DartContainerBrowserSelector
::
begin
()
const
{
unsigned
int
it
=
m_cont
->
realBegin
()
;
while
(
(
it
!=
m_cont
->
realEnd
())
&&
!
m_selector
->
operator
()(
Dart
(
it
))
)
m_cont
->
realNext
(
it
);
return
it
;
}
inline
unsigned
int
DartContainerBrowserSelector
::
end
()
const
{
return
m_cont
->
realEnd
();
}
inline
void
DartContainerBrowserSelector
::
next
(
unsigned
int
&
it
)
const
{
do
{
m_cont
->
realNext
(
it
)
;
}
while
(
(
it
!=
m_cont
->
realEnd
())
&&
!
m_selector
->
operator
()(
Dart
(
it
))
)
;
}
inline
void
DartContainerBrowserSelector
::
enable
()
{
m_cont
->
setContainerBrowser
(
this
);
}
inline
void
DartContainerBrowserSelector
::
disable
()
{
m_cont
->
setContainerBrowser
(
NULL
);
}
inline
ContainerBrowserLinked
::
ContainerBrowserLinked
(
AttribMap
&
m
,
unsigned
int
orbit
)
:
autoAttribute
(
true
),
m_first
(
0xffffffff
),
m_end
(
0xffffffff
)
{
m_cont
=
&
(
m
.
getAttributeContainer
(
orbit
));
m_links
=
m_cont
->
addAttribute
<
unsigned
int
>
(
"Browser_Links"
)
;
}
inline
ContainerBrowserLinked
::
ContainerBrowserLinked
(
AttributeContainer
&
c
)
:
m_cont
(
&
c
),
autoAttribute
(
true
),
m_first
(
0xffffffff
),
m_end
(
0xffffffff
)
{
m_links
=
m_cont
->
addAttribute
<
unsigned
int
>
(
"Browser_Links"
)
;
}
inline
ContainerBrowserLinked
::
ContainerBrowserLinked
(
AttributeContainer
&
c
,
AttributeMultiVector
<
unsigned
int
>*
links
)
:
m_cont
(
&
c
),
m_links
(
links
),
autoAttribute
(
false
),
m_first
(
0xffffffff
),
m_end
(
0xffffffff
)
{}
inline
ContainerBrowserLinked
::
ContainerBrowserLinked
(
ContainerBrowserLinked
&
cbl
)
:
m_cont
(
cbl
.
m_cont
),
m_links
(
cbl
.
m_links
),
m_first
(
0xffffffff
),
m_end
(
0xffffffff
)
{}
inline
ContainerBrowserLinked
::~
ContainerBrowserLinked
()
{
if
(
autoAttribute
)
m_cont
->
removeAttribute
<
unsigned
int
>
(
"Browser_Links"
)
;
}
inline
void
ContainerBrowserLinked
::
clear
()
{
m_first
=
0xffffffff
;
m_end
=
0xffffffff
;
}
inline
unsigned
int
ContainerBrowserLinked
::
begin
()
const
{
return
m_first
;
}
inline
unsigned
int
ContainerBrowserLinked
::
end
()
const
{
return
0xffffffff
;
}
inline
void
ContainerBrowserLinked
::
next
(
unsigned
int
&
it
)
const
{
it
=
(
*
m_links
)[
it
]
;
}
inline
void
ContainerBrowserLinked
::
pushBack
(
unsigned
int
it
)
{
(
*
m_links
)[
it
]
=
0xffffffff
;
if
(
m_first
==
0xffffffff
)
// empty list
{
m_first
=
it
;
m_end
=
it
;
}
else
{
(
*
m_links
)[
m_end
]
=
it
;
m_end
=
it
;
}
}
inline
void
ContainerBrowserLinked
::
enable
()
{
m_cont
->
setContainerBrowser
(
this
);
}
inline
void
ContainerBrowserLinked
::
disable
()
{
m_cont
->
setContainerBrowser
(
NULL
);
}
template
<
unsigned
int
CELL
>
inline
ContainerBrowserCellMarked
<
CELL
>::
ContainerBrowserCellMarked
(
AttribMap
&
m
,
CellMarker
<
CELL
>&
cm
)
:
m_marker
(
cm
)
{
m_cont
=
&
(
m
.
getAttributeContainer
<
CELL
>
());
}
template
<
unsigned
int
CELL
>
inline
ContainerBrowserCellMarked
<
CELL
>::~
ContainerBrowserCellMarked
()
{
}
template
<
unsigned
int
CELL
>
inline
unsigned
int
ContainerBrowserCellMarked
<
CELL
>::
begin
()
const
{
unsigned
int
it
=
m_cont
->
realBegin
()
;
while
(
(
it
!=
m_cont
->
realEnd
())
&&
!
m_marker
.
isMarked
(
it
)
)
m_cont
->
realNext
(
it
);
return
it
;
}
template
<
unsigned
int
CELL
>
inline
unsigned
int
ContainerBrowserCellMarked
<
CELL
>::
end
()
const
{
return
m_cont
->
realEnd
();
}
template
<
unsigned
int
CELL
>
inline
void
ContainerBrowserCellMarked
<
CELL
>::
next
(
unsigned
int
&
it
)
const
{
do
{
m_cont
->
realNext
(
it
)
;
}
while
(
(
it
!=
m_cont
->
realEnd
())
&&
!
m_marker
.
isMarked
(
it
)
);
}
template
<
unsigned
int
CELL
>
inline
void
ContainerBrowserCellMarked
<
CELL
>::
enable
()
{
m_cont
->
setContainerBrowser
(
this
);
}
template
<
unsigned
int
CELL
>
inline
void
ContainerBrowserCellMarked
<
CELL
>::
disable
()
{
m_cont
->
setContainerBrowser
(
NULL
);
}
inline
MapBrowserLinked
::
MapBrowserLinked
(
AttribMap
&
m
)
:
m_cbrowser
(
m
,
DART
)
{}
inline
Dart
MapBrowserLinked
::
begin
()
const
{
return
Dart
(
m_cbrowser
.
begin
());
}
inline
Dart
MapBrowserLinked
::
end
()
const
{
return
NIL
;
}
inline
void
MapBrowserLinked
::
next
(
Dart
&
d
)
const
{
m_cbrowser
.
next
(
d
.
index
);
}
inline
bool
MapBrowserLinked
::
operator
()(
Dart
d
)
{
m_cbrowser
.
pushBack
(
d
.
index
);
return
false
;
}
inline
ContainerBrowserLinked
&
MapBrowserLinked
::
getContainerBrowser
()
{
return
m_cbrowser
;
}
}
// namespace CGoGN
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment