Skip to content

City Class

Vitor Bruno de Oliveira Barth edited this page Nov 2, 2018 · 4 revisions

City Class

To get an instance city1 of City you should:

    import { City } from './city.js'

    let city1 = new City({id: 1, x: 123, y: 456});

Properties

city.id : Number

The ID of the city.

city.x : Number

The position of the city in the x axis.

city.y : Number

The position of the city in the y axis.


Methods

city.calculateDistanceTo(otherCity : City) : Number

Returns the straight distance from city to otherCity.

city.equals(otherCity: City) : Bool

Verify if two cities are the same. Unfortunaly, this method doesn't override the == operator.