Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
David Thompson
SMTK
Commits
b6f2a8f5
Commit
b6f2a8f5
authored
Oct 29, 2013
by
David Thompson
Committed by
Kitware Robot
Oct 29, 2013
Browse files
Merge topic 'rectify-model-names'
09e12da7
Rectify method + member names to style guidelines.
parents
b7d309b3
09e12da7
Changes
16
Hide whitespace changes
Inline
Side-by-side
smtk/model/Arrangement.h
View file @
b6f2a8f5
...
...
@@ -44,7 +44,7 @@ std::string AbbreviationForArrangementKind(ArrangementKind k);
*/
struct
SMTKCORE_EXPORT
Arrangement
{
std
::
vector
<
int
>
D
etails
;
// Kind-dependent specification of the arrangement.
std
::
vector
<
int
>
d
etails
;
// Kind-dependent specification of the arrangement.
};
/// A vector of Arrangements is associated to each ModelBody entity.
...
...
smtk/model/BRepModel.cxx
View file @
b6f2a8f5
...
...
@@ -10,7 +10,7 @@ using smtk::util::UUID;
* Storage is kept separate so that it can easily be serialized and deserialized.
*/
BRepModel
::
BRepModel
()
:
T
opology
(
new
UUIDsToLinks
),
D
eleteStorage
(
true
)
:
m_t
opology
(
new
UUIDsToLinks
),
m_d
eleteStorage
(
true
)
{
// TODO: throw() when topology == NULL?
}
...
...
@@ -20,65 +20,65 @@ BRepModel::BRepModel()
* Storage is kept separate so that it can easily be serialized and deserialized.
*/
BRepModel
::
BRepModel
(
UUIDsToLinks
*
topology
,
bool
shouldDelete
)
:
T
opology
(
topology
),
D
eleteStorage
(
shouldDelete
)
:
m_t
opology
(
topology
),
m_d
eleteStorage
(
shouldDelete
)
{
}
// TODO: throw() when topology == NULL?
BRepModel
::~
BRepModel
()
{
if
(
this
->
D
eleteStorage
)
if
(
this
->
m_d
eleteStorage
)
{
delete
this
->
T
opology
;
this
->
T
opology
=
NULL
;
delete
this
->
m_t
opology
;
this
->
m_t
opology
=
NULL
;
}
}
/// Change whether or not we should delete storage upon our own destruction.
void
BRepModel
::
S
etDeleteStorage
(
bool
d
)
void
BRepModel
::
s
etDeleteStorage
(
bool
d
)
{
this
->
D
eleteStorage
=
d
;
this
->
m_d
eleteStorage
=
d
;
}
UUIDsToLinks
&
BRepModel
::
topology
()
{
return
*
this
->
T
opology
;
return
*
this
->
m_t
opology
;
}
const
UUIDsToLinks
&
BRepModel
::
topology
()
const
{
return
*
this
->
T
opology
;
return
*
this
->
m_t
opology
;
}
/// Entity construction
//@{
/// Insert a new cell of the specified \a dimension, returning an iterator with a new, unique UUID.
BRepModel
::
iter_type
BRepModel
::
I
nsertLinkOfTypeAndDimension
(
int
entityFlags
,
int
dimension
)
BRepModel
::
iter_type
BRepModel
::
i
nsertLinkOfTypeAndDimension
(
int
entityFlags
,
int
dimension
)
{
UUID
actual
;
do
{
actual
=
UUID
::
Random
();
}
while
(
this
->
T
opology
->
find
(
actual
)
!=
this
->
T
opology
->
end
());
return
this
->
S
etLinkOfTypeAndDimension
(
actual
,
entityFlags
,
dimension
);
while
(
this
->
m_t
opology
->
find
(
actual
)
!=
this
->
m_t
opology
->
end
());
return
this
->
s
etLinkOfTypeAndDimension
(
actual
,
entityFlags
,
dimension
);
}
/// Insert the specified cell, returning an iterator with a new, unique UUID.
BRepModel
::
iter_type
BRepModel
::
I
nsertLink
(
Link
&
c
)
BRepModel
::
iter_type
BRepModel
::
i
nsertLink
(
Link
&
c
)
{
UUID
actual
;
do
{
actual
=
UUID
::
Random
();
}
while
(
this
->
T
opology
->
find
(
actual
)
!=
this
->
T
opology
->
end
());
return
this
->
S
etLink
(
actual
,
c
);
while
(
this
->
m_t
opology
->
find
(
actual
)
!=
this
->
m_t
opology
->
end
());
return
this
->
s
etLink
(
actual
,
c
);
}
/**\brief Map a new cell of the given \a dimension to the \a uid.
*
* Passing a non-unique \a uid is an error here and will throw an exception.
*/
BRepModel
::
iter_type
BRepModel
::
S
etLinkOfTypeAndDimension
(
const
UUID
&
uid
,
int
entityFlags
,
int
dimension
)
BRepModel
::
iter_type
BRepModel
::
s
etLinkOfTypeAndDimension
(
const
UUID
&
uid
,
int
entityFlags
,
int
dimension
)
{
UUIDsToLinks
::
iterator
it
;
if
(
uid
.
IsNull
())
...
...
@@ -87,21 +87,21 @@ BRepModel::iter_type BRepModel::SetLinkOfTypeAndDimension(const UUID& uid, int e
msg
<<
"Nil UUID"
;
throw
msg
.
str
();
}
if
((
it
=
this
->
T
opology
->
find
(
uid
))
!=
this
->
T
opology
->
end
()
&&
it
->
second
.
dimension
()
!=
dimension
)
if
((
it
=
this
->
m_t
opology
->
find
(
uid
))
!=
this
->
m_t
opology
->
end
()
&&
it
->
second
.
dimension
()
!=
dimension
)
{
std
::
ostringstream
msg
;
msg
<<
"Duplicate UUID '"
<<
uid
<<
"' of different dimension "
<<
it
->
second
.
dimension
()
<<
" != "
<<
dimension
;
throw
msg
.
str
();
}
std
::
pair
<
UUID
,
Link
>
entry
(
uid
,
Link
(
entityFlags
,
dimension
));
return
this
->
T
opology
->
insert
(
entry
).
first
;
return
this
->
m_t
opology
->
insert
(
entry
).
first
;
}
/**\brief Map the specified cell \a c to the given \a uid.
*
* Passing a nil or non-unique \a uid is an error here and will throw an exception.
*/
BRepModel
::
iter_type
BRepModel
::
S
etLink
(
const
UUID
&
uid
,
Link
&
c
)
BRepModel
::
iter_type
BRepModel
::
s
etLink
(
const
UUID
&
uid
,
Link
&
c
)
{
UUIDsToLinks
::
iterator
it
;
if
(
uid
.
IsNull
())
...
...
@@ -110,7 +110,7 @@ BRepModel::iter_type BRepModel::SetLink(const UUID& uid, Link& c)
msg
<<
"Nil UUID"
;
throw
msg
.
str
();
}
if
((
it
=
this
->
T
opology
->
find
(
uid
))
!=
this
->
T
opology
->
end
())
if
((
it
=
this
->
m_t
opology
->
find
(
uid
))
!=
this
->
m_t
opology
->
end
())
{
if
(
it
->
second
.
dimension
()
!=
c
.
dimension
())
{
...
...
@@ -118,90 +118,90 @@ BRepModel::iter_type BRepModel::SetLink(const UUID& uid, Link& c)
msg
<<
"Duplicate UUID '"
<<
uid
<<
"' of different dimension "
<<
it
->
second
.
dimension
()
<<
" != "
<<
c
.
dimension
();
throw
msg
.
str
();
}
this
->
R
emoveLinkReferences
(
it
);
this
->
r
emoveLinkReferences
(
it
);
it
->
second
=
c
;
this
->
I
nsertLinkReferences
(
it
);
this
->
i
nsertLinkReferences
(
it
);
return
it
;
}
std
::
pair
<
UUID
,
Link
>
entry
(
uid
,
c
);
it
=
this
->
T
opology
->
insert
(
entry
).
first
;
this
->
I
nsertLinkReferences
(
it
);
it
=
this
->
m_t
opology
->
insert
(
entry
).
first
;
this
->
i
nsertLinkReferences
(
it
);
return
it
;
}
/// A wrappable version of InsertLinkOfTypeAndDimension
UUID
BRepModel
::
A
ddLinkOfTypeAndDimension
(
int
entityFlags
,
int
dim
)
UUID
BRepModel
::
a
ddLinkOfTypeAndDimension
(
int
entityFlags
,
int
dim
)
{
return
this
->
I
nsertLinkOfTypeAndDimension
(
entityFlags
,
dim
)
->
first
;
return
this
->
i
nsertLinkOfTypeAndDimension
(
entityFlags
,
dim
)
->
first
;
}
/// A wrappable version of InsertLink
UUID
BRepModel
::
A
ddLink
(
Link
&
cell
)
UUID
BRepModel
::
a
ddLink
(
Link
&
cell
)
{
return
this
->
I
nsertLink
(
cell
)
->
first
;
return
this
->
i
nsertLink
(
cell
)
->
first
;
}
/// A wrappable version of SetLinkOfTypeAndDimension
UUID
BRepModel
::
A
ddLinkOfTypeAndDimensionWithUUID
(
const
UUID
&
uid
,
int
entityFlags
,
int
dim
)
UUID
BRepModel
::
a
ddLinkOfTypeAndDimensionWithUUID
(
const
UUID
&
uid
,
int
entityFlags
,
int
dim
)
{
return
this
->
S
etLinkOfTypeAndDimension
(
uid
,
entityFlags
,
dim
)
->
first
;
return
this
->
s
etLinkOfTypeAndDimension
(
uid
,
entityFlags
,
dim
)
->
first
;
}
/// A wrappable version of SetLink
UUID
BRepModel
::
A
ddLinkWithUUID
(
const
UUID
&
uid
,
Link
&
cell
)
UUID
BRepModel
::
a
ddLinkWithUUID
(
const
UUID
&
uid
,
Link
&
cell
)
{
return
this
->
S
etLink
(
uid
,
cell
)
->
first
;
return
this
->
s
etLink
(
uid
,
cell
)
->
first
;
}
//@}
/// Shortcuts for inserting cells with default entity flags.
//@{
BRepModel
::
iter_type
BRepModel
::
I
nsertCellOfDimension
(
int
dim
)
BRepModel
::
iter_type
BRepModel
::
i
nsertCellOfDimension
(
int
dim
)
{
return
this
->
I
nsertLinkOfTypeAndDimension
(
CELL_ENTITY
,
dim
);
return
this
->
i
nsertLinkOfTypeAndDimension
(
CELL_ENTITY
,
dim
);
}
BRepModel
::
iter_type
BRepModel
::
S
etCellOfDimension
(
const
UUID
&
uid
,
int
dim
)
BRepModel
::
iter_type
BRepModel
::
s
etCellOfDimension
(
const
UUID
&
uid
,
int
dim
)
{
return
this
->
S
etLinkOfTypeAndDimension
(
uid
,
CELL_ENTITY
,
dim
);
return
this
->
s
etLinkOfTypeAndDimension
(
uid
,
CELL_ENTITY
,
dim
);
}
UUID
BRepModel
::
A
ddCellOfDimension
(
int
dim
)
UUID
BRepModel
::
a
ddCellOfDimension
(
int
dim
)
{
return
this
->
A
ddLinkOfTypeAndDimension
(
CELL_ENTITY
,
dim
);
return
this
->
a
ddLinkOfTypeAndDimension
(
CELL_ENTITY
,
dim
);
}
UUID
BRepModel
::
A
ddCellOfDimensionWithUUID
(
const
UUID
&
uid
,
int
dim
)
UUID
BRepModel
::
a
ddCellOfDimensionWithUUID
(
const
UUID
&
uid
,
int
dim
)
{
return
this
->
A
ddLinkOfTypeAndDimensionWithUUID
(
uid
,
CELL_ENTITY
,
dim
);
return
this
->
a
ddLinkOfTypeAndDimensionWithUUID
(
uid
,
CELL_ENTITY
,
dim
);
}
//@}
/// Queries on entities belonging to the solid.
//@{
/// Return the type of entity that the link represents.
int
BRepModel
::
T
ype
(
const
smtk
::
util
::
UUID
&
ofEntity
)
int
BRepModel
::
t
ype
(
const
smtk
::
util
::
UUID
&
ofEntity
)
{
UUIDsToLinks
::
iterator
it
=
this
->
T
opology
->
find
(
ofEntity
);
return
(
it
==
this
->
T
opology
->
end
()
?
INVALID
:
it
->
second
.
entityFlags
());
UUIDsToLinks
::
iterator
it
=
this
->
m_t
opology
->
find
(
ofEntity
);
return
(
it
==
this
->
m_t
opology
->
end
()
?
INVALID
:
it
->
second
.
entityFlags
());
}
/// Return the dimension of the manifold that the passed entity represents.
int
BRepModel
::
D
imension
(
const
UUID
&
ofEntity
)
int
BRepModel
::
d
imension
(
const
UUID
&
ofEntity
)
{
UUIDsToLinks
::
iterator
it
=
this
->
T
opology
->
find
(
ofEntity
);
return
(
it
==
this
->
T
opology
->
end
()
?
-
1
:
it
->
second
.
dimension
());
UUIDsToLinks
::
iterator
it
=
this
->
m_t
opology
->
find
(
ofEntity
);
return
(
it
==
this
->
m_t
opology
->
end
()
?
-
1
:
it
->
second
.
dimension
());
}
/**\brief Return the (Dimension+1 or higher)-entities that are the immediate bordants of the passed entity.
*
* \sa HigherDimensionalBoundaries
*/
UUIDs
BRepModel
::
B
ordantEntities
(
const
UUID
&
ofEntity
,
int
ofDimension
)
UUIDs
BRepModel
::
b
ordantEntities
(
const
UUID
&
ofEntity
,
int
ofDimension
)
{
UUIDs
result
;
UUIDsToLinks
::
iterator
it
=
this
->
T
opology
->
find
(
ofEntity
);
if
(
it
==
this
->
T
opology
->
end
())
UUIDsToLinks
::
iterator
it
=
this
->
m_t
opology
->
find
(
ofEntity
);
if
(
it
==
this
->
m_t
opology
->
end
())
{
return
result
;
}
...
...
@@ -213,8 +213,8 @@ UUIDs BRepModel::BordantEntities(const UUID& ofEntity, int ofDimension)
UUIDsToLinks
::
iterator
other
;
for
(
UUIDArray
::
iterator
ai
=
it
->
second
.
relations
().
begin
();
ai
!=
it
->
second
.
relations
().
end
();
++
ai
)
{
other
=
this
->
T
opology
->
find
(
*
ai
);
if
(
other
==
this
->
T
opology
->
end
())
other
=
this
->
m_t
opology
->
find
(
*
ai
);
if
(
other
==
this
->
m_t
opology
->
end
())
{
// TODO: silently skip bad relations or complain?
continue
;
}
...
...
@@ -232,13 +232,13 @@ UUIDs BRepModel::BordantEntities(const UUID& ofEntity, int ofDimension)
*
* \sa HigherDimensionalBoundaries
*/
UUIDs
BRepModel
::
B
ordantEntities
(
const
UUIDs
&
ofEntities
,
int
ofDimension
)
UUIDs
BRepModel
::
b
ordantEntities
(
const
UUIDs
&
ofEntities
,
int
ofDimension
)
{
UUIDs
result
;
std
::
insert_iterator
<
UUIDs
>
inserter
(
result
,
result
.
begin
());
for
(
UUIDs
::
iterator
it
=
ofEntities
.
begin
();
it
!=
ofEntities
.
end
();
++
it
)
{
UUIDs
bdy
=
this
->
B
ordantEntities
(
*
it
,
ofDimension
);
UUIDs
bdy
=
this
->
b
ordantEntities
(
*
it
,
ofDimension
);
std
::
copy
(
bdy
.
begin
(),
bdy
.
end
(),
inserter
);
}
return
result
;
...
...
@@ -248,11 +248,11 @@ UUIDs BRepModel::BordantEntities(const UUIDs& ofEntities, int ofDimension)
*
* \sa LowerDimensionalBoundaries
*/
UUIDs
BRepModel
::
B
oundaryEntities
(
const
UUID
&
ofEntity
,
int
ofDimension
)
UUIDs
BRepModel
::
b
oundaryEntities
(
const
UUID
&
ofEntity
,
int
ofDimension
)
{
UUIDs
result
;
UUIDsToLinks
::
iterator
it
=
this
->
T
opology
->
find
(
ofEntity
);
if
(
it
==
this
->
T
opology
->
end
())
UUIDsToLinks
::
iterator
it
=
this
->
m_t
opology
->
find
(
ofEntity
);
if
(
it
==
this
->
m_t
opology
->
end
())
{
return
result
;
}
...
...
@@ -264,8 +264,8 @@ UUIDs BRepModel::BoundaryEntities(const UUID& ofEntity, int ofDimension)
UUIDsToLinks
::
iterator
other
;
for
(
UUIDArray
::
iterator
ai
=
it
->
second
.
relations
().
begin
();
ai
!=
it
->
second
.
relations
().
end
();
++
ai
)
{
other
=
this
->
T
opology
->
find
(
*
ai
);
if
(
other
==
this
->
T
opology
->
end
())
other
=
this
->
m_t
opology
->
find
(
*
ai
);
if
(
other
==
this
->
m_t
opology
->
end
())
{
// TODO: silently skip bad relations or complain?
continue
;
}
...
...
@@ -283,13 +283,13 @@ UUIDs BRepModel::BoundaryEntities(const UUID& ofEntity, int ofDimension)
*
* \sa LowerDimensionalBoundaries
*/
UUIDs
BRepModel
::
B
oundaryEntities
(
const
UUIDs
&
ofEntities
,
int
ofDimension
)
UUIDs
BRepModel
::
b
oundaryEntities
(
const
UUIDs
&
ofEntities
,
int
ofDimension
)
{
UUIDs
result
;
std
::
insert_iterator
<
UUIDs
>
inserter
(
result
,
result
.
begin
());
for
(
UUIDs
::
iterator
it
=
ofEntities
.
begin
();
it
!=
ofEntities
.
end
();
++
it
)
{
UUIDs
bdy
=
this
->
B
oundaryEntities
(
*
it
,
ofDimension
);
UUIDs
bdy
=
this
->
b
oundaryEntities
(
*
it
,
ofDimension
);
std
::
copy
(
bdy
.
begin
(),
bdy
.
end
(),
inserter
);
}
return
result
;
...
...
@@ -298,7 +298,7 @@ UUIDs BRepModel::BoundaryEntities(const UUIDs& ofEntities, int ofDimension)
/**\brief Return lower-dimensional boundaries of the passed d-dimensional entity.
*
* \a lowerDimension may be any dimension < d.
* Unlike BRepModel::
B
oundaryEntities(), this method will search the boundaries
* Unlike BRepModel::
b
oundaryEntities(), this method will search the boundaries
* of the entity's boundaries.
* For example, a 2-dimensional face normally stores 1-dimensional edges
* as its immediate boundaries, so if BoundaryEntities() is asked for 0-dimensional
...
...
@@ -310,11 +310,11 @@ UUIDs BRepModel::BoundaryEntities(const UUIDs& ofEntities, int ofDimension)
* Passing -1 will return all boundary entities of the specified entity,
* regardless of their dimension.
*/
UUIDs
BRepModel
::
L
owerDimensionalBoundaries
(
const
UUID
&
ofEntity
,
int
lowerDimension
)
UUIDs
BRepModel
::
l
owerDimensionalBoundaries
(
const
UUID
&
ofEntity
,
int
lowerDimension
)
{
UUIDs
result
;
UUIDsToLinks
::
iterator
it
=
this
->
T
opology
->
find
(
ofEntity
);
if
(
it
==
this
->
T
opology
->
end
())
UUIDsToLinks
::
iterator
it
=
this
->
m_t
opology
->
find
(
ofEntity
);
if
(
it
==
this
->
m_t
opology
->
end
())
{
return
result
;
}
...
...
@@ -330,10 +330,10 @@ UUIDs BRepModel::LowerDimensionalBoundaries(const UUID& ofEntity, int lowerDimen
// relations that match lowerDimension as we go.
int
currentDim
=
it
->
second
.
dimension
()
-
1
;
int
delta
=
currentDim
-
lowerDimension
;
result
=
this
->
B
oundaryEntities
(
ofEntity
,
currentDim
--
);
result
=
this
->
b
oundaryEntities
(
ofEntity
,
currentDim
--
);
for
(
int
i
=
delta
;
i
>
0
;
--
i
,
--
currentDim
)
{
result
=
this
->
B
oundaryEntities
(
result
,
currentDim
);
result
=
this
->
b
oundaryEntities
(
result
,
currentDim
);
}
}
return
result
;
...
...
@@ -342,7 +342,7 @@ UUIDs BRepModel::LowerDimensionalBoundaries(const UUID& ofEntity, int lowerDimen
/**\brief Return higher-dimensional bordants of the passed d-dimensional entity.
*
* \a higherDimension may be any dimension > d.
* Unlike BRepModel::
B
ordantEntities(), this method will search the bordants
* Unlike BRepModel::
b
ordantEntities(), this method will search the bordants
* of the entity's immediate bordants.
* For example, a 1-dimensional edge normally stores 2-dimensional faces
* as its immediate bordants, so if BoundaryEntities() is asked for 3-dimensional
...
...
@@ -354,11 +354,11 @@ UUIDs BRepModel::LowerDimensionalBoundaries(const UUID& ofEntity, int lowerDimen
* Passing -1 will return all bordant entities of the specified entity,
* regardless of their dimension.
*/
UUIDs
BRepModel
::
H
igherDimensionalBordants
(
const
UUID
&
ofEntity
,
int
higherDimension
)
UUIDs
BRepModel
::
h
igherDimensionalBordants
(
const
UUID
&
ofEntity
,
int
higherDimension
)
{
UUIDs
result
;
UUIDsToLinks
::
iterator
it
=
this
->
T
opology
->
find
(
ofEntity
);
if
(
it
==
this
->
T
opology
->
end
())
UUIDsToLinks
::
iterator
it
=
this
->
m_t
opology
->
find
(
ofEntity
);
if
(
it
==
this
->
m_t
opology
->
end
())
{
return
result
;
}
...
...
@@ -370,17 +370,17 @@ UUIDs BRepModel::HigherDimensionalBordants(const UUID& ofEntity, int higherDimen
{
int
currentDim
=
it
->
second
.
dimension
()
+
1
;
int
delta
=
higherDimension
-
currentDim
;
result
=
this
->
B
ordantEntities
(
ofEntity
,
currentDim
++
);
result
=
this
->
b
ordantEntities
(
ofEntity
,
currentDim
++
);
for
(
int
i
=
delta
;
i
>
0
;
--
i
,
++
currentDim
)
{
result
=
this
->
B
ordantEntities
(
result
,
currentDim
);
result
=
this
->
b
ordantEntities
(
result
,
currentDim
);
}
}
return
result
;
}
/// Return entities of the requested dimension that share a boundary relationship with the passed entity.
UUIDs
BRepModel
::
A
djacentEntities
(
const
UUID
&
ofEntity
,
int
ofDimension
)
UUIDs
BRepModel
::
a
djacentEntities
(
const
UUID
&
ofEntity
,
int
ofDimension
)
{
// FIXME: Implement adjacency
(
void
)
ofEntity
;
...
...
@@ -390,10 +390,10 @@ UUIDs BRepModel::AdjacentEntities(const UUID& ofEntity, int ofDimension)
}
/// Return all entities of the requested dimension that are present in the solid.
UUIDs
BRepModel
::
E
ntities
(
int
ofDimension
)
UUIDs
BRepModel
::
e
ntities
(
int
ofDimension
)
{
UUIDs
result
;
for
(
UUIDWithLink
it
=
this
->
T
opology
->
begin
();
it
!=
this
->
T
opology
->
end
();
++
it
)
for
(
UUIDWithLink
it
=
this
->
m_t
opology
->
begin
();
it
!=
this
->
m_t
opology
->
end
();
++
it
)
{
if
(
it
->
second
.
dimension
()
==
ofDimension
)
{
...
...
@@ -404,33 +404,33 @@ UUIDs BRepModel::Entities(int ofDimension)
}
//@}
const
Link
*
BRepModel
::
F
indLink
(
const
UUID
&
uid
)
const
const
Link
*
BRepModel
::
f
indLink
(
const
UUID
&
uid
)
const
{
UUIDWithLink
it
=
this
->
T
opology
->
find
(
uid
);
if
(
it
==
this
->
T
opology
->
end
())
UUIDWithLink
it
=
this
->
m_t
opology
->
find
(
uid
);
if
(
it
==
this
->
m_t
opology
->
end
())
{
return
NULL
;
}
return
&
it
->
second
;
}
Link
*
BRepModel
::
F
indLink
(
const
UUID
&
uid
)
Link
*
BRepModel
::
f
indLink
(
const
UUID
&
uid
)
{
UUIDWithLink
it
=
this
->
T
opology
->
find
(
uid
);
if
(
it
==
this
->
T
opology
->
end
())
UUIDWithLink
it
=
this
->
m_t
opology
->
find
(
uid
);
if
(
it
==
this
->
m_t
opology
->
end
())
{
return
NULL
;
}
return
&
it
->
second
;
}
void
BRepModel
::
R
emoveLinkReferences
(
const
UUIDWithLink
&
c
)
void
BRepModel
::
r
emoveLinkReferences
(
const
UUIDWithLink
&
c
)
{
UUIDArray
::
const_iterator
bit
;
Link
*
ref
;
for
(
bit
=
c
->
second
.
relations
().
begin
();
bit
!=
c
->
second
.
relations
().
end
();
++
bit
)
{
ref
=
this
->
F
indLink
(
*
bit
);
ref
=
this
->
f
indLink
(
*
bit
);
if
(
ref
)
{
ref
->
removeRelation
(
c
->
first
);
...
...
@@ -438,13 +438,13 @@ void BRepModel::RemoveLinkReferences(const UUIDWithLink& c)
}
}
void
BRepModel
::
I
nsertLinkReferences
(
const
UUIDWithLink
&
c
)
void
BRepModel
::
i
nsertLinkReferences
(
const
UUIDWithLink
&
c
)
{
UUIDArray
::
const_iterator
bit
;
Link
*
ref
;
for
(
bit
=
c
->
second
.
relations
().
begin
();
bit
!=
c
->
second
.
relations
().
end
();
++
bit
)
{
ref
=
this
->
F
indLink
(
*
bit
);
ref
=
this
->
f
indLink
(
*
bit
);
if
(
ref
)
{
ref
->
appendRelation
(
c
->
first
);
...
...
smtk/model/BRepModel.h
View file @
b6f2a8f5
...
...
@@ -35,47 +35,45 @@ public:
std
::
map
<
smtk
::
util
::
UUID
,
Link
>&
topology
();
const
std
::
map
<
smtk
::
util
::
UUID
,
Link
>&
topology
()
const
;
int
Type
(
const
smtk
::
util
::
UUID
&
ofEntity
);
int
Dimension
(
const
smtk
::
util
::
UUID
&
ofEntity
);
const
Link
*
FindLink
(
const
smtk
::
util
::
UUID
&
uid
)
const
;
Link
*
FindLink
(
const
smtk
::
util
::
UUID
&
uid
);
UUIDs
BordantEntities
(
const
smtk
::
util
::
UUID
&
ofEntity
,
int
ofDimension
=
-
2
);
UUIDs
BordantEntities
(
const
UUIDs
&
ofEntities
,
int
ofDimension
=
-
2
);
UUIDs
BoundaryEntities
(
const
smtk
::
util
::
UUID
&
ofEntity
,
int
ofDimension
=
-
2
);
UUIDs
BoundaryEntities
(
const
UUIDs
&
ofEntities
,
int
ofDimension
=
-
2
);
UUIDs
LowerDimensionalBoundaries
(
const
smtk
::
util
::
UUID
&
ofEntity
,
int
lowerDimension
);
UUIDs
HigherDimensionalBordants
(
const
smtk
::
util
::
UUID
&
ofEntity
,
int
higherDimension
);
UUIDs
AdjacentEntities
(
const
smtk
::
util
::
UUID
&
ofEntity
,
int
ofDimension
);
UUIDs
Entities
(
int
ofDimension
);
iter_type
InsertLinkOfTypeAndDimension
(
int
entityFlags
,
int
dim
);
iter_type
InsertLink
(
Link
&
cell
);
iter_type
SetLinkOfTypeAndDimension
(
const
smtk
::
util
::
UUID
&
uid
,
int
entityFlags
,
int
dim
);
iter_type
SetLink
(
const
smtk
::
util
::
UUID
&
uid
,
Link
&
cell
);
smtk
::
util
::
UUID
AddLinkOfTypeAndDimension
(
int
entityFlags
,
int
dim
);
smtk
::
util
::
UUID
AddLink
(
Link
&
cell
);
smtk
::
util
::
UUID
AddLinkOfTypeAndDimensionWithUUID
(
const
smtk
::
util
::
UUID
&
uid
,
int
entityFlags
,
int
dim
);
smtk
::
util
::
UUID
AddLinkWithUUID
(
const
smtk
::
util
::
UUID
&
uid
,
Link
&
cell
);
/// Shortcuts for inserting cells with default entity flags.
//@{
iter_type
InsertCellOfDimension
(
int
dim
);
iter_type
SetCellOfDimension
(
const
smtk
::
util
::
UUID
&
uid
,
int
dim
);
smtk
::
util
::
UUID
AddCellOfDimension
(
int
dim
);
smtk
::
util
::
UUID
AddCellOfDimensionWithUUID
(
const
smtk
::
util
::
UUID
&
uid
,
int
dim
);
//@}
void
InsertLinkReferences
(
const
UUIDWithLink
&
c
);
void
RemoveLinkReferences
(
const
UUIDWithLink
&
c
);
void
SetDeleteStorage
(
bool
d
);
int
type
(
const
smtk
::
util
::
UUID
&
ofEntity
);
int
dimension
(
const
smtk
::
util
::
UUID
&
ofEntity
);
const
Link
*
findLink
(
const
smtk
::
util
::
UUID
&
uid
)
const
;
Link
*
findLink
(
const
smtk
::
util
::
UUID
&
uid
);
UUIDs
bordantEntities
(
const
smtk
::
util
::
UUID
&
ofEntity
,
int
ofDimension
=
-
2
);
UUIDs
bordantEntities
(
const
UUIDs
&
ofEntities
,
int
ofDimension
=
-
2
);
UUIDs
boundaryEntities
(
const
smtk
::
util
::
UUID
&
ofEntity
,
int
ofDimension
=
-
2
);
UUIDs
boundaryEntities
(
const
UUIDs
&
ofEntities
,
int
ofDimension
=
-
2
);
UUIDs
lowerDimensionalBoundaries
(
const
smtk
::
util
::
UUID
&
ofEntity
,
int
lowerDimension
);
UUIDs
higherDimensionalBordants
(
const
smtk
::
util
::
UUID
&
ofEntity
,
int
higherDimension
);
UUIDs
adjacentEntities
(
const
smtk
::
util
::
UUID
&
ofEntity
,
int
ofDimension
);
UUIDs
entities
(
int
ofDimension
);
iter_type
insertLinkOfTypeAndDimension
(
int
entityFlags
,
int
dim
);
iter_type
insertLink
(
Link
&
cell
);
iter_type
setLinkOfTypeAndDimension
(
const
smtk
::
util
::
UUID
&
uid
,
int
entityFlags
,
int
dim
);
iter_type
setLink
(
const
smtk
::
util
::
UUID
&
uid
,
Link
&
cell
);
smtk
::
util
::
UUID
addLinkOfTypeAndDimension
(
int
entityFlags
,
int
dim
);
smtk
::
util
::
UUID
addLink
(
Link
&
cell
);
smtk
::
util
::
UUID
addLinkOfTypeAndDimensionWithUUID
(
const
smtk
::
util
::
UUID
&
uid
,
int
entityFlags
,
int
dim
);
smtk
::
util
::
UUID
addLinkWithUUID
(
const
smtk
::
util
::
UUID
&
uid
,
Link
&
cell
);
iter_type
insertCellOfDimension
(
int
dim
);
iter_type
setCellOfDimension
(
const
smtk
::
util
::
UUID
&
uid
,
int
dim
);
smtk
::
util
::
UUID
addCellOfDimension
(
int
dim
);
smtk
::
util
::
UUID
addCellOfDimensionWithUUID
(
const
smtk
::
util
::
UUID
&
uid
,
int
dim
);
void
insertLinkReferences
(
const
UUIDWithLink
&
c
);
void
removeLinkReferences
(
const
UUIDWithLink
&
c
);
void
setDeleteStorage
(
bool
d
);
protected:
UUIDsToLinks
*
T
opology
;
bool
D
eleteStorage
;
UUIDsToLinks
*
m_t
opology
;
bool
m_d
eleteStorage
;
};
}
// model namespace
...
...
smtk/model/ExportJSON.cxx
View file @
b6f2a8f5
...
...
@@ -25,7 +25,7 @@ namespace smtk {
using
smtk
::
util
::
UUID
;
cJSON
*
ExportJSON
::
F
romUUIDs
(
const
UUIDs
&
uids
)
cJSON
*
ExportJSON
::
f
romUUIDs
(
const
UUIDs
&
uids
)
{
cJSON
*
a
=
cJSON_CreateArray
();
for
(
UUIDs
::
iterator
it
=
uids
.
begin
();
it
!=
uids
.
end
();
++
it
)
...
...
@@ -35,7 +35,7 @@ cJSON* ExportJSON::FromUUIDs(const UUIDs& uids)
return
a
;
}
int
ExportJSON
::
F
romModel
(
cJSON
*
json
,
ModelBody
*
model
)
int
ExportJSON
::
f
romModel
(
cJSON
*
json
,
ModelBody
*
model
)
{
int
status
=
0
;
if
(
!
json
||
!
model
)
...
...
@@ -64,12 +64,12 @@ int ExportJSON::FromModel(cJSON* json, ModelBody* model)
cJSON
*
mtyp
=
cJSON_CreateString
(
"ModelBody"
);
cJSON_AddItemToObject
(
json
,
"type"
,
mtyp
);
status
=
ExportJSON
::
F
orModelBody
(
body
,
model
);
status
=
ExportJSON
::
f
orModelBody
(
body
,
model
);
return
status
;
}
int
ExportJSON
::
F
orModelBody
(
int
ExportJSON
::
f
orModelBody
(
cJSON
*
dict
,
ModelBody
*
model
)
{
if
(
!
dict
||
!
model
)
...
...
@@ -85,15 +85,15 @@ int ExportJSON::ForModelBody(
std
::
string
suid
=
it
->
first
.
ToString
();
cJSON_AddItemToObject
(
dict
,
suid
.
c_str
(),
curChild
);
}
status
&=
ExportJSON
::
F
orModelBodyLink
(
it
,
curChild
,
model
);
status
&=
ExportJSON
::
F
orModelBodyArrangement
(
status
&=
ExportJSON
::
f
orModelBodyLink
(
it
,
curChild
,
model
);
status
&=
ExportJSON
::
f
orModelBodyArrangement
(
model
->
arrangements
().
find
(
it
->
first
),
curChild
,
model
);
status
&=
ExportJSON
::
F
orModelBodyTessellation
(
it
->
first
,
curChild
,
model
);
status
&=
ExportJSON
::
f
orModelBodyTessellation
(
it
->
first
,
curChild
,
model
);
}