Documentation
¶
Overview ¶
Package translation provides functions for managing a translation between two countries.
Index ¶
- Constants
- Variables
- func Init(traceHandle io.Writer, infoHandle io.Writer, warningHandle io.Writer, ...)
- type BodySetChoice
- type CountrySpec
- type CountryWithBodies
- func (country *CountryWithBodies) ClosestBodyInOriginalPosition(lat, lng float64) (distance, latClosest, lngClosest, xSpread, ySpread float64, closestIndex int)
- func (country *CountryWithBodies) ComputeBaryCenters()
- func (country *CountryWithBodies) Init()
- func (country *CountryWithBodies) LatLngToTerritoryBorder(lat, lng float64) PointList
- func (country *CountryWithBodies) LoadConfig(isOriginal bool) bool
- func (country *CountryWithBodies) XYToLatLng(x, y float64) (lat, lng float64)
- func (country *CountryWithBodies) XYtoTerritoryBodies(x, y float64) PointList
- type Point
- type PointList
- type Translation
- func (t *Translation) BodyCoordsInSourceCountry(lat, lng float64) (distance, latClosest, lngClosest, xSpread, ySpread float64, closestIndex int)
- func (t *Translation) BodyCoordsInTargetCountry(lat, lng float64) (distance, latClosest, lngClosest, xSpread, ySpread float64, closestIndex int)
- func (t *Translation) GetSourceCountryName() string
- func (t *Translation) GetTargetCountryName() string
- func (t *Translation) LatLngToXYInTargetCountry(x, y float64) (latTarget, lngTarget float64)
- func (t *Translation) SetSourceCountry(name string)
- func (t *Translation) SetTargetCountry(name string)
- func (t *Translation) SourceBorder(lat, lng float64) PointList
- func (t *Translation) TargetBorder(x, y float64) PointList
- type Village
Constants ¶
const ( ORIGINAL_CONFIGURATION = "ORIGINAL_CONFIGURATION" SPREAD_CONFIGURATION = "SPREAD_CONFIGURATION" )
Variables ¶
Functions ¶
Types ¶
type BodySetChoice ¶
type BodySetChoice string
type CountrySpec ¶
type CountryWithBodies ¶
type CountryWithBodies struct { grump.Country NbBodies int // nb of bodies according to the filename VilCoordinates [][]int Step int // step when the simulation stopped // contains filtered or unexported fields }
func (*CountryWithBodies) ClosestBodyInOriginalPosition ¶
func (country *CountryWithBodies) ClosestBodyInOriginalPosition(lat, lng float64) ( distance, latClosest, lngClosest, xSpread, ySpread float64, closestIndex int)
given lat, lng, get coords after simulation
func (*CountryWithBodies) ComputeBaryCenters ¶
func (country *CountryWithBodies) ComputeBaryCenters()
compute villages barycenters
func (*CountryWithBodies) LatLngToTerritoryBorder ¶
func (country *CountryWithBodies) LatLngToTerritoryBorder(lat, lng float64) PointList
given x, y of a point, return the border in the country
func (*CountryWithBodies) LoadConfig ¶
func (country *CountryWithBodies) LoadConfig(isOriginal bool) bool
load configuration from filename into country check that it matches the
func (*CountryWithBodies) XYToLatLng ¶
func (country *CountryWithBodies) XYToLatLng(x, y float64) (lat, lng float64)
func (*CountryWithBodies) XYtoTerritoryBodies ¶
func (country *CountryWithBodies) XYtoTerritoryBodies(x, y float64) PointList
get the bodies of a village from x, y spread coordinates
type Translation ¶
type Translation struct {
// contains filtered or unexported fields
}
Definition of a translation between a source and a target country
func GetTranslateCurrent ¶
func GetTranslateCurrent() *Translation
Singloton pattern to init the current translation
func (*Translation) BodyCoordsInSourceCountry ¶
func (t *Translation) BodyCoordsInSourceCountry(lat, lng float64) (distance, latClosest, lngClosest, xSpread, ySpread float64, closestIndex int)
from lat, lng in source country, find the closest body in source country
func (*Translation) BodyCoordsInTargetCountry ¶
func (t *Translation) BodyCoordsInTargetCountry(lat, lng float64) (distance, latClosest, lngClosest, xSpread, ySpread float64, closestIndex int)
from lat, lng in source country, find the closest body in source country
func (*Translation) GetSourceCountryName ¶
func (t *Translation) GetSourceCountryName() string
func (*Translation) GetTargetCountryName ¶
func (t *Translation) GetTargetCountryName() string
func (*Translation) LatLngToXYInTargetCountry ¶
func (t *Translation) LatLngToXYInTargetCountry(x, y float64) (latTarget, lngTarget float64)
from x, y get closest body lat/lng in target country
func (*Translation) SetSourceCountry ¶
func (t *Translation) SetSourceCountry(name string)
func (*Translation) SetTargetCountry ¶
func (t *Translation) SetTargetCountry(name string)
func (*Translation) SourceBorder ¶
func (t *Translation) SourceBorder(lat, lng float64) PointList
func (*Translation) TargetBorder ¶
func (t *Translation) TargetBorder(x, y float64) PointList
from a coordinate in source coutry, get border