bool OrderedTaskPoint::Equals(const OrderedTaskPoint &other) const { return GetWaypoint() == other.GetWaypoint() && GetType() == other.GetType() && GetObservationZone().Equals(other.GetObservationZone()) && other.GetObservationZone().Equals(GetObservationZone()); }
inline void TaskPointRenderer::DrawOZForeground(const OrderedTaskPoint &tp, int offset) { ozv.Draw(canvas, OZRenderer::LAYER_INACTIVE, m_proj, tp.GetObservationZone(), offset); ozv.Draw(canvas, OZRenderer::LAYER_ACTIVE, m_proj, tp.GetObservationZone(), offset); }
void TaskPointRenderer::DrawOZForeground(const OrderedTaskPoint &tp) { int offset = index - active_index; if (mode_optional_start) offset = -1; // render optional starts as deactivated ozv.Draw(canvas, OZRenderer::LAYER_INACTIVE, m_proj, tp.GetObservationZone(), offset); ozv.Draw(canvas, OZRenderer::LAYER_ACTIVE, m_proj, tp.GetObservationZone(), offset); }
gcc_pure static unsigned get_radius(const OrderedTaskPoint &tp) { const CylinderZone &oz = (const CylinderZone &)tp.GetObservationZone(); return (unsigned)oz.GetRadius(); }
inline void TaskPointRenderer::DrawOZBackground(Canvas &canvas, const OrderedTaskPoint &tp, int offset) { ozv.Draw(canvas, OZRenderer::LAYER_SHADE, m_proj, tp.GetObservationZone(), offset); }
void Serialiser::Serialise(const OrderedTaskPoint &data, const TCHAR* name) { // do nothing std::unique_ptr<DataNode> child(node.AppendChild(_T("Point"))); child->SetAttribute(_T("type"), name); std::unique_ptr<DataNode> wchild(child->AppendChild(_T("Waypoint"))); Serialiser wser(*wchild); wser.Serialise(data.GetWaypoint()); std::unique_ptr<DataNode> ochild(child->AppendChild(_T("ObservationZone"))); Serialiser oser(*ochild); oser.Serialise(data.GetObservationZone()); }
gcc_pure static Declaration::TurnPoint::Shape get_shape(const OrderedTaskPoint &tp) { const ObservationZonePoint &oz = tp.GetObservationZone(); switch (oz.GetShape()) { case ObservationZonePoint::LINE: return Declaration::TurnPoint::LINE; case ObservationZonePoint::CYLINDER: return Declaration::TurnPoint::CYLINDER; default: return Declaration::TurnPoint::SECTOR; } }
static void Serialise(WritableDataNode &node, const OrderedTaskPoint &data, const TCHAR *name) { // do nothing std::unique_ptr<WritableDataNode> child(node.AppendChild(_T("Point"))); child->SetAttribute(_T("type"), name); std::unique_ptr<WritableDataNode> wchild(child->AppendChild(_T("Waypoint"))); Serialise(*wchild, data.GetWaypoint()); std::unique_ptr<WritableDataNode> ochild(child->AppendChild(_T("ObservationZone"))); Serialise(*ochild, data.GetObservationZone()); if (data.GetType() == TaskPointType::AST) { const ASTPoint &ast = (const ASTPoint &)data; if (ast.GetScoreExit()) child->SetAttribute(_T("score_exit"), true); } }
void TaskPointRenderer::DrawOZBackground(Canvas &canvas, const OrderedTaskPoint &tp) { ozv.Draw(canvas, OZRenderer::LAYER_SHADE, m_proj, tp.GetObservationZone(), index - active_index); }
gcc_pure static double GetRadius(const OrderedTaskPoint &tp) { return GetRadius(tp.GetObservationZone()); }
bool test_task_aat(TaskManager& task_manager, const Waypoints &waypoints) { task_manager.SetFactory(TaskFactoryType::AAT); AbstractTaskFactory &fact = task_manager.GetFactory(); const Waypoint *wp; task_report(task_manager, "# adding start\n"); wp = waypoints.LookupId(1); if (wp) { OrderedTaskPoint *tp = fact.CreateStart(*wp); if (!fact.Append(*tp,false)) { return false; } delete tp; } task_manager.SetActiveTaskPoint(0); task_manager.Resume(); task_report(task_manager, "# adding intermediate\n"); wp = waypoints.LookupId(2); if (wp) { OrderedTaskPoint* tp = fact.CreateIntermediate(TaskPointFactoryType::AAT_CYLINDER,*wp); if (tp->GetObservationZone().GetShape() == ObservationZone::Shape::CYLINDER) { CylinderZone &cz = (CylinderZone &)tp->GetObservationZone(); cz.SetRadius(fixed(30000.0)); } if (!fact.Append(*tp,false)) { return false; } delete tp; } task_report(task_manager, "# adding intermediate\n"); wp = waypoints.LookupId(3); if (wp) { OrderedTaskPoint* tp = fact.CreateIntermediate(TaskPointFactoryType::AAT_CYLINDER,*wp); if (tp->GetObservationZone().GetShape() == ObservationZone::Shape::CYLINDER) { CylinderZone &cz = (CylinderZone &)tp->GetObservationZone(); cz.SetRadius(fixed(40000.0)); } if (!fact.Append(*tp,false)) { return false; } delete tp; } task_report(task_manager, "# adding finish\n"); wp = waypoints.LookupId(1); if (wp) { OrderedTaskPoint *tp = fact.CreateFinish(*wp); if (!fact.Append(*tp,false)) { return false; } delete tp; } fact.UpdateStatsGeometry(); task_report(task_manager, "# checking task..\n"); if (!fact.Validate()) { return false; } if (!task_manager.CheckOrderedTask()) { return false; } return true; }
static fixed GetRadius(const OrderedTaskPoint &tp) { return GetRadius(tp.GetObservationZone()); }
TaskPointFactoryType AbstractTaskFactory::GetType(const OrderedTaskPoint &point) const { const ObservationZonePoint &oz = point.GetObservationZone(); switch (point.GetType()) { case TaskPointType::START: switch (oz.GetShape()) { case ObservationZone::Shape::FAI_SECTOR: case ObservationZone::Shape::SYMMETRIC_QUADRANT: return TaskPointFactoryType::START_SECTOR; case ObservationZone::Shape::LINE: return TaskPointFactoryType::START_LINE; case ObservationZone::Shape::CYLINDER: case ObservationZone::Shape::MAT_CYLINDER: case ObservationZone::Shape::SECTOR: case ObservationZone::Shape::DAEC_KEYHOLE: case ObservationZone::Shape::CUSTOM_KEYHOLE: case ObservationZone::Shape::BGAFIXEDCOURSE: case ObservationZone::Shape::BGAENHANCEDOPTION: case ObservationZone::Shape::ANNULAR_SECTOR: return TaskPointFactoryType::START_CYLINDER; case ObservationZone::Shape::BGA_START: return TaskPointFactoryType::START_BGA; } break; case TaskPointType::AAT: switch (oz.GetShape()) { case ObservationZone::Shape::SECTOR: case ObservationZone::Shape::FAI_SECTOR: case ObservationZone::Shape::SYMMETRIC_QUADRANT: case ObservationZone::Shape::DAEC_KEYHOLE: case ObservationZone::Shape::BGAFIXEDCOURSE: case ObservationZone::Shape::BGAENHANCEDOPTION: case ObservationZone::Shape::BGA_START: case ObservationZone::Shape::LINE: return TaskPointFactoryType::AAT_SEGMENT; case ObservationZone::Shape::ANNULAR_SECTOR: return TaskPointFactoryType::AAT_ANNULAR_SECTOR; case ObservationZone::Shape::CYLINDER: return TaskPointFactoryType::AAT_CYLINDER; case ObservationZone::Shape::CUSTOM_KEYHOLE: return TaskPointFactoryType::AAT_KEYHOLE; case ObservationZone::Shape::MAT_CYLINDER: return TaskPointFactoryType::MAT_CYLINDER; } break; case TaskPointType::AST: switch (oz.GetShape()) { case ObservationZone::Shape::FAI_SECTOR: return TaskPointFactoryType::FAI_SECTOR; case ObservationZone::Shape::DAEC_KEYHOLE: case ObservationZone::Shape::CUSTOM_KEYHOLE: return TaskPointFactoryType::KEYHOLE_SECTOR; case ObservationZone::Shape::BGAFIXEDCOURSE: return TaskPointFactoryType::BGAFIXEDCOURSE_SECTOR; case ObservationZone::Shape::BGAENHANCEDOPTION: return TaskPointFactoryType::BGAENHANCEDOPTION_SECTOR; case ObservationZone::Shape::BGA_START: case ObservationZone::Shape::CYLINDER: case ObservationZone::Shape::MAT_CYLINDER: case ObservationZone::Shape::SECTOR: case ObservationZone::Shape::LINE: case ObservationZone::Shape::ANNULAR_SECTOR: return TaskPointFactoryType::AST_CYLINDER; case ObservationZone::Shape::SYMMETRIC_QUADRANT: return TaskPointFactoryType::SYMMETRIC_QUADRANT; } break; case TaskPointType::FINISH: switch (oz.GetShape()) { case ObservationZone::Shape::BGA_START: case ObservationZone::Shape::FAI_SECTOR: case ObservationZone::Shape::SYMMETRIC_QUADRANT: return TaskPointFactoryType::FINISH_SECTOR; case ObservationZone::Shape::LINE: return TaskPointFactoryType::FINISH_LINE; case ObservationZone::Shape::CYLINDER: case ObservationZone::Shape::MAT_CYLINDER: case ObservationZone::Shape::SECTOR: case ObservationZone::Shape::DAEC_KEYHOLE: case ObservationZone::Shape::CUSTOM_KEYHOLE: case ObservationZone::Shape::BGAFIXEDCOURSE: case ObservationZone::Shape::BGAENHANCEDOPTION: case ObservationZone::Shape::ANNULAR_SECTOR: return TaskPointFactoryType::FINISH_CYLINDER; } break; case TaskPointType::UNORDERED: /* obviously, when we check the type of an OrderedTaskPoint, we should never get type==UNORDERED */ gcc_unreachable(); break; } // fail, should never get here gcc_unreachable(); }