+ for (unsigned int i=0; i<apt->numTaxiways(); ++i)
+ {
+ FGTaxiway* txwy(apt->getTaxiwayByIndex(i));
+ addRunwayVertices(txwy, tower_lat, tower_lon, scale, taxi_vertices.get());
+ }
+ osg::Geometry *taxi_geom = dynamic_cast<osg::Geometry *>(_geode->getDrawable(0));
+ taxi_geom->setVertexArray(taxi_vertices.get());
+ osg::DrawArrays* taxi = dynamic_cast<osg::DrawArrays*>(taxi_geom->getPrimitiveSet(0));
+ taxi->setCount(taxi_vertices->size());
+
+ osg::Geometry *pvt_geom = dynamic_cast<osg::Geometry *>(_geode->getDrawable(1));
+ osg::Geometry::PrimitiveSetList &pvt_prim_list = pvt_geom->getPrimitiveSetList();
+ pvt_prim_list.clear();
+ for (unsigned int i=0; i<apt->numPavements(); ++i)
+ {
+ FGPavement* pvt(apt->getPavementByIndex(i));
+ osg::ref_ptr<osg::Geometry> geom = addPavementGeometry(pvt, tower_lat, tower_lon, scale);
+ osg::Geometry::PrimitiveSetList &prim_list = geom->getPrimitiveSetList();
+ osg::Vec3Array *vertices = dynamic_cast<osg::Vec3Array *>(geom->getVertexArray());
+ size_t before = pvt_vertices->size(),
+ count = vertices->size();
+ for (size_t i = 0; i < count; ++i )
+ {
+ pvt_vertices->push_back( (*vertices)[i] );
+ }
+ for (osg::Geometry::PrimitiveSetList::iterator ii = prim_list.begin(); ii != prim_list.end(); ++ii )
+ {
+ osg::DrawArrays *da;
+ osg::DrawElementsUByte *de1;
+ osg::DrawElementsUShort *de2;
+ osg::DrawElementsUInt *de3;
+ if ((da = dynamic_cast<osg::DrawArrays *>(ii->get())) != 0)
+ {
+ osg::DrawArrays *ps = new osg::DrawArrays(*da);
+ ps->setFirst(da->getFirst() + before);
+ pvt_prim_list.push_back(ps);
+ }
+ else if ((de1 = dynamic_cast<osg::DrawElementsUByte *>(ii->get())) != 0)
+ {
+ if (before + count <= 255)
+ {
+ osg::DrawElementsUByte *ps = new osg::DrawElementsUByte(*de1);
+ for (size_t j = 0; j < ps->size(); ++j)
+ {
+ (*ps)[j] += before;
+ }
+ pvt_prim_list.push_back(ps);
+ }
+ else if (before + count <= 65535)
+ {
+ osg::DrawElementsUShort *ps = new osg::DrawElementsUShort(de1->getMode(), de1->begin(), de1->end());
+ for (size_t j = 0; j < ps->size(); ++j)
+ {
+ (*ps)[j] += before;
+ }
+ pvt_prim_list.push_back(ps);
+ }
+ else
+ {
+ osg::DrawElementsUInt *ps = new osg::DrawElementsUInt(de1->getMode(), de1->begin(), de1->end());
+ for (size_t j = 0; j < ps->size(); ++j)
+ {
+ (*ps)[j] += before;
+ }
+ pvt_prim_list.push_back(ps);
+ }
+ }
+ else if ((de2 = dynamic_cast<osg::DrawElementsUShort *>(ii->get())) != 0)
+ {
+ if (before + count <= 65535)
+ {
+ osg::DrawElementsUShort *ps = new osg::DrawElementsUShort(*de2);
+ for (size_t j = 0; j < ps->size(); ++j)
+ {
+ (*ps)[j] += before;
+ }
+ pvt_prim_list.push_back(ps);
+ }
+ else
+ {
+ osg::DrawElementsUInt *ps = new osg::DrawElementsUInt(de2->getMode(), de2->begin(), de2->end());
+ for (size_t j = 0; j < ps->size(); ++j)
+ {
+ (*ps)[j] += before;
+ }
+ pvt_prim_list.push_back(ps);
+ }
+ }
+ else if ((de3 = dynamic_cast<osg::DrawElementsUInt *>(ii->get())) != 0)
+ {
+ osg::DrawElementsUInt *ps = new osg::DrawElementsUInt(*de3);
+ for (size_t j = 0; j < ps->size(); ++j)
+ {
+ (*ps)[j] += before;
+ }
+ pvt_prim_list.push_back(ps);
+ }
+ }
+ }
+ pvt_geom->setVertexArray(pvt_vertices.get());
+