Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
ITAGeo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Institute of Technical Acoustics (ITA)
ITAGeo
Commits
55fb2dea
Commit
55fb2dea
authored
Jul 18, 2019
by
Dipl.-Ing. Jonas Stienen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Taking more care on JSON i/o if keys are not available
parent
9ce1279c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
5 deletions
+10
-5
src/ITAGeo/Base.cpp
src/ITAGeo/Base.cpp
+10
-5
No files found.
src/ITAGeo/Base.cpp
View file @
55fb2dea
...
...
@@ -411,10 +411,12 @@ void ITAGeo::CMirrorImage::LoadFromJSONString( const std::string& sContent, std:
v3MirrorNormal
.
SetValues
(
dMirrorNormal
);
//Get and set the polygon index
iPolygonIndex
=
(
int
)
jnRoot
.
at
(
"polygon_index"
).
as_int
();
if
(
jnRoot
.
find
(
"polygon_index"
)
!=
jnRoot
.
end
()
)
iPolygonIndex
=
(
int
)
jnRoot
.
at
(
"polygon_index"
).
as_int
();
//Get and set the order number
iOrder
=
(
int
)
jnRoot
.
at
(
"order"
).
as_int
();
if
(
jnRoot
.
find
(
"order"
)
!=
jnRoot
.
end
()
)
iOrder
=
(
int
)
jnRoot
.
at
(
"order"
).
as_int
();
#endif
}
...
...
@@ -504,7 +506,8 @@ void ITAGeo::CSpecularReflection::LoadFromJSONString( const std::string& sConten
CPropagationAnchor
::
LoadFromJSONString
(
sContent
,
pResourceManager
);
iPolygonID
=
jnRoot
.
at
(
"polygon_id"
).
as_int
();
if
(
jnRoot
.
find
(
"polygon_id"
)
!=
jnRoot
.
end
()
)
iPolygonID
=
jnRoot
.
at
(
"polygon_id"
).
as_int
();
#endif
}
...
...
@@ -810,8 +813,10 @@ void ITAGeo::CITADiffractionWedgeApertureBase::LoadFromJSONString( const std::st
//Set the opposite wedge face normal
v3OppositeWedgeFaceNormal
.
SetValues
(
dX
,
dY
,
dZ
,
dW
);
int
iMainWedgeFaceID
=
jnRoot
.
at
(
"main_wedge_face_id"
).
as_int
();
int
iOppositeWedgeFaceID
=
jnRoot
.
at
(
"opposite_wedge_face_id"
).
as_int
();
if
(
jnRoot
.
find
(
"main_wedge_face_id"
)
!=
jnRoot
.
end
()
)
iMainWedgeFaceID
=
jnRoot
.
at
(
"main_wedge_face_id"
).
as_int
();
if
(
jnRoot
.
find
(
"opposite_wedge_face_id"
)
!=
jnRoot
.
end
()
)
iOppositeWedgeFaceID
=
jnRoot
.
at
(
"opposite_wedge_face_id"
).
as_int
();
#endif
}
...
...
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