Renaming all JSON keywords! No all small-caps with underscores instead if...

Renaming all JSON keywords! No all small-caps with underscores instead if whitespaces ... this might be interpreted differently by parsers
parent 4ba76017
......@@ -42,23 +42,23 @@ std::string ITAGeo::CPropagationAnchor::GetAnchorTypeStr( ITAGeo::CPropagationAn
switch( iType )
{
case INVALID:
return "InvalidAnchor";
return "invalid_anchor";
case ACOUSTIC_EMITTER:
return "Source";
return "source";
case ACOUSTIC_SENSOR:
return "Receiver";
return "receiver";
case SPECULAR_REFLECTION:
return "SpecularReflection";
return "specular_reflection";
case ITA_DIFFUSE_REFLECTION:
return "DiffuseReflection";
return "diffuse_reflection";
case TRANSMISSION_APEX:
return "Transmission";
return "transmission";
case DIFFRACTION_OUTER_APEX:
return "OuterEdgeDiffraction";
return "outer_edge_diffraction";
case DIFFRACTION_INNER_APEX:
return "InnerEdgeDiffraction";
return "inner_edge_diffraction";
case GENERIC_ANCHOR:
return "GenericAnchor";
return "generic_anchor";
default:
return "Unkown";
}
......@@ -79,7 +79,7 @@ ITAGeo::CPropagationAnchor::EAnchorType ITAGeo::CPropagationAnchor::ParseAnchorT
std::string ITAGeo::CPropagationAnchor::GetTypeStr()
{
return "PropagationAnchor";
return "propagation_anchor";
}
void ITAGeo::CPropagationAnchor::LoadFromJSONString(std::string sContent, std::shared_ptr< CResourceManager >)
......@@ -98,7 +98,7 @@ void ITAGeo::CPropagationAnchor::LoadFromJSONString(std::string sContent, std::s
//Get the interaction point of the propagation anchor
auto jnPosition = jnRoot.at("interaction point").as_array();
auto jnPosition = jnRoot.at("interaction_point").as_array();
double dX = jnPosition.at(0).as_float();
double dY = jnPosition.at(1).as_float();
double dZ = jnPosition.at(2).as_float();
......@@ -108,7 +108,7 @@ void ITAGeo::CPropagationAnchor::LoadFromJSONString(std::string sContent, std::s
v3InteractionPoint.SetValues(dX, dY, dZ, dW);
//Get and set the anchor type
iAnchorType = ParseAnchorType(jnRoot.at("anchor type").as_string());
iAnchorType = ParseAnchorType(jnRoot.at("anchor_type").as_string());
#endif
}
......@@ -130,19 +130,19 @@ std::stringstream ITAGeo::CPropagationAnchor::ToJSON(std::shared_ptr< const CRes
//Set the anchor type node
CPropagationAnchor::EAnchorType eAnchorType = iAnchorType;
JSONNode jnAnchorType("anchor type", GetAnchorTypeStr(eAnchorType));
JSONNode jnAnchorType("anchor_type", GetAnchorTypeStr(eAnchorType));
//Set interaction point array
JSONNode jnPosArray(JSON_ARRAY);
jnPosArray.set_name("interaction point");
jnPosArray.set_name("interaction_point");
//Set the interaction point nodes
double dX, dY, dZ, dW;
v3InteractionPoint.GetValues(dX, dY, dZ, dW);
JSONNode jnPosX("X", dX);
JSONNode jnPosY("Y", dY);
JSONNode jnPosZ("Z", dZ);
JSONNode jnPosW("W", dW);
JSONNode jnPosX("x", dX);
JSONNode jnPosY("y", dY);
JSONNode jnPosZ("z", dZ);
JSONNode jnPosW("w", dW);
//Add positions to array
jnPosArray.push_back(jnPosX);
......@@ -240,10 +240,10 @@ std::stringstream ITAGeo::CEmitter::ToJSON(std::shared_ptr< const CResourceManag
//Get orientation nodes
double dOrient[4];
qOrient.GetValues(dOrient);
JSONNode jnOrientX("X", dOrient[0]);
JSONNode jnOrientY("Y", dOrient[1]);
JSONNode jnOrientZ("Z", dOrient[2]);
JSONNode jnOrientW("W", dOrient[3]);
JSONNode jnOrientX("x", dOrient[0]);
JSONNode jnOrientY("y", dOrient[1]);
JSONNode jnOrientZ("z", dOrient[2]);
JSONNode jnOrientW("w", dOrient[3]);
//Add orientation to array
jnOrientArray.push_back(jnOrientX);
......@@ -343,10 +343,10 @@ std::stringstream ITAGeo::CSensor::ToJSON( std::shared_ptr< CResourceManager > p
//Get orientation nodes
double dOrient[4];
qOrient.GetValues(dOrient);
JSONNode jnOrientX("X", dOrient[0]);
JSONNode jnOrientY("Y", dOrient[1]);
JSONNode jnOrientZ("Z", dOrient[2]);
JSONNode jnOrientW("W", dOrient[3]);
JSONNode jnOrientX("x", dOrient[0]);
JSONNode jnOrientY("y", dOrient[1]);
JSONNode jnOrientZ("z", dOrient[2]);
JSONNode jnOrientW("w", dOrient[3]);
//Add orientation to array
jnOrientArray.push_back(jnOrientX);
......@@ -404,7 +404,7 @@ void ITAGeo::CMirrorImage::LoadFromJSONString(std::string sContent)
v3MirrorNormal.SetValues(dMirrorNormal);
//Get and set the polygon index
iPolygonIndex = (int) jnRoot.at("polygon index").as_int();
iPolygonIndex = (int) jnRoot.at("polygon_index").as_int();
//Get and set the order number
iOrder = ( int ) jnRoot.at( "order" ).as_int();
......@@ -443,15 +443,15 @@ std::stringstream ITAGeo::CMirrorImage::ToJSON() const
//Set mirror normal array
JSONNode jnNormalArray(JSON_ARRAY);
jnNormalArray.set_name("mirror normal");
jnNormalArray.set_name("mirror-normal");
//Set the mirror normal nodes
double dX, dY, dZ, dW;
v3MirrorNormal.GetValues(dX, dY, dZ, dW);
JSONNode jnNormalX("X", dX);
JSONNode jnNormalY("Y", dY);
JSONNode jnNormalZ("Z", dZ);
JSONNode jnNormalW("W", dW);
JSONNode jnNormalX("x", dX);
JSONNode jnNormalY("y", dY);
JSONNode jnNormalZ("z", dZ);
JSONNode jnNormalW("w", dW);
//Add mirror normal nodes to array
jnNormalArray.push_back(jnNormalX);
......@@ -460,7 +460,7 @@ std::stringstream ITAGeo::CMirrorImage::ToJSON() const
jnNormalArray.push_back(jnNormalW);
//Set polygon index node
JSONNode jnPolIndex("polygon index", iPolygonIndex);
JSONNode jnPolIndex("polygon_index", iPolygonIndex);
//Set order node
JSONNode jnOrder("order", iOrder);
......@@ -691,7 +691,7 @@ void ITAGeo::CITADiffractionWedgeApertureBase::LoadFromJSONString(std::string sC
CPropagationAnchor::LoadFromJSONString(sContent);
//Get the vertex start
auto jnVertextStart = jnRoot.at("vertex start").as_array();
auto jnVertextStart = jnRoot.at("vertex_start").as_array();
double dX = jnVertextStart.at(0).as_float();
double dY = jnVertextStart.at(1).as_float();
double dZ = jnVertextStart.at(2).as_float();
......@@ -701,7 +701,7 @@ void ITAGeo::CITADiffractionWedgeApertureBase::LoadFromJSONString(std::string sC
v3VertextStart.SetValues(dX,dY,dZ,dW);
//Get the vertex end
auto jnVertextEnd = jnRoot.at("vertex end").as_array();
auto jnVertextEnd = jnRoot.at("vertex_end").as_array();
dX = jnVertextEnd.at(0).as_float();
dY = jnVertextEnd.at(1).as_float();
dZ = jnVertextEnd.at(2).as_float();
......@@ -711,7 +711,7 @@ void ITAGeo::CITADiffractionWedgeApertureBase::LoadFromJSONString(std::string sC
v3VertextEnd.SetValues(dX, dY, dZ, dW);
//Get the main wedge face normal
auto jnMainWedgeFaceNormal = jnRoot.at("main wedge face normal").as_array();
auto jnMainWedgeFaceNormal = jnRoot.at("main_wedge_face_normal").as_array();
dX = jnMainWedgeFaceNormal.at(0).as_float();
dY = jnMainWedgeFaceNormal.at(1).as_float();
dZ = jnMainWedgeFaceNormal.at(2).as_float();
......@@ -721,7 +721,7 @@ void ITAGeo::CITADiffractionWedgeApertureBase::LoadFromJSONString(std::string sC
v3MainWedgeFaceNormal.SetValues(dX, dY, dZ, dW);
//Get the opposite wedge face normal
auto jnOppositeWedgeFaceNormal = jnRoot.at("opposite wedge face normal").as_array();
auto jnOppositeWedgeFaceNormal = jnRoot.at("opposite_wedge_face_normal").as_array();
dX = jnOppositeWedgeFaceNormal.at(0).as_float();
dY = jnOppositeWedgeFaceNormal.at(1).as_float();
dZ = jnOppositeWedgeFaceNormal.at(2).as_float();
......@@ -761,18 +761,18 @@ std::stringstream ITAGeo::CITADiffractionWedgeApertureBase::ToJSON() const
JSONNode jnVertexEndArray(JSON_ARRAY);
JSONNode jnMainWedgeFaceNormalArray(JSON_ARRAY);
JSONNode jnOppositeWedgeFaceNormalArray(JSON_ARRAY);
jnVertexStartArray.set_name("vertex start");
jnVertexEndArray.set_name("vertex end");
jnMainWedgeFaceNormalArray.set_name("main wedge face normal");
jnOppositeWedgeFaceNormalArray.set_name("opposite wedge face normal");
jnVertexStartArray.set_name("vertex_start");
jnVertexEndArray.set_name("vertex_end");
jnMainWedgeFaceNormalArray.set_name("main_wedge_face_normal");
jnOppositeWedgeFaceNormalArray.set_name("opposite_wedge_face_normal");
//Set the vertex start nodes
double dX, dY, dZ, dW;
v3VertextStart.GetValues(dX, dY, dZ, dW);
JSONNode jnVertexStartX("X", dX);
JSONNode jnVertexStartY("Y", dY);
JSONNode jnVertexStartZ("Z", dZ);
JSONNode jnVertexStartW("W", dW);
JSONNode jnVertexStartX("x", dX);
JSONNode jnVertexStartY("y", dY);
JSONNode jnVertexStartZ("z", dZ);
JSONNode jnVertexStartW("w", dW);
//Add vertex start nodes to array
jnVertexStartArray.push_back(jnVertexStartX);
......@@ -782,10 +782,10 @@ std::stringstream ITAGeo::CITADiffractionWedgeApertureBase::ToJSON() const
//Set the vertex end nodes
v3VertextEnd.GetValues(dX, dY, dZ, dW);
JSONNode jnVertexEndX("X", dX);
JSONNode jnVertexEndY("Y", dY);
JSONNode jnVertexEndZ("Z", dZ);
JSONNode jnVertexEndW("W", dW);
JSONNode jnVertexEndX("x", dX);
JSONNode jnVertexEndY("y", dY);
JSONNode jnVertexEndZ("z", dZ);
JSONNode jnVertexEndW("w", dW);
//Add vertex end nodes to array
jnVertexEndArray.push_back(jnVertexEndX);
......@@ -795,10 +795,10 @@ std::stringstream ITAGeo::CITADiffractionWedgeApertureBase::ToJSON() const
//Set the main wedge face normal nodes
v3MainWedgeFaceNormal.GetValues(dX, dY, dZ, dW);
JSONNode jnMainWedgeFaceNormalX("X", dX);
JSONNode jnMainWedgeFaceNormalY("Y", dY);
JSONNode jnMainWedgeFaceNormalZ("Z", dZ);
JSONNode jnMainWedgeFaceNormalW("W", dW);
JSONNode jnMainWedgeFaceNormalX("x", dX);
JSONNode jnMainWedgeFaceNormalY("y", dY);
JSONNode jnMainWedgeFaceNormalZ("z", dZ);
JSONNode jnMainWedgeFaceNormalW("w", dW);
//Add main wedge face normal nodes to array
jnMainWedgeFaceNormalArray.push_back(jnMainWedgeFaceNormalX);
......@@ -808,10 +808,10 @@ std::stringstream ITAGeo::CITADiffractionWedgeApertureBase::ToJSON() const
//Set the opposite wedge face normal nodes
v3OppositeWedgeFaceNormal.GetValues(dX, dY, dZ, dW);
JSONNode jnOppositeWedgeFaceNormalX("X", dX);
JSONNode jnOppositeWedgeFaceNormalY("Y", dY);
JSONNode jnOppositeWedgeFaceNormalZ("Z", dZ);
JSONNode jnOppositeWedgeFaceNormalW("W", dW);
JSONNode jnOppositeWedgeFaceNormalX("x", dX);
JSONNode jnOppositeWedgeFaceNormalY("y", dY);
JSONNode jnOppositeWedgeFaceNormalZ("z", dZ);
JSONNode jnOppositeWedgeFaceNormalW("w", dW);
//Add opposite wedge face normal nodes to array
jnOppositeWedgeFaceNormalArray.push_back(jnOppositeWedgeFaceNormalX);
......@@ -1033,7 +1033,7 @@ std::stringstream ITAGeo::CPropagationPath::ToJSON(std::shared_ptr< CResourceMan
jnPropagationPath.push_back(jnFile);
JSONNode jnAnchorArray(JSON_ARRAY);
jnAnchorArray.set_name("propagation anchors");
jnAnchorArray.set_name("propagation_anchors");
for each (auto pAnchor in *this)
{
......@@ -1158,7 +1158,7 @@ void ITAGeo::CPropagationPathList::LoadFromJSONString(std::string sContent)
sIdentifier = jnRoot.at("identifier").as_string();
//Get the propagation anchors of the path
JSONNode jnPropagationPaths = jnRoot.at("propagation paths").as_array();
JSONNode jnPropagationPaths = jnRoot.at("propagation_paths").as_array();
for each (JSONNode jnPath in jnPropagationPaths)
{
//Initialization of the emitter as a shared pointer
......@@ -1239,7 +1239,7 @@ std::stringstream ITAGeo::CPropagationPathList::ToJSON() const
//Add the propagation path in an array node
JSONNode jnPathArray(JSON_ARRAY);
jnPathArray.set_name("propagation paths");
jnPathArray.set_name("propagation_paths");
for each (auto pPath in *this)
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment