Renaming some preproc flags and trying to get around SU loops with multiple...

Renaming some preproc flags and trying to get around SU loops with multiple vertex indeces in the list
parent f046e1f2
......@@ -27,6 +27,10 @@ if( NOT DEFINED ITA_GEO_WITH_IFC_SUPPORT )
set( ITA_GEO_WITH_IFC_SUPPORT OFF CACHE BOOL "Build with IFC support (requires ifcopenshell)" )
endif( )
if( NOT DEFINED ITA_GEO_WITH_XERCES_SUPPORT )
set( ITA_GEO_WITH_XERCES_SUPPORT OFF CACHE BOOL "Build with XERCES support (requires xerces)" )
endif( )
if( ITA_GEO_WITH_OPEN_MESH_SUPPORT )
vista_use_package( OpenMesh REQUIRED )
#add_definitions( -DOPENMESHDLL )
......@@ -40,12 +44,18 @@ if( ITA_GEO_WITH_CITYGML_SUPPORT )
vista_use_package( xerces REQUIRED FIND_DEPENDENCIES )
vista_use_package( gdal REQUIRED FIND_DEPENDENCIES )
vista_use_package( libcitygml REQUIRED FIND_DEPENDENCIES )
#add_definitions( -DLIBCITYGML_STATIC )
endif( )
if( ITA_GEO_WITH_IFC_SUPPORT )
vista_use_package( ifcopenshell REQUIRED )
endif( )
if( ITA_GEO_WITH_XERCES_SUPPORT )
add_definitions( -DWITH_XERCES_SUPPORT )
#add_definitions( -DXERCES_STATIC_LIBRARY )
endif( )
# includes
include_directories( "include" )
......
......@@ -20,9 +20,13 @@
#include <citygml/tesselator.h>
#pragma warning( default : 4201 )
#ifdef ITA_GEO_WITH_XERCES_SUPPORT
#ifdef WITH_XERCES_SUPPORT
// Xerces-c
#include <xercesc/sax/SAXException.hpp>
#include <xercesc/sax/SAXParseException.hpp>
using namespace XERCES_CPP_NAMESPACE;
#endif
// OpenMesh includes
......@@ -120,14 +124,15 @@ bool ITAGeo::CCityGMLModel::Load( const std::string& sCityGMLFilePath )
for( unsigned int i = 0; i < pCityRootObjects.size(); i++ )
{
const citygml::CityObject* Object = pCityRootObjects[ i ];
//std::cout << "Parsed Object: " << Object->getId() << " || Object Type: " << Object->getTypeAsString() << std::endl;
std::cout << "Parsed Object: " << Object->getId() << " || Object Type: " << Object->getTypeAsString() << std::endl;
}
return true;
}
#ifdef ITA_GEO_WITH_XERCES_SUPPORT
#ifdef WITH_XERCES_SUPPORT
catch( SAXParseException& e )
{
ITA_EXCEPT_INVALID_PARAMETER( "Could not parse CityGML file " + sCityGMLFilePath + ": " + e.str() );
std::stringstream ss; ss << e.getMessage() << std::endl;
ITA_EXCEPT_INVALID_PARAMETER( "Could not parse CityGML file " + sCityGMLFilePath + ": " + ss.str() );
}
#endif
catch( ... )
......
......@@ -24,7 +24,7 @@
#include <citygml/vecs.hpp>
#pragma warning( default : 4201 )
#ifdef ITA_GEO_WITH_XERCES_SUPPORT
#ifdef WITH_XERCES_SUPPORT
// Xerces-c
#include <xercesc/sax/SAXParseException.hpp>
#endif
......@@ -87,7 +87,7 @@ bool CITAGeoHalfedgeCityGMLReader::read( const std::string& sCityGMLFilePath, Op
return true;
}
#ifdef ITA_GEO_WITH_XERCES_SUPPORT
#ifdef WITH_XERCES_SUPPORT
catch( SAXParseException& e )
{
ITA_EXCEPT_INVALID_PARAMETER( "Could not parse CityGML file " + sCityGMLFilePath + ": " + e.str() );
......
......@@ -46,7 +46,11 @@ bool SUColorToOneDimAcousticMaterial( std::shared_ptr< ITAGeo::CScalarMaterial >
bool AcousticMaterialToSUMaterial( CITAMesh* pMesh, CITAMesh::FaceHandle hFace, SUMaterialRef* pSUFaceMaterial, ITAGeo::CMaterialManager* )
{
assert( pMesh );
auto pMaterial = pMesh->property( tAcousticFaceProp, hFace ).GetMaterial();
std::shared_ptr< IAcousticMaterial > pMaterial = nullptr;
if( pMesh->get_property_handle( tAcousticFaceProp, "<fprop>" ) )
pMaterial = pMesh->property( tAcousticFaceProp, hFace ).GetMaterial();
if( pMaterial == nullptr )
return false;
......
......@@ -219,7 +219,10 @@ SUResult ITAMeshToSUEntities( CITAMesh* pMesh, SUEntitiesRef* rEntities, SULayer
{
CITAMesh::VertexHandle hVertex( *fv_it++ );
size_t iVertexIndex = hVertex.idx();
SU_RET( SULoopInputAddVertexIndex( rLoop, iVertexIndex ) );
//SU_RET( SULoopInputAddVertexIndex( rLoop, iVertexIndex ) );
SUResult sur;
if( ( sur = SULoopInputAddVertexIndex( rLoop, iVertexIndex ) ) == SU_ERROR_UNSUPPORTED )
break;
}
size_t iFaceIndex;
......
......@@ -22,6 +22,7 @@
#include <ITAStopWatch.h>
#include <ITAGeoCityGMLModel.h>
#include <ITAGeoSketchUpModel.h>
#include <ITAGeoHalfedgeMeshModel.h>
#include <VistaBase/VistaVector3D.h>
#include <VistaMath/VistaGeometries.h>
#include <VistaTools/VistaFileSystemFile.h>
......@@ -33,7 +34,7 @@
#include <citygml/geometry.h>
#pragma warning ( default: 4201 )
#ifdef ITA_GEO_WITH_XERCES_SUPPORT
#ifdef WITH_XERCES_SUPPORT
#include <xercesc/sax/SAXParseException.hpp>
#endif
......@@ -53,7 +54,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_0_F0.gml";
static string sCityGMLFilePath = "LoD2_288_5631_1_NW.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";
......@@ -63,11 +64,16 @@ int main( int, char** )
{
ITAGeo::CCityGMLModel oModel;
VistaFileSystemFile f( sCityGMLFilePath );
try
{
cout << "Loading CityGML file path '" << sCityGMLFilePath << "'" << endl;
if( !f.Exists() )
ITA_EXCEPT_INVALID_PARAMETER( "File path " + f.GetName() + " does not exist." );
cout << "Loading CityGML file path '" << f.GetLocalName() << "'" << endl;
oModel.Load( sCityGMLFilePath );
oModel.Load( f.GetName() );
cout << "Loading successful! " << endl;
......@@ -77,10 +83,10 @@ int main( int, char** )
float fDistance = 1000;
ITAGeo::CSensor oReceiver;
oReceiver.vPos.SetValues( 300.0f, 300.0f, 0.0f );
oReceiver.vPos.SetValues( 288153.0f, 5631691.0f, 190.0f );
ITAGeo::CEmitter oSource;
oSource.vPos.SetValues( 100.0f, 100.0f, 10.0f );
oSource.vPos.SetValues( 288253.0f, 5631591.0f, 193.0f );
std::vector< const ITAGeo::CCityGMLModel::CCityBuilding* > RemainingObjects;
......@@ -97,20 +103,30 @@ int main( int, char** )
cout << "Testing Mesh Conversion....";
std::vector<ITAGeo::CHalfedgeMeshModel> CityMesh( RemainingObjects.size() );
std::vector< ITAGeo::CHalfedgeMeshModel > CityMesh( RemainingObjects.size() );
ITAGeo::CSketchUpModel voSketchUpCity;
cout << ITAGeo::CHalfedgeMeshModel::GetSupportedOutputFormats() << endl;
for( unsigned int i = 0; i < RemainingObjects.size(); i++ )
{
cout << "Fetching building " << i << endl;
oModel.GetBuildingMesh( RemainingObjects[ i ], &CityMesh[ i ] );
cout << "Barycenter: " << CityMesh[ i ].GetBarycenter() << endl;
/*
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");
} */
auto s = std::to_string( i );
cout << "Exporting " << s << endl;
voSketchUpCity.AddVisualizationMesh( &CityMesh[ i ] );
cout << "Stored " << s << endl;
if( i == 66 )
break;
}
voSketchUpCity.Store( "LoD2_288_5631_1_NW.skp" );
/* cout << "Creating PointCloud Visualisation...";
std::vector<VistaVector3D> vvPointCloud;
......
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