本文整理汇总了C++中WaypointList类的典型用法代码示例。如果您正苦于以下问题:C++ WaypointList类的具体用法?C++ WaypointList怎么用?C++ WaypointList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WaypointList类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: assert
void
WaypointListDialog::OnPaintItem(Canvas &canvas, const PixelRect rc,
unsigned i)
{
if (waypoint_list.empty()) {
assert(i == 0);
const UPixelScalar line_height = rc.bottom - rc.top;
const Font &name_font =
*UIGlobals::GetDialogLook().list.font;
canvas.SetTextColor(COLOR_BLACK);
canvas.Select(name_font);
canvas.DrawText(rc.left + line_height + Layout::FastScale(2),
rc.top + line_height / 2 - name_font.GetHeight() / 2,
dialog_state.IsDefined() || way_points.IsEmpty() ?
_("No Match!") : _("Choose a filter or click here"));
return;
}
assert(i < waypoint_list.size());
const struct WaypointListItem &info = waypoint_list[i];
WaypointListRenderer::Draw(canvas, rc, *info.waypoint,
info.GetVector(location),
UIGlobals::GetDialogLook(),
UIGlobals::GetMapLook().waypoint,
CommonInterface::GetMapSettings().waypoint);
}
开发者ID:StefanL74,项目名称:XCSoar,代码行数:29,代码来源:WaypointList.cpp
示例2: visibleWaypoints
WaypointList WaypointManager::visibleWaypoints(D3DXVECTOR3 target)
{
WaypointList wps;
for(int i=0; i<waypoints.size(); i++)
{
Ray r(waypoints[i]->_position,target -waypoints[i]->_position);
if(!kdTree.doesRayIntersect(r))
wps.push_back(i);
}
return wps;
}
开发者ID:yixu34,项目名称:RestlessMoon2,代码行数:11,代码来源:waypointmanager.cpp
示例3: FillLastUsedList
static void
FillLastUsedList(WaypointList &list,
const WaypointIDList &last_used_ids,
const Waypoints &waypoints)
{
list.clear();
for (auto it = last_used_ids.rbegin(); it != last_used_ids.rend(); it++) {
const Waypoint* waypoint = waypoints.LookupId(*it);
if (waypoint == NULL)
continue;
list.push_back(WaypointListItem(*waypoint));
}
}
开发者ID:,项目名称:,代码行数:15,代码来源:
示例4:
void
WaypointListWidget::OnWaypointListEnter()
{
if (!items.empty())
action_listener.OnAction(mrOK);
else
filter_widget.GetControl(NAME).BeginEditing();
}
开发者ID:,项目名称:,代码行数:8,代码来源:
示例5: OnWaypointListEnter
static void
OnWaypointListEnter(gcc_unused unsigned i)
{
if (waypoint_list.size() > 0)
dialog->SetModalResult(mrOK);
else
OnFilterNameButton(*name_button);
}
开发者ID:,项目名称:,代码行数:8,代码来源:
示例6: OnWaypointListEnter
static void
OnWaypointListEnter()
{
if (waypoint_list.size() > 0)
dialog->SetModalResult(mrOK);
else
name_control->BeginEditing();
}
开发者ID:StefanL74,项目名称:XCSoar,代码行数:8,代码来源:WaypointList.cpp
示例7: dlgWaypointSelect
const Waypoint*
dlgWaypointSelect(SingleWindow &parent, const GeoPoint &_location,
OrderedTask *ordered_task,
const unsigned ordered_task_index)
{
dialog = LoadDialog(callback_table, parent, Layout::landscape ?
_T("IDR_XML_WAYPOINTSELECT_L") : _T("IDR_XML_WAYPOINTSELECT"));
assert(dialog != NULL);
#ifdef GNAV
dialog->SetKeyDownNotify(FormKeyDown);
#endif
const DialogLook &dialog_look = UIGlobals::GetDialogLook();
waypoint_list_control = (ListControl*)dialog->FindByName(_T("frmWaypointList"));
assert(waypoint_list_control != NULL);
waypoint_list_control->SetActivateCallback(OnWaypointListEnter);
waypoint_list_control->SetPaintItemCallback(OnPaintListItem);
waypoint_list_control->SetItemHeight(WaypointListRenderer::GetHeight(dialog_look));
name_button = (WndButton*)dialog->FindByName(_T("cmdFltName"));
name_button->SetOnLeftNotify(OnFilterNameButtonLeft);
name_button->SetOnRightNotify(OnFilterNameButtonRight);
distance_filter = (WndProperty*)dialog->FindByName(_T("prpFltDistance"));
direction_filter = (WndProperty*)dialog->FindByName(_T("prpFltDirection"));
type_filter = (WndProperty *)dialog->FindByName(_T("prpFltType"));
location = _location;
triangle_validator =
new FAITrianglePointValidator(ordered_task, ordered_task_index);
last_heading = CommonInterface::Calculated().heading;
PrepareData();
UpdateList();
dialog->SetTimerNotify(OnTimerNotify);
if (dialog->ShowModal() != mrOK) {
delete dialog;
delete triangle_validator;
return NULL;
}
unsigned index = waypoint_list_control->GetCursorIndex();
delete dialog;
delete triangle_validator;
const Waypoint* retval = NULL;
if (index < waypoint_list.size())
retval = waypoint_list[index].waypoint;
return retval;
}
开发者ID:,项目名称:,代码行数:57,代码来源:
示例8: builder
void
WaypointManagerWidget::UpdateList()
{
items.clear();
WaypointFilter filter;
filter.Clear();
filter.type_index = TypeFilter::USER;
WaypointListBuilder builder(filter, GeoPoint::Invalid(),
items, nullptr, 0);
builder.Visit(way_points);
auto &list = GetList();
list.SetLength(items.size());
list.SetOrigin(0);
list.SetCursorIndex(0);
list.Invalidate();
}
开发者ID:ThomasXBMC,项目名称:XCSoar,代码行数:19,代码来源:Manager.cpp
示例9: RETAILMSG
WaypointList*
PathFinder::FindPath( WORLD_POSITION src, WORLD_POSITION goal, UINT32 maxCells )
{
if (!m_pPathGraph)
{
RETAILMSG(ZONE_ERROR, "ERROR: PathFinder::FindPath(): m_pPathGraph is NULL\n");
return NULL;
}
NodeID srcID = WorldPositionToNodeID( src );
NodeID goalID = WorldPositionToNodeID( goal );
// RETAILMSG(ZONE_PATHFINDER, ("FindPath: (%.2f, %.2f, %.2f) [%d] -> (%.2f, %.2f, %.2f) [%d]\n",
// src.x, src.y, src.z, srcID,
// goal.x, goal.y, goal.z, goalID );
// Find the list of connections from Cell A to Cell B
WaypointList *pWaypointList = FindPathAStar( srcID, goalID, maxCells );
if (m_bPathSmoothing)
pWaypointList = SmoothWaypointList( pWaypointList );
if (pWaypointList)
{
for( WaypointList::iterator pWaypoint = pWaypointList->begin(); pWaypoint != pWaypointList->end(); pWaypoint++ )
{
if (m_bShowPathFinding && m_pDisplayCallback)
{
WORLD_POSITION temp = *pWaypoint;
temp.x -= 0.5;
temp.z -= 0.5;
m_pDisplayCallback( temp, PATH_NODE_WAYPOINT );
}
}
}
else
{
if (m_bShowPathFinding && m_pClearCallback)
m_pClearCallback();
}
return pWaypointList;
}
开发者ID:kabinud,项目名称:HappyGame,代码行数:43,代码来源:PathFind.cpp
示例10: FillList
static void
FillList(WaypointList &list, const Waypoints &src,
GeoPoint location, Angle heading, const WaypointFilterData &filter)
{
list.clear();
if (!filter.IsDefined() && src.size() >= 500)
return;
FilterWaypointVisitor visitor(filter, location, heading, list);
if (filter.distance_index > 0)
src.VisitWithinRange(location, Units::ToSysDistance(
distance_filter_items[filter.distance_index]), visitor);
else
src.VisitNamePrefix(filter.name, visitor);
if (filter.distance_index > 0 || filter.direction_index > 0)
std::sort(list.begin(), list.end(), WaypointDistanceCompare(location));
}
开发者ID:,项目名称:,代码行数:20,代码来源:
示例11: assert
void
WaypointManagerWidget::OnPaintItem(Canvas &canvas, const PixelRect rc,
unsigned i)
{
assert(i < items.size());
const auto &info = items[i];
WaypointListRenderer::Draw(canvas, rc, *info.waypoint,
row_renderer,
UIGlobals::GetMapLook().waypoint,
CommonInterface::GetMapSettings().waypoint);
}
开发者ID:ThomasXBMC,项目名称:XCSoar,代码行数:13,代码来源:Manager.cpp
示例12: FillList
static void
FillList(WaypointList &list, const Waypoints &src,
GeoPoint location, Angle heading, const WaypointListDialogState &state)
{
if (!state.IsDefined() && src.size() >= 500)
return;
WaypointFilter filter;
state.ToFilter(filter, heading);
WaypointListBuilder builder(filter, location, list,
ordered_task, ordered_task_index);
builder.Visit(src);
if (positive(filter.distance) || !negative(filter.direction.Native()))
list.SortByDistance(location);
}
开发者ID:StefanL74,项目名称:XCSoar,代码行数:17,代码来源:WaypointList.cpp
示例13: ShowWaypointListDialog
const Waypoint*
ShowWaypointListDialog(SingleWindow &parent, const GeoPoint &_location,
OrderedTask *_ordered_task, unsigned _ordered_task_index)
{
dialog = LoadDialog(callback_table, parent, Layout::landscape ?
_T("IDR_XML_WAYPOINTSELECT_L") : _T("IDR_XML_WAYPOINTSELECT"));
assert(dialog != NULL);
#ifdef GNAV
dialog->SetKeyDownFunction(FormKeyDown);
#endif
const DialogLook &dialog_look = UIGlobals::GetDialogLook();
WaypointListDialog dialog2;
waypoint_list_control = (ListControl*)dialog->FindByName(_T("frmWaypointList"));
assert(waypoint_list_control != NULL);
waypoint_list_control->SetItemRenderer(&dialog2);
waypoint_list_control->SetItemHeight(WaypointListRenderer::GetHeight(dialog_look));
waypoint_list_control->SetCursorHandler(&dialog2);
FilterDataFieldListener listener;
name_control = (WndProperty *)dialog->FindByName(_T("name"));
assert(name_control != nullptr);
DataField *name_df = new PrefixDataField(_T(""),
WaypointNameAllowedCharacters);
name_control->SetDataField(name_df);
name_df->SetListener(&listener);
distance_filter = (WndProperty*)dialog->FindByName(_T("prpFltDistance"));
assert(distance_filter != NULL);
distance_filter->GetDataField()->SetListener(&listener);
direction_filter = (WndProperty*)dialog->FindByName(_T("prpFltDirection"));
assert(direction_filter != NULL);
direction_filter->GetDataField()->SetListener(&listener);
type_filter = (WndProperty *)dialog->FindByName(_T("prpFltType"));
assert(type_filter != NULL);
type_filter->GetDataField()->SetListener(&listener);
location = _location;
ordered_task = _ordered_task;
ordered_task_index = _ordered_task_index;
last_heading = CommonInterface::Basic().attitude.heading;
PrepareData();
UpdateList();
const ScopeGPSListener l(CommonInterface::GetLiveBlackboard(), OnGPSUpdate);
if (dialog->ShowModal() != mrOK) {
delete dialog;
return NULL;
}
unsigned index = waypoint_list_control->GetCursorIndex();
delete dialog;
const Waypoint* retval = NULL;
if (index < waypoint_list.size())
retval = waypoint_list[index].waypoint;
return retval;
}
开发者ID:StefanL74,项目名称:XCSoar,代码行数:69,代码来源:WaypointList.cpp
示例14: newPoint0
WaypointList*
PathFinder::SmoothWaypointList( WaypointList* pWaypointList )
{
if (!pWaypointList)
return NULL;
if( pWaypointList->size() > 2 )
{
WORLD_POSITION newPoint0( 0.0f, 0.0f, 0.0f );
WORLD_POSITION newPoint1( 0.0f, 0.0f, 0.0f );
WaypointList oldList;
for( WaypointList::iterator i = pWaypointList->begin(); i != pWaypointList->end(); i++ )
{
oldList.push_back( *i );
}
pWaypointList->clear();
WORLD_POSITION p0, p1, p2, p3;
//First
WaypointList::iterator iter = oldList.begin();
p0 = p1 = p2 = *iter;
iter++;
p3 = *iter;
iter++;
const int divisions = 5;
while( iter != oldList.end() )
{
p0 = p1;
p1 = p2;
p2 = p3;
p3 = *iter;
for( int count=1; count<divisions+1; count++)
{
vec3 newPoint = CatmullRom( p0, p1, p2, p3, (float)count/(float)divisions );
if( pWaypointList->size() > 1 )
{
vec3 lastDir = newPoint1 - newPoint0;
vec3 curDir = newPoint - newPoint1;
lastDir.Normalize();
curDir.Normalize();
float dot = lastDir.Dot( curDir );
if( dot > 0.99f )
{
pWaypointList->pop_back();
}
}
newPoint0 = newPoint1;
newPoint1 = newPoint;
pWaypointList->push_back( newPoint );
}
iter++;
}
//Last
p0 = p1;
p1 = p2;
p2 = p3;
p3 = p3; //Redundant, but put here to make it clear what is intended
for( int count=1; count<divisions+1; count++)
{
WORLD_POSITION newPoint = CatmullRom( p0, p1, p2, p3, (float)count/(float)divisions );
if( pWaypointList->size() > 1 )
{
vec3 lastDir = newPoint1 - newPoint0;
vec3 curDir = newPoint - newPoint1;
lastDir.Normalize();
curDir.Normalize();
float dot = lastDir.Dot( curDir );
if( dot > 0.99f )
{
pWaypointList->pop_back();
}
}
newPoint0 = newPoint1;
newPoint1 = newPoint;
pWaypointList->push_back( newPoint );
}
}
return pWaypointList;
}
开发者ID:kabinud,项目名称:HappyGame,代码行数:90,代码来源:PathFind.cpp
示例15: Visit
void Visit(const Waypoint &waypoint) {
if (CompareType(waypoint, type_index) &&
(filter_data.distance_index == 0 || CompareName(waypoint, name)) &&
CompareDirection(waypoint, direction_index, location, heading))
waypoint_list.push_back(WaypointListItem(waypoint));
}
开发者ID:,项目名称:,代码行数:6,代码来源:
示例16:
void
WaypointManagerWidget::UpdateButtons()
{
const bool non_empty = !items.empty();
edit_button->SetEnabled(non_empty);
delete_button->SetEnabled(non_empty);
}
开发者ID:ThomasXBMC,项目名称:XCSoar,代码行数:7,代码来源:Manager.cpp
示例17: FillLastUsedList
static void
UpdateList()
{
waypoint_list.clear();
if (dialog_state.type_index == TypeFilter::LAST_USED)
FillLastUsedList(waypoint_list, LastUsedWaypoints::GetList(),
way_points);
else
FillList(waypoint_list, way_points, location, last_heading,
dialog_state);
waypoint_list_control->SetLength(std::max(1, (int)waypoint_list.size()));
waypoint_list_control->SetOrigin(0);
waypoint_list_control->SetCursorIndex(0);
waypoint_list_control->Invalidate();
}
开发者ID:StefanL74,项目名称:XCSoar,代码行数:17,代码来源:WaypointList.cpp
注:本文中的WaypointList类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论