本文整理汇总了Golang中github.com/skypies/complaints/complaintdb/types.Complaint.Dist2KM方法的典型用法代码示例。如果您正苦于以下问题:Golang Complaint.Dist2KM方法的具体用法?Golang Complaint.Dist2KM怎么用?Golang Complaint.Dist2KM使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/skypies/complaints/complaintdb/types.Complaint
的用法示例。
在下文中一共展示了Complaint.Dist2KM方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: FixupComplaint
func FixupComplaint(c *types.Complaint, key *datastore.Key) {
// 0. Snag the key, so we can refer to this object later
c.DatastoreKey = key.Encode()
// 1. GAE datastore helpfully converts timezones to UTC upon storage; fix that
c.Timestamp = date.InPdt(c.Timestamp)
// 2. Compute the flight details URL, if within 24 days
age := date.NowInPdt().Sub(c.Timestamp)
if age < time.Hour*24 {
// c.AircraftOverhead.Fr24Url = c.AircraftOverhead.PlaybackUrl()
c.AircraftOverhead.Fr24Url = "http://flightaware.com/live/flight/" +
c.AircraftOverhead.FlightNumber
// Or: http://flightaware.com/live/flight/UAL337/history/20151215/ [0655Z/KLAX/KSFO]
// date is UTC of departure time; might be tricky to guess :/
}
// 3. Compute distances, if we have an aircraft
if c.AircraftOverhead.FlightNumber != "" {
a := c.AircraftOverhead
aircraftPos := geo.Latlong{a.Lat, a.Long}
observerPos := geo.Latlong{c.Profile.Lat, c.Profile.Long}
c.Dist2KM = observerPos.Dist(aircraftPos)
c.Dist3KM = observerPos.Dist3(aircraftPos, a.Altitude)
}
}