-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to get the index of vertex #86
Comments
Hi @fuqifacai ! Maybe I'm misunderstanding, but if your goal is to generate tessellated mesh geometry from a CityGML file, then you should use libcitygml/osgplugin/ReaderWriterCityGML.cpp Line 361 in 3f66e6a
|
Thanks for your reply. |
Hi again @fuqifacai (By the way, I'm not the maintainer of this project - I'm just someone using it, so not everything I say might be 100% correct ) Hmm, that's weird. I was able to successfully get the data from getVertices/getIndices.. I'm wondering, have you created a valid This is how I initialise it in our application: std::unique_ptr<TesselatorBase> tesselator = std::unique_ptr<TesselatorBase>(new Tesselator(nullptr));
std::shared_ptr<const citygml::CityModel> city = citygml::load(filePath, params, std::move(tesselator)); This is how it looks for me: I'm afraid I can't share my full source code (since it belongs to my employer), but maybe I can set up a simple sample project if that's useful? |
@mlavik1 |
@fuqifacai |
@mlavik1 |
Hi again @fuqifacai , std::shared_ptr<const citygml::CityModel> city = citygml::load(filePath, params, std::move(tesselator));
const auto& themes = city->themes();
std::string theme = themes.size() > 0 ? themes[0] : ""; // I pick the first one, but if there are several themes you might want to support custom theme selection Then, when you're processing the geometry you can call unsigned int polygonCount = geometry.getPolygonsCount();
for (unsigned int i = 0; i < polygonCount; ++i)
{
auto polygon = geometry.getPolygon(i);
const auto citygmlMaterial = polygon->getMaterialFor(theme);
if (citygmlMaterial)
{
auto col = citygmlMaterial->getDiffuse();
...
}
} If the polygon has no material for the given theme, then you can call I'm not 100% sure, but I believe |
Thanks for your detailed reply . |
No idea! I've just seen it in some software - though I don't have a lot of practical experience with CityGML yet (started working with it a few months ago). |
But for this specific model that shouldn't be needed, since it already has materials. |
Maybe i can help out here... It has its roots in the histrorical development of the CityGML Standard which was conducted in Germany. It is quite typical for roofs to have a red-ish color. This also facilitated visual debugging a lot ;-) |
Finally understood. |
Hi :
I can get the vertex info from test gml file by using below sample codes, however there is no index or indics for these vertex info.
How can I get that ? My goal is to generate the mesh object by using vertex and index info.
Thanks.
std::shared_ptr myPolygon = inGeometry.getPolygon(i);
std::shared_ptr myExternalLinearRing = tempPolygon->exteriorRing();
std::vector myExternalLinearVertices = myExternalLinearRing->getVertices();
The text was updated successfully, but these errors were encountered: