void Visit(CylinderZone& oz) { fixed radius = Units::ToSysDistance(GetFormValueFixed(*wf, _T("prpOZCylinderRadius"))); if (fabs(radius - oz.getRadius()) > fixed(49)) { oz.setRadius(radius); task_modified = true; } }
ObservationZonePoint* Serialiser::deserialise_oz(const Waypoint& wp, const bool is_turnpoint) { tstring type; if (!m_node.get_attribute(_T("type"),type)) { assert(1); return NULL; } if (_tcscmp(type.c_str(), _T("Line")) == 0) { LineSectorZone *ls = new LineSectorZone(wp.Location); fixed length; if (m_node.get_attribute(_T("length"), length)) { ls->setLength(length); } return ls; } else if (_tcscmp(type.c_str(), _T("Cylinder")) == 0) { CylinderZone *ls = new CylinderZone(wp.Location); fixed radius; if (m_node.get_attribute(_T("radius"), radius)) { ls->setRadius(radius); } return ls; } else if (_tcscmp(type.c_str(), _T("Sector")) == 0) { SectorZone *ls = new SectorZone(wp.Location); fixed radius; Angle start, end; if (m_node.get_attribute(_T("radius"), radius)) { ls->setRadius(radius); } if (m_node.get_attribute(_T("start_radial"), start)) { ls->setStartRadial(start); } if (m_node.get_attribute(_T("end_radial"), end)) { ls->setEndRadial(end); } return ls; } else if (_tcscmp(type.c_str(), _T("FAISector")) == 0) { return new FAISectorZone(wp.Location, is_turnpoint); } else if (_tcscmp(type.c_str(), _T("Keyhole")) == 0) { return new KeyholeZone(wp.Location); } else if (_tcscmp(type.c_str(), _T("BGAFixedCourse")) == 0) { return new BGAFixedCourseZone(wp.Location); } else if (_tcscmp(type.c_str(), _T("BGAEnhancedOption")) == 0) { return new BGAEnhancedOptionZone(wp.Location); } assert(1); return NULL; }
bool test_task_aat(TaskManager& task_manager, const Waypoints &waypoints) { const TaskProjection &projection = task_manager.get_ordered_task().get_task_projection(); task_manager.set_factory(OrderedTask::FACTORY_AAT); AbstractTaskFactory &fact = task_manager.get_factory(); const Waypoint *wp; task_report(task_manager, "# adding start\n"); wp = waypoints.lookup_id(1); if (wp) { if (!fact.append(fact.createStart(*wp),false)) { return false; } } task_manager.setActiveTaskPoint(0); task_manager.resume(); task_report(task_manager, "# adding intermediate\n"); wp = waypoints.lookup_id(2); if (wp) { OrderedTaskPoint* tp = fact.createIntermediate(AbstractTaskFactory::AAT_CYLINDER,*wp); if (tp->get_oz()->shape == ObservationZonePoint::CYLINDER) { CylinderZone *cz = (CylinderZone *)tp->get_oz(); cz->setRadius(fixed(30000.0)); tp->update_oz(projection); } if (!fact.append(tp,false)) { return false; } } task_report(task_manager, "# adding intermediate\n"); wp = waypoints.lookup_id(3); if (wp) { OrderedTaskPoint* tp = fact.createIntermediate(AbstractTaskFactory::AAT_CYLINDER,*wp); if (tp->get_oz()->shape == ObservationZonePoint::CYLINDER) { CylinderZone *cz = (CylinderZone *)tp->get_oz(); cz->setRadius(fixed(40000.0)); tp->update_oz(projection); } if (!fact.append(tp,false)) { return false; } } task_report(task_manager, "# adding finish\n"); wp = waypoints.lookup_id(1); if (wp) { if (!fact.append(fact.createFinish(*wp),false)) { return false; } } task_report(task_manager, "# checking task..\n"); if (!fact.validate()) { return false; } if (!task_manager.check_ordered_task()) { return false; } return true; }
bool test_task_mixed(TaskManager& task_manager, const Waypoints &waypoints) { const TaskProjection &projection = task_manager.get_ordered_task().get_task_projection(); OrderedTaskPoint *tp; const Waypoint *wp; task_manager.set_factory(TaskBehaviour::FACTORY_MIXED); AbstractTaskFactory &fact = task_manager.get_factory(); task_report(task_manager, "# adding start\n"); wp = waypoints.lookup_id(1); if (wp) { tp = fact.createStart(AbstractTaskFactory::START_LINE,*wp); if (tp->get_oz()->shape == ObservationZonePoint::CYLINDER) { CylinderZone *cz = (CylinderZone *)tp->get_oz(); cz->setRadius(fixed(5000.0)); tp->update_oz(projection); } if (!fact.append(*tp,false)) return false; delete tp; } else { return false; } task_manager.setActiveTaskPoint(0); task_manager.resume(); task_report(task_manager, "# adding intermdiate\n"); wp = waypoints.lookup_id(2); if (wp) { tp = fact.createIntermediate(AbstractTaskFactory::AST_CYLINDER,*wp); if (!fact.append(*tp,false)) return false; delete tp; } else { return false; } task_report(task_manager, "# adding intermdiate\n"); wp = waypoints.lookup_id(3); if (wp) { tp = fact.createIntermediate(AbstractTaskFactory::AAT_CYLINDER,*wp); if (tp->get_oz()->shape == ObservationZonePoint::CYLINDER) { CylinderZone *cz = (CylinderZone *)tp->get_oz(); cz->setRadius(fixed(30000.0)); tp->update_oz(projection); } if (!fact.append(*tp,false)) return false; delete tp; } else { return false; } task_report(task_manager, "# adding intermediate\n"); wp = waypoints.lookup_id(4); if (wp) { tp = fact.createIntermediate(AbstractTaskFactory::AAT_CYLINDER,*wp); if (!fact.append(*tp,false)) return false; delete tp; } else { return false; } task_report(task_manager, "# adding intermediate\n"); wp = waypoints.lookup_id(5); if (wp) { tp = fact.createIntermediate(AbstractTaskFactory::AAT_CYLINDER,*wp); if (tp->get_oz()->shape == ObservationZonePoint::CYLINDER) { CylinderZone *cz = (CylinderZone *)tp->get_oz(); cz->setRadius(fixed(30000.0)); tp->update_oz(projection); } if (!fact.append(*tp,false)) return false; delete tp; } else { return false; } task_report(task_manager, "# adding finish\n"); wp = waypoints.lookup_id(1); if (wp) { tp = fact.createFinish(AbstractTaskFactory::FINISH_LINE,*wp); if (!fact.append(*tp,false)) return false; delete tp; } else { return false; } task_report(task_manager, "# checking task\n"); if (!fact.validate()) { return false; } if (!task_manager.check_ordered_task()) { return false; } return true; }
virtual void Visit(CylinderZone& tp) { // radius tp.setRadius(fixed(2000)); }