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; }
void Visit(const CylinderZone& oz) { hide_all(); WndFrame* wp = ((WndFrame *)wf->FindByName(_T("frmOZCylinder"))); if (wp) wp->show(); LoadFormProperty(*wf, _T("prpOZCylinderRadius"), ugDistance, oz.getRadius()); }
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; }
ObservationZonePoint* Deserialiser::DeserialiseOZ(const Waypoint &wp, bool is_turnpoint) { const TCHAR *type = node.GetAttribute(_T("type")); if (type == nullptr) return nullptr; if (StringIsEqual(type, _T("Line"))) { LineSectorZone *ls = new LineSectorZone(wp.location); fixed length; if (node.GetAttribute(_T("length"), length) && positive(length)) ls->SetLength(length); return ls; } else if (StringIsEqual(type, _T("Cylinder"))) { CylinderZone *ls = new CylinderZone(wp.location); fixed radius; if (node.GetAttribute(_T("radius"), radius) && positive(radius)) ls->SetRadius(radius); return ls; } else if (StringIsEqual(type, _T("MatCylinder"))) { return CylinderZone::CreateMatCylinderZone(wp.location); } else if (StringIsEqual(type, _T("Sector"))) { fixed radius, inner_radius; Angle start, end; SectorZone *ls; if (node.GetAttribute(_T("inner_radius"), inner_radius)) { AnnularSectorZone *als = new AnnularSectorZone(wp.location); als->SetInnerRadius(inner_radius); ls = als; } else ls = new SectorZone(wp.location); if (node.GetAttribute(_T("radius"), radius) && positive(radius)) ls->SetRadius(radius); if (node.GetAttribute(_T("start_radial"), start)) ls->SetStartRadial(start); if (node.GetAttribute(_T("end_radial"), end)) ls->SetEndRadial(end); return ls; } else if (StringIsEqual(type, _T("FAISector"))) return SymmetricSectorZone::CreateFAISectorZone(wp.location, is_turnpoint); else if (StringIsEqual(type, _T("SymmetricQuadrant"))) { fixed radius = fixed(10000); node.GetAttribute(_T("radius"), radius); return new SymmetricSectorZone(wp.location, radius); } else if (StringIsEqual(type, _T("Keyhole"))) return KeyholeZone::CreateDAeCKeyholeZone(wp.location); else if (StringIsEqual(type, _T("CustomKeyhole"))) { fixed radius = fixed(10000), inner_radius = fixed(500); Angle angle = Angle::QuarterCircle(); node.GetAttribute(_T("radius"), radius); node.GetAttribute(_T("inner_radius"), inner_radius); node.GetAttribute(_T("angle"), angle); KeyholeZone *keyhole = KeyholeZone::CreateCustomKeyholeZone(wp.location, radius, angle); keyhole->SetInnerRadius(inner_radius); return keyhole; } else if (StringIsEqual(type, _T("BGAStartSector"))) return KeyholeZone::CreateBGAStartSectorZone(wp.location); else if (StringIsEqual(type, _T("BGAFixedCourse"))) return KeyholeZone::CreateBGAFixedCourseZone(wp.location); else if (StringIsEqual(type, _T("BGAEnhancedOption"))) return KeyholeZone::CreateBGAEnhancedOptionZone(wp.location); assert(1); return nullptr; }
static void Visit(WritableDataNode &node, const CylinderZone &data) { node.SetAttribute(_T("type"), _T("Cylinder")); node.SetAttribute(_T("radius"), data.GetRadius()); }
void Visit(const CylinderZone& oz) { ozUserSize = oz.getRadius(); }
void Serialiser::Visit(const CylinderZone& data) { m_node.set_attribute(_T("type"), _T("Cylinder")); m_node.set_attribute(_T("radius"), data.getRadius()); }
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; }
void Serialiser::Visit(const CylinderZone &data) { node.SetAttribute(_T("type"), _T("Cylinder")); node.SetAttribute(_T("radius"), data.GetRadius()); }
virtual void Visit(CylinderZone& tp) { // radius tp.setRadius(fixed(2000)); }
void RenderObservationZone::parms_oz(const CylinderZone& oz) { p_radius = m_proj.DistanceMetersToScreen(oz.getRadius()); p_center = m_proj.LonLat2Screen(oz.get_location()); }