Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CGoGN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
CGoGN
CGoGN
Commits
ad2de7a7
Commit
ad2de7a7
authored
Aug 31, 2011
by
Pierre Kraemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
map now manages the validity of AttributeHandlers
parent
b7003005
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
56 additions
and
16 deletions
+56
-16
Apps/Examples/viewer.cpp
Apps/Examples/viewer.cpp
+0
-1
include/Topology/generic/attribmap.hpp
include/Topology/generic/attribmap.hpp
+9
-1
include/Topology/generic/attributeHandler.h
include/Topology/generic/attributeHandler.h
+14
-6
include/Topology/generic/attributeHandler.hpp
include/Topology/generic/attributeHandler.hpp
+24
-7
include/Topology/generic/genericmap.h
include/Topology/generic/genericmap.h
+2
-1
src/Topology/generic/genericmap.cpp
src/Topology/generic/genericmap.cpp
+7
-0
No files found.
Apps/Examples/viewer.cpp
View file @
ad2de7a7
...
...
@@ -193,7 +193,6 @@ void Viewer::importMesh(std::string& filename)
normalBaseSize
=
bb
.
diagSize
()
/
100.0
f
;
// vertexBaseSize = normalBaseSize /5.0f ;
normal
=
myMap
.
getAttribute
<
PFP
::
VEC3
>
(
VERTEX
,
"normal"
)
;
if
(
!
normal
.
isValid
())
normal
=
myMap
.
addAttribute
<
PFP
::
VEC3
>
(
VERTEX
,
"normal"
)
;
...
...
include/Topology/generic/attribmap.hpp
View file @
ad2de7a7
...
...
@@ -38,7 +38,15 @@ template <typename T>
inline
bool
AttribMap
::
removeAttribute
(
AttributeHandler
<
T
>&
attr
)
{
assert
(
attr
.
isValid
()
||
!
"Invalid attribute handler"
)
;
return
m_attribs
[
attr
.
getOrbit
()].
removeAttribute
<
T
>
(
attr
.
getIndex
())
;
if
(
m_attribs
[
attr
.
getOrbit
()].
removeAttribute
<
T
>
(
attr
.
getIndex
()))
{
typedef
std
::
multimap
<
AttributeMultiVectorGen
*
,
AttributeHandlerGen
*>::
iterator
IT
;
std
::
pair
<
IT
,
IT
>
bounds
=
attributeHandlers
.
equal_range
(
attr
.
getDataVector
())
;
for
(
IT
i
=
bounds
.
first
;
i
!=
bounds
.
second
;
++
i
)
(
*
i
).
second
->
setInvalid
()
;
return
true
;
}
return
false
;
}
template
<
typename
T
>
...
...
include/Topology/generic/attributeHandler.h
View file @
ad2de7a7
...
...
@@ -40,6 +40,9 @@ protected:
GenericMap
*
m_map
;
public:
AttributeHandlerGen
()
:
m_map
(
NULL
)
{}
AttributeHandlerGen
(
GenericMap
*
m
)
:
m_map
(
m
)
{}
...
...
@@ -47,6 +50,11 @@ public:
{
return
m_map
;
}
void
setInvalid
()
{
m_map
=
NULL
;
}
};
/**
...
...
@@ -66,6 +74,12 @@ protected:
public:
typedef
T
DATA_TYPE
;
/**
* Default constructor
* Constructs a non-valid AttributeHandler (i.e. not linked to any attribute)
*/
AttributeHandler
()
;
/**
* Constructor
* @param m the map which belong attribute
...
...
@@ -73,12 +87,6 @@ public:
*/
AttributeHandler
(
GenericMap
*
m
,
AttributeMultiVector
<
T
>*
amv
)
;
/**
* Default constructor
* Constructs a non-valid AttributeHandler (i.e. not linked to any attribute)
*/
AttributeHandler
()
;
/**
* Copy constructor
* @param ta the table attribute
...
...
include/Topology/generic/attributeHandler.hpp
View file @
ad2de7a7
...
...
@@ -26,30 +26,47 @@ namespace CGoGN
{
template
<
typename
T
>
AttributeHandler
<
T
>::
AttributeHandler
(
GenericMap
*
m
,
AttributeMultiVector
<
T
>*
amv
)
:
AttributeHandlerGen
(
m
),
m_attrib
(
amv
)
AttributeHandler
<
T
>::
AttributeHandler
()
:
AttributeHandlerGen
(
),
m_attrib
(
NULL
)
{}
template
<
typename
T
>
AttributeHandler
<
T
>::
AttributeHandler
()
:
AttributeHandlerGen
(
NULL
),
m_attrib
(
NULL
)
{}
AttributeHandler
<
T
>::
AttributeHandler
(
GenericMap
*
m
,
AttributeMultiVector
<
T
>*
amv
)
:
AttributeHandlerGen
(
m
),
m_attrib
(
amv
)
{
m
->
attributeHandlers
.
insert
(
std
::
pair
<
AttributeMultiVectorGen
*
,
AttributeHandlerGen
*>
(
amv
,
this
))
;
}
template
<
typename
T
>
AttributeHandler
<
T
>::
AttributeHandler
(
const
AttributeHandler
<
T
>&
ta
)
:
AttributeHandlerGen
(
ta
.
m_map
),
m_attrib
(
ta
.
m_attrib
)
{}
{
this
->
m_map
->
attributeHandlers
.
insert
(
std
::
pair
<
AttributeMultiVectorGen
*
,
AttributeHandlerGen
*>
(
m_attrib
,
this
))
;
}
template
<
typename
T
>
inline
void
AttributeHandler
<
T
>::
operator
=
(
const
AttributeHandler
<
T
>&
ta
)
{
this
->
m_map
=
ta
.
m_map
;
m_attrib
=
ta
.
m_attrib
;
this
->
m_map
->
attributeHandlers
.
insert
(
std
::
pair
<
AttributeMultiVectorGen
*
,
AttributeHandlerGen
*>
(
m_attrib
,
this
))
;
}
template
<
typename
T
>
AttributeHandler
<
T
>::~
AttributeHandler
()
{}
{
typedef
std
::
multimap
<
AttributeMultiVectorGen
*
,
AttributeHandlerGen
*>::
iterator
IT
;
std
::
pair
<
IT
,
IT
>
bounds
=
this
->
m_map
->
attributeHandlers
.
equal_range
(
m_attrib
)
;
for
(
IT
i
=
bounds
.
first
;
i
!=
bounds
.
second
;
++
i
)
{
if
((
*
i
).
second
==
this
)
{
this
->
m_map
->
attributeHandlers
.
erase
(
i
)
;
return
;
}
}
assert
(
false
||
!
"Should not get here"
)
;
}
template
<
typename
T
>
AttributeMultiVector
<
T
>*
AttributeHandler
<
T
>::
getDataVector
()
const
...
...
include/Topology/generic/genericmap.h
View file @
ad2de7a7
...
...
@@ -77,6 +77,7 @@ class GenericMap : public MapBrowser
{
friend
class
DartMarkerGen
;
template
<
typename
T
>
friend
class
AttributeHandler
;
template
<
typename
T
>
friend
class
AutoAttributeHandler
;
protected:
...
...
@@ -105,7 +106,7 @@ protected:
unsigned
int
m_nbThreads
;
//
std::multimap<AttributeMultiVectorGen*, AttributeHandlerGen*> attributeHandlers ;
std
::
multimap
<
AttributeMultiVectorGen
*
,
AttributeHandlerGen
*>
attributeHandlers
;
public:
static
const
unsigned
int
UNKNOWN_ATTRIB
=
AttributeContainer
::
UNKNOWN
;
...
...
src/Topology/generic/genericmap.cpp
View file @
ad2de7a7
...
...
@@ -23,6 +23,7 @@
*******************************************************************************/
#include "Topology/generic/genericmap.h"
#include "Topology/generic/attributeHandler.h"
#include "Topology/generic/dartmarker.h"
#include "Geometry/vector_gen.h"
#include "Geometry/matrix.h"
...
...
@@ -111,6 +112,12 @@ void GenericMap::clear(bool removeAttrib)
m_markTables
[
i
][
j
]
=
NULL
;
}
}
if
(
removeAttrib
)
{
for
(
std
::
multimap
<
AttributeMultiVectorGen
*
,
AttributeHandlerGen
*>::
iterator
it
=
attributeHandlers
.
begin
();
it
!=
attributeHandlers
.
end
();
++
it
)
(
*
it
).
second
->
setInvalid
()
;
}
}
/****************************************
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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