void OrderedTask::UpdateStatsGeometry() { ScanStartFinish(); stats.task_valid = CheckTask(); stats.has_targets = stats.task_valid && HasTargets(); stats.is_mat = GetFactoryType() == TaskFactoryType::MAT; stats.has_optional_starts = stats.task_valid && HasOptionalStarts(); }
void OrderedTask::UpdateGeometry() { ScanStartFinish(); if (!HasStart() || !task_points[0]) return; // scan location of task points for (auto begin = task_points.cbegin(), end = task_points.cend(), i = begin; i != end; ++i) { if (i == begin) task_projection.reset((*i)->GetLocation()); (*i)->ScanProjection(task_projection); } // ... and optional start points for (auto i = optional_start_points.cbegin(), end = optional_start_points.cend(); i != end; ++i) (*i)->ScanProjection(task_projection); // projection can now be determined task_projection.update_fast(); // update OZ's for items that depend on next-point geometry UpdateObservationZones(task_points, task_projection); UpdateObservationZones(optional_start_points, task_projection); // now that the task projection is stable, and oz is stable, // calculate the bounding box in projected coordinates for (auto i = task_points.cbegin(), end = task_points.cend(); i != end; ++i) (*i)->UpdateBoundingBox(task_projection); for (auto i = optional_start_points.cbegin(), end = optional_start_points.cend(); i != end; ++i) (*i)->UpdateBoundingBox(task_projection); // update stats so data can be used during task construction /// @todo this should only be done if not flying! (currently done with has_entered) if (!taskpoint_start->HasEntered()) { GeoPoint loc = taskpoint_start->GetLocation(); UpdateStatsDistances(loc, true); if (HasFinish()) { /// @todo: call AbstractTask::update stats methods with fake state /// so stats are updated } } }