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
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
KennethVanhoey
CGoGN
Commits
549f0bff
Commit
549f0bff
authored
Dec 16, 2014
by
Sylvain Thery
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
resolve bug of deleted marked darts
parent
09aaaf4e
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
228 additions
and
82 deletions
+228
-82
CMakeLists.txt
CMakeLists.txt
+3
-3
include/Container/attributeContainer.h
include/Container/attributeContainer.h
+15
-1
include/Container/attributeContainer.hpp
include/Container/attributeContainer.hpp
+21
-3
include/Topology/generic/genericmap.hpp
include/Topology/generic/genericmap.hpp
+1
-2
include/Utils/xml.h
include/Utils/xml.h
+1
-1
src/Container/attributeContainer.cpp
src/Container/attributeContainer.cpp
+169
-56
src/Topology/generic/genericmap.cpp
src/Topology/generic/genericmap.cpp
+18
-16
No files found.
CMakeLists.txt
View file @
549f0bff
...
...
@@ -59,6 +59,7 @@ find_package(OpenGL REQUIRED)
find_package
(
Boost COMPONENTS regex REQUIRED
)
find_package
(
ZLIB REQUIRED
)
#find_package(LibXml2 REQUIRED)
find_package
(
TinyXml2 REQUIRED
)
find_package
(
GLEW REQUIRED
)
# MESSAGE HERE FOR MORE EASY USER READING
...
...
@@ -98,7 +99,7 @@ SET (CGoGN_EXT_INCLUDES
${
OPENGL_INCLUDE_DIR
}
${
GLEW_INCLUDE_DIRS
}
${
ZLIB_INCLUDE_DIRS
}
# ${LIB
XML2_INCLUDE_DIR}
${
TINY
XML2_INCLUDE_DIR
}
${
Boost_INCLUDE_DIRS
}
)
...
...
@@ -108,8 +109,7 @@ SET (CGoGN_EXT_LIBS
${
OPENGL_LIBRARY
}
${
GLEW_LIBRARIES
}
${
ZLIB_LIBRARIES
}
# ${LIBXML2_LIBRARIES}
tinyxml2
${
TINYXML2_LIBRARY
}
${
Boost_REGEX_LIBRARY
}
)
...
...
include/Container/attributeContainer.h
View file @
549f0bff
...
...
@@ -38,7 +38,6 @@ namespace CGoGN
class
RegisteredBaseAttribute
;
class
AttributeContainer
;
class
ContainerBrowser
{
public:
...
...
@@ -73,6 +72,11 @@ protected:
*/
std
::
vector
<
AttributeMultiVectorGen
*>
m_tableAttribs
;
/**
* vector of pointers to AttributeMultiVectors of MarkerBool
*/
std
::
vector
<
AttributeMultiVector
<
MarkerBool
>*>
m_tableMarkerAttribs
;
/**
* vector of free indices in the vector of AttributeMultiVectors
*/
...
...
@@ -158,6 +162,10 @@ public:
template
<
typename
T
>
AttributeMultiVector
<
T
>*
addAttribute
(
const
std
::
string
&
attribName
);
/// special version for marker
AttributeMultiVector
<
MarkerBool
>*
addMarkerAttribute
(
const
std
::
string
&
attribName
);
/**
* add a new attribute to the container
* @param typeName type of the new attribute in a string
...
...
@@ -187,6 +195,8 @@ public:
template
<
typename
T
>
bool
removeAttribute
(
const
std
::
string
&
attribName
);
bool
removeMarkerAttribute
(
const
std
::
string
&
attribName
);
/**
* Remove an attribute (destroys data)
* @param index index of the attribute to remove
...
...
@@ -322,6 +332,7 @@ public:
*/
unsigned
int
getAttributesNames
(
std
::
vector
<
std
::
string
>&
names
)
const
;
/**
* fill a vector with attribute type names
* @param types vector of type names
...
...
@@ -329,6 +340,8 @@ public:
*/
unsigned
int
getAttributesTypes
(
std
::
vector
<
std
::
string
>&
types
);
std
::
vector
<
AttributeMultiVector
<
MarkerBool
>*>&
getMarkerAttributes
();
/**************************************
* CONTAINER MANAGEMENT *
**************************************/
...
...
@@ -444,6 +457,7 @@ public:
AttributeMultiVectorGen
*
getVirtualDataVector
(
unsigned
int
attrIndex
);
/**
* get an AttributeMultiVector
* @param attribName name of the attribute
...
...
include/Container/attributeContainer.hpp
View file @
549f0bff
...
...
@@ -43,6 +43,11 @@ inline void AttributeContainer::setOrbit(unsigned int orbit)
if
(
m_tableAttribs
[
i
]
!=
NULL
)
m_tableAttribs
[
i
]
->
setOrbit
(
orbit
);
}
for
(
unsigned
int
i
=
0
;
i
<
m_tableMarkerAttribs
.
size
();
++
i
)
{
m_tableMarkerAttribs
[
i
]
->
setOrbit
(
orbit
);
}
}
inline
void
AttributeContainer
::
setRegistry
(
std
::
map
<
std
::
string
,
RegisteredBaseAttribute
*
>*
re
)
...
...
@@ -340,10 +345,9 @@ inline void AttributeContainer::initLine(unsigned int index)
inline
void
AttributeContainer
::
initMarkersOfLine
(
unsigned
int
index
)
{
for
(
unsigned
int
i
=
0
;
i
<
m_tableAttribs
.
size
();
++
i
)
for
(
unsigned
int
i
=
0
;
i
<
m_table
Marker
Attribs
.
size
();
++
i
)
{
if
((
m_tableAttribs
[
i
]
!=
NULL
)
&&
(
m_tableAttribs
[
i
]
->
isMarkerBool
()))
m_tableAttribs
[
i
]
->
initElt
(
index
);
m_tableMarkerAttribs
[
i
]
->
initElt
(
index
);
}
}
...
...
@@ -355,6 +359,12 @@ inline void AttributeContainer::copyLine(unsigned int dstIndex, unsigned int src
if
(
m_tableAttribs
[
i
]
!=
NULL
)
m_tableAttribs
[
i
]
->
copyElt
(
dstIndex
,
srcIndex
);
}
for
(
unsigned
int
i
=
0
;
i
<
m_tableMarkerAttribs
.
size
();
++
i
)
{
m_tableMarkerAttribs
[
i
]
->
copyElt
(
dstIndex
,
srcIndex
);
}
}
inline
void
AttributeContainer
::
refLine
(
unsigned
int
index
)
...
...
@@ -490,4 +500,12 @@ inline void AttributeContainer::setData(unsigned int attrIndex, unsigned int elt
atm
->
operator
[](
eltIndex
)
=
data
;
}
inline
std
::
vector
<
AttributeMultiVector
<
MarkerBool
>*>&
AttributeContainer
::
getMarkerAttributes
()
{
return
m_tableMarkerAttribs
;
}
}
// namespace CGoGN
include/Topology/generic/genericmap.hpp
View file @
549f0bff
...
...
@@ -211,7 +211,6 @@ inline unsigned int GenericMap::newCell()
unsigned
int
c
=
m_attribs
[
ORBIT
].
insertLine
();
m_attribs
[
ORBIT
].
initMarkersOfLine
(
c
);
return
c
;
// return m_attribs[ORBIT].insertLine();
}
template
<
unsigned
int
ORBIT
>
...
...
@@ -291,7 +290,7 @@ AttributeMultiVector<MarkerBool>* GenericMap::askMarkVector()
x
=
x
/
10
;
number
[
0
]
=
'0'
+
x
%
10
;
AttributeMultiVector
<
MarkerBool
>*
amv
=
m_attribs
[
ORBIT
].
add
Attribute
<
MarkerBool
>
(
"marker_"
+
orbitName
(
ORBIT
)
+
number
);
AttributeMultiVector
<
MarkerBool
>*
amv
=
m_attribs
[
ORBIT
].
add
MarkerAttribute
(
"marker_"
+
orbitName
(
ORBIT
)
+
number
);
return
amv
;
}
}
...
...
include/Utils/xml.h
View file @
549f0bff
...
...
@@ -49,7 +49,7 @@ inline std::string XMLAttribute(tinyxml2::XMLElement* node, const char* attName)
const
char
*
ptr
=
node
->
Attribute
(
attName
);
if
(
ptr
==
NULL
)
{
CGoGNerr
<<
"Warning attrbute "
<<
attName
<<
" not found"
<<
CGoGNendl
;
CGoGNerr
<<
"Warning attr
i
bute "
<<
attName
<<
" not found"
<<
CGoGNendl
;
return
""
;
}
return
std
::
string
(
ptr
);
...
...
src/Container/attributeContainer.cpp
View file @
549f0bff
...
...
@@ -115,6 +115,8 @@ unsigned int AttributeContainer::getAttributesNames(std::vector<std::string>& na
return
m_nbAttributes
;
}
unsigned
int
AttributeContainer
::
getAttributesTypes
(
std
::
vector
<
std
::
string
>&
types
)
{
types
.
clear
()
;
...
...
@@ -129,6 +131,7 @@ unsigned int AttributeContainer::getAttributesTypes(std::vector<std::string>& ty
return
m_nbAttributes
;
}
/**************************************
* CONTAINER MANAGEMENT *
**************************************/
...
...
@@ -138,6 +141,7 @@ void AttributeContainer::swap(AttributeContainer& cont)
// swap everything but the orbit
m_tableAttribs
.
swap
(
cont
.
m_tableAttribs
);
m_tableMarkerAttribs
.
swap
(
cont
.
m_tableMarkerAttribs
);
m_freeIndices
.
swap
(
cont
.
m_freeIndices
);
m_holesBlocks
.
swap
(
cont
.
m_holesBlocks
);
m_tableBlocksWithFree
.
swap
(
cont
.
m_tableBlocksWithFree
);
...
...
@@ -200,10 +204,19 @@ void AttributeContainer::clear(bool removeAttrib)
if
((
*
it
)
!=
NULL
)
delete
(
*
it
);
}
std
::
vector
<
AttributeMultiVectorGen
*>
amg
;
m_tableAttribs
.
swap
(
amg
);
// detruit tous les attributs MarkerBool
for
(
std
::
vector
<
AttributeMultiVector
<
MarkerBool
>*>::
iterator
it
=
m_tableMarkerAttribs
.
begin
();
it
!=
m_tableMarkerAttribs
.
end
();
++
it
)
{
if
((
*
it
)
!=
NULL
)
delete
(
*
it
);
}
std
::
vector
<
AttributeMultiVector
<
MarkerBool
>*>
amgb
;
m_tableMarkerAttribs
.
swap
(
amgb
);
std
::
vector
<
unsigned
int
>
fi
;
m_freeIndices
.
swap
(
fi
);
}
...
...
@@ -211,16 +224,15 @@ void AttributeContainer::clear(bool removeAttrib)
bool
AttributeContainer
::
hasMarkerAttribute
()
const
{
for
(
auto
it
=
m_tableAttribs
.
begin
();
it
!=
m_tableAttribs
.
end
();
++
it
)
// not only size() != 0 because of BoundaryMarkers !
for
(
auto
it
=
m_tableMarkerAttribs
.
begin
();
it
!=
m_tableMarkerAttribs
.
end
();
++
it
)
{
if
((
*
it
)
!=
NULL
)
{
std
::
string
strMarker
=
(
*
it
)
->
getName
().
substr
(
0
,
6
);
if
(
strMarker
==
"marker"
)
return
true
;
}
std
::
string
strMarker
=
(
*
it
)
->
getName
().
substr
(
0
,
6
);
if
(
strMarker
==
"marker"
)
return
true
;
}
return
false
;
}
...
...
@@ -355,6 +367,13 @@ unsigned int AttributeContainer::insertLine()
m_tableAttribs
[
i
]
->
addBlock
();
// add a block to every attribute
}
for
(
unsigned
int
i
=
0
;
i
<
m_tableMarkerAttribs
.
size
();
++
i
)
{
if
(
m_tableMarkerAttribs
[
i
]
!=
NULL
)
m_tableMarkerAttribs
[
i
]
->
addBlock
();
// add a block to every attribute
}
// inc nb of elements
++
m_size
;
...
...
@@ -390,6 +409,11 @@ unsigned int AttributeContainer::insertLine()
if
(
m_tableAttribs
[
i
]
!=
NULL
)
m_tableAttribs
[
i
]
->
addBlock
();
// add a block to every attribute
}
for
(
unsigned
int
i
=
0
;
i
<
m_tableMarkerAttribs
.
size
();
++
i
)
{
if
(
m_tableMarkerAttribs
[
i
]
!=
NULL
)
m_tableMarkerAttribs
[
i
]
->
addBlock
();
// add a block to every attribute
}
}
}
...
...
@@ -435,18 +459,22 @@ void AttributeContainer::saveBin(CGoGNostream& fs, unsigned int id) const
std
::
vector
<
AttributeMultiVectorGen
*>
bufferamv
;
bufferamv
.
reserve
(
m_tableAttribs
.
size
());
// for(std::vector<AttributeMultiVectorGen*>::const_iterator it = m_tableAttribs.begin(); it != m_tableAttribs.end(); ++it)
// {
// if (*it != NULL)
// {
// const std::string& attName = (*it)->getName();
// std::string markName = attName.substr(0,7);
// if (markName != "marker_")
// bufferamv.push_back(*it);
// }
// }
for
(
std
::
vector
<
AttributeMultiVectorGen
*>::
const_iterator
it
=
m_tableAttribs
.
begin
();
it
!=
m_tableAttribs
.
end
();
++
it
)
{
if
(
*
it
!=
NULL
)
{
const
std
::
string
&
attName
=
(
*
it
)
->
getName
();
std
::
string
markName
=
attName
.
substr
(
0
,
7
);
if
(
markName
!=
"marker_"
)
bufferamv
.
push_back
(
*
it
);
}
bufferamv
.
push_back
(
*
it
);
}
// en ascii id et les tailles
std
::
vector
<
unsigned
int
>
bufferui
;
...
...
@@ -456,32 +484,34 @@ void AttributeContainer::saveBin(CGoGNostream& fs, unsigned int id) const
bufferui
.
push_back
(
_BLOCKSIZE_
);
bufferui
.
push_back
(
m_holesBlocks
.
size
());
bufferui
.
push_back
(
m_tableBlocksWithFree
.
size
());
// bufferui.push_back(m_nbAttributes);
bufferui
.
push_back
(
bufferamv
.
size
());
bufferui
.
push_back
(
m_size
);
bufferui
.
push_back
(
m_maxSize
);
bufferui
.
push_back
(
m_orbit
);
bufferui
.
push_back
(
m_nbUnknown
);
// count attribute of boundary markers and increase nb of saved attributes
for
(
std
::
vector
<
AttributeMultiVector
<
MarkerBool
>*>::
const_iterator
it
=
m_tableMarkerAttribs
.
begin
();
it
!=
m_tableMarkerAttribs
.
end
();
++
it
)
{
const
std
::
string
&
attName
=
(
*
it
)
->
getName
();
if
(
attName
[
0
]
==
'B'
)
// for BoundaryMark0/1
bufferui
[
4
]
++
;
}
fs
.
write
(
reinterpret_cast
<
const
char
*>
(
&
bufferui
[
0
]),
bufferui
.
size
()
*
sizeof
(
unsigned
int
));
unsigned
int
i
=
0
;
for
(
std
::
vector
<
AttributeMultiVector
<
MarkerBool
>*>::
const_iterator
it
=
m_tableMarkerAttribs
.
begin
();
it
!=
m_tableMarkerAttribs
.
end
();
++
it
)
{
const
std
::
string
&
attName
=
(
*
it
)
->
getName
();
if
(
attName
[
0
]
==
'B'
)
// for BoundaryMark0/1
(
*
it
)
->
saveBin
(
fs
,
i
++
);
}
for
(
std
::
vector
<
AttributeMultiVectorGen
*>::
const_iterator
it
=
bufferamv
.
begin
();
it
!=
bufferamv
.
end
();
++
it
)
{
if
(
*
it
!=
NULL
)
{
const
std
::
string
&
attName
=
(
*
it
)
->
getName
();
std
::
string
markName
=
attName
.
substr
(
0
,
7
);
if
(
markName
!=
"marker_"
)
(
*
it
)
->
saveBin
(
fs
,
i
++
);
}
else
{
CGoGNerr
<<
"PB saving, NULL ptr in m_tableAttribs"
<<
CGoGNendl
;
i
++
;
}
(
*
it
)
->
saveBin
(
fs
,
i
++
);
}
//en binaire les blocks de ref
...
...
@@ -544,9 +574,17 @@ bool AttributeContainer::loadBin(CGoGNistream& fs)
}
else
{
RegisteredBaseAttribute
*
ra
=
itAtt
->
second
;
AttributeMultiVectorGen
*
amvg
=
ra
->
addAttribute
(
*
this
,
nameAtt
);
amvg
->
loadBin
(
fs
);
if
(
typeAtt
==
"MarkerBool"
)
{
assert
(
j
<
m_tableMarkerAttribs
.
size
());
m_tableMarkerAttribs
[
j
]
->
loadBin
(
fs
);
// use j because BM are saved first
}
else
{
RegisteredBaseAttribute
*
ra
=
itAtt
->
second
;
AttributeMultiVectorGen
*
amvg
=
ra
->
addAttribute
(
*
this
,
nameAtt
);
amvg
->
loadBin
(
fs
);
}
}
}
...
...
@@ -608,31 +646,27 @@ void AttributeContainer::copyFrom(const AttributeContainer& cont)
{
if
(
cont
.
m_tableAttribs
[
i
]
!=
NULL
)
{
std
::
string
sub
=
cont
.
m_tableAttribs
[
i
]
->
getName
().
substr
(
0
,
5
);
if
(
sub
!=
"Mark_"
)
// Mark leaved by
{
AttributeMultiVectorGen
*
ptr
=
cont
.
m_tableAttribs
[
i
]
->
new_obj
();
ptr
->
setName
(
cont
.
m_tableAttribs
[
i
]
->
getName
());
ptr
->
setOrbit
(
cont
.
m_tableAttribs
[
i
]
->
getOrbit
());
ptr
->
setIndex
(
m_tableAttribs
.
size
());
ptr
->
setNbBlocks
(
cont
.
m_tableAttribs
[
i
]
->
getNbBlocks
());
ptr
->
copy
(
cont
.
m_tableAttribs
[
i
]);
m_tableAttribs
.
push_back
(
ptr
);
}
else
{
// get id of thread
const
std
::
string
&
str
=
cont
.
m_tableAttribs
[
i
]
->
getName
();
unsigned
int
thId
=
(
unsigned
int
)(
str
[
5
]
-
'0'
);
if
(
str
.
size
()
==
7
)
thId
=
10
*
thId
+
(
unsigned
int
)(
sub
[
6
]
-
'0'
);
// Mark always at the begin, because called after clear
AttributeMultiVectorGen
*
ptr
=
m_tableAttribs
[
thId
];
ptr
->
setNbBlocks
(
cont
.
m_tableAttribs
[
i
]
->
getNbBlocks
());
ptr
->
copy
(
cont
.
m_tableAttribs
[
i
]);
}
AttributeMultiVectorGen
*
ptr
=
cont
.
m_tableAttribs
[
i
]
->
new_obj
();
ptr
->
setName
(
cont
.
m_tableAttribs
[
i
]
->
getName
());
ptr
->
setOrbit
(
cont
.
m_tableAttribs
[
i
]
->
getOrbit
());
ptr
->
setIndex
(
m_tableAttribs
.
size
());
ptr
->
setNbBlocks
(
cont
.
m_tableAttribs
[
i
]
->
getNbBlocks
());
ptr
->
copy
(
cont
.
m_tableAttribs
[
i
]);
m_tableAttribs
.
push_back
(
ptr
);
}
}
sz
=
cont
.
m_tableMarkerAttribs
.
size
();
for
(
unsigned
int
i
=
0
;
i
<
sz
;
++
i
)
{
AttributeMultiVector
<
MarkerBool
>*
ptr
=
new
AttributeMultiVector
<
MarkerBool
>
;
ptr
->
setTypeName
(
cont
.
m_tableMarkerAttribs
[
i
]
->
getTypeName
());
ptr
->
setName
(
cont
.
m_tableMarkerAttribs
[
i
]
->
getName
());
ptr
->
setOrbit
(
cont
.
m_tableMarkerAttribs
[
i
]
->
getOrbit
());
ptr
->
setIndex
(
m_tableMarkerAttribs
.
size
());
ptr
->
setNbBlocks
(
cont
.
m_tableMarkerAttribs
[
i
]
->
getNbBlocks
());
ptr
->
copy
(
cont
.
m_tableMarkerAttribs
[
i
]);
m_tableMarkerAttribs
.
push_back
(
ptr
);
}
}
void
AttributeContainer
::
dumpCSV
()
const
...
...
@@ -645,6 +679,10 @@ void AttributeContainer::dumpCSV() const
CGoGNout
<<
m_tableAttribs
[
i
]
->
getName
()
<<
" ; "
;
}
}
for
(
unsigned
int
i
=
0
;
i
<
m_tableMarkerAttribs
.
size
();
++
i
)
{
CGoGNout
<<
m_tableMarkerAttribs
[
i
]
->
getName
()
<<
" ; "
;
}
CGoGNout
<<
CGoGNendl
;
CGoGNout
<<
"Type ; ;"
;
for
(
unsigned
int
i
=
0
;
i
<
m_tableAttribs
.
size
();
++
i
)
...
...
@@ -654,6 +692,10 @@ void AttributeContainer::dumpCSV() const
CGoGNout
<<
m_tableAttribs
[
i
]
->
getTypeName
()
<<
" ; "
;
}
}
for
(
unsigned
int
i
=
0
;
i
<
m_tableMarkerAttribs
.
size
();
++
i
)
{
CGoGNout
<<
m_tableMarkerAttribs
[
i
]
->
getTypeName
()
<<
" ; "
;
}
CGoGNout
<<
CGoGNendl
;
CGoGNout
<<
"line ; refs ;"
;
for
(
unsigned
int
i
=
0
;
i
<
m_tableAttribs
.
size
();
++
i
)
...
...
@@ -663,6 +705,10 @@ void AttributeContainer::dumpCSV() const
CGoGNout
<<
"value;"
;
}
}
for
(
unsigned
int
i
=
0
;
i
<
m_tableMarkerAttribs
.
size
();
++
i
)
{
CGoGNout
<<
"value;"
;
}
CGoGNout
<<
CGoGNendl
;
for
(
unsigned
int
l
=
this
->
begin
();
l
!=
this
->
end
();
this
->
next
(
l
))
...
...
@@ -676,6 +722,12 @@ void AttributeContainer::dumpCSV() const
CGoGNout
<<
" ; "
;
}
}
for
(
unsigned
int
i
=
0
;
i
<
m_tableMarkerAttribs
.
size
();
++
i
)
{
m_tableMarkerAttribs
[
i
]
->
dump
(
l
);
CGoGNout
<<
" ; "
;
}
CGoGNout
<<
CGoGNendl
;
}
CGoGNout
<<
CGoGNendl
;
...
...
@@ -696,9 +748,18 @@ void AttributeContainer::dumpByLines() const
m_tableAttribs
[
i
]
->
dump
(
l
);
CGoGNout
<<
CGoGNendl
;
}
}
}
for
(
unsigned
int
i
=
0
;
i
<
m_tableMarkerAttribs
.
size
();
++
i
)
{
CGoGNout
<<
"Name: "
<<
m_tableMarkerAttribs
[
i
]
->
getName
();
CGoGNout
<<
" / Type: "
<<
m_tableMarkerAttribs
[
i
]
->
getTypeName
();
for
(
unsigned
int
l
=
this
->
begin
();
l
!=
this
->
end
();
this
->
next
(
l
))
{
CGoGNout
<<
l
<<
" ; "
;
m_tableMarkerAttribs
[
i
]
->
dump
(
l
);
CGoGNout
<<
CGoGNendl
;
}
}
}
...
...
@@ -732,4 +793,56 @@ AttributeMultiVectorGen* AttributeContainer::addAttribute(const std::string& typ
}
AttributeMultiVector
<
MarkerBool
>*
AttributeContainer
::
addMarkerAttribute
(
const
std
::
string
&
attribName
)
{
// first check if attribute already exist
unsigned
int
index
;
if
(
attribName
!=
""
)
{
index
=
getAttributeIndex
(
attribName
)
;
if
(
index
!=
UNKNOWN
)
{
std
::
cout
<<
"attribute "
<<
attribName
<<
" already found.."
<<
std
::
endl
;
return
NULL
;
}
}
// create the new attribute
AttributeMultiVector
<
MarkerBool
>*
amv
=
new
AttributeMultiVector
<
MarkerBool
>
(
attribName
,
"MarkerBool"
)
;
index
=
m_tableMarkerAttribs
.
size
()
;
m_tableMarkerAttribs
.
push_back
(
amv
)
;
amv
->
setOrbit
(
m_orbit
)
;
amv
->
setIndex
(
index
)
;
// resize the new attribute so that it has the same size than others
amv
->
setNbBlocks
(
m_holesBlocks
.
size
())
;
return
amv
;
}
bool
AttributeContainer
::
removeMarkerAttribute
(
const
std
::
string
&
attribName
)
{
unsigned
int
index
;
bool
found
=
false
;
for
(
index
=
0
;
index
<
m_tableAttribs
.
size
()
&&
!
found
;
++
index
)
{
if
(
m_tableMarkerAttribs
[
index
]
->
getName
()
==
attribName
)
found
=
true
;
}
if
(
!
found
)
return
false
;
index
--
;
// because of for loop
delete
m_tableMarkerAttribs
[
index
]
;
m_tableMarkerAttribs
[
index
]
=
m_tableMarkerAttribs
.
back
()
;
m_tableMarkerAttribs
.
pop_back
()
;
return
true
;
}
}
//namespace CGoGN
src/Topology/generic/genericmap.cpp
View file @
549f0bff
...
...
@@ -235,8 +235,8 @@ void GenericMap::init(bool addBoundaryMarkers)
if
(
addBoundaryMarkers
)
{
m_boundaryMarkers
[
0
]
=
m_attribs
[
DART
].
add
Attribute
<
MarkerBool
>
(
"BoundaryMark0"
)
;
m_boundaryMarkers
[
1
]
=
m_attribs
[
DART
].
add
Attribute
<
MarkerBool
>
(
"BoundaryMark1"
)
;
m_boundaryMarkers
[
0
]
=
m_attribs
[
DART
].
add
MarkerAttribute
(
"BoundaryMark0"
)
;
m_boundaryMarkers
[
1
]
=
m_attribs
[
DART
].
add
MarkerAttribute
(
"BoundaryMark1"
)
;
}
...
...
@@ -405,17 +405,16 @@ void GenericMap::restore_shortcuts()
}
// MARKERS
m_attribs
[
DART
].
getAttributesNames
(
listeNames
);
for
(
unsigned
int
i
=
0
;
i
<
listeNames
.
size
();
++
i
)
std
::
vector
<
AttributeMultiVector
<
MarkerBool
>*>&
amvv
=
m_attribs
[
DART
].
getMarkerAttributes
();
for
(
auto
it
=
amvv
.
begin
();
it
!=
amvv
.
end
();
++
it
)
{
if
(
listeNames
[
i
]
==
"BoundaryMark0"
)
m_boundaryMarkers
[
0
]
=
cont
.
getDataVector
<
MarkerBool
>
(
i
);
if
(
listeNames
[
i
]
==
"BoundaryMark1"
)
m_boundaryMarkers
[
1
]
=
cont
.
getDataVector
<
MarkerBool
>
(
i
);
if
((
*
it
)
->
getName
()
==
"BoundaryMark0"
)
m_boundaryMarkers
[
0
]
=
*
it
;
if
((
*
it
)
->
getName
()
==
"BoundaryMark1"
)
m_boundaryMarkers
[
1
]
=
*
it
;
}
// QUICK TRAVERSAL
for
(
unsigned
int
orbit
=
0
;
orbit
<
NB_ORBITS
;
++
orbit
)
...
...
@@ -603,17 +602,20 @@ void GenericMap::garbageMarkVectors()
for
(
unsigned
int
orbit
=
0
;
orbit
<
NB_ORBITS
;
++
orbit
)
{
std
::
vector
<
std
::
string
>
attNames
;
m_attribs
[
orbit
].
getAttributesNames
(
attNames
);
for
(
auto
sit
=
attNames
.
begin
();
sit
!=
attNames
.
end
();
++
sit
)
std
::
vector
<
AttributeMultiVector
<
MarkerBool
>*>&
amvv
=
m_attribs
[
orbit
].
getMarkerAttributes
()
;
for
(
auto
it
=
amvv
.
begin
();
it
!=
amvv
.
end
();
++
it
)
{
if
(
sit
->
substr
(
0
,
7
)
==
"marker_"
)
AttributeMultiVector
<
MarkerBool
>*
amv
=
*
it
;
const
std
::
string
&
name
=
amv
->
getName
();
if
(
name
.
substr
(
0
,
7
)
==
"marker_"
)
{
std
::
string
num
=
sit
->
substr
(
sit
->
length
()
-
3
,
3
);
// store tne next free index for unique numbering
std
::
string
num
=
name
.
substr
(
name
.
length
()
-
3
,
3
);
unsigned
int
id
=
100
*
(
num
[
0
]
-
'0'
)
+
10
*
(
num
[
1
]
-
'0'
)
+
(
num
[
2
]
-
'0'
);
if
(
id
>
maxId
)
maxId
=
id
;
AttributeMultiVector
<
MarkerBool
>*
amv
=
m_attribs
[
orbit
].
getDataVector
<
MarkerBool
>
(
*
sit
);
amv
->
allFalse
();
m_markVectors_free
[
orbit
][
0
].
push_back
(
amv
);
}
...
...
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