PointCoordinates
open class PointCoordinates: ListBase, Sequence
Represents an N-dimensional point.
Note that some coordinate reference systems will support only x
and y
dimensions.
-
Convert array to list.
Declaration
Swift
public static func fromArray(_ array: [Double]) -> PointCoordinates
Parameters
array
Array with source items.
Return Value
New list with items copied from
array
parameter. -
Convert list to array.
Declaration
Swift
public func toArray() -> [Double]
Return Value
New array with items copied from this list.
-
Undocumented
Declaration
Swift
public subscript(index: Int) -> Double
-
An immutable empty
PointCoordinates
.Declaration
Swift
public static let empty: PointCoordinates = PointCoordinates(capacity: Int(Int32.min))
-
Construct a new list with
length
of zero and optional initialcapacity
. A list can expand in length beyond its initial capacity, but best performance will be obtained if the initial capacity is close to the list’s maximum length.Declaration
Swift
override public init(capacity: Int = (4 as Int))
Parameters
capacity
Optional initial capacity.
-
Synonym for
z
.Declaration
Swift
open var altitude: Double
-
Add
item
to the end of this list.Declaration
Swift
open func append(_ item: Double) -> Void
Parameters
item
Item to be added.
-
Add all the items of
list
to the end of this list.Declaration
Swift
open func append(contentsOf list: PointCoordinates) -> Void
Parameters
list
Items to be added.
-
Declaration
Swift
open func copy() -> PointCoordinates
Return Value
A shallow copy of this list.
-
Throws
EmptyListException
if the list is empty.Declaration
Swift
open func first() -> Double
Return Value
The first item in this list.
-
Declaration
Swift
open func includes(item: Double) -> Bool
Parameters
item
Item for comparison. Comparison uses the
equality
property, which would usually be expected to match the==
operator for item typedouble
.Return Value
true
if this list containsitem
. -
Declaration
Swift
open func indexOf(item: Double, start: Int = (0 as Int)) -> Int
Parameters
item
Item for comparison. Comparison uses the
equality
property, which would usually be expected to match the==
operator for item typedouble
.start
Zero-based starting index (search moves forwards from this index).
Return Value
First index in this list of
item
, or-1
if not found. -
Insert
item
into this list, before the item (if any) atindex
.Throws
ListIndexException
ifindex
is out of range (0 tolength
).Declaration
Swift
open func insert(at index: Int, item: Double) -> Void
Parameters
index
Zero-based index.
item
Item to be added.
-
Insert all items of
list
into this list, before the item (if any) atindex
.Throws
ListIndexException
ifindex
is out of range (0 tolength
).Declaration
Swift
open func insert(at index: Int, contentsOf list: PointCoordinates) -> Void
Parameters
index
Zero-based index.
list
List of items to be inserted.
-
Throws
ListIndexException
ifindex
is out of range (0 tolength
- 1).Declaration
Swift
open func item(at index: Int) -> Double
Parameters
index
Zero-based index.
Return Value
The item in this list at the specified
index
. -
Throws
EmptyListException
if the list is empty.Declaration
Swift
open func last() -> Double
Return Value
The last item in this list.
-
Declaration
Swift
open func lastIndexOf(item: Double, start: Int = (2147483647 as Int)) -> Int
Parameters
item
Item for comparison. Comparison uses the
equality
property, which would usually be expected to match the==
operator for item typedouble
.start
Zero-based starting index (search moves backwards from this index).
Return Value
Last index in this list of
item
, or-1
if not found. -
Synonym for
y
.Declaration
Swift
open var latitude: Double
-
Synonym for
x
.Declaration
Swift
open var longitude: Double
-
The
M
dimension (e.g. measure). Equivalent tothis.last()
. UsewithXYM
orwithXYZM
to obtain point coordinates with anM
dimension.Declaration
Swift
open var m: Double
-
Declaration
Swift
open func makeIterator() -> IndexingIterator<Array<Double>>
Return Value
This list converted to a Swift iterator.
-
Synonym for
m
.Declaration
Swift
open var measure: Double
-
Return a new
PointCoordinates
that shares theListBase.untypedList
as thelist
parameter. To ensure type safety, items inlist
that do not have the item typedouble
will be removed.Declaration
Swift
open class func share(_ list: ListBase) -> PointCoordinates
Parameters
list
List whose items will be shared by the resulting list.
Return Value
A new list of item type
double
, sharing the same items aslist
. -
Throws
EmptyListException
if the list has no items,NotUniqueException
if the list has multiple items.Declaration
Swift
open func single() -> Double
Return Value
A single item from this list.
-
Declaration
Swift
open func slice(start: Int, end: Int = (2147483647 as Int)) -> PointCoordinates
Parameters
start
Zero-based starting index (inclusive), or negative for starting index relative to the end of this list.
end
Zero-based ending index (exclusive), or negative for ending index relative to the end of this list.
Return Value
A slice of this list from index
start
(inclusive) to indexend
(exclusive). -
Set the item in this list at the specified
index
.Declaration
Swift
open func update(at index: Int, item: Double) -> Void
Parameters
index
Zero-based index.
item
Item value.
-
Construct 2D point coordinates.
Declaration
Swift
open class func with(x: Double, y: Double) -> PointCoordinates
Parameters
x
X-coordinate (longitude for geography points).
y
Y-coordinate (latitude for geography points).
-
Construct 2D point coordinates with measure.
Declaration
Swift
open class func with(x: Double, y: Double, m: Double) -> PointCoordinates
Parameters
x
X-coordinate (longitude for geography points).
y
Y-coordinate (latitude for geography points).
m
M-coordinate (measure).
-
Construct 3D point coordinates.
Declaration
Swift
open class func with(x: Double, y: Double, z: Double) -> PointCoordinates
Parameters
x
X-coordinate (longitude for geography points).
y
Y-coordinate (latitude for geography points).
z
Z-coordinate (altitude for geography points).
-
Construct 3D point coordinates with measure.
Declaration
Swift
open class func with(x: Double, y: Double, z: Double, m: Double) -> PointCoordinates
Parameters
x
X-coordinate (longitude for geography points).
y
Y-coordinate (latitude for geography points).
z
Z-coordinate (altitude for geography points).
m
M-coordinate (measure).
-
Construct point coordinates.
Declaration
Swift
open class func with(latitude: Double, longitude: Double) -> PointCoordinates
Parameters
latitude
Latitude (Y-coordinate).
longitude
Longitude (X-coordinate).
-
The
X
dimension (e.g. longitude). Equivalent tothis.get(0)
.Declaration
Swift
open var x: Double
-
The
Y
dimension (e.g. latitude). Equivalent tothis.get(1)
.Declaration
Swift
open var y: Double
-
The
Z
dimension (e.g. altitude). Equivalent tothis.get(2)
.Declaration
Swift
open var z: Double