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
aeva
graph
Commits
d35bbcf9
Commit
d35bbcf9
authored
Mar 19, 2022
by
David Thompson
Browse files
Use the new graph-resource `::initialize()`.
parent
e984306e
Changes
67
Hide whitespace changes
Inline
Side-by-side
smtk/markup/AnalyticShape.cxx
View file @
d35bbcf9
...
...
@@ -8,6 +8,9 @@ namespace markup
AnalyticShape
::~
AnalyticShape
()
=
default
;
void
AnalyticShape
::
initialize
(
const
nlohmann
::
json
&
data
,
json
::
Helper
&
helper
)
{
}
}
// namespace markup
}
// namespace smtk
smtk/markup/AnalyticShape.h
View file @
d35bbcf9
...
...
@@ -22,14 +22,11 @@ public:
{
}
template
<
typename
...
Args
>
AnalyticShape
(
const
nlohmann
::
json
*
j
,
Args
&&
...
args
)
:
smtk
::
markup
::
SpatialData
(
std
::
forward
<
Args
>
(
args
)...)
{
}
~
AnalyticShape
()
override
;
/// Provide an initializer for resources to call after construction.
void
initialize
(
const
nlohmann
::
json
&
data
,
json
::
Helper
&
helper
)
override
;
protected:
};
...
...
smtk/markup/BoundaryOperator.cxx
View file @
d35bbcf9
...
...
@@ -6,8 +6,17 @@ namespace smtk
namespace
markup
{
BoundaryOperator
::~
BoundaryOperator
()
=
default
;
BoundaryOperator
::
BoundaryOperator
(
smtk
::
string
::
Token
name
)
:
Domain
(
name
)
{
// TODO: create mapping?
}
BoundaryOperator
::
BoundaryOperator
(
const
nlohmann
::
json
&
data
)
:
Domain
(
data
)
{
// TODO: Deserialize or create mapping
}
}
// namespace markup
}
// namespace smtk
smtk/markup/BoundaryOperator.h
View file @
d35bbcf9
...
...
@@ -16,19 +16,10 @@ public:
smtkTypeMacro
(
smtk
::
markup
::
BoundaryOperator
);
smtkSuperclassMacro
(
smtk
::
markup
::
Domain
);
template
<
typename
...
Args
>
BoundaryOperator
(
Args
&&
...
args
)
:
smtk
::
markup
::
Domain
(
std
::
forward
<
Args
>
(
args
)...)
{
}
template
<
typename
...
Args
>
BoundaryOperator
(
const
nlohmann
::
json
*
,
Args
&&
...
args
)
:
smtk
::
markup
::
Domain
(
std
::
forward
<
Args
>
(
args
)...)
{
}
~
BoundaryOperator
()
override
;
BoundaryOperator
()
=
default
;
BoundaryOperator
(
smtk
::
string
::
Token
name
);
BoundaryOperator
(
const
nlohmann
::
json
&
data
);
~
BoundaryOperator
()
override
=
default
;
protected:
};
...
...
smtk/markup/Box.cxx
View file @
d35bbcf9
...
...
@@ -8,6 +8,10 @@ namespace markup
Box
::~
Box
()
=
default
;
void
Box
::
initialize
(
const
nlohmann
::
json
&
data
,
json
::
Helper
&
helper
)
{
}
bool
Box
::
setRange
(
const
std
::
array
<
std
::
array
<
double
,
3
>
,
2
>&
range
)
{
if
(
m_range
==
range
)
...
...
smtk/markup/Box.h
View file @
d35bbcf9
...
...
@@ -22,14 +22,11 @@ public:
{
}
template
<
typename
...
Args
>
Box
(
const
nlohmann
::
json
*
j
,
Args
&&
...
args
)
:
smtk
::
markup
::
AnalyticShape
(
std
::
forward
<
Args
>
(
args
)...)
{
}
~
Box
()
override
;
/// Provide an initializer for resources to call after construction.
void
initialize
(
const
nlohmann
::
json
&
data
,
json
::
Helper
&
helper
)
override
;
bool
setRange
(
const
std
::
array
<
std
::
array
<
double
,
3
>
,
2
>&
range
);
const
std
::
array
<
std
::
array
<
double
,
3
>
,
2
>&
range
()
const
;
std
::
array
<
std
::
array
<
double
,
3
>
,
2
>&
range
();
...
...
smtk/markup/Component.cxx
View file @
d35bbcf9
...
...
@@ -4,6 +4,7 @@
#include
"smtk/markup/Group.h"
#include
"smtk/markup/Label.h"
#include
"smtk/markup/Resource.h"
#include
"smtk/markup/json/Helper.h"
namespace
smtk
{
...
...
@@ -24,8 +25,19 @@ struct Component::ModifyName
std
::
string
m_name
;
};
Component
::~
Component
()
=
default
;
void
Component
::
initialize
(
const
nlohmann
::
json
&
data
,
json
::
Helper
&
helper
)
{
(
void
)
helper
;
auto
it
=
data
.
find
(
"name"
);
if
(
it
!=
data
.
end
())
{
m_name
=
it
->
get
<
std
::
string
>
();
}
}
Component
::
Index
Component
::
index
()
const
{
return
std
::
type_index
(
typeid
(
*
this
)).
hash_code
();}
...
...
smtk/markup/Component.h
View file @
d35bbcf9
...
...
@@ -14,6 +14,7 @@ namespace smtk
{
namespace
markup
{
namespace
json
{
class
Helper
;
}
class
Group
;
class
Label
;
...
...
@@ -31,24 +32,17 @@ public:
:
smtk
::
graph
::
Component
(
std
::
forward
<
Args
>
(
args
)...)
{
}
template
<
typename
...
Args
>
Component
(
const
nlohmann
::
json
*
j
,
Args
&&
...
args
)
:
smtk
::
graph
::
Component
(
std
::
forward
<
Args
>
(
args
)...)
{
auto
it
=
j
->
find
(
"name"
);
if
(
it
!=
j
->
end
())
{
m_name
=
it
->
get
<
std
::
string
>
();
}
}
~
Component
()
override
;
/// Provide an initializer for resources to call after construction.
virtual
void
initialize
(
const
nlohmann
::
json
&
data
,
json
::
Helper
&
helper
);
/// The index is a compile-time intrinsic of the derived resource; as such, it cannot be set.
Component
::
Index
index
()
const
;
/// Return the component's name.
std
::
string
name
()
const
override
;
/// Set the component's name.
bool
setName
(
const
std
::
string
&
name
);
...
...
smtk/markup/Cone.cxx
View file @
d35bbcf9
...
...
@@ -8,6 +8,10 @@ namespace markup
Cone
::~
Cone
()
=
default
;
void
Cone
::
initialize
(
const
nlohmann
::
json
&
data
,
json
::
Helper
&
helper
)
{
}
bool
Cone
::
setEndpoints
(
const
std
::
array
<
std
::
array
<
double
,
3
>
,
2
>&
endpoints
)
{
if
(
m_endpoints
==
endpoints
)
...
...
smtk/markup/Cone.h
View file @
d35bbcf9
...
...
@@ -22,14 +22,11 @@ public:
{
}
template
<
typename
...
Args
>
Cone
(
const
nlohmann
::
json
*
j
,
Args
&&
...
args
)
:
smtk
::
markup
::
AnalyticShape
(
std
::
forward
<
Args
>
(
args
)...)
{
}
~
Cone
()
override
;
/// Provide an initializer for resources to call after construction.
void
initialize
(
const
nlohmann
::
json
&
data
,
json
::
Helper
&
helper
)
override
;
bool
setEndpoints
(
const
std
::
array
<
std
::
array
<
double
,
3
>
,
2
>&
endpoints
);
const
std
::
array
<
std
::
array
<
double
,
3
>
,
2
>&
endpoints
()
const
;
std
::
array
<
std
::
array
<
double
,
3
>
,
2
>&
endpoints
();
...
...
smtk/markup/Domain.cxx
View file @
d35bbcf9
// Copyright © Kitware Inc under the [BSD-3-clause license](https://kitware.com/licenses/bsd.md).
#include
"smtk/markup/Domain.h"
#include
"smtk/string/json/jsonToken.h"
namespace
smtk
{
namespace
markup
{
Domain
::
Domain
(
smtk
::
string
::
Token
name
)
:
m_name
(
name
)
{
}
Domain
::
Domain
(
const
nlohmann
::
json
&
data
)
:
m_name
(
data
.
at
(
"name"
).
get
<
smtk
::
string
::
Token
>
())
{
}
}
// namespace markup
}
// namespace smtk
smtk/markup/Domain.h
View file @
d35bbcf9
...
...
@@ -7,6 +7,8 @@
#include
"smtk/SharedFromThis.h"
#include
"smtk/string/Token.h"
#include
"nlohmann/json.hpp"
#include
<memory>
namespace
smtk
...
...
@@ -21,9 +23,8 @@ public:
smtkTypeMacroBase
(
smtk
::
markup
::
Domain
);
Domain
()
=
default
;
Domain
(
const
smtk
::
string
::
Token
&
name
)
:
m_name
(
name
)
{
}
Domain
(
smtk
::
string
::
Token
name
);
Domain
(
const
nlohmann
::
json
&
data
);
virtual
~
Domain
()
=
default
;
smtk
::
string
::
Token
name
()
const
{
return
m_name
;
}
...
...
smtk/markup/DomainFactory.h
View file @
d35bbcf9
...
...
@@ -21,13 +21,12 @@ using DomainFactory =
smtk
::
common
::
Factory
<
smtk
::
markup
::
Domain
,
// Possible constructor arguments:
// 0. Nothing:
void
,
// 1. Just a token (name):
smtk
::
string
::
Token
,
// 2. A JSON pointer (references cause problems) and token (name)
smtk
::
common
::
factory
::
Inputs
<
const
nlohmann
::
json
*
,
smtk
::
string
::
Token
>
// 2. A JSON object
const
nlohmann
::
json
&
>
;
}
// namespace markup
...
...
smtk/markup/ExplicitSubset.cxx
View file @
d35bbcf9
...
...
@@ -8,6 +8,10 @@ namespace markup
ExplicitSubset
::~
ExplicitSubset
()
=
default
;
void
ExplicitSubset
::
initialize
(
const
nlohmann
::
json
&
data
,
json
::
Helper
&
helper
)
{
}
bool
ExplicitSubset
::
setMembers
(
const
std
::
set
<
smtk
::
markup
::
AssignedIds
::
IdType
>&
members
)
{
if
(
m_members
==
members
)
...
...
smtk/markup/ExplicitSubset.h
View file @
d35bbcf9
...
...
@@ -22,14 +22,11 @@ public:
{
}
template
<
typename
...
Args
>
ExplicitSubset
(
const
nlohmann
::
json
*
j
,
Args
&&
...
args
)
:
smtk
::
markup
::
Subset
(
std
::
forward
<
Args
>
(
args
)...)
{
}
~
ExplicitSubset
()
override
;
/// Provide an initializer for resources to call after construction.
void
initialize
(
const
nlohmann
::
json
&
data
,
json
::
Helper
&
helper
)
override
;
bool
setMembers
(
const
std
::
set
<
smtk
::
markup
::
AssignedIds
::
IdType
>&
members
);
const
std
::
set
<
smtk
::
markup
::
AssignedIds
::
IdType
>&
members
()
const
;
std
::
set
<
smtk
::
markup
::
AssignedIds
::
IdType
>&
members
();
...
...
smtk/markup/Field.cxx
View file @
d35bbcf9
...
...
@@ -11,6 +11,10 @@ namespace markup
Field
::~
Field
()
=
default
;
void
Field
::
initialize
(
const
nlohmann
::
json
&
data
,
json
::
Helper
&
helper
)
{
}
std
::
string
Field
::
name
()
const
{
return
m_name
.
data
();
...
...
smtk/markup/Field.h
View file @
d35bbcf9
...
...
@@ -27,14 +27,11 @@ public:
{
}
template
<
typename
...
Args
>
Field
(
const
nlohmann
::
json
*
j
,
Args
&&
...
args
)
:
smtk
::
markup
::
Component
(
std
::
forward
<
Args
>
(
args
)...)
{
}
~
Field
()
override
;
/// Provide an initializer for resources to call after construction.
void
initialize
(
const
nlohmann
::
json
&
data
,
json
::
Helper
&
helper
)
override
;
std
::
string
name
()
const
;
bool
setName
(
const
smtk
::
string
::
Token
&
name
);
...
...
smtk/markup/Frame.cxx
View file @
d35bbcf9
...
...
@@ -8,6 +8,10 @@ namespace markup
Frame
::~
Frame
()
=
default
;
void
Frame
::
initialize
(
const
nlohmann
::
json
&
data
,
json
::
Helper
&
helper
)
{
}
bool
Frame
::
setAxes
(
const
std
::
vector
<
std
::
vector
<
double
>>&
axes
)
{
if
(
m_axes
==
axes
)
...
...
smtk/markup/Frame.h
View file @
d35bbcf9
...
...
@@ -22,14 +22,11 @@ public:
{
}
template
<
typename
...
Args
>
Frame
(
const
nlohmann
::
json
*
j
,
Args
&&
...
args
)
:
smtk
::
markup
::
SpatialData
(
std
::
forward
<
Args
>
(
args
)...)
{
}
~
Frame
()
override
;
/// Provide an initializer for resources to call after construction.
void
initialize
(
const
nlohmann
::
json
&
data
,
json
::
Helper
&
helper
)
override
;
bool
setAxes
(
const
std
::
vector
<
std
::
vector
<
double
>>&
axes
);
const
std
::
vector
<
std
::
vector
<
double
>>&
axes
()
const
;
std
::
vector
<
std
::
vector
<
double
>>&
axes
();
...
...
smtk/markup/Grid.cxx
View file @
d35bbcf9
...
...
@@ -8,6 +8,10 @@ namespace markup
Grid
::~
Grid
()
=
default
;
void
Grid
::
initialize
(
const
nlohmann
::
json
&
data
,
json
::
Helper
&
helper
)
{
}
bool
Grid
::
setPoints
(
const
std
::
weak_ptr
<
smtk
::
markup
::
AssignedIds
>&
points
)
{
auto
mlocked
=
m_points
.
lock
();
...
...
Prev
1
2
3
4
Next
Write
Preview
Supports
Markdown
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