UNPKG

sharedstreets-pbf

Version:

SharedStreets, a 'digital commons' for the street

1,329 lines (1,243 loc) 120 kB
/*eslint-disable block-scoped-var, no-redeclare, no-control-regex, no-prototype-builtins*/ "use strict"; var $protobuf = require("protobufjs/minimal"); // Common aliases var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util; // Exported root namespace var $root = $protobuf.roots["default"] || ($protobuf.roots["default"] = {}); $root.Delimiter = (function() { /** * Properties of a Delimiter. * @exports IDelimiter * @interface IDelimiter * @property {number|null} [length] Delimiter length */ /** * Constructs a new Delimiter. * @exports Delimiter * @classdesc Represents a Delimiter. * @implements IDelimiter * @constructor * @param {IDelimiter=} [properties] Properties to set */ function Delimiter(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; } /** * Delimiter length. * @member {number} length * @memberof Delimiter * @instance */ Delimiter.prototype.length = 0; /** * Creates a new Delimiter instance using the specified properties. * @function create * @memberof Delimiter * @static * @param {IDelimiter=} [properties] Properties to set * @returns {Delimiter} Delimiter instance */ Delimiter.create = function create(properties) { return new Delimiter(properties); }; /** * Encodes the specified Delimiter message. Does not implicitly {@link Delimiter.verify|verify} messages. * @function encode * @memberof Delimiter * @static * @param {IDelimiter} message Delimiter message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ Delimiter.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.length != null && message.hasOwnProperty("length")) writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.length); return writer; }; /** * Encodes the specified Delimiter message, length delimited. Does not implicitly {@link Delimiter.verify|verify} messages. * @function encodeDelimited * @memberof Delimiter * @static * @param {IDelimiter} message Delimiter message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ Delimiter.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** * Decodes a Delimiter message from the specified reader or buffer. * @function decode * @memberof Delimiter * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand * @returns {Delimiter} Delimiter * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ Delimiter.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.Delimiter(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: message.length = reader.uint32(); break; default: reader.skipType(tag & 7); break; } } return message; }; /** * Decodes a Delimiter message from the specified reader or buffer, length delimited. * @function decodeDelimited * @memberof Delimiter * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @returns {Delimiter} Delimiter * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ Delimiter.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** * Verifies a Delimiter message. * @function verify * @memberof Delimiter * @static * @param {Object.<string,*>} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ Delimiter.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.length != null && message.hasOwnProperty("length")) if (!$util.isInteger(message.length)) return "length: integer expected"; return null; }; /** * Creates a Delimiter message from a plain object. Also converts values to their respective internal types. * @function fromObject * @memberof Delimiter * @static * @param {Object.<string,*>} object Plain object * @returns {Delimiter} Delimiter */ Delimiter.fromObject = function fromObject(object) { if (object instanceof $root.Delimiter) return object; var message = new $root.Delimiter(); if (object.length != null) message.length = object.length >>> 0; return message; }; /** * Creates a plain object from a Delimiter message. Also converts values to other types if specified. * @function toObject * @memberof Delimiter * @static * @param {Delimiter} message Delimiter * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.<string,*>} Plain object */ Delimiter.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) object.length = 0; if (message.length != null && message.hasOwnProperty("length")) object.length = message.length; return object; }; /** * Converts this Delimiter to JSON. * @function toJSON * @memberof Delimiter * @instance * @returns {Object.<string,*>} JSON object */ Delimiter.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; return Delimiter; })(); $root.GISSectionMetadata = (function() { /** * Properties of a GISSectionMetadata. * @exports IGISSectionMetadata * @interface IGISSectionMetadata * @property {string|null} [sectionId] GISSectionMetadata sectionId * @property {string|null} [sectionProperties] GISSectionMetadata sectionProperties */ /** * Constructs a new GISSectionMetadata. * @exports GISSectionMetadata * @classdesc Represents a GISSectionMetadata. * @implements IGISSectionMetadata * @constructor * @param {IGISSectionMetadata=} [properties] Properties to set */ function GISSectionMetadata(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; } /** * GISSectionMetadata sectionId. * @member {string} sectionId * @memberof GISSectionMetadata * @instance */ GISSectionMetadata.prototype.sectionId = ""; /** * GISSectionMetadata sectionProperties. * @member {string} sectionProperties * @memberof GISSectionMetadata * @instance */ GISSectionMetadata.prototype.sectionProperties = ""; /** * Creates a new GISSectionMetadata instance using the specified properties. * @function create * @memberof GISSectionMetadata * @static * @param {IGISSectionMetadata=} [properties] Properties to set * @returns {GISSectionMetadata} GISSectionMetadata instance */ GISSectionMetadata.create = function create(properties) { return new GISSectionMetadata(properties); }; /** * Encodes the specified GISSectionMetadata message. Does not implicitly {@link GISSectionMetadata.verify|verify} messages. * @function encode * @memberof GISSectionMetadata * @static * @param {IGISSectionMetadata} message GISSectionMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ GISSectionMetadata.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.sectionId != null && message.hasOwnProperty("sectionId")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.sectionId); if (message.sectionProperties != null && message.hasOwnProperty("sectionProperties")) writer.uint32(/* id 2, wireType 2 =*/18).string(message.sectionProperties); return writer; }; /** * Encodes the specified GISSectionMetadata message, length delimited. Does not implicitly {@link GISSectionMetadata.verify|verify} messages. * @function encodeDelimited * @memberof GISSectionMetadata * @static * @param {IGISSectionMetadata} message GISSectionMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ GISSectionMetadata.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** * Decodes a GISSectionMetadata message from the specified reader or buffer. * @function decode * @memberof GISSectionMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand * @returns {GISSectionMetadata} GISSectionMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ GISSectionMetadata.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.GISSectionMetadata(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: message.sectionId = reader.string(); break; case 2: message.sectionProperties = reader.string(); break; default: reader.skipType(tag & 7); break; } } return message; }; /** * Decodes a GISSectionMetadata message from the specified reader or buffer, length delimited. * @function decodeDelimited * @memberof GISSectionMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @returns {GISSectionMetadata} GISSectionMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ GISSectionMetadata.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** * Verifies a GISSectionMetadata message. * @function verify * @memberof GISSectionMetadata * @static * @param {Object.<string,*>} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ GISSectionMetadata.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.sectionId != null && message.hasOwnProperty("sectionId")) if (!$util.isString(message.sectionId)) return "sectionId: string expected"; if (message.sectionProperties != null && message.hasOwnProperty("sectionProperties")) if (!$util.isString(message.sectionProperties)) return "sectionProperties: string expected"; return null; }; /** * Creates a GISSectionMetadata message from a plain object. Also converts values to their respective internal types. * @function fromObject * @memberof GISSectionMetadata * @static * @param {Object.<string,*>} object Plain object * @returns {GISSectionMetadata} GISSectionMetadata */ GISSectionMetadata.fromObject = function fromObject(object) { if (object instanceof $root.GISSectionMetadata) return object; var message = new $root.GISSectionMetadata(); if (object.sectionId != null) message.sectionId = String(object.sectionId); if (object.sectionProperties != null) message.sectionProperties = String(object.sectionProperties); return message; }; /** * Creates a plain object from a GISSectionMetadata message. Also converts values to other types if specified. * @function toObject * @memberof GISSectionMetadata * @static * @param {GISSectionMetadata} message GISSectionMetadata * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.<string,*>} Plain object */ GISSectionMetadata.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { object.sectionId = ""; object.sectionProperties = ""; } if (message.sectionId != null && message.hasOwnProperty("sectionId")) object.sectionId = message.sectionId; if (message.sectionProperties != null && message.hasOwnProperty("sectionProperties")) object.sectionProperties = message.sectionProperties; return object; }; /** * Converts this GISSectionMetadata to JSON. * @function toJSON * @memberof GISSectionMetadata * @instance * @returns {Object.<string,*>} JSON object */ GISSectionMetadata.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; return GISSectionMetadata; })(); $root.GISMetadata = (function() { /** * Properties of a GISMetadata. * @exports IGISMetadata * @interface IGISMetadata * @property {string|null} [source] GISMetadata source * @property {Array.<IGISSectionMetadata>|null} [sections] GISMetadata sections */ /** * Constructs a new GISMetadata. * @exports GISMetadata * @classdesc Represents a GISMetadata. * @implements IGISMetadata * @constructor * @param {IGISMetadata=} [properties] Properties to set */ function GISMetadata(properties) { this.sections = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; } /** * GISMetadata source. * @member {string} source * @memberof GISMetadata * @instance */ GISMetadata.prototype.source = ""; /** * GISMetadata sections. * @member {Array.<IGISSectionMetadata>} sections * @memberof GISMetadata * @instance */ GISMetadata.prototype.sections = $util.emptyArray; /** * Creates a new GISMetadata instance using the specified properties. * @function create * @memberof GISMetadata * @static * @param {IGISMetadata=} [properties] Properties to set * @returns {GISMetadata} GISMetadata instance */ GISMetadata.create = function create(properties) { return new GISMetadata(properties); }; /** * Encodes the specified GISMetadata message. Does not implicitly {@link GISMetadata.verify|verify} messages. * @function encode * @memberof GISMetadata * @static * @param {IGISMetadata} message GISMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ GISMetadata.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.source != null && message.hasOwnProperty("source")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.source); if (message.sections != null && message.sections.length) for (var i = 0; i < message.sections.length; ++i) $root.GISSectionMetadata.encode(message.sections[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; /** * Encodes the specified GISMetadata message, length delimited. Does not implicitly {@link GISMetadata.verify|verify} messages. * @function encodeDelimited * @memberof GISMetadata * @static * @param {IGISMetadata} message GISMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ GISMetadata.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** * Decodes a GISMetadata message from the specified reader or buffer. * @function decode * @memberof GISMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand * @returns {GISMetadata} GISMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ GISMetadata.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.GISMetadata(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: message.source = reader.string(); break; case 2: if (!(message.sections && message.sections.length)) message.sections = []; message.sections.push($root.GISSectionMetadata.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); break; } } return message; }; /** * Decodes a GISMetadata message from the specified reader or buffer, length delimited. * @function decodeDelimited * @memberof GISMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @returns {GISMetadata} GISMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ GISMetadata.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** * Verifies a GISMetadata message. * @function verify * @memberof GISMetadata * @static * @param {Object.<string,*>} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ GISMetadata.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.source != null && message.hasOwnProperty("source")) if (!$util.isString(message.source)) return "source: string expected"; if (message.sections != null && message.hasOwnProperty("sections")) { if (!Array.isArray(message.sections)) return "sections: array expected"; for (var i = 0; i < message.sections.length; ++i) { var error = $root.GISSectionMetadata.verify(message.sections[i]); if (error) return "sections." + error; } } return null; }; /** * Creates a GISMetadata message from a plain object. Also converts values to their respective internal types. * @function fromObject * @memberof GISMetadata * @static * @param {Object.<string,*>} object Plain object * @returns {GISMetadata} GISMetadata */ GISMetadata.fromObject = function fromObject(object) { if (object instanceof $root.GISMetadata) return object; var message = new $root.GISMetadata(); if (object.source != null) message.source = String(object.source); if (object.sections) { if (!Array.isArray(object.sections)) throw TypeError(".GISMetadata.sections: array expected"); message.sections = []; for (var i = 0; i < object.sections.length; ++i) { if (typeof object.sections[i] !== "object") throw TypeError(".GISMetadata.sections: object expected"); message.sections[i] = $root.GISSectionMetadata.fromObject(object.sections[i]); } } return message; }; /** * Creates a plain object from a GISMetadata message. Also converts values to other types if specified. * @function toObject * @memberof GISMetadata * @static * @param {GISMetadata} message GISMetadata * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.<string,*>} Plain object */ GISMetadata.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.arrays || options.defaults) object.sections = []; if (options.defaults) object.source = ""; if (message.source != null && message.hasOwnProperty("source")) object.source = message.source; if (message.sections && message.sections.length) { object.sections = []; for (var j = 0; j < message.sections.length; ++j) object.sections[j] = $root.GISSectionMetadata.toObject(message.sections[j], options); } return object; }; /** * Converts this GISMetadata to JSON. * @function toJSON * @memberof GISMetadata * @instance * @returns {Object.<string,*>} JSON object */ GISMetadata.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; return GISMetadata; })(); /** * RoadClass enum. * @exports RoadClass * @enum {string} * @property {number} Motorway=0 Motorway value * @property {number} Trunk=1 Trunk value * @property {number} Primary=2 Primary value * @property {number} Secondary=3 Secondary value * @property {number} Tertiary=4 Tertiary value * @property {number} Residential=5 Residential value * @property {number} Unclassified=6 Unclassified value * @property {number} Service=7 Service value * @property {number} Other=8 Other value */ $root.RoadClass = (function() { var valuesById = {}, values = Object.create(valuesById); values[valuesById[0] = "Motorway"] = 0; values[valuesById[1] = "Trunk"] = 1; values[valuesById[2] = "Primary"] = 2; values[valuesById[3] = "Secondary"] = 3; values[valuesById[4] = "Tertiary"] = 4; values[valuesById[5] = "Residential"] = 5; values[valuesById[6] = "Unclassified"] = 6; values[valuesById[7] = "Service"] = 7; values[valuesById[8] = "Other"] = 8; return values; })(); $root.WaySection = (function() { /** * Properties of a WaySection. * @exports IWaySection * @interface IWaySection * @property {number|Long|null} [wayId] WaySection wayId * @property {RoadClass|null} [roadClass] WaySection roadClass * @property {boolean|null} [oneWay] WaySection oneWay * @property {boolean|null} [roundabout] WaySection roundabout * @property {boolean|null} [link] WaySection link * @property {Array.<number|Long>|null} [nodeIds] WaySection nodeIds * @property {string|null} [name] WaySection name */ /** * Constructs a new WaySection. * @exports WaySection * @classdesc Represents a WaySection. * @implements IWaySection * @constructor * @param {IWaySection=} [properties] Properties to set */ function WaySection(properties) { this.nodeIds = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; } /** * WaySection wayId. * @member {number|Long} wayId * @memberof WaySection * @instance */ WaySection.prototype.wayId = $util.Long ? $util.Long.fromBits(0,0,true) : 0; /** * WaySection roadClass. * @member {RoadClass} roadClass * @memberof WaySection * @instance */ WaySection.prototype.roadClass = 0; /** * WaySection oneWay. * @member {boolean} oneWay * @memberof WaySection * @instance */ WaySection.prototype.oneWay = false; /** * WaySection roundabout. * @member {boolean} roundabout * @memberof WaySection * @instance */ WaySection.prototype.roundabout = false; /** * WaySection link. * @member {boolean} link * @memberof WaySection * @instance */ WaySection.prototype.link = false; /** * WaySection nodeIds. * @member {Array.<number|Long>} nodeIds * @memberof WaySection * @instance */ WaySection.prototype.nodeIds = $util.emptyArray; /** * WaySection name. * @member {string} name * @memberof WaySection * @instance */ WaySection.prototype.name = ""; /** * Creates a new WaySection instance using the specified properties. * @function create * @memberof WaySection * @static * @param {IWaySection=} [properties] Properties to set * @returns {WaySection} WaySection instance */ WaySection.create = function create(properties) { return new WaySection(properties); }; /** * Encodes the specified WaySection message. Does not implicitly {@link WaySection.verify|verify} messages. * @function encode * @memberof WaySection * @static * @param {IWaySection} message WaySection message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ WaySection.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.wayId != null && message.hasOwnProperty("wayId")) writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.wayId); if (message.roadClass != null && message.hasOwnProperty("roadClass")) writer.uint32(/* id 2, wireType 0 =*/16).int32(message.roadClass); if (message.oneWay != null && message.hasOwnProperty("oneWay")) writer.uint32(/* id 3, wireType 0 =*/24).bool(message.oneWay); if (message.roundabout != null && message.hasOwnProperty("roundabout")) writer.uint32(/* id 4, wireType 0 =*/32).bool(message.roundabout); if (message.link != null && message.hasOwnProperty("link")) writer.uint32(/* id 5, wireType 0 =*/40).bool(message.link); if (message.nodeIds != null && message.nodeIds.length) { writer.uint32(/* id 6, wireType 2 =*/50).fork(); for (var i = 0; i < message.nodeIds.length; ++i) writer.uint64(message.nodeIds[i]); writer.ldelim(); } if (message.name != null && message.hasOwnProperty("name")) writer.uint32(/* id 7, wireType 2 =*/58).string(message.name); return writer; }; /** * Encodes the specified WaySection message, length delimited. Does not implicitly {@link WaySection.verify|verify} messages. * @function encodeDelimited * @memberof WaySection * @static * @param {IWaySection} message WaySection message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ WaySection.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** * Decodes a WaySection message from the specified reader or buffer. * @function decode * @memberof WaySection * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand * @returns {WaySection} WaySection * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ WaySection.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.WaySection(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: message.wayId = reader.uint64(); break; case 2: message.roadClass = reader.int32(); break; case 3: message.oneWay = reader.bool(); break; case 4: message.roundabout = reader.bool(); break; case 5: message.link = reader.bool(); break; case 6: if (!(message.nodeIds && message.nodeIds.length)) message.nodeIds = []; if ((tag & 7) === 2) { var end2 = reader.uint32() + reader.pos; while (reader.pos < end2) message.nodeIds.push(reader.uint64()); } else message.nodeIds.push(reader.uint64()); break; case 7: message.name = reader.string(); break; default: reader.skipType(tag & 7); break; } } return message; }; /** * Decodes a WaySection message from the specified reader or buffer, length delimited. * @function decodeDelimited * @memberof WaySection * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @returns {WaySection} WaySection * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ WaySection.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** * Verifies a WaySection message. * @function verify * @memberof WaySection * @static * @param {Object.<string,*>} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ WaySection.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.wayId != null && message.hasOwnProperty("wayId")) if (!$util.isInteger(message.wayId) && !(message.wayId && $util.isInteger(message.wayId.low) && $util.isInteger(message.wayId.high))) return "wayId: integer|Long expected"; if (message.roadClass != null && message.hasOwnProperty("roadClass")) switch (message.roadClass) { default: return "roadClass: enum value expected"; case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: break; } if (message.oneWay != null && message.hasOwnProperty("oneWay")) if (typeof message.oneWay !== "boolean") return "oneWay: boolean expected"; if (message.roundabout != null && message.hasOwnProperty("roundabout")) if (typeof message.roundabout !== "boolean") return "roundabout: boolean expected"; if (message.link != null && message.hasOwnProperty("link")) if (typeof message.link !== "boolean") return "link: boolean expected"; if (message.nodeIds != null && message.hasOwnProperty("nodeIds")) { if (!Array.isArray(message.nodeIds)) return "nodeIds: array expected"; for (var i = 0; i < message.nodeIds.length; ++i) if (!$util.isInteger(message.nodeIds[i]) && !(message.nodeIds[i] && $util.isInteger(message.nodeIds[i].low) && $util.isInteger(message.nodeIds[i].high))) return "nodeIds: integer|Long[] expected"; } if (message.name != null && message.hasOwnProperty("name")) if (!$util.isString(message.name)) return "name: string expected"; return null; }; /** * Creates a WaySection message from a plain object. Also converts values to their respective internal types. * @function fromObject * @memberof WaySection * @static * @param {Object.<string,*>} object Plain object * @returns {WaySection} WaySection */ WaySection.fromObject = function fromObject(object) { if (object instanceof $root.WaySection) return object; var message = new $root.WaySection(); if (object.wayId != null) if ($util.Long) (message.wayId = $util.Long.fromValue(object.wayId)).unsigned = true; else if (typeof object.wayId === "string") message.wayId = parseInt(object.wayId, 10); else if (typeof object.wayId === "number") message.wayId = object.wayId; else if (typeof object.wayId === "object") message.wayId = new $util.LongBits(object.wayId.low >>> 0, object.wayId.high >>> 0).toNumber(true); switch (object.roadClass) { case "Motorway": case 0: message.roadClass = 0; break; case "Trunk": case 1: message.roadClass = 1; break; case "Primary": case 2: message.roadClass = 2; break; case "Secondary": case 3: message.roadClass = 3; break; case "Tertiary": case 4: message.roadClass = 4; break; case "Residential": case 5: message.roadClass = 5; break; case "Unclassified": case 6: message.roadClass = 6; break; case "Service": case 7: message.roadClass = 7; break; case "Other": case 8: message.roadClass = 8; break; } if (object.oneWay != null) message.oneWay = Boolean(object.oneWay); if (object.roundabout != null) message.roundabout = Boolean(object.roundabout); if (object.link != null) message.link = Boolean(object.link); if (object.nodeIds) { if (!Array.isArray(object.nodeIds)) throw TypeError(".WaySection.nodeIds: array expected"); message.nodeIds = []; for (var i = 0; i < object.nodeIds.length; ++i) if ($util.Long) (message.nodeIds[i] = $util.Long.fromValue(object.nodeIds[i])).unsigned = true; else if (typeof object.nodeIds[i] === "string") message.nodeIds[i] = parseInt(object.nodeIds[i], 10); else if (typeof object.nodeIds[i] === "number") message.nodeIds[i] = object.nodeIds[i]; else if (typeof object.nodeIds[i] === "object") message.nodeIds[i] = new $util.LongBits(object.nodeIds[i].low >>> 0, object.nodeIds[i].high >>> 0).toNumber(true); } if (object.name != null) message.name = String(object.name); return message; }; /** * Creates a plain object from a WaySection message. Also converts values to other types if specified. * @function toObject * @memberof WaySection * @static * @param {WaySection} message WaySection * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.<string,*>} Plain object */ WaySection.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.arrays || options.defaults) object.nodeIds = []; if (options.defaults) { if ($util.Long) { var long = new $util.Long(0, 0, true); object.wayId = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; } else object.wayId = options.longs === String ? "0" : 0; object.roadClass = options.enums === String ? "Motorway" : 0; object.oneWay = false; object.roundabout = false; object.link = false; object.name = ""; } if (message.wayId != null && message.hasOwnProperty("wayId")) if (typeof message.wayId === "number") object.wayId = options.longs === String ? String(message.wayId) : message.wayId; else object.wayId = options.longs === String ? $util.Long.prototype.toString.call(message.wayId) : options.longs === Number ? new $util.LongBits(message.wayId.low >>> 0, message.wayId.high >>> 0).toNumber(true) : message.wayId; if (message.roadClass != null && message.hasOwnProperty("roadClass")) object.roadClass = options.enums === String ? $root.RoadClass[message.roadClass] : message.roadClass; if (message.oneWay != null && message.hasOwnProperty("oneWay")) object.oneWay = message.oneWay; if (message.roundabout != null && message.hasOwnProperty("roundabout")) object.roundabout = message.roundabout; if (message.link != null && message.hasOwnProperty("link")) object.link = message.link; if (message.nodeIds && message.nodeIds.length) { object.nodeIds = []; for (var j = 0; j < message.nodeIds.length; ++j) if (typeof message.nodeIds[j] === "number") object.nodeIds[j] = options.longs === String ? String(message.nodeIds[j]) : message.nodeIds[j]; else object.nodeIds[j] = options.longs === String ? $util.Long.prototype.toString.call(message.nodeIds[j]) : options.longs === Number ? new $util.LongBits(message.nodeIds[j].low >>> 0, message.nodeIds[j].high >>> 0).toNumber(true) : message.nodeIds[j]; } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; return object; }; /** * Converts this WaySection to JSON. * @function toJSON * @memberof WaySection * @instance * @returns {Object.<string,*>} JSON object */ WaySection.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; return WaySection; })(); $root.OSMMetadata = (function() { /** * Properties of a OSMMetadata. * @exports IOSMMetadata * @interface IOSMMetadata * @property {Array.<IWaySection>|null} [waySections] OSMMetadata waySections * @property {string|null} [name] OSMMetadata name */ /** * Constructs a new OSMMetadata. * @exports OSMMetadata * @classdesc Represents a OSMMetadata. * @implements IOSMMetadata * @constructor * @param {IOSMMetadata=} [properties] Properties to set */ function OSMMetadata(properties) { this.waySections = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; } /** * OSMMetadata waySections. * @member {Array.<IWaySection>} waySections * @memberof OSMMetadata * @instance */ OSMMetadata.prototype.waySections = $util.emptyArray; /** * OSMMetadata name. * @member {string} name * @memberof OSMMetadata * @instance */ OSMMetadata.prototype.name = ""; /** * Creates a new OSMMetadata instance using the specified properties. * @function create * @memberof OSMMetadata * @static * @param {IOSMMetadata=} [properties] Properties to set * @returns {OSMMetadata} OSMMetadata instance */ OSMMetadata.create = function create(properties) { return new OSMMetadata(properties); }; /** * Encodes the specified OSMMetadata message. Does not implicitly {@link OSMMetadata.verify|verify} messages. * @function encode * @memberof OSMMetadata * @static * @param {IOSMMetadata} message OSMMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ OSMMetadata.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.waySections != null && message.waySections.length) for (var i = 0; i < message.waySections.length; ++i) $root.WaySection.encode(message.waySections[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); if (message.name != null && message.hasOwnProperty("name")) writer.uint32(/* id 2, wireType 2 =*/18).string(message.name); return writer; }; /** * Encodes the specified OSMMetadata message, length delimited. Does not implicitly {@link OSMMetadata.verify|verify} messages. * @function encodeDelimited * @memberof OSMMetadata * @static * @param {IOSMMetadata} message OSMMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ OSMMetadata.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** * Decodes a OSMMetadata message from the specified reader or buffer. * @function decode * @memberof OSMMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand * @returns {OSMMetadata} OSMMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ OSMMetadata.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.OSMMetadata(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: if (!(message.waySections && message.waySections.length)) message.waySections = []; message.waySections.push($root.WaySection.decode(reader, reader.uint32())); break; case 2: message.name = reader.string(); break; default: reader.skipType(tag & 7); break; } } return message; }; /** * Decodes a OSMMetadata message from the specified reader or buffer, length delimited. * @function decodeDelimited * @memberof OSMMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @returns {OSMMetadata} OSMMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ OSMMetadata.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** * Verifies a OSMMetadata message. * @function verify * @memberof OSMMetadata * @static * @param {Object.<string,*>} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ OSMMetadata.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.waySections != null && message.hasOwnProperty("waySections")) { if (!Array.isArray(message.waySections)) return "waySections: array expected"; for (var i = 0; i < message.waySections.length; ++i) { var error = $root.WaySection.verify(message.waySections[i]); if (error) return "waySections." + error; } } if (message.name != null && message.hasOwnProperty("name")) if (!$util.isString(message.name)) return "name: string expected"; return null; }; /** * Creates a OSMMetadata message from a plain object. Also converts values to their respective internal types. * @function fromObject * @memberof OSMMetadata * @static * @param {Object.<string,*>} object Plain object * @returns {OSMMetadata} OSMMetadata */ OSMMetadata.fromObject = function fromObject(object) { if (object instanceof $root.OSMMetadata) return object; var message = new $root.OSMMetadata(); if (object.waySections) { if (!Array.isArray(object.waySections)) throw TypeError(".OSMMetadata.waySections: array expected"); message.waySections = []; for (var i = 0; i < object.waySections.length; ++i) { if (typeof object.waySections[i] !== "object") throw TypeError(".OSMMetadata.waySections: object expected"); message.waySections[i] = $root.WaySection.fromObject(object.waySections[i]); } } if (object.name != null) message.name = String(object.name); return message; }; /** * Creates a plain object from a OSMMetadata message. Also converts values to other types if specified. * @function toObject * @memberof OSMMetadata * @static * @param {OSMMetadata} message OSMMetadata * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.<string,*>} Plain object */ OSMMetadata.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.arrays || options.defaults) object.waySections = []; if (options.defaults) object.name = ""; if (message.waySections && message.waySections.length) { object.waySections = []; for (var j = 0; j < message.waySections.length; ++j) object.waySections[j] = $root.WaySection.toObject(message.waySections[j], options); } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; return object; }; /** * Converts this OSMMetadata to JSON. * @function toJSON * @memberof OSMMetadata * @instance * @returns {Object.<string,*>} JSON object */ OSMMetadata.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; return OSMMetadata; })(); $root.SharedStreetsMetadata = (function() { /** * Properties of a SharedStreetsMetadata. * @exports ISharedStreetsMetadata * @interface ISharedStreetsMetadata * @property {string|null} [geometryId] SharedStreetsMetadata geometryId * @property {IOSMMetadata|null} [osmMetadata] SharedStreetsMetadata osmMetadata * @property {Array.<IGISMetadata>|null} [gisMetadata] SharedStreetsMetadata gisMetadata */ /** * Constructs a new SharedStreetsMetadata. * @exports Shared