cp15695540483/moonkml/src/core does not have a README file

    KmlError

    pub(all) suberror KmlError {
    XmlSyntax(String, Int)
    XmlMismatch(String, String, Int)
    XmlUnexpectedEnd(String, Int)
    XmlUnclosed(String, Int)
    XmlMissingRoot
    XmlMultipleRoots(Int)
    MissingCoordinates
    BadCoordinates(String)
    BadGeoJson(String)
    BadGpx(String)
    HostIo(String)
    }

    Geometry

    pub(all) enum Geometry {
    Point(KmlPoint)
    LineString(KmlLineString)
    Polygon(KmlPolygon)
    MultiGeometry(Array[Geometry])
    GxTrack(KmlGxTrack)
    }

    几何类型。

    KmlData

    pub(all) struct KmlData {
    name : String
    value : String
    }

    一个扩展数据条目(..)。

    KmlDocument

    pub(all) struct KmlDocument {
    name : String
    placemarks : Array[Placemark]
    styles : Array[KmlStyle]
    style_maps : Array[KmlStyleMap]
    }

    样式表:id → 样式定义。

    KmlDocument::find_style

    fn KmlDocument::find_style(self : KmlDocument, id : String) -> KmlStyle?

    按 id 找样式。

    KmlDocument::find_style_map

    fn KmlDocument::find_style_map(self : KmlDocument, id : String) -> KmlStyleMap?

    按 id 找 StyleMap。

    KmlDocument::placemark_count

    fn KmlDocument::placemark_count(self : KmlDocument) -> Int

    Placemark 数量。

    KmlDocument::style_count

    fn KmlDocument::style_count(self : KmlDocument) -> Int

    样式数量。

    KmlDocument::style_map_count

    fn KmlDocument::style_map_count(self : KmlDocument) -> Int

    StyleMap 数量。

    KmlGxTrack

    pub(all) struct KmlGxTrack {
    whens : Array[String]
    coords : Array[KmlPoint]
    }

    一条 gx:Track:Google Earth 扩展的 GPS 轨迹,坐标与时间戳一一对应。

    KmlGxTrack::point_count

    fn KmlGxTrack::point_count(self : KmlGxTrack) -> Int

    gx:Track 的点数。

    KmlLineString

    pub(all) struct KmlLineString {
    points : Array[KmlPoint]
    }

    一条折线:有序的点列。

    KmlLineString::point_count

    fn KmlLineString::point_count(self : KmlLineString) -> Int

    折线的顶点数。

    KmlPoint

    pub(all) struct KmlPoint {
    lon : Double
    lat : Double
    alt : Double?
    }

    一个 WGS-84 坐标点。alt 缺省表示 KML 未给出高度。

    KmlPolygon

    pub(all) struct KmlPolygon {
    outer : LinearRing
    inner : Array[LinearRing]
    }

    一个多边形:外环 + 零或多个内环(洞)。

    KmlPolygon::inner_count

    fn KmlPolygon::inner_count(self : KmlPolygon) -> Int

    多边形的内环数。

    KmlStyle

    pub(all) struct KmlStyle {
    id : String
    line_color : String?
    line_width : Double?
    fill_color : String?
    icon_href : String?
    icon_scale : Double?
    label_color : String?
    label_scale : Double?
    }

    一个样式定义:线条颜色与宽度、填充颜色。

    KmlStyleMap

    pub(all) struct KmlStyleMap {
    id : String
    normal : String
    highlight : String
    }

    一个 StyleMap:normal / highlight 两个键指向的样式 id。

    KmlTime

    pub(all) struct KmlTime {
    when : String
    begin : String
    end : String
    }

    时间信息:TimeStamp(瞬时)或 TimeSpan(区间),三者至多一个非空。

    LinearRing

    pub(all) struct LinearRing {
    points : Array[KmlPoint]
    }

    一个闭合环;KML 要求首尾点相同。

    LinearRing::point_count

    fn LinearRing::point_count(self : LinearRing) -> Int

    环的顶点数。

    Placemark

    pub(all) struct Placemark {
    name : String
    description : String
    geometry : Geometry?
    style_url : String
    extended_data : Array[KmlData]
    folder : String
    timestamp : KmlTime?
    }

    一个 Placemark。

    Placemark::data_count

    fn Placemark::data_count(self : Placemark) -> Int

    Placemark 的扩展数据条目数。

    Placemark::find_data

    fn Placemark::find_data(self : Placemark, name : String) -> String?

    按名字找扩展数据值。

    Placemark::has_geometry

    fn Placemark::has_geometry(self : Placemark) -> Bool

    是否有几何。

    Placemark::has_gx_track

    fn Placemark::has_gx_track(self : Placemark) -> Bool

    是否为 gx:Track。

    Placemark::has_line_string

    fn Placemark::has_line_string(self : Placemark) -> Bool

    是否有折线几何。

    Placemark::has_multi_geometry

    fn Placemark::has_multi_geometry(self : Placemark) -> Bool

    是否为多重几何。

    Placemark::has_point

    fn Placemark::has_point(self : Placemark) -> Bool

    是否有点几何。

    Placemark::has_time

    fn Placemark::has_time(self : Placemark) -> Bool

    是否有时间信息。

    Placemark::new

    fn Placemark::new(name : String, geometry : Geometry?) -> Placemark

    便捷构造:只给名称与几何,其余字段取默认值。

    XmlAttr

    pub(all) struct XmlAttr {
    name : String
    value : String
    }

    一个 XML 属性。

    XmlElement

    pub(all) struct XmlElement {
    name : String
    attrs : Array[XmlAttr]
    children : Array[XmlNode]
    }

    一个 XML 元素。

    XmlElement::attr

    fn XmlElement::attr(self : XmlElement, name : String) -> String?

    读取元素上第一个同名属性,没有则返回 None。

    XmlElement::child

    fn XmlElement::child(self : XmlElement, name : String) -> XmlElement?

    子元素中第一个同名的元素。

    XmlElement::text

    fn XmlElement::text(self : XmlElement) -> String

    直接文本子节点拼接后的内容(不含子元素内部的文本)。

    XmlNode

    pub(all) enum XmlNode {
    Element(XmlElement)
    Text(String)
    }

    XML 节点:元素或文本。

    child_text

    fn child_text(elem : XmlElement, name : String) -> String?

    取同名子元素的文本;没有则返回 None。

    dec_digit

    fn dec_digit(b : Byte) -> Int

    first_element

    fn first_element(elem : XmlElement, name : String) -> XmlElement?

    找第一个同名子元素。

    hex_digit

    fn hex_digit(b : Byte) -> Int

    is_space

    fn is_space(b : Byte) -> Bool

    parse_double

    fn parse_double(text : String) -> Double?

    parse_xml

    fn parse_xml(input : String) -> XmlElement raise KmlError

    解析一个 XML 文档,返回根元素。

    push_double

    fn push_double(out : Array[Byte], value : Double) -> Unit

    push_escaped

    fn push_escaped(out : Array[Byte], text : String) -> Unit

    push_lit

    fn push_lit(out : Array[Byte], text : String) -> Unit

    push_newline

    fn push_newline(out : Array[Byte]) -> Unit

    split_commas

    fn split_commas(text : String) -> Array[String]

    split_whitespace

    fn split_whitespace(text : String) -> Array[String]

    trim_text

    fn trim_text(text : String) -> String