Extending JSON I/O methods, now propagating resource manager pointer to handle...

Extending JSON I/O methods, now propagating resource manager pointer to handle materials and directivities
parent 4ba76017
......@@ -122,7 +122,7 @@ namespace ITAGeo
virtual std::stringstream ToJSON(std::shared_ptr< const CResourceManager > pResourceManager = nullptr) const;
//! Load properties from JSON formatted string
virtual void LoadFromJSONString(const std::string sContent, std::shared_ptr< CResourceManager > pResourceManager = nullptr);
virtual void LoadFromJSONString(const std::string& sContent, std::shared_ptr< CResourceManager > pResourceManager = nullptr);
};
......@@ -170,7 +170,7 @@ namespace ITAGeo
std::stringstream ToJSON(std::shared_ptr< const CResourceManager > pResourceManager) const;
//! Load properties from JSON formatted string
void LoadFromJSONString(const std::string sContent, std::shared_ptr< CResourceManager > pResourceManager = nullptr);
void LoadFromJSONString(const std::string& sContent, std::shared_ptr< CResourceManager > pResourceManager = nullptr);
};
//! A sensor / sound receiver / listener
......@@ -205,10 +205,10 @@ namespace ITAGeo
//! Returns a string with the properties of the object
std::string ToString() const;
std::stringstream ToJSON(std::shared_ptr< CResourceManager > pResourceManager = nullptr) const;
std::stringstream ToJSON(std::shared_ptr< const CResourceManager > pResourceManager = nullptr) const;
//! Load properties from JSON formatted string
void LoadFromJSONString(const std::string sContent, std::shared_ptr< CResourceManager > pResourceManager = nullptr);
void LoadFromJSONString(const std::string& sContent, std::shared_ptr< CResourceManager > pResourceManager = nullptr);
int GetNumChannels() const;
};
......@@ -284,14 +284,14 @@ namespace ITAGeo
inline virtual ~CMirrorImage() {};
//! Copy data from another anchor (has to be overwritten by derived classes!)
virtual void CopyFromAnchor(std::shared_ptr< const ITAGeo::CPropagationAnchor > pOther, ITAGeo::Material::IManager* pManager = nullptr);
virtual void CopyFromAnchor(std::shared_ptr< const ITAGeo::CPropagationAnchor > pOther);
//! Returns a string with the properties of the object
std::string ToString() const;
std::stringstream ToJSON() const;
std::stringstream ToJSON( std::shared_ptr< const ITAGeo::CResourceManager > pResourceManager = nullptr ) const;
//! Load properties from JSON formatted string
void LoadFromJSONString(const std::string sContent);
void LoadFromJSONString( const std::string& sContent, std::shared_ptr< ITAGeo::CResourceManager > pResourceManager = nullptr );
private:
inline const CMirrorImage operator=(const CMirrorImage&)
......@@ -324,7 +324,7 @@ namespace ITAGeo
std::stringstream ToJSON(std::shared_ptr< const CResourceManager > pResourceManager = nullptr) const;
//! Load properties from JSON formatted string
void LoadFromJSONString(const std::string sContent, std::shared_ptr< CResourceManager > pResourceManager = nullptr);
void LoadFromJSONString(const std::string& sContent, std::shared_ptr< CResourceManager > pResourceManager = nullptr);
std::shared_ptr< Material::IMaterial > pMaterial; //!< Acoustic material connection, i.e. absorption coefficient
};
......@@ -343,13 +343,13 @@ namespace ITAGeo
/**
* Will throw @CITAException on error
*/
void Store(const std::string& sFilePath, bool bOverwrite = true) const;
void Store(const std::string& sFilePath, bool bOverwrite = true, std::shared_ptr< const ITAGeo::CResourceManager > pResourceManager = nullptr) const;
//! Loads path from file (*.xml or *.json, if supported)
/**
* Will throw @CITAException on error
*/
void Load(const std::string& sFilePath);
void Load( const std::string& sFilePath, std::shared_ptr< ITAGeo::CResourceManager > pResourceManager = nullptr );
static inline std::string GetTypeStr()
{
......@@ -385,10 +385,10 @@ namespace ITAGeo
double GetAccumulatedDiffractionAnglesRad() const;
//! Returns a json formatted stringstream with the properties of the object
std::stringstream ToJSON( std::shared_ptr< CResourceManager > = nullptr ) const;
std::stringstream ToJSON( std::shared_ptr< const CResourceManager > pResourceManager = nullptr ) const;
//! Load properties from JSON formatted string
void LoadFromJSONString(const std::string sContent, std::shared_ptr< CResourceManager > = nullptr);
//! ( properties from JSON formatted string
void LoadFromJSONString( const std::string& sContent, std::shared_ptr< CResourceManager > pResourceManager = nullptr );
};
......@@ -417,13 +417,13 @@ namespace ITAGeo
/**
* Will throw @CITAException on error
*/
void Store(const std::string& sFilePath, bool bOverwrite = true) const;
void Store( const std::string& sFilePath, bool bOverwrite = true, std::shared_ptr< const ITAGeo::CResourceManager > pResourceManager = nullptr ) const;
//! Loads path list from file (*.xml or *.json, if supported)
/**
* Will throw @CITAException on error
*/
void Load(const std::string& sFilePath);
void Load( const std::string& sFilePath, std::shared_ptr< ITAGeo::CResourceManager > pResourceManager = nullptr );
//! Get type string of class.
static inline std::string GetTypeStr()
......@@ -432,10 +432,10 @@ namespace ITAGeo
};
//! Returns a json formatted stringstream with the properties of the object
std::stringstream ToJSON() const;
std::stringstream ToJSON( std::shared_ptr< const ITAGeo::CResourceManager > pResourceManager = nullptr ) const;
//! Load properties from JSON formatted string
void LoadFromJSONString(const std::string sContent);
void LoadFromJSONString( const std::string& sContent, std::shared_ptr< ITAGeo::CResourceManager > pResourceManager = nullptr );
};
......@@ -570,10 +570,10 @@ namespace ITAGeo
//! Returns a string with the properties of the object
std::string ToString() const;
std::stringstream ToJSON() const;
std::stringstream ToJSON( std::shared_ptr< const ITAGeo::CResourceManager > pResourceManager = nullptr ) const;
//! Load properties from JSON formatted string
void LoadFromJSONString(const std::string sContent);
void LoadFromJSONString( const std::string& sContent, std::shared_ptr< ITAGeo::CResourceManager > pResourceManager = nullptr );
};
......@@ -617,15 +617,6 @@ inline std::ostream& operator<<(std::ostream& os, const ITAGeo::CPropagationAnch
return os;
};
/*
inline std::ostream& operator<<( std::ostream& os, const ITAGeo::CPropagationAnchor* pAnchor )
{
ITAGeo::CPropagationAnchor oAnchor( *pAnchor );
os << oAnchor; // error C2593 @todo solve
return os;
};
*/
inline std::ostream& operator<<(std::ostream& os, const ITAGeo::CPropagationPath& oPath)
{
os << "GeoPropagationPath [" << oPath.sIdentifier << "]: num anchors " << oPath.size() << std::endl;
......
......@@ -82,7 +82,7 @@ std::string ITAGeo::CPropagationAnchor::GetTypeStr()
return "PropagationAnchor";
}
void ITAGeo::CPropagationAnchor::LoadFromJSONString(std::string sContent, std::shared_ptr< CResourceManager >)
void ITAGeo::CPropagationAnchor::LoadFromJSONString(const std::string& sContent, std::shared_ptr< CResourceManager >)
{
#ifdef WITH_JSON_SUPPORT
......@@ -120,7 +120,7 @@ std::string ITAGeo::CPropagationAnchor::ToString() const
return ss.str();
}
std::stringstream ITAGeo::CPropagationAnchor::ToJSON(std::shared_ptr< const CResourceManager >) const
std::stringstream ITAGeo::CPropagationAnchor::ToJSON(std::shared_ptr< const ITAGeo::CResourceManager > pResourceManager) const
{
#ifdef WITH_JSON_SUPPORT
JSONNode jnRoot(JSON_NODE);
......@@ -165,7 +165,7 @@ std::stringstream ITAGeo::CPropagationAnchor::ToJSON(std::shared_ptr< const CRes
//---CEmitter-----------------------------------------------------------------------------------------------------------------------------
void ITAGeo::CEmitter::LoadFromJSONString(std::string sContent, std::shared_ptr< CResourceManager> pResourceManager )
void ITAGeo::CEmitter::LoadFromJSONString(const std::string& sContent, std::shared_ptr< CResourceManager> pResourceManager )
{
#ifdef WITH_JSON_SUPPORT
......@@ -179,7 +179,7 @@ void ITAGeo::CEmitter::LoadFromJSONString(std::string sContent, std::shared_ptr<
//--Get the emitter properties-------------------------
CPropagationAnchor::LoadFromJSONString(sContent);
CPropagationAnchor::LoadFromJSONString(sContent, pResourceManager);
//Get and set the name of the emitter
sName = jnRoot.at("name").as_string();
......@@ -220,7 +220,7 @@ std::stringstream ITAGeo::CEmitter::ToJSON(std::shared_ptr< const CResourceManag
{
#ifdef WITH_JSON_SUPPORT
//Get the properties of the parent class
std::string sRoot = ITAGeo::CPropagationAnchor::ToJSON().str();
std::string sRoot = ITAGeo::CPropagationAnchor::ToJSON( pResourceManager).str();
JSONNode jnRoot = libjson::parse(sRoot);
//Set class node. First, search the node. If the node does not exist, push back new node.
......@@ -274,7 +274,7 @@ int ITAGeo::CSensor::GetNumChannels() const
return 1;
}
void ITAGeo::CSensor::LoadFromJSONString(std::string sContent, std::shared_ptr< CResourceManager > pResourceManager)
void ITAGeo::CSensor::LoadFromJSONString(const std::string& sContent, std::shared_ptr< CResourceManager > pResourceManager)
{
#ifdef WITH_JSON_SUPPORT
......@@ -319,11 +319,11 @@ std::string ITAGeo::CSensor::ToString() const
return ss.str();
}
std::stringstream ITAGeo::CSensor::ToJSON( std::shared_ptr< CResourceManager > pResourceManager ) const
std::stringstream ITAGeo::CSensor::ToJSON( std::shared_ptr< const ITAGeo::CResourceManager > pResourceManager ) const
{
#ifdef WITH_JSON_SUPPORT
//Get the properties of the parent class
std::string sRoot = ITAGeo::CPropagationAnchor::ToJSON().str();
std::string sRoot = ITAGeo::CPropagationAnchor::ToJSON(pResourceManager).str();
JSONNode jnRoot = libjson::parse(sRoot);
//Set class node. First, search the node. If the node does not exist, push back new node.
......@@ -376,7 +376,7 @@ std::stringstream ITAGeo::CSensor::ToJSON( std::shared_ptr< CResourceManager > p
//---CMirrorImage-------------------------------------------------------------------------------------------------------------------------
void ITAGeo::CMirrorImage::LoadFromJSONString(std::string sContent)
void ITAGeo::CMirrorImage::LoadFromJSONString( const std::string& sContent, std::shared_ptr< CResourceManager > pResourceManager )
{
#ifdef WITH_JSON_SUPPORT
......@@ -390,7 +390,7 @@ void ITAGeo::CMirrorImage::LoadFromJSONString(std::string sContent)
//--Get the emitter properties-------------------------
CPropagationAnchor::LoadFromJSONString(sContent);
CPropagationAnchor::LoadFromJSONString(sContent,pResourceManager);
//Get the mirror normal
auto jnMirrorNormal = jnRoot.at("orientation").as_array();
......@@ -412,7 +412,7 @@ void ITAGeo::CMirrorImage::LoadFromJSONString(std::string sContent)
#endif
}
void ITAGeo::CMirrorImage::CopyFromAnchor(std::shared_ptr<const ITAGeo::CPropagationAnchor> pOther, ITAGeo::Material::IManager * pManager)
void ITAGeo::CMirrorImage::CopyFromAnchor(std::shared_ptr<const ITAGeo::CPropagationAnchor> pOther)
{
v3InteractionPoint = pOther->v3InteractionPoint;
CPropagationAnchor::iAnchorType = pOther->iAnchorType;
......@@ -427,11 +427,11 @@ std::string ITAGeo::CMirrorImage::ToString() const
return ss.str();
}
std::stringstream ITAGeo::CMirrorImage::ToJSON() const
std::stringstream ITAGeo::CMirrorImage::ToJSON( std::shared_ptr< const ITAGeo::CResourceManager > pResourceManager ) const
{
#ifdef WITH_JSON_SUPPORT
//Get the properties of the parent class
std::string sRoot = ITAGeo::CPropagationAnchor::ToJSON().str();
std::string sRoot = ITAGeo::CPropagationAnchor::ToJSON(pResourceManager).str();
JSONNode jnRoot = libjson::parse(sRoot);
//Set class type node. First, search the node. If the node does not exist, push back new node.
......@@ -481,7 +481,7 @@ std::stringstream ITAGeo::CMirrorImage::ToJSON() const
//---CSpecularReflection------------------------------------------------------------------------------------------------------------------
void ITAGeo::CSpecularReflection::LoadFromJSONString(std::string sContent, std::shared_ptr< CResourceManager > pResourceManager)
void ITAGeo::CSpecularReflection::LoadFromJSONString( const std::string& sContent, std::shared_ptr< CResourceManager > pResourceManager)
{
#ifdef WITH_JSON_SUPPORT
......@@ -495,7 +495,7 @@ void ITAGeo::CSpecularReflection::LoadFromJSONString(std::string sContent, std::
//--Get the properties-------------------------
CPropagationAnchor::LoadFromJSONString(sContent);
CPropagationAnchor::LoadFromJSONString(sContent,pResourceManager);
#endif
......@@ -513,7 +513,7 @@ std::stringstream ITAGeo::CSpecularReflection::ToJSON( std::shared_ptr< const CR
{
#ifdef WITH_JSON_SUPPORT
//Get the properties of the parent class
std::string sRoot = ITAGeo::CPropagationAnchor::ToJSON().str();
std::string sRoot = ITAGeo::CPropagationAnchor::ToJSON(pResourceManager).str();
JSONNode jnRoot = libjson::parse(sRoot);
//Set class node. First, search the node. If the node does not exist, push back new node.
......@@ -524,12 +524,13 @@ std::stringstream ITAGeo::CSpecularReflection::ToJSON( std::shared_ptr< const CR
}
//Get the acoustic material
if (pMaterial != nullptr)
if( pMaterial && pResourceManager )
{
std::string sID = pResourceManager->GetMaterialID(pMaterial);
JSONNode jnMaterialID("material_id", sID);
jnRoot.push_back(jnMaterialID);
}
//Convert to stringstream and return value
std::stringstream ss;
ss << jnRoot.write_formatted();
......@@ -674,7 +675,7 @@ ITAGeo::CITADiffractionWedgeApertureBase& ITAGeo::CITADiffractionWedgeApertureBa
return *this;
}
void ITAGeo::CITADiffractionWedgeApertureBase::LoadFromJSONString(std::string sContent)
void ITAGeo::CITADiffractionWedgeApertureBase::LoadFromJSONString( const std::string& sContent, std::shared_ptr< CResourceManager > pResourceManager )
{
#ifdef WITH_JSON_SUPPORT
......@@ -688,7 +689,7 @@ void ITAGeo::CITADiffractionWedgeApertureBase::LoadFromJSONString(std::string sC
//--Get the properties-------------------------
CPropagationAnchor::LoadFromJSONString(sContent);
CPropagationAnchor::LoadFromJSONString(sContent,pResourceManager);
//Get the vertex start
auto jnVertextStart = jnRoot.at("vertex start").as_array();
......@@ -742,11 +743,11 @@ std::string ITAGeo::CITADiffractionWedgeApertureBase::ToString() const
return ss.str();
}
std::stringstream ITAGeo::CITADiffractionWedgeApertureBase::ToJSON() const
std::stringstream ITAGeo::CITADiffractionWedgeApertureBase::ToJSON( std::shared_ptr< const ITAGeo::CResourceManager > pResourceManager ) const
{
#ifdef WITH_JSON_SUPPORT
//Get the properties of the parent class
std::string sRoot = ITAGeo::CPropagationAnchor::ToJSON().str();
std::string sRoot = ITAGeo::CPropagationAnchor::ToJSON(pResourceManager).str();
JSONNode jnRoot = libjson::parse(sRoot);
//Set class type node. First, search the node. If the node does not exist, push back new node.
......@@ -873,7 +874,7 @@ double ITAGeo::CPropagationPath::GetAccumulatedDiffractionAnglesRad() const
return dIncrementalAngle;
}
void ITAGeo::CPropagationPath::Store( const std::string& sFilePath, bool bOverwrite /*= true */ ) const
void ITAGeo::CPropagationPath::Store( const std::string& sFilePath, bool bOverwrite /*= true */, std::shared_ptr< const ITAGeo::CResourceManager > pResourceManager /* = nullptr */ ) const
{
VistaFileSystemFile oFile( sFilePath );
if( oFile.Exists() && !bOverwrite )
......@@ -883,13 +884,13 @@ void ITAGeo::CPropagationPath::Store( const std::string& sFilePath, bool bOverwr
//Store propagation path to json file located in sFilePath
std::ofstream out(sFilePath);
out << ToJSON().str();
out << ToJSON(pResourceManager).str();
out.close();
#endif
}
void ITAGeo::CPropagationPath::Load(const std::string& sFilePath)
void ITAGeo::CPropagationPath::Load( const std::string& sFilePath, std::shared_ptr< CResourceManager > pResourceManager )
{
VistaFileSystemFile oFile(sFilePath);
if (!oFile.Exists() || !oFile.IsFile())
......@@ -902,11 +903,11 @@ void ITAGeo::CPropagationPath::Load(const std::string& sFilePath)
std::string sContent((std::istreambuf_iterator<char>(inFile)),
(std::istreambuf_iterator<char>()));
LoadFromJSONString(sContent);
LoadFromJSONString(sContent,pResourceManager);
#endif
}
void ITAGeo::CPropagationPath::LoadFromJSONString(std::string sContent, std::shared_ptr< CResourceManager > pResourceManager)
void ITAGeo::CPropagationPath::LoadFromJSONString(const std::string& sContent, std::shared_ptr< CResourceManager > pResourceManager)
{
#ifdef WITH_JSON_SUPPORT
......@@ -938,7 +939,7 @@ void ITAGeo::CPropagationPath::LoadFromJSONString(std::string sContent, std::sha
auto pEmitter = std::make_shared< CEmitter >();
//Load emitter properties from the json formatted string
pEmitter->LoadFromJSONString(jnAnchor.write());
pEmitter->LoadFromJSONString(jnAnchor.write(),pResourceManager);
//Add emitter anchor to path
push_back(pEmitter);
......@@ -950,7 +951,7 @@ void ITAGeo::CPropagationPath::LoadFromJSONString(std::string sContent, std::sha
auto pSensor = std::make_shared< CSensor >();
//Load sensor properties from the json formatted string
pSensor->LoadFromJSONString(jnAnchor.write());
pSensor->LoadFromJSONString(jnAnchor.write(),pResourceManager);
//Add sensor anchor to path
push_back(pSensor);
......@@ -962,7 +963,7 @@ void ITAGeo::CPropagationPath::LoadFromJSONString(std::string sContent, std::sha
auto pMirrorImage = std::make_shared< CMirrorImage >();
//Load properties from the json formatted string
pMirrorImage->LoadFromJSONString(jnAnchor.write());
pMirrorImage->LoadFromJSONString(jnAnchor.write(),pResourceManager);
//Add sensor anchor to path
push_back(pMirrorImage);
......@@ -974,7 +975,7 @@ void ITAGeo::CPropagationPath::LoadFromJSONString(std::string sContent, std::sha
auto pSpecularReflection = std::make_shared< CSpecularReflection >();
//Load properties from the json formatted string
pSpecularReflection->LoadFromJSONString(jnAnchor.write());
pSpecularReflection->LoadFromJSONString(jnAnchor.write(),pResourceManager);
//Add sensor anchor to path
push_back(pSpecularReflection);
......@@ -986,7 +987,7 @@ void ITAGeo::CPropagationPath::LoadFromJSONString(std::string sContent, std::sha
auto pDiffraction = std::make_shared< CITADiffractionOuterWedgeAperture >();
//Load properties from the json formatted string
pDiffraction->LoadFromJSONString( jnAnchor.write() );
pDiffraction->LoadFromJSONString( jnAnchor.write(),pResourceManager );
//Add sensor anchor to path
push_back( pDiffraction );
......@@ -998,7 +999,7 @@ void ITAGeo::CPropagationPath::LoadFromJSONString(std::string sContent, std::sha
auto pDiffraction = std::make_shared< CITADiffractionInnerWedgeAperture >();
//Load properties from the json formatted string
pDiffraction->LoadFromJSONString( jnAnchor.write() );
pDiffraction->LoadFromJSONString( jnAnchor.write(),pResourceManager );
//Add sensor anchor to path
push_back( pDiffraction );
......@@ -1009,7 +1010,7 @@ void ITAGeo::CPropagationPath::LoadFromJSONString(std::string sContent, std::sha
//Initialization as a shared pointer
auto pAnchor = std::make_shared< CPropagationAnchor >();
pAnchor->LoadFromJSONString(jnAnchor.write());
pAnchor->LoadFromJSONString(jnAnchor.write(),pResourceManager);
//Add anchor to path
push_back(pAnchor);
......@@ -1020,7 +1021,7 @@ void ITAGeo::CPropagationPath::LoadFromJSONString(std::string sContent, std::sha
#endif
}
std::stringstream ITAGeo::CPropagationPath::ToJSON(std::shared_ptr< CResourceManager > pResourceManager) const
std::stringstream ITAGeo::CPropagationPath::ToJSON(std::shared_ptr< const ITAGeo::CResourceManager > pResourceManager) const
{
#ifdef WITH_JSON_SUPPORT
......@@ -1062,7 +1063,7 @@ std::stringstream ITAGeo::CPropagationPath::ToJSON(std::shared_ptr< CResourceMan
{
std::shared_ptr< CMirrorImage > pMirrorImage = std::static_pointer_cast<CMirrorImage>(pAnchor);
std::stringstream sMirrorImageJSON = pMirrorImage->ToJSON();
std::stringstream sMirrorImageJSON = pMirrorImage->ToJSON( pResourceManager );
jnAnchor = libjson::parse(sMirrorImageJSON.str());
}
break;
......@@ -1070,7 +1071,7 @@ std::stringstream ITAGeo::CPropagationPath::ToJSON(std::shared_ptr< CResourceMan
{
std::shared_ptr< CSpecularReflection > pSpecularReflection = std::static_pointer_cast<CSpecularReflection>(pAnchor);
std::stringstream sSpecularReflectionJSON = pSpecularReflection->ToJSON();
std::stringstream sSpecularReflectionJSON = pSpecularReflection->ToJSON( pResourceManager );
jnAnchor = libjson::parse(sSpecularReflectionJSON.str());
}
break;
......@@ -1079,13 +1080,13 @@ std::stringstream ITAGeo::CPropagationPath::ToJSON(std::shared_ptr< CResourceMan
{
std::shared_ptr< CITADiffractionWedgeApertureBase > pDiffractionApex = std::static_pointer_cast<CITADiffractionWedgeApertureBase >(pAnchor);
std::stringstream sDiffractionApexJSON = pDiffractionApex->ToJSON();
std::stringstream sDiffractionApexJSON = pDiffractionApex->ToJSON( pResourceManager );
jnAnchor = libjson::parse(sDiffractionApexJSON.str());
}
break;
default:
{
std::stringstream sAnchorJSON = pAnchor->ToJSON();
std::stringstream sAnchorJSON = pAnchor->ToJSON( pResourceManager );
jnAnchor = libjson::parse(sAnchorJSON.str());
}
break;
......@@ -1106,7 +1107,7 @@ std::stringstream ITAGeo::CPropagationPath::ToJSON(std::shared_ptr< CResourceMan
//---CPropagationPathList------------------------------------------------------------------------------------------------------------------
void ITAGeo::CPropagationPathList::Store(const std::string& sFilePath, bool bOverwrite /*= true */) const
void ITAGeo::CPropagationPathList::Store( const std::string& sFilePath, bool bOverwrite /*= true */, std::shared_ptr< const ITAGeo::CResourceManager > pResourceManager /* = nullptr */) const
{
VistaFileSystemFile oFile(sFilePath);
if (oFile.Exists() && !bOverwrite)
......@@ -1116,13 +1117,13 @@ void ITAGeo::CPropagationPathList::Store(const std::string& sFilePath, bool bOve
//Store propagation path to json file located in sFilePath
std::ofstream out(sFilePath);
out << ToJSON().str();
out << ToJSON(pResourceManager).str().c_str();
out.close();
#endif
}
void ITAGeo::CPropagationPathList::Load(const std::string& sFilePath)
void ITAGeo::CPropagationPathList::Load( const std::string& sFilePath, std::shared_ptr< ITAGeo::CResourceManager > pResourceManager )
{
VistaFileSystemFile oFile(sFilePath);
if (!oFile.Exists() || !oFile.IsFile())
......@@ -1135,11 +1136,11 @@ void ITAGeo::CPropagationPathList::Load(const std::string& sFilePath)
std::string sContent((std::istreambuf_iterator<char>(inFile)),
(std::istreambuf_iterator<char>()));
LoadFromJSONString(sContent);
LoadFromJSONString(sContent, pResourceManager);
#endif
}
void ITAGeo::CPropagationPathList::LoadFromJSONString(std::string sContent)
void ITAGeo::CPropagationPathList::LoadFromJSONString( const std::string& sContent, std::shared_ptr< ITAGeo::CResourceManager > pResourceManager )
{
#ifdef WITH_JSON_SUPPORT
......@@ -1165,7 +1166,7 @@ void ITAGeo::CPropagationPathList::LoadFromJSONString(std::string sContent)
CPropagationPath oPath;
//Load emitter properties from the json formatted string
oPath.LoadFromJSONString(jnPath.write());
oPath.LoadFromJSONString(jnPath.write(), pResourceManager);
//Add emitter anchor to path
push_back(oPath);
......@@ -1219,11 +1220,12 @@ void ITAGeo::CPropagationPathList::LoadFromJSONString(std::string sContent)
}
// @todo get resource
#endif
}
std::stringstream ITAGeo::CPropagationPathList::ToJSON() const
std::stringstream ITAGeo::CPropagationPathList::ToJSON( std::shared_ptr< const ITAGeo::CResourceManager > pResourceManager ) const
{
#ifdef WITH_JSON_SUPPORT
//root node
......@@ -1243,7 +1245,7 @@ std::stringstream ITAGeo::CPropagationPathList::ToJSON() const
for each (auto pPath in *this)
{
std::stringstream sPathJSON = pPath.ToJSON();
std::stringstream sPathJSON = pPath.ToJSON(pResourceManager);
JSONNode jnPath = libjson::parse(sPathJSON.str());
jnPathArray.push_back(jnPath);
......
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