// @generated by `cargo xtask codegen` from the DATEX II 3.7 schemas. Do not edit.
//! Types of the DATEX II namespace `http://datex2.eu/schema/3/locationReferencing`.
//!
//! Names follow the standard; see <https://docs.datex2.eu/> for what each one means.
#[allow(unused_imports)]
use super::{common as com, common_extension as comx, location_extension as locx, situation as sit, road_traffic_data as roa, vms, parking as prk, energy_infrastructure as egi, afir_energy_infrastructure as aegi, facilities as fac, afir_facilities as afac, traffic_regulation as tro, controlled_zone as cz, traffic_management_plan as tmp, rerouting_management_enhanced as rer, urban_extensions as ubx, fault_and_status as fst, message_container as con, exchange_information as ex, information_management as inf, cis_information as cis};
#[allow(unused_imports)]
use crate::out::{Out, Pattern, Rules};
#[allow(unused_imports)]
use crate::json::{JsonReader, JsonWriter};
#[allow(unused_imports)]
use crate::{ErrorKind, WarningKind};
#[allow(unused_imports)]
use crate::xml::{Enumeration, Xml};
#[allow(unused_imports)]
use crate::{Date, DateTime, Decimal, Error, Extension, MultilingualString, Time};
/// XML enumeration `loc:AlertCDirectionEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum AlertCDirectionEnum {
/// `negative`
Negative,
/// `positive`
Positive,
/// A value outside the standard list.
Extended(String),
}
impl AlertCDirectionEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::Negative => "negative",
Self::Positive => "positive",
Self::Extended(v) => v,
}
}
}
impl Enumeration for AlertCDirectionEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"negative" => Some(Self::Negative),
"positive" => Some(Self::Positive),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl AlertCDirectionEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML simple type `loc:AlertCLocationCode`.
pub type AlertCLocationCode = com::NonNegativeInteger;
/// XML enumeration `loc:AltitudeAccuracyEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum AltitudeAccuracyEnum {
/// `equalToOrLessThan1Centimetre`
EqualToOrLessThan1Centimetre,
/// `equalToOrLessThan2Centimetres`
EqualToOrLessThan2Centimetres,
/// `equalToOrLessThan5Centimetres`
EqualToOrLessThan5Centimetres,
/// `equalToOrLessThan10Centimetres`
EqualToOrLessThan10Centimetres,
/// `equalToOrLessThan20Centimetres`
EqualToOrLessThan20Centimetres,
/// `equalToOrLessThan50Centimetres`
EqualToOrLessThan50Centimetres,
/// `equalToOrLessThan1Metre`
EqualToOrLessThan1Metre,
/// `equalToOrLessThan2Metres`
EqualToOrLessThan2Metres,
/// `equalToOrLessThan5Metres`
EqualToOrLessThan5Metres,
/// `equalToOrLessThan10Metres`
EqualToOrLessThan10Metres,
/// `equalToOrLessThan20Metres`
EqualToOrLessThan20Metres,
/// `equalToOrLessThan50Metres`
EqualToOrLessThan50Metres,
/// `equalToOrLessThan100Metres`
EqualToOrLessThan100Metres,
/// `equalToOrLessThan200Metres`
EqualToOrLessThan200Metres,
/// A value outside the standard list.
Extended(String),
}
impl AltitudeAccuracyEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::EqualToOrLessThan1Centimetre => "equalToOrLessThan1Centimetre",
Self::EqualToOrLessThan2Centimetres => "equalToOrLessThan2Centimetres",
Self::EqualToOrLessThan5Centimetres => "equalToOrLessThan5Centimetres",
Self::EqualToOrLessThan10Centimetres => "equalToOrLessThan10Centimetres",
Self::EqualToOrLessThan20Centimetres => "equalToOrLessThan20Centimetres",
Self::EqualToOrLessThan50Centimetres => "equalToOrLessThan50Centimetres",
Self::EqualToOrLessThan1Metre => "equalToOrLessThan1Metre",
Self::EqualToOrLessThan2Metres => "equalToOrLessThan2Metres",
Self::EqualToOrLessThan5Metres => "equalToOrLessThan5Metres",
Self::EqualToOrLessThan10Metres => "equalToOrLessThan10Metres",
Self::EqualToOrLessThan20Metres => "equalToOrLessThan20Metres",
Self::EqualToOrLessThan50Metres => "equalToOrLessThan50Metres",
Self::EqualToOrLessThan100Metres => "equalToOrLessThan100Metres",
Self::EqualToOrLessThan200Metres => "equalToOrLessThan200Metres",
Self::Extended(v) => v,
}
}
}
impl Enumeration for AltitudeAccuracyEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"equalToOrLessThan1Centimetre" => Some(Self::EqualToOrLessThan1Centimetre),
"equalToOrLessThan2Centimetres" => Some(Self::EqualToOrLessThan2Centimetres),
"equalToOrLessThan5Centimetres" => Some(Self::EqualToOrLessThan5Centimetres),
"equalToOrLessThan10Centimetres" => Some(Self::EqualToOrLessThan10Centimetres),
"equalToOrLessThan20Centimetres" => Some(Self::EqualToOrLessThan20Centimetres),
"equalToOrLessThan50Centimetres" => Some(Self::EqualToOrLessThan50Centimetres),
"equalToOrLessThan1Metre" => Some(Self::EqualToOrLessThan1Metre),
"equalToOrLessThan2Metres" => Some(Self::EqualToOrLessThan2Metres),
"equalToOrLessThan5Metres" => Some(Self::EqualToOrLessThan5Metres),
"equalToOrLessThan10Metres" => Some(Self::EqualToOrLessThan10Metres),
"equalToOrLessThan20Metres" => Some(Self::EqualToOrLessThan20Metres),
"equalToOrLessThan50Metres" => Some(Self::EqualToOrLessThan50Metres),
"equalToOrLessThan100Metres" => Some(Self::EqualToOrLessThan100Metres),
"equalToOrLessThan200Metres" => Some(Self::EqualToOrLessThan200Metres),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl AltitudeAccuracyEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML enumeration `loc:AreaPlacesEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum AreaPlacesEnum {
/// `atBorders`
AtBorders,
/// `atHighAltitudes`
AtHighAltitudes,
/// `inBuiltUpAreas`
InBuiltUpAreas,
/// `inForestedAreas`
InForestedAreas,
/// `inGalleries`
InGalleries,
/// `inLowLyingAreas`
InLowLyingAreas,
/// `inRuralAreas`
InRuralAreas,
/// `inShadedAreas`
InShadedAreas,
/// `inTheInnerCityAreas`
InTheInnerCityAreas,
/// `inTunnels`
InTunnels,
/// `onBridges`
OnBridges,
/// `onDownhillSections`
OnDownhillSections,
/// `onElevatedSections`
OnElevatedSections,
/// `onEnteringOrLeavingTunnels`
OnEnteringOrLeavingTunnels,
/// `onFlyovers`
OnFlyovers,
/// `onPasses`
OnPasses,
/// `onUndergroundSections`
OnUndergroundSections,
/// `onUnderpasses`
OnUnderpasses,
/// A value outside the standard list.
Extended(String),
}
impl AreaPlacesEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::AtBorders => "atBorders",
Self::AtHighAltitudes => "atHighAltitudes",
Self::InBuiltUpAreas => "inBuiltUpAreas",
Self::InForestedAreas => "inForestedAreas",
Self::InGalleries => "inGalleries",
Self::InLowLyingAreas => "inLowLyingAreas",
Self::InRuralAreas => "inRuralAreas",
Self::InShadedAreas => "inShadedAreas",
Self::InTheInnerCityAreas => "inTheInnerCityAreas",
Self::InTunnels => "inTunnels",
Self::OnBridges => "onBridges",
Self::OnDownhillSections => "onDownhillSections",
Self::OnElevatedSections => "onElevatedSections",
Self::OnEnteringOrLeavingTunnels => "onEnteringOrLeavingTunnels",
Self::OnFlyovers => "onFlyovers",
Self::OnPasses => "onPasses",
Self::OnUndergroundSections => "onUndergroundSections",
Self::OnUnderpasses => "onUnderpasses",
Self::Extended(v) => v,
}
}
}
impl Enumeration for AreaPlacesEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"atBorders" => Some(Self::AtBorders),
"atHighAltitudes" => Some(Self::AtHighAltitudes),
"inBuiltUpAreas" => Some(Self::InBuiltUpAreas),
"inForestedAreas" => Some(Self::InForestedAreas),
"inGalleries" => Some(Self::InGalleries),
"inLowLyingAreas" => Some(Self::InLowLyingAreas),
"inRuralAreas" => Some(Self::InRuralAreas),
"inShadedAreas" => Some(Self::InShadedAreas),
"inTheInnerCityAreas" => Some(Self::InTheInnerCityAreas),
"inTunnels" => Some(Self::InTunnels),
"onBridges" => Some(Self::OnBridges),
"onDownhillSections" => Some(Self::OnDownhillSections),
"onElevatedSections" => Some(Self::OnElevatedSections),
"onEnteringOrLeavingTunnels" => Some(Self::OnEnteringOrLeavingTunnels),
"onFlyovers" => Some(Self::OnFlyovers),
"onPasses" => Some(Self::OnPasses),
"onUndergroundSections" => Some(Self::OnUndergroundSections),
"onUnderpasses" => Some(Self::OnUnderpasses),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl AreaPlacesEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML enumeration `loc:CarriagewayEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum CarriagewayEnum {
/// `connectingCarriageway`
ConnectingCarriageway,
/// `cycleTrack`
CycleTrack,
/// `entrySlipRoad`
EntrySlipRoad,
/// `exitSlipRoad`
ExitSlipRoad,
/// `flyover`
Flyover,
/// `footpath`
Footpath,
/// `leftHandFeederRoad`
LeftHandFeederRoad,
/// `leftHandParallelCarriageway`
LeftHandParallelCarriageway,
/// `mainCarriageway`
MainCarriageway,
/// `oppositeCarriageway`
OppositeCarriageway,
/// `parallelCarriageway`
ParallelCarriageway,
/// `rightHandFeederRoad`
RightHandFeederRoad,
/// `rightHandParallelCarriageway`
RightHandParallelCarriageway,
/// `roundabout`
Roundabout,
/// `serviceRoad`
ServiceRoad,
/// `slipRoads`
SlipRoads,
/// `underpass`
Underpass,
/// `unspecifiedCarriageway`
UnspecifiedCarriageway,
/// A value outside the standard list.
Extended(String),
}
impl CarriagewayEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::ConnectingCarriageway => "connectingCarriageway",
Self::CycleTrack => "cycleTrack",
Self::EntrySlipRoad => "entrySlipRoad",
Self::ExitSlipRoad => "exitSlipRoad",
Self::Flyover => "flyover",
Self::Footpath => "footpath",
Self::LeftHandFeederRoad => "leftHandFeederRoad",
Self::LeftHandParallelCarriageway => "leftHandParallelCarriageway",
Self::MainCarriageway => "mainCarriageway",
Self::OppositeCarriageway => "oppositeCarriageway",
Self::ParallelCarriageway => "parallelCarriageway",
Self::RightHandFeederRoad => "rightHandFeederRoad",
Self::RightHandParallelCarriageway => "rightHandParallelCarriageway",
Self::Roundabout => "roundabout",
Self::ServiceRoad => "serviceRoad",
Self::SlipRoads => "slipRoads",
Self::Underpass => "underpass",
Self::UnspecifiedCarriageway => "unspecifiedCarriageway",
Self::Extended(v) => v,
}
}
}
impl Enumeration for CarriagewayEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"connectingCarriageway" => Some(Self::ConnectingCarriageway),
"cycleTrack" => Some(Self::CycleTrack),
"entrySlipRoad" => Some(Self::EntrySlipRoad),
"exitSlipRoad" => Some(Self::ExitSlipRoad),
"flyover" => Some(Self::Flyover),
"footpath" => Some(Self::Footpath),
"leftHandFeederRoad" => Some(Self::LeftHandFeederRoad),
"leftHandParallelCarriageway" => Some(Self::LeftHandParallelCarriageway),
"mainCarriageway" => Some(Self::MainCarriageway),
"oppositeCarriageway" => Some(Self::OppositeCarriageway),
"parallelCarriageway" => Some(Self::ParallelCarriageway),
"rightHandFeederRoad" => Some(Self::RightHandFeederRoad),
"rightHandParallelCarriageway" => Some(Self::RightHandParallelCarriageway),
"roundabout" => Some(Self::Roundabout),
"serviceRoad" => Some(Self::ServiceRoad),
"slipRoads" => Some(Self::SlipRoads),
"underpass" => Some(Self::Underpass),
"unspecifiedCarriageway" => Some(Self::UnspecifiedCarriageway),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl CarriagewayEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML enumeration `loc:DirectionEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum DirectionEnum {
/// `aligned`
Aligned,
/// `allDirections`
AllDirections,
/// `anticlockwise`
Anticlockwise,
/// `bothWays`
BothWays,
/// `clockwise`
Clockwise,
/// `innerRing`
InnerRing,
/// `outerRing`
OuterRing,
/// `eastBound`
EastBound,
/// `northBound`
NorthBound,
/// `northEastBound`
NorthEastBound,
/// `northWestBound`
NorthWestBound,
/// `southBound`
SouthBound,
/// `southEastBound`
SouthEastBound,
/// `southWestBound`
SouthWestBound,
/// `westBound`
WestBound,
/// `inboundTowardsTown`
InboundTowardsTown,
/// `outboundFromTown`
OutboundFromTown,
/// `opposite`
Opposite,
/// `unknown`
Unknown,
/// `other`
Other,
/// A value outside the standard list.
Extended(String),
}
impl DirectionEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::Aligned => "aligned",
Self::AllDirections => "allDirections",
Self::Anticlockwise => "anticlockwise",
Self::BothWays => "bothWays",
Self::Clockwise => "clockwise",
Self::InnerRing => "innerRing",
Self::OuterRing => "outerRing",
Self::EastBound => "eastBound",
Self::NorthBound => "northBound",
Self::NorthEastBound => "northEastBound",
Self::NorthWestBound => "northWestBound",
Self::SouthBound => "southBound",
Self::SouthEastBound => "southEastBound",
Self::SouthWestBound => "southWestBound",
Self::WestBound => "westBound",
Self::InboundTowardsTown => "inboundTowardsTown",
Self::OutboundFromTown => "outboundFromTown",
Self::Opposite => "opposite",
Self::Unknown => "unknown",
Self::Other => "other",
Self::Extended(v) => v,
}
}
}
impl Enumeration for DirectionEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"aligned" => Some(Self::Aligned),
"allDirections" => Some(Self::AllDirections),
"anticlockwise" => Some(Self::Anticlockwise),
"bothWays" => Some(Self::BothWays),
"clockwise" => Some(Self::Clockwise),
"innerRing" => Some(Self::InnerRing),
"outerRing" => Some(Self::OuterRing),
"eastBound" => Some(Self::EastBound),
"northBound" => Some(Self::NorthBound),
"northEastBound" => Some(Self::NorthEastBound),
"northWestBound" => Some(Self::NorthWestBound),
"southBound" => Some(Self::SouthBound),
"southEastBound" => Some(Self::SouthEastBound),
"southWestBound" => Some(Self::SouthWestBound),
"westBound" => Some(Self::WestBound),
"inboundTowardsTown" => Some(Self::InboundTowardsTown),
"outboundFromTown" => Some(Self::OutboundFromTown),
"opposite" => Some(Self::Opposite),
"unknown" => Some(Self::Unknown),
"other" => Some(Self::Other),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl DirectionEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML enumeration `loc:DirectionPurposeEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum DirectionPurposeEnum {
/// `inbound`
Inbound,
/// `outbound`
Outbound,
/// A value outside the standard list.
Extended(String),
}
impl DirectionPurposeEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::Inbound => "inbound",
Self::Outbound => "outbound",
Self::Extended(v) => v,
}
}
}
impl Enumeration for DirectionPurposeEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"inbound" => Some(Self::Inbound),
"outbound" => Some(Self::Outbound),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl DirectionPurposeEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML enumeration `loc:GeographicCharacteristicEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum GeographicCharacteristicEnum {
/// `aroundABendInRoad`
AroundABendInRoad,
/// `onBorder`
OnBorder,
/// `onPass`
OnPass,
/// `overCrestOfHill`
OverCrestOfHill,
/// A value outside the standard list.
Extended(String),
}
impl GeographicCharacteristicEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::AroundABendInRoad => "aroundABendInRoad",
Self::OnBorder => "onBorder",
Self::OnPass => "onPass",
Self::OverCrestOfHill => "overCrestOfHill",
Self::Extended(v) => v,
}
}
}
impl Enumeration for GeographicCharacteristicEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"aroundABendInRoad" => Some(Self::AroundABendInRoad),
"onBorder" => Some(Self::OnBorder),
"onPass" => Some(Self::OnPass),
"overCrestOfHill" => Some(Self::OverCrestOfHill),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl GeographicCharacteristicEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML simple type `loc:GmlPosList`.
pub type GmlPosList = com::LongString;
/// XML enumeration `loc:HeightGradeEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum HeightGradeEnum {
/// `aboveGrade`
AboveGrade,
/// `atGrade`
AtGrade,
/// `belowGrade`
BelowGrade,
/// A value outside the standard list.
Extended(String),
}
impl HeightGradeEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::AboveGrade => "aboveGrade",
Self::AtGrade => "atGrade",
Self::BelowGrade => "belowGrade",
Self::Extended(v) => v,
}
}
}
impl Enumeration for HeightGradeEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"aboveGrade" => Some(Self::AboveGrade),
"atGrade" => Some(Self::AtGrade),
"belowGrade" => Some(Self::BelowGrade),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl HeightGradeEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML enumeration `loc:HeightTypeEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum HeightTypeEnum {
/// `ellipsoidalHeight`
EllipsoidalHeight,
/// `gravityRelatedHeight`
GravityRelatedHeight,
/// `relativeHeight`
RelativeHeight,
/// A value outside the standard list.
Extended(String),
}
impl HeightTypeEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::EllipsoidalHeight => "ellipsoidalHeight",
Self::GravityRelatedHeight => "gravityRelatedHeight",
Self::RelativeHeight => "relativeHeight",
Self::Extended(v) => v,
}
}
}
impl Enumeration for HeightTypeEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"ellipsoidalHeight" => Some(Self::EllipsoidalHeight),
"gravityRelatedHeight" => Some(Self::GravityRelatedHeight),
"relativeHeight" => Some(Self::RelativeHeight),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl HeightTypeEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML enumeration `loc:InfrastructureDescriptorEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum InfrastructureDescriptorEnum {
/// `atMotorwayInterchange`
AtMotorwayInterchange,
/// `atRestArea`
AtRestArea,
/// `atServiceArea`
AtServiceArea,
/// `atTollPlaza`
AtTollPlaza,
/// `atTunnelEntryOrExit`
AtTunnelEntryOrExit,
/// `inGallery`
InGallery,
/// `inTunnel`
InTunnel,
/// `onBridge`
OnBridge,
/// `onConnector`
OnConnector,
/// `onElevatedSection`
OnElevatedSection,
/// `onFlyover`
OnFlyover,
/// `onIceRoad`
OnIceRoad,
/// `onLevelCrossing`
OnLevelCrossing,
/// `onLinkRoad`
OnLinkRoad,
/// `onRoundabout`
OnRoundabout,
/// `onTheRoadway`
OnTheRoadway,
/// `onUndergroundSection`
OnUndergroundSection,
/// `onUnderpass`
OnUnderpass,
/// `withinJunction`
WithinJunction,
/// A value outside the standard list.
Extended(String),
}
impl InfrastructureDescriptorEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::AtMotorwayInterchange => "atMotorwayInterchange",
Self::AtRestArea => "atRestArea",
Self::AtServiceArea => "atServiceArea",
Self::AtTollPlaza => "atTollPlaza",
Self::AtTunnelEntryOrExit => "atTunnelEntryOrExit",
Self::InGallery => "inGallery",
Self::InTunnel => "inTunnel",
Self::OnBridge => "onBridge",
Self::OnConnector => "onConnector",
Self::OnElevatedSection => "onElevatedSection",
Self::OnFlyover => "onFlyover",
Self::OnIceRoad => "onIceRoad",
Self::OnLevelCrossing => "onLevelCrossing",
Self::OnLinkRoad => "onLinkRoad",
Self::OnRoundabout => "onRoundabout",
Self::OnTheRoadway => "onTheRoadway",
Self::OnUndergroundSection => "onUndergroundSection",
Self::OnUnderpass => "onUnderpass",
Self::WithinJunction => "withinJunction",
Self::Extended(v) => v,
}
}
}
impl Enumeration for InfrastructureDescriptorEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"atMotorwayInterchange" => Some(Self::AtMotorwayInterchange),
"atRestArea" => Some(Self::AtRestArea),
"atServiceArea" => Some(Self::AtServiceArea),
"atTollPlaza" => Some(Self::AtTollPlaza),
"atTunnelEntryOrExit" => Some(Self::AtTunnelEntryOrExit),
"inGallery" => Some(Self::InGallery),
"inTunnel" => Some(Self::InTunnel),
"onBridge" => Some(Self::OnBridge),
"onConnector" => Some(Self::OnConnector),
"onElevatedSection" => Some(Self::OnElevatedSection),
"onFlyover" => Some(Self::OnFlyover),
"onIceRoad" => Some(Self::OnIceRoad),
"onLevelCrossing" => Some(Self::OnLevelCrossing),
"onLinkRoad" => Some(Self::OnLinkRoad),
"onRoundabout" => Some(Self::OnRoundabout),
"onTheRoadway" => Some(Self::OnTheRoadway),
"onUndergroundSection" => Some(Self::OnUndergroundSection),
"onUnderpass" => Some(Self::OnUnderpass),
"withinJunction" => Some(Self::WithinJunction),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl InfrastructureDescriptorEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML enumeration `loc:LaneEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum LaneEnum {
/// `allLanesCompleteCarriageway`
AllLanesCompleteCarriageway,
/// `busLane`
BusLane,
/// `busStop`
BusStop,
/// `carPoolLane`
CarPoolLane,
/// `centralReservation`
CentralReservation,
/// `crawlerLane`
CrawlerLane,
/// `cycleLane`
CycleLane,
/// `emergencyLane`
EmergencyLane,
/// `escapeLane`
EscapeLane,
/// `expressLane`
ExpressLane,
/// `hardShoulder`
HardShoulder,
/// `heavyVehicleLane`
HeavyVehicleLane,
/// `layBy`
LayBy,
/// `leftHandTurningLane`
LeftHandTurningLane,
/// `leftLane`
LeftLane,
/// `localTrafficLane`
LocalTrafficLane,
/// `middleLane`
MiddleLane,
/// `overtakingLane`
OvertakingLane,
/// `rightHandTurningLane`
RightHandTurningLane,
/// `rightLane`
RightLane,
/// `rushHourLane`
RushHourLane,
/// `setDownArea`
SetDownArea,
/// `slowVehicleLane`
SlowVehicleLane,
/// `throughTrafficLane`
ThroughTrafficLane,
/// `tidalFlowLane`
TidalFlowLane,
/// `turningLane`
TurningLane,
/// `verge`
Verge,
/// A value outside the standard list.
Extended(String),
}
impl LaneEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::AllLanesCompleteCarriageway => "allLanesCompleteCarriageway",
Self::BusLane => "busLane",
Self::BusStop => "busStop",
Self::CarPoolLane => "carPoolLane",
Self::CentralReservation => "centralReservation",
Self::CrawlerLane => "crawlerLane",
Self::CycleLane => "cycleLane",
Self::EmergencyLane => "emergencyLane",
Self::EscapeLane => "escapeLane",
Self::ExpressLane => "expressLane",
Self::HardShoulder => "hardShoulder",
Self::HeavyVehicleLane => "heavyVehicleLane",
Self::LayBy => "layBy",
Self::LeftHandTurningLane => "leftHandTurningLane",
Self::LeftLane => "leftLane",
Self::LocalTrafficLane => "localTrafficLane",
Self::MiddleLane => "middleLane",
Self::OvertakingLane => "overtakingLane",
Self::RightHandTurningLane => "rightHandTurningLane",
Self::RightLane => "rightLane",
Self::RushHourLane => "rushHourLane",
Self::SetDownArea => "setDownArea",
Self::SlowVehicleLane => "slowVehicleLane",
Self::ThroughTrafficLane => "throughTrafficLane",
Self::TidalFlowLane => "tidalFlowLane",
Self::TurningLane => "turningLane",
Self::Verge => "verge",
Self::Extended(v) => v,
}
}
}
impl Enumeration for LaneEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"allLanesCompleteCarriageway" => Some(Self::AllLanesCompleteCarriageway),
"busLane" => Some(Self::BusLane),
"busStop" => Some(Self::BusStop),
"carPoolLane" => Some(Self::CarPoolLane),
"centralReservation" => Some(Self::CentralReservation),
"crawlerLane" => Some(Self::CrawlerLane),
"cycleLane" => Some(Self::CycleLane),
"emergencyLane" => Some(Self::EmergencyLane),
"escapeLane" => Some(Self::EscapeLane),
"expressLane" => Some(Self::ExpressLane),
"hardShoulder" => Some(Self::HardShoulder),
"heavyVehicleLane" => Some(Self::HeavyVehicleLane),
"layBy" => Some(Self::LayBy),
"leftHandTurningLane" => Some(Self::LeftHandTurningLane),
"leftLane" => Some(Self::LeftLane),
"localTrafficLane" => Some(Self::LocalTrafficLane),
"middleLane" => Some(Self::MiddleLane),
"overtakingLane" => Some(Self::OvertakingLane),
"rightHandTurningLane" => Some(Self::RightHandTurningLane),
"rightLane" => Some(Self::RightLane),
"rushHourLane" => Some(Self::RushHourLane),
"setDownArea" => Some(Self::SetDownArea),
"slowVehicleLane" => Some(Self::SlowVehicleLane),
"throughTrafficLane" => Some(Self::ThroughTrafficLane),
"tidalFlowLane" => Some(Self::TidalFlowLane),
"turningLane" => Some(Self::TurningLane),
"verge" => Some(Self::Verge),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl LaneEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML enumeration `loc:LinearDirectionEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum LinearDirectionEnum {
/// `both`
Both,
/// `opposite`
Opposite,
/// `aligned`
Aligned,
/// `unknown`
Unknown,
/// A value outside the standard list.
Extended(String),
}
impl LinearDirectionEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::Both => "both",
Self::Opposite => "opposite",
Self::Aligned => "aligned",
Self::Unknown => "unknown",
Self::Extended(v) => v,
}
}
}
impl Enumeration for LinearDirectionEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"both" => Some(Self::Both),
"opposite" => Some(Self::Opposite),
"aligned" => Some(Self::Aligned),
"unknown" => Some(Self::Unknown),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl LinearDirectionEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML enumeration `loc:LinearElementNatureEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum LinearElementNatureEnum {
/// `road`
Road,
/// `roadSection`
RoadSection,
/// `slipRoad`
SlipRoad,
/// `other`
Other,
/// A value outside the standard list.
Extended(String),
}
impl LinearElementNatureEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::Road => "road",
Self::RoadSection => "roadSection",
Self::SlipRoad => "slipRoad",
Self::Other => "other",
Self::Extended(v) => v,
}
}
}
impl Enumeration for LinearElementNatureEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"road" => Some(Self::Road),
"roadSection" => Some(Self::RoadSection),
"slipRoad" => Some(Self::SlipRoad),
"other" => Some(Self::Other),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl LinearElementNatureEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML enumeration `loc:NamedAreaTypeEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum NamedAreaTypeEnum {
/// `applicationRegion`
ApplicationRegion,
/// `continent`
Continent,
/// `country`
Country,
/// `countryGroup`
CountryGroup,
/// `carParkArea`
CarParkArea,
/// `carpoolArea`
CarpoolArea,
/// `fuzzyArea`
FuzzyArea,
/// `industrialArea`
IndustrialArea,
/// `lake`
Lake,
/// `meteorologicalArea`
MeteorologicalArea,
/// `metropolitanArea`
MetropolitanArea,
/// `municipality`
Municipality,
/// `parkAndRideSite`
ParkAndRideSite,
/// `ruralCounty`
RuralCounty,
/// `sea`
Sea,
/// `touristArea`
TouristArea,
/// `trafficArea`
TrafficArea,
/// `urbanCounty`
UrbanCounty,
/// `order1AdministrativeArea`
Order1AdministrativeArea,
/// `order2AdministrativeArea`
Order2AdministrativeArea,
/// `order3AdministrativeArea`
Order3AdministrativeArea,
/// `order4AdministrativeArea`
Order4AdministrativeArea,
/// `order5AdministrativeArea`
Order5AdministrativeArea,
/// `policeForceControlArea`
PoliceForceControlArea,
/// `roadOperatorControlArea`
RoadOperatorControlArea,
/// `waterArea`
WaterArea,
/// A value outside the standard list.
Extended(String),
}
impl NamedAreaTypeEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::ApplicationRegion => "applicationRegion",
Self::Continent => "continent",
Self::Country => "country",
Self::CountryGroup => "countryGroup",
Self::CarParkArea => "carParkArea",
Self::CarpoolArea => "carpoolArea",
Self::FuzzyArea => "fuzzyArea",
Self::IndustrialArea => "industrialArea",
Self::Lake => "lake",
Self::MeteorologicalArea => "meteorologicalArea",
Self::MetropolitanArea => "metropolitanArea",
Self::Municipality => "municipality",
Self::ParkAndRideSite => "parkAndRideSite",
Self::RuralCounty => "ruralCounty",
Self::Sea => "sea",
Self::TouristArea => "touristArea",
Self::TrafficArea => "trafficArea",
Self::UrbanCounty => "urbanCounty",
Self::Order1AdministrativeArea => "order1AdministrativeArea",
Self::Order2AdministrativeArea => "order2AdministrativeArea",
Self::Order3AdministrativeArea => "order3AdministrativeArea",
Self::Order4AdministrativeArea => "order4AdministrativeArea",
Self::Order5AdministrativeArea => "order5AdministrativeArea",
Self::PoliceForceControlArea => "policeForceControlArea",
Self::RoadOperatorControlArea => "roadOperatorControlArea",
Self::WaterArea => "waterArea",
Self::Extended(v) => v,
}
}
}
impl Enumeration for NamedAreaTypeEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"applicationRegion" => Some(Self::ApplicationRegion),
"continent" => Some(Self::Continent),
"country" => Some(Self::Country),
"countryGroup" => Some(Self::CountryGroup),
"carParkArea" => Some(Self::CarParkArea),
"carpoolArea" => Some(Self::CarpoolArea),
"fuzzyArea" => Some(Self::FuzzyArea),
"industrialArea" => Some(Self::IndustrialArea),
"lake" => Some(Self::Lake),
"meteorologicalArea" => Some(Self::MeteorologicalArea),
"metropolitanArea" => Some(Self::MetropolitanArea),
"municipality" => Some(Self::Municipality),
"parkAndRideSite" => Some(Self::ParkAndRideSite),
"ruralCounty" => Some(Self::RuralCounty),
"sea" => Some(Self::Sea),
"touristArea" => Some(Self::TouristArea),
"trafficArea" => Some(Self::TrafficArea),
"urbanCounty" => Some(Self::UrbanCounty),
"order1AdministrativeArea" => Some(Self::Order1AdministrativeArea),
"order2AdministrativeArea" => Some(Self::Order2AdministrativeArea),
"order3AdministrativeArea" => Some(Self::Order3AdministrativeArea),
"order4AdministrativeArea" => Some(Self::Order4AdministrativeArea),
"order5AdministrativeArea" => Some(Self::Order5AdministrativeArea),
"policeForceControlArea" => Some(Self::PoliceForceControlArea),
"roadOperatorControlArea" => Some(Self::RoadOperatorControlArea),
"waterArea" => Some(Self::WaterArea),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl NamedAreaTypeEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML simple type `loc:NutsCode`.
pub type NutsCode = String;
/// XML enumeration `loc:NutsCodeTypeEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum NutsCodeTypeEnum {
/// `nuts1Code`
Nuts1Code,
/// `nuts2Code`
Nuts2Code,
/// `nuts3Code`
Nuts3Code,
/// `lau1Code`
Lau1Code,
/// `lau2Code`
Lau2Code,
/// A value outside the standard list.
Extended(String),
}
impl NutsCodeTypeEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::Nuts1Code => "nuts1Code",
Self::Nuts2Code => "nuts2Code",
Self::Nuts3Code => "nuts3Code",
Self::Lau1Code => "lau1Code",
Self::Lau2Code => "lau2Code",
Self::Extended(v) => v,
}
}
}
impl Enumeration for NutsCodeTypeEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"nuts1Code" => Some(Self::Nuts1Code),
"nuts2Code" => Some(Self::Nuts2Code),
"nuts3Code" => Some(Self::Nuts3Code),
"lau1Code" => Some(Self::Lau1Code),
"lau2Code" => Some(Self::Lau2Code),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl NutsCodeTypeEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML enumeration `loc:OpenlrFormOfWayEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum OpenlrFormOfWayEnum {
/// `undefined`
Undefined,
/// `motorway`
Motorway,
/// `multipleCarriageway`
MultipleCarriageway,
/// `singleCarriageway`
SingleCarriageway,
/// `roundabout`
Roundabout,
/// `slipRoad`
SlipRoad,
/// `trafficSquare`
TrafficSquare,
/// `other`
Other,
/// A value outside the standard list.
Extended(String),
}
impl OpenlrFormOfWayEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::Undefined => "undefined",
Self::Motorway => "motorway",
Self::MultipleCarriageway => "multipleCarriageway",
Self::SingleCarriageway => "singleCarriageway",
Self::Roundabout => "roundabout",
Self::SlipRoad => "slipRoad",
Self::TrafficSquare => "trafficSquare",
Self::Other => "other",
Self::Extended(v) => v,
}
}
}
impl Enumeration for OpenlrFormOfWayEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"undefined" => Some(Self::Undefined),
"motorway" => Some(Self::Motorway),
"multipleCarriageway" => Some(Self::MultipleCarriageway),
"singleCarriageway" => Some(Self::SingleCarriageway),
"roundabout" => Some(Self::Roundabout),
"slipRoad" => Some(Self::SlipRoad),
"trafficSquare" => Some(Self::TrafficSquare),
"other" => Some(Self::Other),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl OpenlrFormOfWayEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML enumeration `loc:OpenlrFunctionalRoadClassEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum OpenlrFunctionalRoadClassEnum {
/// `frc0`
Frc0,
/// `frc1`
Frc1,
/// `frc2`
Frc2,
/// `frc3`
Frc3,
/// `frc4`
Frc4,
/// `frc5`
Frc5,
/// `frc6`
Frc6,
/// `frc7`
Frc7,
/// A value outside the standard list.
Extended(String),
}
impl OpenlrFunctionalRoadClassEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::Frc0 => "frc0",
Self::Frc1 => "frc1",
Self::Frc2 => "frc2",
Self::Frc3 => "frc3",
Self::Frc4 => "frc4",
Self::Frc5 => "frc5",
Self::Frc6 => "frc6",
Self::Frc7 => "frc7",
Self::Extended(v) => v,
}
}
}
impl Enumeration for OpenlrFunctionalRoadClassEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"frc0" => Some(Self::Frc0),
"frc1" => Some(Self::Frc1),
"frc2" => Some(Self::Frc2),
"frc3" => Some(Self::Frc3),
"frc4" => Some(Self::Frc4),
"frc5" => Some(Self::Frc5),
"frc6" => Some(Self::Frc6),
"frc7" => Some(Self::Frc7),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl OpenlrFunctionalRoadClassEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML enumeration `loc:OpenlrOrientationEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum OpenlrOrientationEnum {
/// `noOrientationOrUnknown`
NoOrientationOrUnknown,
/// `withLineDirection`
WithLineDirection,
/// `againstLineDirection`
AgainstLineDirection,
/// `both`
Both,
/// A value outside the standard list.
Extended(String),
}
impl OpenlrOrientationEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::NoOrientationOrUnknown => "noOrientationOrUnknown",
Self::WithLineDirection => "withLineDirection",
Self::AgainstLineDirection => "againstLineDirection",
Self::Both => "both",
Self::Extended(v) => v,
}
}
}
impl Enumeration for OpenlrOrientationEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"noOrientationOrUnknown" => Some(Self::NoOrientationOrUnknown),
"withLineDirection" => Some(Self::WithLineDirection),
"againstLineDirection" => Some(Self::AgainstLineDirection),
"both" => Some(Self::Both),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl OpenlrOrientationEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML enumeration `loc:OpenlrSideOfRoadEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum OpenlrSideOfRoadEnum {
/// `onRoadOrUnknown`
OnRoadOrUnknown,
/// `right`
Right,
/// `left`
Left,
/// `both`
Both,
/// A value outside the standard list.
Extended(String),
}
impl OpenlrSideOfRoadEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::OnRoadOrUnknown => "onRoadOrUnknown",
Self::Right => "right",
Self::Left => "left",
Self::Both => "both",
Self::Extended(v) => v,
}
}
}
impl Enumeration for OpenlrSideOfRoadEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"onRoadOrUnknown" => Some(Self::OnRoadOrUnknown),
"right" => Some(Self::Right),
"left" => Some(Self::Left),
"both" => Some(Self::Both),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl OpenlrSideOfRoadEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML enumeration `loc:PositionConfidenceCodedErrorEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum PositionConfidenceCodedErrorEnum {
/// `outOfRange`
OutOfRange,
/// `unavailable`
Unavailable,
/// A value outside the standard list.
Extended(String),
}
impl PositionConfidenceCodedErrorEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::OutOfRange => "outOfRange",
Self::Unavailable => "unavailable",
Self::Extended(v) => v,
}
}
}
impl Enumeration for PositionConfidenceCodedErrorEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"outOfRange" => Some(Self::OutOfRange),
"unavailable" => Some(Self::Unavailable),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl PositionConfidenceCodedErrorEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML enumeration `loc:ReferentTypeEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum ReferentTypeEnum {
/// `boundary`
Boundary,
/// `intersection`
Intersection,
/// `referenceMarker`
ReferenceMarker,
/// `landmark`
Landmark,
/// `roadNode`
RoadNode,
/// A value outside the standard list.
Extended(String),
}
impl ReferentTypeEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::Boundary => "boundary",
Self::Intersection => "intersection",
Self::ReferenceMarker => "referenceMarker",
Self::Landmark => "landmark",
Self::RoadNode => "roadNode",
Self::Extended(v) => v,
}
}
}
impl Enumeration for ReferentTypeEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"boundary" => Some(Self::Boundary),
"intersection" => Some(Self::Intersection),
"referenceMarker" => Some(Self::ReferenceMarker),
"landmark" => Some(Self::Landmark),
"roadNode" => Some(Self::RoadNode),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl ReferentTypeEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML enumeration `loc:RelativePositionOnCarriagewayEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum RelativePositionOnCarriagewayEnum {
/// `inTheCentre`
InTheCentre,
/// `onTheLeft`
OnTheLeft,
/// `onTheRight`
OnTheRight,
/// A value outside the standard list.
Extended(String),
}
impl RelativePositionOnCarriagewayEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::InTheCentre => "inTheCentre",
Self::OnTheLeft => "onTheLeft",
Self::OnTheRight => "onTheRight",
Self::Extended(v) => v,
}
}
}
impl Enumeration for RelativePositionOnCarriagewayEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"inTheCentre" => Some(Self::InTheCentre),
"onTheLeft" => Some(Self::OnTheLeft),
"onTheRight" => Some(Self::OnTheRight),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl RelativePositionOnCarriagewayEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML simple type `loc:SubdivisionCode`.
pub type SubdivisionCode = String;
/// XML enumeration `loc:SubdivisionTypeEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum SubdivisionTypeEnum {
/// `administrativeAtoll`
AdministrativeAtoll,
/// `administrativeRegion`
AdministrativeRegion,
/// `administrativeTerritory`
AdministrativeTerritory,
/// `arcticRegion`
ArcticRegion,
/// `autonomousCity`
AutonomousCity,
/// `autonomousCityInNorthAfrica`
AutonomousCityInNorthAfrica,
/// `autonomousCommunity`
AutonomousCommunity,
/// `autonomousDistrict`
AutonomousDistrict,
/// `autonomousProvince`
AutonomousProvince,
/// `autonomousRegion`
AutonomousRegion,
/// `canton`
Canton,
/// `capitalCity`
CapitalCity,
/// `city`
City,
/// `cityMunicipality`
CityMunicipality,
/// `cityOfCountyRight`
CityOfCountyRight,
/// `commune`
Commune,
/// `councilArea`
CouncilArea,
/// `county`
County,
/// `country`
Country,
/// `department`
Department,
/// `dependency`
Dependency,
/// `district`
District,
/// `districtMunicipality`
DistrictMunicipality,
/// `districtWithSpecialStatus`
DistrictWithSpecialStatus,
/// `entity`
Entity,
/// `geographicalEntity`
GeographicalEntity,
/// `governorate`
Governorate,
/// `laender`
Laender,
/// `localCouncil`
LocalCouncil,
/// `londonBorough`
LondonBorough,
/// `metropolitanArea`
MetropolitanArea,
/// `metropolitanDepartment`
MetropolitanDepartment,
/// `metropolitanDistrict`
MetropolitanDistrict,
/// `metropolitanRegion`
MetropolitanRegion,
/// `municipality`
Municipality,
/// `overseasDepartment`
OverseasDepartment,
/// `overseasRegion`
OverseasRegion,
/// `overseasTerritorialCollectivity`
OverseasTerritorialCollectivity,
/// `parish`
Parish,
/// `province`
Province,
/// `quarter`
Quarter,
/// `region`
Region,
/// `republic`
Republic,
/// `republicanCity`
RepublicanCity,
/// `selfGovernedPart`
SelfGovernedPart,
/// `specialMunicipality`
SpecialMunicipality,
/// `state`
State,
/// `territorialUnit`
TerritorialUnit,
/// `territory`
Territory,
/// `twoTierCounty`
TwoTierCounty,
/// `unitaryAuthority`
UnitaryAuthority,
/// `ward`
Ward,
/// `other`
Other,
/// A value outside the standard list.
Extended(String),
}
impl SubdivisionTypeEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::AdministrativeAtoll => "administrativeAtoll",
Self::AdministrativeRegion => "administrativeRegion",
Self::AdministrativeTerritory => "administrativeTerritory",
Self::ArcticRegion => "arcticRegion",
Self::AutonomousCity => "autonomousCity",
Self::AutonomousCityInNorthAfrica => "autonomousCityInNorthAfrica",
Self::AutonomousCommunity => "autonomousCommunity",
Self::AutonomousDistrict => "autonomousDistrict",
Self::AutonomousProvince => "autonomousProvince",
Self::AutonomousRegion => "autonomousRegion",
Self::Canton => "canton",
Self::CapitalCity => "capitalCity",
Self::City => "city",
Self::CityMunicipality => "cityMunicipality",
Self::CityOfCountyRight => "cityOfCountyRight",
Self::Commune => "commune",
Self::CouncilArea => "councilArea",
Self::County => "county",
Self::Country => "country",
Self::Department => "department",
Self::Dependency => "dependency",
Self::District => "district",
Self::DistrictMunicipality => "districtMunicipality",
Self::DistrictWithSpecialStatus => "districtWithSpecialStatus",
Self::Entity => "entity",
Self::GeographicalEntity => "geographicalEntity",
Self::Governorate => "governorate",
Self::Laender => "laender",
Self::LocalCouncil => "localCouncil",
Self::LondonBorough => "londonBorough",
Self::MetropolitanArea => "metropolitanArea",
Self::MetropolitanDepartment => "metropolitanDepartment",
Self::MetropolitanDistrict => "metropolitanDistrict",
Self::MetropolitanRegion => "metropolitanRegion",
Self::Municipality => "municipality",
Self::OverseasDepartment => "overseasDepartment",
Self::OverseasRegion => "overseasRegion",
Self::OverseasTerritorialCollectivity => "overseasTerritorialCollectivity",
Self::Parish => "parish",
Self::Province => "province",
Self::Quarter => "quarter",
Self::Region => "region",
Self::Republic => "republic",
Self::RepublicanCity => "republicanCity",
Self::SelfGovernedPart => "selfGovernedPart",
Self::SpecialMunicipality => "specialMunicipality",
Self::State => "state",
Self::TerritorialUnit => "territorialUnit",
Self::Territory => "territory",
Self::TwoTierCounty => "twoTierCounty",
Self::UnitaryAuthority => "unitaryAuthority",
Self::Ward => "ward",
Self::Other => "other",
Self::Extended(v) => v,
}
}
}
impl Enumeration for SubdivisionTypeEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"administrativeAtoll" => Some(Self::AdministrativeAtoll),
"administrativeRegion" => Some(Self::AdministrativeRegion),
"administrativeTerritory" => Some(Self::AdministrativeTerritory),
"arcticRegion" => Some(Self::ArcticRegion),
"autonomousCity" => Some(Self::AutonomousCity),
"autonomousCityInNorthAfrica" => Some(Self::AutonomousCityInNorthAfrica),
"autonomousCommunity" => Some(Self::AutonomousCommunity),
"autonomousDistrict" => Some(Self::AutonomousDistrict),
"autonomousProvince" => Some(Self::AutonomousProvince),
"autonomousRegion" => Some(Self::AutonomousRegion),
"canton" => Some(Self::Canton),
"capitalCity" => Some(Self::CapitalCity),
"city" => Some(Self::City),
"cityMunicipality" => Some(Self::CityMunicipality),
"cityOfCountyRight" => Some(Self::CityOfCountyRight),
"commune" => Some(Self::Commune),
"councilArea" => Some(Self::CouncilArea),
"county" => Some(Self::County),
"country" => Some(Self::Country),
"department" => Some(Self::Department),
"dependency" => Some(Self::Dependency),
"district" => Some(Self::District),
"districtMunicipality" => Some(Self::DistrictMunicipality),
"districtWithSpecialStatus" => Some(Self::DistrictWithSpecialStatus),
"entity" => Some(Self::Entity),
"geographicalEntity" => Some(Self::GeographicalEntity),
"governorate" => Some(Self::Governorate),
"laender" => Some(Self::Laender),
"localCouncil" => Some(Self::LocalCouncil),
"londonBorough" => Some(Self::LondonBorough),
"metropolitanArea" => Some(Self::MetropolitanArea),
"metropolitanDepartment" => Some(Self::MetropolitanDepartment),
"metropolitanDistrict" => Some(Self::MetropolitanDistrict),
"metropolitanRegion" => Some(Self::MetropolitanRegion),
"municipality" => Some(Self::Municipality),
"overseasDepartment" => Some(Self::OverseasDepartment),
"overseasRegion" => Some(Self::OverseasRegion),
"overseasTerritorialCollectivity" => Some(Self::OverseasTerritorialCollectivity),
"parish" => Some(Self::Parish),
"province" => Some(Self::Province),
"quarter" => Some(Self::Quarter),
"region" => Some(Self::Region),
"republic" => Some(Self::Republic),
"republicanCity" => Some(Self::RepublicanCity),
"selfGovernedPart" => Some(Self::SelfGovernedPart),
"specialMunicipality" => Some(Self::SpecialMunicipality),
"state" => Some(Self::State),
"territorialUnit" => Some(Self::TerritorialUnit),
"territory" => Some(Self::Territory),
"twoTierCounty" => Some(Self::TwoTierCounty),
"unitaryAuthority" => Some(Self::UnitaryAuthority),
"ward" => Some(Self::Ward),
"other" => Some(Self::Other),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl SubdivisionTypeEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML enumeration `loc:TpegLoc01AreaLocationSubtypeEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum TpegLoc01AreaLocationSubtypeEnum {
/// `largeArea`
LargeArea,
/// `other`
Other,
/// A value outside the standard list.
Extended(String),
}
impl TpegLoc01AreaLocationSubtypeEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::LargeArea => "largeArea",
Self::Other => "other",
Self::Extended(v) => v,
}
}
}
impl Enumeration for TpegLoc01AreaLocationSubtypeEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"largeArea" => Some(Self::LargeArea),
"other" => Some(Self::Other),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl TpegLoc01AreaLocationSubtypeEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML enumeration `loc:TpegLoc01FramedPointLocationSubtypeEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum TpegLoc01FramedPointLocationSubtypeEnum {
/// `framedPoint`
FramedPoint,
/// A value outside the standard list.
Extended(String),
}
impl TpegLoc01FramedPointLocationSubtypeEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::FramedPoint => "framedPoint",
Self::Extended(v) => v,
}
}
}
impl Enumeration for TpegLoc01FramedPointLocationSubtypeEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"framedPoint" => Some(Self::FramedPoint),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl TpegLoc01FramedPointLocationSubtypeEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML enumeration `loc:TpegLoc01LinearLocationSubtypeEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum TpegLoc01LinearLocationSubtypeEnum {
/// `segment`
Segment,
/// A value outside the standard list.
Extended(String),
}
impl TpegLoc01LinearLocationSubtypeEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::Segment => "segment",
Self::Extended(v) => v,
}
}
}
impl Enumeration for TpegLoc01LinearLocationSubtypeEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"segment" => Some(Self::Segment),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl TpegLoc01LinearLocationSubtypeEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML enumeration `loc:TpegLoc01SimplePointLocationSubtypeEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum TpegLoc01SimplePointLocationSubtypeEnum {
/// `intersection`
Intersection,
/// `nonLinkedPoint`
NonLinkedPoint,
/// A value outside the standard list.
Extended(String),
}
impl TpegLoc01SimplePointLocationSubtypeEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::Intersection => "intersection",
Self::NonLinkedPoint => "nonLinkedPoint",
Self::Extended(v) => v,
}
}
}
impl Enumeration for TpegLoc01SimplePointLocationSubtypeEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"intersection" => Some(Self::Intersection),
"nonLinkedPoint" => Some(Self::NonLinkedPoint),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl TpegLoc01SimplePointLocationSubtypeEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML enumeration `loc:TpegLoc03AreaDescriptorSubtypeEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum TpegLoc03AreaDescriptorSubtypeEnum {
/// `administrativeAreaName`
AdministrativeAreaName,
/// `administrativeReferenceName`
AdministrativeReferenceName,
/// `areaName`
AreaName,
/// `countyName`
CountyName,
/// `lakeName`
LakeName,
/// `nationName`
NationName,
/// `policeForceControlAreaName`
PoliceForceControlAreaName,
/// `regionName`
RegionName,
/// `seaName`
SeaName,
/// `townName`
TownName,
/// `other`
Other,
/// A value outside the standard list.
Extended(String),
}
impl TpegLoc03AreaDescriptorSubtypeEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::AdministrativeAreaName => "administrativeAreaName",
Self::AdministrativeReferenceName => "administrativeReferenceName",
Self::AreaName => "areaName",
Self::CountyName => "countyName",
Self::LakeName => "lakeName",
Self::NationName => "nationName",
Self::PoliceForceControlAreaName => "policeForceControlAreaName",
Self::RegionName => "regionName",
Self::SeaName => "seaName",
Self::TownName => "townName",
Self::Other => "other",
Self::Extended(v) => v,
}
}
}
impl Enumeration for TpegLoc03AreaDescriptorSubtypeEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"administrativeAreaName" => Some(Self::AdministrativeAreaName),
"administrativeReferenceName" => Some(Self::AdministrativeReferenceName),
"areaName" => Some(Self::AreaName),
"countyName" => Some(Self::CountyName),
"lakeName" => Some(Self::LakeName),
"nationName" => Some(Self::NationName),
"policeForceControlAreaName" => Some(Self::PoliceForceControlAreaName),
"regionName" => Some(Self::RegionName),
"seaName" => Some(Self::SeaName),
"townName" => Some(Self::TownName),
"other" => Some(Self::Other),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl TpegLoc03AreaDescriptorSubtypeEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML enumeration `loc:TpegLoc03IlcPointDescriptorSubtypeEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum TpegLoc03IlcPointDescriptorSubtypeEnum {
/// `tpegIlcName1`
TpegIlcName1,
/// `tpegIlcName2`
TpegIlcName2,
/// `tpegIlcName3`
TpegIlcName3,
/// A value outside the standard list.
Extended(String),
}
impl TpegLoc03IlcPointDescriptorSubtypeEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::TpegIlcName1 => "tpegIlcName1",
Self::TpegIlcName2 => "tpegIlcName2",
Self::TpegIlcName3 => "tpegIlcName3",
Self::Extended(v) => v,
}
}
}
impl Enumeration for TpegLoc03IlcPointDescriptorSubtypeEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"tpegIlcName1" => Some(Self::TpegIlcName1),
"tpegIlcName2" => Some(Self::TpegIlcName2),
"tpegIlcName3" => Some(Self::TpegIlcName3),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl TpegLoc03IlcPointDescriptorSubtypeEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML enumeration `loc:TpegLoc03JunctionPointDescriptorSubtypeEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum TpegLoc03JunctionPointDescriptorSubtypeEnum {
/// `junctionName`
JunctionName,
/// A value outside the standard list.
Extended(String),
}
impl TpegLoc03JunctionPointDescriptorSubtypeEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::JunctionName => "junctionName",
Self::Extended(v) => v,
}
}
}
impl Enumeration for TpegLoc03JunctionPointDescriptorSubtypeEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"junctionName" => Some(Self::JunctionName),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl TpegLoc03JunctionPointDescriptorSubtypeEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML enumeration `loc:TpegLoc03OtherPointDescriptorSubtypeEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum TpegLoc03OtherPointDescriptorSubtypeEnum {
/// `administrativeAreaName`
AdministrativeAreaName,
/// `administrativeReferenceName`
AdministrativeReferenceName,
/// `airportName`
AirportName,
/// `areaName`
AreaName,
/// `buildingName`
BuildingName,
/// `busStopIdentifier`
BusStopIdentifier,
/// `busStopName`
BusStopName,
/// `canalName`
CanalName,
/// `countyName`
CountyName,
/// `ferryPortName`
FerryPortName,
/// `intersectionName`
IntersectionName,
/// `lakeName`
LakeName,
/// `linkName`
LinkName,
/// `localLinkName`
LocalLinkName,
/// `metroStationName`
MetroStationName,
/// `nationName`
NationName,
/// `nonLinkedPointName`
NonLinkedPointName,
/// `parkingFacilityName`
ParkingFacilityName,
/// `pointName`
PointName,
/// `pointOfInterestName`
PointOfInterestName,
/// `railwayStation`
RailwayStation,
/// `regionName`
RegionName,
/// `riverName`
RiverName,
/// `seaName`
SeaName,
/// `serviceAreaName`
ServiceAreaName,
/// `tidalRiverName`
TidalRiverName,
/// `townName`
TownName,
/// `other`
Other,
/// A value outside the standard list.
Extended(String),
}
impl TpegLoc03OtherPointDescriptorSubtypeEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::AdministrativeAreaName => "administrativeAreaName",
Self::AdministrativeReferenceName => "administrativeReferenceName",
Self::AirportName => "airportName",
Self::AreaName => "areaName",
Self::BuildingName => "buildingName",
Self::BusStopIdentifier => "busStopIdentifier",
Self::BusStopName => "busStopName",
Self::CanalName => "canalName",
Self::CountyName => "countyName",
Self::FerryPortName => "ferryPortName",
Self::IntersectionName => "intersectionName",
Self::LakeName => "lakeName",
Self::LinkName => "linkName",
Self::LocalLinkName => "localLinkName",
Self::MetroStationName => "metroStationName",
Self::NationName => "nationName",
Self::NonLinkedPointName => "nonLinkedPointName",
Self::ParkingFacilityName => "parkingFacilityName",
Self::PointName => "pointName",
Self::PointOfInterestName => "pointOfInterestName",
Self::RailwayStation => "railwayStation",
Self::RegionName => "regionName",
Self::RiverName => "riverName",
Self::SeaName => "seaName",
Self::ServiceAreaName => "serviceAreaName",
Self::TidalRiverName => "tidalRiverName",
Self::TownName => "townName",
Self::Other => "other",
Self::Extended(v) => v,
}
}
}
impl Enumeration for TpegLoc03OtherPointDescriptorSubtypeEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"administrativeAreaName" => Some(Self::AdministrativeAreaName),
"administrativeReferenceName" => Some(Self::AdministrativeReferenceName),
"airportName" => Some(Self::AirportName),
"areaName" => Some(Self::AreaName),
"buildingName" => Some(Self::BuildingName),
"busStopIdentifier" => Some(Self::BusStopIdentifier),
"busStopName" => Some(Self::BusStopName),
"canalName" => Some(Self::CanalName),
"countyName" => Some(Self::CountyName),
"ferryPortName" => Some(Self::FerryPortName),
"intersectionName" => Some(Self::IntersectionName),
"lakeName" => Some(Self::LakeName),
"linkName" => Some(Self::LinkName),
"localLinkName" => Some(Self::LocalLinkName),
"metroStationName" => Some(Self::MetroStationName),
"nationName" => Some(Self::NationName),
"nonLinkedPointName" => Some(Self::NonLinkedPointName),
"parkingFacilityName" => Some(Self::ParkingFacilityName),
"pointName" => Some(Self::PointName),
"pointOfInterestName" => Some(Self::PointOfInterestName),
"railwayStation" => Some(Self::RailwayStation),
"regionName" => Some(Self::RegionName),
"riverName" => Some(Self::RiverName),
"seaName" => Some(Self::SeaName),
"serviceAreaName" => Some(Self::ServiceAreaName),
"tidalRiverName" => Some(Self::TidalRiverName),
"townName" => Some(Self::TownName),
"other" => Some(Self::Other),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl TpegLoc03OtherPointDescriptorSubtypeEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML enumeration `loc:TpegLoc04HeightTypeEnum`.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum TpegLoc04HeightTypeEnum {
/// `above`
Above,
/// `aboveSeaLevel`
AboveSeaLevel,
/// `aboveStreetLevel`
AboveStreetLevel,
/// `at`
At,
/// `atSeaLevel`
AtSeaLevel,
/// `atStreetLevel`
AtStreetLevel,
/// `below`
Below,
/// `belowSeaLevel`
BelowSeaLevel,
/// `belowStreetLevel`
BelowStreetLevel,
/// `undefined`
Undefined,
/// `unknown`
Unknown,
/// `other`
Other,
/// A value outside the standard list.
Extended(String),
}
impl TpegLoc04HeightTypeEnum {
/// The value as written in a document.
pub fn as_str(&self) -> &str {
match self {
Self::Above => "above",
Self::AboveSeaLevel => "aboveSeaLevel",
Self::AboveStreetLevel => "aboveStreetLevel",
Self::At => "at",
Self::AtSeaLevel => "atSeaLevel",
Self::AtStreetLevel => "atStreetLevel",
Self::Below => "below",
Self::BelowSeaLevel => "belowSeaLevel",
Self::BelowStreetLevel => "belowStreetLevel",
Self::Undefined => "undefined",
Self::Unknown => "unknown",
Self::Other => "other",
Self::Extended(v) => v,
}
}
}
impl Enumeration for TpegLoc04HeightTypeEnum {
fn from_literal(literal: &str) -> Option<Self> {
match literal {
"above" => Some(Self::Above),
"aboveSeaLevel" => Some(Self::AboveSeaLevel),
"aboveStreetLevel" => Some(Self::AboveStreetLevel),
"at" => Some(Self::At),
"atSeaLevel" => Some(Self::AtSeaLevel),
"atStreetLevel" => Some(Self::AtStreetLevel),
"below" => Some(Self::Below),
"belowSeaLevel" => Some(Self::BelowSeaLevel),
"belowStreetLevel" => Some(Self::BelowStreetLevel),
"undefined" => Some(Self::Undefined),
"unknown" => Some(Self::Unknown),
"other" => Some(Self::Other),
_ => None,
}
}
fn extended(value: String) -> Self {
Self::Extended(value)
}
}
impl TpegLoc04HeightTypeEnum {
/// The literal to write and, for a value outside the standard list, that value.
#[allow(unreachable_patterns)]
pub(crate) fn literal(&self) -> (&str, Option<&str>) {
match self {
Self::Extended(v) => ("_extended", Some(v)),
other => (other.as_str(), None),
}
}
}
/// XML type `loc:AlertCArea`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct AlertCArea {
/// XML element `loc:alertCLocationCountryCode`.
pub alert_c_location_country_code: Option<String>,
/// XML element `loc:alertCLocationTableNumber`.
pub alert_c_location_table_number: Option<String>,
/// XML element `loc:alertCLocationTableVersion`.
pub alert_c_location_table_version: Option<String>,
/// XML element `loc:areaLocation`.
pub area_location: Option<Box<AlertCLocation>>,
/// XML element `loc:_alertCAreaExtension`.
pub alert_c_area_extension: Option<Box<Extension>>,
}
impl AlertCArea {
const FIELDS: &'static [u32] = &[0xe06cd, 0xe06cf, 0xe06d0, 0xe06f5, 0xe0423];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe001c);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
let mut e4 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe06cd => { let v = r.string()?; r.set(&mut e0, v, 1741); }
0xe06cf => { let v = r.string()?; r.set(&mut e1, v, 1743); }
0xe06d0 => { let v = r.string()?; r.set(&mut e2, v, 1744); }
0xe06f5 => { let v = Some(AlertCLocation::read(r)?); r.set(&mut e3, v.map(Box::new), 1781); }
0xe0423 => { let v = r.raw()?; r.set(&mut e4, v.map(Box::new), 1059); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 1741);
r.required(&e1, 1743);
r.required(&e2, 1744);
r.required(&e3, 1781);
let v = Self {
alert_c_location_country_code: e0,
alert_c_location_table_number: e1,
alert_c_location_table_version: e2,
area_location: e3,
alert_c_area_extension: e4,
};
r.close();
Ok(v)
}
}
impl AlertCArea {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
match &self.alert_c_location_country_code {
Some(v) => { w.max_len("alertCLocationCountryCode", "String", v, 1024)?; w.leaf("loc:alertCLocationCountryCode", v)?; }
None => return Err(w.missing("loc:alertCLocationCountryCode")),
}
match &self.alert_c_location_table_number {
Some(v) => { w.max_len("alertCLocationTableNumber", "String", v, 1024)?; w.leaf("loc:alertCLocationTableNumber", v)?; }
None => return Err(w.missing("loc:alertCLocationTableNumber")),
}
match &self.alert_c_location_table_version {
Some(v) => { w.max_len("alertCLocationTableVersion", "String", v, 1024)?; w.leaf("loc:alertCLocationTableVersion", v)?; }
None => return Err(w.missing("loc:alertCLocationTableVersion")),
}
match &self.area_location {
Some(v) => { v.write(w, "loc:areaLocation", "", "")?; }
None => return Err(w.missing("loc:areaLocation")),
}
if let Some(v) = &self.alert_c_area_extension { w.extension("loc:_alertCAreaExtension", v)?; }
w.end(tag)
}
}
impl AlertCArea {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 5];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
216 => if r.first(&mut seen[0])? { f0 = r.string()?; },
218 => if r.first(&mut seen[1])? { f1 = r.string()?; },
219 => if r.first(&mut seen[2])? { f2 = r.string()?; },
256 => if r.first(&mut seen[3])? { f3 = AlertCLocation::read_json(r)?.map(Box::new); },
1076 => if r.first(&mut seen[4])? { f4 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 216);
r.required(&f1, 218);
r.required(&f2, 219);
r.required(&f3, 256);
Ok(Self {
alert_c_location_country_code: f0,
alert_c_location_table_number: f1,
alert_c_location_table_version: f2,
area_location: f3,
alert_c_area_extension: f4,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(480)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.alert_c_location_country_code {
Some(v) => {
w.key(216)?;
w.max_len("alertCLocationCountryCode", "String", v, 1024)?; w.string(v)?;
}
None => w.absent(216, w.missing("alertCLocationCountryCode"))?,
}
match &self.alert_c_location_table_number {
Some(v) => {
w.key(218)?;
w.max_len("alertCLocationTableNumber", "String", v, 1024)?; w.string(v)?;
}
None => w.absent(218, w.missing("alertCLocationTableNumber"))?,
}
match &self.alert_c_location_table_version {
Some(v) => {
w.key(219)?;
w.max_len("alertCLocationTableVersion", "String", v, 1024)?; w.string(v)?;
}
None => w.absent(219, w.missing("alertCLocationTableVersion"))?,
}
match &self.area_location {
Some(v) => {
w.key(256)?;
v.write_json(w, None)?;
}
None => w.absent(256, w.missing("areaLocation"))?,
}
if let Some(v) = &self.alert_c_area_extension {
w.key(1076)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:AlertCDirection`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct AlertCDirection {
/// XML element `loc:alertCDirectionCoded`.
pub alert_c_direction_coded: Option<AlertCDirectionEnum>,
/// XML element `loc:alertCDirectionNamed`.
pub alert_c_direction_named: Option<MultilingualString>,
/// XML element `loc:alertCAffectedDirection`.
pub alert_c_affected_direction: Option<LinearDirectionEnum>,
/// XML element `loc:_alertCDirectionExtension`.
pub alert_c_direction_extension: Option<Box<Extension>>,
}
impl AlertCDirection {
const FIELDS: &'static [u32] = &[0xe06c9, 0xe06ca, 0xe06c6, 0xe0424];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe001d);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe06c9 => { let v = r.enumeration::<AlertCDirectionEnum>()?; r.set(&mut e0, v, 1737); }
0xe06ca => { let v = r.multilingual()?; r.set(&mut e1, v, 1738); }
0xe06c6 => { let v = r.enumeration::<LinearDirectionEnum>()?; r.set(&mut e2, v, 1734); }
0xe0424 => { let v = r.raw()?; r.set(&mut e3, v.map(Box::new), 1060); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 1737);
r.required(&e2, 1734);
let v = Self {
alert_c_direction_coded: e0,
alert_c_direction_named: e1,
alert_c_affected_direction: e2,
alert_c_direction_extension: e3,
};
r.close();
Ok(v)
}
}
impl AlertCDirection {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
match &self.alert_c_direction_coded {
Some(v) => { w.enumeration("loc:alertCDirectionCoded", v.literal())?; }
None => return Err(w.missing("loc:alertCDirectionCoded")),
}
if let Some(v) = &self.alert_c_direction_named { w.multilingual("loc:alertCDirectionNamed", v)?; }
match &self.alert_c_affected_direction {
Some(v) => { w.enumeration("loc:alertCAffectedDirection", v.literal())?; }
None => return Err(w.missing("loc:alertCAffectedDirection")),
}
if let Some(v) = &self.alert_c_direction_extension { w.extension("loc:_alertCDirectionExtension", v)?; }
w.end(tag)
}
}
impl AlertCDirection {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 4];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
212 => if r.first(&mut seen[0])? { f0 = r.enumeration::<AlertCDirectionEnum>()?; },
213 => if r.first(&mut seen[1])? { f1 = r.multilingual()?; },
209 => if r.first(&mut seen[2])? { f2 = r.enumeration::<LinearDirectionEnum>()?; },
1077 => if r.first(&mut seen[3])? { f3 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 212);
r.required(&f2, 209);
Ok(Self {
alert_c_direction_coded: f0,
alert_c_direction_named: f1,
alert_c_affected_direction: f2,
alert_c_direction_extension: f3,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(481)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.alert_c_direction_coded {
Some(v) => {
w.key(212)?;
w.enumeration(482, v.literal())?;
}
None => w.absent(212, w.missing("alertCDirectionCoded"))?,
}
if let Some(v) = &self.alert_c_direction_named {
w.key(213)?;
w.multilingual(v)?;
}
match &self.alert_c_affected_direction {
Some(v) => {
w.key(209)?;
w.enumeration(525, v.literal())?;
}
None => w.absent(209, w.missing("alertCAffectedDirection"))?,
}
if let Some(v) = &self.alert_c_direction_extension {
w.key(1077)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:AlertCLinearByCode`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct AlertCLinearByCode {
/// XML element `loc:alertCLocationCountryCode`.
pub alert_c_location_country_code: Option<String>,
/// XML element `loc:alertCLocationTableNumber`.
pub alert_c_location_table_number: Option<String>,
/// XML element `loc:alertCLocationTableVersion`.
pub alert_c_location_table_version: Option<String>,
/// XML element `loc:_alertCLinearExtension`.
pub alert_c_linear_extension: Option<Box<Extension>>,
/// XML element `loc:alertCDirection`.
pub alert_c_direction: Option<Box<AlertCDirection>>,
/// XML element `loc:locationCodeForLinearLocation`.
pub location_code_for_linear_location: Option<Box<AlertCLocation>>,
/// XML element `loc:_alertCLinearByCodeExtension`.
pub alert_c_linear_by_code_extension: Option<Box<Extension>>,
}
impl AlertCLinearByCode {
const FIELDS: &'static [u32] = &[0xe06cd, 0xe06cf, 0xe06d0, 0xe0426, 0xe06c8, 0xe091c, 0xe0425];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe001f);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
let mut e4 = None;
let mut e5 = None;
let mut e6 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe06cd => { let v = r.string()?; r.set(&mut e0, v, 1741); }
0xe06cf => { let v = r.string()?; r.set(&mut e1, v, 1743); }
0xe06d0 => { let v = r.string()?; r.set(&mut e2, v, 1744); }
0xe0426 => { let v = r.raw()?; r.set(&mut e3, v.map(Box::new), 1062); }
0xe06c8 => { let v = Some(AlertCDirection::read(r)?); r.set(&mut e4, v.map(Box::new), 1736); }
0xe091c => { let v = Some(AlertCLocation::read(r)?); r.set(&mut e5, v.map(Box::new), 2332); }
0xe0425 => { let v = r.raw()?; r.set(&mut e6, v.map(Box::new), 1061); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 1741);
r.required(&e1, 1743);
r.required(&e2, 1744);
r.required(&e4, 1736);
r.required(&e5, 2332);
let v = Self {
alert_c_location_country_code: e0,
alert_c_location_table_number: e1,
alert_c_location_table_version: e2,
alert_c_linear_extension: e3,
alert_c_direction: e4,
location_code_for_linear_location: e5,
alert_c_linear_by_code_extension: e6,
};
r.close();
Ok(v)
}
}
impl AlertCLinearByCode {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
match &self.alert_c_location_country_code {
Some(v) => { w.max_len("alertCLocationCountryCode", "String", v, 1024)?; w.leaf("loc:alertCLocationCountryCode", v)?; }
None => return Err(w.missing("loc:alertCLocationCountryCode")),
}
match &self.alert_c_location_table_number {
Some(v) => { w.max_len("alertCLocationTableNumber", "String", v, 1024)?; w.leaf("loc:alertCLocationTableNumber", v)?; }
None => return Err(w.missing("loc:alertCLocationTableNumber")),
}
match &self.alert_c_location_table_version {
Some(v) => { w.max_len("alertCLocationTableVersion", "String", v, 1024)?; w.leaf("loc:alertCLocationTableVersion", v)?; }
None => return Err(w.missing("loc:alertCLocationTableVersion")),
}
if let Some(v) = &self.alert_c_linear_extension { w.extension("loc:_alertCLinearExtension", v)?; }
match &self.alert_c_direction {
Some(v) => { v.write(w, "loc:alertCDirection", "", "")?; }
None => return Err(w.missing("loc:alertCDirection")),
}
match &self.location_code_for_linear_location {
Some(v) => { v.write(w, "loc:locationCodeForLinearLocation", "", "")?; }
None => return Err(w.missing("loc:locationCodeForLinearLocation")),
}
if let Some(v) = &self.alert_c_linear_by_code_extension { w.extension("loc:_alertCLinearByCodeExtension", v)?; }
w.end(tag)
}
}
impl AlertCLinearByCode {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 7];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
let mut f5 = None;
let mut f6 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
216 => if r.first(&mut seen[0])? { f0 = r.string()?; },
218 => if r.first(&mut seen[1])? { f1 = r.string()?; },
219 => if r.first(&mut seen[2])? { f2 = r.string()?; },
1080 => if r.first(&mut seen[3])? { f3 = r.raw_object()?.map(Box::new); },
211 => if r.first(&mut seen[4])? { f4 = AlertCDirection::read_json(r)?.map(Box::new); },
1230 => if r.first(&mut seen[5])? { f5 = AlertCLocation::read_json(r)?.map(Box::new); },
1079 => if r.first(&mut seen[6])? { f6 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 216);
r.required(&f1, 218);
r.required(&f2, 219);
r.required(&f4, 211);
r.required(&f5, 1230);
Ok(Self {
alert_c_location_country_code: f0,
alert_c_location_table_number: f1,
alert_c_location_table_version: f2,
alert_c_linear_extension: f3,
alert_c_direction: f4,
location_code_for_linear_location: f5,
alert_c_linear_by_code_extension: f6,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(483)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.alert_c_location_country_code {
Some(v) => {
w.key(216)?;
w.max_len("alertCLocationCountryCode", "String", v, 1024)?; w.string(v)?;
}
None => w.absent(216, w.missing("alertCLocationCountryCode"))?,
}
match &self.alert_c_location_table_number {
Some(v) => {
w.key(218)?;
w.max_len("alertCLocationTableNumber", "String", v, 1024)?; w.string(v)?;
}
None => w.absent(218, w.missing("alertCLocationTableNumber"))?,
}
match &self.alert_c_location_table_version {
Some(v) => {
w.key(219)?;
w.max_len("alertCLocationTableVersion", "String", v, 1024)?; w.string(v)?;
}
None => w.absent(219, w.missing("alertCLocationTableVersion"))?,
}
if let Some(v) = &self.alert_c_linear_extension {
w.key(1080)?;
w.extension(v)?;
}
match &self.alert_c_direction {
Some(v) => {
w.key(211)?;
v.write_json(w, None)?;
}
None => w.absent(211, w.missing("alertCDirection"))?,
}
match &self.location_code_for_linear_location {
Some(v) => {
w.key(1230)?;
v.write_json(w, None)?;
}
None => w.absent(1230, w.missing("locationCodeForLinearLocation"))?,
}
if let Some(v) = &self.alert_c_linear_by_code_extension {
w.key(1079)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:AlertCLocation`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct AlertCLocation {
/// XML element `loc:alertCLocationName`.
pub alert_c_location_name: Option<MultilingualString>,
/// XML element `loc:specificLocation`.
pub specific_location: Option<AlertCLocationCode>,
/// XML element `loc:_alertCLocationExtension`.
pub alert_c_location_extension: Option<Box<Extension>>,
}
impl AlertCLocation {
const FIELDS: &'static [u32] = &[0xe06ce, 0xe0bb9, 0xe0427];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe0020);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe06ce => { let v = r.multilingual()?; r.set(&mut e0, v, 1742); }
0xe0bb9 => { let v = r.value::<u64>()?; r.set(&mut e1, v, 3001); }
0xe0427 => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1063); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e1, 3001);
let v = Self {
alert_c_location_name: e0,
specific_location: e1,
alert_c_location_extension: e2,
};
r.close();
Ok(v)
}
}
impl AlertCLocation {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.alert_c_location_name { w.multilingual("loc:alertCLocationName", v)?; }
match &self.specific_location {
Some(v) => { w.range("specificLocation", "AlertCLocationCode", *v, 1, 63487)?; w.leaf("loc:specificLocation", v)?; }
None => return Err(w.missing("loc:specificLocation")),
}
if let Some(v) = &self.alert_c_location_extension { w.extension("loc:_alertCLocationExtension", v)?; }
w.end(tag)
}
}
impl AlertCLocation {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 3];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
217 => if r.first(&mut seen[0])? { f0 = r.multilingual()?; },
2166 => if r.first(&mut seen[1])? { f1 = r.number::<u64>()?; },
1081 => if r.first(&mut seen[2])? { f2 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f1, 2166);
Ok(Self {
alert_c_location_name: f0,
specific_location: f1,
alert_c_location_extension: f2,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(485)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.alert_c_location_name {
w.key(217)?;
w.multilingual(v)?;
}
match &self.specific_location {
Some(v) => {
w.key(2166)?;
w.range("specificLocation", "AlertCLocationCode", *v, 1, 63487)?; w.integer(*v)?;
}
None => w.absent(2166, w.missing("specificLocation"))?,
}
if let Some(v) = &self.alert_c_location_extension {
w.key(1081)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:AlertCMethod2Linear`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct AlertCMethod2Linear {
/// XML element `loc:alertCLocationCountryCode`.
pub alert_c_location_country_code: Option<String>,
/// XML element `loc:alertCLocationTableNumber`.
pub alert_c_location_table_number: Option<String>,
/// XML element `loc:alertCLocationTableVersion`.
pub alert_c_location_table_version: Option<String>,
/// XML element `loc:_alertCLinearExtension`.
pub alert_c_linear_extension: Option<Box<Extension>>,
/// XML element `loc:alertCDirection`.
pub alert_c_direction: Option<Box<AlertCDirection>>,
/// XML element `loc:alertCMethod2PrimaryPointLocation`.
pub alert_c_method2_primary_point_location: Option<Box<AlertCMethod2PrimaryPointLocation>>,
/// XML element `loc:alertCMethod2SecondaryPointLocation`.
pub alert_c_method2_secondary_point_location: Option<Box<AlertCMethod2SecondaryPointLocation>>,
/// XML element `loc:_alertCMethod2LinearExtension`.
pub alert_c_method2_linear_extension: Option<Box<Extension>>,
}
impl AlertCMethod2Linear {
const FIELDS: &'static [u32] = &[0xe06cd, 0xe06cf, 0xe06d0, 0xe0426, 0xe06c8, 0xe06d1, 0xe06d2, 0xe0428];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe0021);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
let mut e4 = None;
let mut e5 = None;
let mut e6 = None;
let mut e7 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe06cd => { let v = r.string()?; r.set(&mut e0, v, 1741); }
0xe06cf => { let v = r.string()?; r.set(&mut e1, v, 1743); }
0xe06d0 => { let v = r.string()?; r.set(&mut e2, v, 1744); }
0xe0426 => { let v = r.raw()?; r.set(&mut e3, v.map(Box::new), 1062); }
0xe06c8 => { let v = Some(AlertCDirection::read(r)?); r.set(&mut e4, v.map(Box::new), 1736); }
0xe06d1 => { let v = Some(AlertCMethod2PrimaryPointLocation::read(r)?); r.set(&mut e5, v.map(Box::new), 1745); }
0xe06d2 => { let v = Some(AlertCMethod2SecondaryPointLocation::read(r)?); r.set(&mut e6, v.map(Box::new), 1746); }
0xe0428 => { let v = r.raw()?; r.set(&mut e7, v.map(Box::new), 1064); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 1741);
r.required(&e1, 1743);
r.required(&e2, 1744);
r.required(&e4, 1736);
r.required(&e5, 1745);
r.required(&e6, 1746);
let v = Self {
alert_c_location_country_code: e0,
alert_c_location_table_number: e1,
alert_c_location_table_version: e2,
alert_c_linear_extension: e3,
alert_c_direction: e4,
alert_c_method2_primary_point_location: e5,
alert_c_method2_secondary_point_location: e6,
alert_c_method2_linear_extension: e7,
};
r.close();
Ok(v)
}
}
impl AlertCMethod2Linear {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
match &self.alert_c_location_country_code {
Some(v) => { w.max_len("alertCLocationCountryCode", "String", v, 1024)?; w.leaf("loc:alertCLocationCountryCode", v)?; }
None => return Err(w.missing("loc:alertCLocationCountryCode")),
}
match &self.alert_c_location_table_number {
Some(v) => { w.max_len("alertCLocationTableNumber", "String", v, 1024)?; w.leaf("loc:alertCLocationTableNumber", v)?; }
None => return Err(w.missing("loc:alertCLocationTableNumber")),
}
match &self.alert_c_location_table_version {
Some(v) => { w.max_len("alertCLocationTableVersion", "String", v, 1024)?; w.leaf("loc:alertCLocationTableVersion", v)?; }
None => return Err(w.missing("loc:alertCLocationTableVersion")),
}
if let Some(v) = &self.alert_c_linear_extension { w.extension("loc:_alertCLinearExtension", v)?; }
match &self.alert_c_direction {
Some(v) => { v.write(w, "loc:alertCDirection", "", "")?; }
None => return Err(w.missing("loc:alertCDirection")),
}
match &self.alert_c_method2_primary_point_location {
Some(v) => { v.write(w, "loc:alertCMethod2PrimaryPointLocation", "", "")?; }
None => return Err(w.missing("loc:alertCMethod2PrimaryPointLocation")),
}
match &self.alert_c_method2_secondary_point_location {
Some(v) => { v.write(w, "loc:alertCMethod2SecondaryPointLocation", "", "")?; }
None => return Err(w.missing("loc:alertCMethod2SecondaryPointLocation")),
}
if let Some(v) = &self.alert_c_method2_linear_extension { w.extension("loc:_alertCMethod2LinearExtension", v)?; }
w.end(tag)
}
}
impl AlertCMethod2Linear {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 8];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
let mut f5 = None;
let mut f6 = None;
let mut f7 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
216 => if r.first(&mut seen[0])? { f0 = r.string()?; },
218 => if r.first(&mut seen[1])? { f1 = r.string()?; },
219 => if r.first(&mut seen[2])? { f2 = r.string()?; },
1080 => if r.first(&mut seen[3])? { f3 = r.raw_object()?.map(Box::new); },
211 => if r.first(&mut seen[4])? { f4 = AlertCDirection::read_json(r)?.map(Box::new); },
220 => if r.first(&mut seen[5])? { f5 = AlertCMethod2PrimaryPointLocation::read_json(r)?.map(Box::new); },
221 => if r.first(&mut seen[6])? { f6 = AlertCMethod2SecondaryPointLocation::read_json(r)?.map(Box::new); },
1083 => if r.first(&mut seen[7])? { f7 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 216);
r.required(&f1, 218);
r.required(&f2, 219);
r.required(&f4, 211);
r.required(&f5, 220);
r.required(&f6, 221);
Ok(Self {
alert_c_location_country_code: f0,
alert_c_location_table_number: f1,
alert_c_location_table_version: f2,
alert_c_linear_extension: f3,
alert_c_direction: f4,
alert_c_method2_primary_point_location: f5,
alert_c_method2_secondary_point_location: f6,
alert_c_method2_linear_extension: f7,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(486)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.alert_c_location_country_code {
Some(v) => {
w.key(216)?;
w.max_len("alertCLocationCountryCode", "String", v, 1024)?; w.string(v)?;
}
None => w.absent(216, w.missing("alertCLocationCountryCode"))?,
}
match &self.alert_c_location_table_number {
Some(v) => {
w.key(218)?;
w.max_len("alertCLocationTableNumber", "String", v, 1024)?; w.string(v)?;
}
None => w.absent(218, w.missing("alertCLocationTableNumber"))?,
}
match &self.alert_c_location_table_version {
Some(v) => {
w.key(219)?;
w.max_len("alertCLocationTableVersion", "String", v, 1024)?; w.string(v)?;
}
None => w.absent(219, w.missing("alertCLocationTableVersion"))?,
}
if let Some(v) = &self.alert_c_linear_extension {
w.key(1080)?;
w.extension(v)?;
}
match &self.alert_c_direction {
Some(v) => {
w.key(211)?;
v.write_json(w, None)?;
}
None => w.absent(211, w.missing("alertCDirection"))?,
}
match &self.alert_c_method2_primary_point_location {
Some(v) => {
w.key(220)?;
v.write_json(w, None)?;
}
None => w.absent(220, w.missing("alertCMethod2PrimaryPointLocation"))?,
}
match &self.alert_c_method2_secondary_point_location {
Some(v) => {
w.key(221)?;
v.write_json(w, None)?;
}
None => w.absent(221, w.missing("alertCMethod2SecondaryPointLocation"))?,
}
if let Some(v) = &self.alert_c_method2_linear_extension {
w.key(1083)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:AlertCMethod2Point`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct AlertCMethod2Point {
/// XML element `loc:alertCLocationCountryCode`.
pub alert_c_location_country_code: Option<String>,
/// XML element `loc:alertCLocationTableNumber`.
pub alert_c_location_table_number: Option<String>,
/// XML element `loc:alertCLocationTableVersion`.
pub alert_c_location_table_version: Option<String>,
/// XML element `loc:_alertCPointExtension`.
pub alert_c_point_extension: Option<Box<Extension>>,
/// XML element `loc:alertCDirection`.
pub alert_c_direction: Option<Box<AlertCDirection>>,
/// XML element `loc:alertCMethod2PrimaryPointLocation`.
pub alert_c_method2_primary_point_location: Option<Box<AlertCMethod2PrimaryPointLocation>>,
/// XML element `loc:_alertCMethod2PointExtension`.
pub alert_c_method2_point_extension: Option<Box<Extension>>,
}
impl AlertCMethod2Point {
const FIELDS: &'static [u32] = &[0xe06cd, 0xe06cf, 0xe06d0, 0xe0430, 0xe06c8, 0xe06d1, 0xe0429];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe0022);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
let mut e4 = None;
let mut e5 = None;
let mut e6 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe06cd => { let v = r.string()?; r.set(&mut e0, v, 1741); }
0xe06cf => { let v = r.string()?; r.set(&mut e1, v, 1743); }
0xe06d0 => { let v = r.string()?; r.set(&mut e2, v, 1744); }
0xe0430 => { let v = r.raw()?; r.set(&mut e3, v.map(Box::new), 1072); }
0xe06c8 => { let v = Some(AlertCDirection::read(r)?); r.set(&mut e4, v.map(Box::new), 1736); }
0xe06d1 => { let v = Some(AlertCMethod2PrimaryPointLocation::read(r)?); r.set(&mut e5, v.map(Box::new), 1745); }
0xe0429 => { let v = r.raw()?; r.set(&mut e6, v.map(Box::new), 1065); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 1741);
r.required(&e1, 1743);
r.required(&e2, 1744);
r.required(&e4, 1736);
r.required(&e5, 1745);
let v = Self {
alert_c_location_country_code: e0,
alert_c_location_table_number: e1,
alert_c_location_table_version: e2,
alert_c_point_extension: e3,
alert_c_direction: e4,
alert_c_method2_primary_point_location: e5,
alert_c_method2_point_extension: e6,
};
r.close();
Ok(v)
}
}
impl AlertCMethod2Point {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
match &self.alert_c_location_country_code {
Some(v) => { w.max_len("alertCLocationCountryCode", "String", v, 1024)?; w.leaf("loc:alertCLocationCountryCode", v)?; }
None => return Err(w.missing("loc:alertCLocationCountryCode")),
}
match &self.alert_c_location_table_number {
Some(v) => { w.max_len("alertCLocationTableNumber", "String", v, 1024)?; w.leaf("loc:alertCLocationTableNumber", v)?; }
None => return Err(w.missing("loc:alertCLocationTableNumber")),
}
match &self.alert_c_location_table_version {
Some(v) => { w.max_len("alertCLocationTableVersion", "String", v, 1024)?; w.leaf("loc:alertCLocationTableVersion", v)?; }
None => return Err(w.missing("loc:alertCLocationTableVersion")),
}
if let Some(v) = &self.alert_c_point_extension { w.extension("loc:_alertCPointExtension", v)?; }
match &self.alert_c_direction {
Some(v) => { v.write(w, "loc:alertCDirection", "", "")?; }
None => return Err(w.missing("loc:alertCDirection")),
}
match &self.alert_c_method2_primary_point_location {
Some(v) => { v.write(w, "loc:alertCMethod2PrimaryPointLocation", "", "")?; }
None => return Err(w.missing("loc:alertCMethod2PrimaryPointLocation")),
}
if let Some(v) = &self.alert_c_method2_point_extension { w.extension("loc:_alertCMethod2PointExtension", v)?; }
w.end(tag)
}
}
impl AlertCMethod2Point {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 7];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
let mut f5 = None;
let mut f6 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
216 => if r.first(&mut seen[0])? { f0 = r.string()?; },
218 => if r.first(&mut seen[1])? { f1 = r.string()?; },
219 => if r.first(&mut seen[2])? { f2 = r.string()?; },
1094 => if r.first(&mut seen[3])? { f3 = r.raw_object()?.map(Box::new); },
211 => if r.first(&mut seen[4])? { f4 = AlertCDirection::read_json(r)?.map(Box::new); },
220 => if r.first(&mut seen[5])? { f5 = AlertCMethod2PrimaryPointLocation::read_json(r)?.map(Box::new); },
1085 => if r.first(&mut seen[6])? { f6 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 216);
r.required(&f1, 218);
r.required(&f2, 219);
r.required(&f4, 211);
r.required(&f5, 220);
Ok(Self {
alert_c_location_country_code: f0,
alert_c_location_table_number: f1,
alert_c_location_table_version: f2,
alert_c_point_extension: f3,
alert_c_direction: f4,
alert_c_method2_primary_point_location: f5,
alert_c_method2_point_extension: f6,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(487)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.alert_c_location_country_code {
Some(v) => {
w.key(216)?;
w.max_len("alertCLocationCountryCode", "String", v, 1024)?; w.string(v)?;
}
None => w.absent(216, w.missing("alertCLocationCountryCode"))?,
}
match &self.alert_c_location_table_number {
Some(v) => {
w.key(218)?;
w.max_len("alertCLocationTableNumber", "String", v, 1024)?; w.string(v)?;
}
None => w.absent(218, w.missing("alertCLocationTableNumber"))?,
}
match &self.alert_c_location_table_version {
Some(v) => {
w.key(219)?;
w.max_len("alertCLocationTableVersion", "String", v, 1024)?; w.string(v)?;
}
None => w.absent(219, w.missing("alertCLocationTableVersion"))?,
}
if let Some(v) = &self.alert_c_point_extension {
w.key(1094)?;
w.extension(v)?;
}
match &self.alert_c_direction {
Some(v) => {
w.key(211)?;
v.write_json(w, None)?;
}
None => w.absent(211, w.missing("alertCDirection"))?,
}
match &self.alert_c_method2_primary_point_location {
Some(v) => {
w.key(220)?;
v.write_json(w, None)?;
}
None => w.absent(220, w.missing("alertCMethod2PrimaryPointLocation"))?,
}
if let Some(v) = &self.alert_c_method2_point_extension {
w.key(1085)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:AlertCMethod2PrimaryPointLocation`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct AlertCMethod2PrimaryPointLocation {
/// XML element `loc:alertCLocation`.
pub alert_c_location: Option<Box<AlertCLocation>>,
/// XML element `loc:_alertCMethod2PrimaryPointLocationExtension`.
pub alert_c_method2_primary_point_location_extension: Option<Box<Extension>>,
}
impl AlertCMethod2PrimaryPointLocation {
const FIELDS: &'static [u32] = &[0xe06cc, 0xe042a];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe0023);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe06cc => { let v = Some(AlertCLocation::read(r)?); r.set(&mut e0, v.map(Box::new), 1740); }
0xe042a => { let v = r.raw()?; r.set(&mut e1, v.map(Box::new), 1066); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 1740);
let v = Self {
alert_c_location: e0,
alert_c_method2_primary_point_location_extension: e1,
};
r.close();
Ok(v)
}
}
impl AlertCMethod2PrimaryPointLocation {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
match &self.alert_c_location {
Some(v) => { v.write(w, "loc:alertCLocation", "", "")?; }
None => return Err(w.missing("loc:alertCLocation")),
}
if let Some(v) = &self.alert_c_method2_primary_point_location_extension { w.extension("loc:_alertCMethod2PrimaryPointLocationExtension", v)?; }
w.end(tag)
}
}
impl AlertCMethod2PrimaryPointLocation {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 2];
let mut f0 = None;
let mut f1 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
215 => if r.first(&mut seen[0])? { f0 = AlertCLocation::read_json(r)?.map(Box::new); },
1086 => if r.first(&mut seen[1])? { f1 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 215);
Ok(Self {
alert_c_location: f0,
alert_c_method2_primary_point_location_extension: f1,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(488)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.alert_c_location {
Some(v) => {
w.key(215)?;
v.write_json(w, None)?;
}
None => w.absent(215, w.missing("alertCLocation"))?,
}
if let Some(v) = &self.alert_c_method2_primary_point_location_extension {
w.key(1086)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:AlertCMethod2SecondaryPointLocation`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct AlertCMethod2SecondaryPointLocation {
/// XML element `loc:alertCLocation`.
pub alert_c_location: Option<Box<AlertCLocation>>,
/// XML element `loc:_alertCMethod2SecondaryPointLocationExtension`.
pub alert_c_method2_secondary_point_location_extension: Option<Box<Extension>>,
}
impl AlertCMethod2SecondaryPointLocation {
const FIELDS: &'static [u32] = &[0xe06cc, 0xe042b];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe0024);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe06cc => { let v = Some(AlertCLocation::read(r)?); r.set(&mut e0, v.map(Box::new), 1740); }
0xe042b => { let v = r.raw()?; r.set(&mut e1, v.map(Box::new), 1067); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 1740);
let v = Self {
alert_c_location: e0,
alert_c_method2_secondary_point_location_extension: e1,
};
r.close();
Ok(v)
}
}
impl AlertCMethod2SecondaryPointLocation {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
match &self.alert_c_location {
Some(v) => { v.write(w, "loc:alertCLocation", "", "")?; }
None => return Err(w.missing("loc:alertCLocation")),
}
if let Some(v) = &self.alert_c_method2_secondary_point_location_extension { w.extension("loc:_alertCMethod2SecondaryPointLocationExtension", v)?; }
w.end(tag)
}
}
impl AlertCMethod2SecondaryPointLocation {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 2];
let mut f0 = None;
let mut f1 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
215 => if r.first(&mut seen[0])? { f0 = AlertCLocation::read_json(r)?.map(Box::new); },
1087 => if r.first(&mut seen[1])? { f1 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 215);
Ok(Self {
alert_c_location: f0,
alert_c_method2_secondary_point_location_extension: f1,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(489)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.alert_c_location {
Some(v) => {
w.key(215)?;
v.write_json(w, None)?;
}
None => w.absent(215, w.missing("alertCLocation"))?,
}
if let Some(v) = &self.alert_c_method2_secondary_point_location_extension {
w.key(1087)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:AlertCMethod4Linear`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct AlertCMethod4Linear {
/// XML element `loc:alertCLocationCountryCode`.
pub alert_c_location_country_code: Option<String>,
/// XML element `loc:alertCLocationTableNumber`.
pub alert_c_location_table_number: Option<String>,
/// XML element `loc:alertCLocationTableVersion`.
pub alert_c_location_table_version: Option<String>,
/// XML element `loc:_alertCLinearExtension`.
pub alert_c_linear_extension: Option<Box<Extension>>,
/// XML element `loc:alertCDirection`.
pub alert_c_direction: Option<Box<AlertCDirection>>,
/// XML element `loc:alertCMethod4PrimaryPointLocation`.
pub alert_c_method4_primary_point_location: Option<Box<AlertCMethod4PrimaryPointLocation>>,
/// XML element `loc:alertCMethod4SecondaryPointLocation`.
pub alert_c_method4_secondary_point_location: Option<Box<AlertCMethod4SecondaryPointLocation>>,
/// XML element `loc:_alertCMethod4LinearExtension`.
pub alert_c_method4_linear_extension: Option<Box<Extension>>,
}
impl AlertCMethod4Linear {
const FIELDS: &'static [u32] = &[0xe06cd, 0xe06cf, 0xe06d0, 0xe0426, 0xe06c8, 0xe06d3, 0xe06d4, 0xe042c];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe0025);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
let mut e4 = None;
let mut e5 = None;
let mut e6 = None;
let mut e7 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe06cd => { let v = r.string()?; r.set(&mut e0, v, 1741); }
0xe06cf => { let v = r.string()?; r.set(&mut e1, v, 1743); }
0xe06d0 => { let v = r.string()?; r.set(&mut e2, v, 1744); }
0xe0426 => { let v = r.raw()?; r.set(&mut e3, v.map(Box::new), 1062); }
0xe06c8 => { let v = Some(AlertCDirection::read(r)?); r.set(&mut e4, v.map(Box::new), 1736); }
0xe06d3 => { let v = Some(AlertCMethod4PrimaryPointLocation::read(r)?); r.set(&mut e5, v.map(Box::new), 1747); }
0xe06d4 => { let v = Some(AlertCMethod4SecondaryPointLocation::read(r)?); r.set(&mut e6, v.map(Box::new), 1748); }
0xe042c => { let v = r.raw()?; r.set(&mut e7, v.map(Box::new), 1068); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 1741);
r.required(&e1, 1743);
r.required(&e2, 1744);
r.required(&e4, 1736);
r.required(&e5, 1747);
r.required(&e6, 1748);
let v = Self {
alert_c_location_country_code: e0,
alert_c_location_table_number: e1,
alert_c_location_table_version: e2,
alert_c_linear_extension: e3,
alert_c_direction: e4,
alert_c_method4_primary_point_location: e5,
alert_c_method4_secondary_point_location: e6,
alert_c_method4_linear_extension: e7,
};
r.close();
Ok(v)
}
}
impl AlertCMethod4Linear {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
match &self.alert_c_location_country_code {
Some(v) => { w.max_len("alertCLocationCountryCode", "String", v, 1024)?; w.leaf("loc:alertCLocationCountryCode", v)?; }
None => return Err(w.missing("loc:alertCLocationCountryCode")),
}
match &self.alert_c_location_table_number {
Some(v) => { w.max_len("alertCLocationTableNumber", "String", v, 1024)?; w.leaf("loc:alertCLocationTableNumber", v)?; }
None => return Err(w.missing("loc:alertCLocationTableNumber")),
}
match &self.alert_c_location_table_version {
Some(v) => { w.max_len("alertCLocationTableVersion", "String", v, 1024)?; w.leaf("loc:alertCLocationTableVersion", v)?; }
None => return Err(w.missing("loc:alertCLocationTableVersion")),
}
if let Some(v) = &self.alert_c_linear_extension { w.extension("loc:_alertCLinearExtension", v)?; }
match &self.alert_c_direction {
Some(v) => { v.write(w, "loc:alertCDirection", "", "")?; }
None => return Err(w.missing("loc:alertCDirection")),
}
match &self.alert_c_method4_primary_point_location {
Some(v) => { v.write(w, "loc:alertCMethod4PrimaryPointLocation", "", "")?; }
None => return Err(w.missing("loc:alertCMethod4PrimaryPointLocation")),
}
match &self.alert_c_method4_secondary_point_location {
Some(v) => { v.write(w, "loc:alertCMethod4SecondaryPointLocation", "", "")?; }
None => return Err(w.missing("loc:alertCMethod4SecondaryPointLocation")),
}
if let Some(v) = &self.alert_c_method4_linear_extension { w.extension("loc:_alertCMethod4LinearExtension", v)?; }
w.end(tag)
}
}
impl AlertCMethod4Linear {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 8];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
let mut f5 = None;
let mut f6 = None;
let mut f7 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
216 => if r.first(&mut seen[0])? { f0 = r.string()?; },
218 => if r.first(&mut seen[1])? { f1 = r.string()?; },
219 => if r.first(&mut seen[2])? { f2 = r.string()?; },
1080 => if r.first(&mut seen[3])? { f3 = r.raw_object()?.map(Box::new); },
211 => if r.first(&mut seen[4])? { f4 = AlertCDirection::read_json(r)?.map(Box::new); },
222 => if r.first(&mut seen[5])? { f5 = AlertCMethod4PrimaryPointLocation::read_json(r)?.map(Box::new); },
223 => if r.first(&mut seen[6])? { f6 = AlertCMethod4SecondaryPointLocation::read_json(r)?.map(Box::new); },
1089 => if r.first(&mut seen[7])? { f7 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 216);
r.required(&f1, 218);
r.required(&f2, 219);
r.required(&f4, 211);
r.required(&f5, 222);
r.required(&f6, 223);
Ok(Self {
alert_c_location_country_code: f0,
alert_c_location_table_number: f1,
alert_c_location_table_version: f2,
alert_c_linear_extension: f3,
alert_c_direction: f4,
alert_c_method4_primary_point_location: f5,
alert_c_method4_secondary_point_location: f6,
alert_c_method4_linear_extension: f7,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(490)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.alert_c_location_country_code {
Some(v) => {
w.key(216)?;
w.max_len("alertCLocationCountryCode", "String", v, 1024)?; w.string(v)?;
}
None => w.absent(216, w.missing("alertCLocationCountryCode"))?,
}
match &self.alert_c_location_table_number {
Some(v) => {
w.key(218)?;
w.max_len("alertCLocationTableNumber", "String", v, 1024)?; w.string(v)?;
}
None => w.absent(218, w.missing("alertCLocationTableNumber"))?,
}
match &self.alert_c_location_table_version {
Some(v) => {
w.key(219)?;
w.max_len("alertCLocationTableVersion", "String", v, 1024)?; w.string(v)?;
}
None => w.absent(219, w.missing("alertCLocationTableVersion"))?,
}
if let Some(v) = &self.alert_c_linear_extension {
w.key(1080)?;
w.extension(v)?;
}
match &self.alert_c_direction {
Some(v) => {
w.key(211)?;
v.write_json(w, None)?;
}
None => w.absent(211, w.missing("alertCDirection"))?,
}
match &self.alert_c_method4_primary_point_location {
Some(v) => {
w.key(222)?;
v.write_json(w, None)?;
}
None => w.absent(222, w.missing("alertCMethod4PrimaryPointLocation"))?,
}
match &self.alert_c_method4_secondary_point_location {
Some(v) => {
w.key(223)?;
v.write_json(w, None)?;
}
None => w.absent(223, w.missing("alertCMethod4SecondaryPointLocation"))?,
}
if let Some(v) = &self.alert_c_method4_linear_extension {
w.key(1089)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:AlertCMethod4Point`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct AlertCMethod4Point {
/// XML element `loc:alertCLocationCountryCode`.
pub alert_c_location_country_code: Option<String>,
/// XML element `loc:alertCLocationTableNumber`.
pub alert_c_location_table_number: Option<String>,
/// XML element `loc:alertCLocationTableVersion`.
pub alert_c_location_table_version: Option<String>,
/// XML element `loc:_alertCPointExtension`.
pub alert_c_point_extension: Option<Box<Extension>>,
/// XML element `loc:alertCDirection`.
pub alert_c_direction: Option<Box<AlertCDirection>>,
/// XML element `loc:alertCMethod4PrimaryPointLocation`.
pub alert_c_method4_primary_point_location: Option<Box<AlertCMethod4PrimaryPointLocation>>,
/// XML element `loc:_alertCMethod4PointExtension`.
pub alert_c_method4_point_extension: Option<Box<Extension>>,
}
impl AlertCMethod4Point {
const FIELDS: &'static [u32] = &[0xe06cd, 0xe06cf, 0xe06d0, 0xe0430, 0xe06c8, 0xe06d3, 0xe042d];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe0026);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
let mut e4 = None;
let mut e5 = None;
let mut e6 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe06cd => { let v = r.string()?; r.set(&mut e0, v, 1741); }
0xe06cf => { let v = r.string()?; r.set(&mut e1, v, 1743); }
0xe06d0 => { let v = r.string()?; r.set(&mut e2, v, 1744); }
0xe0430 => { let v = r.raw()?; r.set(&mut e3, v.map(Box::new), 1072); }
0xe06c8 => { let v = Some(AlertCDirection::read(r)?); r.set(&mut e4, v.map(Box::new), 1736); }
0xe06d3 => { let v = Some(AlertCMethod4PrimaryPointLocation::read(r)?); r.set(&mut e5, v.map(Box::new), 1747); }
0xe042d => { let v = r.raw()?; r.set(&mut e6, v.map(Box::new), 1069); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 1741);
r.required(&e1, 1743);
r.required(&e2, 1744);
r.required(&e4, 1736);
r.required(&e5, 1747);
let v = Self {
alert_c_location_country_code: e0,
alert_c_location_table_number: e1,
alert_c_location_table_version: e2,
alert_c_point_extension: e3,
alert_c_direction: e4,
alert_c_method4_primary_point_location: e5,
alert_c_method4_point_extension: e6,
};
r.close();
Ok(v)
}
}
impl AlertCMethod4Point {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
match &self.alert_c_location_country_code {
Some(v) => { w.max_len("alertCLocationCountryCode", "String", v, 1024)?; w.leaf("loc:alertCLocationCountryCode", v)?; }
None => return Err(w.missing("loc:alertCLocationCountryCode")),
}
match &self.alert_c_location_table_number {
Some(v) => { w.max_len("alertCLocationTableNumber", "String", v, 1024)?; w.leaf("loc:alertCLocationTableNumber", v)?; }
None => return Err(w.missing("loc:alertCLocationTableNumber")),
}
match &self.alert_c_location_table_version {
Some(v) => { w.max_len("alertCLocationTableVersion", "String", v, 1024)?; w.leaf("loc:alertCLocationTableVersion", v)?; }
None => return Err(w.missing("loc:alertCLocationTableVersion")),
}
if let Some(v) = &self.alert_c_point_extension { w.extension("loc:_alertCPointExtension", v)?; }
match &self.alert_c_direction {
Some(v) => { v.write(w, "loc:alertCDirection", "", "")?; }
None => return Err(w.missing("loc:alertCDirection")),
}
match &self.alert_c_method4_primary_point_location {
Some(v) => { v.write(w, "loc:alertCMethod4PrimaryPointLocation", "", "")?; }
None => return Err(w.missing("loc:alertCMethod4PrimaryPointLocation")),
}
if let Some(v) = &self.alert_c_method4_point_extension { w.extension("loc:_alertCMethod4PointExtension", v)?; }
w.end(tag)
}
}
impl AlertCMethod4Point {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 7];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
let mut f5 = None;
let mut f6 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
216 => if r.first(&mut seen[0])? { f0 = r.string()?; },
218 => if r.first(&mut seen[1])? { f1 = r.string()?; },
219 => if r.first(&mut seen[2])? { f2 = r.string()?; },
1094 => if r.first(&mut seen[3])? { f3 = r.raw_object()?.map(Box::new); },
211 => if r.first(&mut seen[4])? { f4 = AlertCDirection::read_json(r)?.map(Box::new); },
222 => if r.first(&mut seen[5])? { f5 = AlertCMethod4PrimaryPointLocation::read_json(r)?.map(Box::new); },
1091 => if r.first(&mut seen[6])? { f6 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 216);
r.required(&f1, 218);
r.required(&f2, 219);
r.required(&f4, 211);
r.required(&f5, 222);
Ok(Self {
alert_c_location_country_code: f0,
alert_c_location_table_number: f1,
alert_c_location_table_version: f2,
alert_c_point_extension: f3,
alert_c_direction: f4,
alert_c_method4_primary_point_location: f5,
alert_c_method4_point_extension: f6,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(491)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.alert_c_location_country_code {
Some(v) => {
w.key(216)?;
w.max_len("alertCLocationCountryCode", "String", v, 1024)?; w.string(v)?;
}
None => w.absent(216, w.missing("alertCLocationCountryCode"))?,
}
match &self.alert_c_location_table_number {
Some(v) => {
w.key(218)?;
w.max_len("alertCLocationTableNumber", "String", v, 1024)?; w.string(v)?;
}
None => w.absent(218, w.missing("alertCLocationTableNumber"))?,
}
match &self.alert_c_location_table_version {
Some(v) => {
w.key(219)?;
w.max_len("alertCLocationTableVersion", "String", v, 1024)?; w.string(v)?;
}
None => w.absent(219, w.missing("alertCLocationTableVersion"))?,
}
if let Some(v) = &self.alert_c_point_extension {
w.key(1094)?;
w.extension(v)?;
}
match &self.alert_c_direction {
Some(v) => {
w.key(211)?;
v.write_json(w, None)?;
}
None => w.absent(211, w.missing("alertCDirection"))?,
}
match &self.alert_c_method4_primary_point_location {
Some(v) => {
w.key(222)?;
v.write_json(w, None)?;
}
None => w.absent(222, w.missing("alertCMethod4PrimaryPointLocation"))?,
}
if let Some(v) = &self.alert_c_method4_point_extension {
w.key(1091)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:AlertCMethod4PrimaryPointLocation`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct AlertCMethod4PrimaryPointLocation {
/// XML element `loc:alertCLocation`.
pub alert_c_location: Option<Box<AlertCLocation>>,
/// XML element `loc:offsetDistance`.
pub offset_distance: Option<Box<OffsetDistance>>,
/// XML element `loc:_alertCMethod4PrimaryPointLocationExtension`.
pub alert_c_method4_primary_point_location_extension: Option<Box<Extension>>,
}
impl AlertCMethod4PrimaryPointLocation {
const FIELDS: &'static [u32] = &[0xe06cc, 0xe09e9, 0xe042e];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe0027);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe06cc => { let v = Some(AlertCLocation::read(r)?); r.set(&mut e0, v.map(Box::new), 1740); }
0xe09e9 => { let v = Some(OffsetDistance::read(r)?); r.set(&mut e1, v.map(Box::new), 2537); }
0xe042e => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1070); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 1740);
r.required(&e1, 2537);
let v = Self {
alert_c_location: e0,
offset_distance: e1,
alert_c_method4_primary_point_location_extension: e2,
};
r.close();
Ok(v)
}
}
impl AlertCMethod4PrimaryPointLocation {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
match &self.alert_c_location {
Some(v) => { v.write(w, "loc:alertCLocation", "", "")?; }
None => return Err(w.missing("loc:alertCLocation")),
}
match &self.offset_distance {
Some(v) => { v.write(w, "loc:offsetDistance", "", "")?; }
None => return Err(w.missing("loc:offsetDistance")),
}
if let Some(v) = &self.alert_c_method4_primary_point_location_extension { w.extension("loc:_alertCMethod4PrimaryPointLocationExtension", v)?; }
w.end(tag)
}
}
impl AlertCMethod4PrimaryPointLocation {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 3];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
215 => if r.first(&mut seen[0])? { f0 = AlertCLocation::read_json(r)?.map(Box::new); },
1437 => if r.first(&mut seen[1])? { f1 = OffsetDistance::read_json(r)?.map(Box::new); },
1092 => if r.first(&mut seen[2])? { f2 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 215);
r.required(&f1, 1437);
Ok(Self {
alert_c_location: f0,
offset_distance: f1,
alert_c_method4_primary_point_location_extension: f2,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(492)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.alert_c_location {
Some(v) => {
w.key(215)?;
v.write_json(w, None)?;
}
None => w.absent(215, w.missing("alertCLocation"))?,
}
match &self.offset_distance {
Some(v) => {
w.key(1437)?;
v.write_json(w, None)?;
}
None => w.absent(1437, w.missing("offsetDistance"))?,
}
if let Some(v) = &self.alert_c_method4_primary_point_location_extension {
w.key(1092)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:AlertCMethod4SecondaryPointLocation`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct AlertCMethod4SecondaryPointLocation {
/// XML element `loc:alertCLocation`.
pub alert_c_location: Option<Box<AlertCLocation>>,
/// XML element `loc:offsetDistance`.
pub offset_distance: Option<Box<OffsetDistance>>,
/// XML element `loc:_alertCMethod4SecondaryPointLocationExtension`.
pub alert_c_method4_secondary_point_location_extension: Option<Box<Extension>>,
}
impl AlertCMethod4SecondaryPointLocation {
const FIELDS: &'static [u32] = &[0xe06cc, 0xe09e9, 0xe042f];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe0028);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe06cc => { let v = Some(AlertCLocation::read(r)?); r.set(&mut e0, v.map(Box::new), 1740); }
0xe09e9 => { let v = Some(OffsetDistance::read(r)?); r.set(&mut e1, v.map(Box::new), 2537); }
0xe042f => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1071); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 1740);
r.required(&e1, 2537);
let v = Self {
alert_c_location: e0,
offset_distance: e1,
alert_c_method4_secondary_point_location_extension: e2,
};
r.close();
Ok(v)
}
}
impl AlertCMethod4SecondaryPointLocation {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
match &self.alert_c_location {
Some(v) => { v.write(w, "loc:alertCLocation", "", "")?; }
None => return Err(w.missing("loc:alertCLocation")),
}
match &self.offset_distance {
Some(v) => { v.write(w, "loc:offsetDistance", "", "")?; }
None => return Err(w.missing("loc:offsetDistance")),
}
if let Some(v) = &self.alert_c_method4_secondary_point_location_extension { w.extension("loc:_alertCMethod4SecondaryPointLocationExtension", v)?; }
w.end(tag)
}
}
impl AlertCMethod4SecondaryPointLocation {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 3];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
215 => if r.first(&mut seen[0])? { f0 = AlertCLocation::read_json(r)?.map(Box::new); },
1437 => if r.first(&mut seen[1])? { f1 = OffsetDistance::read_json(r)?.map(Box::new); },
1093 => if r.first(&mut seen[2])? { f2 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 215);
r.required(&f1, 1437);
Ok(Self {
alert_c_location: f0,
offset_distance: f1,
alert_c_method4_secondary_point_location_extension: f2,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(493)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.alert_c_location {
Some(v) => {
w.key(215)?;
v.write_json(w, None)?;
}
None => w.absent(215, w.missing("alertCLocation"))?,
}
match &self.offset_distance {
Some(v) => {
w.key(1437)?;
v.write_json(w, None)?;
}
None => w.absent(1437, w.missing("offsetDistance"))?,
}
if let Some(v) = &self.alert_c_method4_secondary_point_location_extension {
w.key(1093)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:AltitudeConfidence`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct AltitudeConfidence {
/// XML element `loc:altitudeAccuracyCodedValue`.
pub altitude_accuracy_coded_value: Option<AltitudeAccuracyEnum>,
/// XML element `loc:altitudeAccuracyCodedError`.
pub altitude_accuracy_coded_error: Option<PositionConfidenceCodedErrorEnum>,
/// XML element `loc:_altitudeConfidenceExtension`.
pub altitude_confidence_extension: Option<Box<Extension>>,
}
impl AltitudeConfidence {
const FIELDS: &'static [u32] = &[0xe06de, 0xe06dd, 0xe0435];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe002e);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe06de => { let v = r.enumeration::<AltitudeAccuracyEnum>()?; r.set(&mut e0, v, 1758); }
0xe06dd => { let v = r.enumeration::<PositionConfidenceCodedErrorEnum>()?; r.set(&mut e1, v, 1757); }
0xe0435 => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1077); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
altitude_accuracy_coded_value: e0,
altitude_accuracy_coded_error: e1,
altitude_confidence_extension: e2,
};
r.close();
Ok(v)
}
}
impl AltitudeConfidence {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.altitude_accuracy_coded_value { w.enumeration("loc:altitudeAccuracyCodedValue", v.literal())?; }
if let Some(v) = &self.altitude_accuracy_coded_error { w.enumeration("loc:altitudeAccuracyCodedError", v.literal())?; }
if let Some(v) = &self.altitude_confidence_extension { w.extension("loc:_altitudeConfidenceExtension", v)?; }
w.end(tag)
}
}
impl AltitudeConfidence {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 3];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
233 => if r.first(&mut seen[0])? { f0 = r.enumeration::<AltitudeAccuracyEnum>()?; },
232 => if r.first(&mut seen[1])? { f1 = r.enumeration::<PositionConfidenceCodedErrorEnum>()?; },
1095 => if r.first(&mut seen[2])? { f2 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
Ok(Self {
altitude_accuracy_coded_value: f0,
altitude_accuracy_coded_error: f1,
altitude_confidence_extension: f2,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(496)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.altitude_accuracy_coded_value {
w.key(233)?;
w.enumeration(495, v.literal())?;
}
if let Some(v) = &self.altitude_accuracy_coded_error {
w.key(232)?;
w.enumeration(581, v.literal())?;
}
if let Some(v) = &self.altitude_confidence_extension {
w.key(1095)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:AreaDestination`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct AreaDestination {
/// XML element `loc:_destinationExtension`.
pub destination_extension: Option<Box<Extension>>,
/// XML element `loc:areaLocation`.
pub area_location: Option<Box<AreaLocation>>,
/// XML element `loc:_areaDestinationExtension`.
pub area_destination_extension: Option<Box<Extension>>,
}
impl AreaDestination {
const FIELDS: &'static [u32] = &[0xe0479, 0xe06f5, 0xe043c];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe0035);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe0479 => { let v = r.raw()?; r.set(&mut e0, v.map(Box::new), 1145); }
0xe06f5 => { let v = Some(AreaLocation::read(r)?); r.set(&mut e1, v.map(Box::new), 1781); }
0xe043c => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1084); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e1, 1781);
let v = Self {
destination_extension: e0,
area_location: e1,
area_destination_extension: e2,
};
r.close();
Ok(v)
}
}
impl AreaDestination {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.destination_extension { w.extension("loc:_destinationExtension", v)?; }
match &self.area_location {
Some(v) => { v.write(w, "loc:areaLocation", "", "")?; }
None => return Err(w.missing("loc:areaLocation")),
}
if let Some(v) = &self.area_destination_extension { w.extension("loc:_areaDestinationExtension", v)?; }
w.end(tag)
}
}
impl AreaDestination {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 3];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1101 => if r.first(&mut seen[0])? { f0 = r.raw_object()?.map(Box::new); },
256 => if r.first(&mut seen[1])? { f1 = AreaLocation::read_json(r)?.map(Box::new); },
1097 => if r.first(&mut seen[2])? { f2 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f1, 256);
Ok(Self {
destination_extension: f0,
area_location: f1,
area_destination_extension: f2,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(497)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.destination_extension {
w.key(1101)?;
w.extension(v)?;
}
match &self.area_location {
Some(v) => {
w.key(256)?;
v.write_json(w, None)?;
}
None => w.absent(256, w.missing("areaLocation"))?,
}
if let Some(v) = &self.area_destination_extension {
w.key(1097)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:AreaLocation`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct AreaLocation {
/// XML element `loc:_locationReferenceExtension`.
pub location_reference_extension: Option<Box<LocationReferenceExtensionType>>,
/// XML element `loc:externalReferencing`.
pub external_referencing: Vec<ExternalReferencing>,
/// XML element `loc:coordinatesForDisplay`.
pub coordinates_for_display: Option<Box<PointCoordinates>>,
/// XML element `loc:_locationExtension`.
pub location_extension: Option<Box<LocationExtensionType>>,
/// XML element `loc:areasAtWhichApplicable`.
pub areas_at_which_applicable: Option<AreaPlacesEnum>,
/// XML element `loc:alertCArea`.
pub alert_c_area: Vec<AlertCArea>,
/// XML element `loc:tpegAreaLocation`.
pub tpeg_area_location: Option<TpegAreaLocation>,
/// XML element `loc:namedArea`.
pub named_area: Option<AnyNamedArea>,
/// XML element `loc:gmlMultiPolygon`.
pub gml_multi_polygon: Option<Box<GmlMultiPolygon>>,
/// XML element `loc:openlrAreaLocationReference`.
pub openlr_area_location_reference: Option<OpenlrAreaLocationReference>,
/// XML element `loc:_areaLocationExtension`.
pub area_location_extension: Option<Box<Extension>>,
}
impl AreaLocation {
const FIELDS: &'static [u32] = &[0xe0505, 0xe0845, 0xe0772, 0xe0501, 0xe06f7, 0xe06c7, 0xe0c2d, 0xe098d, 0xe0882, 0xe09ed, 0xe043d];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe0036);
r.attrs_done();
let mut e0 = None;
let mut e1 = Vec::new();
let mut e2 = None;
let mut e3 = None;
let mut e4 = None;
let mut e5 = Vec::new();
let mut e6 = None;
let mut e7 = None;
let mut e8 = None;
let mut e9 = None;
let mut e10 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe0505 => { let v = Some(LocationReferenceExtensionType::read(r)?); r.set(&mut e0, v.map(Box::new), 1285); }
0xe0845 => { let v = Some(ExternalReferencing::read(r)?); e1.extend(v); }
0xe0772 => { let v = Some(PointCoordinates::read(r)?); r.set(&mut e2, v.map(Box::new), 1906); }
0xe0501 => { let v = Some(LocationExtensionType::read(r)?); r.set(&mut e3, v.map(Box::new), 1281); }
0xe06f7 => { let v = r.enumeration::<AreaPlacesEnum>()?; r.set(&mut e4, v, 1783); }
0xe06c7 => { let v = Some(AlertCArea::read(r)?); e5.extend(v); }
0xe0c2d => { let v = TpegAreaLocation::read(r)?; r.set(&mut e6, v, 3117); }
0xe098d => { let v = AnyNamedArea::read(r)?; r.set(&mut e7, v, 2445); }
0xe0882 => { let v = Some(GmlMultiPolygon::read(r)?); r.set(&mut e8, v.map(Box::new), 2178); }
0xe09ed => { let v = OpenlrAreaLocationReference::read(r)?; r.set(&mut e9, v, 2541); }
0xe043d => { let v = r.raw()?; r.set(&mut e10, v.map(Box::new), 1085); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
location_reference_extension: e0,
external_referencing: e1,
coordinates_for_display: e2,
location_extension: e3,
areas_at_which_applicable: e4,
alert_c_area: e5,
tpeg_area_location: e6,
named_area: e7,
gml_multi_polygon: e8,
openlr_area_location_reference: e9,
area_location_extension: e10,
};
r.close();
Ok(v)
}
}
impl AreaLocation {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.location_reference_extension { v.write(w, "loc:_locationReferenceExtension", "", "")?; }
for v in &self.external_referencing { v.write(w, "loc:externalReferencing", "", "")?; }
if let Some(v) = &self.coordinates_for_display { v.write(w, "loc:coordinatesForDisplay", "", "")?; }
if let Some(v) = &self.location_extension { v.write(w, "loc:_locationExtension", "", "")?; }
if let Some(v) = &self.areas_at_which_applicable { w.enumeration("loc:areasAtWhichApplicable", v.literal())?; }
for v in &self.alert_c_area { v.write(w, "loc:alertCArea", "", "")?; }
if let Some(v) = &self.tpeg_area_location { v.write(w, "loc:tpegAreaLocation")?; }
if let Some(v) = &self.named_area { v.write(w, "loc:namedArea")?; }
if let Some(v) = &self.gml_multi_polygon { v.write(w, "loc:gmlMultiPolygon", "", "")?; }
if let Some(v) = &self.openlr_area_location_reference { v.write(w, "loc:openlrAreaLocationReference")?; }
if let Some(v) = &self.area_location_extension { w.extension("loc:_areaLocationExtension", v)?; }
w.end(tag)
}
}
impl AreaLocation {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 11];
let mut f0 = None;
let mut f1 = Vec::new();
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
let mut f5 = Vec::new();
let mut f6 = None;
let mut f7 = None;
let mut f8 = None;
let mut f9 = None;
let mut f10 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1142 => if r.first(&mut seen[0])? { f0 = LocationReferenceExtensionType::read_json(r)?.map(Box::new); },
744 => if r.first(&mut seen[1])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = ExternalReferencing::read_json(r)? { f1.push(v); } } },
464 => if r.first(&mut seen[2])? { f2 = PointCoordinates::read_json(r)?.map(Box::new); },
1136 => if r.first(&mut seen[3])? { f3 = LocationExtensionType::read_json(r)?.map(Box::new); },
258 => if r.first(&mut seen[4])? { f4 = r.enumeration::<AreaPlacesEnum>()?; },
210 => if r.first(&mut seen[5])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = AlertCArea::read_json(r)? { f5.push(v); } } },
2342 => if r.first(&mut seen[6])? { f6 = TpegAreaLocation::read_json(r)?; },
1347 => if r.first(&mut seen[7])? { f7 = AnyNamedArea::read_json(r)?; },
923 => if r.first(&mut seen[8])? { f8 = GmlMultiPolygon::read_json(r)?.map(Box::new); },
1441 => if r.first(&mut seen[9])? { f9 = OpenlrAreaLocationReference::read_json(r)?; },
1099 => if r.first(&mut seen[10])? { f10 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
Ok(Self {
location_reference_extension: f0,
external_referencing: f1,
coordinates_for_display: f2,
location_extension: f3,
areas_at_which_applicable: f4,
alert_c_area: f5,
tpeg_area_location: f6,
named_area: f7,
gml_multi_polygon: f8,
openlr_area_location_reference: f9,
area_location_extension: f10,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(498)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.location_reference_extension {
w.key(1142)?;
v.write_json(w, None)?;
}
if !self.external_referencing.is_empty() {
w.key(744)?;
w.begin_array()?;
for v in &self.external_referencing {
w.item()?;
v.write_json(w, None)?;
}
w.end_array()?;
}
if let Some(v) = &self.coordinates_for_display {
w.key(464)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.location_extension {
w.key(1136)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.areas_at_which_applicable {
w.key(258)?;
w.enumeration(499, v.literal())?;
}
if !self.alert_c_area.is_empty() {
w.key(210)?;
w.begin_array()?;
for v in &self.alert_c_area {
w.item()?;
v.write_json(w, None)?;
}
w.end_array()?;
}
if let Some(v) = &self.tpeg_area_location {
w.key(2342)?;
v.write_json(w)?;
}
if let Some(v) = &self.named_area {
w.key(1347)?;
v.write_json(w)?;
}
if let Some(v) = &self.gml_multi_polygon {
w.key(923)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.openlr_area_location_reference {
w.key(1441)?;
v.write_json(w)?;
}
if let Some(v) = &self.area_location_extension {
w.key(1099)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:Carriageway`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct Carriageway {
/// XML element `loc:carriageway`.
pub carriageway: Option<CarriagewayEnum>,
/// XML element `loc:originalNumberOfLanes`.
pub original_number_of_lanes: Option<com::Integer>,
/// XML element `loc:lane`.
pub lane: Vec<Lane>,
/// XML element `loc:_carriagewayExtension`.
pub carriageway_extension: Option<Box<Extension>>,
}
impl Carriageway {
const FIELDS: &'static [u32] = &[0xe0733, 0xe0a27, 0xe08e9, 0xe0450];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe004b);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = Vec::new();
let mut e3 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe0733 => { let v = r.enumeration::<CarriagewayEnum>()?; r.set(&mut e0, v, 1843); }
0xe0a27 => { let v = r.value::<i64>()?; r.set(&mut e1, v, 2599); }
0xe08e9 => { let v = Some(Lane::read(r)?); e2.extend(v); }
0xe0450 => { let v = r.raw()?; r.set(&mut e3, v.map(Box::new), 1104); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 1843);
let v = Self {
carriageway: e0,
original_number_of_lanes: e1,
lane: e2,
carriageway_extension: e3,
};
r.close();
Ok(v)
}
}
impl Carriageway {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
match &self.carriageway {
Some(v) => { w.enumeration("loc:carriageway", v.literal())?; }
None => return Err(w.missing("loc:carriageway")),
}
if let Some(v) = &self.original_number_of_lanes { w.leaf("loc:originalNumberOfLanes", v)?; }
for v in &self.lane { v.write(w, "loc:lane", "", "")?; }
if let Some(v) = &self.carriageway_extension { w.extension("loc:_carriagewayExtension", v)?; }
w.end(tag)
}
}
impl Carriageway {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 4];
let mut f0 = None;
let mut f1 = None;
let mut f2 = Vec::new();
let mut f3 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
317 => if r.first(&mut seen[0])? { f0 = r.enumeration::<CarriagewayEnum>()?; },
1498 => if r.first(&mut seen[1])? { f1 = r.number::<i64>()?; },
1028 => if r.first(&mut seen[2])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = Lane::read_json(r)? { f2.push(v); } } },
1100 => if r.first(&mut seen[3])? { f3 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 317);
Ok(Self {
carriageway: f0,
original_number_of_lanes: f1,
lane: f2,
carriageway_extension: f3,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(500)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.carriageway {
Some(v) => {
w.key(317)?;
w.enumeration(501, v.literal())?;
}
None => w.absent(317, w.missing("carriageway"))?,
}
if let Some(v) = &self.original_number_of_lanes {
w.key(1498)?;
w.integer(*v)?;
}
if !self.lane.is_empty() {
w.key(1028)?;
w.begin_array()?;
for v in &self.lane {
w.item()?;
v.write_json(w, None)?;
}
w.end_array()?;
}
if let Some(v) = &self.carriageway_extension {
w.key(1100)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:DistanceFromLinearElementReferent`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct DistanceFromLinearElementReferent {
/// XML element `loc:_distanceAlongLinearElementExtension`.
pub distance_along_linear_element_extension: Option<Box<Extension>>,
/// XML element `loc:distanceAlong`.
pub distance_along: Option<com::MetresAsFloat>,
/// XML element `loc:fromReferent`.
pub from_referent: Option<Box<Referent>>,
/// XML element `loc:towardsReferent`.
pub towards_referent: Option<Box<Referent>>,
/// XML element `loc:_distanceFromLinearElementReferentExtension`.
pub distance_from_linear_element_referent_extension: Option<Box<Extension>>,
}
impl DistanceFromLinearElementReferent {
const FIELDS: &'static [u32] = &[0xe048c, 0xe07cd, 0xe0870, 0xe0c2b, 0xe048d];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe0088);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
let mut e4 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe048c => { let v = r.raw()?; r.set(&mut e0, v.map(Box::new), 1164); }
0xe07cd => { let v = r.value::<f32>()?; r.set(&mut e1, v, 1997); }
0xe0870 => { let v = Some(Referent::read(r)?); r.set(&mut e2, v.map(Box::new), 2160); }
0xe0c2b => { let v = Some(Referent::read(r)?); r.set(&mut e3, v.map(Box::new), 3115); }
0xe048d => { let v = r.raw()?; r.set(&mut e4, v.map(Box::new), 1165); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e1, 1997);
r.required(&e2, 2160);
let v = Self {
distance_along_linear_element_extension: e0,
distance_along: e1,
from_referent: e2,
towards_referent: e3,
distance_from_linear_element_referent_extension: e4,
};
r.close();
Ok(v)
}
}
impl DistanceFromLinearElementReferent {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.distance_along_linear_element_extension { w.extension("loc:_distanceAlongLinearElementExtension", v)?; }
match &self.distance_along {
Some(v) => { w.leaf("loc:distanceAlong", v)?; }
None => return Err(w.missing("loc:distanceAlong")),
}
match &self.from_referent {
Some(v) => { v.write(w, "loc:fromReferent", "", "")?; }
None => return Err(w.missing("loc:fromReferent")),
}
if let Some(v) = &self.towards_referent { v.write(w, "loc:towardsReferent", "", "")?; }
if let Some(v) = &self.distance_from_linear_element_referent_extension { w.extension("loc:_distanceFromLinearElementReferentExtension", v)?; }
w.end(tag)
}
}
impl DistanceFromLinearElementReferent {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 5];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1102 => if r.first(&mut seen[0])? { f0 = r.raw_object()?.map(Box::new); },
582 => if r.first(&mut seen[1])? { f1 = r.number::<f32>()?; },
870 => if r.first(&mut seen[2])? { f2 = Referent::read_json(r)?.map(Box::new); },
2340 => if r.first(&mut seen[3])? { f3 = Referent::read_json(r)?.map(Box::new); },
1104 => if r.first(&mut seen[4])? { f4 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f1, 582);
r.required(&f2, 870);
Ok(Self {
distance_along_linear_element_extension: f0,
distance_along: f1,
from_referent: f2,
towards_referent: f3,
distance_from_linear_element_referent_extension: f4,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(506)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.distance_along_linear_element_extension {
w.key(1102)?;
w.extension(v)?;
}
match &self.distance_along {
Some(v) => {
w.key(582)?;
w.float32(*v)?;
}
None => w.absent(582, w.missing("distanceAlong"))?,
}
match &self.from_referent {
Some(v) => {
w.key(870)?;
v.write_json(w, None)?;
}
None => w.absent(870, w.missing("fromReferent"))?,
}
if let Some(v) = &self.towards_referent {
w.key(2340)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.distance_from_linear_element_referent_extension {
w.key(1104)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:DistanceFromLinearElementStart`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct DistanceFromLinearElementStart {
/// XML element `loc:_distanceAlongLinearElementExtension`.
pub distance_along_linear_element_extension: Option<Box<Extension>>,
/// XML element `loc:distanceAlong`.
pub distance_along: Option<com::MetresAsFloat>,
/// XML element `loc:_distanceFromLinearElementStartExtension`.
pub distance_from_linear_element_start_extension: Option<Box<Extension>>,
}
impl DistanceFromLinearElementStart {
const FIELDS: &'static [u32] = &[0xe048c, 0xe07cd, 0xe048e];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe0089);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe048c => { let v = r.raw()?; r.set(&mut e0, v.map(Box::new), 1164); }
0xe07cd => { let v = r.value::<f32>()?; r.set(&mut e1, v, 1997); }
0xe048e => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1166); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e1, 1997);
let v = Self {
distance_along_linear_element_extension: e0,
distance_along: e1,
distance_from_linear_element_start_extension: e2,
};
r.close();
Ok(v)
}
}
impl DistanceFromLinearElementStart {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.distance_along_linear_element_extension { w.extension("loc:_distanceAlongLinearElementExtension", v)?; }
match &self.distance_along {
Some(v) => { w.leaf("loc:distanceAlong", v)?; }
None => return Err(w.missing("loc:distanceAlong")),
}
if let Some(v) = &self.distance_from_linear_element_start_extension { w.extension("loc:_distanceFromLinearElementStartExtension", v)?; }
w.end(tag)
}
}
impl DistanceFromLinearElementStart {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 3];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1102 => if r.first(&mut seen[0])? { f0 = r.raw_object()?.map(Box::new); },
582 => if r.first(&mut seen[1])? { f1 = r.number::<f32>()?; },
1106 => if r.first(&mut seen[2])? { f2 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f1, 582);
Ok(Self {
distance_along_linear_element_extension: f0,
distance_along: f1,
distance_from_linear_element_start_extension: f2,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(507)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.distance_along_linear_element_extension {
w.key(1102)?;
w.extension(v)?;
}
match &self.distance_along {
Some(v) => {
w.key(582)?;
w.float32(*v)?;
}
None => w.absent(582, w.missing("distanceAlong"))?,
}
if let Some(v) = &self.distance_from_linear_element_start_extension {
w.key(1106)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:ExternalReferencing`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct ExternalReferencing {
/// XML element `loc:externalLocationCode`.
pub external_location_code: Option<String>,
/// XML element `loc:externalReferencingSystem`.
pub external_referencing_system: Option<String>,
/// XML element `loc:_externalReferencingExtension`.
pub external_referencing_extension: Option<Box<Extension>>,
}
impl ExternalReferencing {
const FIELDS: &'static [u32] = &[0xe0841, 0xe0846, 0xe04b5];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe00b0);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe0841 => { let v = r.string()?; r.set(&mut e0, v, 2113); }
0xe0846 => { let v = r.string()?; r.set(&mut e1, v, 2118); }
0xe04b5 => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1205); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 2113);
r.required(&e1, 2118);
let v = Self {
external_location_code: e0,
external_referencing_system: e1,
external_referencing_extension: e2,
};
r.close();
Ok(v)
}
}
impl ExternalReferencing {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
match &self.external_location_code {
Some(v) => { w.max_len("externalLocationCode", "String", v, 1024)?; w.leaf("loc:externalLocationCode", v)?; }
None => return Err(w.missing("loc:externalLocationCode")),
}
match &self.external_referencing_system {
Some(v) => { w.max_len("externalReferencingSystem", "String", v, 1024)?; w.leaf("loc:externalReferencingSystem", v)?; }
None => return Err(w.missing("loc:externalReferencingSystem")),
}
if let Some(v) = &self.external_referencing_extension { w.extension("loc:_externalReferencingExtension", v)?; }
w.end(tag)
}
}
impl ExternalReferencing {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 3];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
740 => if r.first(&mut seen[0])? { f0 = r.string()?; },
745 => if r.first(&mut seen[1])? { f1 = r.string()?; },
1107 => if r.first(&mut seen[2])? { f2 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 740);
r.required(&f1, 745);
Ok(Self {
external_location_code: f0,
external_referencing_system: f1,
external_referencing_extension: f2,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(508)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.external_location_code {
Some(v) => {
w.key(740)?;
w.max_len("externalLocationCode", "String", v, 1024)?; w.string(v)?;
}
None => w.absent(740, w.missing("externalLocationCode"))?,
}
match &self.external_referencing_system {
Some(v) => {
w.key(745)?;
w.max_len("externalReferencingSystem", "String", v, 1024)?; w.string(v)?;
}
None => w.absent(745, w.missing("externalReferencingSystem"))?,
}
if let Some(v) = &self.external_referencing_extension {
w.key(1107)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:GmlLineString`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct GmlLineString {
/// XML attribute `srsDimension`.
pub srs_dimension: Option<com::NonNegativeInteger>,
/// XML attribute `srsName`.
pub srs_name: Option<String>,
/// XML element `loc:posList`.
pub pos_list: Option<GmlPosList>,
/// XML element `loc:_gmlLineStringExtension`.
pub gml_line_string_extension: Option<Box<Extension>>,
}
impl GmlLineString {
const FIELDS: &'static [u32] = &[0xe0a93, 0xe04cf];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe00cb);
let a0 = r.attr_value::<u64>(3008)?;
let a1 = r.attr(3009);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe0a93 => { let v = r.string()?; r.set(&mut e0, v, 2707); }
0xe04cf => { let v = r.raw()?; r.set(&mut e1, v.map(Box::new), 1231); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 2707);
let v = Self {
srs_dimension: a0,
srs_name: a1,
pos_list: e0,
gml_line_string_extension: e1,
};
r.close();
Ok(v)
}
}
impl GmlLineString {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.srs_dimension { w.attr_value("srsDimension", v)?; }
if let Some(v) = &self.srs_name { w.max_len("srsName", "String", v, 1024)?; w.attr("srsName", v)?; }
match &self.pos_list {
Some(v) => { w.pattern("posList", "GmlPosList", v, Pattern::GmlPosList)?; w.leaf("loc:posList", v)?; }
None => return Err(w.missing("loc:posList")),
}
if let Some(v) = &self.gml_line_string_extension { w.extension("loc:_gmlLineStringExtension", v)?; }
w.end(tag)
}
}
impl GmlLineString {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 4];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
2173 => if r.first(&mut seen[0])? { f0 = r.number::<u64>()?; },
2174 => if r.first(&mut seen[1])? { f1 = r.string()?; },
1605 => if r.first(&mut seen[2])? { f2 = r.string()?; },
1109 => if r.first(&mut seen[3])? { f3 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f2, 1605);
Ok(Self {
srs_dimension: f0,
srs_name: f1,
pos_list: f2,
gml_line_string_extension: f3,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(510)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.srs_dimension {
w.key(2173)?;
w.integer(*v)?;
}
if let Some(v) = &self.srs_name {
w.key(2174)?;
w.max_len("srsName", "String", v, 1024)?; w.string(v)?;
}
match &self.pos_list {
Some(v) => {
w.key(1605)?;
w.pattern("posList", "GmlPosList", v, Pattern::GmlPosList)?; w.string(v)?;
}
None => w.absent(1605, w.missing("posList"))?,
}
if let Some(v) = &self.gml_line_string_extension {
w.key(1109)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:GmlLinearRing`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct GmlLinearRing {
/// XML attribute `srsDimension`.
pub srs_dimension: Option<com::NonNegativeInteger>,
/// XML attribute `srsName`.
pub srs_name: Option<String>,
/// XML element `loc:posList`.
pub pos_list: Option<GmlPosList>,
/// XML element `loc:_gmlLineStringExtension`.
pub gml_line_string_extension: Option<Box<Extension>>,
/// XML element `loc:_gmlLinearRingExtension`.
pub gml_linear_ring_extension: Option<Box<Extension>>,
}
impl GmlLinearRing {
const FIELDS: &'static [u32] = &[0xe0a93, 0xe04cf, 0xe04d0];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe00cc);
let a0 = r.attr_value::<u64>(3008)?;
let a1 = r.attr(3009);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe0a93 => { let v = r.string()?; r.set(&mut e0, v, 2707); }
0xe04cf => { let v = r.raw()?; r.set(&mut e1, v.map(Box::new), 1231); }
0xe04d0 => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1232); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 2707);
let v = Self {
srs_dimension: a0,
srs_name: a1,
pos_list: e0,
gml_line_string_extension: e1,
gml_linear_ring_extension: e2,
};
r.close();
Ok(v)
}
}
impl GmlLinearRing {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.srs_dimension { w.attr_value("srsDimension", v)?; }
if let Some(v) = &self.srs_name { w.max_len("srsName", "String", v, 1024)?; w.attr("srsName", v)?; }
match &self.pos_list {
Some(v) => { w.pattern("posList", "GmlPosList", v, Pattern::GmlPosList)?; w.leaf("loc:posList", v)?; }
None => return Err(w.missing("loc:posList")),
}
if let Some(v) = &self.gml_line_string_extension { w.extension("loc:_gmlLineStringExtension", v)?; }
if let Some(v) = &self.gml_linear_ring_extension { w.extension("loc:_gmlLinearRingExtension", v)?; }
w.end(tag)
}
}
impl GmlLinearRing {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 5];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
2173 => if r.first(&mut seen[0])? { f0 = r.number::<u64>()?; },
2174 => if r.first(&mut seen[1])? { f1 = r.string()?; },
1605 => if r.first(&mut seen[2])? { f2 = r.string()?; },
1109 => if r.first(&mut seen[3])? { f3 = r.raw_object()?.map(Box::new); },
1111 => if r.first(&mut seen[4])? { f4 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f2, 1605);
Ok(Self {
srs_dimension: f0,
srs_name: f1,
pos_list: f2,
gml_line_string_extension: f3,
gml_linear_ring_extension: f4,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(512)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.srs_dimension {
w.key(2173)?;
w.integer(*v)?;
}
if let Some(v) = &self.srs_name {
w.key(2174)?;
w.max_len("srsName", "String", v, 1024)?; w.string(v)?;
}
match &self.pos_list {
Some(v) => {
w.key(1605)?;
w.pattern("posList", "GmlPosList", v, Pattern::GmlPosList)?; w.string(v)?;
}
None => w.absent(1605, w.missing("posList"))?,
}
if let Some(v) = &self.gml_line_string_extension {
w.key(1109)?;
w.extension(v)?;
}
if let Some(v) = &self.gml_linear_ring_extension {
w.key(1111)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:GmlMultiPolygon`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct GmlMultiPolygon {
/// XML element `loc:gmlAreaName`.
pub gml_area_name: Option<MultilingualString>,
/// XML element `loc:gmlPolygon`.
pub gml_polygon: Vec<GmlPolygon>,
/// XML element `loc:_gmlMultiPolygonExtension`.
pub gml_multi_polygon_extension: Option<Box<Extension>>,
}
impl GmlMultiPolygon {
const FIELDS: &'static [u32] = &[0xe0880, 0xe0883, 0xe04d1];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe00cd);
r.attrs_done();
let mut e0 = None;
let mut e1 = Vec::new();
let mut e2 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe0880 => { let v = r.multilingual()?; r.set(&mut e0, v, 2176); }
0xe0883 => { let v = Some(GmlPolygon::read(r)?); e1.extend(v); }
0xe04d1 => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1233); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
gml_area_name: e0,
gml_polygon: e1,
gml_multi_polygon_extension: e2,
};
r.close();
Ok(v)
}
}
impl GmlMultiPolygon {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.gml_area_name { w.multilingual("loc:gmlAreaName", v)?; }
w.count("loc:gmlPolygon", self.gml_polygon.len(), 1, usize::MAX)?;
for v in &self.gml_polygon { v.write(w, "loc:gmlPolygon", "", "")?; }
if let Some(v) = &self.gml_multi_polygon_extension { w.extension("loc:_gmlMultiPolygonExtension", v)?; }
w.end(tag)
}
}
impl GmlMultiPolygon {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 3];
let mut f0 = None;
let mut f1 = Vec::new();
let mut f2 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
921 => if r.first(&mut seen[0])? { f0 = r.multilingual()?; },
924 => if r.first(&mut seen[1])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = GmlPolygon::read_json(r)? { f1.push(v); } } },
1112 => if r.first(&mut seen[2])? { f2 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
Ok(Self {
gml_area_name: f0,
gml_polygon: f1,
gml_multi_polygon_extension: f2,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(513)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.gml_area_name {
w.key(921)?;
w.multilingual(v)?;
}
w.count("gmlPolygon", self.gml_polygon.len(), 1, usize::MAX)?;
if !self.gml_polygon.is_empty() {
w.key(924)?;
w.begin_array()?;
for v in &self.gml_polygon {
w.item()?;
v.write_json(w, None)?;
}
w.end_array()?;
}
if let Some(v) = &self.gml_multi_polygon_extension {
w.key(1112)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:GmlPolygon`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct GmlPolygon {
/// XML element `loc:exterior`.
pub exterior: Option<Box<GmlLinearRing>>,
/// XML element `loc:interior`.
pub interior: Vec<GmlLinearRing>,
/// XML element `loc:_gmlPolygonExtension`.
pub gml_polygon_extension: Option<Box<Extension>>,
}
impl GmlPolygon {
const FIELDS: &'static [u32] = &[0xe083a, 0xe08cc, 0xe04d2];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe00ce);
r.attrs_done();
let mut e0 = None;
let mut e1 = Vec::new();
let mut e2 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe083a => { let v = Some(GmlLinearRing::read(r)?); r.set(&mut e0, v.map(Box::new), 2106); }
0xe08cc => { let v = Some(GmlLinearRing::read(r)?); e1.extend(v); }
0xe04d2 => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1234); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 2106);
let v = Self {
exterior: e0,
interior: e1,
gml_polygon_extension: e2,
};
r.close();
Ok(v)
}
}
impl GmlPolygon {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
match &self.exterior {
Some(v) => { v.write(w, "loc:exterior", "", "")?; }
None => return Err(w.missing("loc:exterior")),
}
for v in &self.interior { v.write(w, "loc:interior", "", "")?; }
if let Some(v) = &self.gml_polygon_extension { w.extension("loc:_gmlPolygonExtension", v)?; }
w.end(tag)
}
}
impl GmlPolygon {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 3];
let mut f0 = None;
let mut f1 = Vec::new();
let mut f2 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
733 => if r.first(&mut seen[0])? { f0 = GmlLinearRing::read_json(r)?.map(Box::new); },
999 => if r.first(&mut seen[1])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = GmlLinearRing::read_json(r)? { f1.push(v); } } },
1113 => if r.first(&mut seen[2])? { f2 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 733);
Ok(Self {
exterior: f0,
interior: f1,
gml_polygon_extension: f2,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(514)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.exterior {
Some(v) => {
w.key(733)?;
v.write_json(w, None)?;
}
None => w.absent(733, w.missing("exterior"))?,
}
if !self.interior.is_empty() {
w.key(999)?;
w.begin_array()?;
for v in &self.interior {
w.item()?;
v.write_json(w, None)?;
}
w.end_array()?;
}
if let Some(v) = &self.gml_polygon_extension {
w.key(1113)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:HeightCoordinate`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct HeightCoordinate {
/// XML element `loc:heightValue`.
pub height_value: Option<com::MetresAsFloat>,
/// XML element `loc:heightType`.
pub height_type: Option<HeightTypeEnum>,
/// XML element `loc:altitudeConfidence`.
pub altitude_confidence: Option<Box<AltitudeConfidence>>,
/// XML element `loc:verticalPositionAccuracy`.
pub vertical_position_accuracy: Option<Box<PositionAccuracy>>,
/// XML element `loc:_heightCoordinateExtension`.
pub height_coordinate_extension: Option<Box<Extension>>,
}
impl HeightCoordinate {
const FIELDS: &'static [u32] = &[0xe089f, 0xe089e, 0xe06df, 0xe0cb1, 0xe04dd];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe00d9);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
let mut e4 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe089f => { let v = r.value::<f32>()?; r.set(&mut e0, v, 2207); }
0xe089e => { let v = r.enumeration::<HeightTypeEnum>()?; r.set(&mut e1, v, 2206); }
0xe06df => { let v = Some(AltitudeConfidence::read(r)?); r.set(&mut e2, v.map(Box::new), 1759); }
0xe0cb1 => { let v = Some(PositionAccuracy::read(r)?); r.set(&mut e3, v.map(Box::new), 3249); }
0xe04dd => { let v = r.raw()?; r.set(&mut e4, v.map(Box::new), 1245); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 2207);
let v = Self {
height_value: e0,
height_type: e1,
altitude_confidence: e2,
vertical_position_accuracy: e3,
height_coordinate_extension: e4,
};
r.close();
Ok(v)
}
}
impl HeightCoordinate {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
match &self.height_value {
Some(v) => { w.leaf("loc:heightValue", v)?; }
None => return Err(w.missing("loc:heightValue")),
}
if let Some(v) = &self.height_type { w.enumeration("loc:heightType", v.literal())?; }
if let Some(v) = &self.altitude_confidence { v.write(w, "loc:altitudeConfidence", "", "")?; }
if let Some(v) = &self.vertical_position_accuracy { v.write(w, "loc:verticalPositionAccuracy", "", "")?; }
if let Some(v) = &self.height_coordinate_extension { w.extension("loc:_heightCoordinateExtension", v)?; }
w.end(tag)
}
}
impl HeightCoordinate {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 5];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
952 => if r.first(&mut seen[0])? { f0 = r.number::<f32>()?; },
951 => if r.first(&mut seen[1])? { f1 = r.enumeration::<HeightTypeEnum>()?; },
234 => if r.first(&mut seen[2])? { f2 = AltitudeConfidence::read_json(r)?.map(Box::new); },
2582 => if r.first(&mut seen[3])? { f3 = PositionAccuracy::read_json(r)?.map(Box::new); },
1114 => if r.first(&mut seen[4])? { f4 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 952);
Ok(Self {
height_value: f0,
height_type: f1,
altitude_confidence: f2,
vertical_position_accuracy: f3,
height_coordinate_extension: f4,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(515)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.height_value {
Some(v) => {
w.key(952)?;
w.float32(*v)?;
}
None => w.absent(952, w.missing("heightValue"))?,
}
if let Some(v) = &self.height_type {
w.key(951)?;
w.enumeration(517, v.literal())?;
}
if let Some(v) = &self.altitude_confidence {
w.key(234)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.vertical_position_accuracy {
w.key(2582)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.height_coordinate_extension {
w.key(1114)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:IsoNamedArea`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct IsoNamedArea {
/// XML element `com:_namedAreaExtension`.
pub named_area_extension: Option<Box<Extension>>,
/// XML element `loc:areaName`.
pub area_name: Option<MultilingualString>,
/// XML element `loc:namedAreaType`.
pub named_area_type: Option<NamedAreaTypeEnum>,
/// XML element `loc:country`.
pub country: Option<com::CountryCode>,
/// XML element `loc:_namedAreaExtension`.
pub loc_named_area_extension: Option<Box<NamedAreaExtensionType>>,
/// XML element `loc:subdivisionType`.
pub subdivision_type: Option<SubdivisionTypeEnum>,
/// XML element `loc:subdivisionCode`.
pub subdivision_code: Option<SubdivisionCode>,
/// XML element `loc:_isoNamedAreaExtension`.
pub iso_named_area_extension: Option<Box<Extension>>,
}
impl IsoNamedArea {
const FIELDS: &'static [u32] = &[0x4051d, 0xe06f6, 0xe0990, 0xe0776, 0xe051d, 0xe0be6, 0xe0be5, 0xe04ef];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe00ec);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
let mut e4 = None;
let mut e5 = None;
let mut e6 = None;
let mut e7 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x4051d => { let v = r.raw()?; r.set(&mut e0, v.map(Box::new), 1309); }
0xe06f6 => { let v = r.multilingual()?; r.set(&mut e1, v, 1782); }
0xe0990 => { let v = r.enumeration::<NamedAreaTypeEnum>()?; r.set(&mut e2, v, 2448); }
0xe0776 => { let v = r.string()?; r.set(&mut e3, v, 1910); }
0xe051d => { let v = Some(NamedAreaExtensionType::read(r)?); r.set(&mut e4, v.map(Box::new), 1309); }
0xe0be6 => { let v = r.enumeration::<SubdivisionTypeEnum>()?; r.set(&mut e5, v, 3046); }
0xe0be5 => { let v = r.string()?; r.set(&mut e6, v, 3045); }
0xe04ef => { let v = r.raw()?; r.set(&mut e7, v.map(Box::new), 1263); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e1, 1782);
r.required(&e5, 3046);
r.required(&e6, 3045);
let v = Self {
named_area_extension: e0,
area_name: e1,
named_area_type: e2,
country: e3,
loc_named_area_extension: e4,
subdivision_type: e5,
subdivision_code: e6,
iso_named_area_extension: e7,
};
r.close();
Ok(v)
}
}
impl IsoNamedArea {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.named_area_extension { w.extension("com:_namedAreaExtension", v)?; }
match &self.area_name {
Some(v) => { w.multilingual("loc:areaName", v)?; }
None => return Err(w.missing("loc:areaName")),
}
if let Some(v) = &self.named_area_type { w.enumeration("loc:namedAreaType", v.literal())?; }
if let Some(v) = &self.country { w.max_len("country", "CountryCode", v, 2)?; w.leaf("loc:country", v)?; }
if let Some(v) = &self.loc_named_area_extension { v.write(w, "loc:_namedAreaExtension", "", "")?; }
match &self.subdivision_type {
Some(v) => { w.enumeration("loc:subdivisionType", v.literal())?; }
None => return Err(w.missing("loc:subdivisionType")),
}
match &self.subdivision_code {
Some(v) => { w.max_len("subdivisionCode", "SubdivisionCode", v, 3)?; w.leaf("loc:subdivisionCode", v)?; }
None => return Err(w.missing("loc:subdivisionCode")),
}
if let Some(v) = &self.iso_named_area_extension { w.extension("loc:_isoNamedAreaExtension", v)?; }
w.end(tag)
}
}
impl IsoNamedArea {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 8];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
let mut f5 = None;
let mut f6 = None;
let mut f7 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
384 => if r.first(&mut seen[0])? { f0 = r.raw_object()?.map(Box::new); },
257 => if r.first(&mut seen[1])? { f1 = r.multilingual()?; },
1349 => if r.first(&mut seen[2])? { f2 = r.enumeration::<NamedAreaTypeEnum>()?; },
468 => if r.first(&mut seen[3])? { f3 = r.string()?; },
1144 => if r.first(&mut seen[4])? { f4 = NamedAreaExtensionType::read_json(r)?.map(Box::new); },
2210 => if r.first(&mut seen[5])? { f5 = r.enumeration::<SubdivisionTypeEnum>()?; },
2209 => if r.first(&mut seen[6])? { f6 = r.string()?; },
1116 => if r.first(&mut seen[7])? { f7 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f1, 257);
r.required(&f5, 2210);
r.required(&f6, 2209);
Ok(Self {
named_area_extension: f0,
area_name: f1,
named_area_type: f2,
country: f3,
loc_named_area_extension: f4,
subdivision_type: f5,
subdivision_code: f6,
iso_named_area_extension: f7,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(519)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.named_area_extension {
w.key(384)?;
w.extension(v)?;
}
match &self.area_name {
Some(v) => {
w.key(257)?;
w.multilingual(v)?;
}
None => w.absent(257, w.missing("areaName"))?,
}
if let Some(v) = &self.named_area_type {
w.key(1349)?;
w.enumeration(545, v.literal())?;
}
if let Some(v) = &self.country {
w.key(468)?;
w.max_len("country", "CountryCode", v, 2)?; w.string(v)?;
}
if let Some(v) = &self.loc_named_area_extension {
w.key(1144)?;
v.write_json(w, None)?;
}
match &self.subdivision_type {
Some(v) => {
w.key(2210)?;
w.enumeration(594, v.literal())?;
}
None => w.absent(2210, w.missing("subdivisionType"))?,
}
match &self.subdivision_code {
Some(v) => {
w.key(2209)?;
w.max_len("subdivisionCode", "SubdivisionCode", v, 3)?; w.string(v)?;
}
None => w.absent(2209, w.missing("subdivisionCode"))?,
}
if let Some(v) = &self.iso_named_area_extension {
w.key(1116)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:ItineraryByIndexedLocations`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct ItineraryByIndexedLocations {
/// XML element `loc:_locationReferenceExtension`.
pub location_reference_extension: Option<Box<LocationReferenceExtensionType>>,
/// XML element `loc:routeDestination`.
pub route_destination: Vec<Destination>,
/// XML element `loc:_itineraryExtension`.
pub itinerary_extension: Option<Box<Extension>>,
/// XML element `loc:locationContainedInItinerary`.
pub location_contained_in_itinerary: Vec<LocationContainedInItinerary>,
/// XML element `loc:_itineraryByIndexedLocationsExtension`.
pub itinerary_by_indexed_locations_extension: Option<Box<Extension>>,
}
impl ItineraryByIndexedLocations {
const FIELDS: &'static [u32] = &[0xe0505, 0xe0b5d, 0xe04f2, 0xe091e, 0xe04f0];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe00ee);
r.attrs_done();
let mut e0 = None;
let mut e1 = Vec::new();
let mut e2 = None;
let mut e3 = Vec::new();
let mut e4 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe0505 => { let v = Some(LocationReferenceExtensionType::read(r)?); r.set(&mut e0, v.map(Box::new), 1285); }
0xe0b5d => { let v = Destination::read(r)?; e1.extend(v); }
0xe04f2 => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1266); }
0xe091e => { let v = Some(LocationContainedInItinerary::read(r)?); e3.extend(v); }
0xe04f0 => { let v = r.raw()?; r.set(&mut e4, v.map(Box::new), 1264); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
location_reference_extension: e0,
route_destination: e1,
itinerary_extension: e2,
location_contained_in_itinerary: e3,
itinerary_by_indexed_locations_extension: e4,
};
r.close();
Ok(v)
}
}
impl ItineraryByIndexedLocations {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.location_reference_extension { v.write(w, "loc:_locationReferenceExtension", "", "")?; }
for v in &self.route_destination { v.write(w, "loc:routeDestination")?; }
if let Some(v) = &self.itinerary_extension { w.extension("loc:_itineraryExtension", v)?; }
for v in &self.location_contained_in_itinerary { v.write(w, "loc:locationContainedInItinerary", "", "")?; }
if let Some(v) = &self.itinerary_by_indexed_locations_extension { w.extension("loc:_itineraryByIndexedLocationsExtension", v)?; }
w.end(tag)
}
}
impl ItineraryByIndexedLocations {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 5];
let mut f0 = None;
let mut f1 = Vec::new();
let mut f2 = None;
let mut f3 = Vec::new();
let mut f4 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1142 => if r.first(&mut seen[0])? { f0 = LocationReferenceExtensionType::read_json(r)?.map(Box::new); },
1996 => if r.first(&mut seen[1])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = Destination::read_json(r)? { f1.push(v); } } },
1121 => if r.first(&mut seen[2])? { f2 = r.raw_object()?.map(Box::new); },
1232 => if r.first(&mut seen[3])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = LocationContainedInItinerary::read_json(r)? { f3.push(v); } } },
1118 => if r.first(&mut seen[4])? { f4 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
Ok(Self {
location_reference_extension: f0,
route_destination: f1,
itinerary_extension: f2,
location_contained_in_itinerary: f3,
itinerary_by_indexed_locations_extension: f4,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(520)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.location_reference_extension {
w.key(1142)?;
v.write_json(w, None)?;
}
if !self.route_destination.is_empty() {
w.key(1996)?;
w.begin_array()?;
for v in &self.route_destination {
w.item()?;
v.write_json(w)?;
}
w.end_array()?;
}
if let Some(v) = &self.itinerary_extension {
w.key(1121)?;
w.extension(v)?;
}
if !self.location_contained_in_itinerary.is_empty() {
w.key(1232)?;
w.begin_array()?;
for v in &self.location_contained_in_itinerary {
w.item()?;
v.write_json(w, None)?;
}
w.end_array()?;
}
if let Some(v) = &self.itinerary_by_indexed_locations_extension {
w.key(1118)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:ItineraryByReference`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct ItineraryByReference {
/// XML element `loc:_locationReferenceExtension`.
pub location_reference_extension: Option<Box<LocationReferenceExtensionType>>,
/// XML element `loc:routeDestination`.
pub route_destination: Vec<Destination>,
/// XML element `loc:_itineraryExtension`.
pub itinerary_extension: Option<Box<Extension>>,
/// XML element `loc:predefinedItineraryReference`.
pub predefined_itinerary_reference: Option<Box<com::VersionedReference>>,
/// XML element `loc:_itineraryByReferenceExtension`.
pub itinerary_by_reference_extension: Option<Box<Extension>>,
}
impl ItineraryByReference {
const FIELDS: &'static [u32] = &[0xe0505, 0xe0b5d, 0xe04f2, 0xe0aa8, 0xe04f1];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe00ef);
r.attrs_done();
let mut e0 = None;
let mut e1 = Vec::new();
let mut e2 = None;
let mut e3 = None;
let mut e4 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe0505 => { let v = Some(LocationReferenceExtensionType::read(r)?); r.set(&mut e0, v.map(Box::new), 1285); }
0xe0b5d => { let v = Destination::read(r)?; e1.extend(v); }
0xe04f2 => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1266); }
0xe0aa8 => { let v = Some(com::VersionedReference::read(r)?); r.set(&mut e3, v.map(Box::new), 2728); }
0xe04f1 => { let v = r.raw()?; r.set(&mut e4, v.map(Box::new), 1265); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e3, 2728);
let v = Self {
location_reference_extension: e0,
route_destination: e1,
itinerary_extension: e2,
predefined_itinerary_reference: e3,
itinerary_by_reference_extension: e4,
};
r.close();
Ok(v)
}
}
impl ItineraryByReference {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.location_reference_extension { v.write(w, "loc:_locationReferenceExtension", "", "")?; }
for v in &self.route_destination { v.write(w, "loc:routeDestination")?; }
if let Some(v) = &self.itinerary_extension { w.extension("loc:_itineraryExtension", v)?; }
match &self.predefined_itinerary_reference {
Some(v) => { v.write(w, "loc:predefinedItineraryReference", "", " targetClass=\"loc:PredefinedItinerary\"")?; }
None => return Err(w.missing("loc:predefinedItineraryReference")),
}
if let Some(v) = &self.itinerary_by_reference_extension { w.extension("loc:_itineraryByReferenceExtension", v)?; }
w.end(tag)
}
}
impl ItineraryByReference {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 5];
let mut f0 = None;
let mut f1 = Vec::new();
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1142 => if r.first(&mut seen[0])? { f0 = LocationReferenceExtensionType::read_json(r)?.map(Box::new); },
1996 => if r.first(&mut seen[1])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = Destination::read_json(r)? { f1.push(v); } } },
1121 => if r.first(&mut seen[2])? { f2 = r.raw_object()?.map(Box::new); },
1626 => if r.first(&mut seen[3])? { f3 = com::VersionedReference::read_json(r)?.map(Box::new); },
1120 => if r.first(&mut seen[4])? { f4 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f3, 1626);
Ok(Self {
location_reference_extension: f0,
route_destination: f1,
itinerary_extension: f2,
predefined_itinerary_reference: f3,
itinerary_by_reference_extension: f4,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(521)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.location_reference_extension {
w.key(1142)?;
v.write_json(w, None)?;
}
if !self.route_destination.is_empty() {
w.key(1996)?;
w.begin_array()?;
for v in &self.route_destination {
w.item()?;
v.write_json(w)?;
}
w.end_array()?;
}
if let Some(v) = &self.itinerary_extension {
w.key(1121)?;
w.extension(v)?;
}
match &self.predefined_itinerary_reference {
Some(v) => {
w.key(1626)?;
v.write_json(w, Some("PredefinedItinerary"))?;
}
None => w.absent(1626, w.missing("predefinedItineraryReference"))?,
}
if let Some(v) = &self.itinerary_by_reference_extension {
w.key(1120)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:Lane`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct Lane {
/// XML element `loc:laneNumber`.
pub lane_number: Option<com::Integer>,
/// XML element `loc:laneUsage`.
pub lane_usage: Option<LaneEnum>,
/// XML element `loc:_laneExtension`.
pub lane_extension: Option<Box<Extension>>,
}
impl Lane {
const FIELDS: &'static [u32] = &[0xe08ea, 0xe08ec, 0xe04f5];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe00f2);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe08ea => { let v = r.value::<i64>()?; r.set(&mut e0, v, 2282); }
0xe08ec => { let v = r.enumeration::<LaneEnum>()?; r.set(&mut e1, v, 2284); }
0xe04f5 => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1269); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
lane_number: e0,
lane_usage: e1,
lane_extension: e2,
};
r.close();
Ok(v)
}
}
impl Lane {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.lane_number { w.leaf("loc:laneNumber", v)?; }
if let Some(v) = &self.lane_usage { w.enumeration("loc:laneUsage", v.literal())?; }
if let Some(v) = &self.lane_extension { w.extension("loc:_laneExtension", v)?; }
w.end(tag)
}
}
impl Lane {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 3];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1029 => if r.first(&mut seen[0])? { f0 = r.number::<i64>()?; },
1031 => if r.first(&mut seen[1])? { f1 = r.enumeration::<LaneEnum>()?; },
1122 => if r.first(&mut seen[2])? { f2 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
Ok(Self {
lane_number: f0,
lane_usage: f1,
lane_extension: f2,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(523)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.lane_number {
w.key(1029)?;
w.integer(*v)?;
}
if let Some(v) = &self.lane_usage {
w.key(1031)?;
w.enumeration(524, v.literal())?;
}
if let Some(v) = &self.lane_extension {
w.key(1122)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:LinearElement`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct LinearElement {
/// XML element `loc:roadName`.
pub road_name: Option<MultilingualString>,
/// XML element `loc:roadNumber`.
pub road_number: Option<String>,
/// XML element `loc:linearElementReferenceModel`.
pub linear_element_reference_model: Option<String>,
/// XML element `loc:linearElementReferenceModelVersion`.
pub linear_element_reference_model_version: Option<String>,
/// XML element `loc:linearElementNature`.
pub linear_element_nature: Option<LinearElementNatureEnum>,
/// XML element `loc:_linearElementExtension`.
pub linear_element_extension: Option<Box<Extension>>,
}
impl LinearElement {
const FIELDS: &'static [u32] = &[0xe0b44, 0xe0b45, 0xe0911, 0xe0912, 0xe0910, 0xe04fb];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe00f5);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
let mut e4 = None;
let mut e5 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe0b44 => { let v = r.multilingual()?; r.set(&mut e0, v, 2884); }
0xe0b45 => { let v = r.string()?; r.set(&mut e1, v, 2885); }
0xe0911 => { let v = r.string()?; r.set(&mut e2, v, 2321); }
0xe0912 => { let v = r.string()?; r.set(&mut e3, v, 2322); }
0xe0910 => { let v = r.enumeration::<LinearElementNatureEnum>()?; r.set(&mut e4, v, 2320); }
0xe04fb => { let v = r.raw()?; r.set(&mut e5, v.map(Box::new), 1275); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
road_name: e0,
road_number: e1,
linear_element_reference_model: e2,
linear_element_reference_model_version: e3,
linear_element_nature: e4,
linear_element_extension: e5,
};
r.close();
Ok(v)
}
}
impl LinearElement {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.road_name { w.multilingual("loc:roadName", v)?; }
if let Some(v) = &self.road_number { w.max_len("roadNumber", "String", v, 1024)?; w.leaf("loc:roadNumber", v)?; }
if let Some(v) = &self.linear_element_reference_model { w.max_len("linearElementReferenceModel", "String", v, 1024)?; w.leaf("loc:linearElementReferenceModel", v)?; }
if let Some(v) = &self.linear_element_reference_model_version { w.max_len("linearElementReferenceModelVersion", "String", v, 1024)?; w.leaf("loc:linearElementReferenceModelVersion", v)?; }
if let Some(v) = &self.linear_element_nature { w.enumeration("loc:linearElementNature", v.literal())?; }
if let Some(v) = &self.linear_element_extension { w.extension("loc:_linearElementExtension", v)?; }
w.end(tag)
}
}
impl LinearElement {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 6];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
let mut f5 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1970 => if r.first(&mut seen[0])? { f0 = r.multilingual()?; },
1971 => if r.first(&mut seen[1])? { f1 = r.string()?; },
1068 => if r.first(&mut seen[2])? { f2 = r.string()?; },
1069 => if r.first(&mut seen[3])? { f3 = r.string()?; },
1067 => if r.first(&mut seen[4])? { f4 = r.enumeration::<LinearElementNatureEnum>()?; },
1130 => if r.first(&mut seen[5])? { f5 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
Ok(Self {
road_name: f0,
road_number: f1,
linear_element_reference_model: f2,
linear_element_reference_model_version: f3,
linear_element_nature: f4,
linear_element_extension: f5,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(526)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.road_name {
w.key(1970)?;
w.multilingual(v)?;
}
if let Some(v) = &self.road_number {
w.key(1971)?;
w.max_len("roadNumber", "String", v, 1024)?; w.string(v)?;
}
if let Some(v) = &self.linear_element_reference_model {
w.key(1068)?;
w.max_len("linearElementReferenceModel", "String", v, 1024)?; w.string(v)?;
}
if let Some(v) = &self.linear_element_reference_model_version {
w.key(1069)?;
w.max_len("linearElementReferenceModelVersion", "String", v, 1024)?; w.string(v)?;
}
if let Some(v) = &self.linear_element_nature {
w.key(1067)?;
w.enumeration(531, v.literal())?;
}
if let Some(v) = &self.linear_element_extension {
w.key(1130)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:LinearElementByCode`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct LinearElementByCode {
/// XML element `loc:roadName`.
pub road_name: Option<MultilingualString>,
/// XML element `loc:roadNumber`.
pub road_number: Option<String>,
/// XML element `loc:linearElementReferenceModel`.
pub linear_element_reference_model: Option<String>,
/// XML element `loc:linearElementReferenceModelVersion`.
pub linear_element_reference_model_version: Option<String>,
/// XML element `loc:linearElementNature`.
pub linear_element_nature: Option<LinearElementNatureEnum>,
/// XML element `loc:_linearElementExtension`.
pub linear_element_extension: Option<Box<Extension>>,
/// XML element `loc:linearElementIdentifier`.
pub linear_element_identifier: Option<String>,
/// XML element `loc:_linearElementByCodeExtension`.
pub linear_element_by_code_extension: Option<Box<Extension>>,
}
impl LinearElementByCode {
const FIELDS: &'static [u32] = &[0xe0b44, 0xe0b45, 0xe0911, 0xe0912, 0xe0910, 0xe04fb, 0xe090f, 0xe04f8];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe00f6);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
let mut e4 = None;
let mut e5 = None;
let mut e6 = None;
let mut e7 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe0b44 => { let v = r.multilingual()?; r.set(&mut e0, v, 2884); }
0xe0b45 => { let v = r.string()?; r.set(&mut e1, v, 2885); }
0xe0911 => { let v = r.string()?; r.set(&mut e2, v, 2321); }
0xe0912 => { let v = r.string()?; r.set(&mut e3, v, 2322); }
0xe0910 => { let v = r.enumeration::<LinearElementNatureEnum>()?; r.set(&mut e4, v, 2320); }
0xe04fb => { let v = r.raw()?; r.set(&mut e5, v.map(Box::new), 1275); }
0xe090f => { let v = r.string()?; r.set(&mut e6, v, 2319); }
0xe04f8 => { let v = r.raw()?; r.set(&mut e7, v.map(Box::new), 1272); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e6, 2319);
let v = Self {
road_name: e0,
road_number: e1,
linear_element_reference_model: e2,
linear_element_reference_model_version: e3,
linear_element_nature: e4,
linear_element_extension: e5,
linear_element_identifier: e6,
linear_element_by_code_extension: e7,
};
r.close();
Ok(v)
}
}
impl LinearElementByCode {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.road_name { w.multilingual("loc:roadName", v)?; }
if let Some(v) = &self.road_number { w.max_len("roadNumber", "String", v, 1024)?; w.leaf("loc:roadNumber", v)?; }
if let Some(v) = &self.linear_element_reference_model { w.max_len("linearElementReferenceModel", "String", v, 1024)?; w.leaf("loc:linearElementReferenceModel", v)?; }
if let Some(v) = &self.linear_element_reference_model_version { w.max_len("linearElementReferenceModelVersion", "String", v, 1024)?; w.leaf("loc:linearElementReferenceModelVersion", v)?; }
if let Some(v) = &self.linear_element_nature { w.enumeration("loc:linearElementNature", v.literal())?; }
if let Some(v) = &self.linear_element_extension { w.extension("loc:_linearElementExtension", v)?; }
match &self.linear_element_identifier {
Some(v) => { w.max_len("linearElementIdentifier", "String", v, 1024)?; w.leaf("loc:linearElementIdentifier", v)?; }
None => return Err(w.missing("loc:linearElementIdentifier")),
}
if let Some(v) = &self.linear_element_by_code_extension { w.extension("loc:_linearElementByCodeExtension", v)?; }
w.end(tag)
}
}
impl LinearElementByCode {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 8];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
let mut f5 = None;
let mut f6 = None;
let mut f7 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1970 => if r.first(&mut seen[0])? { f0 = r.multilingual()?; },
1971 => if r.first(&mut seen[1])? { f1 = r.string()?; },
1068 => if r.first(&mut seen[2])? { f2 = r.string()?; },
1069 => if r.first(&mut seen[3])? { f3 = r.string()?; },
1067 => if r.first(&mut seen[4])? { f4 = r.enumeration::<LinearElementNatureEnum>()?; },
1130 => if r.first(&mut seen[5])? { f5 = r.raw_object()?.map(Box::new); },
1066 => if r.first(&mut seen[6])? { f6 = r.string()?; },
1125 => if r.first(&mut seen[7])? { f7 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f6, 1066);
Ok(Self {
road_name: f0,
road_number: f1,
linear_element_reference_model: f2,
linear_element_reference_model_version: f3,
linear_element_nature: f4,
linear_element_extension: f5,
linear_element_identifier: f6,
linear_element_by_code_extension: f7,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(527)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.road_name {
w.key(1970)?;
w.multilingual(v)?;
}
if let Some(v) = &self.road_number {
w.key(1971)?;
w.max_len("roadNumber", "String", v, 1024)?; w.string(v)?;
}
if let Some(v) = &self.linear_element_reference_model {
w.key(1068)?;
w.max_len("linearElementReferenceModel", "String", v, 1024)?; w.string(v)?;
}
if let Some(v) = &self.linear_element_reference_model_version {
w.key(1069)?;
w.max_len("linearElementReferenceModelVersion", "String", v, 1024)?; w.string(v)?;
}
if let Some(v) = &self.linear_element_nature {
w.key(1067)?;
w.enumeration(531, v.literal())?;
}
if let Some(v) = &self.linear_element_extension {
w.key(1130)?;
w.extension(v)?;
}
match &self.linear_element_identifier {
Some(v) => {
w.key(1066)?;
w.max_len("linearElementIdentifier", "String", v, 1024)?; w.string(v)?;
}
None => w.absent(1066, w.missing("linearElementIdentifier"))?,
}
if let Some(v) = &self.linear_element_by_code_extension {
w.key(1125)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:LinearElementByLineString`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct LinearElementByLineString {
/// XML element `loc:roadName`.
pub road_name: Option<MultilingualString>,
/// XML element `loc:roadNumber`.
pub road_number: Option<String>,
/// XML element `loc:linearElementReferenceModel`.
pub linear_element_reference_model: Option<String>,
/// XML element `loc:linearElementReferenceModelVersion`.
pub linear_element_reference_model_version: Option<String>,
/// XML element `loc:linearElementNature`.
pub linear_element_nature: Option<LinearElementNatureEnum>,
/// XML element `loc:_linearElementExtension`.
pub linear_element_extension: Option<Box<Extension>>,
/// XML element `loc:gmlLineString`.
pub gml_line_string: Option<AnyGmlLineString>,
/// XML element `loc:_linearElementByLineStringExtension`.
pub linear_element_by_line_string_extension: Option<Box<Extension>>,
}
impl LinearElementByLineString {
const FIELDS: &'static [u32] = &[0xe0b44, 0xe0b45, 0xe0911, 0xe0912, 0xe0910, 0xe04fb, 0xe0881, 0xe04f9];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe00f7);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
let mut e4 = None;
let mut e5 = None;
let mut e6 = None;
let mut e7 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe0b44 => { let v = r.multilingual()?; r.set(&mut e0, v, 2884); }
0xe0b45 => { let v = r.string()?; r.set(&mut e1, v, 2885); }
0xe0911 => { let v = r.string()?; r.set(&mut e2, v, 2321); }
0xe0912 => { let v = r.string()?; r.set(&mut e3, v, 2322); }
0xe0910 => { let v = r.enumeration::<LinearElementNatureEnum>()?; r.set(&mut e4, v, 2320); }
0xe04fb => { let v = r.raw()?; r.set(&mut e5, v.map(Box::new), 1275); }
0xe0881 => { let v = AnyGmlLineString::read(r)?; r.set(&mut e6, v, 2177); }
0xe04f9 => { let v = r.raw()?; r.set(&mut e7, v.map(Box::new), 1273); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e6, 2177);
let v = Self {
road_name: e0,
road_number: e1,
linear_element_reference_model: e2,
linear_element_reference_model_version: e3,
linear_element_nature: e4,
linear_element_extension: e5,
gml_line_string: e6,
linear_element_by_line_string_extension: e7,
};
r.close();
Ok(v)
}
}
impl LinearElementByLineString {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.road_name { w.multilingual("loc:roadName", v)?; }
if let Some(v) = &self.road_number { w.max_len("roadNumber", "String", v, 1024)?; w.leaf("loc:roadNumber", v)?; }
if let Some(v) = &self.linear_element_reference_model { w.max_len("linearElementReferenceModel", "String", v, 1024)?; w.leaf("loc:linearElementReferenceModel", v)?; }
if let Some(v) = &self.linear_element_reference_model_version { w.max_len("linearElementReferenceModelVersion", "String", v, 1024)?; w.leaf("loc:linearElementReferenceModelVersion", v)?; }
if let Some(v) = &self.linear_element_nature { w.enumeration("loc:linearElementNature", v.literal())?; }
if let Some(v) = &self.linear_element_extension { w.extension("loc:_linearElementExtension", v)?; }
match &self.gml_line_string {
Some(v) => { v.write(w, "loc:gmlLineString")?; }
None => return Err(w.missing("loc:gmlLineString")),
}
if let Some(v) = &self.linear_element_by_line_string_extension { w.extension("loc:_linearElementByLineStringExtension", v)?; }
w.end(tag)
}
}
impl LinearElementByLineString {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 8];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
let mut f5 = None;
let mut f6 = None;
let mut f7 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1970 => if r.first(&mut seen[0])? { f0 = r.multilingual()?; },
1971 => if r.first(&mut seen[1])? { f1 = r.string()?; },
1068 => if r.first(&mut seen[2])? { f2 = r.string()?; },
1069 => if r.first(&mut seen[3])? { f3 = r.string()?; },
1067 => if r.first(&mut seen[4])? { f4 = r.enumeration::<LinearElementNatureEnum>()?; },
1130 => if r.first(&mut seen[5])? { f5 = r.raw_object()?.map(Box::new); },
922 => if r.first(&mut seen[6])? { f6 = AnyGmlLineString::read_json(r)?; },
1127 => if r.first(&mut seen[7])? { f7 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f6, 922);
Ok(Self {
road_name: f0,
road_number: f1,
linear_element_reference_model: f2,
linear_element_reference_model_version: f3,
linear_element_nature: f4,
linear_element_extension: f5,
gml_line_string: f6,
linear_element_by_line_string_extension: f7,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(528)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.road_name {
w.key(1970)?;
w.multilingual(v)?;
}
if let Some(v) = &self.road_number {
w.key(1971)?;
w.max_len("roadNumber", "String", v, 1024)?; w.string(v)?;
}
if let Some(v) = &self.linear_element_reference_model {
w.key(1068)?;
w.max_len("linearElementReferenceModel", "String", v, 1024)?; w.string(v)?;
}
if let Some(v) = &self.linear_element_reference_model_version {
w.key(1069)?;
w.max_len("linearElementReferenceModelVersion", "String", v, 1024)?; w.string(v)?;
}
if let Some(v) = &self.linear_element_nature {
w.key(1067)?;
w.enumeration(531, v.literal())?;
}
if let Some(v) = &self.linear_element_extension {
w.key(1130)?;
w.extension(v)?;
}
match &self.gml_line_string {
Some(v) => {
w.key(922)?;
v.write_json(w)?;
}
None => w.absent(922, w.missing("gmlLineString"))?,
}
if let Some(v) = &self.linear_element_by_line_string_extension {
w.key(1127)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:LinearElementByPoints`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct LinearElementByPoints {
/// XML element `loc:roadName`.
pub road_name: Option<MultilingualString>,
/// XML element `loc:roadNumber`.
pub road_number: Option<String>,
/// XML element `loc:linearElementReferenceModel`.
pub linear_element_reference_model: Option<String>,
/// XML element `loc:linearElementReferenceModelVersion`.
pub linear_element_reference_model_version: Option<String>,
/// XML element `loc:linearElementNature`.
pub linear_element_nature: Option<LinearElementNatureEnum>,
/// XML element `loc:_linearElementExtension`.
pub linear_element_extension: Option<Box<Extension>>,
/// XML element `loc:startPointOfLinearElement`.
pub start_point_of_linear_element: Option<Box<Referent>>,
/// XML element `loc:intermediatePointOnLinearElement`.
pub intermediate_point_on_linear_element: Vec<IntermediatePointOnLinearElement>,
/// XML element `loc:endPointOfLinearElement`.
pub end_point_of_linear_element: Option<Box<Referent>>,
/// XML element `loc:_linearElementByPointsExtension`.
pub linear_element_by_points_extension: Option<Box<Extension>>,
}
impl LinearElementByPoints {
const FIELDS: &'static [u32] = &[0xe0b44, 0xe0b45, 0xe0911, 0xe0912, 0xe0910, 0xe04fb, 0xe0bc9, 0xe08cd, 0xe07fd, 0xe04fa];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe00f8);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
let mut e4 = None;
let mut e5 = None;
let mut e6 = None;
let mut e7 = Vec::new();
let mut e8 = None;
let mut e9 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe0b44 => { let v = r.multilingual()?; r.set(&mut e0, v, 2884); }
0xe0b45 => { let v = r.string()?; r.set(&mut e1, v, 2885); }
0xe0911 => { let v = r.string()?; r.set(&mut e2, v, 2321); }
0xe0912 => { let v = r.string()?; r.set(&mut e3, v, 2322); }
0xe0910 => { let v = r.enumeration::<LinearElementNatureEnum>()?; r.set(&mut e4, v, 2320); }
0xe04fb => { let v = r.raw()?; r.set(&mut e5, v.map(Box::new), 1275); }
0xe0bc9 => { let v = Some(Referent::read(r)?); r.set(&mut e6, v.map(Box::new), 3017); }
0xe08cd => { let v = Some(IntermediatePointOnLinearElement::read(r)?); e7.extend(v); }
0xe07fd => { let v = Some(Referent::read(r)?); r.set(&mut e8, v.map(Box::new), 2045); }
0xe04fa => { let v = r.raw()?; r.set(&mut e9, v.map(Box::new), 1274); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e6, 3017);
r.required(&e8, 2045);
let v = Self {
road_name: e0,
road_number: e1,
linear_element_reference_model: e2,
linear_element_reference_model_version: e3,
linear_element_nature: e4,
linear_element_extension: e5,
start_point_of_linear_element: e6,
intermediate_point_on_linear_element: e7,
end_point_of_linear_element: e8,
linear_element_by_points_extension: e9,
};
r.close();
Ok(v)
}
}
impl LinearElementByPoints {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.road_name { w.multilingual("loc:roadName", v)?; }
if let Some(v) = &self.road_number { w.max_len("roadNumber", "String", v, 1024)?; w.leaf("loc:roadNumber", v)?; }
if let Some(v) = &self.linear_element_reference_model { w.max_len("linearElementReferenceModel", "String", v, 1024)?; w.leaf("loc:linearElementReferenceModel", v)?; }
if let Some(v) = &self.linear_element_reference_model_version { w.max_len("linearElementReferenceModelVersion", "String", v, 1024)?; w.leaf("loc:linearElementReferenceModelVersion", v)?; }
if let Some(v) = &self.linear_element_nature { w.enumeration("loc:linearElementNature", v.literal())?; }
if let Some(v) = &self.linear_element_extension { w.extension("loc:_linearElementExtension", v)?; }
match &self.start_point_of_linear_element {
Some(v) => { v.write(w, "loc:startPointOfLinearElement", "", "")?; }
None => return Err(w.missing("loc:startPointOfLinearElement")),
}
for v in &self.intermediate_point_on_linear_element { v.write(w, "loc:intermediatePointOnLinearElement", "", "")?; }
match &self.end_point_of_linear_element {
Some(v) => { v.write(w, "loc:endPointOfLinearElement", "", "")?; }
None => return Err(w.missing("loc:endPointOfLinearElement")),
}
if let Some(v) = &self.linear_element_by_points_extension { w.extension("loc:_linearElementByPointsExtension", v)?; }
w.end(tag)
}
}
impl LinearElementByPoints {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 10];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
let mut f5 = None;
let mut f6 = None;
let mut f7 = Vec::new();
let mut f8 = None;
let mut f9 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1970 => if r.first(&mut seen[0])? { f0 = r.multilingual()?; },
1971 => if r.first(&mut seen[1])? { f1 = r.string()?; },
1068 => if r.first(&mut seen[2])? { f2 = r.string()?; },
1069 => if r.first(&mut seen[3])? { f3 = r.string()?; },
1067 => if r.first(&mut seen[4])? { f4 = r.enumeration::<LinearElementNatureEnum>()?; },
1130 => if r.first(&mut seen[5])? { f5 = r.raw_object()?.map(Box::new); },
2182 => if r.first(&mut seen[6])? { f6 = Referent::read_json(r)?.map(Box::new); },
1000 => if r.first(&mut seen[7])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = IntermediatePointOnLinearElement::read_json(r)? { f7.push(v); } } },
664 => if r.first(&mut seen[8])? { f8 = Referent::read_json(r)?.map(Box::new); },
1129 => if r.first(&mut seen[9])? { f9 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f6, 2182);
r.required(&f8, 664);
Ok(Self {
road_name: f0,
road_number: f1,
linear_element_reference_model: f2,
linear_element_reference_model_version: f3,
linear_element_nature: f4,
linear_element_extension: f5,
start_point_of_linear_element: f6,
intermediate_point_on_linear_element: f7,
end_point_of_linear_element: f8,
linear_element_by_points_extension: f9,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(529)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.road_name {
w.key(1970)?;
w.multilingual(v)?;
}
if let Some(v) = &self.road_number {
w.key(1971)?;
w.max_len("roadNumber", "String", v, 1024)?; w.string(v)?;
}
if let Some(v) = &self.linear_element_reference_model {
w.key(1068)?;
w.max_len("linearElementReferenceModel", "String", v, 1024)?; w.string(v)?;
}
if let Some(v) = &self.linear_element_reference_model_version {
w.key(1069)?;
w.max_len("linearElementReferenceModelVersion", "String", v, 1024)?; w.string(v)?;
}
if let Some(v) = &self.linear_element_nature {
w.key(1067)?;
w.enumeration(531, v.literal())?;
}
if let Some(v) = &self.linear_element_extension {
w.key(1130)?;
w.extension(v)?;
}
match &self.start_point_of_linear_element {
Some(v) => {
w.key(2182)?;
v.write_json(w, None)?;
}
None => w.absent(2182, w.missing("startPointOfLinearElement"))?,
}
if !self.intermediate_point_on_linear_element.is_empty() {
w.key(1000)?;
w.begin_array()?;
for v in &self.intermediate_point_on_linear_element {
w.item()?;
v.write_json(w, None)?;
}
w.end_array()?;
}
match &self.end_point_of_linear_element {
Some(v) => {
w.key(664)?;
v.write_json(w, None)?;
}
None => w.absent(664, w.missing("endPointOfLinearElement"))?,
}
if let Some(v) = &self.linear_element_by_points_extension {
w.key(1129)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:LinearLocation`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct LinearLocation {
/// XML element `loc:_locationReferenceExtension`.
pub location_reference_extension: Option<Box<LocationReferenceExtensionType>>,
/// XML element `loc:externalReferencing`.
pub external_referencing: Vec<ExternalReferencing>,
/// XML element `loc:coordinatesForDisplay`.
pub coordinates_for_display: Option<Box<PointCoordinates>>,
/// XML element `loc:_locationExtension`.
pub location_extension: Option<Box<LocationExtensionType>>,
/// XML element `loc:supplementaryPositionalDescription`.
pub supplementary_positional_description: Option<Box<SupplementaryPositionalDescription>>,
/// XML element `loc:destination`.
pub destination: Option<Destination>,
/// XML element `loc:_networkLocationExtension`.
pub network_location_extension: Option<Box<Extension>>,
/// XML element `loc:openlrLinear`.
pub openlr_linear: Option<Box<OpenlrLinear>>,
/// XML element `loc:gmlLineString`.
pub gml_line_string: Option<AnyGmlLineString>,
/// XML element `loc:secondarySupplementaryDescription`.
pub secondary_supplementary_description: Option<Box<SupplementaryPositionalDescription>>,
/// XML element `loc:_linearLocationExtension`.
pub linear_location_extension: Option<Box<Extension>>,
}
impl LinearLocation {
const FIELDS: &'static [u32] = &[0xe0505, 0xe0845, 0xe0772, 0xe0501, 0xe0bf2, 0xe07aa, 0xe051e, 0xe09f7, 0xe0881, 0xe0b6c, 0xe04fc];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe00f9);
r.attrs_done();
let mut e0 = None;
let mut e1 = Vec::new();
let mut e2 = None;
let mut e3 = None;
let mut e4 = None;
let mut e5 = None;
let mut e6 = None;
let mut e7 = None;
let mut e8 = None;
let mut e9 = None;
let mut e10 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe0505 => { let v = Some(LocationReferenceExtensionType::read(r)?); r.set(&mut e0, v.map(Box::new), 1285); }
0xe0845 => { let v = Some(ExternalReferencing::read(r)?); e1.extend(v); }
0xe0772 => { let v = Some(PointCoordinates::read(r)?); r.set(&mut e2, v.map(Box::new), 1906); }
0xe0501 => { let v = Some(LocationExtensionType::read(r)?); r.set(&mut e3, v.map(Box::new), 1281); }
0xe0bf2 => { let v = Some(SupplementaryPositionalDescription::read(r)?); r.set(&mut e4, v.map(Box::new), 3058); }
0xe07aa => { let v = Destination::read(r)?; r.set(&mut e5, v, 1962); }
0xe051e => { let v = r.raw()?; r.set(&mut e6, v.map(Box::new), 1310); }
0xe09f7 => { let v = Some(OpenlrLinear::read(r)?); r.set(&mut e7, v.map(Box::new), 2551); }
0xe0881 => { let v = AnyGmlLineString::read(r)?; r.set(&mut e8, v, 2177); }
0xe0b6c => { let v = Some(SupplementaryPositionalDescription::read(r)?); r.set(&mut e9, v.map(Box::new), 2924); }
0xe04fc => { let v = r.raw()?; r.set(&mut e10, v.map(Box::new), 1276); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
location_reference_extension: e0,
external_referencing: e1,
coordinates_for_display: e2,
location_extension: e3,
supplementary_positional_description: e4,
destination: e5,
network_location_extension: e6,
openlr_linear: e7,
gml_line_string: e8,
secondary_supplementary_description: e9,
linear_location_extension: e10,
};
r.close();
Ok(v)
}
}
impl LinearLocation {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.location_reference_extension { v.write(w, "loc:_locationReferenceExtension", "", "")?; }
for v in &self.external_referencing { v.write(w, "loc:externalReferencing", "", "")?; }
if let Some(v) = &self.coordinates_for_display { v.write(w, "loc:coordinatesForDisplay", "", "")?; }
if let Some(v) = &self.location_extension { v.write(w, "loc:_locationExtension", "", "")?; }
if let Some(v) = &self.supplementary_positional_description { v.write(w, "loc:supplementaryPositionalDescription", "", "")?; }
if let Some(v) = &self.destination { v.write(w, "loc:destination")?; }
if let Some(v) = &self.network_location_extension { w.extension("loc:_networkLocationExtension", v)?; }
if let Some(v) = &self.openlr_linear { v.write(w, "loc:openlrLinear", "", "")?; }
if let Some(v) = &self.gml_line_string { v.write(w, "loc:gmlLineString")?; }
if let Some(v) = &self.secondary_supplementary_description { v.write(w, "loc:secondarySupplementaryDescription", "", "")?; }
if let Some(v) = &self.linear_location_extension { w.extension("loc:_linearLocationExtension", v)?; }
w.end(tag)
}
}
impl LinearLocation {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 11];
let mut f0 = None;
let mut f1 = Vec::new();
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
let mut f5 = None;
let mut f6 = None;
let mut f7 = None;
let mut f8 = None;
let mut f9 = None;
let mut f10 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1142 => if r.first(&mut seen[0])? { f0 = LocationReferenceExtensionType::read_json(r)?.map(Box::new); },
744 => if r.first(&mut seen[1])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = ExternalReferencing::read_json(r)? { f1.push(v); } } },
464 => if r.first(&mut seen[2])? { f2 = PointCoordinates::read_json(r)?.map(Box::new); },
1136 => if r.first(&mut seen[3])? { f3 = LocationExtensionType::read_json(r)?.map(Box::new); },
2222 => if r.first(&mut seen[4])? { f4 = SupplementaryPositionalDescription::read_json(r)?.map(Box::new); },
547 => if r.first(&mut seen[5])? { f5 = Destination::read_json(r)?; },
1145 => if r.first(&mut seen[6])? { f6 = r.raw_object()?.map(Box::new); },
1451 => if r.first(&mut seen[7])? { f7 = OpenlrLinear::read_json(r)?.map(Box::new); },
922 => if r.first(&mut seen[8])? { f8 = AnyGmlLineString::read_json(r)?; },
2011 => if r.first(&mut seen[9])? { f9 = SupplementaryPositionalDescription::read_json(r)?.map(Box::new); },
1132 => if r.first(&mut seen[10])? { f10 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
Ok(Self {
location_reference_extension: f0,
external_referencing: f1,
coordinates_for_display: f2,
location_extension: f3,
supplementary_positional_description: f4,
destination: f5,
network_location_extension: f6,
openlr_linear: f7,
gml_line_string: f8,
secondary_supplementary_description: f9,
linear_location_extension: f10,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(532)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.location_reference_extension {
w.key(1142)?;
v.write_json(w, None)?;
}
if !self.external_referencing.is_empty() {
w.key(744)?;
w.begin_array()?;
for v in &self.external_referencing {
w.item()?;
v.write_json(w, None)?;
}
w.end_array()?;
}
if let Some(v) = &self.coordinates_for_display {
w.key(464)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.location_extension {
w.key(1136)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.supplementary_positional_description {
w.key(2222)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.destination {
w.key(547)?;
v.write_json(w)?;
}
if let Some(v) = &self.network_location_extension {
w.key(1145)?;
w.extension(v)?;
}
if let Some(v) = &self.openlr_linear {
w.key(1451)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.gml_line_string {
w.key(922)?;
v.write_json(w)?;
}
if let Some(v) = &self.secondary_supplementary_description {
w.key(2011)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.linear_location_extension {
w.key(1132)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:LinearWithinLinearElement`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct LinearWithinLinearElement {
/// XML element `loc:administrativeAreaOfLinearSection`.
pub administrative_area_of_linear_section: Option<MultilingualString>,
/// XML element `loc:directionOnLinearSection`.
pub direction_on_linear_section: Option<DirectionEnum>,
/// XML element `loc:directionRelativeOnLinearSection`.
pub direction_relative_on_linear_section: Option<LinearDirectionEnum>,
/// XML element `loc:heightGradeOfLinearSection`.
pub height_grade_of_linear_section: Option<HeightGradeEnum>,
/// XML element `loc:linearElement`.
pub linear_element: Option<AnyLinearElement>,
/// XML element `loc:fromPoint`.
pub from_point: Option<DistanceAlongLinearElement>,
/// XML element `loc:toPoint`.
pub to_point: Option<DistanceAlongLinearElement>,
/// XML element `loc:_linearWithinLinearElementExtension`.
pub linear_within_linear_element_extension: Option<Box<Extension>>,
}
impl LinearWithinLinearElement {
const FIELDS: &'static [u32] = &[0xe06be, 0xe07bc, 0xe07bf, 0xe089c, 0xe090e, 0xe086f, 0xe0c26, 0xe04fd];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe00fa);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
let mut e4 = None;
let mut e5 = None;
let mut e6 = None;
let mut e7 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe06be => { let v = r.multilingual()?; r.set(&mut e0, v, 1726); }
0xe07bc => { let v = r.enumeration::<DirectionEnum>()?; r.set(&mut e1, v, 1980); }
0xe07bf => { let v = r.enumeration::<LinearDirectionEnum>()?; r.set(&mut e2, v, 1983); }
0xe089c => { let v = r.enumeration::<HeightGradeEnum>()?; r.set(&mut e3, v, 2204); }
0xe090e => { let v = AnyLinearElement::read(r)?; r.set(&mut e4, v, 2318); }
0xe086f => { let v = DistanceAlongLinearElement::read(r)?; r.set(&mut e5, v, 2159); }
0xe0c26 => { let v = DistanceAlongLinearElement::read(r)?; r.set(&mut e6, v, 3110); }
0xe04fd => { let v = r.raw()?; r.set(&mut e7, v.map(Box::new), 1277); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e4, 2318);
r.required(&e5, 2159);
r.required(&e6, 3110);
let v = Self {
administrative_area_of_linear_section: e0,
direction_on_linear_section: e1,
direction_relative_on_linear_section: e2,
height_grade_of_linear_section: e3,
linear_element: e4,
from_point: e5,
to_point: e6,
linear_within_linear_element_extension: e7,
};
r.close();
Ok(v)
}
}
impl LinearWithinLinearElement {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.administrative_area_of_linear_section { w.multilingual("loc:administrativeAreaOfLinearSection", v)?; }
if let Some(v) = &self.direction_on_linear_section { w.enumeration("loc:directionOnLinearSection", v.literal())?; }
if let Some(v) = &self.direction_relative_on_linear_section { w.enumeration("loc:directionRelativeOnLinearSection", v.literal())?; }
if let Some(v) = &self.height_grade_of_linear_section { w.enumeration("loc:heightGradeOfLinearSection", v.literal())?; }
match &self.linear_element {
Some(v) => { v.write(w, "loc:linearElement")?; }
None => return Err(w.missing("loc:linearElement")),
}
match &self.from_point {
Some(v) => { v.write(w, "loc:fromPoint")?; }
None => return Err(w.missing("loc:fromPoint")),
}
match &self.to_point {
Some(v) => { v.write(w, "loc:toPoint")?; }
None => return Err(w.missing("loc:toPoint")),
}
if let Some(v) = &self.linear_within_linear_element_extension { w.extension("loc:_linearWithinLinearElementExtension", v)?; }
w.end(tag)
}
}
impl LinearWithinLinearElement {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 8];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
let mut f5 = None;
let mut f6 = None;
let mut f7 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
66 => if r.first(&mut seen[0])? { f0 = r.multilingual()?; },
565 => if r.first(&mut seen[1])? { f1 = r.enumeration::<DirectionEnum>()?; },
568 => if r.first(&mut seen[2])? { f2 = r.enumeration::<LinearDirectionEnum>()?; },
949 => if r.first(&mut seen[3])? { f3 = r.enumeration::<HeightGradeEnum>()?; },
1065 => if r.first(&mut seen[4])? { f4 = AnyLinearElement::read_json(r)?; },
869 => if r.first(&mut seen[5])? { f5 = DistanceAlongLinearElement::read_json(r)?; },
2335 => if r.first(&mut seen[6])? { f6 = DistanceAlongLinearElement::read_json(r)?; },
1133 => if r.first(&mut seen[7])? { f7 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f4, 1065);
r.required(&f5, 869);
r.required(&f6, 2335);
Ok(Self {
administrative_area_of_linear_section: f0,
direction_on_linear_section: f1,
direction_relative_on_linear_section: f2,
height_grade_of_linear_section: f3,
linear_element: f4,
from_point: f5,
to_point: f6,
linear_within_linear_element_extension: f7,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(533)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.administrative_area_of_linear_section {
w.key(66)?;
w.multilingual(v)?;
}
if let Some(v) = &self.direction_on_linear_section {
w.key(565)?;
w.enumeration(503, v.literal())?;
}
if let Some(v) = &self.direction_relative_on_linear_section {
w.key(568)?;
w.enumeration(525, v.literal())?;
}
if let Some(v) = &self.height_grade_of_linear_section {
w.key(949)?;
w.enumeration(516, v.literal())?;
}
match &self.linear_element {
Some(v) => {
w.key(1065)?;
v.write_json(w)?;
}
None => w.absent(1065, w.missing("linearElement"))?,
}
match &self.from_point {
Some(v) => {
w.key(869)?;
v.write_json(w)?;
}
None => w.absent(869, w.missing("fromPoint"))?,
}
match &self.to_point {
Some(v) => {
w.key(2335)?;
v.write_json(w)?;
}
None => w.absent(2335, w.missing("toPoint"))?,
}
if let Some(v) = &self.linear_within_linear_element_extension {
w.key(1133)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:LocationByReference`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct LocationByReference {
/// XML element `loc:_locationReferenceExtension`.
pub location_reference_extension: Option<Box<LocationReferenceExtensionType>>,
/// XML element `loc:externalReferencing`.
pub external_referencing: Vec<ExternalReferencing>,
/// XML element `loc:coordinatesForDisplay`.
pub coordinates_for_display: Option<Box<PointCoordinates>>,
/// XML element `loc:_locationExtension`.
pub location_extension: Option<Box<LocationExtensionType>>,
/// XML element `loc:predefinedLocationReference`.
pub predefined_location_reference: Option<Box<com::VersionedReference>>,
/// XML element `loc:_locationByReferenceExtension`.
pub location_by_reference_extension: Option<Box<Extension>>,
}
impl LocationByReference {
const FIELDS: &'static [u32] = &[0xe0505, 0xe0845, 0xe0772, 0xe0501, 0xe0aad, 0xe04ff];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe00fd);
r.attrs_done();
let mut e0 = None;
let mut e1 = Vec::new();
let mut e2 = None;
let mut e3 = None;
let mut e4 = None;
let mut e5 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe0505 => { let v = Some(LocationReferenceExtensionType::read(r)?); r.set(&mut e0, v.map(Box::new), 1285); }
0xe0845 => { let v = Some(ExternalReferencing::read(r)?); e1.extend(v); }
0xe0772 => { let v = Some(PointCoordinates::read(r)?); r.set(&mut e2, v.map(Box::new), 1906); }
0xe0501 => { let v = Some(LocationExtensionType::read(r)?); r.set(&mut e3, v.map(Box::new), 1281); }
0xe0aad => { let v = Some(com::VersionedReference::read(r)?); r.set(&mut e4, v.map(Box::new), 2733); }
0xe04ff => { let v = r.raw()?; r.set(&mut e5, v.map(Box::new), 1279); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e4, 2733);
let v = Self {
location_reference_extension: e0,
external_referencing: e1,
coordinates_for_display: e2,
location_extension: e3,
predefined_location_reference: e4,
location_by_reference_extension: e5,
};
r.close();
Ok(v)
}
}
impl LocationByReference {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.location_reference_extension { v.write(w, "loc:_locationReferenceExtension", "", "")?; }
for v in &self.external_referencing { v.write(w, "loc:externalReferencing", "", "")?; }
if let Some(v) = &self.coordinates_for_display { v.write(w, "loc:coordinatesForDisplay", "", "")?; }
if let Some(v) = &self.location_extension { v.write(w, "loc:_locationExtension", "", "")?; }
match &self.predefined_location_reference {
Some(v) => { v.write(w, "loc:predefinedLocationReference", "", " targetClass=\"loc:PredefinedLocation\"")?; }
None => return Err(w.missing("loc:predefinedLocationReference")),
}
if let Some(v) = &self.location_by_reference_extension { w.extension("loc:_locationByReferenceExtension", v)?; }
w.end(tag)
}
}
impl LocationByReference {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 6];
let mut f0 = None;
let mut f1 = Vec::new();
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
let mut f5 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1142 => if r.first(&mut seen[0])? { f0 = LocationReferenceExtensionType::read_json(r)?.map(Box::new); },
744 => if r.first(&mut seen[1])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = ExternalReferencing::read_json(r)? { f1.push(v); } } },
464 => if r.first(&mut seen[2])? { f2 = PointCoordinates::read_json(r)?.map(Box::new); },
1136 => if r.first(&mut seen[3])? { f3 = LocationExtensionType::read_json(r)?.map(Box::new); },
1631 => if r.first(&mut seen[4])? { f4 = com::VersionedReference::read_json(r)?.map(Box::new); },
1135 => if r.first(&mut seen[5])? { f5 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f4, 1631);
Ok(Self {
location_reference_extension: f0,
external_referencing: f1,
coordinates_for_display: f2,
location_extension: f3,
predefined_location_reference: f4,
location_by_reference_extension: f5,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(534)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.location_reference_extension {
w.key(1142)?;
v.write_json(w, None)?;
}
if !self.external_referencing.is_empty() {
w.key(744)?;
w.begin_array()?;
for v in &self.external_referencing {
w.item()?;
v.write_json(w, None)?;
}
w.end_array()?;
}
if let Some(v) = &self.coordinates_for_display {
w.key(464)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.location_extension {
w.key(1136)?;
v.write_json(w, None)?;
}
match &self.predefined_location_reference {
Some(v) => {
w.key(1631)?;
v.write_json(w, Some("PredefinedLocation"))?;
}
None => w.absent(1631, w.missing("predefinedLocationReference"))?,
}
if let Some(v) = &self.location_by_reference_extension {
w.key(1135)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:LocationGroupByList`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct LocationGroupByList {
/// XML element `loc:_locationReferenceExtension`.
pub location_reference_extension: Option<Box<LocationReferenceExtensionType>>,
/// XML element `loc:_locationGroupExtension`.
pub location_group_extension: Option<Box<Extension>>,
/// XML element `loc:locationContainedInGroup`.
pub location_contained_in_group: Vec<Location>,
/// XML element `loc:_locationGroupByListExtension`.
pub location_group_by_list_extension: Option<Box<Extension>>,
}
impl LocationGroupByList {
const FIELDS: &'static [u32] = &[0xe0505, 0xe0504, 0xe091d, 0xe0502];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe0100);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = Vec::new();
let mut e3 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe0505 => { let v = Some(LocationReferenceExtensionType::read(r)?); r.set(&mut e0, v.map(Box::new), 1285); }
0xe0504 => { let v = r.raw()?; r.set(&mut e1, v.map(Box::new), 1284); }
0xe091d => { let v = Location::read(r)?; e2.extend(v); }
0xe0502 => { let v = r.raw()?; r.set(&mut e3, v.map(Box::new), 1282); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
location_reference_extension: e0,
location_group_extension: e1,
location_contained_in_group: e2,
location_group_by_list_extension: e3,
};
r.close();
Ok(v)
}
}
impl LocationGroupByList {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.location_reference_extension { v.write(w, "loc:_locationReferenceExtension", "", "")?; }
if let Some(v) = &self.location_group_extension { w.extension("loc:_locationGroupExtension", v)?; }
w.count("loc:locationContainedInGroup", self.location_contained_in_group.len(), 2, usize::MAX)?;
for v in &self.location_contained_in_group { v.write(w, "loc:locationContainedInGroup")?; }
if let Some(v) = &self.location_group_by_list_extension { w.extension("loc:_locationGroupByListExtension", v)?; }
w.end(tag)
}
}
impl LocationGroupByList {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 4];
let mut f0 = None;
let mut f1 = None;
let mut f2 = Vec::new();
let mut f3 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1142 => if r.first(&mut seen[0])? { f0 = LocationReferenceExtensionType::read_json(r)?.map(Box::new); },
1141 => if r.first(&mut seen[1])? { f1 = r.raw_object()?.map(Box::new); },
1231 => if r.first(&mut seen[2])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = Location::read_json(r)? { f2.push(v); } } },
1138 => if r.first(&mut seen[3])? { f3 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
Ok(Self {
location_reference_extension: f0,
location_group_extension: f1,
location_contained_in_group: f2,
location_group_by_list_extension: f3,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(537)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.location_reference_extension {
w.key(1142)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.location_group_extension {
w.key(1141)?;
w.extension(v)?;
}
w.count("locationContainedInGroup", self.location_contained_in_group.len(), 2, usize::MAX)?;
if !self.location_contained_in_group.is_empty() {
w.key(1231)?;
w.begin_array()?;
for v in &self.location_contained_in_group {
w.item()?;
v.write_json(w)?;
}
w.end_array()?;
}
if let Some(v) = &self.location_group_by_list_extension {
w.key(1138)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:LocationGroupByReference`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct LocationGroupByReference {
/// XML element `loc:_locationReferenceExtension`.
pub location_reference_extension: Option<Box<LocationReferenceExtensionType>>,
/// XML element `loc:_locationGroupExtension`.
pub location_group_extension: Option<Box<Extension>>,
/// XML element `loc:predefinedLocationGroupReference`.
pub predefined_location_group_reference: Option<Box<com::VersionedReference>>,
/// XML element `loc:_locationGroupByReferenceExtension`.
pub location_group_by_reference_extension: Option<Box<Extension>>,
}
impl LocationGroupByReference {
const FIELDS: &'static [u32] = &[0xe0505, 0xe0504, 0xe0aab, 0xe0503];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe0101);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe0505 => { let v = Some(LocationReferenceExtensionType::read(r)?); r.set(&mut e0, v.map(Box::new), 1285); }
0xe0504 => { let v = r.raw()?; r.set(&mut e1, v.map(Box::new), 1284); }
0xe0aab => { let v = Some(com::VersionedReference::read(r)?); r.set(&mut e2, v.map(Box::new), 2731); }
0xe0503 => { let v = r.raw()?; r.set(&mut e3, v.map(Box::new), 1283); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e2, 2731);
let v = Self {
location_reference_extension: e0,
location_group_extension: e1,
predefined_location_group_reference: e2,
location_group_by_reference_extension: e3,
};
r.close();
Ok(v)
}
}
impl LocationGroupByReference {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.location_reference_extension { v.write(w, "loc:_locationReferenceExtension", "", "")?; }
if let Some(v) = &self.location_group_extension { w.extension("loc:_locationGroupExtension", v)?; }
match &self.predefined_location_group_reference {
Some(v) => { v.write(w, "loc:predefinedLocationGroupReference", "", " targetClass=\"loc:PredefinedLocationGroup\"")?; }
None => return Err(w.missing("loc:predefinedLocationGroupReference")),
}
if let Some(v) = &self.location_group_by_reference_extension { w.extension("loc:_locationGroupByReferenceExtension", v)?; }
w.end(tag)
}
}
impl LocationGroupByReference {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 4];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1142 => if r.first(&mut seen[0])? { f0 = LocationReferenceExtensionType::read_json(r)?.map(Box::new); },
1141 => if r.first(&mut seen[1])? { f1 = r.raw_object()?.map(Box::new); },
1629 => if r.first(&mut seen[2])? { f2 = com::VersionedReference::read_json(r)?.map(Box::new); },
1140 => if r.first(&mut seen[3])? { f3 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f2, 1629);
Ok(Self {
location_reference_extension: f0,
location_group_extension: f1,
predefined_location_group_reference: f2,
location_group_by_reference_extension: f3,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(538)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.location_reference_extension {
w.key(1142)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.location_group_extension {
w.key(1141)?;
w.extension(v)?;
}
match &self.predefined_location_group_reference {
Some(v) => {
w.key(1629)?;
v.write_json(w, Some("PredefinedLocationGroup"))?;
}
None => w.absent(1629, w.missing("predefinedLocationGroupReference"))?,
}
if let Some(v) = &self.location_group_by_reference_extension {
w.key(1140)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:NamedArea`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct NamedArea {
/// XML element `com:_namedAreaExtension`.
pub named_area_extension: Option<Box<Extension>>,
/// XML element `loc:areaName`.
pub area_name: Option<MultilingualString>,
/// XML element `loc:namedAreaType`.
pub named_area_type: Option<NamedAreaTypeEnum>,
/// XML element `loc:country`.
pub country: Option<com::CountryCode>,
/// XML element `loc:_namedAreaExtension`.
pub loc_named_area_extension: Option<Box<NamedAreaExtensionType>>,
}
impl NamedArea {
const FIELDS: &'static [u32] = &[0x4051d, 0xe06f6, 0xe0990, 0xe0776, 0xe051d];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe011c);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
let mut e4 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x4051d => { let v = r.raw()?; r.set(&mut e0, v.map(Box::new), 1309); }
0xe06f6 => { let v = r.multilingual()?; r.set(&mut e1, v, 1782); }
0xe0990 => { let v = r.enumeration::<NamedAreaTypeEnum>()?; r.set(&mut e2, v, 2448); }
0xe0776 => { let v = r.string()?; r.set(&mut e3, v, 1910); }
0xe051d => { let v = Some(NamedAreaExtensionType::read(r)?); r.set(&mut e4, v.map(Box::new), 1309); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e1, 1782);
let v = Self {
named_area_extension: e0,
area_name: e1,
named_area_type: e2,
country: e3,
loc_named_area_extension: e4,
};
r.close();
Ok(v)
}
}
impl NamedArea {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.named_area_extension { w.extension("com:_namedAreaExtension", v)?; }
match &self.area_name {
Some(v) => { w.multilingual("loc:areaName", v)?; }
None => return Err(w.missing("loc:areaName")),
}
if let Some(v) = &self.named_area_type { w.enumeration("loc:namedAreaType", v.literal())?; }
if let Some(v) = &self.country { w.max_len("country", "CountryCode", v, 2)?; w.leaf("loc:country", v)?; }
if let Some(v) = &self.loc_named_area_extension { v.write(w, "loc:_namedAreaExtension", "", "")?; }
w.end(tag)
}
}
impl NamedArea {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 5];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
384 => if r.first(&mut seen[0])? { f0 = r.raw_object()?.map(Box::new); },
257 => if r.first(&mut seen[1])? { f1 = r.multilingual()?; },
1349 => if r.first(&mut seen[2])? { f2 = r.enumeration::<NamedAreaTypeEnum>()?; },
468 => if r.first(&mut seen[3])? { f3 = r.string()?; },
1144 => if r.first(&mut seen[4])? { f4 = NamedAreaExtensionType::read_json(r)?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f1, 257);
Ok(Self {
named_area_extension: f0,
area_name: f1,
named_area_type: f2,
country: f3,
loc_named_area_extension: f4,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(542)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.named_area_extension {
w.key(384)?;
w.extension(v)?;
}
match &self.area_name {
Some(v) => {
w.key(257)?;
w.multilingual(v)?;
}
None => w.absent(257, w.missing("areaName"))?,
}
if let Some(v) = &self.named_area_type {
w.key(1349)?;
w.enumeration(545, v.literal())?;
}
if let Some(v) = &self.country {
w.key(468)?;
w.max_len("country", "CountryCode", v, 2)?; w.string(v)?;
}
if let Some(v) = &self.loc_named_area_extension {
w.key(1144)?;
v.write_json(w, None)?;
}
w.end_object()
}
}
/// XML type `loc:NutsNamedArea`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct NutsNamedArea {
/// XML element `com:_namedAreaExtension`.
pub named_area_extension: Option<Box<Extension>>,
/// XML element `loc:areaName`.
pub area_name: Option<MultilingualString>,
/// XML element `loc:namedAreaType`.
pub named_area_type: Option<NamedAreaTypeEnum>,
/// XML element `loc:country`.
pub country: Option<com::CountryCode>,
/// XML element `loc:_namedAreaExtension`.
pub loc_named_area_extension: Option<Box<NamedAreaExtensionType>>,
/// XML element `loc:nutsCodeType`.
pub nuts_code_type: Option<NutsCodeTypeEnum>,
/// XML element `loc:nutsCode`.
pub nuts_code: Option<NutsCode>,
/// XML element `loc:_nutsNamedAreaExtension`.
pub nuts_named_area_extension: Option<Box<Extension>>,
}
impl NutsNamedArea {
const FIELDS: &'static [u32] = &[0x4051d, 0xe06f6, 0xe0990, 0xe0776, 0xe051d, 0xe09d9, 0xe09d8, 0xe052e];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe012f);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
let mut e4 = None;
let mut e5 = None;
let mut e6 = None;
let mut e7 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x4051d => { let v = r.raw()?; r.set(&mut e0, v.map(Box::new), 1309); }
0xe06f6 => { let v = r.multilingual()?; r.set(&mut e1, v, 1782); }
0xe0990 => { let v = r.enumeration::<NamedAreaTypeEnum>()?; r.set(&mut e2, v, 2448); }
0xe0776 => { let v = r.string()?; r.set(&mut e3, v, 1910); }
0xe051d => { let v = Some(NamedAreaExtensionType::read(r)?); r.set(&mut e4, v.map(Box::new), 1309); }
0xe09d9 => { let v = r.enumeration::<NutsCodeTypeEnum>()?; r.set(&mut e5, v, 2521); }
0xe09d8 => { let v = r.string()?; r.set(&mut e6, v, 2520); }
0xe052e => { let v = r.raw()?; r.set(&mut e7, v.map(Box::new), 1326); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e1, 1782);
r.required(&e5, 2521);
r.required(&e6, 2520);
let v = Self {
named_area_extension: e0,
area_name: e1,
named_area_type: e2,
country: e3,
loc_named_area_extension: e4,
nuts_code_type: e5,
nuts_code: e6,
nuts_named_area_extension: e7,
};
r.close();
Ok(v)
}
}
impl NutsNamedArea {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.named_area_extension { w.extension("com:_namedAreaExtension", v)?; }
match &self.area_name {
Some(v) => { w.multilingual("loc:areaName", v)?; }
None => return Err(w.missing("loc:areaName")),
}
if let Some(v) = &self.named_area_type { w.enumeration("loc:namedAreaType", v.literal())?; }
if let Some(v) = &self.country { w.max_len("country", "CountryCode", v, 2)?; w.leaf("loc:country", v)?; }
if let Some(v) = &self.loc_named_area_extension { v.write(w, "loc:_namedAreaExtension", "", "")?; }
match &self.nuts_code_type {
Some(v) => { w.enumeration("loc:nutsCodeType", v.literal())?; }
None => return Err(w.missing("loc:nutsCodeType")),
}
match &self.nuts_code {
Some(v) => { w.max_len("nutsCode", "NutsCode", v, 5)?; w.leaf("loc:nutsCode", v)?; }
None => return Err(w.missing("loc:nutsCode")),
}
if let Some(v) = &self.nuts_named_area_extension { w.extension("loc:_nutsNamedAreaExtension", v)?; }
w.end(tag)
}
}
impl NutsNamedArea {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 8];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
let mut f5 = None;
let mut f6 = None;
let mut f7 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
384 => if r.first(&mut seen[0])? { f0 = r.raw_object()?.map(Box::new); },
257 => if r.first(&mut seen[1])? { f1 = r.multilingual()?; },
1349 => if r.first(&mut seen[2])? { f2 = r.enumeration::<NamedAreaTypeEnum>()?; },
468 => if r.first(&mut seen[3])? { f3 = r.string()?; },
1144 => if r.first(&mut seen[4])? { f4 = NamedAreaExtensionType::read_json(r)?.map(Box::new); },
1421 => if r.first(&mut seen[5])? { f5 = r.enumeration::<NutsCodeTypeEnum>()?; },
1420 => if r.first(&mut seen[6])? { f6 = r.string()?; },
1147 => if r.first(&mut seen[7])? { f7 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f1, 257);
r.required(&f5, 1421);
r.required(&f6, 1420);
Ok(Self {
named_area_extension: f0,
area_name: f1,
named_area_type: f2,
country: f3,
loc_named_area_extension: f4,
nuts_code_type: f5,
nuts_code: f6,
nuts_named_area_extension: f7,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(548)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.named_area_extension {
w.key(384)?;
w.extension(v)?;
}
match &self.area_name {
Some(v) => {
w.key(257)?;
w.multilingual(v)?;
}
None => w.absent(257, w.missing("areaName"))?,
}
if let Some(v) = &self.named_area_type {
w.key(1349)?;
w.enumeration(545, v.literal())?;
}
if let Some(v) = &self.country {
w.key(468)?;
w.max_len("country", "CountryCode", v, 2)?; w.string(v)?;
}
if let Some(v) = &self.loc_named_area_extension {
w.key(1144)?;
v.write_json(w, None)?;
}
match &self.nuts_code_type {
Some(v) => {
w.key(1421)?;
w.enumeration(547, v.literal())?;
}
None => w.absent(1421, w.missing("nutsCodeType"))?,
}
match &self.nuts_code {
Some(v) => {
w.key(1420)?;
w.max_len("nutsCode", "NutsCode", v, 5)?; w.string(v)?;
}
None => w.absent(1420, w.missing("nutsCode"))?,
}
if let Some(v) = &self.nuts_named_area_extension {
w.key(1147)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:OffsetDistance`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct OffsetDistance {
/// XML element `loc:offsetDistance`.
pub offset_distance: Option<com::MetresAsNonNegativeInteger>,
/// XML element `loc:_offsetDistanceExtension`.
pub offset_distance_extension: Option<Box<Extension>>,
}
impl OffsetDistance {
const FIELDS: &'static [u32] = &[0xe09e9, 0xe0535];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe0136);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe09e9 => { let v = r.value::<u64>()?; r.set(&mut e0, v, 2537); }
0xe0535 => { let v = r.raw()?; r.set(&mut e1, v.map(Box::new), 1333); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 2537);
let v = Self {
offset_distance: e0,
offset_distance_extension: e1,
};
r.close();
Ok(v)
}
}
impl OffsetDistance {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
match &self.offset_distance {
Some(v) => { w.leaf("loc:offsetDistance", v)?; }
None => return Err(w.missing("loc:offsetDistance")),
}
if let Some(v) = &self.offset_distance_extension { w.extension("loc:_offsetDistanceExtension", v)?; }
w.end(tag)
}
}
impl OffsetDistance {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 2];
let mut f0 = None;
let mut f1 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1437 => if r.first(&mut seen[0])? { f0 = r.number::<u64>()?; },
1148 => if r.first(&mut seen[1])? { f1 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 1437);
Ok(Self {
offset_distance: f0,
offset_distance_extension: f1,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(549)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.offset_distance {
Some(v) => {
w.key(1437)?;
w.integer(*v)?;
}
None => w.absent(1437, w.missing("offsetDistance"))?,
}
if let Some(v) = &self.offset_distance_extension {
w.key(1148)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:OpenlrCircleLocationReference`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct OpenlrCircleLocationReference {
/// XML element `loc:_openlrAreaLocationReferenceExtension`.
pub openlr_area_location_reference_extension: Option<Box<Extension>>,
/// XML element `loc:openlrRadius`.
pub openlr_radius: Option<com::MetresAsNonNegativeInteger>,
/// XML element `loc:openlrGeoCoordinate`.
pub openlr_geo_coordinate: Option<Box<OpenlrGeoCoordinate>>,
/// XML element `loc:_openlrCircleLocationReferenceExtension`.
pub openlr_circle_location_reference_extension: Option<Box<Extension>>,
}
impl OpenlrCircleLocationReference {
const FIELDS: &'static [u32] = &[0xe0537, 0xe0a04, 0xe09f3, 0xe053a];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe013b);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe0537 => { let v = r.raw()?; r.set(&mut e0, v.map(Box::new), 1335); }
0xe0a04 => { let v = r.value::<u64>()?; r.set(&mut e1, v, 2564); }
0xe09f3 => { let v = Some(OpenlrGeoCoordinate::read(r)?); r.set(&mut e2, v.map(Box::new), 2547); }
0xe053a => { let v = r.raw()?; r.set(&mut e3, v.map(Box::new), 1338); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e1, 2564);
r.required(&e2, 2547);
let v = Self {
openlr_area_location_reference_extension: e0,
openlr_radius: e1,
openlr_geo_coordinate: e2,
openlr_circle_location_reference_extension: e3,
};
r.close();
Ok(v)
}
}
impl OpenlrCircleLocationReference {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.openlr_area_location_reference_extension { w.extension("loc:_openlrAreaLocationReferenceExtension", v)?; }
match &self.openlr_radius {
Some(v) => { w.leaf("loc:openlrRadius", v)?; }
None => return Err(w.missing("loc:openlrRadius")),
}
match &self.openlr_geo_coordinate {
Some(v) => { v.write(w, "loc:openlrGeoCoordinate", "", "")?; }
None => return Err(w.missing("loc:openlrGeoCoordinate")),
}
if let Some(v) = &self.openlr_circle_location_reference_extension { w.extension("loc:_openlrCircleLocationReferenceExtension", v)?; }
w.end(tag)
}
}
impl OpenlrCircleLocationReference {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 4];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1149 => if r.first(&mut seen[0])? { f0 = r.raw_object()?.map(Box::new); },
1464 => if r.first(&mut seen[1])? { f1 = r.number::<u64>()?; },
1447 => if r.first(&mut seen[2])? { f2 = OpenlrGeoCoordinate::read_json(r)?.map(Box::new); },
1153 => if r.first(&mut seen[3])? { f3 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f1, 1464);
r.required(&f2, 1447);
Ok(Self {
openlr_area_location_reference_extension: f0,
openlr_radius: f1,
openlr_geo_coordinate: f2,
openlr_circle_location_reference_extension: f3,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(551)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.openlr_area_location_reference_extension {
w.key(1149)?;
w.extension(v)?;
}
match &self.openlr_radius {
Some(v) => {
w.key(1464)?;
w.integer(*v)?;
}
None => w.absent(1464, w.missing("openlrRadius"))?,
}
match &self.openlr_geo_coordinate {
Some(v) => {
w.key(1447)?;
v.write_json(w, None)?;
}
None => w.absent(1447, w.missing("openlrGeoCoordinate"))?,
}
if let Some(v) = &self.openlr_circle_location_reference_extension {
w.key(1153)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:OpenlrClosedLineLocationReference`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct OpenlrClosedLineLocationReference {
/// XML element `loc:_openlrAreaLocationReferenceExtension`.
pub openlr_area_location_reference_extension: Option<Box<Extension>>,
/// XML element `loc:openlrLocationReferencePoint`.
pub openlr_location_reference_point: Vec<OpenlrLocationReferencePoint>,
/// XML element `loc:openlrLastLine`.
pub openlr_last_line: Option<Box<OpenlrLastLocationReferencePoint>>,
/// XML element `loc:_openlrClosedLineLocationReferenceExtension`.
pub openlr_closed_line_location_reference_extension: Option<Box<Extension>>,
}
impl OpenlrClosedLineLocationReference {
const FIELDS: &'static [u32] = &[0xe0537, 0xe09f8, 0xe09f4, 0xe053b];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe013c);
r.attrs_done();
let mut e0 = None;
let mut e1 = Vec::new();
let mut e2 = None;
let mut e3 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe0537 => { let v = r.raw()?; r.set(&mut e0, v.map(Box::new), 1335); }
0xe09f8 => { let v = Some(OpenlrLocationReferencePoint::read(r)?); e1.extend(v); }
0xe09f4 => { let v = Some(OpenlrLastLocationReferencePoint::read(r)?); r.set(&mut e2, v.map(Box::new), 2548); }
0xe053b => { let v = r.raw()?; r.set(&mut e3, v.map(Box::new), 1339); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e2, 2548);
let v = Self {
openlr_area_location_reference_extension: e0,
openlr_location_reference_point: e1,
openlr_last_line: e2,
openlr_closed_line_location_reference_extension: e3,
};
r.close();
Ok(v)
}
}
impl OpenlrClosedLineLocationReference {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.openlr_area_location_reference_extension { w.extension("loc:_openlrAreaLocationReferenceExtension", v)?; }
w.count("loc:openlrLocationReferencePoint", self.openlr_location_reference_point.len(), 1, usize::MAX)?;
for v in &self.openlr_location_reference_point { v.write(w, "loc:openlrLocationReferencePoint", "", "")?; }
match &self.openlr_last_line {
Some(v) => { v.write(w, "loc:openlrLastLine", "", "")?; }
None => return Err(w.missing("loc:openlrLastLine")),
}
if let Some(v) = &self.openlr_closed_line_location_reference_extension { w.extension("loc:_openlrClosedLineLocationReferenceExtension", v)?; }
w.end(tag)
}
}
impl OpenlrClosedLineLocationReference {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 4];
let mut f0 = None;
let mut f1 = Vec::new();
let mut f2 = None;
let mut f3 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1149 => if r.first(&mut seen[0])? { f0 = r.raw_object()?.map(Box::new); },
1452 => if r.first(&mut seen[1])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = OpenlrLocationReferencePoint::read_json(r)? { f1.push(v); } } },
1448 => if r.first(&mut seen[2])? { f2 = OpenlrLastLocationReferencePoint::read_json(r)?.map(Box::new); },
1155 => if r.first(&mut seen[3])? { f3 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f2, 1448);
Ok(Self {
openlr_area_location_reference_extension: f0,
openlr_location_reference_point: f1,
openlr_last_line: f2,
openlr_closed_line_location_reference_extension: f3,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(552)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.openlr_area_location_reference_extension {
w.key(1149)?;
w.extension(v)?;
}
w.count("openlrLocationReferencePoint", self.openlr_location_reference_point.len(), 1, usize::MAX)?;
if !self.openlr_location_reference_point.is_empty() {
w.key(1452)?;
w.begin_array()?;
for v in &self.openlr_location_reference_point {
w.item()?;
v.write_json(w, None)?;
}
w.end_array()?;
}
match &self.openlr_last_line {
Some(v) => {
w.key(1448)?;
v.write_json(w, None)?;
}
None => w.absent(1448, w.missing("openlrLastLine"))?,
}
if let Some(v) = &self.openlr_closed_line_location_reference_extension {
w.key(1155)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:OpenlrGeoCoordinate`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct OpenlrGeoCoordinate {
/// XML element `loc:_openlrPointLocationReferenceExtension`.
pub openlr_point_location_reference_extension: Option<Box<Extension>>,
/// XML element `loc:openlrCoordinates`.
pub openlr_coordinates: Option<Box<PointCoordinates>>,
/// XML element `loc:_openlrGeoCoordinateExtension`.
pub openlr_geo_coordinate_extension: Option<Box<Extension>>,
}
impl OpenlrGeoCoordinate {
const FIELDS: &'static [u32] = &[0xe0547, 0xe09ef, 0xe053c];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe013d);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe0547 => { let v = r.raw()?; r.set(&mut e0, v.map(Box::new), 1351); }
0xe09ef => { let v = Some(PointCoordinates::read(r)?); r.set(&mut e1, v.map(Box::new), 2543); }
0xe053c => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1340); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e1, 2543);
let v = Self {
openlr_point_location_reference_extension: e0,
openlr_coordinates: e1,
openlr_geo_coordinate_extension: e2,
};
r.close();
Ok(v)
}
}
impl OpenlrGeoCoordinate {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.openlr_point_location_reference_extension { w.extension("loc:_openlrPointLocationReferenceExtension", v)?; }
match &self.openlr_coordinates {
Some(v) => { v.write(w, "loc:openlrCoordinates", "", "")?; }
None => return Err(w.missing("loc:openlrCoordinates")),
}
if let Some(v) = &self.openlr_geo_coordinate_extension { w.extension("loc:_openlrGeoCoordinateExtension", v)?; }
w.end(tag)
}
}
impl OpenlrGeoCoordinate {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 3];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1171 => if r.first(&mut seen[0])? { f0 = r.raw_object()?.map(Box::new); },
1443 => if r.first(&mut seen[1])? { f1 = PointCoordinates::read_json(r)?.map(Box::new); },
1157 => if r.first(&mut seen[2])? { f2 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f1, 1443);
Ok(Self {
openlr_point_location_reference_extension: f0,
openlr_coordinates: f1,
openlr_geo_coordinate_extension: f2,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(555)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.openlr_point_location_reference_extension {
w.key(1171)?;
w.extension(v)?;
}
match &self.openlr_coordinates {
Some(v) => {
w.key(1443)?;
v.write_json(w, None)?;
}
None => w.absent(1443, w.missing("openlrCoordinates"))?,
}
if let Some(v) = &self.openlr_geo_coordinate_extension {
w.key(1157)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:OpenlrGridLocationReference`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct OpenlrGridLocationReference {
/// XML element `loc:_openlrAreaLocationReferenceExtension`.
pub openlr_area_location_reference_extension: Option<Box<Extension>>,
/// XML element `loc:openlrNumColumns`.
pub openlr_num_columns: Option<com::NonNegativeInteger>,
/// XML element `loc:openlrNumRows`.
pub openlr_num_rows: Option<com::NonNegativeInteger>,
/// XML element `loc:openlrRectangle`.
pub openlr_rectangle: Option<Box<OpenlrRectangle>>,
/// XML element `loc:_openlrGridLocationReferenceExtension`.
pub openlr_grid_location_reference_extension: Option<Box<Extension>>,
}
impl OpenlrGridLocationReference {
const FIELDS: &'static [u32] = &[0xe0537, 0xe09fc, 0xe09fd, 0xe0a05, 0xe053d];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe013e);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
let mut e4 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe0537 => { let v = r.raw()?; r.set(&mut e0, v.map(Box::new), 1335); }
0xe09fc => { let v = r.value::<u64>()?; r.set(&mut e1, v, 2556); }
0xe09fd => { let v = r.value::<u64>()?; r.set(&mut e2, v, 2557); }
0xe0a05 => { let v = Some(OpenlrRectangle::read(r)?); r.set(&mut e3, v.map(Box::new), 2565); }
0xe053d => { let v = r.raw()?; r.set(&mut e4, v.map(Box::new), 1341); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e1, 2556);
r.required(&e2, 2557);
r.required(&e3, 2565);
let v = Self {
openlr_area_location_reference_extension: e0,
openlr_num_columns: e1,
openlr_num_rows: e2,
openlr_rectangle: e3,
openlr_grid_location_reference_extension: e4,
};
r.close();
Ok(v)
}
}
impl OpenlrGridLocationReference {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.openlr_area_location_reference_extension { w.extension("loc:_openlrAreaLocationReferenceExtension", v)?; }
match &self.openlr_num_columns {
Some(v) => { w.leaf("loc:openlrNumColumns", v)?; }
None => return Err(w.missing("loc:openlrNumColumns")),
}
match &self.openlr_num_rows {
Some(v) => { w.leaf("loc:openlrNumRows", v)?; }
None => return Err(w.missing("loc:openlrNumRows")),
}
match &self.openlr_rectangle {
Some(v) => { v.write(w, "loc:openlrRectangle", "", "")?; }
None => return Err(w.missing("loc:openlrRectangle")),
}
if let Some(v) = &self.openlr_grid_location_reference_extension { w.extension("loc:_openlrGridLocationReferenceExtension", v)?; }
w.end(tag)
}
}
impl OpenlrGridLocationReference {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 5];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1149 => if r.first(&mut seen[0])? { f0 = r.raw_object()?.map(Box::new); },
1456 => if r.first(&mut seen[1])? { f1 = r.number::<u64>()?; },
1457 => if r.first(&mut seen[2])? { f2 = r.number::<u64>()?; },
1465 => if r.first(&mut seen[3])? { f3 = OpenlrRectangle::read_json(r)?.map(Box::new); },
1159 => if r.first(&mut seen[4])? { f4 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f1, 1456);
r.required(&f2, 1457);
r.required(&f3, 1465);
Ok(Self {
openlr_area_location_reference_extension: f0,
openlr_num_columns: f1,
openlr_num_rows: f2,
openlr_rectangle: f3,
openlr_grid_location_reference_extension: f4,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(556)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.openlr_area_location_reference_extension {
w.key(1149)?;
w.extension(v)?;
}
match &self.openlr_num_columns {
Some(v) => {
w.key(1456)?;
w.integer(*v)?;
}
None => w.absent(1456, w.missing("openlrNumColumns"))?,
}
match &self.openlr_num_rows {
Some(v) => {
w.key(1457)?;
w.integer(*v)?;
}
None => w.absent(1457, w.missing("openlrNumRows"))?,
}
match &self.openlr_rectangle {
Some(v) => {
w.key(1465)?;
v.write_json(w, None)?;
}
None => w.absent(1465, w.missing("openlrRectangle"))?,
}
if let Some(v) = &self.openlr_grid_location_reference_extension {
w.key(1159)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:OpenlrLastLocationReferencePoint`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct OpenlrLastLocationReferencePoint {
/// XML element `loc:openlrCoordinates`.
pub openlr_coordinates: Option<Box<PointCoordinates>>,
/// XML element `loc:openlrLineAttributes`.
pub openlr_line_attributes: Option<Box<OpenlrLineAttributes>>,
/// XML element `loc:_openlrBaseReferencePointExtension`.
pub openlr_base_reference_point_extension: Option<Box<Extension>>,
/// XML element `loc:_openlrLastLocationReferencePointExtension`.
pub openlr_last_location_reference_point_extension: Option<Box<Extension>>,
}
impl OpenlrLastLocationReferencePoint {
const FIELDS: &'static [u32] = &[0xe09ef, 0xe09f6, 0xe0539, 0xe053e];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe013f);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe09ef => { let v = Some(PointCoordinates::read(r)?); r.set(&mut e0, v.map(Box::new), 2543); }
0xe09f6 => { let v = Some(OpenlrLineAttributes::read(r)?); r.set(&mut e1, v.map(Box::new), 2550); }
0xe0539 => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1337); }
0xe053e => { let v = r.raw()?; r.set(&mut e3, v.map(Box::new), 1342); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 2543);
r.required(&e1, 2550);
let v = Self {
openlr_coordinates: e0,
openlr_line_attributes: e1,
openlr_base_reference_point_extension: e2,
openlr_last_location_reference_point_extension: e3,
};
r.close();
Ok(v)
}
}
impl OpenlrLastLocationReferencePoint {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
match &self.openlr_coordinates {
Some(v) => { v.write(w, "loc:openlrCoordinates", "", "")?; }
None => return Err(w.missing("loc:openlrCoordinates")),
}
match &self.openlr_line_attributes {
Some(v) => { v.write(w, "loc:openlrLineAttributes", "", "")?; }
None => return Err(w.missing("loc:openlrLineAttributes")),
}
if let Some(v) = &self.openlr_base_reference_point_extension { w.extension("loc:_openlrBaseReferencePointExtension", v)?; }
if let Some(v) = &self.openlr_last_location_reference_point_extension { w.extension("loc:_openlrLastLocationReferencePointExtension", v)?; }
w.end(tag)
}
}
impl OpenlrLastLocationReferencePoint {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 4];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1443 => if r.first(&mut seen[0])? { f0 = PointCoordinates::read_json(r)?.map(Box::new); },
1450 => if r.first(&mut seen[1])? { f1 = OpenlrLineAttributes::read_json(r)?.map(Box::new); },
1151 => if r.first(&mut seen[2])? { f2 = r.raw_object()?.map(Box::new); },
1160 => if r.first(&mut seen[3])? { f3 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 1443);
r.required(&f1, 1450);
Ok(Self {
openlr_coordinates: f0,
openlr_line_attributes: f1,
openlr_base_reference_point_extension: f2,
openlr_last_location_reference_point_extension: f3,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(557)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.openlr_coordinates {
Some(v) => {
w.key(1443)?;
v.write_json(w, None)?;
}
None => w.absent(1443, w.missing("openlrCoordinates"))?,
}
match &self.openlr_line_attributes {
Some(v) => {
w.key(1450)?;
v.write_json(w, None)?;
}
None => w.absent(1450, w.missing("openlrLineAttributes"))?,
}
if let Some(v) = &self.openlr_base_reference_point_extension {
w.key(1151)?;
w.extension(v)?;
}
if let Some(v) = &self.openlr_last_location_reference_point_extension {
w.key(1160)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:OpenlrLineAttributes`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct OpenlrLineAttributes {
/// XML element `loc:openlrFunctionalRoadClass`.
pub openlr_functional_road_class: Option<OpenlrFunctionalRoadClassEnum>,
/// XML element `loc:openlrFormOfWay`.
pub openlr_form_of_way: Option<OpenlrFormOfWayEnum>,
/// XML element `loc:openlrBearing`.
pub openlr_bearing: Option<com::AngleInDegrees>,
/// XML element `loc:_openlrLineAttributesExtension`.
pub openlr_line_attributes_extension: Option<Box<Extension>>,
}
impl OpenlrLineAttributes {
const FIELDS: &'static [u32] = &[0xe09f2, 0xe09f1, 0xe09ee, 0xe053f];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe0140);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe09f2 => { let v = r.enumeration::<OpenlrFunctionalRoadClassEnum>()?; r.set(&mut e0, v, 2546); }
0xe09f1 => { let v = r.enumeration::<OpenlrFormOfWayEnum>()?; r.set(&mut e1, v, 2545); }
0xe09ee => { let v = r.value::<u64>()?; r.set(&mut e2, v, 2542); }
0xe053f => { let v = r.raw()?; r.set(&mut e3, v.map(Box::new), 1343); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 2546);
r.required(&e1, 2545);
r.required(&e2, 2542);
let v = Self {
openlr_functional_road_class: e0,
openlr_form_of_way: e1,
openlr_bearing: e2,
openlr_line_attributes_extension: e3,
};
r.close();
Ok(v)
}
}
impl OpenlrLineAttributes {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
match &self.openlr_functional_road_class {
Some(v) => { w.enumeration("loc:openlrFunctionalRoadClass", v.literal())?; }
None => return Err(w.missing("loc:openlrFunctionalRoadClass")),
}
match &self.openlr_form_of_way {
Some(v) => { w.enumeration("loc:openlrFormOfWay", v.literal())?; }
None => return Err(w.missing("loc:openlrFormOfWay")),
}
match &self.openlr_bearing {
Some(v) => { w.range("openlrBearing", "AngleInDegrees", *v, 0, 359)?; w.leaf("loc:openlrBearing", v)?; }
None => return Err(w.missing("loc:openlrBearing")),
}
if let Some(v) = &self.openlr_line_attributes_extension { w.extension("loc:_openlrLineAttributesExtension", v)?; }
w.end(tag)
}
}
impl OpenlrLineAttributes {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 4];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1446 => if r.first(&mut seen[0])? { f0 = r.enumeration::<OpenlrFunctionalRoadClassEnum>()?; },
1445 => if r.first(&mut seen[1])? { f1 = r.enumeration::<OpenlrFormOfWayEnum>()?; },
1442 => if r.first(&mut seen[2])? { f2 = r.number::<u64>()?; },
1161 => if r.first(&mut seen[3])? { f3 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 1446);
r.required(&f1, 1445);
r.required(&f2, 1442);
Ok(Self {
openlr_functional_road_class: f0,
openlr_form_of_way: f1,
openlr_bearing: f2,
openlr_line_attributes_extension: f3,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(558)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.openlr_functional_road_class {
Some(v) => {
w.key(1446)?;
w.enumeration(554, v.literal())?;
}
None => w.absent(1446, w.missing("openlrFunctionalRoadClass"))?,
}
match &self.openlr_form_of_way {
Some(v) => {
w.key(1445)?;
w.enumeration(553, v.literal())?;
}
None => w.absent(1445, w.missing("openlrFormOfWay"))?,
}
match &self.openlr_bearing {
Some(v) => {
w.key(1442)?;
w.range("openlrBearing", "AngleInDegrees", *v, 0, 359)?; w.integer(*v)?;
}
None => w.absent(1442, w.missing("openlrBearing"))?,
}
if let Some(v) = &self.openlr_line_attributes_extension {
w.key(1161)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:OpenlrLineLocationReference`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct OpenlrLineLocationReference {
/// XML element `loc:openlrLocationReferencePoint`.
pub openlr_location_reference_point: Vec<OpenlrLocationReferencePoint>,
/// XML element `loc:openlrLastLocationReferencePoint`.
pub openlr_last_location_reference_point: Option<Box<OpenlrLastLocationReferencePoint>>,
/// XML element `loc:openlrOffsets`.
pub openlr_offsets: Option<Box<OpenlrOffsets>>,
/// XML element `loc:_openlrLineLocationReferenceExtension`.
pub openlr_line_location_reference_extension: Option<Box<Extension>>,
}
impl OpenlrLineLocationReference {
const FIELDS: &'static [u32] = &[0xe09f8, 0xe09f5, 0xe09fe, 0xe0540];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe0141);
r.attrs_done();
let mut e0 = Vec::new();
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe09f8 => { let v = Some(OpenlrLocationReferencePoint::read(r)?); e0.extend(v); }
0xe09f5 => { let v = Some(OpenlrLastLocationReferencePoint::read(r)?); r.set(&mut e1, v.map(Box::new), 2549); }
0xe09fe => { let v = Some(OpenlrOffsets::read(r)?); r.set(&mut e2, v.map(Box::new), 2558); }
0xe0540 => { let v = r.raw()?; r.set(&mut e3, v.map(Box::new), 1344); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e1, 2549);
let v = Self {
openlr_location_reference_point: e0,
openlr_last_location_reference_point: e1,
openlr_offsets: e2,
openlr_line_location_reference_extension: e3,
};
r.close();
Ok(v)
}
}
impl OpenlrLineLocationReference {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
w.count("loc:openlrLocationReferencePoint", self.openlr_location_reference_point.len(), 1, usize::MAX)?;
for v in &self.openlr_location_reference_point { v.write(w, "loc:openlrLocationReferencePoint", "", "")?; }
match &self.openlr_last_location_reference_point {
Some(v) => { v.write(w, "loc:openlrLastLocationReferencePoint", "", "")?; }
None => return Err(w.missing("loc:openlrLastLocationReferencePoint")),
}
if let Some(v) = &self.openlr_offsets { v.write(w, "loc:openlrOffsets", "", "")?; }
if let Some(v) = &self.openlr_line_location_reference_extension { w.extension("loc:_openlrLineLocationReferenceExtension", v)?; }
w.end(tag)
}
}
impl OpenlrLineLocationReference {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 4];
let mut f0 = Vec::new();
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1452 => if r.first(&mut seen[0])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = OpenlrLocationReferencePoint::read_json(r)? { f0.push(v); } } },
1449 => if r.first(&mut seen[1])? { f1 = OpenlrLastLocationReferencePoint::read_json(r)?.map(Box::new); },
1458 => if r.first(&mut seen[2])? { f2 = OpenlrOffsets::read_json(r)?.map(Box::new); },
1162 => if r.first(&mut seen[3])? { f3 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f1, 1449);
Ok(Self {
openlr_location_reference_point: f0,
openlr_last_location_reference_point: f1,
openlr_offsets: f2,
openlr_line_location_reference_extension: f3,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(559)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
w.count("openlrLocationReferencePoint", self.openlr_location_reference_point.len(), 1, usize::MAX)?;
if !self.openlr_location_reference_point.is_empty() {
w.key(1452)?;
w.begin_array()?;
for v in &self.openlr_location_reference_point {
w.item()?;
v.write_json(w, None)?;
}
w.end_array()?;
}
match &self.openlr_last_location_reference_point {
Some(v) => {
w.key(1449)?;
v.write_json(w, None)?;
}
None => w.absent(1449, w.missing("openlrLastLocationReferencePoint"))?,
}
if let Some(v) = &self.openlr_offsets {
w.key(1458)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.openlr_line_location_reference_extension {
w.key(1162)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:OpenlrLinear`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct OpenlrLinear {
/// XML element `loc:firstDirection`.
pub first_direction: Option<Box<OpenlrLineLocationReference>>,
/// XML element `loc:oppositeDirection`.
pub opposite_direction: Option<Box<OpenlrLineLocationReference>>,
/// XML element `loc:_openlrLinearExtension`.
pub openlr_linear_extension: Option<Box<Extension>>,
}
impl OpenlrLinear {
const FIELDS: &'static [u32] = &[0xe085d, 0xe0a1d, 0xe0541];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe0142);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe085d => { let v = Some(OpenlrLineLocationReference::read(r)?); r.set(&mut e0, v.map(Box::new), 2141); }
0xe0a1d => { let v = Some(OpenlrLineLocationReference::read(r)?); r.set(&mut e1, v.map(Box::new), 2589); }
0xe0541 => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1345); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 2141);
let v = Self {
first_direction: e0,
opposite_direction: e1,
openlr_linear_extension: e2,
};
r.close();
Ok(v)
}
}
impl OpenlrLinear {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
match &self.first_direction {
Some(v) => { v.write(w, "loc:firstDirection", "", "")?; }
None => return Err(w.missing("loc:firstDirection")),
}
if let Some(v) = &self.opposite_direction { v.write(w, "loc:oppositeDirection", "", "")?; }
if let Some(v) = &self.openlr_linear_extension { w.extension("loc:_openlrLinearExtension", v)?; }
w.end(tag)
}
}
impl OpenlrLinear {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 3];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
851 => if r.first(&mut seen[0])? { f0 = OpenlrLineLocationReference::read_json(r)?.map(Box::new); },
1488 => if r.first(&mut seen[1])? { f1 = OpenlrLineLocationReference::read_json(r)?.map(Box::new); },
1163 => if r.first(&mut seen[2])? { f2 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 851);
Ok(Self {
first_direction: f0,
opposite_direction: f1,
openlr_linear_extension: f2,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(560)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.first_direction {
Some(v) => {
w.key(851)?;
v.write_json(w, None)?;
}
None => w.absent(851, w.missing("firstDirection"))?,
}
if let Some(v) = &self.opposite_direction {
w.key(1488)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.openlr_linear_extension {
w.key(1163)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:OpenlrLocationReferencePoint`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct OpenlrLocationReferencePoint {
/// XML element `loc:openlrCoordinates`.
pub openlr_coordinates: Option<Box<PointCoordinates>>,
/// XML element `loc:openlrLineAttributes`.
pub openlr_line_attributes: Option<Box<OpenlrLineAttributes>>,
/// XML element `loc:_openlrBaseReferencePointExtension`.
pub openlr_base_reference_point_extension: Option<Box<Extension>>,
/// XML element `loc:openlrPathAttributes`.
pub openlr_path_attributes: Option<Box<OpenlrPathAttributes>>,
/// XML element `loc:_openlrLocationReferencePointExtension`.
pub openlr_location_reference_point_extension: Option<Box<Extension>>,
}
impl OpenlrLocationReferencePoint {
const FIELDS: &'static [u32] = &[0xe09ef, 0xe09f6, 0xe0539, 0xe0a00, 0xe0542];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe0143);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
let mut e4 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe09ef => { let v = Some(PointCoordinates::read(r)?); r.set(&mut e0, v.map(Box::new), 2543); }
0xe09f6 => { let v = Some(OpenlrLineAttributes::read(r)?); r.set(&mut e1, v.map(Box::new), 2550); }
0xe0539 => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1337); }
0xe0a00 => { let v = Some(OpenlrPathAttributes::read(r)?); r.set(&mut e3, v.map(Box::new), 2560); }
0xe0542 => { let v = r.raw()?; r.set(&mut e4, v.map(Box::new), 1346); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 2543);
r.required(&e1, 2550);
r.required(&e3, 2560);
let v = Self {
openlr_coordinates: e0,
openlr_line_attributes: e1,
openlr_base_reference_point_extension: e2,
openlr_path_attributes: e3,
openlr_location_reference_point_extension: e4,
};
r.close();
Ok(v)
}
}
impl OpenlrLocationReferencePoint {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
match &self.openlr_coordinates {
Some(v) => { v.write(w, "loc:openlrCoordinates", "", "")?; }
None => return Err(w.missing("loc:openlrCoordinates")),
}
match &self.openlr_line_attributes {
Some(v) => { v.write(w, "loc:openlrLineAttributes", "", "")?; }
None => return Err(w.missing("loc:openlrLineAttributes")),
}
if let Some(v) = &self.openlr_base_reference_point_extension { w.extension("loc:_openlrBaseReferencePointExtension", v)?; }
match &self.openlr_path_attributes {
Some(v) => { v.write(w, "loc:openlrPathAttributes", "", "")?; }
None => return Err(w.missing("loc:openlrPathAttributes")),
}
if let Some(v) = &self.openlr_location_reference_point_extension { w.extension("loc:_openlrLocationReferencePointExtension", v)?; }
w.end(tag)
}
}
impl OpenlrLocationReferencePoint {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 5];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1443 => if r.first(&mut seen[0])? { f0 = PointCoordinates::read_json(r)?.map(Box::new); },
1450 => if r.first(&mut seen[1])? { f1 = OpenlrLineAttributes::read_json(r)?.map(Box::new); },
1151 => if r.first(&mut seen[2])? { f2 = r.raw_object()?.map(Box::new); },
1460 => if r.first(&mut seen[3])? { f3 = OpenlrPathAttributes::read_json(r)?.map(Box::new); },
1164 => if r.first(&mut seen[4])? { f4 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 1443);
r.required(&f1, 1450);
r.required(&f3, 1460);
Ok(Self {
openlr_coordinates: f0,
openlr_line_attributes: f1,
openlr_base_reference_point_extension: f2,
openlr_path_attributes: f3,
openlr_location_reference_point_extension: f4,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(561)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.openlr_coordinates {
Some(v) => {
w.key(1443)?;
v.write_json(w, None)?;
}
None => w.absent(1443, w.missing("openlrCoordinates"))?,
}
match &self.openlr_line_attributes {
Some(v) => {
w.key(1450)?;
v.write_json(w, None)?;
}
None => w.absent(1450, w.missing("openlrLineAttributes"))?,
}
if let Some(v) = &self.openlr_base_reference_point_extension {
w.key(1151)?;
w.extension(v)?;
}
match &self.openlr_path_attributes {
Some(v) => {
w.key(1460)?;
v.write_json(w, None)?;
}
None => w.absent(1460, w.missing("openlrPathAttributes"))?,
}
if let Some(v) = &self.openlr_location_reference_point_extension {
w.key(1164)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:OpenlrOffsets`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct OpenlrOffsets {
/// XML element `loc:openlrPositiveOffset`.
pub openlr_positive_offset: Option<com::MetresAsNonNegativeInteger>,
/// XML element `loc:openlrNegativeOffset`.
pub openlr_negative_offset: Option<com::MetresAsNonNegativeInteger>,
/// XML element `loc:_openlrOffsetsExtension`.
pub openlr_offsets_extension: Option<Box<Extension>>,
}
impl OpenlrOffsets {
const FIELDS: &'static [u32] = &[0xe0a03, 0xe09fb, 0xe0543];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe0144);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe0a03 => { let v = r.value::<u64>()?; r.set(&mut e0, v, 2563); }
0xe09fb => { let v = r.value::<u64>()?; r.set(&mut e1, v, 2555); }
0xe0543 => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1347); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
openlr_positive_offset: e0,
openlr_negative_offset: e1,
openlr_offsets_extension: e2,
};
r.close();
Ok(v)
}
}
impl OpenlrOffsets {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.openlr_positive_offset { w.leaf("loc:openlrPositiveOffset", v)?; }
if let Some(v) = &self.openlr_negative_offset { w.leaf("loc:openlrNegativeOffset", v)?; }
if let Some(v) = &self.openlr_offsets_extension { w.extension("loc:_openlrOffsetsExtension", v)?; }
w.end(tag)
}
}
impl OpenlrOffsets {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 3];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1463 => if r.first(&mut seen[0])? { f0 = r.number::<u64>()?; },
1455 => if r.first(&mut seen[1])? { f1 = r.number::<u64>()?; },
1165 => if r.first(&mut seen[2])? { f2 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
Ok(Self {
openlr_positive_offset: f0,
openlr_negative_offset: f1,
openlr_offsets_extension: f2,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(562)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.openlr_positive_offset {
w.key(1463)?;
w.integer(*v)?;
}
if let Some(v) = &self.openlr_negative_offset {
w.key(1455)?;
w.integer(*v)?;
}
if let Some(v) = &self.openlr_offsets_extension {
w.key(1165)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:OpenlrPathAttributes`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct OpenlrPathAttributes {
/// XML element `loc:openlrLowestFrcToNextLRPoint`.
pub openlr_lowest_frc_to_next_lr_point: Option<OpenlrFunctionalRoadClassEnum>,
/// XML element `loc:openlrDistanceToNextLRPoint`.
pub openlr_distance_to_next_lr_point: Option<com::NonNegativeInteger>,
/// XML element `loc:_openlrPathAttributesExtension`.
pub openlr_path_attributes_extension: Option<Box<Extension>>,
}
impl OpenlrPathAttributes {
const FIELDS: &'static [u32] = &[0xe09fa, 0xe09f0, 0xe0544];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe0145);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe09fa => { let v = r.enumeration::<OpenlrFunctionalRoadClassEnum>()?; r.set(&mut e0, v, 2554); }
0xe09f0 => { let v = r.value::<u64>()?; r.set(&mut e1, v, 2544); }
0xe0544 => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1348); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 2554);
r.required(&e1, 2544);
let v = Self {
openlr_lowest_frc_to_next_lr_point: e0,
openlr_distance_to_next_lr_point: e1,
openlr_path_attributes_extension: e2,
};
r.close();
Ok(v)
}
}
impl OpenlrPathAttributes {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
match &self.openlr_lowest_frc_to_next_lr_point {
Some(v) => { w.enumeration("loc:openlrLowestFrcToNextLRPoint", v.literal())?; }
None => return Err(w.missing("loc:openlrLowestFrcToNextLRPoint")),
}
match &self.openlr_distance_to_next_lr_point {
Some(v) => { w.leaf("loc:openlrDistanceToNextLRPoint", v)?; }
None => return Err(w.missing("loc:openlrDistanceToNextLRPoint")),
}
if let Some(v) = &self.openlr_path_attributes_extension { w.extension("loc:_openlrPathAttributesExtension", v)?; }
w.end(tag)
}
}
impl OpenlrPathAttributes {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 3];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1454 => if r.first(&mut seen[0])? { f0 = r.enumeration::<OpenlrFunctionalRoadClassEnum>()?; },
1444 => if r.first(&mut seen[1])? { f1 = r.number::<u64>()?; },
1166 => if r.first(&mut seen[2])? { f2 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 1454);
r.required(&f1, 1444);
Ok(Self {
openlr_lowest_frc_to_next_lr_point: f0,
openlr_distance_to_next_lr_point: f1,
openlr_path_attributes_extension: f2,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(564)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.openlr_lowest_frc_to_next_lr_point {
Some(v) => {
w.key(1454)?;
w.enumeration(554, v.literal())?;
}
None => w.absent(1454, w.missing("openlrLowestFrcToNextLRPoint"))?,
}
match &self.openlr_distance_to_next_lr_point {
Some(v) => {
w.key(1444)?;
w.integer(*v)?;
}
None => w.absent(1444, w.missing("openlrDistanceToNextLRPoint"))?,
}
if let Some(v) = &self.openlr_path_attributes_extension {
w.key(1166)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:OpenlrPoiWithAccessPoint`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct OpenlrPoiWithAccessPoint {
/// XML element `loc:_openlrPointLocationReferenceExtension`.
pub openlr_point_location_reference_extension: Option<Box<Extension>>,
/// XML element `loc:openlrSideOfRoad`.
pub openlr_side_of_road: Option<OpenlrSideOfRoadEnum>,
/// XML element `loc:openlrOrientation`.
pub openlr_orientation: Option<OpenlrOrientationEnum>,
/// XML element `loc:openlrLocationReferencePoint`.
pub openlr_location_reference_point: Option<Box<OpenlrLocationReferencePoint>>,
/// XML element `loc:openlrLastLocationReferencePoint`.
pub openlr_last_location_reference_point: Option<Box<OpenlrLastLocationReferencePoint>>,
/// XML element `loc:openlrOffsets`.
pub openlr_offsets: Option<Box<OpenlrOffsets>>,
/// XML element `loc:_openlrBasePointLocationExtension`.
pub openlr_base_point_location_extension: Option<Box<Extension>>,
/// XML element `loc:openlrCoordinates`.
pub openlr_coordinates: Option<Box<PointCoordinates>>,
/// XML element `loc:_openlrPoiWithAccessPointExtension`.
pub openlr_poi_with_access_point_extension: Option<Box<Extension>>,
}
impl OpenlrPoiWithAccessPoint {
const FIELDS: &'static [u32] = &[0xe0547, 0xe0a06, 0xe09ff, 0xe09f8, 0xe09f5, 0xe09fe, 0xe0538, 0xe09ef, 0xe0545];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe0146);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
let mut e4 = None;
let mut e5 = None;
let mut e6 = None;
let mut e7 = None;
let mut e8 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe0547 => { let v = r.raw()?; r.set(&mut e0, v.map(Box::new), 1351); }
0xe0a06 => { let v = r.enumeration::<OpenlrSideOfRoadEnum>()?; r.set(&mut e1, v, 2566); }
0xe09ff => { let v = r.enumeration::<OpenlrOrientationEnum>()?; r.set(&mut e2, v, 2559); }
0xe09f8 => { let v = Some(OpenlrLocationReferencePoint::read(r)?); r.set(&mut e3, v.map(Box::new), 2552); }
0xe09f5 => { let v = Some(OpenlrLastLocationReferencePoint::read(r)?); r.set(&mut e4, v.map(Box::new), 2549); }
0xe09fe => { let v = Some(OpenlrOffsets::read(r)?); r.set(&mut e5, v.map(Box::new), 2558); }
0xe0538 => { let v = r.raw()?; r.set(&mut e6, v.map(Box::new), 1336); }
0xe09ef => { let v = Some(PointCoordinates::read(r)?); r.set(&mut e7, v.map(Box::new), 2543); }
0xe0545 => { let v = r.raw()?; r.set(&mut e8, v.map(Box::new), 1349); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e1, 2566);
r.required(&e2, 2559);
r.required(&e3, 2552);
r.required(&e4, 2549);
r.required(&e7, 2543);
let v = Self {
openlr_point_location_reference_extension: e0,
openlr_side_of_road: e1,
openlr_orientation: e2,
openlr_location_reference_point: e3,
openlr_last_location_reference_point: e4,
openlr_offsets: e5,
openlr_base_point_location_extension: e6,
openlr_coordinates: e7,
openlr_poi_with_access_point_extension: e8,
};
r.close();
Ok(v)
}
}
impl OpenlrPoiWithAccessPoint {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.openlr_point_location_reference_extension { w.extension("loc:_openlrPointLocationReferenceExtension", v)?; }
match &self.openlr_side_of_road {
Some(v) => { w.enumeration("loc:openlrSideOfRoad", v.literal())?; }
None => return Err(w.missing("loc:openlrSideOfRoad")),
}
match &self.openlr_orientation {
Some(v) => { w.enumeration("loc:openlrOrientation", v.literal())?; }
None => return Err(w.missing("loc:openlrOrientation")),
}
match &self.openlr_location_reference_point {
Some(v) => { v.write(w, "loc:openlrLocationReferencePoint", "", "")?; }
None => return Err(w.missing("loc:openlrLocationReferencePoint")),
}
match &self.openlr_last_location_reference_point {
Some(v) => { v.write(w, "loc:openlrLastLocationReferencePoint", "", "")?; }
None => return Err(w.missing("loc:openlrLastLocationReferencePoint")),
}
if let Some(v) = &self.openlr_offsets { v.write(w, "loc:openlrOffsets", "", "")?; }
if let Some(v) = &self.openlr_base_point_location_extension { w.extension("loc:_openlrBasePointLocationExtension", v)?; }
match &self.openlr_coordinates {
Some(v) => { v.write(w, "loc:openlrCoordinates", "", "")?; }
None => return Err(w.missing("loc:openlrCoordinates")),
}
if let Some(v) = &self.openlr_poi_with_access_point_extension { w.extension("loc:_openlrPoiWithAccessPointExtension", v)?; }
w.end(tag)
}
}
impl OpenlrPoiWithAccessPoint {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 9];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
let mut f5 = None;
let mut f6 = None;
let mut f7 = None;
let mut f8 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1171 => if r.first(&mut seen[0])? { f0 = r.raw_object()?.map(Box::new); },
1466 => if r.first(&mut seen[1])? { f1 = r.enumeration::<OpenlrSideOfRoadEnum>()?; },
1459 => if r.first(&mut seen[2])? { f2 = r.enumeration::<OpenlrOrientationEnum>()?; },
1452 => if r.first(&mut seen[3])? { f3 = OpenlrLocationReferencePoint::read_json(r)?.map(Box::new); },
1449 => if r.first(&mut seen[4])? { f4 = OpenlrLastLocationReferencePoint::read_json(r)?.map(Box::new); },
1458 => if r.first(&mut seen[5])? { f5 = OpenlrOffsets::read_json(r)?.map(Box::new); },
1150 => if r.first(&mut seen[6])? { f6 = r.raw_object()?.map(Box::new); },
1443 => if r.first(&mut seen[7])? { f7 = PointCoordinates::read_json(r)?.map(Box::new); },
1168 => if r.first(&mut seen[8])? { f8 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f1, 1466);
r.required(&f2, 1459);
r.required(&f3, 1452);
r.required(&f4, 1449);
r.required(&f7, 1443);
Ok(Self {
openlr_point_location_reference_extension: f0,
openlr_side_of_road: f1,
openlr_orientation: f2,
openlr_location_reference_point: f3,
openlr_last_location_reference_point: f4,
openlr_offsets: f5,
openlr_base_point_location_extension: f6,
openlr_coordinates: f7,
openlr_poi_with_access_point_extension: f8,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(565)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.openlr_point_location_reference_extension {
w.key(1171)?;
w.extension(v)?;
}
match &self.openlr_side_of_road {
Some(v) => {
w.key(1466)?;
w.enumeration(572, v.literal())?;
}
None => w.absent(1466, w.missing("openlrSideOfRoad"))?,
}
match &self.openlr_orientation {
Some(v) => {
w.key(1459)?;
w.enumeration(563, v.literal())?;
}
None => w.absent(1459, w.missing("openlrOrientation"))?,
}
match &self.openlr_location_reference_point {
Some(v) => {
w.key(1452)?;
v.write_json(w, None)?;
}
None => w.absent(1452, w.missing("openlrLocationReferencePoint"))?,
}
match &self.openlr_last_location_reference_point {
Some(v) => {
w.key(1449)?;
v.write_json(w, None)?;
}
None => w.absent(1449, w.missing("openlrLastLocationReferencePoint"))?,
}
if let Some(v) = &self.openlr_offsets {
w.key(1458)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.openlr_base_point_location_extension {
w.key(1150)?;
w.extension(v)?;
}
match &self.openlr_coordinates {
Some(v) => {
w.key(1443)?;
v.write_json(w, None)?;
}
None => w.absent(1443, w.missing("openlrCoordinates"))?,
}
if let Some(v) = &self.openlr_poi_with_access_point_extension {
w.key(1168)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:OpenlrPointAlongLine`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct OpenlrPointAlongLine {
/// XML element `loc:_openlrPointLocationReferenceExtension`.
pub openlr_point_location_reference_extension: Option<Box<Extension>>,
/// XML element `loc:openlrSideOfRoad`.
pub openlr_side_of_road: Option<OpenlrSideOfRoadEnum>,
/// XML element `loc:openlrOrientation`.
pub openlr_orientation: Option<OpenlrOrientationEnum>,
/// XML element `loc:openlrLocationReferencePoint`.
pub openlr_location_reference_point: Option<Box<OpenlrLocationReferencePoint>>,
/// XML element `loc:openlrLastLocationReferencePoint`.
pub openlr_last_location_reference_point: Option<Box<OpenlrLastLocationReferencePoint>>,
/// XML element `loc:openlrOffsets`.
pub openlr_offsets: Option<Box<OpenlrOffsets>>,
/// XML element `loc:_openlrBasePointLocationExtension`.
pub openlr_base_point_location_extension: Option<Box<Extension>>,
/// XML element `loc:_openlrPointAlongLineExtension`.
pub openlr_point_along_line_extension: Option<Box<Extension>>,
}
impl OpenlrPointAlongLine {
const FIELDS: &'static [u32] = &[0xe0547, 0xe0a06, 0xe09ff, 0xe09f8, 0xe09f5, 0xe09fe, 0xe0538, 0xe0546];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe0147);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
let mut e4 = None;
let mut e5 = None;
let mut e6 = None;
let mut e7 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe0547 => { let v = r.raw()?; r.set(&mut e0, v.map(Box::new), 1351); }
0xe0a06 => { let v = r.enumeration::<OpenlrSideOfRoadEnum>()?; r.set(&mut e1, v, 2566); }
0xe09ff => { let v = r.enumeration::<OpenlrOrientationEnum>()?; r.set(&mut e2, v, 2559); }
0xe09f8 => { let v = Some(OpenlrLocationReferencePoint::read(r)?); r.set(&mut e3, v.map(Box::new), 2552); }
0xe09f5 => { let v = Some(OpenlrLastLocationReferencePoint::read(r)?); r.set(&mut e4, v.map(Box::new), 2549); }
0xe09fe => { let v = Some(OpenlrOffsets::read(r)?); r.set(&mut e5, v.map(Box::new), 2558); }
0xe0538 => { let v = r.raw()?; r.set(&mut e6, v.map(Box::new), 1336); }
0xe0546 => { let v = r.raw()?; r.set(&mut e7, v.map(Box::new), 1350); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e1, 2566);
r.required(&e2, 2559);
r.required(&e3, 2552);
r.required(&e4, 2549);
let v = Self {
openlr_point_location_reference_extension: e0,
openlr_side_of_road: e1,
openlr_orientation: e2,
openlr_location_reference_point: e3,
openlr_last_location_reference_point: e4,
openlr_offsets: e5,
openlr_base_point_location_extension: e6,
openlr_point_along_line_extension: e7,
};
r.close();
Ok(v)
}
}
impl OpenlrPointAlongLine {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.openlr_point_location_reference_extension { w.extension("loc:_openlrPointLocationReferenceExtension", v)?; }
match &self.openlr_side_of_road {
Some(v) => { w.enumeration("loc:openlrSideOfRoad", v.literal())?; }
None => return Err(w.missing("loc:openlrSideOfRoad")),
}
match &self.openlr_orientation {
Some(v) => { w.enumeration("loc:openlrOrientation", v.literal())?; }
None => return Err(w.missing("loc:openlrOrientation")),
}
match &self.openlr_location_reference_point {
Some(v) => { v.write(w, "loc:openlrLocationReferencePoint", "", "")?; }
None => return Err(w.missing("loc:openlrLocationReferencePoint")),
}
match &self.openlr_last_location_reference_point {
Some(v) => { v.write(w, "loc:openlrLastLocationReferencePoint", "", "")?; }
None => return Err(w.missing("loc:openlrLastLocationReferencePoint")),
}
if let Some(v) = &self.openlr_offsets { v.write(w, "loc:openlrOffsets", "", "")?; }
if let Some(v) = &self.openlr_base_point_location_extension { w.extension("loc:_openlrBasePointLocationExtension", v)?; }
if let Some(v) = &self.openlr_point_along_line_extension { w.extension("loc:_openlrPointAlongLineExtension", v)?; }
w.end(tag)
}
}
impl OpenlrPointAlongLine {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 8];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
let mut f5 = None;
let mut f6 = None;
let mut f7 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1171 => if r.first(&mut seen[0])? { f0 = r.raw_object()?.map(Box::new); },
1466 => if r.first(&mut seen[1])? { f1 = r.enumeration::<OpenlrSideOfRoadEnum>()?; },
1459 => if r.first(&mut seen[2])? { f2 = r.enumeration::<OpenlrOrientationEnum>()?; },
1452 => if r.first(&mut seen[3])? { f3 = OpenlrLocationReferencePoint::read_json(r)?.map(Box::new); },
1449 => if r.first(&mut seen[4])? { f4 = OpenlrLastLocationReferencePoint::read_json(r)?.map(Box::new); },
1458 => if r.first(&mut seen[5])? { f5 = OpenlrOffsets::read_json(r)?.map(Box::new); },
1150 => if r.first(&mut seen[6])? { f6 = r.raw_object()?.map(Box::new); },
1170 => if r.first(&mut seen[7])? { f7 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f1, 1466);
r.required(&f2, 1459);
r.required(&f3, 1452);
r.required(&f4, 1449);
Ok(Self {
openlr_point_location_reference_extension: f0,
openlr_side_of_road: f1,
openlr_orientation: f2,
openlr_location_reference_point: f3,
openlr_last_location_reference_point: f4,
openlr_offsets: f5,
openlr_base_point_location_extension: f6,
openlr_point_along_line_extension: f7,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(566)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.openlr_point_location_reference_extension {
w.key(1171)?;
w.extension(v)?;
}
match &self.openlr_side_of_road {
Some(v) => {
w.key(1466)?;
w.enumeration(572, v.literal())?;
}
None => w.absent(1466, w.missing("openlrSideOfRoad"))?,
}
match &self.openlr_orientation {
Some(v) => {
w.key(1459)?;
w.enumeration(563, v.literal())?;
}
None => w.absent(1459, w.missing("openlrOrientation"))?,
}
match &self.openlr_location_reference_point {
Some(v) => {
w.key(1452)?;
v.write_json(w, None)?;
}
None => w.absent(1452, w.missing("openlrLocationReferencePoint"))?,
}
match &self.openlr_last_location_reference_point {
Some(v) => {
w.key(1449)?;
v.write_json(w, None)?;
}
None => w.absent(1449, w.missing("openlrLastLocationReferencePoint"))?,
}
if let Some(v) = &self.openlr_offsets {
w.key(1458)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.openlr_base_point_location_extension {
w.key(1150)?;
w.extension(v)?;
}
if let Some(v) = &self.openlr_point_along_line_extension {
w.key(1170)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:OpenlrPolygonCorners`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct OpenlrPolygonCorners {
/// XML element `loc:openlrCoordinates`.
pub openlr_coordinates: Vec<PointCoordinates>,
/// XML element `loc:_openlrPolygonCornersExtension`.
pub openlr_polygon_corners_extension: Option<Box<Extension>>,
}
impl OpenlrPolygonCorners {
const FIELDS: &'static [u32] = &[0xe09ef, 0xe0548];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe0149);
r.attrs_done();
let mut e0 = Vec::new();
let mut e1 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe09ef => { let v = Some(PointCoordinates::read(r)?); e0.extend(v); }
0xe0548 => { let v = r.raw()?; r.set(&mut e1, v.map(Box::new), 1352); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
openlr_coordinates: e0,
openlr_polygon_corners_extension: e1,
};
r.close();
Ok(v)
}
}
impl OpenlrPolygonCorners {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
w.count("loc:openlrCoordinates", self.openlr_coordinates.len(), 3, usize::MAX)?;
for v in &self.openlr_coordinates { v.write(w, "loc:openlrCoordinates", "", "")?; }
if let Some(v) = &self.openlr_polygon_corners_extension { w.extension("loc:_openlrPolygonCornersExtension", v)?; }
w.end(tag)
}
}
impl OpenlrPolygonCorners {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 2];
let mut f0 = Vec::new();
let mut f1 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1443 => if r.first(&mut seen[0])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = PointCoordinates::read_json(r)? { f0.push(v); } } },
1172 => if r.first(&mut seen[1])? { f1 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
Ok(Self {
openlr_coordinates: f0,
openlr_polygon_corners_extension: f1,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(568)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
w.count("openlrCoordinates", self.openlr_coordinates.len(), 3, usize::MAX)?;
if !self.openlr_coordinates.is_empty() {
w.key(1443)?;
w.begin_array()?;
for v in &self.openlr_coordinates {
w.item()?;
v.write_json(w, None)?;
}
w.end_array()?;
}
if let Some(v) = &self.openlr_polygon_corners_extension {
w.key(1172)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:OpenlrPolygonLocationReference`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct OpenlrPolygonLocationReference {
/// XML element `loc:_openlrAreaLocationReferenceExtension`.
pub openlr_area_location_reference_extension: Option<Box<Extension>>,
/// XML element `loc:openlrPolygonCorners`.
pub openlr_polygon_corners: Option<Box<OpenlrPolygonCorners>>,
/// XML element `loc:_openlrPolygonLocationReferenceExtension`.
pub openlr_polygon_location_reference_extension: Option<Box<Extension>>,
}
impl OpenlrPolygonLocationReference {
const FIELDS: &'static [u32] = &[0xe0537, 0xe0a02, 0xe0549];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe014a);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe0537 => { let v = r.raw()?; r.set(&mut e0, v.map(Box::new), 1335); }
0xe0a02 => { let v = Some(OpenlrPolygonCorners::read(r)?); r.set(&mut e1, v.map(Box::new), 2562); }
0xe0549 => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1353); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e1, 2562);
let v = Self {
openlr_area_location_reference_extension: e0,
openlr_polygon_corners: e1,
openlr_polygon_location_reference_extension: e2,
};
r.close();
Ok(v)
}
}
impl OpenlrPolygonLocationReference {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.openlr_area_location_reference_extension { w.extension("loc:_openlrAreaLocationReferenceExtension", v)?; }
match &self.openlr_polygon_corners {
Some(v) => { v.write(w, "loc:openlrPolygonCorners", "", "")?; }
None => return Err(w.missing("loc:openlrPolygonCorners")),
}
if let Some(v) = &self.openlr_polygon_location_reference_extension { w.extension("loc:_openlrPolygonLocationReferenceExtension", v)?; }
w.end(tag)
}
}
impl OpenlrPolygonLocationReference {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 3];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1149 => if r.first(&mut seen[0])? { f0 = r.raw_object()?.map(Box::new); },
1462 => if r.first(&mut seen[1])? { f1 = OpenlrPolygonCorners::read_json(r)?.map(Box::new); },
1174 => if r.first(&mut seen[2])? { f2 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f1, 1462);
Ok(Self {
openlr_area_location_reference_extension: f0,
openlr_polygon_corners: f1,
openlr_polygon_location_reference_extension: f2,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(569)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.openlr_area_location_reference_extension {
w.key(1149)?;
w.extension(v)?;
}
match &self.openlr_polygon_corners {
Some(v) => {
w.key(1462)?;
v.write_json(w, None)?;
}
None => w.absent(1462, w.missing("openlrPolygonCorners"))?,
}
if let Some(v) = &self.openlr_polygon_location_reference_extension {
w.key(1174)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:OpenlrRectangle`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct OpenlrRectangle {
/// XML element `loc:openlrLowerLeft`.
pub openlr_lower_left: Option<Box<PointCoordinates>>,
/// XML element `loc:openlrUpperRight`.
pub openlr_upper_right: Option<Box<PointCoordinates>>,
/// XML element `loc:_openlrRectangleExtension`.
pub openlr_rectangle_extension: Option<Box<Extension>>,
}
impl OpenlrRectangle {
const FIELDS: &'static [u32] = &[0xe09f9, 0xe0a07, 0xe054a];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe014b);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe09f9 => { let v = Some(PointCoordinates::read(r)?); r.set(&mut e0, v.map(Box::new), 2553); }
0xe0a07 => { let v = Some(PointCoordinates::read(r)?); r.set(&mut e1, v.map(Box::new), 2567); }
0xe054a => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1354); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 2553);
r.required(&e1, 2567);
let v = Self {
openlr_lower_left: e0,
openlr_upper_right: e1,
openlr_rectangle_extension: e2,
};
r.close();
Ok(v)
}
}
impl OpenlrRectangle {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
match &self.openlr_lower_left {
Some(v) => { v.write(w, "loc:openlrLowerLeft", "", "")?; }
None => return Err(w.missing("loc:openlrLowerLeft")),
}
match &self.openlr_upper_right {
Some(v) => { v.write(w, "loc:openlrUpperRight", "", "")?; }
None => return Err(w.missing("loc:openlrUpperRight")),
}
if let Some(v) = &self.openlr_rectangle_extension { w.extension("loc:_openlrRectangleExtension", v)?; }
w.end(tag)
}
}
impl OpenlrRectangle {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 3];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1453 => if r.first(&mut seen[0])? { f0 = PointCoordinates::read_json(r)?.map(Box::new); },
1467 => if r.first(&mut seen[1])? { f1 = PointCoordinates::read_json(r)?.map(Box::new); },
1175 => if r.first(&mut seen[2])? { f2 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 1453);
r.required(&f1, 1467);
Ok(Self {
openlr_lower_left: f0,
openlr_upper_right: f1,
openlr_rectangle_extension: f2,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(570)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.openlr_lower_left {
Some(v) => {
w.key(1453)?;
v.write_json(w, None)?;
}
None => w.absent(1453, w.missing("openlrLowerLeft"))?,
}
match &self.openlr_upper_right {
Some(v) => {
w.key(1467)?;
v.write_json(w, None)?;
}
None => w.absent(1467, w.missing("openlrUpperRight"))?,
}
if let Some(v) = &self.openlr_rectangle_extension {
w.key(1175)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:OpenlrRectangleLocationReference`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct OpenlrRectangleLocationReference {
/// XML element `loc:_openlrAreaLocationReferenceExtension`.
pub openlr_area_location_reference_extension: Option<Box<Extension>>,
/// XML element `loc:openlrRectangle`.
pub openlr_rectangle: Option<Box<OpenlrRectangle>>,
/// XML element `loc:_openlrRectangleLocationReferenceExtension`.
pub openlr_rectangle_location_reference_extension: Option<Box<Extension>>,
}
impl OpenlrRectangleLocationReference {
const FIELDS: &'static [u32] = &[0xe0537, 0xe0a05, 0xe054b];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe014c);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe0537 => { let v = r.raw()?; r.set(&mut e0, v.map(Box::new), 1335); }
0xe0a05 => { let v = Some(OpenlrRectangle::read(r)?); r.set(&mut e1, v.map(Box::new), 2565); }
0xe054b => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1355); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e1, 2565);
let v = Self {
openlr_area_location_reference_extension: e0,
openlr_rectangle: e1,
openlr_rectangle_location_reference_extension: e2,
};
r.close();
Ok(v)
}
}
impl OpenlrRectangleLocationReference {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.openlr_area_location_reference_extension { w.extension("loc:_openlrAreaLocationReferenceExtension", v)?; }
match &self.openlr_rectangle {
Some(v) => { v.write(w, "loc:openlrRectangle", "", "")?; }
None => return Err(w.missing("loc:openlrRectangle")),
}
if let Some(v) = &self.openlr_rectangle_location_reference_extension { w.extension("loc:_openlrRectangleLocationReferenceExtension", v)?; }
w.end(tag)
}
}
impl OpenlrRectangleLocationReference {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 3];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1149 => if r.first(&mut seen[0])? { f0 = r.raw_object()?.map(Box::new); },
1465 => if r.first(&mut seen[1])? { f1 = OpenlrRectangle::read_json(r)?.map(Box::new); },
1177 => if r.first(&mut seen[2])? { f2 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f1, 1465);
Ok(Self {
openlr_area_location_reference_extension: f0,
openlr_rectangle: f1,
openlr_rectangle_location_reference_extension: f2,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(571)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.openlr_area_location_reference_extension {
w.key(1149)?;
w.extension(v)?;
}
match &self.openlr_rectangle {
Some(v) => {
w.key(1465)?;
v.write_json(w, None)?;
}
None => w.absent(1465, w.missing("openlrRectangle"))?,
}
if let Some(v) = &self.openlr_rectangle_location_reference_extension {
w.key(1177)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:PercentageDistanceAlongLinearElement`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct PercentageDistanceAlongLinearElement {
/// XML element `loc:_distanceAlongLinearElementExtension`.
pub distance_along_linear_element_extension: Option<Box<Extension>>,
/// XML element `loc:percentageDistanceAlong`.
pub percentage_distance_along: Option<com::Percentage>,
/// XML element `loc:_percentageDistanceAlongLinearElementExtension`.
pub percentage_distance_along_linear_element_extension: Option<Box<Extension>>,
}
impl PercentageDistanceAlongLinearElement {
const FIELDS: &'static [u32] = &[0xe048c, 0xe0a60, 0xe0570];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe0172);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe048c => { let v = r.raw()?; r.set(&mut e0, v.map(Box::new), 1164); }
0xe0a60 => { let v = r.value::<f32>()?; r.set(&mut e1, v, 2656); }
0xe0570 => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1392); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e1, 2656);
let v = Self {
distance_along_linear_element_extension: e0,
percentage_distance_along: e1,
percentage_distance_along_linear_element_extension: e2,
};
r.close();
Ok(v)
}
}
impl PercentageDistanceAlongLinearElement {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.distance_along_linear_element_extension { w.extension("loc:_distanceAlongLinearElementExtension", v)?; }
match &self.percentage_distance_along {
Some(v) => { w.leaf("loc:percentageDistanceAlong", v)?; }
None => return Err(w.missing("loc:percentageDistanceAlong")),
}
if let Some(v) = &self.percentage_distance_along_linear_element_extension { w.extension("loc:_percentageDistanceAlongLinearElementExtension", v)?; }
w.end(tag)
}
}
impl PercentageDistanceAlongLinearElement {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 3];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1102 => if r.first(&mut seen[0])? { f0 = r.raw_object()?.map(Box::new); },
1555 => if r.first(&mut seen[1])? { f1 = r.number::<f32>()?; },
1179 => if r.first(&mut seen[2])? { f2 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f1, 1555);
Ok(Self {
distance_along_linear_element_extension: f0,
percentage_distance_along: f1,
percentage_distance_along_linear_element_extension: f2,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(573)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.distance_along_linear_element_extension {
w.key(1102)?;
w.extension(v)?;
}
match &self.percentage_distance_along {
Some(v) => {
w.key(1555)?;
w.float32(*v)?;
}
None => w.absent(1555, w.missing("percentageDistanceAlong"))?,
}
if let Some(v) = &self.percentage_distance_along_linear_element_extension {
w.key(1179)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:PointAlongLinearElement`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct PointAlongLinearElement {
/// XML element `loc:administrativeAreaOfPoint`.
pub administrative_area_of_point: Option<MultilingualString>,
/// XML element `loc:directionAtPoint`.
pub direction_at_point: Option<DirectionEnum>,
/// XML element `loc:directionRelativeAtPoint`.
pub direction_relative_at_point: Option<LinearDirectionEnum>,
/// XML element `loc:heightGradeOfPoint`.
pub height_grade_of_point: Option<HeightGradeEnum>,
/// XML element `loc:linearElement`.
pub linear_element: Option<AnyLinearElement>,
/// XML element `loc:distanceAlongLinearElement`.
pub distance_along_linear_element: Option<DistanceAlongLinearElement>,
/// XML element `loc:_pointAlongLinearElementExtension`.
pub point_along_linear_element_extension: Option<Box<Extension>>,
}
impl PointAlongLinearElement {
const FIELDS: &'static [u32] = &[0xe06bf, 0xe07b9, 0xe07be, 0xe089d, 0xe090e, 0xe07ce, 0xe0581];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe0184);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
let mut e4 = None;
let mut e5 = None;
let mut e6 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe06bf => { let v = r.multilingual()?; r.set(&mut e0, v, 1727); }
0xe07b9 => { let v = r.enumeration::<DirectionEnum>()?; r.set(&mut e1, v, 1977); }
0xe07be => { let v = r.enumeration::<LinearDirectionEnum>()?; r.set(&mut e2, v, 1982); }
0xe089d => { let v = r.enumeration::<HeightGradeEnum>()?; r.set(&mut e3, v, 2205); }
0xe090e => { let v = AnyLinearElement::read(r)?; r.set(&mut e4, v, 2318); }
0xe07ce => { let v = DistanceAlongLinearElement::read(r)?; r.set(&mut e5, v, 1998); }
0xe0581 => { let v = r.raw()?; r.set(&mut e6, v.map(Box::new), 1409); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e4, 2318);
r.required(&e5, 1998);
let v = Self {
administrative_area_of_point: e0,
direction_at_point: e1,
direction_relative_at_point: e2,
height_grade_of_point: e3,
linear_element: e4,
distance_along_linear_element: e5,
point_along_linear_element_extension: e6,
};
r.close();
Ok(v)
}
}
impl PointAlongLinearElement {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.administrative_area_of_point { w.multilingual("loc:administrativeAreaOfPoint", v)?; }
if let Some(v) = &self.direction_at_point { w.enumeration("loc:directionAtPoint", v.literal())?; }
if let Some(v) = &self.direction_relative_at_point { w.enumeration("loc:directionRelativeAtPoint", v.literal())?; }
if let Some(v) = &self.height_grade_of_point { w.enumeration("loc:heightGradeOfPoint", v.literal())?; }
match &self.linear_element {
Some(v) => { v.write(w, "loc:linearElement")?; }
None => return Err(w.missing("loc:linearElement")),
}
match &self.distance_along_linear_element {
Some(v) => { v.write(w, "loc:distanceAlongLinearElement")?; }
None => return Err(w.missing("loc:distanceAlongLinearElement")),
}
if let Some(v) = &self.point_along_linear_element_extension { w.extension("loc:_pointAlongLinearElementExtension", v)?; }
w.end(tag)
}
}
impl PointAlongLinearElement {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 7];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
let mut f5 = None;
let mut f6 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
67 => if r.first(&mut seen[0])? { f0 = r.multilingual()?; },
562 => if r.first(&mut seen[1])? { f1 = r.enumeration::<DirectionEnum>()?; },
567 => if r.first(&mut seen[2])? { f2 = r.enumeration::<LinearDirectionEnum>()?; },
950 => if r.first(&mut seen[3])? { f3 = r.enumeration::<HeightGradeEnum>()?; },
1065 => if r.first(&mut seen[4])? { f4 = AnyLinearElement::read_json(r)?; },
583 => if r.first(&mut seen[5])? { f5 = DistanceAlongLinearElement::read_json(r)?; },
1180 => if r.first(&mut seen[6])? { f6 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f4, 1065);
r.required(&f5, 583);
Ok(Self {
administrative_area_of_point: f0,
direction_at_point: f1,
direction_relative_at_point: f2,
height_grade_of_point: f3,
linear_element: f4,
distance_along_linear_element: f5,
point_along_linear_element_extension: f6,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(574)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.administrative_area_of_point {
w.key(67)?;
w.multilingual(v)?;
}
if let Some(v) = &self.direction_at_point {
w.key(562)?;
w.enumeration(503, v.literal())?;
}
if let Some(v) = &self.direction_relative_at_point {
w.key(567)?;
w.enumeration(525, v.literal())?;
}
if let Some(v) = &self.height_grade_of_point {
w.key(950)?;
w.enumeration(516, v.literal())?;
}
match &self.linear_element {
Some(v) => {
w.key(1065)?;
v.write_json(w)?;
}
None => w.absent(1065, w.missing("linearElement"))?,
}
match &self.distance_along_linear_element {
Some(v) => {
w.key(583)?;
v.write_json(w)?;
}
None => w.absent(583, w.missing("distanceAlongLinearElement"))?,
}
if let Some(v) = &self.point_along_linear_element_extension {
w.key(1180)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:PointByCoordinates`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct PointByCoordinates {
/// XML element `loc:bearing`.
pub bearing: Option<com::AngleInDegrees>,
/// XML element `loc:pointCoordinates`.
pub point_coordinates: Option<Box<PointCoordinates>>,
/// XML element `loc:_pointByCoordinatesExtension`.
pub point_by_coordinates_extension: Option<Box<Extension>>,
}
impl PointByCoordinates {
const FIELDS: &'static [u32] = &[0xe071b, 0xe0a8c, 0xe0582];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe0185);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe071b => { let v = r.value::<u64>()?; r.set(&mut e0, v, 1819); }
0xe0a8c => { let v = Some(PointCoordinates::read(r)?); r.set(&mut e1, v.map(Box::new), 2700); }
0xe0582 => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1410); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e1, 2700);
let v = Self {
bearing: e0,
point_coordinates: e1,
point_by_coordinates_extension: e2,
};
r.close();
Ok(v)
}
}
impl PointByCoordinates {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.bearing { w.range("bearing", "AngleInDegrees", *v, 0, 359)?; w.leaf("loc:bearing", v)?; }
match &self.point_coordinates {
Some(v) => { v.write(w, "loc:pointCoordinates", "", "")?; }
None => return Err(w.missing("loc:pointCoordinates")),
}
if let Some(v) = &self.point_by_coordinates_extension { w.extension("loc:_pointByCoordinatesExtension", v)?; }
w.end(tag)
}
}
impl PointByCoordinates {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 3];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
294 => if r.first(&mut seen[0])? { f0 = r.number::<u64>()?; },
1598 => if r.first(&mut seen[1])? { f1 = PointCoordinates::read_json(r)?.map(Box::new); },
1181 => if r.first(&mut seen[2])? { f2 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f1, 1598);
Ok(Self {
bearing: f0,
point_coordinates: f1,
point_by_coordinates_extension: f2,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(575)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.bearing {
w.key(294)?;
w.range("bearing", "AngleInDegrees", *v, 0, 359)?; w.integer(*v)?;
}
match &self.point_coordinates {
Some(v) => {
w.key(1598)?;
v.write_json(w, None)?;
}
None => w.absent(1598, w.missing("pointCoordinates"))?,
}
if let Some(v) = &self.point_by_coordinates_extension {
w.key(1181)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:PointCoordinates`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct PointCoordinates {
/// XML element `loc:latitude`.
pub latitude: Option<com::Float>,
/// XML element `loc:longitude`.
pub longitude: Option<com::Float>,
/// XML element `loc:heightCoordinate`.
pub height_coordinate: Vec<HeightCoordinate>,
/// XML element `loc:positionConfidenceEllipse`.
pub position_confidence_ellipse: Option<Box<PositionConfidenceEllipse>>,
/// XML element `loc:horizontalPositionAccuracy`.
pub horizontal_position_accuracy: Option<Box<PositionAccuracy>>,
/// XML element `loc:_pointCoordinatesExtension`.
pub point_coordinates_extension: Option<Box<Extension>>,
}
impl PointCoordinates {
const FIELDS: &'static [u32] = &[0xe08fd, 0xe0929, 0xe089b, 0xe0a95, 0xe08a2, 0xe0583];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe0186);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = Vec::new();
let mut e3 = None;
let mut e4 = None;
let mut e5 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe08fd => { let v = r.value::<f32>()?; r.set(&mut e0, v, 2301); }
0xe0929 => { let v = r.value::<f32>()?; r.set(&mut e1, v, 2345); }
0xe089b => { let v = Some(HeightCoordinate::read(r)?); e2.extend(v); }
0xe0a95 => { let v = Some(PositionConfidenceEllipse::read(r)?); r.set(&mut e3, v.map(Box::new), 2709); }
0xe08a2 => { let v = Some(PositionAccuracy::read(r)?); r.set(&mut e4, v.map(Box::new), 2210); }
0xe0583 => { let v = r.raw()?; r.set(&mut e5, v.map(Box::new), 1411); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 2301);
r.required(&e1, 2345);
let v = Self {
latitude: e0,
longitude: e1,
height_coordinate: e2,
position_confidence_ellipse: e3,
horizontal_position_accuracy: e4,
point_coordinates_extension: e5,
};
r.close();
Ok(v)
}
}
impl PointCoordinates {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
match &self.latitude {
Some(v) => { w.leaf("loc:latitude", v)?; }
None => return Err(w.missing("loc:latitude")),
}
match &self.longitude {
Some(v) => { w.leaf("loc:longitude", v)?; }
None => return Err(w.missing("loc:longitude")),
}
w.count("loc:heightCoordinate", self.height_coordinate.len(), 0, 3)?;
for v in &self.height_coordinate { v.write(w, "loc:heightCoordinate", "", "")?; }
if let Some(v) = &self.position_confidence_ellipse { v.write(w, "loc:positionConfidenceEllipse", "", "")?; }
if let Some(v) = &self.horizontal_position_accuracy { v.write(w, "loc:horizontalPositionAccuracy", "", "")?; }
if let Some(v) = &self.point_coordinates_extension { w.extension("loc:_pointCoordinatesExtension", v)?; }
w.end(tag)
}
}
impl PointCoordinates {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 6];
let mut f0 = None;
let mut f1 = None;
let mut f2 = Vec::new();
let mut f3 = None;
let mut f4 = None;
let mut f5 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1048 => if r.first(&mut seen[0])? { f0 = r.number::<f32>()?; },
1246 => if r.first(&mut seen[1])? { f1 = r.number::<f32>()?; },
948 => if r.first(&mut seen[2])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = HeightCoordinate::read_json(r)? { f2.push(v); } } },
1607 => if r.first(&mut seen[3])? { f3 = PositionConfidenceEllipse::read_json(r)?.map(Box::new); },
955 => if r.first(&mut seen[4])? { f4 = PositionAccuracy::read_json(r)?.map(Box::new); },
1182 => if r.first(&mut seen[5])? { f5 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 1048);
r.required(&f1, 1246);
Ok(Self {
latitude: f0,
longitude: f1,
height_coordinate: f2,
position_confidence_ellipse: f3,
horizontal_position_accuracy: f4,
point_coordinates_extension: f5,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(576)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.latitude {
Some(v) => {
w.key(1048)?;
w.float32(*v)?;
}
None => w.absent(1048, w.missing("latitude"))?,
}
match &self.longitude {
Some(v) => {
w.key(1246)?;
w.float32(*v)?;
}
None => w.absent(1246, w.missing("longitude"))?,
}
w.count("heightCoordinate", self.height_coordinate.len(), 0, 3)?;
if !self.height_coordinate.is_empty() {
w.key(948)?;
w.begin_array()?;
for v in &self.height_coordinate {
w.item()?;
v.write_json(w, None)?;
}
w.end_array()?;
}
if let Some(v) = &self.position_confidence_ellipse {
w.key(1607)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.horizontal_position_accuracy {
w.key(955)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.point_coordinates_extension {
w.key(1182)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:PointDestination`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct PointDestination {
/// XML element `loc:_destinationExtension`.
pub destination_extension: Option<Box<Extension>>,
/// XML element `loc:pointLocation`.
pub point_location: Option<AnyPointLocation>,
/// XML element `loc:_pointDestinationExtension`.
pub point_destination_extension: Option<Box<Extension>>,
}
impl PointDestination {
const FIELDS: &'static [u32] = &[0xe0479, 0xe0a8d, 0xe0584];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe0187);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe0479 => { let v = r.raw()?; r.set(&mut e0, v.map(Box::new), 1145); }
0xe0a8d => { let v = AnyPointLocation::read(r)?; r.set(&mut e1, v, 2701); }
0xe0584 => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1412); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e1, 2701);
let v = Self {
destination_extension: e0,
point_location: e1,
point_destination_extension: e2,
};
r.close();
Ok(v)
}
}
impl PointDestination {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.destination_extension { w.extension("loc:_destinationExtension", v)?; }
match &self.point_location {
Some(v) => { v.write(w, "loc:pointLocation")?; }
None => return Err(w.missing("loc:pointLocation")),
}
if let Some(v) = &self.point_destination_extension { w.extension("loc:_pointDestinationExtension", v)?; }
w.end(tag)
}
}
impl PointDestination {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 3];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1101 => if r.first(&mut seen[0])? { f0 = r.raw_object()?.map(Box::new); },
1599 => if r.first(&mut seen[1])? { f1 = AnyPointLocation::read_json(r)?; },
1184 => if r.first(&mut seen[2])? { f2 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f1, 1599);
Ok(Self {
destination_extension: f0,
point_location: f1,
point_destination_extension: f2,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(577)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.destination_extension {
w.key(1101)?;
w.extension(v)?;
}
match &self.point_location {
Some(v) => {
w.key(1599)?;
v.write_json(w)?;
}
None => w.absent(1599, w.missing("pointLocation"))?,
}
if let Some(v) = &self.point_destination_extension {
w.key(1184)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:PointLocation`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct PointLocation {
/// XML element `loc:_locationReferenceExtension`.
pub location_reference_extension: Option<Box<LocationReferenceExtensionType>>,
/// XML element `loc:externalReferencing`.
pub external_referencing: Vec<ExternalReferencing>,
/// XML element `loc:coordinatesForDisplay`.
pub coordinates_for_display: Option<Box<PointCoordinates>>,
/// XML element `loc:_locationExtension`.
pub location_extension: Option<Box<LocationExtensionType>>,
/// XML element `loc:supplementaryPositionalDescription`.
pub supplementary_positional_description: Option<Box<SupplementaryPositionalDescription>>,
/// XML element `loc:destination`.
pub destination: Option<Destination>,
/// XML element `loc:_networkLocationExtension`.
pub network_location_extension: Option<Box<Extension>>,
/// XML element `loc:pointByCoordinates`.
pub point_by_coordinates: Option<Box<PointByCoordinates>>,
/// XML element `loc:pointAlongLinearElement`.
pub point_along_linear_element: Vec<PointAlongLinearElement>,
/// XML element `loc:alertCPoint`.
pub alert_c_point: Vec<AlertCPoint>,
/// XML element `loc:tpegPointLocation`.
pub tpeg_point_location: Option<TpegPointLocation>,
/// XML element `loc:openlrPointLocationReference`.
pub openlr_point_location_reference: Option<OpenlrPointLocationReference>,
/// XML element `loc:_pointLocationExtension`.
pub point_location_extension: Option<Box<Extension>>,
}
impl PointLocation {
const FIELDS: &'static [u32] = &[0xe0505, 0xe0845, 0xe0772, 0xe0501, 0xe0bf2, 0xe07aa, 0xe051e, 0xe0a8b, 0xe0a8a, 0xe06d5, 0xe0c37, 0xe0a01, 0xe0585];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe0188);
r.attrs_done();
let mut e0 = None;
let mut e1 = Vec::new();
let mut e2 = None;
let mut e3 = None;
let mut e4 = None;
let mut e5 = None;
let mut e6 = None;
let mut e7 = None;
let mut e8 = Vec::new();
let mut e9 = Vec::new();
let mut e10 = None;
let mut e11 = None;
let mut e12 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe0505 => { let v = Some(LocationReferenceExtensionType::read(r)?); r.set(&mut e0, v.map(Box::new), 1285); }
0xe0845 => { let v = Some(ExternalReferencing::read(r)?); e1.extend(v); }
0xe0772 => { let v = Some(PointCoordinates::read(r)?); r.set(&mut e2, v.map(Box::new), 1906); }
0xe0501 => { let v = Some(LocationExtensionType::read(r)?); r.set(&mut e3, v.map(Box::new), 1281); }
0xe0bf2 => { let v = Some(SupplementaryPositionalDescription::read(r)?); r.set(&mut e4, v.map(Box::new), 3058); }
0xe07aa => { let v = Destination::read(r)?; r.set(&mut e5, v, 1962); }
0xe051e => { let v = r.raw()?; r.set(&mut e6, v.map(Box::new), 1310); }
0xe0a8b => { let v = Some(PointByCoordinates::read(r)?); r.set(&mut e7, v.map(Box::new), 2699); }
0xe0a8a => { let v = Some(PointAlongLinearElement::read(r)?); e8.extend(v); }
0xe06d5 => { let v = AlertCPoint::read(r)?; e9.extend(v); }
0xe0c37 => { let v = TpegPointLocation::read(r)?; r.set(&mut e10, v, 3127); }
0xe0a01 => { let v = OpenlrPointLocationReference::read(r)?; r.set(&mut e11, v, 2561); }
0xe0585 => { let v = r.raw()?; r.set(&mut e12, v.map(Box::new), 1413); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
location_reference_extension: e0,
external_referencing: e1,
coordinates_for_display: e2,
location_extension: e3,
supplementary_positional_description: e4,
destination: e5,
network_location_extension: e6,
point_by_coordinates: e7,
point_along_linear_element: e8,
alert_c_point: e9,
tpeg_point_location: e10,
openlr_point_location_reference: e11,
point_location_extension: e12,
};
r.close();
Ok(v)
}
}
impl PointLocation {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.location_reference_extension { v.write(w, "loc:_locationReferenceExtension", "", "")?; }
for v in &self.external_referencing { v.write(w, "loc:externalReferencing", "", "")?; }
if let Some(v) = &self.coordinates_for_display { v.write(w, "loc:coordinatesForDisplay", "", "")?; }
if let Some(v) = &self.location_extension { v.write(w, "loc:_locationExtension", "", "")?; }
if let Some(v) = &self.supplementary_positional_description { v.write(w, "loc:supplementaryPositionalDescription", "", "")?; }
if let Some(v) = &self.destination { v.write(w, "loc:destination")?; }
if let Some(v) = &self.network_location_extension { w.extension("loc:_networkLocationExtension", v)?; }
if let Some(v) = &self.point_by_coordinates { v.write(w, "loc:pointByCoordinates", "", "")?; }
for v in &self.point_along_linear_element { v.write(w, "loc:pointAlongLinearElement", "", "")?; }
for v in &self.alert_c_point { v.write(w, "loc:alertCPoint")?; }
if let Some(v) = &self.tpeg_point_location { v.write(w, "loc:tpegPointLocation")?; }
if let Some(v) = &self.openlr_point_location_reference { v.write(w, "loc:openlrPointLocationReference")?; }
if let Some(v) = &self.point_location_extension { w.extension("loc:_pointLocationExtension", v)?; }
w.end(tag)
}
}
impl PointLocation {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 13];
let mut f0 = None;
let mut f1 = Vec::new();
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
let mut f5 = None;
let mut f6 = None;
let mut f7 = None;
let mut f8 = Vec::new();
let mut f9 = Vec::new();
let mut f10 = None;
let mut f11 = None;
let mut f12 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1142 => if r.first(&mut seen[0])? { f0 = LocationReferenceExtensionType::read_json(r)?.map(Box::new); },
744 => if r.first(&mut seen[1])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = ExternalReferencing::read_json(r)? { f1.push(v); } } },
464 => if r.first(&mut seen[2])? { f2 = PointCoordinates::read_json(r)?.map(Box::new); },
1136 => if r.first(&mut seen[3])? { f3 = LocationExtensionType::read_json(r)?.map(Box::new); },
2222 => if r.first(&mut seen[4])? { f4 = SupplementaryPositionalDescription::read_json(r)?.map(Box::new); },
547 => if r.first(&mut seen[5])? { f5 = Destination::read_json(r)?; },
1145 => if r.first(&mut seen[6])? { f6 = r.raw_object()?.map(Box::new); },
1597 => if r.first(&mut seen[7])? { f7 = PointByCoordinates::read_json(r)?.map(Box::new); },
1596 => if r.first(&mut seen[8])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = PointAlongLinearElement::read_json(r)? { f8.push(v); } } },
224 => if r.first(&mut seen[9])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = AlertCPoint::read_json(r)? { f9.push(v); } } },
2352 => if r.first(&mut seen[10])? { f10 = TpegPointLocation::read_json(r)?; },
1461 => if r.first(&mut seen[11])? { f11 = OpenlrPointLocationReference::read_json(r)?; },
1186 => if r.first(&mut seen[12])? { f12 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
Ok(Self {
location_reference_extension: f0,
external_referencing: f1,
coordinates_for_display: f2,
location_extension: f3,
supplementary_positional_description: f4,
destination: f5,
network_location_extension: f6,
point_by_coordinates: f7,
point_along_linear_element: f8,
alert_c_point: f9,
tpeg_point_location: f10,
openlr_point_location_reference: f11,
point_location_extension: f12,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(578)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.location_reference_extension {
w.key(1142)?;
v.write_json(w, None)?;
}
if !self.external_referencing.is_empty() {
w.key(744)?;
w.begin_array()?;
for v in &self.external_referencing {
w.item()?;
v.write_json(w, None)?;
}
w.end_array()?;
}
if let Some(v) = &self.coordinates_for_display {
w.key(464)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.location_extension {
w.key(1136)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.supplementary_positional_description {
w.key(2222)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.destination {
w.key(547)?;
v.write_json(w)?;
}
if let Some(v) = &self.network_location_extension {
w.key(1145)?;
w.extension(v)?;
}
if let Some(v) = &self.point_by_coordinates {
w.key(1597)?;
v.write_json(w, None)?;
}
if !self.point_along_linear_element.is_empty() {
w.key(1596)?;
w.begin_array()?;
for v in &self.point_along_linear_element {
w.item()?;
v.write_json(w, None)?;
}
w.end_array()?;
}
if !self.alert_c_point.is_empty() {
w.key(224)?;
w.begin_array()?;
for v in &self.alert_c_point {
w.item()?;
v.write_json(w)?;
}
w.end_array()?;
}
if let Some(v) = &self.tpeg_point_location {
w.key(2352)?;
v.write_json(w)?;
}
if let Some(v) = &self.openlr_point_location_reference {
w.key(1461)?;
v.write_json(w)?;
}
if let Some(v) = &self.point_location_extension {
w.key(1186)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:PositionAccuracy`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct PositionAccuracy {
/// XML element `loc:accuracyPercentile50`.
pub accuracy_percentile50: Option<com::MetresAsFloat>,
/// XML element `loc:accuracyPercentile75`.
pub accuracy_percentile75: Option<com::MetresAsFloat>,
/// XML element `loc:accuracyPercentile95`.
pub accuracy_percentile95: Option<com::MetresAsFloat>,
/// XML element `loc:_positionAccuracyExtension`.
pub position_accuracy_extension: Option<Box<Extension>>,
}
impl PositionAccuracy {
const FIELDS: &'static [u32] = &[0xe069a, 0xe069b, 0xe069c, 0xe058b];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe018e);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe069a => { let v = r.value::<f32>()?; r.set(&mut e0, v, 1690); }
0xe069b => { let v = r.value::<f32>()?; r.set(&mut e1, v, 1691); }
0xe069c => { let v = r.value::<f32>()?; r.set(&mut e2, v, 1692); }
0xe058b => { let v = r.raw()?; r.set(&mut e3, v.map(Box::new), 1419); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
accuracy_percentile50: e0,
accuracy_percentile75: e1,
accuracy_percentile95: e2,
position_accuracy_extension: e3,
};
r.close();
Ok(v)
}
}
impl PositionAccuracy {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.accuracy_percentile50 { w.leaf("loc:accuracyPercentile50", v)?; }
if let Some(v) = &self.accuracy_percentile75 { w.leaf("loc:accuracyPercentile75", v)?; }
if let Some(v) = &self.accuracy_percentile95 { w.leaf("loc:accuracyPercentile95", v)?; }
if let Some(v) = &self.position_accuracy_extension { w.extension("loc:_positionAccuracyExtension", v)?; }
w.end(tag)
}
}
impl PositionAccuracy {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 4];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
30 => if r.first(&mut seen[0])? { f0 = r.number::<f32>()?; },
31 => if r.first(&mut seen[1])? { f1 = r.number::<f32>()?; },
32 => if r.first(&mut seen[2])? { f2 = r.number::<f32>()?; },
1187 => if r.first(&mut seen[3])? { f3 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
Ok(Self {
accuracy_percentile50: f0,
accuracy_percentile75: f1,
accuracy_percentile95: f2,
position_accuracy_extension: f3,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(580)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.accuracy_percentile50 {
w.key(30)?;
w.float32(*v)?;
}
if let Some(v) = &self.accuracy_percentile75 {
w.key(31)?;
w.float32(*v)?;
}
if let Some(v) = &self.accuracy_percentile95 {
w.key(32)?;
w.float32(*v)?;
}
if let Some(v) = &self.position_accuracy_extension {
w.key(1187)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:PositionConfidenceEllipse`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct PositionConfidenceEllipse {
/// XML element `loc:semiMajorAxisLength`.
pub semi_major_axis_length: Option<com::MetresAsFloat>,
/// XML element `loc:semiMajorAxisLengthCodedError`.
pub semi_major_axis_length_coded_error: Option<PositionConfidenceCodedErrorEnum>,
/// XML element `loc:semiMinorAxisLength`.
pub semi_minor_axis_length: Option<com::MetresAsFloat>,
/// XML element `loc:semiMinorAxisLengthCodedError`.
pub semi_minor_axis_length_coded_error: Option<PositionConfidenceCodedErrorEnum>,
/// XML element `loc:semiMajorAxisOrientation`.
pub semi_major_axis_orientation: Option<com::AngleInDegrees>,
/// XML element `loc:semiMajorAxisOrientationError`.
pub semi_major_axis_orientation_error: Option<com::Boolean>,
/// XML element `loc:_positionConfidenceEllipseExtension`.
pub position_confidence_ellipse_extension: Option<Box<Extension>>,
}
impl PositionConfidenceEllipse {
const FIELDS: &'static [u32] = &[0xe0b71, 0xe0b72, 0xe0b75, 0xe0b76, 0xe0b73, 0xe0b74, 0xe058c];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe018f);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
let mut e4 = None;
let mut e5 = None;
let mut e6 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe0b71 => { let v = r.value::<f32>()?; r.set(&mut e0, v, 2929); }
0xe0b72 => { let v = r.enumeration::<PositionConfidenceCodedErrorEnum>()?; r.set(&mut e1, v, 2930); }
0xe0b75 => { let v = r.value::<f32>()?; r.set(&mut e2, v, 2933); }
0xe0b76 => { let v = r.enumeration::<PositionConfidenceCodedErrorEnum>()?; r.set(&mut e3, v, 2934); }
0xe0b73 => { let v = r.value::<u64>()?; r.set(&mut e4, v, 2931); }
0xe0b74 => { let v = r.value::<bool>()?; r.set(&mut e5, v, 2932); }
0xe058c => { let v = r.raw()?; r.set(&mut e6, v.map(Box::new), 1420); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
semi_major_axis_length: e0,
semi_major_axis_length_coded_error: e1,
semi_minor_axis_length: e2,
semi_minor_axis_length_coded_error: e3,
semi_major_axis_orientation: e4,
semi_major_axis_orientation_error: e5,
position_confidence_ellipse_extension: e6,
};
r.close();
Ok(v)
}
}
impl PositionConfidenceEllipse {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.semi_major_axis_length { w.leaf("loc:semiMajorAxisLength", v)?; }
if let Some(v) = &self.semi_major_axis_length_coded_error { w.enumeration("loc:semiMajorAxisLengthCodedError", v.literal())?; }
if let Some(v) = &self.semi_minor_axis_length { w.leaf("loc:semiMinorAxisLength", v)?; }
if let Some(v) = &self.semi_minor_axis_length_coded_error { w.enumeration("loc:semiMinorAxisLengthCodedError", v.literal())?; }
if let Some(v) = &self.semi_major_axis_orientation { w.range("semiMajorAxisOrientation", "AngleInDegrees", *v, 0, 359)?; w.leaf("loc:semiMajorAxisOrientation", v)?; }
if let Some(v) = &self.semi_major_axis_orientation_error { w.leaf("loc:semiMajorAxisOrientationError", v)?; }
if let Some(v) = &self.position_confidence_ellipse_extension { w.extension("loc:_positionConfidenceEllipseExtension", v)?; }
w.end(tag)
}
}
impl PositionConfidenceEllipse {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 7];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
let mut f5 = None;
let mut f6 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
2016 => if r.first(&mut seen[0])? { f0 = r.number::<f32>()?; },
2017 => if r.first(&mut seen[1])? { f1 = r.enumeration::<PositionConfidenceCodedErrorEnum>()?; },
2020 => if r.first(&mut seen[2])? { f2 = r.number::<f32>()?; },
2021 => if r.first(&mut seen[3])? { f3 = r.enumeration::<PositionConfidenceCodedErrorEnum>()?; },
2018 => if r.first(&mut seen[4])? { f4 = r.number::<u64>()?; },
2019 => if r.first(&mut seen[5])? { f5 = r.boolean()?; },
1188 => if r.first(&mut seen[6])? { f6 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
Ok(Self {
semi_major_axis_length: f0,
semi_major_axis_length_coded_error: f1,
semi_minor_axis_length: f2,
semi_minor_axis_length_coded_error: f3,
semi_major_axis_orientation: f4,
semi_major_axis_orientation_error: f5,
position_confidence_ellipse_extension: f6,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(582)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.semi_major_axis_length {
w.key(2016)?;
w.float32(*v)?;
}
if let Some(v) = &self.semi_major_axis_length_coded_error {
w.key(2017)?;
w.enumeration(581, v.literal())?;
}
if let Some(v) = &self.semi_minor_axis_length {
w.key(2020)?;
w.float32(*v)?;
}
if let Some(v) = &self.semi_minor_axis_length_coded_error {
w.key(2021)?;
w.enumeration(581, v.literal())?;
}
if let Some(v) = &self.semi_major_axis_orientation {
w.key(2018)?;
w.range("semiMajorAxisOrientation", "AngleInDegrees", *v, 0, 359)?; w.integer(*v)?;
}
if let Some(v) = &self.semi_major_axis_orientation_error {
w.key(2019)?;
w.boolean(*v)?;
}
if let Some(v) = &self.position_confidence_ellipse_extension {
w.key(1188)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:PredefinedItinerary`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct PredefinedItinerary {
/// XML attribute `id`.
pub id: Option<String>,
/// XML attribute `version`.
pub version: Option<String>,
/// XML element `loc:_predefinedLocationReferenceExtension`.
pub predefined_location_reference_extension: Option<Box<Extension>>,
/// XML element `loc:predefinedItineraryName`.
pub predefined_itinerary_name: Option<MultilingualString>,
/// XML element `loc:itinerary`.
pub itinerary: Option<Itinerary>,
/// XML element `loc:predefinedLocation`.
pub predefined_location: Vec<PredefinedLocation>,
/// XML element `loc:_predefinedItineraryExtension`.
pub predefined_itinerary_extension: Option<Box<Extension>>,
}
impl PredefinedItinerary {
const FIELDS: &'static [u32] = &[0xe0597, 0xe0aa7, 0xe08de, 0xe0aa9, 0xe0594];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe0197);
let a0 = r.req_attr(2219);
let a1 = r.req_attr(3245);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = Vec::new();
let mut e4 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe0597 => { let v = r.raw()?; r.set(&mut e0, v.map(Box::new), 1431); }
0xe0aa7 => { let v = r.multilingual()?; r.set(&mut e1, v, 2727); }
0xe08de => { let v = Itinerary::read(r)?; r.set(&mut e2, v, 2270); }
0xe0aa9 => { let v = Some(PredefinedLocation::read(r)?); e3.extend(v); }
0xe0594 => { let v = r.raw()?; r.set(&mut e4, v.map(Box::new), 1428); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
id: a0,
version: a1,
predefined_location_reference_extension: e0,
predefined_itinerary_name: e1,
itinerary: e2,
predefined_location: e3,
predefined_itinerary_extension: e4,
};
r.close();
Ok(v)
}
}
impl PredefinedItinerary {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
match &self.id {
Some(v) => { w.attr("id", v)?; }
None => return Err(w.missing_attr("id")),
}
match &self.version {
Some(v) => { w.attr("version", v)?; }
None => return Err(w.missing_attr("version")),
}
if let Some(v) = &self.predefined_location_reference_extension { w.extension("loc:_predefinedLocationReferenceExtension", v)?; }
if let Some(v) = &self.predefined_itinerary_name { w.multilingual("loc:predefinedItineraryName", v)?; }
if let Some(v) = &self.itinerary { v.write(w, "loc:itinerary")?; }
for v in &self.predefined_location { v.write(w, "loc:predefinedLocation", "", "")?; }
if let Some(v) = &self.predefined_itinerary_extension { w.extension("loc:_predefinedItineraryExtension", v)?; }
w.end(tag)
}
}
impl PredefinedItinerary {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 7];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
let mut f5 = Vec::new();
let mut f6 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
964 => if r.first(&mut seen[0])? { f0 = r.string()?; },
2578 => if r.first(&mut seen[1])? { f1 = r.string()?; },
1195 => if r.first(&mut seen[2])? { f2 = r.raw_object()?.map(Box::new); },
1625 => if r.first(&mut seen[3])? { f3 = r.multilingual()?; },
1017 => if r.first(&mut seen[4])? { f4 = Itinerary::read_json(r)?; },
1627 => if r.first(&mut seen[5])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = PredefinedLocation::read_json(r)? { f5.push(v); } } },
1190 => if r.first(&mut seen[6])? { f6 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 964);
r.required(&f1, 2578);
Ok(Self {
id: f0,
version: f1,
predefined_location_reference_extension: f2,
predefined_itinerary_name: f3,
itinerary: f4,
predefined_location: f5,
predefined_itinerary_extension: f6,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(583)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.id {
Some(v) => {
w.key(964)?;
w.string(v)?;
}
None => w.absent(964, w.missing_attr("idG"))?,
}
match &self.version {
Some(v) => {
w.key(2578)?;
w.string(v)?;
}
None => w.absent(2578, w.missing_attr("versionG"))?,
}
if let Some(v) = &self.predefined_location_reference_extension {
w.key(1195)?;
w.extension(v)?;
}
if let Some(v) = &self.predefined_itinerary_name {
w.key(1625)?;
w.multilingual(v)?;
}
if let Some(v) = &self.itinerary {
w.key(1017)?;
v.write_json(w)?;
}
if !self.predefined_location.is_empty() {
w.key(1627)?;
w.begin_array()?;
for v in &self.predefined_location {
w.item()?;
v.write_json(w, None)?;
}
w.end_array()?;
}
if let Some(v) = &self.predefined_itinerary_extension {
w.key(1190)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:PredefinedLocation`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct PredefinedLocation {
/// XML attribute `id`.
pub id: Option<String>,
/// XML attribute `version`.
pub version: Option<String>,
/// XML element `loc:_predefinedLocationReferenceExtension`.
pub predefined_location_reference_extension: Option<Box<Extension>>,
/// XML element `loc:predefinedLocationName`.
pub predefined_location_name: Option<MultilingualString>,
/// XML element `loc:location`.
pub location: Option<Location>,
/// XML element `loc:_predefinedLocationExtension`.
pub predefined_location_extension: Option<Box<Extension>>,
}
impl PredefinedLocation {
const FIELDS: &'static [u32] = &[0xe0597, 0xe0aac, 0xe091a, 0xe0595];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe0198);
let a0 = r.req_attr(2219);
let a1 = r.req_attr(3245);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe0597 => { let v = r.raw()?; r.set(&mut e0, v.map(Box::new), 1431); }
0xe0aac => { let v = r.multilingual()?; r.set(&mut e1, v, 2732); }
0xe091a => { let v = Location::read(r)?; r.set(&mut e2, v, 2330); }
0xe0595 => { let v = r.raw()?; r.set(&mut e3, v.map(Box::new), 1429); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e2, 2330);
let v = Self {
id: a0,
version: a1,
predefined_location_reference_extension: e0,
predefined_location_name: e1,
location: e2,
predefined_location_extension: e3,
};
r.close();
Ok(v)
}
}
impl PredefinedLocation {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
match &self.id {
Some(v) => { w.attr("id", v)?; }
None => return Err(w.missing_attr("id")),
}
match &self.version {
Some(v) => { w.attr("version", v)?; }
None => return Err(w.missing_attr("version")),
}
if let Some(v) = &self.predefined_location_reference_extension { w.extension("loc:_predefinedLocationReferenceExtension", v)?; }
if let Some(v) = &self.predefined_location_name { w.multilingual("loc:predefinedLocationName", v)?; }
match &self.location {
Some(v) => { v.write(w, "loc:location")?; }
None => return Err(w.missing("loc:location")),
}
if let Some(v) = &self.predefined_location_extension { w.extension("loc:_predefinedLocationExtension", v)?; }
w.end(tag)
}
}
impl PredefinedLocation {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 6];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
let mut f5 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
964 => if r.first(&mut seen[0])? { f0 = r.string()?; },
2578 => if r.first(&mut seen[1])? { f1 = r.string()?; },
1195 => if r.first(&mut seen[2])? { f2 = r.raw_object()?.map(Box::new); },
1630 => if r.first(&mut seen[3])? { f3 = r.multilingual()?; },
1228 => if r.first(&mut seen[4])? { f4 = Location::read_json(r)?; },
1192 => if r.first(&mut seen[5])? { f5 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 964);
r.required(&f1, 2578);
r.required(&f4, 1228);
Ok(Self {
id: f0,
version: f1,
predefined_location_reference_extension: f2,
predefined_location_name: f3,
location: f4,
predefined_location_extension: f5,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(584)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.id {
Some(v) => {
w.key(964)?;
w.string(v)?;
}
None => w.absent(964, w.missing_attr("idG"))?,
}
match &self.version {
Some(v) => {
w.key(2578)?;
w.string(v)?;
}
None => w.absent(2578, w.missing_attr("versionG"))?,
}
if let Some(v) = &self.predefined_location_reference_extension {
w.key(1195)?;
w.extension(v)?;
}
if let Some(v) = &self.predefined_location_name {
w.key(1630)?;
w.multilingual(v)?;
}
match &self.location {
Some(v) => {
w.key(1228)?;
v.write_json(w)?;
}
None => w.absent(1228, w.missing("location"))?,
}
if let Some(v) = &self.predefined_location_extension {
w.key(1192)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:PredefinedLocationGroup`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct PredefinedLocationGroup {
/// XML attribute `id`.
pub id: Option<String>,
/// XML attribute `version`.
pub version: Option<String>,
/// XML element `loc:_predefinedLocationReferenceExtension`.
pub predefined_location_reference_extension: Option<Box<Extension>>,
/// XML element `loc:predefinedLocationGroupName`.
pub predefined_location_group_name: Option<MultilingualString>,
/// XML element `loc:locationGroup`.
pub location_group: Option<LocationGroup>,
/// XML element `loc:predefinedLocation`.
pub predefined_location: Vec<PredefinedLocation>,
/// XML element `loc:_predefinedLocationGroupExtension`.
pub predefined_location_group_extension: Option<Box<Extension>>,
}
impl PredefinedLocationGroup {
const FIELDS: &'static [u32] = &[0xe0597, 0xe0aaa, 0xe0921, 0xe0aa9, 0xe0596];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe0199);
let a0 = r.req_attr(2219);
let a1 = r.req_attr(3245);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = Vec::new();
let mut e4 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe0597 => { let v = r.raw()?; r.set(&mut e0, v.map(Box::new), 1431); }
0xe0aaa => { let v = r.multilingual()?; r.set(&mut e1, v, 2730); }
0xe0921 => { let v = LocationGroup::read(r)?; r.set(&mut e2, v, 2337); }
0xe0aa9 => { let v = Some(PredefinedLocation::read(r)?); e3.extend(v); }
0xe0596 => { let v = r.raw()?; r.set(&mut e4, v.map(Box::new), 1430); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
id: a0,
version: a1,
predefined_location_reference_extension: e0,
predefined_location_group_name: e1,
location_group: e2,
predefined_location: e3,
predefined_location_group_extension: e4,
};
r.close();
Ok(v)
}
}
impl PredefinedLocationGroup {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
match &self.id {
Some(v) => { w.attr("id", v)?; }
None => return Err(w.missing_attr("id")),
}
match &self.version {
Some(v) => { w.attr("version", v)?; }
None => return Err(w.missing_attr("version")),
}
if let Some(v) = &self.predefined_location_reference_extension { w.extension("loc:_predefinedLocationReferenceExtension", v)?; }
if let Some(v) = &self.predefined_location_group_name { w.multilingual("loc:predefinedLocationGroupName", v)?; }
if let Some(v) = &self.location_group { v.write(w, "loc:locationGroup")?; }
for v in &self.predefined_location { v.write(w, "loc:predefinedLocation", "", "")?; }
if let Some(v) = &self.predefined_location_group_extension { w.extension("loc:_predefinedLocationGroupExtension", v)?; }
w.end(tag)
}
}
impl PredefinedLocationGroup {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 7];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
let mut f5 = Vec::new();
let mut f6 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
964 => if r.first(&mut seen[0])? { f0 = r.string()?; },
2578 => if r.first(&mut seen[1])? { f1 = r.string()?; },
1195 => if r.first(&mut seen[2])? { f2 = r.raw_object()?.map(Box::new); },
1628 => if r.first(&mut seen[3])? { f3 = r.multilingual()?; },
1235 => if r.first(&mut seen[4])? { f4 = LocationGroup::read_json(r)?; },
1627 => if r.first(&mut seen[5])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = PredefinedLocation::read_json(r)? { f5.push(v); } } },
1194 => if r.first(&mut seen[6])? { f6 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 964);
r.required(&f1, 2578);
Ok(Self {
id: f0,
version: f1,
predefined_location_reference_extension: f2,
predefined_location_group_name: f3,
location_group: f4,
predefined_location: f5,
predefined_location_group_extension: f6,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(585)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.id {
Some(v) => {
w.key(964)?;
w.string(v)?;
}
None => w.absent(964, w.missing_attr("idG"))?,
}
match &self.version {
Some(v) => {
w.key(2578)?;
w.string(v)?;
}
None => w.absent(2578, w.missing_attr("versionG"))?,
}
if let Some(v) = &self.predefined_location_reference_extension {
w.key(1195)?;
w.extension(v)?;
}
if let Some(v) = &self.predefined_location_group_name {
w.key(1628)?;
w.multilingual(v)?;
}
if let Some(v) = &self.location_group {
w.key(1235)?;
v.write_json(w)?;
}
if !self.predefined_location.is_empty() {
w.key(1627)?;
w.begin_array()?;
for v in &self.predefined_location {
w.item()?;
v.write_json(w, None)?;
}
w.end_array()?;
}
if let Some(v) = &self.predefined_location_group_extension {
w.key(1194)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:PredefinedLocationsPublication`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct PredefinedLocationsPublication {
/// XML attribute `lang`.
pub lang: Option<com::Language>,
/// XML attribute `extensionName`.
pub extension_name: Option<String>,
/// XML attribute `extensionVersion`.
pub extension_version: Option<String>,
/// XML attribute `profileName`.
pub profile_name: Option<String>,
/// XML attribute `profileVersion`.
pub profile_version: Option<String>,
/// XML element `com:feedDescription`.
pub feed_description: Option<MultilingualString>,
/// XML element `com:feedType`.
pub feed_type: Option<String>,
/// XML element `com:publicationTime`.
pub publication_time: Option<DateTime>,
/// XML element `com:publicationCreator`.
pub publication_creator: Option<Box<com::InternationalIdentifier>>,
/// XML element `com:_payloadPublicationExtension`.
pub payload_publication_extension: Option<Box<Extension>>,
/// XML element `loc:headerInformation`.
pub header_information: Option<Box<com::HeaderInformation>>,
/// XML element `loc:predefinedLocationReference`.
pub predefined_location_reference: Vec<PredefinedLocationReference>,
/// XML element `loc:_predefinedLocationsPublicationExtension`.
pub predefined_locations_publication_extension: Option<Box<Extension>>,
}
impl PredefinedLocationsPublication {
const FIELDS: &'static [u32] = &[0x40859, 0x4085a, 0x40adb, 0x40ada, 0x4056a, 0xe0893, 0xe0aad, 0xe0598];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe019b);
let a0 = r.req_attr(2285);
let _ = r.attr(2439);
let a2 = r.attr(2104);
let a3 = r.attr(2105);
let a4 = r.attr(2760);
let a5 = r.attr(2761);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
let mut e4 = None;
let mut e5 = None;
let mut e6 = Vec::new();
let mut e7 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0x40859 => { let v = r.multilingual()?; r.set(&mut e0, v, 2137); }
0x4085a => { let v = r.string()?; r.set(&mut e1, v, 2138); }
0x40adb => { let v = r.date_time()?; r.set(&mut e2, v, 2779); }
0x40ada => { let v = Some(com::InternationalIdentifier::read(r)?); r.set(&mut e3, v.map(Box::new), 2778); }
0x4056a => { let v = r.raw()?; r.set(&mut e4, v.map(Box::new), 1386); }
0xe0893 => { let v = Some(com::HeaderInformation::read(r)?); r.set(&mut e5, v.map(Box::new), 2195); }
0xe0aad => { let v = PredefinedLocationReference::read(r)?; e6.extend(v); }
0xe0598 => { let v = r.raw()?; r.set(&mut e7, v.map(Box::new), 1432); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e2, 2779);
r.required(&e3, 2778);
r.required(&e5, 2195);
let v = Self {
lang: a0,
extension_name: a2,
extension_version: a3,
profile_name: a4,
profile_version: a5,
feed_description: e0,
feed_type: e1,
publication_time: e2,
publication_creator: e3,
payload_publication_extension: e4,
header_information: e5,
predefined_location_reference: e6,
predefined_locations_publication_extension: e7,
};
r.close();
Ok(v)
}
}
impl PredefinedLocationsPublication {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
w.constant_attrs(" modelBaseVersion=\"3\"")?;
match &self.lang {
Some(v) => { w.pattern("lang", "Language", v, Pattern::Language)?; w.attr("lang", v)?; }
None => return Err(w.missing_attr("lang")),
}
if let Some(v) = &self.extension_name { w.attr("extensionName", v)?; }
if let Some(v) = &self.extension_version { w.attr("extensionVersion", v)?; }
if let Some(v) = &self.profile_name { w.attr("profileName", v)?; }
if let Some(v) = &self.profile_version { w.attr("profileVersion", v)?; }
if let Some(v) = &self.feed_description { w.multilingual("com:feedDescription", v)?; }
if let Some(v) = &self.feed_type { w.max_len("feedType", "String", v, 1024)?; w.leaf("com:feedType", v)?; }
match &self.publication_time {
Some(v) => { w.leaf("com:publicationTime", v)?; }
None => return Err(w.missing("com:publicationTime")),
}
match &self.publication_creator {
Some(v) => { v.write(w, "com:publicationCreator", "", "")?; }
None => return Err(w.missing("com:publicationCreator")),
}
if let Some(v) = &self.payload_publication_extension { w.extension("com:_payloadPublicationExtension", v)?; }
match &self.header_information {
Some(v) => { v.write(w, "loc:headerInformation", "", "")?; }
None => return Err(w.missing("loc:headerInformation")),
}
w.count("loc:predefinedLocationReference", self.predefined_location_reference.len(), 1, usize::MAX)?;
for v in &self.predefined_location_reference { v.write(w, "loc:predefinedLocationReference")?; }
if let Some(v) = &self.predefined_locations_publication_extension { w.extension("loc:_predefinedLocationsPublicationExtension", v)?; }
w.end(tag)
}
}
impl PredefinedLocationsPublication {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 13];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
let mut f5 = None;
let mut f6 = None;
let mut f7 = None;
let mut f8 = None;
let mut f9 = None;
let mut f10 = None;
let mut f11 = Vec::new();
let mut f12 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1032 => if r.first(&mut seen[0])? { f0 = r.string()?; },
847 => if r.first(&mut seen[5])? { f5 = r.multilingual()?; },
848 => if r.first(&mut seen[6])? { f6 = r.string()?; },
1779 => if r.first(&mut seen[7])? { f7 = r.date_time()?; },
1778 => if r.first(&mut seen[8])? { f8 = com::InternationalIdentifier::read_json(r)?.map(Box::new); },
387 => if r.first(&mut seen[9])? { f9 = r.raw_object()?.map(Box::new); },
940 => if r.first(&mut seen[10])? { f10 = com::HeaderInformation::read_json(r)?.map(Box::new); },
1631 => if r.first(&mut seen[11])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = PredefinedLocationReference::read_json(r)? { f11.push(v); } } },
1197 => if r.first(&mut seen[12])? { f12 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 1032);
r.required(&f7, 1779);
r.required(&f8, 1778);
r.required(&f10, 940);
Ok(Self {
lang: f0,
extension_name: f1,
extension_version: f2,
profile_name: f3,
profile_version: f4,
feed_description: f5,
feed_type: f6,
publication_time: f7,
publication_creator: f8,
payload_publication_extension: f9,
header_information: f10,
predefined_location_reference: f11,
predefined_locations_publication_extension: f12,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(587)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.lang {
Some(v) => {
w.key(1032)?;
w.pattern("lang", "Language", v, Pattern::Language)?; w.string(v)?;
}
None => w.absent(1032, w.missing_attr("lang"))?,
}
if let Some(v) = &self.feed_description {
w.key(847)?;
w.multilingual(v)?;
}
if let Some(v) = &self.feed_type {
w.key(848)?;
w.max_len("feedType", "String", v, 1024)?; w.string(v)?;
}
match &self.publication_time {
Some(v) => {
w.key(1779)?;
w.date_time(v)?;
}
None => w.absent(1779, w.missing("publicationTime"))?,
}
match &self.publication_creator {
Some(v) => {
w.key(1778)?;
v.write_json(w, None)?;
}
None => w.absent(1778, w.missing("publicationCreator"))?,
}
if let Some(v) = &self.payload_publication_extension {
w.key(387)?;
w.extension(v)?;
}
match &self.header_information {
Some(v) => {
w.key(940)?;
v.write_json(w, None)?;
}
None => w.absent(940, w.missing("headerInformation"))?,
}
w.count("predefinedLocationReference", self.predefined_location_reference.len(), 1, usize::MAX)?;
if !self.predefined_location_reference.is_empty() {
w.key(1631)?;
w.begin_array()?;
for v in &self.predefined_location_reference {
w.item()?;
v.write_json(w)?;
}
w.end_array()?;
}
if let Some(v) = &self.predefined_locations_publication_extension {
w.key(1197)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:Referent`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct Referent {
/// XML element `loc:referentIdentifier`.
pub referent_identifier: Option<String>,
/// XML element `loc:referentName`.
pub referent_name: Option<String>,
/// XML element `loc:referentType`.
pub referent_type: Option<ReferentTypeEnum>,
/// XML element `loc:referentDescription`.
pub referent_description: Option<MultilingualString>,
/// XML element `loc:pointCoordinates`.
pub point_coordinates: Option<Box<PointCoordinates>>,
/// XML element `loc:_referentExtension`.
pub referent_extension: Option<Box<Extension>>,
}
impl Referent {
const FIELDS: &'static [u32] = &[0xe0b09, 0xe0b0a, 0xe0b0b, 0xe0b08, 0xe0a8c, 0xe05b4];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe01b8);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
let mut e4 = None;
let mut e5 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe0b09 => { let v = r.string()?; r.set(&mut e0, v, 2825); }
0xe0b0a => { let v = r.string()?; r.set(&mut e1, v, 2826); }
0xe0b0b => { let v = r.enumeration::<ReferentTypeEnum>()?; r.set(&mut e2, v, 2827); }
0xe0b08 => { let v = r.multilingual()?; r.set(&mut e3, v, 2824); }
0xe0a8c => { let v = Some(PointCoordinates::read(r)?); r.set(&mut e4, v.map(Box::new), 2700); }
0xe05b4 => { let v = r.raw()?; r.set(&mut e5, v.map(Box::new), 1460); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 2825);
r.required(&e2, 2827);
let v = Self {
referent_identifier: e0,
referent_name: e1,
referent_type: e2,
referent_description: e3,
point_coordinates: e4,
referent_extension: e5,
};
r.close();
Ok(v)
}
}
impl Referent {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
match &self.referent_identifier {
Some(v) => { w.max_len("referentIdentifier", "String", v, 1024)?; w.leaf("loc:referentIdentifier", v)?; }
None => return Err(w.missing("loc:referentIdentifier")),
}
if let Some(v) = &self.referent_name { w.max_len("referentName", "String", v, 1024)?; w.leaf("loc:referentName", v)?; }
match &self.referent_type {
Some(v) => { w.enumeration("loc:referentType", v.literal())?; }
None => return Err(w.missing("loc:referentType")),
}
if let Some(v) = &self.referent_description { w.multilingual("loc:referentDescription", v)?; }
if let Some(v) = &self.point_coordinates { v.write(w, "loc:pointCoordinates", "", "")?; }
if let Some(v) = &self.referent_extension { w.extension("loc:_referentExtension", v)?; }
w.end(tag)
}
}
impl Referent {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 6];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
let mut f5 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1825 => if r.first(&mut seen[0])? { f0 = r.string()?; },
1826 => if r.first(&mut seen[1])? { f1 = r.string()?; },
1827 => if r.first(&mut seen[2])? { f2 = r.enumeration::<ReferentTypeEnum>()?; },
1824 => if r.first(&mut seen[3])? { f3 = r.multilingual()?; },
1598 => if r.first(&mut seen[4])? { f4 = PointCoordinates::read_json(r)?.map(Box::new); },
1198 => if r.first(&mut seen[5])? { f5 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 1825);
r.required(&f2, 1827);
Ok(Self {
referent_identifier: f0,
referent_name: f1,
referent_type: f2,
referent_description: f3,
point_coordinates: f4,
referent_extension: f5,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(588)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.referent_identifier {
Some(v) => {
w.key(1825)?;
w.max_len("referentIdentifier", "String", v, 1024)?; w.string(v)?;
}
None => w.absent(1825, w.missing("referentIdentifier"))?,
}
if let Some(v) = &self.referent_name {
w.key(1826)?;
w.max_len("referentName", "String", v, 1024)?; w.string(v)?;
}
match &self.referent_type {
Some(v) => {
w.key(1827)?;
w.enumeration(589, v.literal())?;
}
None => w.absent(1827, w.missing("referentType"))?,
}
if let Some(v) = &self.referent_description {
w.key(1824)?;
w.multilingual(v)?;
}
if let Some(v) = &self.point_coordinates {
w.key(1598)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.referent_extension {
w.key(1198)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:RoadInformation`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct RoadInformation {
/// XML element `loc:roadDestination`.
pub road_destination: Option<String>,
/// XML element `loc:roadName`.
pub road_name: Option<String>,
/// XML element `loc:roadNumber`.
pub road_number: Option<String>,
/// XML element `loc:_roadInformationExtension`.
pub road_information_extension: Option<Box<Extension>>,
}
impl RoadInformation {
const FIELDS: &'static [u32] = &[0xe0b40, 0xe0b44, 0xe0b45, 0xe05c8];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe01cc);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe0b40 => { let v = r.string()?; r.set(&mut e0, v, 2880); }
0xe0b44 => { let v = r.string()?; r.set(&mut e1, v, 2884); }
0xe0b45 => { let v = r.string()?; r.set(&mut e2, v, 2885); }
0xe05c8 => { let v = r.raw()?; r.set(&mut e3, v.map(Box::new), 1480); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
road_destination: e0,
road_name: e1,
road_number: e2,
road_information_extension: e3,
};
r.close();
Ok(v)
}
}
impl RoadInformation {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.road_destination { w.max_len("roadDestination", "String", v, 1024)?; w.leaf("loc:roadDestination", v)?; }
if let Some(v) = &self.road_name { w.max_len("roadName", "String", v, 1024)?; w.leaf("loc:roadName", v)?; }
if let Some(v) = &self.road_number { w.max_len("roadNumber", "String", v, 1024)?; w.leaf("loc:roadNumber", v)?; }
if let Some(v) = &self.road_information_extension { w.extension("loc:_roadInformationExtension", v)?; }
w.end(tag)
}
}
impl RoadInformation {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 4];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1966 => if r.first(&mut seen[0])? { f0 = r.string()?; },
1970 => if r.first(&mut seen[1])? { f1 = r.string()?; },
1971 => if r.first(&mut seen[2])? { f2 = r.string()?; },
1200 => if r.first(&mut seen[3])? { f3 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
Ok(Self {
road_destination: f0,
road_name: f1,
road_number: f2,
road_information_extension: f3,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(591)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.road_destination {
w.key(1966)?;
w.max_len("roadDestination", "String", v, 1024)?; w.string(v)?;
}
if let Some(v) = &self.road_name {
w.key(1970)?;
w.max_len("roadName", "String", v, 1024)?; w.string(v)?;
}
if let Some(v) = &self.road_number {
w.key(1971)?;
w.max_len("roadNumber", "String", v, 1024)?; w.string(v)?;
}
if let Some(v) = &self.road_information_extension {
w.key(1200)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:SingleRoadLinearLocation`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct SingleRoadLinearLocation {
/// XML element `loc:_locationReferenceExtension`.
pub location_reference_extension: Option<Box<LocationReferenceExtensionType>>,
/// XML element `loc:externalReferencing`.
pub external_referencing: Vec<ExternalReferencing>,
/// XML element `loc:coordinatesForDisplay`.
pub coordinates_for_display: Option<Box<PointCoordinates>>,
/// XML element `loc:_locationExtension`.
pub location_extension: Option<Box<LocationExtensionType>>,
/// XML element `loc:supplementaryPositionalDescription`.
pub supplementary_positional_description: Option<Box<SupplementaryPositionalDescription>>,
/// XML element `loc:destination`.
pub destination: Option<Destination>,
/// XML element `loc:_networkLocationExtension`.
pub network_location_extension: Option<Box<Extension>>,
/// XML element `loc:openlrLinear`.
pub openlr_linear: Option<Box<OpenlrLinear>>,
/// XML element `loc:gmlLineString`.
pub gml_line_string: Option<AnyGmlLineString>,
/// XML element `loc:secondarySupplementaryDescription`.
pub secondary_supplementary_description: Option<Box<SupplementaryPositionalDescription>>,
/// XML element `loc:_linearLocationExtension`.
pub linear_location_extension: Option<Box<Extension>>,
/// XML element `loc:tpegLinearLocation`.
pub tpeg_linear_location: Option<Box<TpegLinearLocation>>,
/// XML element `loc:alertCLinear`.
pub alert_c_linear: Vec<AlertCLinear>,
/// XML element `loc:linearWithinLinearElement`.
pub linear_within_linear_element: Vec<LinearWithinLinearElement>,
/// XML element `loc:_singleRoadLinearLocationExtension`.
pub single_road_linear_location_extension: Option<Box<Extension>>,
}
impl SingleRoadLinearLocation {
const FIELDS: &'static [u32] = &[0xe0505, 0xe0845, 0xe0772, 0xe0501, 0xe0bf2, 0xe07aa, 0xe051e, 0xe09f7, 0xe0881, 0xe0b6c, 0xe04fc, 0xe0c34, 0xe06cb, 0xe0913, 0xe05e2];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe01e8);
r.attrs_done();
let mut e0 = None;
let mut e1 = Vec::new();
let mut e2 = None;
let mut e3 = None;
let mut e4 = None;
let mut e5 = None;
let mut e6 = None;
let mut e7 = None;
let mut e8 = None;
let mut e9 = None;
let mut e10 = None;
let mut e11 = None;
let mut e12 = Vec::new();
let mut e13 = Vec::new();
let mut e14 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe0505 => { let v = Some(LocationReferenceExtensionType::read(r)?); r.set(&mut e0, v.map(Box::new), 1285); }
0xe0845 => { let v = Some(ExternalReferencing::read(r)?); e1.extend(v); }
0xe0772 => { let v = Some(PointCoordinates::read(r)?); r.set(&mut e2, v.map(Box::new), 1906); }
0xe0501 => { let v = Some(LocationExtensionType::read(r)?); r.set(&mut e3, v.map(Box::new), 1281); }
0xe0bf2 => { let v = Some(SupplementaryPositionalDescription::read(r)?); r.set(&mut e4, v.map(Box::new), 3058); }
0xe07aa => { let v = Destination::read(r)?; r.set(&mut e5, v, 1962); }
0xe051e => { let v = r.raw()?; r.set(&mut e6, v.map(Box::new), 1310); }
0xe09f7 => { let v = Some(OpenlrLinear::read(r)?); r.set(&mut e7, v.map(Box::new), 2551); }
0xe0881 => { let v = AnyGmlLineString::read(r)?; r.set(&mut e8, v, 2177); }
0xe0b6c => { let v = Some(SupplementaryPositionalDescription::read(r)?); r.set(&mut e9, v.map(Box::new), 2924); }
0xe04fc => { let v = r.raw()?; r.set(&mut e10, v.map(Box::new), 1276); }
0xe0c34 => { let v = Some(TpegLinearLocation::read(r)?); r.set(&mut e11, v.map(Box::new), 3124); }
0xe06cb => { let v = AlertCLinear::read(r)?; e12.extend(v); }
0xe0913 => { let v = Some(LinearWithinLinearElement::read(r)?); e13.extend(v); }
0xe05e2 => { let v = r.raw()?; r.set(&mut e14, v.map(Box::new), 1506); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
location_reference_extension: e0,
external_referencing: e1,
coordinates_for_display: e2,
location_extension: e3,
supplementary_positional_description: e4,
destination: e5,
network_location_extension: e6,
openlr_linear: e7,
gml_line_string: e8,
secondary_supplementary_description: e9,
linear_location_extension: e10,
tpeg_linear_location: e11,
alert_c_linear: e12,
linear_within_linear_element: e13,
single_road_linear_location_extension: e14,
};
r.close();
Ok(v)
}
}
impl SingleRoadLinearLocation {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.location_reference_extension { v.write(w, "loc:_locationReferenceExtension", "", "")?; }
for v in &self.external_referencing { v.write(w, "loc:externalReferencing", "", "")?; }
if let Some(v) = &self.coordinates_for_display { v.write(w, "loc:coordinatesForDisplay", "", "")?; }
if let Some(v) = &self.location_extension { v.write(w, "loc:_locationExtension", "", "")?; }
if let Some(v) = &self.supplementary_positional_description { v.write(w, "loc:supplementaryPositionalDescription", "", "")?; }
if let Some(v) = &self.destination { v.write(w, "loc:destination")?; }
if let Some(v) = &self.network_location_extension { w.extension("loc:_networkLocationExtension", v)?; }
if let Some(v) = &self.openlr_linear { v.write(w, "loc:openlrLinear", "", "")?; }
if let Some(v) = &self.gml_line_string { v.write(w, "loc:gmlLineString")?; }
if let Some(v) = &self.secondary_supplementary_description { v.write(w, "loc:secondarySupplementaryDescription", "", "")?; }
if let Some(v) = &self.linear_location_extension { w.extension("loc:_linearLocationExtension", v)?; }
if let Some(v) = &self.tpeg_linear_location { v.write(w, "loc:tpegLinearLocation", "", "")?; }
for v in &self.alert_c_linear { v.write(w, "loc:alertCLinear")?; }
for v in &self.linear_within_linear_element { v.write(w, "loc:linearWithinLinearElement", "", "")?; }
if let Some(v) = &self.single_road_linear_location_extension { w.extension("loc:_singleRoadLinearLocationExtension", v)?; }
w.end(tag)
}
}
impl SingleRoadLinearLocation {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 15];
let mut f0 = None;
let mut f1 = Vec::new();
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
let mut f5 = None;
let mut f6 = None;
let mut f7 = None;
let mut f8 = None;
let mut f9 = None;
let mut f10 = None;
let mut f11 = None;
let mut f12 = Vec::new();
let mut f13 = Vec::new();
let mut f14 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1142 => if r.first(&mut seen[0])? { f0 = LocationReferenceExtensionType::read_json(r)?.map(Box::new); },
744 => if r.first(&mut seen[1])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = ExternalReferencing::read_json(r)? { f1.push(v); } } },
464 => if r.first(&mut seen[2])? { f2 = PointCoordinates::read_json(r)?.map(Box::new); },
1136 => if r.first(&mut seen[3])? { f3 = LocationExtensionType::read_json(r)?.map(Box::new); },
2222 => if r.first(&mut seen[4])? { f4 = SupplementaryPositionalDescription::read_json(r)?.map(Box::new); },
547 => if r.first(&mut seen[5])? { f5 = Destination::read_json(r)?; },
1145 => if r.first(&mut seen[6])? { f6 = r.raw_object()?.map(Box::new); },
1451 => if r.first(&mut seen[7])? { f7 = OpenlrLinear::read_json(r)?.map(Box::new); },
922 => if r.first(&mut seen[8])? { f8 = AnyGmlLineString::read_json(r)?; },
2011 => if r.first(&mut seen[9])? { f9 = SupplementaryPositionalDescription::read_json(r)?.map(Box::new); },
1132 => if r.first(&mut seen[10])? { f10 = r.raw_object()?.map(Box::new); },
2349 => if r.first(&mut seen[11])? { f11 = TpegLinearLocation::read_json(r)?.map(Box::new); },
214 => if r.first(&mut seen[12])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = AlertCLinear::read_json(r)? { f12.push(v); } } },
1070 => if r.first(&mut seen[13])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = LinearWithinLinearElement::read_json(r)? { f13.push(v); } } },
1202 => if r.first(&mut seen[14])? { f14 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
Ok(Self {
location_reference_extension: f0,
external_referencing: f1,
coordinates_for_display: f2,
location_extension: f3,
supplementary_positional_description: f4,
destination: f5,
network_location_extension: f6,
openlr_linear: f7,
gml_line_string: f8,
secondary_supplementary_description: f9,
linear_location_extension: f10,
tpeg_linear_location: f11,
alert_c_linear: f12,
linear_within_linear_element: f13,
single_road_linear_location_extension: f14,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(593)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.location_reference_extension {
w.key(1142)?;
v.write_json(w, None)?;
}
if !self.external_referencing.is_empty() {
w.key(744)?;
w.begin_array()?;
for v in &self.external_referencing {
w.item()?;
v.write_json(w, None)?;
}
w.end_array()?;
}
if let Some(v) = &self.coordinates_for_display {
w.key(464)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.location_extension {
w.key(1136)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.supplementary_positional_description {
w.key(2222)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.destination {
w.key(547)?;
v.write_json(w)?;
}
if let Some(v) = &self.network_location_extension {
w.key(1145)?;
w.extension(v)?;
}
if let Some(v) = &self.openlr_linear {
w.key(1451)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.gml_line_string {
w.key(922)?;
v.write_json(w)?;
}
if let Some(v) = &self.secondary_supplementary_description {
w.key(2011)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.linear_location_extension {
w.key(1132)?;
w.extension(v)?;
}
if let Some(v) = &self.tpeg_linear_location {
w.key(2349)?;
v.write_json(w, None)?;
}
if !self.alert_c_linear.is_empty() {
w.key(214)?;
w.begin_array()?;
for v in &self.alert_c_linear {
w.item()?;
v.write_json(w)?;
}
w.end_array()?;
}
if !self.linear_within_linear_element.is_empty() {
w.key(1070)?;
w.begin_array()?;
for v in &self.linear_within_linear_element {
w.item()?;
v.write_json(w, None)?;
}
w.end_array()?;
}
if let Some(v) = &self.single_road_linear_location_extension {
w.key(1202)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:SupplementaryPositionalDescription`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct SupplementaryPositionalDescription {
/// XML attribute `locationPrecision`.
pub location_precision: Option<com::MetresAsNonNegativeInteger>,
/// XML element `loc:directionPurpose`.
pub direction_purpose: Option<DirectionPurposeEnum>,
/// XML element `loc:geographicDescriptor`.
pub geographic_descriptor: Option<GeographicCharacteristicEnum>,
/// XML element `loc:infrastructureDescriptor`.
pub infrastructure_descriptor: Option<InfrastructureDescriptorEnum>,
/// XML element `loc:lengthAffected`.
pub length_affected: Option<com::MetresAsFloat>,
/// XML element `loc:locationDescription`.
pub location_description: Option<MultilingualString>,
/// XML element `loc:positionOnCarriageway`.
pub position_on_carriageway: Option<RelativePositionOnCarriagewayEnum>,
/// XML element `loc:sequentialRampNumber`.
pub sequential_ramp_number: Option<com::NonNegativeInteger>,
/// XML element `loc:carriageway`.
pub carriageway: Vec<Carriageway>,
/// XML element `loc:namedArea`.
pub named_area: Option<AnyNamedArea>,
/// XML element `loc:roadInformation`.
pub road_information: Vec<AnyRoadInformation>,
/// XML element `loc:_supplementaryPositionalDescriptionExtension`.
pub supplementary_positional_description_extension: Option<Box<SupplementaryPositionalDescriptionExtensionType>>,
}
impl SupplementaryPositionalDescription {
const FIELDS: &'static [u32] = &[0xe07bd, 0xe087e, 0xe08c7, 0xe0904, 0xe091f, 0xe0a96, 0xe0b7c, 0xe0733, 0xe098d, 0xe0b42, 0xe060c];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe0213);
let a0 = r.attr_value::<u64>(2341)?;
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
let mut e4 = None;
let mut e5 = None;
let mut e6 = None;
let mut e7 = Vec::new();
let mut e8 = None;
let mut e9 = Vec::new();
let mut e10 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe07bd => { let v = r.enumeration::<DirectionPurposeEnum>()?; r.set(&mut e0, v, 1981); }
0xe087e => { let v = r.enumeration::<GeographicCharacteristicEnum>()?; r.set(&mut e1, v, 2174); }
0xe08c7 => { let v = r.enumeration::<InfrastructureDescriptorEnum>()?; r.set(&mut e2, v, 2247); }
0xe0904 => { let v = r.value::<f32>()?; r.set(&mut e3, v, 2308); }
0xe091f => { let v = r.multilingual()?; r.set(&mut e4, v, 2335); }
0xe0a96 => { let v = r.enumeration::<RelativePositionOnCarriagewayEnum>()?; r.set(&mut e5, v, 2710); }
0xe0b7c => { let v = r.value::<u64>()?; r.set(&mut e6, v, 2940); }
0xe0733 => { let v = Some(Carriageway::read(r)?); e7.extend(v); }
0xe098d => { let v = AnyNamedArea::read(r)?; r.set(&mut e8, v, 2445); }
0xe0b42 => { let v = AnyRoadInformation::read(r)?; e9.extend(v); }
0xe060c => { let v = Some(SupplementaryPositionalDescriptionExtensionType::read(r)?); r.set(&mut e10, v.map(Box::new), 1548); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
let v = Self {
location_precision: a0,
direction_purpose: e0,
geographic_descriptor: e1,
infrastructure_descriptor: e2,
length_affected: e3,
location_description: e4,
position_on_carriageway: e5,
sequential_ramp_number: e6,
carriageway: e7,
named_area: e8,
road_information: e9,
supplementary_positional_description_extension: e10,
};
r.close();
Ok(v)
}
}
impl SupplementaryPositionalDescription {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.location_precision { w.attr_value("locationPrecision", v)?; }
if let Some(v) = &self.direction_purpose { w.enumeration("loc:directionPurpose", v.literal())?; }
if let Some(v) = &self.geographic_descriptor { w.enumeration("loc:geographicDescriptor", v.literal())?; }
if let Some(v) = &self.infrastructure_descriptor { w.enumeration("loc:infrastructureDescriptor", v.literal())?; }
if let Some(v) = &self.length_affected { w.leaf("loc:lengthAffected", v)?; }
if let Some(v) = &self.location_description { w.multilingual("loc:locationDescription", v)?; }
if let Some(v) = &self.position_on_carriageway { w.enumeration("loc:positionOnCarriageway", v.literal())?; }
if let Some(v) = &self.sequential_ramp_number { w.leaf("loc:sequentialRampNumber", v)?; }
for v in &self.carriageway { v.write(w, "loc:carriageway", "", "")?; }
if let Some(v) = &self.named_area { v.write(w, "loc:namedArea")?; }
for v in &self.road_information { v.write(w, "loc:roadInformation")?; }
if let Some(v) = &self.supplementary_positional_description_extension { v.write(w, "loc:_supplementaryPositionalDescriptionExtension", "", "")?; }
w.end(tag)
}
}
impl SupplementaryPositionalDescription {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 12];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
let mut f5 = None;
let mut f6 = None;
let mut f7 = None;
let mut f8 = Vec::new();
let mut f9 = None;
let mut f10 = Vec::new();
let mut f11 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1239 => if r.first(&mut seen[0])? { f0 = r.number::<u64>()?; },
566 => if r.first(&mut seen[1])? { f1 = r.enumeration::<DirectionPurposeEnum>()?; },
919 => if r.first(&mut seen[2])? { f2 = r.enumeration::<GeographicCharacteristicEnum>()?; },
994 => if r.first(&mut seen[3])? { f3 = r.enumeration::<InfrastructureDescriptorEnum>()?; },
1055 => if r.first(&mut seen[4])? { f4 = r.number::<f32>()?; },
1233 => if r.first(&mut seen[5])? { f5 = r.multilingual()?; },
1608 => if r.first(&mut seen[6])? { f6 = r.enumeration::<RelativePositionOnCarriagewayEnum>()?; },
2027 => if r.first(&mut seen[7])? { f7 = r.number::<u64>()?; },
317 => if r.first(&mut seen[8])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = Carriageway::read_json(r)? { f8.push(v); } } },
1347 => if r.first(&mut seen[9])? { f9 = AnyNamedArea::read_json(r)?; },
1968 => if r.first(&mut seen[10])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = AnyRoadInformation::read_json(r)? { f10.push(v); } } },
1203 => if r.first(&mut seen[11])? { f11 = SupplementaryPositionalDescriptionExtensionType::read_json(r)?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
Ok(Self {
location_precision: f0,
direction_purpose: f1,
geographic_descriptor: f2,
infrastructure_descriptor: f3,
length_affected: f4,
location_description: f5,
position_on_carriageway: f6,
sequential_ramp_number: f7,
carriageway: f8,
named_area: f9,
road_information: f10,
supplementary_positional_description_extension: f11,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(595)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.location_precision {
w.key(1239)?;
w.integer(*v)?;
}
if let Some(v) = &self.direction_purpose {
w.key(566)?;
w.enumeration(504, v.literal())?;
}
if let Some(v) = &self.geographic_descriptor {
w.key(919)?;
w.enumeration(509, v.literal())?;
}
if let Some(v) = &self.infrastructure_descriptor {
w.key(994)?;
w.enumeration(518, v.literal())?;
}
if let Some(v) = &self.length_affected {
w.key(1055)?;
w.float32(*v)?;
}
if let Some(v) = &self.location_description {
w.key(1233)?;
w.multilingual(v)?;
}
if let Some(v) = &self.position_on_carriageway {
w.key(1608)?;
w.enumeration(590, v.literal())?;
}
if let Some(v) = &self.sequential_ramp_number {
w.key(2027)?;
w.integer(*v)?;
}
if !self.carriageway.is_empty() {
w.key(317)?;
w.begin_array()?;
for v in &self.carriageway {
w.item()?;
v.write_json(w, None)?;
}
w.end_array()?;
}
if let Some(v) = &self.named_area {
w.key(1347)?;
v.write_json(w)?;
}
if !self.road_information.is_empty() {
w.key(1968)?;
w.begin_array()?;
for v in &self.road_information {
w.item()?;
v.write_json(w)?;
}
w.end_array()?;
}
if let Some(v) = &self.supplementary_positional_description_extension {
w.key(1203)?;
v.write_json(w, None)?;
}
w.end_object()
}
}
/// XML type `loc:TpegAreaDescriptor`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct TpegAreaDescriptor {
/// XML element `loc:descriptor`.
pub descriptor: Option<MultilingualString>,
/// XML element `loc:_tpegDescriptorExtension`.
pub tpeg_descriptor_extension: Option<Box<Extension>>,
/// XML element `loc:tpegAreaDescriptorType`.
pub tpeg_area_descriptor_type: Option<TpegLoc03AreaDescriptorSubtypeEnum>,
/// XML element `loc:_tpegAreaDescriptorExtension`.
pub tpeg_area_descriptor_extension: Option<Box<Extension>>,
}
impl TpegAreaDescriptor {
const FIELDS: &'static [u32] = &[0xe07a9, 0xe0628, 0xe0c2c, 0xe0626];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe022e);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe07a9 => { let v = r.multilingual()?; r.set(&mut e0, v, 1961); }
0xe0628 => { let v = r.raw()?; r.set(&mut e1, v.map(Box::new), 1576); }
0xe0c2c => { let v = r.enumeration::<TpegLoc03AreaDescriptorSubtypeEnum>()?; r.set(&mut e2, v, 3116); }
0xe0626 => { let v = r.raw()?; r.set(&mut e3, v.map(Box::new), 1574); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 1961);
r.required(&e2, 3116);
let v = Self {
descriptor: e0,
tpeg_descriptor_extension: e1,
tpeg_area_descriptor_type: e2,
tpeg_area_descriptor_extension: e3,
};
r.close();
Ok(v)
}
}
impl TpegAreaDescriptor {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
match &self.descriptor {
Some(v) => { w.multilingual("loc:descriptor", v)?; }
None => return Err(w.missing("loc:descriptor")),
}
if let Some(v) = &self.tpeg_descriptor_extension { w.extension("loc:_tpegDescriptorExtension", v)?; }
match &self.tpeg_area_descriptor_type {
Some(v) => { w.enumeration("loc:tpegAreaDescriptorType", v.literal())?; }
None => return Err(w.missing("loc:tpegAreaDescriptorType")),
}
if let Some(v) = &self.tpeg_area_descriptor_extension { w.extension("loc:_tpegAreaDescriptorExtension", v)?; }
w.end(tag)
}
}
impl TpegAreaDescriptor {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 4];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
546 => if r.first(&mut seen[0])? { f0 = r.multilingual()?; },
1206 => if r.first(&mut seen[1])? { f1 = r.raw_object()?.map(Box::new); },
2341 => if r.first(&mut seen[2])? { f2 = r.enumeration::<TpegLoc03AreaDescriptorSubtypeEnum>()?; },
1204 => if r.first(&mut seen[3])? { f3 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 546);
r.required(&f2, 2341);
Ok(Self {
descriptor: f0,
tpeg_descriptor_extension: f1,
tpeg_area_descriptor_type: f2,
tpeg_area_descriptor_extension: f3,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(597)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.descriptor {
Some(v) => {
w.key(546)?;
w.multilingual(v)?;
}
None => w.absent(546, w.missing("descriptor"))?,
}
if let Some(v) = &self.tpeg_descriptor_extension {
w.key(1206)?;
w.extension(v)?;
}
match &self.tpeg_area_descriptor_type {
Some(v) => {
w.key(2341)?;
w.enumeration(610, v.literal())?;
}
None => w.absent(2341, w.missing("tpegAreaDescriptorType"))?,
}
if let Some(v) = &self.tpeg_area_descriptor_extension {
w.key(1204)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:TpegFramedPoint`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct TpegFramedPoint {
/// XML element `loc:tpegDirection`.
pub tpeg_direction: Option<DirectionEnum>,
/// XML element `loc:_tpegPointLocationExtension`.
pub tpeg_point_location_extension: Option<Box<Extension>>,
/// XML element `loc:tpegFramedPointLocationType`.
pub tpeg_framed_point_location_type: Option<TpegLoc01FramedPointLocationSubtypeEnum>,
/// XML element `loc:framedPoint`.
pub framed_point: Option<Box<TpegNonJunctionPoint>>,
/// XML element `loc:to`.
pub to: Option<TpegPoint>,
/// XML element `loc:from`.
pub from: Option<TpegPoint>,
/// XML element `loc:_tpegFramedPointExtension`.
pub tpeg_framed_point_extension: Option<Box<Extension>>,
}
impl TpegFramedPoint {
const FIELDS: &'static [u32] = &[0xe0c2f, 0xe0635, 0xe0c30, 0xe0866, 0xe0c23, 0xe086c, 0xe0629];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe0231);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
let mut e4 = None;
let mut e5 = None;
let mut e6 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe0c2f => { let v = r.enumeration::<DirectionEnum>()?; r.set(&mut e0, v, 3119); }
0xe0635 => { let v = r.raw()?; r.set(&mut e1, v.map(Box::new), 1589); }
0xe0c30 => { let v = r.enumeration::<TpegLoc01FramedPointLocationSubtypeEnum>()?; r.set(&mut e2, v, 3120); }
0xe0866 => { let v = Some(TpegNonJunctionPoint::read(r)?); r.set(&mut e3, v.map(Box::new), 2150); }
0xe0c23 => { let v = TpegPoint::read(r)?; r.set(&mut e4, v, 3107); }
0xe086c => { let v = TpegPoint::read(r)?; r.set(&mut e5, v, 2156); }
0xe0629 => { let v = r.raw()?; r.set(&mut e6, v.map(Box::new), 1577); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 3119);
r.required(&e2, 3120);
r.required(&e3, 2150);
r.required(&e4, 3107);
r.required(&e5, 2156);
let v = Self {
tpeg_direction: e0,
tpeg_point_location_extension: e1,
tpeg_framed_point_location_type: e2,
framed_point: e3,
to: e4,
from: e5,
tpeg_framed_point_extension: e6,
};
r.close();
Ok(v)
}
}
impl TpegFramedPoint {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
match &self.tpeg_direction {
Some(v) => { w.enumeration("loc:tpegDirection", v.literal())?; }
None => return Err(w.missing("loc:tpegDirection")),
}
if let Some(v) = &self.tpeg_point_location_extension { w.extension("loc:_tpegPointLocationExtension", v)?; }
match &self.tpeg_framed_point_location_type {
Some(v) => { w.enumeration("loc:tpegFramedPointLocationType", v.literal())?; }
None => return Err(w.missing("loc:tpegFramedPointLocationType")),
}
match &self.framed_point {
Some(v) => { v.write(w, "loc:framedPoint", "", "")?; }
None => return Err(w.missing("loc:framedPoint")),
}
match &self.to {
Some(v) => { v.write(w, "loc:to")?; }
None => return Err(w.missing("loc:to")),
}
match &self.from {
Some(v) => { v.write(w, "loc:from")?; }
None => return Err(w.missing("loc:from")),
}
if let Some(v) = &self.tpeg_framed_point_extension { w.extension("loc:_tpegFramedPointExtension", v)?; }
w.end(tag)
}
}
impl TpegFramedPoint {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 7];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
let mut f5 = None;
let mut f6 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
2344 => if r.first(&mut seen[0])? { f0 = r.enumeration::<DirectionEnum>()?; },
1224 => if r.first(&mut seen[1])? { f1 = r.raw_object()?.map(Box::new); },
2345 => if r.first(&mut seen[2])? { f2 = r.enumeration::<TpegLoc01FramedPointLocationSubtypeEnum>()?; },
860 => if r.first(&mut seen[3])? { f3 = TpegNonJunctionPoint::read_json(r)?.map(Box::new); },
2332 => if r.first(&mut seen[4])? { f4 = TpegPoint::read_json(r)?; },
866 => if r.first(&mut seen[5])? { f5 = TpegPoint::read_json(r)?; },
1208 => if r.first(&mut seen[6])? { f6 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 2344);
r.required(&f2, 2345);
r.required(&f3, 860);
r.required(&f4, 2332);
r.required(&f5, 866);
Ok(Self {
tpeg_direction: f0,
tpeg_point_location_extension: f1,
tpeg_framed_point_location_type: f2,
framed_point: f3,
to: f4,
from: f5,
tpeg_framed_point_extension: f6,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(599)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.tpeg_direction {
Some(v) => {
w.key(2344)?;
w.enumeration(503, v.literal())?;
}
None => w.absent(2344, w.missing("tpegDirection"))?,
}
if let Some(v) = &self.tpeg_point_location_extension {
w.key(1224)?;
w.extension(v)?;
}
match &self.tpeg_framed_point_location_type {
Some(v) => {
w.key(2345)?;
w.enumeration(607, v.literal())?;
}
None => w.absent(2345, w.missing("tpegFramedPointLocationType"))?,
}
match &self.framed_point {
Some(v) => {
w.key(860)?;
v.write_json(w, None)?;
}
None => w.absent(860, w.missing("framedPoint"))?,
}
match &self.to {
Some(v) => {
w.key(2332)?;
v.write_json(w)?;
}
None => w.absent(2332, w.missing("to"))?,
}
match &self.from {
Some(v) => {
w.key(866)?;
v.write_json(w)?;
}
None => w.absent(866, w.missing("from"))?,
}
if let Some(v) = &self.tpeg_framed_point_extension {
w.key(1208)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:TpegGeometricArea`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct TpegGeometricArea {
/// XML element `loc:tpegAreaLocationType`.
pub tpeg_area_location_type: Option<TpegLoc01AreaLocationSubtypeEnum>,
/// XML element `loc:tpegHeight`.
pub tpeg_height: Option<Box<TpegHeight>>,
/// XML element `loc:_tpegAreaLocationExtension`.
pub tpeg_area_location_extension: Option<Box<Extension>>,
/// XML element `loc:radius`.
pub radius: Option<com::MetresAsNonNegativeInteger>,
/// XML element `loc:centrePoint`.
pub centre_point: Option<Box<PointCoordinates>>,
/// XML element `loc:name`.
pub name: Option<Box<TpegAreaDescriptor>>,
/// XML element `loc:_tpegGeometricAreaExtension`.
pub tpeg_geometric_area_extension: Option<Box<Extension>>,
}
impl TpegGeometricArea {
const FIELDS: &'static [u32] = &[0xe0c2e, 0xe0c31, 0xe0627, 0xe0ae3, 0xe073a, 0xe098b, 0xe062a];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe0232);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
let mut e4 = None;
let mut e5 = None;
let mut e6 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe0c2e => { let v = r.enumeration::<TpegLoc01AreaLocationSubtypeEnum>()?; r.set(&mut e0, v, 3118); }
0xe0c31 => { let v = Some(TpegHeight::read(r)?); r.set(&mut e1, v.map(Box::new), 3121); }
0xe0627 => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1575); }
0xe0ae3 => { let v = r.value::<u64>()?; r.set(&mut e3, v, 2787); }
0xe073a => { let v = Some(PointCoordinates::read(r)?); r.set(&mut e4, v.map(Box::new), 1850); }
0xe098b => { let v = Some(TpegAreaDescriptor::read(r)?); r.set(&mut e5, v.map(Box::new), 2443); }
0xe062a => { let v = r.raw()?; r.set(&mut e6, v.map(Box::new), 1578); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 3118);
r.required(&e3, 2787);
r.required(&e4, 1850);
let v = Self {
tpeg_area_location_type: e0,
tpeg_height: e1,
tpeg_area_location_extension: e2,
radius: e3,
centre_point: e4,
name: e5,
tpeg_geometric_area_extension: e6,
};
r.close();
Ok(v)
}
}
impl TpegGeometricArea {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
match &self.tpeg_area_location_type {
Some(v) => { w.enumeration("loc:tpegAreaLocationType", v.literal())?; }
None => return Err(w.missing("loc:tpegAreaLocationType")),
}
if let Some(v) = &self.tpeg_height { v.write(w, "loc:tpegHeight", "", "")?; }
if let Some(v) = &self.tpeg_area_location_extension { w.extension("loc:_tpegAreaLocationExtension", v)?; }
match &self.radius {
Some(v) => { w.leaf("loc:radius", v)?; }
None => return Err(w.missing("loc:radius")),
}
match &self.centre_point {
Some(v) => { v.write(w, "loc:centrePoint", "", "")?; }
None => return Err(w.missing("loc:centrePoint")),
}
if let Some(v) = &self.name { v.write(w, "loc:name", "", "")?; }
if let Some(v) = &self.tpeg_geometric_area_extension { w.extension("loc:_tpegGeometricAreaExtension", v)?; }
w.end(tag)
}
}
impl TpegGeometricArea {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 7];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
let mut f5 = None;
let mut f6 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
2343 => if r.first(&mut seen[0])? { f0 = r.enumeration::<TpegLoc01AreaLocationSubtypeEnum>()?; },
2346 => if r.first(&mut seen[1])? { f1 = TpegHeight::read_json(r)?.map(Box::new); },
1205 => if r.first(&mut seen[2])? { f2 = r.raw_object()?.map(Box::new); },
1787 => if r.first(&mut seen[3])? { f3 = r.number::<u64>()?; },
324 => if r.first(&mut seen[4])? { f4 = PointCoordinates::read_json(r)?.map(Box::new); },
1345 => if r.first(&mut seen[5])? { f5 = TpegAreaDescriptor::read_json(r)?.map(Box::new); },
1210 => if r.first(&mut seen[6])? { f6 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 2343);
r.required(&f3, 1787);
r.required(&f4, 324);
Ok(Self {
tpeg_area_location_type: f0,
tpeg_height: f1,
tpeg_area_location_extension: f2,
radius: f3,
centre_point: f4,
name: f5,
tpeg_geometric_area_extension: f6,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(600)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.tpeg_area_location_type {
Some(v) => {
w.key(2343)?;
w.enumeration(606, v.literal())?;
}
None => w.absent(2343, w.missing("tpegAreaLocationType"))?,
}
if let Some(v) = &self.tpeg_height {
w.key(2346)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.tpeg_area_location_extension {
w.key(1205)?;
w.extension(v)?;
}
match &self.radius {
Some(v) => {
w.key(1787)?;
w.integer(*v)?;
}
None => w.absent(1787, w.missing("radius"))?,
}
match &self.centre_point {
Some(v) => {
w.key(324)?;
v.write_json(w, None)?;
}
None => w.absent(324, w.missing("centrePoint"))?,
}
if let Some(v) = &self.name {
w.key(1345)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.tpeg_geometric_area_extension {
w.key(1210)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:TpegHeight`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct TpegHeight {
/// XML element `loc:height`.
pub height: Option<com::MetresAsFloat>,
/// XML element `loc:heightType`.
pub height_type: Option<TpegLoc04HeightTypeEnum>,
/// XML element `loc:_tpegHeightExtension`.
pub tpeg_height_extension: Option<Box<Extension>>,
}
impl TpegHeight {
const FIELDS: &'static [u32] = &[0xe0897, 0xe089e, 0xe062b];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe0233);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe0897 => { let v = r.value::<f32>()?; r.set(&mut e0, v, 2199); }
0xe089e => { let v = r.enumeration::<TpegLoc04HeightTypeEnum>()?; r.set(&mut e1, v, 2206); }
0xe062b => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1579); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e1, 2206);
let v = Self {
height: e0,
height_type: e1,
tpeg_height_extension: e2,
};
r.close();
Ok(v)
}
}
impl TpegHeight {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.height { w.leaf("loc:height", v)?; }
match &self.height_type {
Some(v) => { w.enumeration("loc:heightType", v.literal())?; }
None => return Err(w.missing("loc:heightType")),
}
if let Some(v) = &self.tpeg_height_extension { w.extension("loc:_tpegHeightExtension", v)?; }
w.end(tag)
}
}
impl TpegHeight {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 3];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
944 => if r.first(&mut seen[0])? { f0 = r.number::<f32>()?; },
951 => if r.first(&mut seen[1])? { f1 = r.enumeration::<TpegLoc04HeightTypeEnum>()?; },
1211 => if r.first(&mut seen[2])? { f2 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f1, 951);
Ok(Self {
height: f0,
height_type: f1,
tpeg_height_extension: f2,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(601)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.height {
w.key(944)?;
w.float32(*v)?;
}
match &self.height_type {
Some(v) => {
w.key(951)?;
w.enumeration(614, v.literal())?;
}
None => w.absent(951, w.missing("heightType"))?,
}
if let Some(v) = &self.tpeg_height_extension {
w.key(1211)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:TpegIlcPointDescriptor`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct TpegIlcPointDescriptor {
/// XML element `loc:descriptor`.
pub descriptor: Option<MultilingualString>,
/// XML element `loc:_tpegDescriptorExtension`.
pub tpeg_descriptor_extension: Option<Box<Extension>>,
/// XML element `loc:_tpegPointDescriptorExtension`.
pub tpeg_point_descriptor_extension: Option<Box<Extension>>,
/// XML element `loc:tpegIlcPointDescriptorType`.
pub tpeg_ilc_point_descriptor_type: Option<TpegLoc03IlcPointDescriptorSubtypeEnum>,
/// XML element `loc:_tpegIlcPointDescriptorExtension`.
pub tpeg_ilc_point_descriptor_extension: Option<Box<Extension>>,
}
impl TpegIlcPointDescriptor {
const FIELDS: &'static [u32] = &[0xe07a9, 0xe0628, 0xe0633, 0xe0c32, 0xe062c];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe0234);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
let mut e4 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe07a9 => { let v = r.multilingual()?; r.set(&mut e0, v, 1961); }
0xe0628 => { let v = r.raw()?; r.set(&mut e1, v.map(Box::new), 1576); }
0xe0633 => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1587); }
0xe0c32 => { let v = r.enumeration::<TpegLoc03IlcPointDescriptorSubtypeEnum>()?; r.set(&mut e3, v, 3122); }
0xe062c => { let v = r.raw()?; r.set(&mut e4, v.map(Box::new), 1580); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 1961);
r.required(&e3, 3122);
let v = Self {
descriptor: e0,
tpeg_descriptor_extension: e1,
tpeg_point_descriptor_extension: e2,
tpeg_ilc_point_descriptor_type: e3,
tpeg_ilc_point_descriptor_extension: e4,
};
r.close();
Ok(v)
}
}
impl TpegIlcPointDescriptor {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
match &self.descriptor {
Some(v) => { w.multilingual("loc:descriptor", v)?; }
None => return Err(w.missing("loc:descriptor")),
}
if let Some(v) = &self.tpeg_descriptor_extension { w.extension("loc:_tpegDescriptorExtension", v)?; }
if let Some(v) = &self.tpeg_point_descriptor_extension { w.extension("loc:_tpegPointDescriptorExtension", v)?; }
match &self.tpeg_ilc_point_descriptor_type {
Some(v) => { w.enumeration("loc:tpegIlcPointDescriptorType", v.literal())?; }
None => return Err(w.missing("loc:tpegIlcPointDescriptorType")),
}
if let Some(v) = &self.tpeg_ilc_point_descriptor_extension { w.extension("loc:_tpegIlcPointDescriptorExtension", v)?; }
w.end(tag)
}
}
impl TpegIlcPointDescriptor {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 5];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
546 => if r.first(&mut seen[0])? { f0 = r.multilingual()?; },
1206 => if r.first(&mut seen[1])? { f1 = r.raw_object()?.map(Box::new); },
1222 => if r.first(&mut seen[2])? { f2 = r.raw_object()?.map(Box::new); },
2347 => if r.first(&mut seen[3])? { f3 = r.enumeration::<TpegLoc03IlcPointDescriptorSubtypeEnum>()?; },
1212 => if r.first(&mut seen[4])? { f4 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 546);
r.required(&f3, 2347);
Ok(Self {
descriptor: f0,
tpeg_descriptor_extension: f1,
tpeg_point_descriptor_extension: f2,
tpeg_ilc_point_descriptor_type: f3,
tpeg_ilc_point_descriptor_extension: f4,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(602)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.descriptor {
Some(v) => {
w.key(546)?;
w.multilingual(v)?;
}
None => w.absent(546, w.missing("descriptor"))?,
}
if let Some(v) = &self.tpeg_descriptor_extension {
w.key(1206)?;
w.extension(v)?;
}
if let Some(v) = &self.tpeg_point_descriptor_extension {
w.key(1222)?;
w.extension(v)?;
}
match &self.tpeg_ilc_point_descriptor_type {
Some(v) => {
w.key(2347)?;
w.enumeration(611, v.literal())?;
}
None => w.absent(2347, w.missing("tpegIlcPointDescriptorType"))?,
}
if let Some(v) = &self.tpeg_ilc_point_descriptor_extension {
w.key(1212)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:TpegJunction`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct TpegJunction {
/// XML element `loc:_tpegPointExtension`.
pub tpeg_point_extension: Option<Box<Extension>>,
/// XML element `loc:pointCoordinates`.
pub point_coordinates: Option<Box<PointCoordinates>>,
/// XML element `loc:name`.
pub name: Option<Box<TpegJunctionPointDescriptor>>,
/// XML element `loc:ilc`.
pub ilc: Vec<TpegIlcPointDescriptor>,
/// XML element `loc:otherName`.
pub other_name: Vec<TpegOtherPointDescriptor>,
/// XML element `loc:_tpegJunctionExtension`.
pub tpeg_junction_extension: Option<Box<Extension>>,
}
impl TpegJunction {
const FIELDS: &'static [u32] = &[0xe0634, 0xe0a8c, 0xe098b, 0xe08ad, 0xe0a2d, 0xe062d];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe0235);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = Vec::new();
let mut e4 = Vec::new();
let mut e5 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe0634 => { let v = r.raw()?; r.set(&mut e0, v.map(Box::new), 1588); }
0xe0a8c => { let v = Some(PointCoordinates::read(r)?); r.set(&mut e1, v.map(Box::new), 2700); }
0xe098b => { let v = Some(TpegJunctionPointDescriptor::read(r)?); r.set(&mut e2, v.map(Box::new), 2443); }
0xe08ad => { let v = Some(TpegIlcPointDescriptor::read(r)?); e3.extend(v); }
0xe0a2d => { let v = Some(TpegOtherPointDescriptor::read(r)?); e4.extend(v); }
0xe062d => { let v = r.raw()?; r.set(&mut e5, v.map(Box::new), 1581); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e1, 2700);
let v = Self {
tpeg_point_extension: e0,
point_coordinates: e1,
name: e2,
ilc: e3,
other_name: e4,
tpeg_junction_extension: e5,
};
r.close();
Ok(v)
}
}
impl TpegJunction {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.tpeg_point_extension { w.extension("loc:_tpegPointExtension", v)?; }
match &self.point_coordinates {
Some(v) => { v.write(w, "loc:pointCoordinates", "", "")?; }
None => return Err(w.missing("loc:pointCoordinates")),
}
if let Some(v) = &self.name { v.write(w, "loc:name", "", "")?; }
w.count("loc:ilc", self.ilc.len(), 1, 3)?;
for v in &self.ilc { v.write(w, "loc:ilc", "", "")?; }
for v in &self.other_name { v.write(w, "loc:otherName", "", "")?; }
if let Some(v) = &self.tpeg_junction_extension { w.extension("loc:_tpegJunctionExtension", v)?; }
w.end(tag)
}
}
impl TpegJunction {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 6];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = Vec::new();
let mut f4 = Vec::new();
let mut f5 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1223 => if r.first(&mut seen[0])? { f0 = r.raw_object()?.map(Box::new); },
1598 => if r.first(&mut seen[1])? { f1 = PointCoordinates::read_json(r)?.map(Box::new); },
1345 => if r.first(&mut seen[2])? { f2 = TpegJunctionPointDescriptor::read_json(r)?.map(Box::new); },
966 => if r.first(&mut seen[3])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = TpegIlcPointDescriptor::read_json(r)? { f3.push(v); } } },
1504 => if r.first(&mut seen[4])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = TpegOtherPointDescriptor::read_json(r)? { f4.push(v); } } },
1214 => if r.first(&mut seen[5])? { f5 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f1, 1598);
Ok(Self {
tpeg_point_extension: f0,
point_coordinates: f1,
name: f2,
ilc: f3,
other_name: f4,
tpeg_junction_extension: f5,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(603)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.tpeg_point_extension {
w.key(1223)?;
w.extension(v)?;
}
match &self.point_coordinates {
Some(v) => {
w.key(1598)?;
v.write_json(w, None)?;
}
None => w.absent(1598, w.missing("pointCoordinates"))?,
}
if let Some(v) = &self.name {
w.key(1345)?;
v.write_json(w, None)?;
}
w.count("ilc", self.ilc.len(), 1, 3)?;
if !self.ilc.is_empty() {
w.key(966)?;
w.begin_array()?;
for v in &self.ilc {
w.item()?;
v.write_json(w, None)?;
}
w.end_array()?;
}
if !self.other_name.is_empty() {
w.key(1504)?;
w.begin_array()?;
for v in &self.other_name {
w.item()?;
v.write_json(w, None)?;
}
w.end_array()?;
}
if let Some(v) = &self.tpeg_junction_extension {
w.key(1214)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:TpegJunctionPointDescriptor`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct TpegJunctionPointDescriptor {
/// XML element `loc:descriptor`.
pub descriptor: Option<MultilingualString>,
/// XML element `loc:_tpegDescriptorExtension`.
pub tpeg_descriptor_extension: Option<Box<Extension>>,
/// XML element `loc:_tpegPointDescriptorExtension`.
pub tpeg_point_descriptor_extension: Option<Box<Extension>>,
/// XML element `loc:tpegJunctionPointDescriptorType`.
pub tpeg_junction_point_descriptor_type: Option<TpegLoc03JunctionPointDescriptorSubtypeEnum>,
/// XML element `loc:_tpegJunctionPointDescriptorExtension`.
pub tpeg_junction_point_descriptor_extension: Option<Box<Extension>>,
}
impl TpegJunctionPointDescriptor {
const FIELDS: &'static [u32] = &[0xe07a9, 0xe0628, 0xe0633, 0xe0c33, 0xe062e];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe0236);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
let mut e4 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe07a9 => { let v = r.multilingual()?; r.set(&mut e0, v, 1961); }
0xe0628 => { let v = r.raw()?; r.set(&mut e1, v.map(Box::new), 1576); }
0xe0633 => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1587); }
0xe0c33 => { let v = r.enumeration::<TpegLoc03JunctionPointDescriptorSubtypeEnum>()?; r.set(&mut e3, v, 3123); }
0xe062e => { let v = r.raw()?; r.set(&mut e4, v.map(Box::new), 1582); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 1961);
r.required(&e3, 3123);
let v = Self {
descriptor: e0,
tpeg_descriptor_extension: e1,
tpeg_point_descriptor_extension: e2,
tpeg_junction_point_descriptor_type: e3,
tpeg_junction_point_descriptor_extension: e4,
};
r.close();
Ok(v)
}
}
impl TpegJunctionPointDescriptor {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
match &self.descriptor {
Some(v) => { w.multilingual("loc:descriptor", v)?; }
None => return Err(w.missing("loc:descriptor")),
}
if let Some(v) = &self.tpeg_descriptor_extension { w.extension("loc:_tpegDescriptorExtension", v)?; }
if let Some(v) = &self.tpeg_point_descriptor_extension { w.extension("loc:_tpegPointDescriptorExtension", v)?; }
match &self.tpeg_junction_point_descriptor_type {
Some(v) => { w.enumeration("loc:tpegJunctionPointDescriptorType", v.literal())?; }
None => return Err(w.missing("loc:tpegJunctionPointDescriptorType")),
}
if let Some(v) = &self.tpeg_junction_point_descriptor_extension { w.extension("loc:_tpegJunctionPointDescriptorExtension", v)?; }
w.end(tag)
}
}
impl TpegJunctionPointDescriptor {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 5];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
546 => if r.first(&mut seen[0])? { f0 = r.multilingual()?; },
1206 => if r.first(&mut seen[1])? { f1 = r.raw_object()?.map(Box::new); },
1222 => if r.first(&mut seen[2])? { f2 = r.raw_object()?.map(Box::new); },
2348 => if r.first(&mut seen[3])? { f3 = r.enumeration::<TpegLoc03JunctionPointDescriptorSubtypeEnum>()?; },
1215 => if r.first(&mut seen[4])? { f4 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 546);
r.required(&f3, 2348);
Ok(Self {
descriptor: f0,
tpeg_descriptor_extension: f1,
tpeg_point_descriptor_extension: f2,
tpeg_junction_point_descriptor_type: f3,
tpeg_junction_point_descriptor_extension: f4,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(604)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.descriptor {
Some(v) => {
w.key(546)?;
w.multilingual(v)?;
}
None => w.absent(546, w.missing("descriptor"))?,
}
if let Some(v) = &self.tpeg_descriptor_extension {
w.key(1206)?;
w.extension(v)?;
}
if let Some(v) = &self.tpeg_point_descriptor_extension {
w.key(1222)?;
w.extension(v)?;
}
match &self.tpeg_junction_point_descriptor_type {
Some(v) => {
w.key(2348)?;
w.enumeration(612, v.literal())?;
}
None => w.absent(2348, w.missing("tpegJunctionPointDescriptorType"))?,
}
if let Some(v) = &self.tpeg_junction_point_descriptor_extension {
w.key(1215)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:TpegLinearLocation`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct TpegLinearLocation {
/// XML element `loc:tpegDirection`.
pub tpeg_direction: Option<DirectionEnum>,
/// XML element `loc:tpegLinearLocationType`.
pub tpeg_linear_location_type: Option<TpegLoc01LinearLocationSubtypeEnum>,
/// XML element `loc:to`.
pub to: Option<TpegPoint>,
/// XML element `loc:from`.
pub from: Option<TpegPoint>,
/// XML element `loc:_tpegLinearLocationExtension`.
pub tpeg_linear_location_extension: Option<Box<Extension>>,
}
impl TpegLinearLocation {
const FIELDS: &'static [u32] = &[0xe0c2f, 0xe0c35, 0xe0c23, 0xe086c, 0xe062f];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe0237);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
let mut e4 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe0c2f => { let v = r.enumeration::<DirectionEnum>()?; r.set(&mut e0, v, 3119); }
0xe0c35 => { let v = r.enumeration::<TpegLoc01LinearLocationSubtypeEnum>()?; r.set(&mut e1, v, 3125); }
0xe0c23 => { let v = TpegPoint::read(r)?; r.set(&mut e2, v, 3107); }
0xe086c => { let v = TpegPoint::read(r)?; r.set(&mut e3, v, 2156); }
0xe062f => { let v = r.raw()?; r.set(&mut e4, v.map(Box::new), 1583); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 3119);
r.required(&e1, 3125);
r.required(&e2, 3107);
r.required(&e3, 2156);
let v = Self {
tpeg_direction: e0,
tpeg_linear_location_type: e1,
to: e2,
from: e3,
tpeg_linear_location_extension: e4,
};
r.close();
Ok(v)
}
}
impl TpegLinearLocation {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
match &self.tpeg_direction {
Some(v) => { w.enumeration("loc:tpegDirection", v.literal())?; }
None => return Err(w.missing("loc:tpegDirection")),
}
match &self.tpeg_linear_location_type {
Some(v) => { w.enumeration("loc:tpegLinearLocationType", v.literal())?; }
None => return Err(w.missing("loc:tpegLinearLocationType")),
}
match &self.to {
Some(v) => { v.write(w, "loc:to")?; }
None => return Err(w.missing("loc:to")),
}
match &self.from {
Some(v) => { v.write(w, "loc:from")?; }
None => return Err(w.missing("loc:from")),
}
if let Some(v) = &self.tpeg_linear_location_extension { w.extension("loc:_tpegLinearLocationExtension", v)?; }
w.end(tag)
}
}
impl TpegLinearLocation {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 5];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
2344 => if r.first(&mut seen[0])? { f0 = r.enumeration::<DirectionEnum>()?; },
2350 => if r.first(&mut seen[1])? { f1 = r.enumeration::<TpegLoc01LinearLocationSubtypeEnum>()?; },
2332 => if r.first(&mut seen[2])? { f2 = TpegPoint::read_json(r)?; },
866 => if r.first(&mut seen[3])? { f3 = TpegPoint::read_json(r)?; },
1216 => if r.first(&mut seen[4])? { f4 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 2344);
r.required(&f1, 2350);
r.required(&f2, 2332);
r.required(&f3, 866);
Ok(Self {
tpeg_direction: f0,
tpeg_linear_location_type: f1,
to: f2,
from: f3,
tpeg_linear_location_extension: f4,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(605)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.tpeg_direction {
Some(v) => {
w.key(2344)?;
w.enumeration(503, v.literal())?;
}
None => w.absent(2344, w.missing("tpegDirection"))?,
}
match &self.tpeg_linear_location_type {
Some(v) => {
w.key(2350)?;
w.enumeration(608, v.literal())?;
}
None => w.absent(2350, w.missing("tpegLinearLocationType"))?,
}
match &self.to {
Some(v) => {
w.key(2332)?;
v.write_json(w)?;
}
None => w.absent(2332, w.missing("to"))?,
}
match &self.from {
Some(v) => {
w.key(866)?;
v.write_json(w)?;
}
None => w.absent(866, w.missing("from"))?,
}
if let Some(v) = &self.tpeg_linear_location_extension {
w.key(1216)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:TpegNamedOnlyArea`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct TpegNamedOnlyArea {
/// XML element `loc:tpegAreaLocationType`.
pub tpeg_area_location_type: Option<TpegLoc01AreaLocationSubtypeEnum>,
/// XML element `loc:tpegHeight`.
pub tpeg_height: Option<Box<TpegHeight>>,
/// XML element `loc:_tpegAreaLocationExtension`.
pub tpeg_area_location_extension: Option<Box<Extension>>,
/// XML element `loc:name`.
pub name: Vec<TpegAreaDescriptor>,
/// XML element `loc:_tpegNamedOnlyAreaExtension`.
pub tpeg_named_only_area_extension: Option<Box<Extension>>,
}
impl TpegNamedOnlyArea {
const FIELDS: &'static [u32] = &[0xe0c2e, 0xe0c31, 0xe0627, 0xe098b, 0xe0630];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe0238);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = Vec::new();
let mut e4 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe0c2e => { let v = r.enumeration::<TpegLoc01AreaLocationSubtypeEnum>()?; r.set(&mut e0, v, 3118); }
0xe0c31 => { let v = Some(TpegHeight::read(r)?); r.set(&mut e1, v.map(Box::new), 3121); }
0xe0627 => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1575); }
0xe098b => { let v = Some(TpegAreaDescriptor::read(r)?); e3.extend(v); }
0xe0630 => { let v = r.raw()?; r.set(&mut e4, v.map(Box::new), 1584); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 3118);
let v = Self {
tpeg_area_location_type: e0,
tpeg_height: e1,
tpeg_area_location_extension: e2,
name: e3,
tpeg_named_only_area_extension: e4,
};
r.close();
Ok(v)
}
}
impl TpegNamedOnlyArea {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
match &self.tpeg_area_location_type {
Some(v) => { w.enumeration("loc:tpegAreaLocationType", v.literal())?; }
None => return Err(w.missing("loc:tpegAreaLocationType")),
}
if let Some(v) = &self.tpeg_height { v.write(w, "loc:tpegHeight", "", "")?; }
if let Some(v) = &self.tpeg_area_location_extension { w.extension("loc:_tpegAreaLocationExtension", v)?; }
w.count("loc:name", self.name.len(), 1, usize::MAX)?;
for v in &self.name { v.write(w, "loc:name", "", "")?; }
if let Some(v) = &self.tpeg_named_only_area_extension { w.extension("loc:_tpegNamedOnlyAreaExtension", v)?; }
w.end(tag)
}
}
impl TpegNamedOnlyArea {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 5];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = Vec::new();
let mut f4 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
2343 => if r.first(&mut seen[0])? { f0 = r.enumeration::<TpegLoc01AreaLocationSubtypeEnum>()?; },
2346 => if r.first(&mut seen[1])? { f1 = TpegHeight::read_json(r)?.map(Box::new); },
1205 => if r.first(&mut seen[2])? { f2 = r.raw_object()?.map(Box::new); },
1345 => if r.first(&mut seen[3])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = TpegAreaDescriptor::read_json(r)? { f3.push(v); } } },
1218 => if r.first(&mut seen[4])? { f4 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 2343);
Ok(Self {
tpeg_area_location_type: f0,
tpeg_height: f1,
tpeg_area_location_extension: f2,
name: f3,
tpeg_named_only_area_extension: f4,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(615)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.tpeg_area_location_type {
Some(v) => {
w.key(2343)?;
w.enumeration(606, v.literal())?;
}
None => w.absent(2343, w.missing("tpegAreaLocationType"))?,
}
if let Some(v) = &self.tpeg_height {
w.key(2346)?;
v.write_json(w, None)?;
}
if let Some(v) = &self.tpeg_area_location_extension {
w.key(1205)?;
w.extension(v)?;
}
w.count("name", self.name.len(), 1, usize::MAX)?;
if !self.name.is_empty() {
w.key(1345)?;
w.begin_array()?;
for v in &self.name {
w.item()?;
v.write_json(w, None)?;
}
w.end_array()?;
}
if let Some(v) = &self.tpeg_named_only_area_extension {
w.key(1218)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:TpegNonJunctionPoint`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct TpegNonJunctionPoint {
/// XML element `loc:_tpegPointExtension`.
pub tpeg_point_extension: Option<Box<Extension>>,
/// XML element `loc:pointCoordinates`.
pub point_coordinates: Option<Box<PointCoordinates>>,
/// XML element `loc:name`.
pub name: Vec<TpegOtherPointDescriptor>,
/// XML element `loc:_tpegNonJunctionPointExtension`.
pub tpeg_non_junction_point_extension: Option<Box<Extension>>,
}
impl TpegNonJunctionPoint {
const FIELDS: &'static [u32] = &[0xe0634, 0xe0a8c, 0xe098b, 0xe0631];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe0239);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = Vec::new();
let mut e3 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe0634 => { let v = r.raw()?; r.set(&mut e0, v.map(Box::new), 1588); }
0xe0a8c => { let v = Some(PointCoordinates::read(r)?); r.set(&mut e1, v.map(Box::new), 2700); }
0xe098b => { let v = Some(TpegOtherPointDescriptor::read(r)?); e2.extend(v); }
0xe0631 => { let v = r.raw()?; r.set(&mut e3, v.map(Box::new), 1585); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e1, 2700);
let v = Self {
tpeg_point_extension: e0,
point_coordinates: e1,
name: e2,
tpeg_non_junction_point_extension: e3,
};
r.close();
Ok(v)
}
}
impl TpegNonJunctionPoint {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.tpeg_point_extension { w.extension("loc:_tpegPointExtension", v)?; }
match &self.point_coordinates {
Some(v) => { v.write(w, "loc:pointCoordinates", "", "")?; }
None => return Err(w.missing("loc:pointCoordinates")),
}
w.count("loc:name", self.name.len(), 1, usize::MAX)?;
for v in &self.name { v.write(w, "loc:name", "", "")?; }
if let Some(v) = &self.tpeg_non_junction_point_extension { w.extension("loc:_tpegNonJunctionPointExtension", v)?; }
w.end(tag)
}
}
impl TpegNonJunctionPoint {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 4];
let mut f0 = None;
let mut f1 = None;
let mut f2 = Vec::new();
let mut f3 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1223 => if r.first(&mut seen[0])? { f0 = r.raw_object()?.map(Box::new); },
1598 => if r.first(&mut seen[1])? { f1 = PointCoordinates::read_json(r)?.map(Box::new); },
1345 => if r.first(&mut seen[2])? { let mut l = r.list()?; while r.item(&mut l)? { if let Some(v) = TpegOtherPointDescriptor::read_json(r)? { f2.push(v); } } },
1220 => if r.first(&mut seen[3])? { f3 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f1, 1598);
Ok(Self {
tpeg_point_extension: f0,
point_coordinates: f1,
name: f2,
tpeg_non_junction_point_extension: f3,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(616)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.tpeg_point_extension {
w.key(1223)?;
w.extension(v)?;
}
match &self.point_coordinates {
Some(v) => {
w.key(1598)?;
v.write_json(w, None)?;
}
None => w.absent(1598, w.missing("pointCoordinates"))?,
}
w.count("name", self.name.len(), 1, usize::MAX)?;
if !self.name.is_empty() {
w.key(1345)?;
w.begin_array()?;
for v in &self.name {
w.item()?;
v.write_json(w, None)?;
}
w.end_array()?;
}
if let Some(v) = &self.tpeg_non_junction_point_extension {
w.key(1220)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:TpegOtherPointDescriptor`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct TpegOtherPointDescriptor {
/// XML element `loc:descriptor`.
pub descriptor: Option<MultilingualString>,
/// XML element `loc:_tpegDescriptorExtension`.
pub tpeg_descriptor_extension: Option<Box<Extension>>,
/// XML element `loc:_tpegPointDescriptorExtension`.
pub tpeg_point_descriptor_extension: Option<Box<Extension>>,
/// XML element `loc:tpegOtherPointDescriptorType`.
pub tpeg_other_point_descriptor_type: Option<TpegLoc03OtherPointDescriptorSubtypeEnum>,
/// XML element `loc:_tpegOtherPointDescriptorExtension`.
pub tpeg_other_point_descriptor_extension: Option<Box<Extension>>,
}
impl TpegOtherPointDescriptor {
const FIELDS: &'static [u32] = &[0xe07a9, 0xe0628, 0xe0633, 0xe0c36, 0xe0632];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe023a);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
let mut e4 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe07a9 => { let v = r.multilingual()?; r.set(&mut e0, v, 1961); }
0xe0628 => { let v = r.raw()?; r.set(&mut e1, v.map(Box::new), 1576); }
0xe0633 => { let v = r.raw()?; r.set(&mut e2, v.map(Box::new), 1587); }
0xe0c36 => { let v = r.enumeration::<TpegLoc03OtherPointDescriptorSubtypeEnum>()?; r.set(&mut e3, v, 3126); }
0xe0632 => { let v = r.raw()?; r.set(&mut e4, v.map(Box::new), 1586); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 1961);
r.required(&e3, 3126);
let v = Self {
descriptor: e0,
tpeg_descriptor_extension: e1,
tpeg_point_descriptor_extension: e2,
tpeg_other_point_descriptor_type: e3,
tpeg_other_point_descriptor_extension: e4,
};
r.close();
Ok(v)
}
}
impl TpegOtherPointDescriptor {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
match &self.descriptor {
Some(v) => { w.multilingual("loc:descriptor", v)?; }
None => return Err(w.missing("loc:descriptor")),
}
if let Some(v) = &self.tpeg_descriptor_extension { w.extension("loc:_tpegDescriptorExtension", v)?; }
if let Some(v) = &self.tpeg_point_descriptor_extension { w.extension("loc:_tpegPointDescriptorExtension", v)?; }
match &self.tpeg_other_point_descriptor_type {
Some(v) => { w.enumeration("loc:tpegOtherPointDescriptorType", v.literal())?; }
None => return Err(w.missing("loc:tpegOtherPointDescriptorType")),
}
if let Some(v) = &self.tpeg_other_point_descriptor_extension { w.extension("loc:_tpegOtherPointDescriptorExtension", v)?; }
w.end(tag)
}
}
impl TpegOtherPointDescriptor {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 5];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
546 => if r.first(&mut seen[0])? { f0 = r.multilingual()?; },
1206 => if r.first(&mut seen[1])? { f1 = r.raw_object()?.map(Box::new); },
1222 => if r.first(&mut seen[2])? { f2 = r.raw_object()?.map(Box::new); },
2351 => if r.first(&mut seen[3])? { f3 = r.enumeration::<TpegLoc03OtherPointDescriptorSubtypeEnum>()?; },
1221 => if r.first(&mut seen[4])? { f4 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 546);
r.required(&f3, 2351);
Ok(Self {
descriptor: f0,
tpeg_descriptor_extension: f1,
tpeg_point_descriptor_extension: f2,
tpeg_other_point_descriptor_type: f3,
tpeg_other_point_descriptor_extension: f4,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(617)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.descriptor {
Some(v) => {
w.key(546)?;
w.multilingual(v)?;
}
None => w.absent(546, w.missing("descriptor"))?,
}
if let Some(v) = &self.tpeg_descriptor_extension {
w.key(1206)?;
w.extension(v)?;
}
if let Some(v) = &self.tpeg_point_descriptor_extension {
w.key(1222)?;
w.extension(v)?;
}
match &self.tpeg_other_point_descriptor_type {
Some(v) => {
w.key(2351)?;
w.enumeration(613, v.literal())?;
}
None => w.absent(2351, w.missing("tpegOtherPointDescriptorType"))?,
}
if let Some(v) = &self.tpeg_other_point_descriptor_extension {
w.key(1221)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:TpegSimplePoint`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct TpegSimplePoint {
/// XML element `loc:tpegDirection`.
pub tpeg_direction: Option<DirectionEnum>,
/// XML element `loc:_tpegPointLocationExtension`.
pub tpeg_point_location_extension: Option<Box<Extension>>,
/// XML element `loc:tpegSimplePointLocationType`.
pub tpeg_simple_point_location_type: Option<TpegLoc01SimplePointLocationSubtypeEnum>,
/// XML element `loc:point`.
pub point: Option<TpegPoint>,
/// XML element `loc:_tpegSimplePointExtension`.
pub tpeg_simple_point_extension: Option<Box<Extension>>,
}
impl TpegSimplePoint {
const FIELDS: &'static [u32] = &[0xe0c2f, 0xe0635, 0xe0c38, 0xe0a89, 0xe0636];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe023e);
r.attrs_done();
let mut e0 = None;
let mut e1 = None;
let mut e2 = None;
let mut e3 = None;
let mut e4 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe0c2f => { let v = r.enumeration::<DirectionEnum>()?; r.set(&mut e0, v, 3119); }
0xe0635 => { let v = r.raw()?; r.set(&mut e1, v.map(Box::new), 1589); }
0xe0c38 => { let v = r.enumeration::<TpegLoc01SimplePointLocationSubtypeEnum>()?; r.set(&mut e2, v, 3128); }
0xe0a89 => { let v = TpegPoint::read(r)?; r.set(&mut e3, v, 2697); }
0xe0636 => { let v = r.raw()?; r.set(&mut e4, v.map(Box::new), 1590); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 3119);
r.required(&e2, 3128);
r.required(&e3, 2697);
let v = Self {
tpeg_direction: e0,
tpeg_point_location_extension: e1,
tpeg_simple_point_location_type: e2,
point: e3,
tpeg_simple_point_extension: e4,
};
r.close();
Ok(v)
}
}
impl TpegSimplePoint {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
match &self.tpeg_direction {
Some(v) => { w.enumeration("loc:tpegDirection", v.literal())?; }
None => return Err(w.missing("loc:tpegDirection")),
}
if let Some(v) = &self.tpeg_point_location_extension { w.extension("loc:_tpegPointLocationExtension", v)?; }
match &self.tpeg_simple_point_location_type {
Some(v) => { w.enumeration("loc:tpegSimplePointLocationType", v.literal())?; }
None => return Err(w.missing("loc:tpegSimplePointLocationType")),
}
match &self.point {
Some(v) => { v.write(w, "loc:point")?; }
None => return Err(w.missing("loc:point")),
}
if let Some(v) = &self.tpeg_simple_point_extension { w.extension("loc:_tpegSimplePointExtension", v)?; }
w.end(tag)
}
}
impl TpegSimplePoint {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 5];
let mut f0 = None;
let mut f1 = None;
let mut f2 = None;
let mut f3 = None;
let mut f4 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
2344 => if r.first(&mut seen[0])? { f0 = r.enumeration::<DirectionEnum>()?; },
1224 => if r.first(&mut seen[1])? { f1 = r.raw_object()?.map(Box::new); },
2353 => if r.first(&mut seen[2])? { f2 = r.enumeration::<TpegLoc01SimplePointLocationSubtypeEnum>()?; },
1595 => if r.first(&mut seen[3])? { f3 = TpegPoint::read_json(r)?; },
1226 => if r.first(&mut seen[4])? { f4 = r.raw_object()?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 2344);
r.required(&f2, 2353);
r.required(&f3, 1595);
Ok(Self {
tpeg_direction: f0,
tpeg_point_location_extension: f1,
tpeg_simple_point_location_type: f2,
point: f3,
tpeg_simple_point_extension: f4,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(620)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.tpeg_direction {
Some(v) => {
w.key(2344)?;
w.enumeration(503, v.literal())?;
}
None => w.absent(2344, w.missing("tpegDirection"))?,
}
if let Some(v) = &self.tpeg_point_location_extension {
w.key(1224)?;
w.extension(v)?;
}
match &self.tpeg_simple_point_location_type {
Some(v) => {
w.key(2353)?;
w.enumeration(609, v.literal())?;
}
None => w.absent(2353, w.missing("tpegSimplePointLocationType"))?,
}
match &self.point {
Some(v) => {
w.key(1595)?;
v.write_json(w)?;
}
None => w.absent(1595, w.missing("point"))?,
}
if let Some(v) = &self.tpeg_simple_point_extension {
w.key(1226)?;
w.extension(v)?;
}
w.end_object()
}
}
/// XML type `loc:_IntermediatePointOnLinearElement`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct IntermediatePointOnLinearElement {
/// XML attribute `index`.
pub index: Option<i32>,
/// XML element `loc:referent`.
pub referent: Option<Box<Referent>>,
}
impl IntermediatePointOnLinearElement {
const FIELDS: &'static [u32] = &[0xe0b07];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe0317);
let a0 = r.req_attr_value::<i32>(2237)?;
r.attrs_done();
let mut e0 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe0b07 => { let v = Some(Referent::read(r)?); r.set(&mut e0, v.map(Box::new), 2823); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 2823);
let v = Self {
index: a0,
referent: e0,
};
r.close();
Ok(v)
}
}
impl IntermediatePointOnLinearElement {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
match &self.index {
Some(v) => { w.attr_value("index", v)?; }
None => return Err(w.missing_attr("index")),
}
match &self.referent {
Some(v) => { v.write(w, "loc:referent", "", "")?; }
None => return Err(w.missing("loc:referent")),
}
w.end(tag)
}
}
impl IntermediatePointOnLinearElement {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 2];
let mut f0 = None;
let mut f1 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
981 => if r.first(&mut seen[0])? { f0 = r.number::<i32>()?; },
1823 => if r.first(&mut seen[1])? { f1 = Referent::read_json(r)?.map(Box::new); },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 981);
r.required(&f1, 1823);
Ok(Self {
index: f0,
referent: f1,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(621)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.index {
Some(v) => {
w.key(981)?;
w.integer(*v)?;
}
None => w.absent(981, w.missing_attr("index"))?,
}
match &self.referent {
Some(v) => {
w.key(1823)?;
v.write_json(w, None)?;
}
None => w.absent(1823, w.missing("referent"))?,
}
w.end_object()
}
}
/// XML type `loc:_LocationContainedInItinerary`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct LocationContainedInItinerary {
/// XML attribute `index`.
pub index: Option<i32>,
/// XML element `loc:location`.
pub location: Option<Location>,
}
impl LocationContainedInItinerary {
const FIELDS: &'static [u32] = &[0xe091a];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe0321);
let a0 = r.req_attr_value::<i32>(2237)?;
r.attrs_done();
let mut e0 = None;
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe091a => { let v = Location::read(r)?; r.set(&mut e0, v, 2330); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => r.skip_unknown(key)?,
},
}
break;
}
}
r.required(&e0, 2330);
let v = Self {
index: a0,
location: e0,
};
r.close();
Ok(v)
}
}
impl LocationContainedInItinerary {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
match &self.index {
Some(v) => { w.attr_value("index", v)?; }
None => return Err(w.missing_attr("index")),
}
match &self.location {
Some(v) => { v.write(w, "loc:location")?; }
None => return Err(w.missing("loc:location")),
}
w.end(tag)
}
}
impl LocationContainedInItinerary {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 2];
let mut f0 = None;
let mut f1 = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
981 => if r.first(&mut seen[0])? { f0 = r.number::<i32>()?; },
1228 => if r.first(&mut seen[1])? { f1 = Location::read_json(r)?; },
_ => r.skip_unknown()?,
}
}
r.required(&f0, 981);
r.required(&f1, 1228);
Ok(Self {
index: f0,
location: f1,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(622)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
match &self.index {
Some(v) => {
w.key(981)?;
w.integer(*v)?;
}
None => w.absent(981, w.missing_attr("index"))?,
}
match &self.location {
Some(v) => {
w.key(1228)?;
v.write_json(w)?;
}
None => w.absent(1228, w.missing("location"))?,
}
w.end_object()
}
}
/// XML type `loc:_LocationExtensionType`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct LocationExtensionType {
/// XML element `loc:afirFacilityLocation`.
pub afir_facility_location: Option<Box<afac::AfirFacilityLocation>>,
/// Elements from other namespaces, kept as written.
pub other: Vec<Extension>,
}
impl LocationExtensionType {
const FIELDS: &'static [u32] = &[0xe06c2];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe0322);
r.attrs_done();
let mut e0 = None;
let mut other = Vec::new();
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe06c2 => { let v = Some(afac::AfirFacilityLocation::read(r)?); r.set(&mut e0, v.map(Box::new), 1730); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => other.push(r.raw_element()?),
},
}
break;
}
}
let v = Self {
afir_facility_location: e0,
other,
};
r.close();
Ok(v)
}
}
impl LocationExtensionType {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.afir_facility_location { v.write(w, "loc:afirFacilityLocation", "", "")?; }
for v in &self.other { w.foreign_element(v)?; }
w.end(tag)
}
}
impl LocationExtensionType {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 2];
let mut f0 = None;
let mut f1 = Vec::new();
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1 => if r.first(&mut seen[0])? { f0 = afac::AfirFacilityLocation::read_json(r)?.map(Box::new); },
5 => if r.first(&mut seen[0])? { f0 = afac::AfirFacilityLocation::read_json(r)?.map(Box::new); },
_ => f1.push(r.raw_member()?),
}
}
Ok(Self {
afir_facility_location: f0,
other: f1,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(535)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.afir_facility_location {
w.key(1)?;
v.write_json(w, None)?;
}
w.foreign_members(&self.other)?;
w.end_object()
}
}
/// XML type `loc:_LocationReferenceExtensionType`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct LocationReferenceExtensionType {
/// XML element `loc:facilityLocation`.
pub facility_location: Option<Box<locx::FacilityLocation>>,
/// Elements from other namespaces, kept as written.
pub other: Vec<Extension>,
}
impl LocationReferenceExtensionType {
const FIELDS: &'static [u32] = &[0xe0847];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe0323);
r.attrs_done();
let mut e0 = None;
let mut other = Vec::new();
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe0847 => { let v = Some(locx::FacilityLocation::read(r)?); r.set(&mut e0, v.map(Box::new), 2119); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => other.push(r.raw_element()?),
},
}
break;
}
}
let v = Self {
facility_location: e0,
other,
};
r.close();
Ok(v)
}
}
impl LocationReferenceExtensionType {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.facility_location { v.write(w, "loc:facilityLocation", "", "")?; }
for v in &self.other { w.foreign_element(v)?; }
w.end(tag)
}
}
impl LocationReferenceExtensionType {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 2];
let mut f0 = None;
let mut f1 = Vec::new();
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
5 => if r.first(&mut seen[0])? { f0 = locx::FacilityLocation::read_json(r)?.map(Box::new); },
_ => f1.push(r.raw_member()?),
}
}
Ok(Self {
facility_location: f0,
other: f1,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(540)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.facility_location {
w.key(5)?;
v.write_json(w, None)?;
}
w.foreign_members(&self.other)?;
w.end_object()
}
}
/// XML type `loc:_NamedAreaExtensionType`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct NamedAreaExtensionType {
/// XML element `loc:namedAreaExtended`.
pub named_area_extended: Option<Box<locx::NamedAreaExtended>>,
/// Elements from other namespaces, kept as written.
pub other: Vec<Extension>,
}
impl NamedAreaExtensionType {
const FIELDS: &'static [u32] = &[0xe098f];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe0332);
r.attrs_done();
let mut e0 = None;
let mut other = Vec::new();
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe098f => { let v = Some(locx::NamedAreaExtended::read(r)?); r.set(&mut e0, v.map(Box::new), 2447); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => other.push(r.raw_element()?),
},
}
break;
}
}
let v = Self {
named_area_extended: e0,
other,
};
r.close();
Ok(v)
}
}
impl NamedAreaExtensionType {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.named_area_extended { v.write(w, "loc:namedAreaExtended", "", "")?; }
for v in &self.other { w.foreign_element(v)?; }
w.end(tag)
}
}
impl NamedAreaExtensionType {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 2];
let mut f0 = None;
let mut f1 = Vec::new();
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
7 => if r.first(&mut seen[0])? { f0 = locx::NamedAreaExtended::read_json(r)?.map(Box::new); },
_ => f1.push(r.raw_member()?),
}
}
Ok(Self {
named_area_extended: f0,
other: f1,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(543)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.named_area_extended {
w.key(7)?;
v.write_json(w, None)?;
}
w.foreign_members(&self.other)?;
w.end_object()
}
}
/// XML type `loc:_SupplementaryPositionalDescriptionExtensionType`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct SupplementaryPositionalDescriptionExtensionType {
/// XML element `loc:supplementaryPositionalDescriptionExtended`.
pub supplementary_positional_description_extended: Option<Box<locx::SupplementaryPositionalDescriptionExtended>>,
/// Elements from other namespaces, kept as written.
pub other: Vec<Extension>,
}
impl SupplementaryPositionalDescriptionExtensionType {
const FIELDS: &'static [u32] = &[0xe0bf3];
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Self, Error> {
r.expect_type(0xe03cb);
r.attrs_done();
let mut e0 = None;
let mut other = Vec::new();
while let Some(mut key) = r.next_child()? {
loop {
match key {
0xe0bf3 => { let v = Some(locx::SupplementaryPositionalDescriptionExtended::read(r)?); r.set(&mut e0, v.map(Box::new), 3059); }
_ => match r.fallback(key, Self::FIELDS) {
Some(k) => { key = k; continue; }
None => other.push(r.raw_element()?),
},
}
break;
}
}
let v = Self {
supplementary_positional_description_extended: e0,
other,
};
r.close();
Ok(v)
}
}
impl SupplementaryPositionalDescriptionExtensionType {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str, kind: &'static str, fixed: &'static str) -> Result<(), Error> {
w.begin(tag)?;
w.constant_attrs(kind)?;
w.constant_attrs(fixed)?;
if let Some(v) = &self.supplementary_positional_description_extended { v.write(w, "loc:supplementaryPositionalDescriptionExtended", "", "")?; }
for v in &self.other { w.foreign_element(v)?; }
w.end(tag)
}
}
impl SupplementaryPositionalDescriptionExtensionType {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
Self::read_json_members(r, None).map(Some)
}
/// Reads the members of an object that is already open; `pending` is a member key read
/// already.
pub(crate) fn read_json_members(r: &mut JsonReader<'_>, mut pending: Option<u32>) -> Result<Self, Error> {
let mut seen = [false; 2];
let mut f0 = None;
let mut f1 = Vec::new();
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
14 => if r.first(&mut seen[0])? { f0 = locx::SupplementaryPositionalDescriptionExtended::read_json(r)?.map(Box::new); },
_ => f1.push(r.raw_member()?),
}
}
Ok(Self {
supplementary_positional_description_extended: f0,
other: f1,
})
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>, target_class: Option<&'static str>) -> Result<(), Error> {
w.begin_object(596)?;
if let Some(class) = target_class {
w.target_class(class)?;
}
if let Some(v) = &self.supplementary_positional_description_extended {
w.key(14)?;
v.write_json(w, None)?;
}
w.foreign_members(&self.other)?;
w.end_object()
}
}
/// Any concrete kind of XML type `loc:AlertCLinear`, chosen by `xsi:type`.
#[derive(Debug, Clone, PartialEq)]
pub enum AlertCLinear {
/// XML type `loc:AlertCLinearByCode`.
AlertCLinearByCode(Box<AlertCLinearByCode>),
/// XML type `loc:AlertCMethod2Linear`.
AlertCMethod2Linear(Box<AlertCMethod2Linear>),
/// XML type `loc:AlertCMethod4Linear`.
AlertCMethod4Linear(Box<AlertCMethod4Linear>),
}
impl AlertCLinear {
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Option<Self>, Error> {
Self::read_as(r, r.xsi_type())
}
pub(crate) fn read_as(r: &mut Xml<'_>, kind: Option<u32>) -> Result<Option<Self>, Error> {
Ok(Some(match kind {
Some(0xe001f) => Self::AlertCLinearByCode(Box::new(AlertCLinearByCode::read(r)?)),
Some(0xe0021) => Self::AlertCMethod2Linear(Box::new(AlertCMethod2Linear::read(r)?)),
Some(0xe0025) => Self::AlertCMethod4Linear(Box::new(AlertCMethod4Linear::read(r)?)),
_ => {
r.unknown_type("AlertCLinear")?;
return Ok(None);
}
}))
}
/// XML element `loc:alertCLocationCountryCode`, which every kind has.
pub fn alert_c_location_country_code(&self) -> Option<&str> {
match self {
Self::AlertCLinearByCode(v) => v.alert_c_location_country_code.as_deref(),
Self::AlertCMethod2Linear(v) => v.alert_c_location_country_code.as_deref(),
Self::AlertCMethod4Linear(v) => v.alert_c_location_country_code.as_deref(),
}
}
/// XML element `loc:alertCLocationTableNumber`, which every kind has.
pub fn alert_c_location_table_number(&self) -> Option<&str> {
match self {
Self::AlertCLinearByCode(v) => v.alert_c_location_table_number.as_deref(),
Self::AlertCMethod2Linear(v) => v.alert_c_location_table_number.as_deref(),
Self::AlertCMethod4Linear(v) => v.alert_c_location_table_number.as_deref(),
}
}
/// XML element `loc:alertCLocationTableVersion`, which every kind has.
pub fn alert_c_location_table_version(&self) -> Option<&str> {
match self {
Self::AlertCLinearByCode(v) => v.alert_c_location_table_version.as_deref(),
Self::AlertCMethod2Linear(v) => v.alert_c_location_table_version.as_deref(),
Self::AlertCMethod4Linear(v) => v.alert_c_location_table_version.as_deref(),
}
}
/// XML element `loc:_alertCLinearExtension`, which every kind has.
pub fn alert_c_linear_extension(&self) -> Option<&Extension> {
match self {
Self::AlertCLinearByCode(v) => v.alert_c_linear_extension.as_deref(),
Self::AlertCMethod2Linear(v) => v.alert_c_linear_extension.as_deref(),
Self::AlertCMethod4Linear(v) => v.alert_c_linear_extension.as_deref(),
}
}
}
impl AlertCLinear {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str) -> Result<(), Error> {
match self {
Self::AlertCLinearByCode(v) => v.write(w, tag, " xsi:type=\"loc:AlertCLinearByCode\"", ""),
Self::AlertCMethod2Linear(v) => v.write(w, tag, " xsi:type=\"loc:AlertCMethod2Linear\"", ""),
Self::AlertCMethod4Linear(v) => v.write(w, tag, " xsi:type=\"loc:AlertCMethod4Linear\"", ""),
}
}
}
impl AlertCLinear {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
let mut pending = r.next_key()?;
let mut seen = false;
let mut value = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1078 => if r.first(&mut seen)? { value = AlertCLinearByCode::read_json(r)?.map(|v| Self::AlertCLinearByCode(Box::new(v))); },
1082 => if r.first(&mut seen)? { value = AlertCMethod2Linear::read_json(r)?.map(|v| Self::AlertCMethod2Linear(Box::new(v))); },
1088 => if r.first(&mut seen)? { value = AlertCMethod4Linear::read_json(r)?.map(|v| Self::AlertCMethod4Linear(Box::new(v))); },
_ => r.skip_unknown()?,
}
}
if !seen {
r.warn(WarningKind::UnknownType, "no known kind of AlertCLinear in its wrapper".to_owned());
}
Ok(value)
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>) -> Result<(), Error> {
match self {
Self::AlertCLinearByCode(v) => {
if w.wrapper(1078)? {
w.begin_object(484)?;
w.key(1078)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::AlertCMethod2Linear(v) => {
if w.wrapper(1082)? {
w.begin_object(484)?;
w.key(1082)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::AlertCMethod4Linear(v) => {
if w.wrapper(1088)? {
w.begin_object(484)?;
w.key(1088)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
}
}
}
/// Any concrete kind of XML type `loc:AlertCPoint`, chosen by `xsi:type`.
#[derive(Debug, Clone, PartialEq)]
pub enum AlertCPoint {
/// XML type `loc:AlertCMethod2Point`.
AlertCMethod2Point(Box<AlertCMethod2Point>),
/// XML type `loc:AlertCMethod4Point`.
AlertCMethod4Point(Box<AlertCMethod4Point>),
}
impl AlertCPoint {
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Option<Self>, Error> {
Self::read_as(r, r.xsi_type())
}
pub(crate) fn read_as(r: &mut Xml<'_>, kind: Option<u32>) -> Result<Option<Self>, Error> {
Ok(Some(match kind {
Some(0xe0022) => Self::AlertCMethod2Point(Box::new(AlertCMethod2Point::read(r)?)),
Some(0xe0026) => Self::AlertCMethod4Point(Box::new(AlertCMethod4Point::read(r)?)),
_ => {
r.unknown_type("AlertCPoint")?;
return Ok(None);
}
}))
}
/// XML element `loc:alertCLocationCountryCode`, which every kind has.
pub fn alert_c_location_country_code(&self) -> Option<&str> {
match self {
Self::AlertCMethod2Point(v) => v.alert_c_location_country_code.as_deref(),
Self::AlertCMethod4Point(v) => v.alert_c_location_country_code.as_deref(),
}
}
/// XML element `loc:alertCLocationTableNumber`, which every kind has.
pub fn alert_c_location_table_number(&self) -> Option<&str> {
match self {
Self::AlertCMethod2Point(v) => v.alert_c_location_table_number.as_deref(),
Self::AlertCMethod4Point(v) => v.alert_c_location_table_number.as_deref(),
}
}
/// XML element `loc:alertCLocationTableVersion`, which every kind has.
pub fn alert_c_location_table_version(&self) -> Option<&str> {
match self {
Self::AlertCMethod2Point(v) => v.alert_c_location_table_version.as_deref(),
Self::AlertCMethod4Point(v) => v.alert_c_location_table_version.as_deref(),
}
}
/// XML element `loc:_alertCPointExtension`, which every kind has.
pub fn alert_c_point_extension(&self) -> Option<&Extension> {
match self {
Self::AlertCMethod2Point(v) => v.alert_c_point_extension.as_deref(),
Self::AlertCMethod4Point(v) => v.alert_c_point_extension.as_deref(),
}
}
}
impl AlertCPoint {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str) -> Result<(), Error> {
match self {
Self::AlertCMethod2Point(v) => v.write(w, tag, " xsi:type=\"loc:AlertCMethod2Point\"", ""),
Self::AlertCMethod4Point(v) => v.write(w, tag, " xsi:type=\"loc:AlertCMethod4Point\"", ""),
}
}
}
impl AlertCPoint {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
let mut pending = r.next_key()?;
let mut seen = false;
let mut value = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1084 => if r.first(&mut seen)? { value = AlertCMethod2Point::read_json(r)?.map(|v| Self::AlertCMethod2Point(Box::new(v))); },
1090 => if r.first(&mut seen)? { value = AlertCMethod4Point::read_json(r)?.map(|v| Self::AlertCMethod4Point(Box::new(v))); },
_ => r.skip_unknown()?,
}
}
if !seen {
r.warn(WarningKind::UnknownType, "no known kind of AlertCPoint in its wrapper".to_owned());
}
Ok(value)
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>) -> Result<(), Error> {
match self {
Self::AlertCMethod2Point(v) => {
if w.wrapper(1084)? {
w.begin_object(494)?;
w.key(1084)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::AlertCMethod4Point(v) => {
if w.wrapper(1090)? {
w.begin_object(494)?;
w.key(1090)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
}
}
}
/// Any concrete kind of XML type `loc:Destination`, chosen by `xsi:type`.
#[derive(Debug, Clone, PartialEq)]
pub enum Destination {
/// XML type `loc:AreaDestination`.
AreaDestination(Box<AreaDestination>),
/// XML type `loc:PointDestination`.
PointDestination(Box<PointDestination>),
}
impl Destination {
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Option<Self>, Error> {
Self::read_as(r, r.xsi_type())
}
pub(crate) fn read_as(r: &mut Xml<'_>, kind: Option<u32>) -> Result<Option<Self>, Error> {
Ok(Some(match kind {
Some(0xe0035) => Self::AreaDestination(Box::new(AreaDestination::read(r)?)),
Some(0xe0187) => Self::PointDestination(Box::new(PointDestination::read(r)?)),
_ => {
r.unknown_type("Destination")?;
return Ok(None);
}
}))
}
/// XML element `loc:_destinationExtension`, which every kind has.
pub fn destination_extension(&self) -> Option<&Extension> {
match self {
Self::AreaDestination(v) => v.destination_extension.as_deref(),
Self::PointDestination(v) => v.destination_extension.as_deref(),
}
}
}
impl Destination {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str) -> Result<(), Error> {
match self {
Self::AreaDestination(v) => v.write(w, tag, " xsi:type=\"loc:AreaDestination\"", ""),
Self::PointDestination(v) => v.write(w, tag, " xsi:type=\"loc:PointDestination\"", ""),
}
}
}
impl Destination {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
let mut pending = r.next_key()?;
let mut seen = false;
let mut value = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1096 => if r.first(&mut seen)? { value = AreaDestination::read_json(r)?.map(|v| Self::AreaDestination(Box::new(v))); },
1183 => if r.first(&mut seen)? { value = PointDestination::read_json(r)?.map(|v| Self::PointDestination(Box::new(v))); },
_ => r.skip_unknown()?,
}
}
if !seen {
r.warn(WarningKind::UnknownType, "no known kind of Destination in its wrapper".to_owned());
}
Ok(value)
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>) -> Result<(), Error> {
match self {
Self::AreaDestination(v) => {
if w.wrapper(1096)? {
w.begin_object(502)?;
w.key(1096)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::PointDestination(v) => {
if w.wrapper(1183)? {
w.begin_object(502)?;
w.key(1183)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
}
}
}
/// Any concrete kind of XML type `loc:DistanceAlongLinearElement`, chosen by `xsi:type`.
#[derive(Debug, Clone, PartialEq)]
pub enum DistanceAlongLinearElement {
/// XML type `loc:DistanceFromLinearElementReferent`.
DistanceFromLinearElementReferent(Box<DistanceFromLinearElementReferent>),
/// XML type `loc:DistanceFromLinearElementStart`.
DistanceFromLinearElementStart(Box<DistanceFromLinearElementStart>),
/// XML type `loc:PercentageDistanceAlongLinearElement`.
PercentageDistanceAlongLinearElement(Box<PercentageDistanceAlongLinearElement>),
}
impl DistanceAlongLinearElement {
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Option<Self>, Error> {
Self::read_as(r, r.xsi_type())
}
pub(crate) fn read_as(r: &mut Xml<'_>, kind: Option<u32>) -> Result<Option<Self>, Error> {
Ok(Some(match kind {
Some(0xe0088) => Self::DistanceFromLinearElementReferent(Box::new(DistanceFromLinearElementReferent::read(r)?)),
Some(0xe0089) => Self::DistanceFromLinearElementStart(Box::new(DistanceFromLinearElementStart::read(r)?)),
Some(0xe0172) => Self::PercentageDistanceAlongLinearElement(Box::new(PercentageDistanceAlongLinearElement::read(r)?)),
_ => {
r.unknown_type("DistanceAlongLinearElement")?;
return Ok(None);
}
}))
}
/// XML element `loc:_distanceAlongLinearElementExtension`, which every kind has.
pub fn distance_along_linear_element_extension(&self) -> Option<&Extension> {
match self {
Self::DistanceFromLinearElementReferent(v) => v.distance_along_linear_element_extension.as_deref(),
Self::DistanceFromLinearElementStart(v) => v.distance_along_linear_element_extension.as_deref(),
Self::PercentageDistanceAlongLinearElement(v) => v.distance_along_linear_element_extension.as_deref(),
}
}
}
impl DistanceAlongLinearElement {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str) -> Result<(), Error> {
match self {
Self::DistanceFromLinearElementReferent(v) => v.write(w, tag, " xsi:type=\"loc:DistanceFromLinearElementReferent\"", ""),
Self::DistanceFromLinearElementStart(v) => v.write(w, tag, " xsi:type=\"loc:DistanceFromLinearElementStart\"", ""),
Self::PercentageDistanceAlongLinearElement(v) => v.write(w, tag, " xsi:type=\"loc:PercentageDistanceAlongLinearElement\"", ""),
}
}
}
impl DistanceAlongLinearElement {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
let mut pending = r.next_key()?;
let mut seen = false;
let mut value = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1103 => if r.first(&mut seen)? { value = DistanceFromLinearElementReferent::read_json(r)?.map(|v| Self::DistanceFromLinearElementReferent(Box::new(v))); },
1105 => if r.first(&mut seen)? { value = DistanceFromLinearElementStart::read_json(r)?.map(|v| Self::DistanceFromLinearElementStart(Box::new(v))); },
1178 => if r.first(&mut seen)? { value = PercentageDistanceAlongLinearElement::read_json(r)?.map(|v| Self::PercentageDistanceAlongLinearElement(Box::new(v))); },
_ => r.skip_unknown()?,
}
}
if !seen {
r.warn(WarningKind::UnknownType, "no known kind of DistanceAlongLinearElement in its wrapper".to_owned());
}
Ok(value)
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>) -> Result<(), Error> {
match self {
Self::DistanceFromLinearElementReferent(v) => {
if w.wrapper(1103)? {
w.begin_object(505)?;
w.key(1103)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::DistanceFromLinearElementStart(v) => {
if w.wrapper(1105)? {
w.begin_object(505)?;
w.key(1105)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::PercentageDistanceAlongLinearElement(v) => {
if w.wrapper(1178)? {
w.begin_object(505)?;
w.key(1178)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
}
}
}
/// Any concrete kind of XML type `loc:GmlLineString`, chosen by `xsi:type`.
#[derive(Debug, Clone, PartialEq)]
pub enum AnyGmlLineString {
/// XML type `loc:GmlLineString`.
GmlLineString(Box<GmlLineString>),
/// XML type `loc:GmlLinearRing`.
GmlLinearRing(Box<GmlLinearRing>),
}
impl AnyGmlLineString {
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Option<Self>, Error> {
Self::read_as(r, r.xsi_type())
}
pub(crate) fn read_as(r: &mut Xml<'_>, kind: Option<u32>) -> Result<Option<Self>, Error> {
Ok(Some(match kind {
Some(0xe00cb) => Self::GmlLineString(Box::new(GmlLineString::read(r)?)),
Some(0xe00cc) => Self::GmlLinearRing(Box::new(GmlLinearRing::read(r)?)),
None => Self::GmlLineString(Box::new(GmlLineString::read(r)?)),
_ => {
r.unknown_type_as("GmlLineString");
Self::GmlLineString(Box::new(GmlLineString::read(r)?))
}
}))
}
/// XML attribute `srsDimension`, which every kind has.
pub fn srs_dimension(&self) -> Option<&com::NonNegativeInteger> {
match self {
Self::GmlLineString(v) => v.srs_dimension.as_ref(),
Self::GmlLinearRing(v) => v.srs_dimension.as_ref(),
}
}
/// XML attribute `srsName`, which every kind has.
pub fn srs_name(&self) -> Option<&str> {
match self {
Self::GmlLineString(v) => v.srs_name.as_deref(),
Self::GmlLinearRing(v) => v.srs_name.as_deref(),
}
}
/// XML element `loc:posList`, which every kind has.
pub fn pos_list(&self) -> Option<&str> {
match self {
Self::GmlLineString(v) => v.pos_list.as_deref(),
Self::GmlLinearRing(v) => v.pos_list.as_deref(),
}
}
/// XML element `loc:_gmlLineStringExtension`, which every kind has.
pub fn gml_line_string_extension(&self) -> Option<&Extension> {
match self {
Self::GmlLineString(v) => v.gml_line_string_extension.as_deref(),
Self::GmlLinearRing(v) => v.gml_line_string_extension.as_deref(),
}
}
}
impl AnyGmlLineString {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str) -> Result<(), Error> {
match self {
Self::GmlLineString(v) => v.write(w, tag, "", ""),
Self::GmlLinearRing(v) => v.write(w, tag, " xsi:type=\"loc:GmlLinearRing\"", ""),
}
}
}
impl AnyGmlLineString {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
let mut pending = r.next_key()?;
// The concrete base may come without its wrapper.
if let Some(key) = pending {
if !matches!(key, 1108 | 1110) {
return GmlLineString::read_json_members(r, Some(key)).map(|v| Some(Self::GmlLineString(Box::new(v))));
}
}
let mut seen = false;
let mut value = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1108 => if r.first(&mut seen)? { value = GmlLineString::read_json(r)?.map(|v| Self::GmlLineString(Box::new(v))); },
1110 => if r.first(&mut seen)? { value = GmlLinearRing::read_json(r)?.map(|v| Self::GmlLinearRing(Box::new(v))); },
_ => r.skip_unknown()?,
}
}
if !seen {
r.warn(WarningKind::UnknownType, "no known kind of GmlLineString in its wrapper".to_owned());
}
Ok(value)
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>) -> Result<(), Error> {
match self {
Self::GmlLineString(v) => {
if w.wrapper(1108)? {
w.begin_object(511)?;
w.key(1108)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::GmlLinearRing(v) => {
if w.wrapper(1110)? {
w.begin_object(511)?;
w.key(1110)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
}
}
}
/// Any concrete kind of XML type `loc:Itinerary`, chosen by `xsi:type`.
#[derive(Debug, Clone, PartialEq)]
pub enum Itinerary {
/// XML type `loc:ItineraryByIndexedLocations`.
ItineraryByIndexedLocations(Box<ItineraryByIndexedLocations>),
/// XML type `loc:ItineraryByReference`.
ItineraryByReference(Box<ItineraryByReference>),
}
impl Itinerary {
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Option<Self>, Error> {
Self::read_as(r, r.xsi_type())
}
pub(crate) fn read_as(r: &mut Xml<'_>, kind: Option<u32>) -> Result<Option<Self>, Error> {
Ok(Some(match kind {
Some(0xe00ee) => Self::ItineraryByIndexedLocations(Box::new(ItineraryByIndexedLocations::read(r)?)),
Some(0xe00ef) => Self::ItineraryByReference(Box::new(ItineraryByReference::read(r)?)),
_ => {
r.unknown_type("Itinerary")?;
return Ok(None);
}
}))
}
/// XML element `loc:_locationReferenceExtension`, which every kind has.
pub fn location_reference_extension(&self) -> Option<&LocationReferenceExtensionType> {
match self {
Self::ItineraryByIndexedLocations(v) => v.location_reference_extension.as_deref(),
Self::ItineraryByReference(v) => v.location_reference_extension.as_deref(),
}
}
/// XML element `loc:routeDestination`, which every kind has.
pub fn route_destination(&self) -> &[Destination] {
match self {
Self::ItineraryByIndexedLocations(v) => &v.route_destination,
Self::ItineraryByReference(v) => &v.route_destination,
}
}
/// XML element `loc:_itineraryExtension`, which every kind has.
pub fn itinerary_extension(&self) -> Option<&Extension> {
match self {
Self::ItineraryByIndexedLocations(v) => v.itinerary_extension.as_deref(),
Self::ItineraryByReference(v) => v.itinerary_extension.as_deref(),
}
}
}
impl Itinerary {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str) -> Result<(), Error> {
match self {
Self::ItineraryByIndexedLocations(v) => v.write(w, tag, " xsi:type=\"loc:ItineraryByIndexedLocations\"", ""),
Self::ItineraryByReference(v) => v.write(w, tag, " xsi:type=\"loc:ItineraryByReference\"", ""),
}
}
}
impl Itinerary {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
let mut pending = r.next_key()?;
let mut seen = false;
let mut value = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1117 => if r.first(&mut seen)? { value = ItineraryByIndexedLocations::read_json(r)?.map(|v| Self::ItineraryByIndexedLocations(Box::new(v))); },
1119 => if r.first(&mut seen)? { value = ItineraryByReference::read_json(r)?.map(|v| Self::ItineraryByReference(Box::new(v))); },
_ => r.skip_unknown()?,
}
}
if !seen {
r.warn(WarningKind::UnknownType, "no known kind of Itinerary in its wrapper".to_owned());
}
Ok(value)
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>) -> Result<(), Error> {
match self {
Self::ItineraryByIndexedLocations(v) => {
if w.wrapper(1117)? {
w.begin_object(522)?;
w.key(1117)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::ItineraryByReference(v) => {
if w.wrapper(1119)? {
w.begin_object(522)?;
w.key(1119)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
}
}
}
/// Any concrete kind of XML type `loc:LinearElement`, chosen by `xsi:type`.
#[derive(Debug, Clone, PartialEq)]
pub enum AnyLinearElement {
/// XML type `loc:LinearElement`.
LinearElement(Box<LinearElement>),
/// XML type `loc:LinearElementByCode`.
LinearElementByCode(Box<LinearElementByCode>),
/// XML type `loc:LinearElementByLineString`.
LinearElementByLineString(Box<LinearElementByLineString>),
/// XML type `loc:LinearElementByPoints`.
LinearElementByPoints(Box<LinearElementByPoints>),
}
impl AnyLinearElement {
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Option<Self>, Error> {
Self::read_as(r, r.xsi_type())
}
pub(crate) fn read_as(r: &mut Xml<'_>, kind: Option<u32>) -> Result<Option<Self>, Error> {
Ok(Some(match kind {
Some(0xe00f5) => Self::LinearElement(Box::new(LinearElement::read(r)?)),
Some(0xe00f6) => Self::LinearElementByCode(Box::new(LinearElementByCode::read(r)?)),
Some(0xe00f7) => Self::LinearElementByLineString(Box::new(LinearElementByLineString::read(r)?)),
Some(0xe00f8) => Self::LinearElementByPoints(Box::new(LinearElementByPoints::read(r)?)),
None => Self::LinearElement(Box::new(LinearElement::read(r)?)),
_ => {
r.unknown_type_as("LinearElement");
Self::LinearElement(Box::new(LinearElement::read(r)?))
}
}))
}
/// XML element `loc:roadName`, which every kind has.
pub fn road_name(&self) -> Option<&MultilingualString> {
match self {
Self::LinearElement(v) => v.road_name.as_ref(),
Self::LinearElementByCode(v) => v.road_name.as_ref(),
Self::LinearElementByLineString(v) => v.road_name.as_ref(),
Self::LinearElementByPoints(v) => v.road_name.as_ref(),
}
}
/// XML element `loc:roadNumber`, which every kind has.
pub fn road_number(&self) -> Option<&str> {
match self {
Self::LinearElement(v) => v.road_number.as_deref(),
Self::LinearElementByCode(v) => v.road_number.as_deref(),
Self::LinearElementByLineString(v) => v.road_number.as_deref(),
Self::LinearElementByPoints(v) => v.road_number.as_deref(),
}
}
/// XML element `loc:linearElementReferenceModel`, which every kind has.
pub fn linear_element_reference_model(&self) -> Option<&str> {
match self {
Self::LinearElement(v) => v.linear_element_reference_model.as_deref(),
Self::LinearElementByCode(v) => v.linear_element_reference_model.as_deref(),
Self::LinearElementByLineString(v) => v.linear_element_reference_model.as_deref(),
Self::LinearElementByPoints(v) => v.linear_element_reference_model.as_deref(),
}
}
/// XML element `loc:linearElementReferenceModelVersion`, which every kind has.
pub fn linear_element_reference_model_version(&self) -> Option<&str> {
match self {
Self::LinearElement(v) => v.linear_element_reference_model_version.as_deref(),
Self::LinearElementByCode(v) => v.linear_element_reference_model_version.as_deref(),
Self::LinearElementByLineString(v) => v.linear_element_reference_model_version.as_deref(),
Self::LinearElementByPoints(v) => v.linear_element_reference_model_version.as_deref(),
}
}
/// XML element `loc:linearElementNature`, which every kind has.
pub fn linear_element_nature(&self) -> Option<&LinearElementNatureEnum> {
match self {
Self::LinearElement(v) => v.linear_element_nature.as_ref(),
Self::LinearElementByCode(v) => v.linear_element_nature.as_ref(),
Self::LinearElementByLineString(v) => v.linear_element_nature.as_ref(),
Self::LinearElementByPoints(v) => v.linear_element_nature.as_ref(),
}
}
/// XML element `loc:_linearElementExtension`, which every kind has.
pub fn linear_element_extension(&self) -> Option<&Extension> {
match self {
Self::LinearElement(v) => v.linear_element_extension.as_deref(),
Self::LinearElementByCode(v) => v.linear_element_extension.as_deref(),
Self::LinearElementByLineString(v) => v.linear_element_extension.as_deref(),
Self::LinearElementByPoints(v) => v.linear_element_extension.as_deref(),
}
}
}
impl AnyLinearElement {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str) -> Result<(), Error> {
match self {
Self::LinearElement(v) => v.write(w, tag, "", ""),
Self::LinearElementByCode(v) => v.write(w, tag, " xsi:type=\"loc:LinearElementByCode\"", ""),
Self::LinearElementByLineString(v) => v.write(w, tag, " xsi:type=\"loc:LinearElementByLineString\"", ""),
Self::LinearElementByPoints(v) => v.write(w, tag, " xsi:type=\"loc:LinearElementByPoints\"", ""),
}
}
}
impl AnyLinearElement {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
let mut pending = r.next_key()?;
// The concrete base may come without its wrapper.
if let Some(key) = pending {
if !matches!(key, 1123 | 1124 | 1126 | 1128) {
return LinearElement::read_json_members(r, Some(key)).map(|v| Some(Self::LinearElement(Box::new(v))));
}
}
let mut seen = false;
let mut value = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1123 => if r.first(&mut seen)? { value = LinearElement::read_json(r)?.map(|v| Self::LinearElement(Box::new(v))); },
1124 => if r.first(&mut seen)? { value = LinearElementByCode::read_json(r)?.map(|v| Self::LinearElementByCode(Box::new(v))); },
1126 => if r.first(&mut seen)? { value = LinearElementByLineString::read_json(r)?.map(|v| Self::LinearElementByLineString(Box::new(v))); },
1128 => if r.first(&mut seen)? { value = LinearElementByPoints::read_json(r)?.map(|v| Self::LinearElementByPoints(Box::new(v))); },
_ => r.skip_unknown()?,
}
}
if !seen {
r.warn(WarningKind::UnknownType, "no known kind of LinearElement in its wrapper".to_owned());
}
Ok(value)
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>) -> Result<(), Error> {
match self {
Self::LinearElement(v) => {
if w.wrapper(1123)? {
w.begin_object(530)?;
w.key(1123)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::LinearElementByCode(v) => {
if w.wrapper(1124)? {
w.begin_object(530)?;
w.key(1124)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::LinearElementByLineString(v) => {
if w.wrapper(1126)? {
w.begin_object(530)?;
w.key(1126)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::LinearElementByPoints(v) => {
if w.wrapper(1128)? {
w.begin_object(530)?;
w.key(1128)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
}
}
}
/// Any concrete kind of XML type `loc:Location`, chosen by `xsi:type`.
#[derive(Debug, Clone, PartialEq)]
pub enum Location {
/// XML type `loc:AreaLocation`.
AreaLocation(Box<AreaLocation>),
/// XML type `loc:LocationByReference`.
LocationByReference(Box<LocationByReference>),
/// XML type `loc:LinearLocation`.
LinearLocation(Box<LinearLocation>),
/// XML type `loc:SingleRoadLinearLocation`.
SingleRoadLinearLocation(Box<SingleRoadLinearLocation>),
/// XML type `loc:PointLocation`.
PointLocation(Box<PointLocation>),
/// XML type `prk:PointLocationForParking`.
PointLocationForParking(Box<prk::PointLocationForParking>),
}
impl Location {
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Option<Self>, Error> {
Self::read_as(r, r.xsi_type())
}
pub(crate) fn read_as(r: &mut Xml<'_>, kind: Option<u32>) -> Result<Option<Self>, Error> {
Ok(Some(match kind {
Some(0xe0036) => Self::AreaLocation(Box::new(AreaLocation::read(r)?)),
Some(0xe00fd) => Self::LocationByReference(Box::new(LocationByReference::read(r)?)),
Some(0xe00f9) => Self::LinearLocation(Box::new(LinearLocation::read(r)?)),
Some(0xe01e8) => Self::SingleRoadLinearLocation(Box::new(SingleRoadLinearLocation::read(r)?)),
Some(0xe0188) => Self::PointLocation(Box::new(PointLocation::read(r)?)),
Some(0x100189) => Self::PointLocationForParking(Box::new(prk::PointLocationForParking::read(r)?)),
_ => {
r.unknown_type("Location")?;
return Ok(None);
}
}))
}
/// XML element `loc:_locationReferenceExtension`, which every kind has.
pub fn location_reference_extension(&self) -> Option<&LocationReferenceExtensionType> {
match self {
Self::AreaLocation(v) => v.location_reference_extension.as_deref(),
Self::LocationByReference(v) => v.location_reference_extension.as_deref(),
Self::LinearLocation(v) => v.location_reference_extension.as_deref(),
Self::SingleRoadLinearLocation(v) => v.location_reference_extension.as_deref(),
Self::PointLocation(v) => v.location_reference_extension.as_deref(),
Self::PointLocationForParking(v) => v.location_reference_extension.as_deref(),
}
}
/// XML element `loc:externalReferencing`, which every kind has.
pub fn external_referencing(&self) -> &[ExternalReferencing] {
match self {
Self::AreaLocation(v) => &v.external_referencing,
Self::LocationByReference(v) => &v.external_referencing,
Self::LinearLocation(v) => &v.external_referencing,
Self::SingleRoadLinearLocation(v) => &v.external_referencing,
Self::PointLocation(v) => &v.external_referencing,
Self::PointLocationForParking(v) => &v.external_referencing,
}
}
/// XML element `loc:coordinatesForDisplay`, which every kind has.
pub fn coordinates_for_display(&self) -> Option<&PointCoordinates> {
match self {
Self::AreaLocation(v) => v.coordinates_for_display.as_deref(),
Self::LocationByReference(v) => v.coordinates_for_display.as_deref(),
Self::LinearLocation(v) => v.coordinates_for_display.as_deref(),
Self::SingleRoadLinearLocation(v) => v.coordinates_for_display.as_deref(),
Self::PointLocation(v) => v.coordinates_for_display.as_deref(),
Self::PointLocationForParking(v) => v.coordinates_for_display.as_deref(),
}
}
/// XML element `loc:_locationExtension`, which every kind has.
pub fn location_extension(&self) -> Option<&LocationExtensionType> {
match self {
Self::AreaLocation(v) => v.location_extension.as_deref(),
Self::LocationByReference(v) => v.location_extension.as_deref(),
Self::LinearLocation(v) => v.location_extension.as_deref(),
Self::SingleRoadLinearLocation(v) => v.location_extension.as_deref(),
Self::PointLocation(v) => v.location_extension.as_deref(),
Self::PointLocationForParking(v) => v.location_extension.as_deref(),
}
}
}
impl Location {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str) -> Result<(), Error> {
match self {
Self::AreaLocation(v) => v.write(w, tag, " xsi:type=\"loc:AreaLocation\"", ""),
Self::LocationByReference(v) => v.write(w, tag, " xsi:type=\"loc:LocationByReference\"", ""),
Self::LinearLocation(v) => v.write(w, tag, " xsi:type=\"loc:LinearLocation\"", ""),
Self::SingleRoadLinearLocation(v) => v.write(w, tag, " xsi:type=\"loc:SingleRoadLinearLocation\"", ""),
Self::PointLocation(v) => v.write(w, tag, " xsi:type=\"loc:PointLocation\"", ""),
Self::PointLocationForParking(v) => v.write(w, tag, " xsi:type=\"prk:PointLocationForParking\"", ""),
}
}
}
impl Location {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
let mut pending = r.next_key()?;
let mut seen = false;
let mut value = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1098 => if r.first(&mut seen)? { value = AreaLocation::read_json(r)?.map(|v| Self::AreaLocation(Box::new(v))); },
1134 => if r.first(&mut seen)? { value = LocationByReference::read_json(r)?.map(|v| Self::LocationByReference(Box::new(v))); },
1131 => if r.first(&mut seen)? { value = LinearLocation::read_json(r)?.map(|v| Self::LinearLocation(Box::new(v))); },
1201 => if r.first(&mut seen)? { value = SingleRoadLinearLocation::read_json(r)?.map(|v| Self::SingleRoadLinearLocation(Box::new(v))); },
1185 => if r.first(&mut seen)? { value = PointLocation::read_json(r)?.map(|v| Self::PointLocation(Box::new(v))); },
1710 => if r.first(&mut seen)? { value = prk::PointLocationForParking::read_json(r)?.map(|v| Self::PointLocationForParking(Box::new(v))); },
_ => r.skip_unknown()?,
}
}
if !seen {
r.warn(WarningKind::UnknownType, "no known kind of Location in its wrapper".to_owned());
}
Ok(value)
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>) -> Result<(), Error> {
match self {
Self::AreaLocation(v) => {
if w.wrapper(1098)? {
w.begin_object(536)?;
w.key(1098)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::LocationByReference(v) => {
if w.wrapper(1134)? {
w.begin_object(536)?;
w.key(1134)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::LinearLocation(v) => {
if w.wrapper(1131)? {
w.begin_object(536)?;
w.key(1131)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::SingleRoadLinearLocation(v) => {
if w.wrapper(1201)? {
w.begin_object(536)?;
w.key(1201)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::PointLocation(v) => {
if w.wrapper(1185)? {
w.begin_object(536)?;
w.key(1185)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::PointLocationForParking(v) => {
if w.wrapper(1710)? {
w.begin_object(536)?;
w.key(1710)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
}
}
}
/// Any concrete kind of XML type `loc:LocationGroup`, chosen by `xsi:type`.
#[derive(Debug, Clone, PartialEq)]
pub enum LocationGroup {
/// XML type `loc:LocationGroupByList`.
LocationGroupByList(Box<LocationGroupByList>),
/// XML type `loc:LocationGroupByReference`.
LocationGroupByReference(Box<LocationGroupByReference>),
}
impl LocationGroup {
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Option<Self>, Error> {
Self::read_as(r, r.xsi_type())
}
pub(crate) fn read_as(r: &mut Xml<'_>, kind: Option<u32>) -> Result<Option<Self>, Error> {
Ok(Some(match kind {
Some(0xe0100) => Self::LocationGroupByList(Box::new(LocationGroupByList::read(r)?)),
Some(0xe0101) => Self::LocationGroupByReference(Box::new(LocationGroupByReference::read(r)?)),
_ => {
r.unknown_type("LocationGroup")?;
return Ok(None);
}
}))
}
/// XML element `loc:_locationReferenceExtension`, which every kind has.
pub fn location_reference_extension(&self) -> Option<&LocationReferenceExtensionType> {
match self {
Self::LocationGroupByList(v) => v.location_reference_extension.as_deref(),
Self::LocationGroupByReference(v) => v.location_reference_extension.as_deref(),
}
}
/// XML element `loc:_locationGroupExtension`, which every kind has.
pub fn location_group_extension(&self) -> Option<&Extension> {
match self {
Self::LocationGroupByList(v) => v.location_group_extension.as_deref(),
Self::LocationGroupByReference(v) => v.location_group_extension.as_deref(),
}
}
}
impl LocationGroup {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str) -> Result<(), Error> {
match self {
Self::LocationGroupByList(v) => v.write(w, tag, " xsi:type=\"loc:LocationGroupByList\"", ""),
Self::LocationGroupByReference(v) => v.write(w, tag, " xsi:type=\"loc:LocationGroupByReference\"", ""),
}
}
}
impl LocationGroup {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
let mut pending = r.next_key()?;
let mut seen = false;
let mut value = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1137 => if r.first(&mut seen)? { value = LocationGroupByList::read_json(r)?.map(|v| Self::LocationGroupByList(Box::new(v))); },
1139 => if r.first(&mut seen)? { value = LocationGroupByReference::read_json(r)?.map(|v| Self::LocationGroupByReference(Box::new(v))); },
_ => r.skip_unknown()?,
}
}
if !seen {
r.warn(WarningKind::UnknownType, "no known kind of LocationGroup in its wrapper".to_owned());
}
Ok(value)
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>) -> Result<(), Error> {
match self {
Self::LocationGroupByList(v) => {
if w.wrapper(1137)? {
w.begin_object(539)?;
w.key(1137)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::LocationGroupByReference(v) => {
if w.wrapper(1139)? {
w.begin_object(539)?;
w.key(1139)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
}
}
}
/// Any concrete kind of XML type `loc:LocationReference`, chosen by `xsi:type`.
#[derive(Debug, Clone, PartialEq)]
pub enum LocationReference {
/// XML type `loc:ItineraryByIndexedLocations`.
ItineraryByIndexedLocations(Box<ItineraryByIndexedLocations>),
/// XML type `loc:ItineraryByReference`.
ItineraryByReference(Box<ItineraryByReference>),
/// XML type `loc:AreaLocation`.
AreaLocation(Box<AreaLocation>),
/// XML type `loc:LocationByReference`.
LocationByReference(Box<LocationByReference>),
/// XML type `loc:LinearLocation`.
LinearLocation(Box<LinearLocation>),
/// XML type `loc:SingleRoadLinearLocation`.
SingleRoadLinearLocation(Box<SingleRoadLinearLocation>),
/// XML type `loc:PointLocation`.
PointLocation(Box<PointLocation>),
/// XML type `prk:PointLocationForParking`.
PointLocationForParking(Box<prk::PointLocationForParking>),
/// XML type `loc:LocationGroupByList`.
LocationGroupByList(Box<LocationGroupByList>),
/// XML type `loc:LocationGroupByReference`.
LocationGroupByReference(Box<LocationGroupByReference>),
}
impl LocationReference {
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Option<Self>, Error> {
Self::read_as(r, r.xsi_type())
}
pub(crate) fn read_as(r: &mut Xml<'_>, kind: Option<u32>) -> Result<Option<Self>, Error> {
Ok(Some(match kind {
Some(0xe00ee) => Self::ItineraryByIndexedLocations(Box::new(ItineraryByIndexedLocations::read(r)?)),
Some(0xe00ef) => Self::ItineraryByReference(Box::new(ItineraryByReference::read(r)?)),
Some(0xe0036) => Self::AreaLocation(Box::new(AreaLocation::read(r)?)),
Some(0xe00fd) => Self::LocationByReference(Box::new(LocationByReference::read(r)?)),
Some(0xe00f9) => Self::LinearLocation(Box::new(LinearLocation::read(r)?)),
Some(0xe01e8) => Self::SingleRoadLinearLocation(Box::new(SingleRoadLinearLocation::read(r)?)),
Some(0xe0188) => Self::PointLocation(Box::new(PointLocation::read(r)?)),
Some(0x100189) => Self::PointLocationForParking(Box::new(prk::PointLocationForParking::read(r)?)),
Some(0xe0100) => Self::LocationGroupByList(Box::new(LocationGroupByList::read(r)?)),
Some(0xe0101) => Self::LocationGroupByReference(Box::new(LocationGroupByReference::read(r)?)),
_ => {
r.unknown_type("LocationReference")?;
return Ok(None);
}
}))
}
/// XML element `loc:_locationReferenceExtension`, which every kind has.
pub fn location_reference_extension(&self) -> Option<&LocationReferenceExtensionType> {
match self {
Self::ItineraryByIndexedLocations(v) => v.location_reference_extension.as_deref(),
Self::ItineraryByReference(v) => v.location_reference_extension.as_deref(),
Self::AreaLocation(v) => v.location_reference_extension.as_deref(),
Self::LocationByReference(v) => v.location_reference_extension.as_deref(),
Self::LinearLocation(v) => v.location_reference_extension.as_deref(),
Self::SingleRoadLinearLocation(v) => v.location_reference_extension.as_deref(),
Self::PointLocation(v) => v.location_reference_extension.as_deref(),
Self::PointLocationForParking(v) => v.location_reference_extension.as_deref(),
Self::LocationGroupByList(v) => v.location_reference_extension.as_deref(),
Self::LocationGroupByReference(v) => v.location_reference_extension.as_deref(),
}
}
}
impl LocationReference {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str) -> Result<(), Error> {
match self {
Self::ItineraryByIndexedLocations(v) => v.write(w, tag, " xsi:type=\"loc:ItineraryByIndexedLocations\"", ""),
Self::ItineraryByReference(v) => v.write(w, tag, " xsi:type=\"loc:ItineraryByReference\"", ""),
Self::AreaLocation(v) => v.write(w, tag, " xsi:type=\"loc:AreaLocation\"", ""),
Self::LocationByReference(v) => v.write(w, tag, " xsi:type=\"loc:LocationByReference\"", ""),
Self::LinearLocation(v) => v.write(w, tag, " xsi:type=\"loc:LinearLocation\"", ""),
Self::SingleRoadLinearLocation(v) => v.write(w, tag, " xsi:type=\"loc:SingleRoadLinearLocation\"", ""),
Self::PointLocation(v) => v.write(w, tag, " xsi:type=\"loc:PointLocation\"", ""),
Self::PointLocationForParking(v) => v.write(w, tag, " xsi:type=\"prk:PointLocationForParking\"", ""),
Self::LocationGroupByList(v) => v.write(w, tag, " xsi:type=\"loc:LocationGroupByList\"", ""),
Self::LocationGroupByReference(v) => v.write(w, tag, " xsi:type=\"loc:LocationGroupByReference\"", ""),
}
}
}
impl LocationReference {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
let mut pending = r.next_key()?;
let mut seen = false;
let mut value = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1117 => if r.first(&mut seen)? { value = ItineraryByIndexedLocations::read_json(r)?.map(|v| Self::ItineraryByIndexedLocations(Box::new(v))); },
1119 => if r.first(&mut seen)? { value = ItineraryByReference::read_json(r)?.map(|v| Self::ItineraryByReference(Box::new(v))); },
1098 => if r.first(&mut seen)? { value = AreaLocation::read_json(r)?.map(|v| Self::AreaLocation(Box::new(v))); },
1134 => if r.first(&mut seen)? { value = LocationByReference::read_json(r)?.map(|v| Self::LocationByReference(Box::new(v))); },
1131 => if r.first(&mut seen)? { value = LinearLocation::read_json(r)?.map(|v| Self::LinearLocation(Box::new(v))); },
1201 => if r.first(&mut seen)? { value = SingleRoadLinearLocation::read_json(r)?.map(|v| Self::SingleRoadLinearLocation(Box::new(v))); },
1185 => if r.first(&mut seen)? { value = PointLocation::read_json(r)?.map(|v| Self::PointLocation(Box::new(v))); },
1710 => if r.first(&mut seen)? { value = prk::PointLocationForParking::read_json(r)?.map(|v| Self::PointLocationForParking(Box::new(v))); },
1137 => if r.first(&mut seen)? { value = LocationGroupByList::read_json(r)?.map(|v| Self::LocationGroupByList(Box::new(v))); },
1139 => if r.first(&mut seen)? { value = LocationGroupByReference::read_json(r)?.map(|v| Self::LocationGroupByReference(Box::new(v))); },
_ => r.skip_unknown()?,
}
}
if !seen {
r.warn(WarningKind::UnknownType, "no known kind of LocationReference in its wrapper".to_owned());
}
Ok(value)
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>) -> Result<(), Error> {
match self {
Self::ItineraryByIndexedLocations(v) => {
if w.wrapper(1117)? {
w.begin_object(541)?;
w.key(1117)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::ItineraryByReference(v) => {
if w.wrapper(1119)? {
w.begin_object(541)?;
w.key(1119)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::AreaLocation(v) => {
if w.wrapper(1098)? {
w.begin_object(541)?;
w.key(1098)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::LocationByReference(v) => {
if w.wrapper(1134)? {
w.begin_object(541)?;
w.key(1134)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::LinearLocation(v) => {
if w.wrapper(1131)? {
w.begin_object(541)?;
w.key(1131)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::SingleRoadLinearLocation(v) => {
if w.wrapper(1201)? {
w.begin_object(541)?;
w.key(1201)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::PointLocation(v) => {
if w.wrapper(1185)? {
w.begin_object(541)?;
w.key(1185)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::PointLocationForParking(v) => {
if w.wrapper(1710)? {
w.begin_object(541)?;
w.key(1710)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::LocationGroupByList(v) => {
if w.wrapper(1137)? {
w.begin_object(541)?;
w.key(1137)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::LocationGroupByReference(v) => {
if w.wrapper(1139)? {
w.begin_object(541)?;
w.key(1139)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
}
}
}
/// Any concrete kind of XML type `loc:NamedArea`, chosen by `xsi:type`.
#[derive(Debug, Clone, PartialEq)]
pub enum AnyNamedArea {
/// XML type `loc:NamedArea`.
NamedArea(Box<NamedArea>),
/// XML type `loc:IsoNamedArea`.
IsoNamedArea(Box<IsoNamedArea>),
/// XML type `loc:NutsNamedArea`.
NutsNamedArea(Box<NutsNamedArea>),
}
impl AnyNamedArea {
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Option<Self>, Error> {
Self::read_as(r, r.xsi_type())
}
pub(crate) fn read_as(r: &mut Xml<'_>, kind: Option<u32>) -> Result<Option<Self>, Error> {
Ok(Some(match kind {
Some(0xe011c) => Self::NamedArea(Box::new(NamedArea::read(r)?)),
Some(0xe00ec) => Self::IsoNamedArea(Box::new(IsoNamedArea::read(r)?)),
Some(0xe012f) => Self::NutsNamedArea(Box::new(NutsNamedArea::read(r)?)),
None => Self::NamedArea(Box::new(NamedArea::read(r)?)),
_ => {
r.unknown_type_as("NamedArea");
Self::NamedArea(Box::new(NamedArea::read(r)?))
}
}))
}
/// XML element `com:_namedAreaExtension`, which every kind has.
pub fn named_area_extension(&self) -> Option<&Extension> {
match self {
Self::NamedArea(v) => v.named_area_extension.as_deref(),
Self::IsoNamedArea(v) => v.named_area_extension.as_deref(),
Self::NutsNamedArea(v) => v.named_area_extension.as_deref(),
}
}
/// XML element `loc:areaName`, which every kind has.
pub fn area_name(&self) -> Option<&MultilingualString> {
match self {
Self::NamedArea(v) => v.area_name.as_ref(),
Self::IsoNamedArea(v) => v.area_name.as_ref(),
Self::NutsNamedArea(v) => v.area_name.as_ref(),
}
}
/// XML element `loc:namedAreaType`, which every kind has.
pub fn named_area_type(&self) -> Option<&NamedAreaTypeEnum> {
match self {
Self::NamedArea(v) => v.named_area_type.as_ref(),
Self::IsoNamedArea(v) => v.named_area_type.as_ref(),
Self::NutsNamedArea(v) => v.named_area_type.as_ref(),
}
}
/// XML element `loc:country`, which every kind has.
pub fn country(&self) -> Option<&str> {
match self {
Self::NamedArea(v) => v.country.as_deref(),
Self::IsoNamedArea(v) => v.country.as_deref(),
Self::NutsNamedArea(v) => v.country.as_deref(),
}
}
/// XML element `loc:_namedAreaExtension`, which every kind has.
pub fn loc_named_area_extension(&self) -> Option<&NamedAreaExtensionType> {
match self {
Self::NamedArea(v) => v.loc_named_area_extension.as_deref(),
Self::IsoNamedArea(v) => v.loc_named_area_extension.as_deref(),
Self::NutsNamedArea(v) => v.loc_named_area_extension.as_deref(),
}
}
}
impl AnyNamedArea {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str) -> Result<(), Error> {
match self {
Self::NamedArea(v) => v.write(w, tag, "", ""),
Self::IsoNamedArea(v) => v.write(w, tag, " xsi:type=\"loc:IsoNamedArea\"", ""),
Self::NutsNamedArea(v) => v.write(w, tag, " xsi:type=\"loc:NutsNamedArea\"", ""),
}
}
}
impl AnyNamedArea {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
let mut pending = r.next_key()?;
// The concrete base may come without its wrapper.
if let Some(key) = pending {
if !matches!(key, 1143 | 1115 | 1146) {
return NamedArea::read_json_members(r, Some(key)).map(|v| Some(Self::NamedArea(Box::new(v))));
}
}
let mut seen = false;
let mut value = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1143 => if r.first(&mut seen)? { value = NamedArea::read_json(r)?.map(|v| Self::NamedArea(Box::new(v))); },
1115 => if r.first(&mut seen)? { value = IsoNamedArea::read_json(r)?.map(|v| Self::IsoNamedArea(Box::new(v))); },
1146 => if r.first(&mut seen)? { value = NutsNamedArea::read_json(r)?.map(|v| Self::NutsNamedArea(Box::new(v))); },
_ => r.skip_unknown()?,
}
}
if !seen {
r.warn(WarningKind::UnknownType, "no known kind of NamedArea in its wrapper".to_owned());
}
Ok(value)
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>) -> Result<(), Error> {
match self {
Self::NamedArea(v) => {
if w.wrapper(1143)? {
w.begin_object(544)?;
w.key(1143)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::IsoNamedArea(v) => {
if w.wrapper(1115)? {
w.begin_object(544)?;
w.key(1115)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::NutsNamedArea(v) => {
if w.wrapper(1146)? {
w.begin_object(544)?;
w.key(1146)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
}
}
}
/// Any concrete kind of XML type `loc:NetworkLocation`, chosen by `xsi:type`.
#[derive(Debug, Clone, PartialEq)]
pub enum NetworkLocation {
/// XML type `loc:LinearLocation`.
LinearLocation(Box<LinearLocation>),
/// XML type `loc:SingleRoadLinearLocation`.
SingleRoadLinearLocation(Box<SingleRoadLinearLocation>),
/// XML type `loc:PointLocation`.
PointLocation(Box<PointLocation>),
/// XML type `prk:PointLocationForParking`.
PointLocationForParking(Box<prk::PointLocationForParking>),
}
impl NetworkLocation {
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Option<Self>, Error> {
Self::read_as(r, r.xsi_type())
}
pub(crate) fn read_as(r: &mut Xml<'_>, kind: Option<u32>) -> Result<Option<Self>, Error> {
Ok(Some(match kind {
Some(0xe00f9) => Self::LinearLocation(Box::new(LinearLocation::read(r)?)),
Some(0xe01e8) => Self::SingleRoadLinearLocation(Box::new(SingleRoadLinearLocation::read(r)?)),
Some(0xe0188) => Self::PointLocation(Box::new(PointLocation::read(r)?)),
Some(0x100189) => Self::PointLocationForParking(Box::new(prk::PointLocationForParking::read(r)?)),
_ => {
r.unknown_type("NetworkLocation")?;
return Ok(None);
}
}))
}
/// XML element `loc:_locationReferenceExtension`, which every kind has.
pub fn location_reference_extension(&self) -> Option<&LocationReferenceExtensionType> {
match self {
Self::LinearLocation(v) => v.location_reference_extension.as_deref(),
Self::SingleRoadLinearLocation(v) => v.location_reference_extension.as_deref(),
Self::PointLocation(v) => v.location_reference_extension.as_deref(),
Self::PointLocationForParking(v) => v.location_reference_extension.as_deref(),
}
}
/// XML element `loc:externalReferencing`, which every kind has.
pub fn external_referencing(&self) -> &[ExternalReferencing] {
match self {
Self::LinearLocation(v) => &v.external_referencing,
Self::SingleRoadLinearLocation(v) => &v.external_referencing,
Self::PointLocation(v) => &v.external_referencing,
Self::PointLocationForParking(v) => &v.external_referencing,
}
}
/// XML element `loc:coordinatesForDisplay`, which every kind has.
pub fn coordinates_for_display(&self) -> Option<&PointCoordinates> {
match self {
Self::LinearLocation(v) => v.coordinates_for_display.as_deref(),
Self::SingleRoadLinearLocation(v) => v.coordinates_for_display.as_deref(),
Self::PointLocation(v) => v.coordinates_for_display.as_deref(),
Self::PointLocationForParking(v) => v.coordinates_for_display.as_deref(),
}
}
/// XML element `loc:_locationExtension`, which every kind has.
pub fn location_extension(&self) -> Option<&LocationExtensionType> {
match self {
Self::LinearLocation(v) => v.location_extension.as_deref(),
Self::SingleRoadLinearLocation(v) => v.location_extension.as_deref(),
Self::PointLocation(v) => v.location_extension.as_deref(),
Self::PointLocationForParking(v) => v.location_extension.as_deref(),
}
}
/// XML element `loc:supplementaryPositionalDescription`, which every kind has.
pub fn supplementary_positional_description(&self) -> Option<&SupplementaryPositionalDescription> {
match self {
Self::LinearLocation(v) => v.supplementary_positional_description.as_deref(),
Self::SingleRoadLinearLocation(v) => v.supplementary_positional_description.as_deref(),
Self::PointLocation(v) => v.supplementary_positional_description.as_deref(),
Self::PointLocationForParking(v) => v.supplementary_positional_description.as_deref(),
}
}
/// XML element `loc:destination`, which every kind has.
pub fn destination(&self) -> Option<&Destination> {
match self {
Self::LinearLocation(v) => v.destination.as_ref(),
Self::SingleRoadLinearLocation(v) => v.destination.as_ref(),
Self::PointLocation(v) => v.destination.as_ref(),
Self::PointLocationForParking(v) => v.destination.as_ref(),
}
}
/// XML element `loc:_networkLocationExtension`, which every kind has.
pub fn network_location_extension(&self) -> Option<&Extension> {
match self {
Self::LinearLocation(v) => v.network_location_extension.as_deref(),
Self::SingleRoadLinearLocation(v) => v.network_location_extension.as_deref(),
Self::PointLocation(v) => v.network_location_extension.as_deref(),
Self::PointLocationForParking(v) => v.network_location_extension.as_deref(),
}
}
}
impl NetworkLocation {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str) -> Result<(), Error> {
match self {
Self::LinearLocation(v) => v.write(w, tag, " xsi:type=\"loc:LinearLocation\"", ""),
Self::SingleRoadLinearLocation(v) => v.write(w, tag, " xsi:type=\"loc:SingleRoadLinearLocation\"", ""),
Self::PointLocation(v) => v.write(w, tag, " xsi:type=\"loc:PointLocation\"", ""),
Self::PointLocationForParking(v) => v.write(w, tag, " xsi:type=\"prk:PointLocationForParking\"", ""),
}
}
}
impl NetworkLocation {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
let mut pending = r.next_key()?;
let mut seen = false;
let mut value = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1131 => if r.first(&mut seen)? { value = LinearLocation::read_json(r)?.map(|v| Self::LinearLocation(Box::new(v))); },
1201 => if r.first(&mut seen)? { value = SingleRoadLinearLocation::read_json(r)?.map(|v| Self::SingleRoadLinearLocation(Box::new(v))); },
1185 => if r.first(&mut seen)? { value = PointLocation::read_json(r)?.map(|v| Self::PointLocation(Box::new(v))); },
1710 => if r.first(&mut seen)? { value = prk::PointLocationForParking::read_json(r)?.map(|v| Self::PointLocationForParking(Box::new(v))); },
_ => r.skip_unknown()?,
}
}
if !seen {
r.warn(WarningKind::UnknownType, "no known kind of NetworkLocation in its wrapper".to_owned());
}
Ok(value)
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>) -> Result<(), Error> {
match self {
Self::LinearLocation(v) => {
if w.wrapper(1131)? {
w.begin_object(546)?;
w.key(1131)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::SingleRoadLinearLocation(v) => {
if w.wrapper(1201)? {
w.begin_object(546)?;
w.key(1201)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::PointLocation(v) => {
if w.wrapper(1185)? {
w.begin_object(546)?;
w.key(1185)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::PointLocationForParking(v) => {
if w.wrapper(1710)? {
w.begin_object(546)?;
w.key(1710)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
}
}
}
/// Any concrete kind of XML type `loc:OpenlrAreaLocationReference`, chosen by `xsi:type`.
#[derive(Debug, Clone, PartialEq)]
pub enum OpenlrAreaLocationReference {
/// XML type `loc:OpenlrCircleLocationReference`.
OpenlrCircleLocationReference(Box<OpenlrCircleLocationReference>),
/// XML type `loc:OpenlrClosedLineLocationReference`.
OpenlrClosedLineLocationReference(Box<OpenlrClosedLineLocationReference>),
/// XML type `loc:OpenlrGridLocationReference`.
OpenlrGridLocationReference(Box<OpenlrGridLocationReference>),
/// XML type `loc:OpenlrPolygonLocationReference`.
OpenlrPolygonLocationReference(Box<OpenlrPolygonLocationReference>),
/// XML type `loc:OpenlrRectangleLocationReference`.
OpenlrRectangleLocationReference(Box<OpenlrRectangleLocationReference>),
}
impl OpenlrAreaLocationReference {
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Option<Self>, Error> {
Self::read_as(r, r.xsi_type())
}
pub(crate) fn read_as(r: &mut Xml<'_>, kind: Option<u32>) -> Result<Option<Self>, Error> {
Ok(Some(match kind {
Some(0xe013b) => Self::OpenlrCircleLocationReference(Box::new(OpenlrCircleLocationReference::read(r)?)),
Some(0xe013c) => Self::OpenlrClosedLineLocationReference(Box::new(OpenlrClosedLineLocationReference::read(r)?)),
Some(0xe013e) => Self::OpenlrGridLocationReference(Box::new(OpenlrGridLocationReference::read(r)?)),
Some(0xe014a) => Self::OpenlrPolygonLocationReference(Box::new(OpenlrPolygonLocationReference::read(r)?)),
Some(0xe014c) => Self::OpenlrRectangleLocationReference(Box::new(OpenlrRectangleLocationReference::read(r)?)),
_ => {
r.unknown_type("OpenlrAreaLocationReference")?;
return Ok(None);
}
}))
}
/// XML element `loc:_openlrAreaLocationReferenceExtension`, which every kind has.
pub fn openlr_area_location_reference_extension(&self) -> Option<&Extension> {
match self {
Self::OpenlrCircleLocationReference(v) => v.openlr_area_location_reference_extension.as_deref(),
Self::OpenlrClosedLineLocationReference(v) => v.openlr_area_location_reference_extension.as_deref(),
Self::OpenlrGridLocationReference(v) => v.openlr_area_location_reference_extension.as_deref(),
Self::OpenlrPolygonLocationReference(v) => v.openlr_area_location_reference_extension.as_deref(),
Self::OpenlrRectangleLocationReference(v) => v.openlr_area_location_reference_extension.as_deref(),
}
}
}
impl OpenlrAreaLocationReference {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str) -> Result<(), Error> {
match self {
Self::OpenlrCircleLocationReference(v) => v.write(w, tag, " xsi:type=\"loc:OpenlrCircleLocationReference\"", ""),
Self::OpenlrClosedLineLocationReference(v) => v.write(w, tag, " xsi:type=\"loc:OpenlrClosedLineLocationReference\"", ""),
Self::OpenlrGridLocationReference(v) => v.write(w, tag, " xsi:type=\"loc:OpenlrGridLocationReference\"", ""),
Self::OpenlrPolygonLocationReference(v) => v.write(w, tag, " xsi:type=\"loc:OpenlrPolygonLocationReference\"", ""),
Self::OpenlrRectangleLocationReference(v) => v.write(w, tag, " xsi:type=\"loc:OpenlrRectangleLocationReference\"", ""),
}
}
}
impl OpenlrAreaLocationReference {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
let mut pending = r.next_key()?;
let mut seen = false;
let mut value = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1152 => if r.first(&mut seen)? { value = OpenlrCircleLocationReference::read_json(r)?.map(|v| Self::OpenlrCircleLocationReference(Box::new(v))); },
1154 => if r.first(&mut seen)? { value = OpenlrClosedLineLocationReference::read_json(r)?.map(|v| Self::OpenlrClosedLineLocationReference(Box::new(v))); },
1158 => if r.first(&mut seen)? { value = OpenlrGridLocationReference::read_json(r)?.map(|v| Self::OpenlrGridLocationReference(Box::new(v))); },
1173 => if r.first(&mut seen)? { value = OpenlrPolygonLocationReference::read_json(r)?.map(|v| Self::OpenlrPolygonLocationReference(Box::new(v))); },
1176 => if r.first(&mut seen)? { value = OpenlrRectangleLocationReference::read_json(r)?.map(|v| Self::OpenlrRectangleLocationReference(Box::new(v))); },
_ => r.skip_unknown()?,
}
}
if !seen {
r.warn(WarningKind::UnknownType, "no known kind of OpenlrAreaLocationReference in its wrapper".to_owned());
}
Ok(value)
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>) -> Result<(), Error> {
match self {
Self::OpenlrCircleLocationReference(v) => {
if w.wrapper(1152)? {
w.begin_object(550)?;
w.key(1152)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::OpenlrClosedLineLocationReference(v) => {
if w.wrapper(1154)? {
w.begin_object(550)?;
w.key(1154)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::OpenlrGridLocationReference(v) => {
if w.wrapper(1158)? {
w.begin_object(550)?;
w.key(1158)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::OpenlrPolygonLocationReference(v) => {
if w.wrapper(1173)? {
w.begin_object(550)?;
w.key(1173)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::OpenlrRectangleLocationReference(v) => {
if w.wrapper(1176)? {
w.begin_object(550)?;
w.key(1176)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
}
}
}
/// Any concrete kind of XML type `loc:OpenlrPointLocationReference`, chosen by `xsi:type`.
#[derive(Debug, Clone, PartialEq)]
pub enum OpenlrPointLocationReference {
/// XML type `loc:OpenlrPoiWithAccessPoint`.
OpenlrPoiWithAccessPoint(Box<OpenlrPoiWithAccessPoint>),
/// XML type `loc:OpenlrPointAlongLine`.
OpenlrPointAlongLine(Box<OpenlrPointAlongLine>),
/// XML type `loc:OpenlrGeoCoordinate`.
OpenlrGeoCoordinate(Box<OpenlrGeoCoordinate>),
}
impl OpenlrPointLocationReference {
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Option<Self>, Error> {
Self::read_as(r, r.xsi_type())
}
pub(crate) fn read_as(r: &mut Xml<'_>, kind: Option<u32>) -> Result<Option<Self>, Error> {
Ok(Some(match kind {
Some(0xe0146) => Self::OpenlrPoiWithAccessPoint(Box::new(OpenlrPoiWithAccessPoint::read(r)?)),
Some(0xe0147) => Self::OpenlrPointAlongLine(Box::new(OpenlrPointAlongLine::read(r)?)),
Some(0xe013d) => Self::OpenlrGeoCoordinate(Box::new(OpenlrGeoCoordinate::read(r)?)),
_ => {
r.unknown_type("OpenlrPointLocationReference")?;
return Ok(None);
}
}))
}
/// XML element `loc:_openlrPointLocationReferenceExtension`, which every kind has.
pub fn openlr_point_location_reference_extension(&self) -> Option<&Extension> {
match self {
Self::OpenlrPoiWithAccessPoint(v) => v.openlr_point_location_reference_extension.as_deref(),
Self::OpenlrPointAlongLine(v) => v.openlr_point_location_reference_extension.as_deref(),
Self::OpenlrGeoCoordinate(v) => v.openlr_point_location_reference_extension.as_deref(),
}
}
}
impl OpenlrPointLocationReference {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str) -> Result<(), Error> {
match self {
Self::OpenlrPoiWithAccessPoint(v) => v.write(w, tag, " xsi:type=\"loc:OpenlrPoiWithAccessPoint\"", ""),
Self::OpenlrPointAlongLine(v) => v.write(w, tag, " xsi:type=\"loc:OpenlrPointAlongLine\"", ""),
Self::OpenlrGeoCoordinate(v) => v.write(w, tag, " xsi:type=\"loc:OpenlrGeoCoordinate\"", ""),
}
}
}
impl OpenlrPointLocationReference {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
let mut pending = r.next_key()?;
let mut seen = false;
let mut value = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1167 => if r.first(&mut seen)? { value = OpenlrPoiWithAccessPoint::read_json(r)?.map(|v| Self::OpenlrPoiWithAccessPoint(Box::new(v))); },
1169 => if r.first(&mut seen)? { value = OpenlrPointAlongLine::read_json(r)?.map(|v| Self::OpenlrPointAlongLine(Box::new(v))); },
1156 => if r.first(&mut seen)? { value = OpenlrGeoCoordinate::read_json(r)?.map(|v| Self::OpenlrGeoCoordinate(Box::new(v))); },
_ => r.skip_unknown()?,
}
}
if !seen {
r.warn(WarningKind::UnknownType, "no known kind of OpenlrPointLocationReference in its wrapper".to_owned());
}
Ok(value)
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>) -> Result<(), Error> {
match self {
Self::OpenlrPoiWithAccessPoint(v) => {
if w.wrapper(1167)? {
w.begin_object(567)?;
w.key(1167)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::OpenlrPointAlongLine(v) => {
if w.wrapper(1169)? {
w.begin_object(567)?;
w.key(1169)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::OpenlrGeoCoordinate(v) => {
if w.wrapper(1156)? {
w.begin_object(567)?;
w.key(1156)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
}
}
}
/// Any concrete kind of XML type `loc:PointLocation`, chosen by `xsi:type`.
#[derive(Debug, Clone, PartialEq)]
pub enum AnyPointLocation {
/// XML type `loc:PointLocation`.
PointLocation(Box<PointLocation>),
/// XML type `prk:PointLocationForParking`.
PointLocationForParking(Box<prk::PointLocationForParking>),
}
impl AnyPointLocation {
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Option<Self>, Error> {
Self::read_as(r, r.xsi_type())
}
pub(crate) fn read_as(r: &mut Xml<'_>, kind: Option<u32>) -> Result<Option<Self>, Error> {
Ok(Some(match kind {
Some(0xe0188) => Self::PointLocation(Box::new(PointLocation::read(r)?)),
Some(0x100189) => Self::PointLocationForParking(Box::new(prk::PointLocationForParking::read(r)?)),
None => Self::PointLocation(Box::new(PointLocation::read(r)?)),
_ => {
r.unknown_type_as("PointLocation");
Self::PointLocation(Box::new(PointLocation::read(r)?))
}
}))
}
/// XML element `loc:_locationReferenceExtension`, which every kind has.
pub fn location_reference_extension(&self) -> Option<&LocationReferenceExtensionType> {
match self {
Self::PointLocation(v) => v.location_reference_extension.as_deref(),
Self::PointLocationForParking(v) => v.location_reference_extension.as_deref(),
}
}
/// XML element `loc:externalReferencing`, which every kind has.
pub fn external_referencing(&self) -> &[ExternalReferencing] {
match self {
Self::PointLocation(v) => &v.external_referencing,
Self::PointLocationForParking(v) => &v.external_referencing,
}
}
/// XML element `loc:coordinatesForDisplay`, which every kind has.
pub fn coordinates_for_display(&self) -> Option<&PointCoordinates> {
match self {
Self::PointLocation(v) => v.coordinates_for_display.as_deref(),
Self::PointLocationForParking(v) => v.coordinates_for_display.as_deref(),
}
}
/// XML element `loc:_locationExtension`, which every kind has.
pub fn location_extension(&self) -> Option<&LocationExtensionType> {
match self {
Self::PointLocation(v) => v.location_extension.as_deref(),
Self::PointLocationForParking(v) => v.location_extension.as_deref(),
}
}
/// XML element `loc:supplementaryPositionalDescription`, which every kind has.
pub fn supplementary_positional_description(&self) -> Option<&SupplementaryPositionalDescription> {
match self {
Self::PointLocation(v) => v.supplementary_positional_description.as_deref(),
Self::PointLocationForParking(v) => v.supplementary_positional_description.as_deref(),
}
}
/// XML element `loc:destination`, which every kind has.
pub fn destination(&self) -> Option<&Destination> {
match self {
Self::PointLocation(v) => v.destination.as_ref(),
Self::PointLocationForParking(v) => v.destination.as_ref(),
}
}
/// XML element `loc:_networkLocationExtension`, which every kind has.
pub fn network_location_extension(&self) -> Option<&Extension> {
match self {
Self::PointLocation(v) => v.network_location_extension.as_deref(),
Self::PointLocationForParking(v) => v.network_location_extension.as_deref(),
}
}
/// XML element `loc:pointByCoordinates`, which every kind has.
pub fn point_by_coordinates(&self) -> Option<&PointByCoordinates> {
match self {
Self::PointLocation(v) => v.point_by_coordinates.as_deref(),
Self::PointLocationForParking(v) => v.point_by_coordinates.as_deref(),
}
}
/// XML element `loc:pointAlongLinearElement`, which every kind has.
pub fn point_along_linear_element(&self) -> &[PointAlongLinearElement] {
match self {
Self::PointLocation(v) => &v.point_along_linear_element,
Self::PointLocationForParking(v) => &v.point_along_linear_element,
}
}
/// XML element `loc:alertCPoint`, which every kind has.
pub fn alert_c_point(&self) -> &[AlertCPoint] {
match self {
Self::PointLocation(v) => &v.alert_c_point,
Self::PointLocationForParking(v) => &v.alert_c_point,
}
}
/// XML element `loc:tpegPointLocation`, which every kind has.
pub fn tpeg_point_location(&self) -> Option<&TpegPointLocation> {
match self {
Self::PointLocation(v) => v.tpeg_point_location.as_ref(),
Self::PointLocationForParking(v) => v.tpeg_point_location.as_ref(),
}
}
/// XML element `loc:openlrPointLocationReference`, which every kind has.
pub fn openlr_point_location_reference(&self) -> Option<&OpenlrPointLocationReference> {
match self {
Self::PointLocation(v) => v.openlr_point_location_reference.as_ref(),
Self::PointLocationForParking(v) => v.openlr_point_location_reference.as_ref(),
}
}
/// XML element `loc:_pointLocationExtension`, which every kind has.
pub fn point_location_extension(&self) -> Option<&Extension> {
match self {
Self::PointLocation(v) => v.point_location_extension.as_deref(),
Self::PointLocationForParking(v) => v.point_location_extension.as_deref(),
}
}
}
impl AnyPointLocation {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str) -> Result<(), Error> {
match self {
Self::PointLocation(v) => v.write(w, tag, "", ""),
Self::PointLocationForParking(v) => v.write(w, tag, " xsi:type=\"prk:PointLocationForParking\"", ""),
}
}
}
impl AnyPointLocation {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
let mut pending = r.next_key()?;
// The concrete base may come without its wrapper.
if let Some(key) = pending {
if !matches!(key, 1185 | 1710) {
return PointLocation::read_json_members(r, Some(key)).map(|v| Some(Self::PointLocation(Box::new(v))));
}
}
let mut seen = false;
let mut value = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1185 => if r.first(&mut seen)? { value = PointLocation::read_json(r)?.map(|v| Self::PointLocation(Box::new(v))); },
1710 => if r.first(&mut seen)? { value = prk::PointLocationForParking::read_json(r)?.map(|v| Self::PointLocationForParking(Box::new(v))); },
_ => r.skip_unknown()?,
}
}
if !seen {
r.warn(WarningKind::UnknownType, "no known kind of PointLocation in its wrapper".to_owned());
}
Ok(value)
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>) -> Result<(), Error> {
match self {
Self::PointLocation(v) => {
if w.wrapper(1185)? {
w.begin_object(579)?;
w.key(1185)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::PointLocationForParking(v) => {
if w.wrapper(1710)? {
w.begin_object(579)?;
w.key(1710)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
}
}
}
/// Any concrete kind of XML type `loc:PredefinedLocationReference`, chosen by `xsi:type`.
#[derive(Debug, Clone, PartialEq)]
pub enum PredefinedLocationReference {
/// XML type `loc:PredefinedItinerary`.
PredefinedItinerary(Box<PredefinedItinerary>),
/// XML type `loc:PredefinedLocation`.
PredefinedLocation(Box<PredefinedLocation>),
/// XML type `loc:PredefinedLocationGroup`.
PredefinedLocationGroup(Box<PredefinedLocationGroup>),
}
impl PredefinedLocationReference {
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Option<Self>, Error> {
Self::read_as(r, r.xsi_type())
}
pub(crate) fn read_as(r: &mut Xml<'_>, kind: Option<u32>) -> Result<Option<Self>, Error> {
Ok(Some(match kind {
Some(0xe0197) => Self::PredefinedItinerary(Box::new(PredefinedItinerary::read(r)?)),
Some(0xe0198) => Self::PredefinedLocation(Box::new(PredefinedLocation::read(r)?)),
Some(0xe0199) => Self::PredefinedLocationGroup(Box::new(PredefinedLocationGroup::read(r)?)),
_ => {
r.unknown_type("PredefinedLocationReference")?;
return Ok(None);
}
}))
}
/// XML element `loc:_predefinedLocationReferenceExtension`, which every kind has.
pub fn predefined_location_reference_extension(&self) -> Option<&Extension> {
match self {
Self::PredefinedItinerary(v) => v.predefined_location_reference_extension.as_deref(),
Self::PredefinedLocation(v) => v.predefined_location_reference_extension.as_deref(),
Self::PredefinedLocationGroup(v) => v.predefined_location_reference_extension.as_deref(),
}
}
}
impl PredefinedLocationReference {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str) -> Result<(), Error> {
match self {
Self::PredefinedItinerary(v) => v.write(w, tag, " xsi:type=\"loc:PredefinedItinerary\"", ""),
Self::PredefinedLocation(v) => v.write(w, tag, " xsi:type=\"loc:PredefinedLocation\"", ""),
Self::PredefinedLocationGroup(v) => v.write(w, tag, " xsi:type=\"loc:PredefinedLocationGroup\"", ""),
}
}
}
impl PredefinedLocationReference {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
let mut pending = r.next_key()?;
let mut seen = false;
let mut value = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1189 => if r.first(&mut seen)? { value = PredefinedItinerary::read_json(r)?.map(|v| Self::PredefinedItinerary(Box::new(v))); },
1191 => if r.first(&mut seen)? { value = PredefinedLocation::read_json(r)?.map(|v| Self::PredefinedLocation(Box::new(v))); },
1193 => if r.first(&mut seen)? { value = PredefinedLocationGroup::read_json(r)?.map(|v| Self::PredefinedLocationGroup(Box::new(v))); },
_ => r.skip_unknown()?,
}
}
if !seen {
r.warn(WarningKind::UnknownType, "no known kind of PredefinedLocationReference in its wrapper".to_owned());
}
Ok(value)
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>) -> Result<(), Error> {
match self {
Self::PredefinedItinerary(v) => {
if w.wrapper(1189)? {
w.begin_object(586)?;
w.key(1189)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::PredefinedLocation(v) => {
if w.wrapper(1191)? {
w.begin_object(586)?;
w.key(1191)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::PredefinedLocationGroup(v) => {
if w.wrapper(1193)? {
w.begin_object(586)?;
w.key(1193)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
}
}
}
/// Any concrete kind of XML type `loc:RoadInformation`, chosen by `xsi:type`.
#[derive(Debug, Clone, PartialEq)]
pub enum AnyRoadInformation {
/// XML type `loc:RoadInformation`.
RoadInformation(Box<RoadInformation>),
/// XML type `prk:RoadInformationEnhanced`.
RoadInformationEnhanced(Box<prk::RoadInformationEnhanced>),
}
impl AnyRoadInformation {
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Option<Self>, Error> {
Self::read_as(r, r.xsi_type())
}
pub(crate) fn read_as(r: &mut Xml<'_>, kind: Option<u32>) -> Result<Option<Self>, Error> {
Ok(Some(match kind {
Some(0xe01cc) => Self::RoadInformation(Box::new(RoadInformation::read(r)?)),
Some(0x1001cd) => Self::RoadInformationEnhanced(Box::new(prk::RoadInformationEnhanced::read(r)?)),
None => Self::RoadInformation(Box::new(RoadInformation::read(r)?)),
_ => {
r.unknown_type_as("RoadInformation");
Self::RoadInformation(Box::new(RoadInformation::read(r)?))
}
}))
}
/// XML element `loc:roadDestination`, which every kind has.
pub fn road_destination(&self) -> Option<&str> {
match self {
Self::RoadInformation(v) => v.road_destination.as_deref(),
Self::RoadInformationEnhanced(v) => v.road_destination.as_deref(),
}
}
/// XML element `loc:roadName`, which every kind has.
pub fn road_name(&self) -> Option<&str> {
match self {
Self::RoadInformation(v) => v.road_name.as_deref(),
Self::RoadInformationEnhanced(v) => v.road_name.as_deref(),
}
}
/// XML element `loc:roadNumber`, which every kind has.
pub fn road_number(&self) -> Option<&str> {
match self {
Self::RoadInformation(v) => v.road_number.as_deref(),
Self::RoadInformationEnhanced(v) => v.road_number.as_deref(),
}
}
/// XML element `loc:_roadInformationExtension`, which every kind has.
pub fn road_information_extension(&self) -> Option<&Extension> {
match self {
Self::RoadInformation(v) => v.road_information_extension.as_deref(),
Self::RoadInformationEnhanced(v) => v.road_information_extension.as_deref(),
}
}
}
impl AnyRoadInformation {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str) -> Result<(), Error> {
match self {
Self::RoadInformation(v) => v.write(w, tag, "", ""),
Self::RoadInformationEnhanced(v) => v.write(w, tag, " xsi:type=\"prk:RoadInformationEnhanced\"", ""),
}
}
}
impl AnyRoadInformation {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
let mut pending = r.next_key()?;
// The concrete base may come without its wrapper.
if let Some(key) = pending {
if !matches!(key, 1199 | 1720) {
return RoadInformation::read_json_members(r, Some(key)).map(|v| Some(Self::RoadInformation(Box::new(v))));
}
}
let mut seen = false;
let mut value = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1199 => if r.first(&mut seen)? { value = RoadInformation::read_json(r)?.map(|v| Self::RoadInformation(Box::new(v))); },
1720 => if r.first(&mut seen)? { value = prk::RoadInformationEnhanced::read_json(r)?.map(|v| Self::RoadInformationEnhanced(Box::new(v))); },
_ => r.skip_unknown()?,
}
}
if !seen {
r.warn(WarningKind::UnknownType, "no known kind of RoadInformation in its wrapper".to_owned());
}
Ok(value)
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>) -> Result<(), Error> {
match self {
Self::RoadInformation(v) => {
if w.wrapper(1199)? {
w.begin_object(592)?;
w.key(1199)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::RoadInformationEnhanced(v) => {
if w.wrapper(1720)? {
w.begin_object(592)?;
w.key(1720)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
}
}
}
/// Any concrete kind of XML type `loc:TpegAreaLocation`, chosen by `xsi:type`.
#[derive(Debug, Clone, PartialEq)]
pub enum TpegAreaLocation {
/// XML type `loc:TpegGeometricArea`.
TpegGeometricArea(Box<TpegGeometricArea>),
/// XML type `loc:TpegNamedOnlyArea`.
TpegNamedOnlyArea(Box<TpegNamedOnlyArea>),
}
impl TpegAreaLocation {
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Option<Self>, Error> {
Self::read_as(r, r.xsi_type())
}
pub(crate) fn read_as(r: &mut Xml<'_>, kind: Option<u32>) -> Result<Option<Self>, Error> {
Ok(Some(match kind {
Some(0xe0232) => Self::TpegGeometricArea(Box::new(TpegGeometricArea::read(r)?)),
Some(0xe0238) => Self::TpegNamedOnlyArea(Box::new(TpegNamedOnlyArea::read(r)?)),
_ => {
r.unknown_type("TpegAreaLocation")?;
return Ok(None);
}
}))
}
/// XML element `loc:tpegAreaLocationType`, which every kind has.
pub fn tpeg_area_location_type(&self) -> Option<&TpegLoc01AreaLocationSubtypeEnum> {
match self {
Self::TpegGeometricArea(v) => v.tpeg_area_location_type.as_ref(),
Self::TpegNamedOnlyArea(v) => v.tpeg_area_location_type.as_ref(),
}
}
/// XML element `loc:tpegHeight`, which every kind has.
pub fn tpeg_height(&self) -> Option<&TpegHeight> {
match self {
Self::TpegGeometricArea(v) => v.tpeg_height.as_deref(),
Self::TpegNamedOnlyArea(v) => v.tpeg_height.as_deref(),
}
}
/// XML element `loc:_tpegAreaLocationExtension`, which every kind has.
pub fn tpeg_area_location_extension(&self) -> Option<&Extension> {
match self {
Self::TpegGeometricArea(v) => v.tpeg_area_location_extension.as_deref(),
Self::TpegNamedOnlyArea(v) => v.tpeg_area_location_extension.as_deref(),
}
}
}
impl TpegAreaLocation {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str) -> Result<(), Error> {
match self {
Self::TpegGeometricArea(v) => v.write(w, tag, " xsi:type=\"loc:TpegGeometricArea\"", ""),
Self::TpegNamedOnlyArea(v) => v.write(w, tag, " xsi:type=\"loc:TpegNamedOnlyArea\"", ""),
}
}
}
impl TpegAreaLocation {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
let mut pending = r.next_key()?;
let mut seen = false;
let mut value = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1209 => if r.first(&mut seen)? { value = TpegGeometricArea::read_json(r)?.map(|v| Self::TpegGeometricArea(Box::new(v))); },
1217 => if r.first(&mut seen)? { value = TpegNamedOnlyArea::read_json(r)?.map(|v| Self::TpegNamedOnlyArea(Box::new(v))); },
_ => r.skip_unknown()?,
}
}
if !seen {
r.warn(WarningKind::UnknownType, "no known kind of TpegAreaLocation in its wrapper".to_owned());
}
Ok(value)
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>) -> Result<(), Error> {
match self {
Self::TpegGeometricArea(v) => {
if w.wrapper(1209)? {
w.begin_object(598)?;
w.key(1209)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::TpegNamedOnlyArea(v) => {
if w.wrapper(1217)? {
w.begin_object(598)?;
w.key(1217)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
}
}
}
/// Any concrete kind of XML type `loc:TpegPoint`, chosen by `xsi:type`.
#[derive(Debug, Clone, PartialEq)]
pub enum TpegPoint {
/// XML type `loc:TpegJunction`.
TpegJunction(Box<TpegJunction>),
/// XML type `loc:TpegNonJunctionPoint`.
TpegNonJunctionPoint(Box<TpegNonJunctionPoint>),
}
impl TpegPoint {
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Option<Self>, Error> {
Self::read_as(r, r.xsi_type())
}
pub(crate) fn read_as(r: &mut Xml<'_>, kind: Option<u32>) -> Result<Option<Self>, Error> {
Ok(Some(match kind {
Some(0xe0235) => Self::TpegJunction(Box::new(TpegJunction::read(r)?)),
Some(0xe0239) => Self::TpegNonJunctionPoint(Box::new(TpegNonJunctionPoint::read(r)?)),
_ => {
r.unknown_type("TpegPoint")?;
return Ok(None);
}
}))
}
/// XML element `loc:_tpegPointExtension`, which every kind has.
pub fn tpeg_point_extension(&self) -> Option<&Extension> {
match self {
Self::TpegJunction(v) => v.tpeg_point_extension.as_deref(),
Self::TpegNonJunctionPoint(v) => v.tpeg_point_extension.as_deref(),
}
}
}
impl TpegPoint {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str) -> Result<(), Error> {
match self {
Self::TpegJunction(v) => v.write(w, tag, " xsi:type=\"loc:TpegJunction\"", ""),
Self::TpegNonJunctionPoint(v) => v.write(w, tag, " xsi:type=\"loc:TpegNonJunctionPoint\"", ""),
}
}
}
impl TpegPoint {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
let mut pending = r.next_key()?;
let mut seen = false;
let mut value = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1213 => if r.first(&mut seen)? { value = TpegJunction::read_json(r)?.map(|v| Self::TpegJunction(Box::new(v))); },
1219 => if r.first(&mut seen)? { value = TpegNonJunctionPoint::read_json(r)?.map(|v| Self::TpegNonJunctionPoint(Box::new(v))); },
_ => r.skip_unknown()?,
}
}
if !seen {
r.warn(WarningKind::UnknownType, "no known kind of TpegPoint in its wrapper".to_owned());
}
Ok(value)
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>) -> Result<(), Error> {
match self {
Self::TpegJunction(v) => {
if w.wrapper(1213)? {
w.begin_object(618)?;
w.key(1213)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::TpegNonJunctionPoint(v) => {
if w.wrapper(1219)? {
w.begin_object(618)?;
w.key(1219)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
}
}
}
/// Any concrete kind of XML type `loc:TpegPointLocation`, chosen by `xsi:type`.
#[derive(Debug, Clone, PartialEq)]
pub enum TpegPointLocation {
/// XML type `loc:TpegFramedPoint`.
TpegFramedPoint(Box<TpegFramedPoint>),
/// XML type `loc:TpegSimplePoint`.
TpegSimplePoint(Box<TpegSimplePoint>),
}
impl TpegPointLocation {
pub(crate) fn read(r: &mut Xml<'_>) -> Result<Option<Self>, Error> {
Self::read_as(r, r.xsi_type())
}
pub(crate) fn read_as(r: &mut Xml<'_>, kind: Option<u32>) -> Result<Option<Self>, Error> {
Ok(Some(match kind {
Some(0xe0231) => Self::TpegFramedPoint(Box::new(TpegFramedPoint::read(r)?)),
Some(0xe023e) => Self::TpegSimplePoint(Box::new(TpegSimplePoint::read(r)?)),
_ => {
r.unknown_type("TpegPointLocation")?;
return Ok(None);
}
}))
}
/// XML element `loc:tpegDirection`, which every kind has.
pub fn tpeg_direction(&self) -> Option<&DirectionEnum> {
match self {
Self::TpegFramedPoint(v) => v.tpeg_direction.as_ref(),
Self::TpegSimplePoint(v) => v.tpeg_direction.as_ref(),
}
}
/// XML element `loc:_tpegPointLocationExtension`, which every kind has.
pub fn tpeg_point_location_extension(&self) -> Option<&Extension> {
match self {
Self::TpegFramedPoint(v) => v.tpeg_point_location_extension.as_deref(),
Self::TpegSimplePoint(v) => v.tpeg_point_location_extension.as_deref(),
}
}
}
impl TpegPointLocation {
pub(crate) fn write(&self, w: &mut Out<'_>, tag: &'static str) -> Result<(), Error> {
match self {
Self::TpegFramedPoint(v) => v.write(w, tag, " xsi:type=\"loc:TpegFramedPoint\"", ""),
Self::TpegSimplePoint(v) => v.write(w, tag, " xsi:type=\"loc:TpegSimplePoint\"", ""),
}
}
}
impl TpegPointLocation {
pub(crate) fn read_json(r: &mut JsonReader<'_>) -> Result<Option<Self>, Error> {
if !r.begin_object()? {
return Ok(None);
}
let mut pending = r.next_key()?;
let mut seen = false;
let mut value = None;
loop {
let key = match pending.take() {
Some(key) => key,
None => match r.next_key()? {
Some(key) => key,
None => break,
},
};
match key {
1207 => if r.first(&mut seen)? { value = TpegFramedPoint::read_json(r)?.map(|v| Self::TpegFramedPoint(Box::new(v))); },
1225 => if r.first(&mut seen)? { value = TpegSimplePoint::read_json(r)?.map(|v| Self::TpegSimplePoint(Box::new(v))); },
_ => r.skip_unknown()?,
}
}
if !seen {
r.warn(WarningKind::UnknownType, "no known kind of TpegPointLocation in its wrapper".to_owned());
}
Ok(value)
}
pub(crate) fn write_json(&self, w: &mut JsonWriter<'_>) -> Result<(), Error> {
match self {
Self::TpegFramedPoint(v) => {
if w.wrapper(1207)? {
w.begin_object(619)?;
w.key(1207)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
Self::TpegSimplePoint(v) => {
if w.wrapper(1225)? {
w.begin_object(619)?;
w.key(1225)?;
v.write_json(w, None)?;
w.end_object()
} else {
v.write_json(w, None)
}
}
}
}
}