Commit 8de2fa5f authored by Dipl.-Ing. Jonas Stienen's avatar Dipl.-Ing. Jonas Stienen

Merging citygml features

parents 3c1dd523 f60f5375
......@@ -21,6 +21,7 @@
// ITAGeo includes
#include <ITAGeoDefinitions.h>
#include <ITAException.h>
// Vista includes
#include <VistaBase/VistaQuaternion.h>
......@@ -203,6 +204,11 @@ namespace ITAGeo
pManager->AssignMaterial( *this, oOther.pAcousticMaterial->GetIdentifier(), pAcousticMaterial );
*/
};
private:
inline const CMirrorImage operator=( const CMirrorImage& )
{
ITA_EXCEPT1( INVALID_PARAMETER, "Copying not allowed" );
};
};
//! Geometrical propagation anchor with parameters of a specular reflection point
......
......@@ -29,6 +29,17 @@
// 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
......@@ -46,9 +57,15 @@ namespace ITAGeo
public:
struct CCityBuilding
{
int num;
std::string id;
std::string type;
VistaVector3D v3CenterPos;
float fBoundingSphereRad;
bool CenterInsideEllipse( const float coordinates[ 4 ], const float SemiMajorAxis, const float SemiMinorAxis ) const;
bool BoundingSphereInsideEllipse( const VistaVector3D& v3centerpos, const float fBSradius, const float SemiMajorAxis, const float SemiMinorAxis ) const;
};
CCityGMLModel();
......@@ -73,16 +90,14 @@ namespace ITAGeo
void DistanceCulling( const double dDetourDistance, const ITAGeo::CEmitter& v3Source, const ITAGeo::CSensor& v3Receiver, std::vector< const CCityBuilding* >& vpResidualBuildings );
void CalculateObjectCentroids();
protected:
CCityGMLPtr* m_pCityModel; //!< Encapsuled pointer to the city GML instance
std::vector< ITAGeo::CHalfedgeMeshModel* > m_pBuildings;
std::vector< CCityBuilding> m_vOBuildings;
bool CenterInsideEllipse( const float coordinates[ 4 ], const float SemiMajorAxis, const float SemiMinorAxis );
bool BoundingSphereInsideEllipse( const VistaVector3D v3centerpos, const float fBSradius, const float SemiMajorAxis, const float SemiMinorAxis );
std::vector< CCityBuilding> m_voBuildings;
};
}
......
......@@ -32,7 +32,6 @@
#include <string>
#include <vector>
namespace ITAGeo
{
class CMaterialManager;
......
......@@ -4,7 +4,7 @@
#include <ITAException.h>
CITAMesh::Point CityGMLPoint3DToITAMeshPoint( const TVec3d& vCityGMLPoint )
CITAMesh::Point CityGMLPoint3DToITAMeshPoint( TVec3d& vCityGMLPoint )
{
return CITAMesh::Point( float( vCityGMLPoint.x ), float( vCityGMLPoint.y ), float( vCityGMLPoint.z ) );
}
......@@ -45,6 +45,6 @@
typedef OpenMesh::PolyMesh_ArrayKernelT<> CITAMesh;
//! Creates CITAMesh point from CityGML point (double precision)
CITAMesh::Point CityGMLPoint3DToITAMeshPoint( const TVec3d& vCityGMLPoint );
CITAMesh::Point CityGMLPoint3DToITAMeshPoint( TVec3d& vCityGMLPoint );
#endif // INCLUDE_WATCHER_ITA_GEO_CITYGML_CONVERSIONS
This diff is collapsed.
......@@ -42,7 +42,7 @@ CITAGeoHalfedgeCityGMLReader::~CITAGeoHalfedgeCityGMLReader()
}
bool CITAGeoHalfedgeCityGMLReader::read( const std::string& sCityGMLFilePath, OpenMesh::IO::BaseImporter& oBaseImporter, OpenMesh::IO::Options& )
{
{ /*
try
{
citygml::ParserParams oParserParams;
......@@ -84,7 +84,7 @@ bool CITAGeoHalfedgeCityGMLReader::read( const std::string& sCityGMLFilePath, Op
}
}
return true;
return true;
}
#ifdef ITA_GEO_WITH_XERCES_SUPPORT
......@@ -98,7 +98,8 @@ bool CITAGeoHalfedgeCityGMLReader::read( const std::string& sCityGMLFilePath, Op
ITA_EXCEPT_INVALID_PARAMETER( "Could not parse CityGML file " + sCityGMLFilePath );
}
return false;
return false; */
return true;
};
bool CITAGeoHalfedgeCityGMLReader::read( std::istream&, OpenMesh::IO::BaseImporter&, OpenMesh::IO::Options& )
......
......@@ -20,7 +20,8 @@
#include <ITAException.h>
#include <ITAStopWatch.h>
#include <ITAGeoCityGMLModel.h>
#include <ITAGeoSketchUpModel.h>
#include <VistaBase/VistaVector3D.h>
#include <VistaMath/VistaGeometries.h>
#include <VistaTools/VistaFileSystemFile.h>
......@@ -36,44 +37,104 @@
#include <xercesc/sax/SAXParseException.hpp>
#endif
// OpenMesh includes
#pragma warning( disable : 4512 4127 )
#include <OpenMesh/Core/Mesh/PolyMesh_ArrayKernelT.hh>
#include <OpenMesh/Core/IO/IOManager.hh>
#include <OpenMesh/Core/IO/MeshIO.hh>
#pragma warning( default : 4512 4127 )
#include <cassert>
#include <iostream>
#include <memory>
#include <string>
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 = "3d - gm_lod2_05766012_Barntrup_EPSG25832_CityGML/LoD2_502_5760_1_NW.gml";
static string sCityGMLFilePath = "LOD2_0_F0.gml";
// Resource (Land NRW, 2017, https://www.govdata.de/dl-de/by-2-0): https://www.opengeodata.nrw.de/produkte/geobasis/3d-gm/3d-gm_lod2/
static string sCityGMLFilePath = "Aachen/LoD2_287_5631_1_NW_no_terrain_intersection.gml";
//static string sCityGMLFilePath = "Aachen/LoD2_287_5631_1_NW_no_terrain_intersection.gml";
//static string sCityGMLFilePath = "3d - gm_lod2_05766012_Barntrup_EPSG25832_CityGML/LoD2_502_5760_1_NW.gml";
int main( int, char** )
{
citygml::ParserParams oParserParams;
shared_ptr< const citygml::CityModel > pCityModel;
shared_ptr< citygml::CityGMLLogger > pLogger = nullptr;
ITAGeo::CCityGMLModel oModel;
try
{
cout << "Loading CityGML file path '" << sCityGMLFilePath << "'" << endl;
pCityModel = citygml::load( sCityGMLFilePath, oParserParams, pLogger );
cout << "\tIdentifier: " << pCityModel->getId() << endl;
cout << "\tNum root objects: " << pCityModel->getNumRootCityObjects() << endl;
cout << "Root CityObjects: " << std::endl;
citygml::ConstCityObjects rootObjcts = pCityModel->getRootCityObjects();
for( const citygml::CityObject* cityObj : rootObjcts )
oModel.Load( sCityGMLFilePath );
cout << "Loading successful! " << endl;
cout << "Continuing with centroid calculation of cityobjects...." << endl;
oModel.CalculateObjectCentroids();
float fDistance = 1000;
ITAGeo::CSensor oReceiver;
oReceiver.vPos.SetValues( 300.0f, 300.0f, 0.0f );
ITAGeo::CEmitter oSource;
oSource.vPos.SetValues( 100.0f, 100.0f, 10.0f );
std::vector< const ITAGeo::CCityGMLModel::CCityBuilding* > RemainingObjects;
cout << "Executing Culling Test with Distance of 1000m, Source Position at 100/100/10, Receiver Position at 300/300/0 " << endl;
oModel.DistanceCulling( fDistance, oSource, oReceiver, RemainingObjects );
cout << RemainingObjects.size() << " Objects Remaining" << endl;
for( unsigned int i = 0; i < RemainingObjects.size(); i++ )
{
cout << cityObj->getTypeAsString() << endl;
cout << RemainingObjects[ i ]->id << " " << RemainingObjects[ i ]->v3CenterPos << endl;
}
cout << "Testing Mesh Conversion....";
std::vector<ITAGeo::CHalfedgeMeshModel> CityMesh( RemainingObjects.size() );
for( unsigned int i = 0; i < RemainingObjects.size(); i++ )
oModel.GetBuildingMesh( RemainingObjects[ i ], &CityMesh[ i ] );
/*
for (unsigned int i = 0; i < CityMesh.size(); i++)
{
auto s = std::to_string(i+1);
OpenMesh::IO::write_mesh(CityMesh[i], s + ". ObjectMesh.obj");
} */
/* cout << "Creating PointCloud Visualisation...";
std::vector<VistaVector3D> vvPointCloud;
for (unsigned int j = 0; j < RemainingObjects.size(); j++)
{
vvPointCloud.push_back(RemainingObjects[j]->v3CenterPos);
}
CITAGeoPropagationPath oDummyPath;
for (int n = 0; n<vvPointCloud.size(); n++)
{
CITAGeoPropagationAnchor* pAnchor = new CITAGeoPropagationAnchor(vvPointCloud[n]);
oDummyPath.push_back(pAnchor);
}
CITAGeoSketchUpModel CulledModel;
CulledModel.AddPropagationPathVisualization(oDummyPath, "PointCloudPolyLine");
CulledModel.Store("CulledModel.skp"); */
//cout << "\tIdentifier: " << pCityModel->getId() << endl;
//cout << "\tNum root objects: " << pCityModel->getNumRootCityObjects() << endl;
}
catch( ... )
catch( ITAException e )
{
cerr << "Unrecognized exception during citygml::load of " << sCityGMLFilePath << endl;
if( pLogger )
cerr << pLogger << endl;
cerr << e << endl;
}
return 0;
......
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