- // Handle start point
- int pos = i->getCurrentPosition();
- //cerr << "rendering for " << i->getAircraft()->getCallSign() << "pos = " << pos << endl;
- if (pos > 0) {
- FGTaxiSegment *segment = parent->getGroundNetwork()->findSegment(pos);
- SGGeod start(SGGeod::fromDeg((i->getLongitude()), (i->getLatitude())));
- SGGeod end (SGGeod::fromDeg(segment->getEnd()->getLongitude(), segment->getEnd()->getLatitude()));
-
- double length = SGGeodesy::distanceM(start, end);
- //heading = SGGeodesy::headingDeg(start->getGeod(), end->getGeod());
-
- double az2, heading; //, distanceM;
- SGGeodesy::inverse(start, end, heading, az2, length);
- double coveredDistance = length * 0.5;
- SGGeod center;
- SGGeodesy::direct(start, heading, coveredDistance, center, az2);
- //cerr << "Active Aircraft : Centerpoint = (" << center.getLatitudeDeg() << ", " << center.getLongitudeDeg() << "). Heading = " << heading << endl;
- ///////////////////////////////////////////////////////////////////////////////
- // Make a helper function out of this
- osg::Matrix obj_pos;
- osg::MatrixTransform *obj_trans = new osg::MatrixTransform;
- obj_trans->setDataVariance(osg::Object::STATIC);
- // Experimental: Calculate slope here, based on length, and the individual elevations
- double elevationStart;
- if (isUserAircraft((i)->getAircraft())) {
- elevationStart = fgGetDouble("/position/ground-elev-m");
- } else {
- elevationStart = ((i)->getAircraft()->_getAltitude());
- }
- double elevationEnd = segment->getEnd()->getElevation();
- if ((elevationEnd == 0) || (elevationEnd == parent->getElevation())) {
- SGGeod center2 = end;
- center2.setElevationM(SG_MAX_ELEVATION_M);
- if (local_scenery->get_elevation_m( center2, elevationEnd, NULL )) {
- elevation_feet = elevationEnd * SG_METER_TO_FEET + 0.5;
- //elevation_meters += 0.5;
- }
- else {
- elevationEnd = parent->getElevation();
- }
- segment->getEnd()->setElevation(elevationEnd);
- }
-
- double elevationMean = (elevationStart + elevationEnd) / 2.0;
- double elevDiff = elevationEnd - elevationStart;
-
- double slope = atan2(elevDiff, length) * SGD_RADIANS_TO_DEGREES;
-
- //cerr << "1. Using mean elevation : " << elevationMean << " and " << slope << endl;
-
- WorldCoordinate( obj_pos, center.getLatitudeDeg(), center.getLongitudeDeg(), elevationMean + 0.5, -(heading), slope );
-;
-
- obj_trans->setMatrix( obj_pos );
- //osg::Vec3 center(0, 0, 0)
-
- float width = length /2.0;
- osg::Vec3 corner(-width, 0, 0.25f);
- osg::Vec3 widthVec(2*width + 1, 0, 0);
- osg::Vec3 heightVec(0, 1, 0);
- osg::Geometry* geometry;
- geometry = osg::createTexturedQuadGeometry(corner, widthVec, heightVec);
- simgear::EffectGeode* geode = new simgear::EffectGeode;
- geode->setName("test");
- geode->addDrawable(geometry);
- //osg::Node *custom_obj;
- SGMaterial *mat = matlib->find("UnidirectionalTaper");
- if (mat)
- geode->setEffect(mat->get_effect());
- obj_trans->addChild(geode);
- // wire as much of the scene graph together as we can
- //->addChild( obj_trans );
- group->addChild( obj_trans );
- /////////////////////////////////////////////////////////////////////
- } else {
- //cerr << "BIG FAT WARNING: current position is here : " << pos << endl;
- }
- for(intVecIterator j = (i)->getIntentions().begin(); j != (i)->getIntentions().end(); j++) {
- osg::Matrix obj_pos;
- int k = (*j);
- if (k > 0) {
- //cerr << "rendering for " << i->getAircraft()->getCallSign() << "intention = " << k << endl;
+ if (i->isActive(300)) {
+ // Handle start point
+ int pos = i->getCurrentPosition();
+ //cerr << "rendering for " << i->getAircraft()->getCallSign() << "pos = " << pos << endl;
+ if (pos > 0) {
+ FGTaxiSegment *segment = parent->getGroundNetwork()->findSegment(pos);
+ SGGeod start(SGGeod::fromDeg((i->getLongitude()), (i->getLatitude())));
+ SGGeod end (SGGeod::fromDeg(segment->getEnd()->getLongitude(), segment->getEnd()->getLatitude()));
+
+ double length = SGGeodesy::distanceM(start, end);
+ //heading = SGGeodesy::headingDeg(start->getGeod(), end->getGeod());
+
+ double az2, heading; //, distanceM;
+ SGGeodesy::inverse(start, end, heading, az2, length);
+ double coveredDistance = length * 0.5;
+ SGGeod center;
+ SGGeodesy::direct(start, heading, coveredDistance, center, az2);
+ //cerr << "Active Aircraft : Centerpoint = (" << center.getLatitudeDeg() << ", " << center.getLongitudeDeg() << "). Heading = " << heading << endl;
+ ///////////////////////////////////////////////////////////////////////////////
+ // Make a helper function out of this
+ osg::Matrix obj_pos;