Commit f466131e authored by Julian Jansen's avatar Julian Jansen

deleted obsolete getcitymesh function

parent a26c285e
......@@ -29,76 +29,83 @@
// STL includes
#include <string>
#include <vector>
// OpenMesh includes
#pragma warning( disable : 4512 4127 )
#include <OpenMesh/Core/Mesh/PolyMesh_ArrayKernelT.hh>
#include <OpenMesh/Core/IO/IOManager.hh>
#include <OpenMesh/Core/IO/importer/ImporterT.hh>
#pragma warning( default : 4512 4127 )
struct CITACityGMLPtr;
typedef OpenMesh::PolyMesh_ArrayKernelT<> CITAMesh;
namespace ITAGeo
//! CityGML input and output class
/**
* Interface that describes file I/O for CityGML files.
*
*/
class ITA_GEO_API CITAGeoCityGMLModel : public ITAGeo::CModelBase
{
//! Helper struct forward declaration
struct CCityGMLPtr;
//! CityGML input and output class
/**
* Interface that describes file I/O for CityGML files.
*
*/
class ITA_GEO_API CCityGMLModel : public CModelBase
public:
class CCityObject //!< Contains the relevant information from the CityGML Objects
{
public:
struct CCityBuilding
{
int num;
std::string id;
std::string type;
VistaVector3D v3CenterPos;
float fBoundingSphereRad;
int iNum;
std::string sID;
std::string sType;
VistaVector3D v3CentroidPosition;
float fBoundingSphereRadius;
bool CenterInsideEllipse( const float coordinates[ 4 ], const float SemiMajorAxis, const float SemiMinorAxis ) const;
//! Checks if the centroid of an object is inside the defined ellipsoid
bool CentroidInsideEllipsoid(const float fCoordinates[4], const float fSemiMajorAxis, const float fSemiMinorAxis);
bool BoundingSphereInsideEllipse( const VistaVector3D& v3centerpos, const float fBSradius, const float SemiMajorAxis, const float SemiMinorAxis ) const;
};
//! Checks if the bounding sphere of an object intersects the defined ellipsoid
bool BoundingSphereIntersectsEllipsoid(const VistaVector3D v3Centroid, const float fBSRadius, const float fSemiMajorAxis, const float fSemiMinorAxis);
};
CCityGMLModel();
virtual ~CCityGMLModel();
CITAGeoCityGMLModel();
virtual ~CITAGeoCityGMLModel();
//! Loads CityGML data from given file path
/*
* \note Throws ITAException (i.e. if file not found)
* \return True, if CityGML file can be translated into a scene
*
*/
bool Load( const std::string& sGMLFilePath );
//! Loads CityGML data from given file path
/*
* \note Throws ITAException (i.e. if file not found)
* \return True, if CityGML file can be translated into a scene
*
*/
bool Load( const std::string& sGMLFilePath );
//! Saves CityGML data to given file path
/*
* \note Throws ITAException (i.e. if file could not be written)
* \return True, if file could be exported
*/
bool Store( const std::string& sGMLFilePath, bool bOverwrite = true ) const;
//! Saves CityGML data to given file path
/*
* \note Throws ITAException (i.e. if file could not be written)
* \return True, if file could be exported
*/
bool Store( const std::string& sGMLFilePath, bool bOverwrite = true ) const;
void GetBuildingMesh( const CCityBuilding* pBuilding, ITAGeo::CHalfedgeMeshModel* pBuildingMesh );
//! Calculates centroid coordinates and boundingsphere of city object
/*
*
*
*/
void PrepareCityObjects();
void DistanceCulling( const double dDetourDistance, const ITAGeo::CEmitter& v3Source, const ITAGeo::CSensor& v3Receiver, std::vector< const CCityBuilding* >& vpResidualBuildings );
//! Creates mesh network of citygml object vertices
/*
*
*
*/
void GetObjectMesh(const CCityObject* pObject, CITAMesh& oObjectMesh);
void CalculateObjectCentroids();
//! Identifies relevant objects for propagation simulation based on max propagation Distance (derived form dynamic range)
//! and Source and Receiver positions
void DistanceCulling(const float fPropagationDistance, const VistaVector3D& v3SourcePosition, const VistaVector3D& v3ReceiverPosition, std::vector< const CCityObject* >& vpResidualObjects);
protected:
CCityGMLPtr* m_pCityModel; //!< Encapsuled pointer to the city GML instance
std::vector< ITAGeo::CHalfedgeMeshModel* > m_pBuildings;
std::vector< CCityBuilding> m_voBuildings;
};
}
protected:
CITACityGMLPtr* m_pCityModel; //!< Encapsuled pointer to the city GML instance
std::vector< ITAGeo::CHalfedgeMeshModel* > m_pObjects;
std::vector< CCityObject> m_vOObjects;
};
#endif // INCLUDE_WATCHER_ITA_GEO_CITYGML_MODEL
......@@ -43,36 +43,9 @@ struct CITACityGMLPtr
};
void CITAGeoCityGMLModel::GetCityMesh(const CCityObject* pObject, CITAMesh& oCityMesh)
{
const citygml::CityObject& oCityRootObject = m_pCityModel->pCityModel->getRootCityObject(pObject->iNum - 1);
for (unsigned int j = 0; j < oCityRootObject.getChildCityObjectsCount(); j++)
{
for (unsigned int k = 0; k < oCityRootObject.getChildCityObject(j).getGeometriesCount(); k++)
{
for (unsigned int l = 0; l < oCityRootObject.getChildCityObject(j).getGeometry(k).getPolygonsCount(); l++)
{
std::shared_ptr<const citygml::Polygon> pPolygon = oCityRootObject.getChildCityObject(j).getGeometry(k).getPolygon(l);
std::vector<TVec3d> vPolygonVertices = pPolygon->getVertices();
// vPolygonVertices.pop_back();
std::vector<CITAMesh::VertexHandle> vFaceVertices;
vFaceVertices.clear();
for (unsigned int m = 0; m < vPolygonVertices.size(); m++)
{
vFaceVertices.push_back(oCityMesh.add_vertex(CityGMLPoint3DToITAMeshPoint(vPolygonVertices[m])));
}
oCityMesh.add_face(vFaceVertices);
}
}
}
}
//! PROBABLY RESOLVED Not working properly ATM // throws Polygon Connectivity error at seemingly random points.
//! Resolved for Polygons without Holes // throws Polygon Connectivity error at seemingly random points.
void CITAGeoCityGMLModel::GetObjectMesh(const CCityObject* pBuilding, CITAMesh& oObjectMesh)
{
const citygml::CityObject& oCityRootObject = m_pCityModel->pCityModel->getRootCityObject(pBuilding->iNum - 1);
......@@ -243,6 +216,7 @@ void CITAGeoCityGMLModel::PrepareCityObjects()
const TVec3d v3TObjectCentroid(fObjectCentroid_X / vPolygonCentroids.size(), fObjectCentroid_Y / vPolygonCentroids.size(), fObjectCentroid_Z / vPolygonCentroids.size());
const VistaVector3D v3ObjectCentroid(v3TObjectCentroid.x, v3TObjectCentroid.y, v3TObjectCentroid.z);
std::cout << v3ObjectCentroid << std::endl;
//Defining Object Boundingsphere by finding Object Vertex that is the farthest from Centroid and using this distance as radius for the Boundingsphere
float fMaxDistance = 0;
......
......@@ -47,7 +47,7 @@ using namespace std;
typedef OpenMesh::PolyMesh_ArrayKernelT<> CITAMesh;
// Resource (CC BY-SA 4.0 Filip Biljecki): https://3d.bk.tudelft.nl/biljecki/Random3Dcity.html
static string sCityGMLFilePath = "LoD2_288_5631_1_NW.gml";
static string sCityGMLFilePath = "Delft_3dfier.gml";
int main( int, char** )
{
......@@ -101,7 +101,7 @@ int main( int, char** )
ITAStopWatch Culling;
for (int i = 0; i < 30000; i++)
for (int i = 0; i < 1; i++)
{
Culling.start();
oModel.DistanceCulling(fDistance, oSource.vPos, oReceiver.vPos, RemainingObjects);
......@@ -136,8 +136,8 @@ int main( int, char** )
cout << "Mesh Conversion to CityMesh took " << MeshWatch.stop() << " seconds." << endl;
*/
/*std::vector<CITAMesh> vCityMesh;
MeshWatch.start();
std::vector<CITAMesh> vCityMesh;
for (unsigned int i = 0; i < RemainingObjects.size(); i++)
{
CITAMesh ObjectMesh;
......@@ -149,9 +149,9 @@ int main( int, char** )
for (unsigned int i = 0; i < vCityMesh.size(); i++)
{
auto s = std::to_string(i+1);
OpenMesh::IO::write_mesh(vCityMesh[i], s + ". ObjectMesh.skp");
OpenMesh::IO::write_mesh(vCityMesh[i], s + ". ObjectMesh.obj");
}
cout << "Mesh Conversion to seperate ObjectMeshes took " << MeshWatch.stop() << " seconds." << endl; */
//cout << "Mesh Conversion to seperate ObjectMeshes took " << MeshWatch.stop() << " seconds." << endl;
}
catch( ... )
......
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