my_data BuildFeature(trajectory_type &trajectory, double flight_frac) { // Nothing complicated here. Basically, divide the trajectory up into // some even-sized pieces, and take the early way-points and build a // feature vector out of them. The only tricky part is that when you // divide a trajectory into n pieces, you essentially have n+1 points // to choose from. const unsigned int sample_pts = 4; // Must be >= 2 Feature temp; for (unsigned int i = 0; i < sample_pts; ++i) { double frac = flight_frac * static_cast<double>(i)/static_cast<double>(sample_pts-1); trajectory_point_type pt = GetInterpolatedPoint(trajectory,frac); temp[2*i] = pt.longitude(); temp[2*i + 1] = pt.latitude(); // temp[3*i + 2 ] = (pt.timestamp() - // trajectory.front().timestamp()).seconds()/1200; } trajectory_point_type pt = GetInterpolatedPoint(trajectory,flight_frac); temp[2*sample_pts] = (pt.timestamp() - trajectory.front().timestamp()).seconds()/1200.; return my_data(temp,0,&(trajectory)); }
void TrackPickerDlg::onTrackCellLeftClick( wxGridEvent& event ) { wxString str = ((wxGrid*)event.GetEventObject())->GetCellValue( event.GetRow(), 0 ); ((wxGrid*)event.GetEventObject())->SetGridCursor(event.GetRow(), 0); CellRenderer* renderer = (CellRenderer*)((wxGrid*)event.GetEventObject())->GetCellRenderer(event.GetRow(),0); if( renderer->GetTip() != NULL) { TraceOp.trc( "trackpicker", TRCLEVEL_DEBUG, __LINE__, 9999, "cell tip is [%s] at row %d", renderer->GetTip(), event.GetRow()); m_Tip->SetValue(wxGetApp().getMsg( renderer->GetTip() )); } else m_Tip->SetValue(str); wxString my_text = wxT("addsymbol:") + str; TraceOp.trc( "trackpicker", TRCLEVEL_DEBUG, __LINE__, 9999, "drag [%s]", (const char*)my_text.mb_str(wxConvUTF8) ); wxTextDataObject my_data(my_text); wxDropSource dragSource( this ); dragSource.SetData( my_data ); wxDragResult result = dragSource.DoDragDrop(wxDrag_CopyOnly); Raise(); event.Skip(); }
void ElementsCtrlBase::OnBeginDrag( wxListEvent& ev ) { ev.Allow(); wxTextDataObject my_data(wxT("ruelps")); wxDropSource dragSource( this ); dragSource.SetData( my_data ); wxDragResult result = dragSource.DoDragDrop( TRUE ); wxGetApp().mainframe()->statusbar()->SetStatusText(_("Ready"), (SB_MSG)); /* wxString pc; switch ( result ) { case wxDragError: pc = _T("Error!"); break; case wxDragNone: pc = _T("Nothing"); break; case wxDragCopy: pc = _T("Copied"); break; case wxDragMove: pc = _T("Moved"); break; case wxDragCancel: pc = _T("Cancelled"); break; default: pc = _T("Huh?"); break; } wxLogDebug(pc); */ }