Commit 9627dbc3 authored by Armin Erraji's avatar Armin Erraji

Replaced map of meshmodels with MeshModelList.

parent 058d115e
......@@ -160,15 +160,12 @@ namespace ITAPropagationPathSim
//! Pointer to destination anchor
shared_ptr<ITAGeo::CPropagationAnchor> m_pDestinationAnchor;
//mesh model list
ITAGeo::Halfedge::CMeshModelList m_pMeshModelList;
//Mesh model list
ITAGeo::Halfedge::CMeshModelList m_vpMeshModelList;
//! Map of illuminated edges
DiffractionEdgesMap m_mvhIlluminatedEdges;
//Vector of meshes
map< string, ITAGeo::Halfedge::CMeshModelShared > m_mpMeshModels;
//Relations map between two edge directions
map <MeshListEdgeHandle, map <MeshListEdgeHandle, double>> m_mdEdgeDirMultiplicationMap;
......
......@@ -16,33 +16,21 @@ CDiffractionPath::CDiffractionPath(ITAGeo::Halfedge::CMeshModelList pMeshModelLi
m_iMaxDiffractionOrder = iDiffractionOrder;
//Set mesh model list member variable //TODO: ersetzen durch kopie und Eingangsparameter auf const setzen
m_pMeshModelList = pMeshModelList;
m_vpMeshModelList = pMeshModelList;
//Copy to mesh model map
vector<Halfedge::CMeshModelShared> pMeshModels;
for (int i = 0; i < pMeshModelList.GetNumMeshes(); i++)
{
auto pCurrentMeshModel = pMeshModelList[i];
string sMeshName = pMeshModelList[i]->GetName();
Halfedge::CMeshModelShared pCurrentMeshCopy = make_shared< Halfedge::CMeshModel>();
pCurrentMeshCopy->CopyFrom(*pCurrentMeshModel);
// Calculate mesh normals
CITAMesh* pMesh = pCurrentMeshCopy->GetMesh()->pMesh;
CITAMesh* pMesh = m_vpMeshModelList[i]->GetMesh()->pMesh;
pMesh->request_face_normals();
pMesh->update_face_normals();
pMesh->request_halfedge_normals();
pMesh->request_vertex_normals();
//Add current mesh model to member variable
m_mpMeshModels[sMeshName] = pCurrentMeshCopy;
pMeshModels.push_back(pCurrentMeshCopy);
}
//Add mesh tree for faster filtering of illuminable mesh meshes //TODO aer: baumstruktur fr schnellere erstellung von Bumen
//m_pBuildingsTree = make_shared<ITAGeo::Urban::RTree::CBuildings>();
//m_pBuildingsTree->Create(pBuildings);
//Construct diffraction matrix
ConstructDiffractionMatrix();
......@@ -251,7 +239,7 @@ bool CDiffractionPath::CalculateDiffractionPath(vector<shared_ptr<DiffractionEdg
void CDiffractionPath::RecursiveGetIlluminableDiffractionEdges(vector<shared_ptr<DiffractionEdge>>& vpOutIllumEdges, const VistaVector3D& v3InOrigin, shared_ptr<DiffractionEdge> pInParentEdge)
{
//Add current edge to output vector if current edge and origin point can see each other
auto pEdgeMesh = m_mpMeshModels[pInParentEdge->sMeshModelName]->GetMesh()->pMesh;
auto pEdgeMesh = m_vpMeshModelList.GetMeshModel(pInParentEdge->sMeshModelName)->GetMesh()->pMesh;
if (IsEdgeIlluminated(*pEdgeMesh, pInParentEdge->hEdge, v3InOrigin))
vpOutIllumEdges.push_back(pInParentEdge);
......@@ -271,10 +259,9 @@ void CDiffractionPath::ConstructDiffractionMatrix()
//get all diffraction edges
vector<shared_ptr<DiffractionEdge>> vpDiffractionEdges;
for (auto &keyMeshModel : m_mpMeshModels)
for(auto &pMeshModel : m_vpMeshModelList)
{
auto pCurrentMeshModel = keyMeshModel.second;
CITAMesh* pCurrentMesh = pCurrentMeshModel->GetMesh()->pMesh;
CITAMesh* pCurrentMesh = pMeshModel->GetMesh()->pMesh;
CITAMesh::ConstEdgeRange hCurrentMeshEdges = pCurrentMesh->edges();
......@@ -299,7 +286,7 @@ void CDiffractionPath::ConstructDiffractionMatrix()
//Set diffraction edge
auto pDiffractionEdge = make_shared<DiffractionEdge>();
pDiffractionEdge->sMeshModelName = pCurrentMeshModel->GetName();
pDiffractionEdge->sMeshModelName = pMeshModel->GetName();
pDiffractionEdge->hEdge = hCurrentEdge;
pDiffractionEdge->v3StartPoint = v3FromPoint;
pDiffractionEdge->v3EndPoint = v3ToPoint;
......@@ -373,7 +360,7 @@ void CDiffractionPath::ConstructDiffractionTree(const CPropagationAnchor* pOrigi
void CDiffractionPath::RecursiveAddIlluminatedEdges(shared_ptr<DiffractionEdge>& pParentDiffractionEdge)
{
CITAMesh* pParentMesh = m_mpMeshModels[pParentDiffractionEdge->sMeshModelName]->GetMesh()->pMesh;
CITAMesh* pParentMesh = m_vpMeshModelList.GetMeshModel(pParentDiffractionEdge->sMeshModelName)->GetMesh()->pMesh;
CITAMesh::HalfedgeHandle hParentHalfedge = pParentMesh->halfedge_handle(pParentDiffractionEdge->hEdge,0); //Halfedge is needed for vertex points
string sParentMeshModelName = pParentDiffractionEdge->sMeshModelName;
......@@ -415,7 +402,7 @@ void CDiffractionPath::SetStartDiffractionEdges()
{
auto sCurrentMeshModelName = kDiffractionEdge.first.first;
auto hCurrentEdge = kDiffractionEdge.first.second;
auto pCurrentMesh = m_mpMeshModels[sCurrentMeshModelName]->GetMesh()->pMesh;
auto pCurrentMesh = m_vpMeshModelList.GetMeshModel(sCurrentMeshModelName)->GetMesh()->pMesh;
//Face handles of current edge handle
auto hFace0 = pCurrentMesh->face_handle(pCurrentMesh->halfedge_handle(hCurrentEdge, 0));
......@@ -497,8 +484,8 @@ bool CDiffractionPath::CanEdgeIlluminateInDirection(const CITAMesh& oMesh, const
bool CDiffractionPath::IsDiffractionEdgeIlluminated(const DiffractionEdge& oStartEdge, const DiffractionEdge& oEndEdge)
{
//Start edge mesh and end edge mesh
auto pStartEdgeMesh = m_mpMeshModels[oStartEdge.sMeshModelName]->GetMesh()->pMesh;
auto pEndEdgeMesh = m_mpMeshModels[oEndEdge.sMeshModelName]->GetMesh()->pMesh;
auto pStartEdgeMesh = m_vpMeshModelList.GetMeshModel(oStartEdge.sMeshModelName)->GetMesh()->pMesh;
auto pEndEdgeMesh = m_vpMeshModelList.GetMeshModel(oEndEdge.sMeshModelName)->GetMesh()->pMesh;
//Corresponding Halfedges
auto pStartHalfedge = pStartEdgeMesh->halfedge_handle(oStartEdge.hEdge, 0);
......@@ -566,10 +553,10 @@ bool CDiffractionPath::IsEdgeIlluminated(const CITAMesh& oEdgeMesh, const CITAMe
//Test if any face is between the edge vertex point and the emitter
bool isEdgeIlluminated = true;
for (auto &keyMeshModel : m_mpMeshModels)
for(auto &pMeshModel : m_vpMeshModelList)
{
//Current Mesh of current and its face handles
CITAMesh* pCurrentMesh = keyMeshModel.second->GetMesh()->pMesh;
CITAMesh* pCurrentMesh = pMeshModel->GetMesh()->pMesh;
CITAMesh::ConstFaceRange hFaces = pCurrentMesh->faces();
for (CITAMesh::FaceHandle const &hFace : hFaces)
......
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