Skip to content

Commit

Permalink
create different pylons
Browse files Browse the repository at this point in the history
  • Loading branch information
uwewoessner committed Sep 8, 2024
1 parent 957e7b6 commit c704f4b
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions osgplugin/ReaderWriterCityGML.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -997,7 +997,22 @@ bool ReaderWriterCityGML::createSingleCityObject(const citygml::CityObject& obje
{
std::string sheight = object.getAttribute("bldg:measuredheight");
float height = std::stof(sheight);
float scale = height / 31.0; // our model is 31 m high
float scale = 1.0;
std::string powerlineFile = "Freileitung.ive";
if(height>=30)
{
scale = height / 31.0; // our model is 31 m high
}
else if(height>=15)
{
scale = height / 20.0;
powerlineFile = "Freileitung20.ive";
}
else
{
scale = height / 10.0;
powerlineFile = "FreileitungSmall.ive";
}
isSpecial = true;
osg::ProxyNode* p = new osg::ProxyNode();
osg::MatrixTransform* m = new osg::MatrixTransform();
Expand All @@ -1007,7 +1022,7 @@ bool ReaderWriterCityGML::createSingleCityObject(const citygml::CityObject& obje
float angle = atan2(direction.x(), direction.y());
m->setMatrix(osg::Matrix::scale(osg::Vec3(scale, scale, scale)) * osg::Matrix::rotate(angle, osg::Vec3(0, 0, 1)) * osg::Matrix::translate(position-offset));

p->setFileName(0, "Freileitung.ive");
p->setFileName(0, powerlineFile);
m->addChild(p);
root->addChild(m);
}
Expand Down

0 comments on commit c704f4b

Please sign in to comment.