route_guide_pb.js 30 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069
  1. // source: route_guide.proto
  2. /**
  3. * @fileoverview
  4. * @enhanceable
  5. * @suppress {messageConventions} JS Compiler reports an error if a variable or
  6. * field starts with 'MSG_' and isn't a translatable message.
  7. * @public
  8. */
  9. // GENERATED CODE -- DO NOT EDIT!
  10. var jspb = require('google-protobuf');
  11. var goog = jspb;
  12. var global = Function('return this')();
  13. goog.exportSymbol('proto.routeguide.Feature', null, global);
  14. goog.exportSymbol('proto.routeguide.Point', null, global);
  15. goog.exportSymbol('proto.routeguide.Rectangle', null, global);
  16. goog.exportSymbol('proto.routeguide.RouteNote', null, global);
  17. goog.exportSymbol('proto.routeguide.RouteSummary', null, global);
  18. /**
  19. * Generated by JsPbCodeGenerator.
  20. * @param {Array=} opt_data Optional initial data array, typically from a
  21. * server response, or constructed directly in Javascript. The array is used
  22. * in place and becomes part of the constructed object. It is not cloned.
  23. * If no data is provided, the constructed object will be empty, but still
  24. * valid.
  25. * @extends {jspb.Message}
  26. * @constructor
  27. */
  28. proto.routeguide.Point = function(opt_data) {
  29. jspb.Message.initialize(this, opt_data, 0, -1, null, null);
  30. };
  31. goog.inherits(proto.routeguide.Point, jspb.Message);
  32. if (goog.DEBUG && !COMPILED) {
  33. /**
  34. * @public
  35. * @override
  36. */
  37. proto.routeguide.Point.displayName = 'proto.routeguide.Point';
  38. }
  39. /**
  40. * Generated by JsPbCodeGenerator.
  41. * @param {Array=} opt_data Optional initial data array, typically from a
  42. * server response, or constructed directly in Javascript. The array is used
  43. * in place and becomes part of the constructed object. It is not cloned.
  44. * If no data is provided, the constructed object will be empty, but still
  45. * valid.
  46. * @extends {jspb.Message}
  47. * @constructor
  48. */
  49. proto.routeguide.Rectangle = function(opt_data) {
  50. jspb.Message.initialize(this, opt_data, 0, -1, null, null);
  51. };
  52. goog.inherits(proto.routeguide.Rectangle, jspb.Message);
  53. if (goog.DEBUG && !COMPILED) {
  54. /**
  55. * @public
  56. * @override
  57. */
  58. proto.routeguide.Rectangle.displayName = 'proto.routeguide.Rectangle';
  59. }
  60. /**
  61. * Generated by JsPbCodeGenerator.
  62. * @param {Array=} opt_data Optional initial data array, typically from a
  63. * server response, or constructed directly in Javascript. The array is used
  64. * in place and becomes part of the constructed object. It is not cloned.
  65. * If no data is provided, the constructed object will be empty, but still
  66. * valid.
  67. * @extends {jspb.Message}
  68. * @constructor
  69. */
  70. proto.routeguide.Feature = function(opt_data) {
  71. jspb.Message.initialize(this, opt_data, 0, -1, null, null);
  72. };
  73. goog.inherits(proto.routeguide.Feature, jspb.Message);
  74. if (goog.DEBUG && !COMPILED) {
  75. /**
  76. * @public
  77. * @override
  78. */
  79. proto.routeguide.Feature.displayName = 'proto.routeguide.Feature';
  80. }
  81. /**
  82. * Generated by JsPbCodeGenerator.
  83. * @param {Array=} opt_data Optional initial data array, typically from a
  84. * server response, or constructed directly in Javascript. The array is used
  85. * in place and becomes part of the constructed object. It is not cloned.
  86. * If no data is provided, the constructed object will be empty, but still
  87. * valid.
  88. * @extends {jspb.Message}
  89. * @constructor
  90. */
  91. proto.routeguide.RouteNote = function(opt_data) {
  92. jspb.Message.initialize(this, opt_data, 0, -1, null, null);
  93. };
  94. goog.inherits(proto.routeguide.RouteNote, jspb.Message);
  95. if (goog.DEBUG && !COMPILED) {
  96. /**
  97. * @public
  98. * @override
  99. */
  100. proto.routeguide.RouteNote.displayName = 'proto.routeguide.RouteNote';
  101. }
  102. /**
  103. * Generated by JsPbCodeGenerator.
  104. * @param {Array=} opt_data Optional initial data array, typically from a
  105. * server response, or constructed directly in Javascript. The array is used
  106. * in place and becomes part of the constructed object. It is not cloned.
  107. * If no data is provided, the constructed object will be empty, but still
  108. * valid.
  109. * @extends {jspb.Message}
  110. * @constructor
  111. */
  112. proto.routeguide.RouteSummary = function(opt_data) {
  113. jspb.Message.initialize(this, opt_data, 0, -1, null, null);
  114. };
  115. goog.inherits(proto.routeguide.RouteSummary, jspb.Message);
  116. if (goog.DEBUG && !COMPILED) {
  117. /**
  118. * @public
  119. * @override
  120. */
  121. proto.routeguide.RouteSummary.displayName = 'proto.routeguide.RouteSummary';
  122. }
  123. if (jspb.Message.GENERATE_TO_OBJECT) {
  124. /**
  125. * Creates an object representation of this proto.
  126. * Field names that are reserved in JavaScript and will be renamed to pb_name.
  127. * Optional fields that are not set will be set to undefined.
  128. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
  129. * For the list of reserved names please see:
  130. * net/proto2/compiler/js/internal/generator.cc#kKeyword.
  131. * @param {boolean=} opt_includeInstance Deprecated. whether to include the
  132. * JSPB instance for transitional soy proto support:
  133. * http://goto/soy-param-migration
  134. * @return {!Object}
  135. */
  136. proto.routeguide.Point.prototype.toObject = function(opt_includeInstance) {
  137. return proto.routeguide.Point.toObject(opt_includeInstance, this);
  138. };
  139. /**
  140. * Static version of the {@see toObject} method.
  141. * @param {boolean|undefined} includeInstance Deprecated. Whether to include
  142. * the JSPB instance for transitional soy proto support:
  143. * http://goto/soy-param-migration
  144. * @param {!proto.routeguide.Point} msg The msg instance to transform.
  145. * @return {!Object}
  146. * @suppress {unusedLocalVariables} f is only used for nested messages
  147. */
  148. proto.routeguide.Point.toObject = function(includeInstance, msg) {
  149. var f, obj = {
  150. latitude: jspb.Message.getFieldWithDefault(msg, 1, 0),
  151. longitude: jspb.Message.getFieldWithDefault(msg, 2, 0)
  152. };
  153. if (includeInstance) {
  154. obj.$jspbMessageInstance = msg;
  155. }
  156. return obj;
  157. };
  158. }
  159. /**
  160. * Deserializes binary data (in protobuf wire format).
  161. * @param {jspb.ByteSource} bytes The bytes to deserialize.
  162. * @return {!proto.routeguide.Point}
  163. */
  164. proto.routeguide.Point.deserializeBinary = function(bytes) {
  165. var reader = new jspb.BinaryReader(bytes);
  166. var msg = new proto.routeguide.Point;
  167. return proto.routeguide.Point.deserializeBinaryFromReader(msg, reader);
  168. };
  169. /**
  170. * Deserializes binary data (in protobuf wire format) from the
  171. * given reader into the given message object.
  172. * @param {!proto.routeguide.Point} msg The message object to deserialize into.
  173. * @param {!jspb.BinaryReader} reader The BinaryReader to use.
  174. * @return {!proto.routeguide.Point}
  175. */
  176. proto.routeguide.Point.deserializeBinaryFromReader = function(msg, reader) {
  177. while (reader.nextField()) {
  178. if (reader.isEndGroup()) {
  179. break;
  180. }
  181. var field = reader.getFieldNumber();
  182. switch (field) {
  183. case 1:
  184. var value = /** @type {number} */ (reader.readInt32());
  185. msg.setLatitude(value);
  186. break;
  187. case 2:
  188. var value = /** @type {number} */ (reader.readInt32());
  189. msg.setLongitude(value);
  190. break;
  191. default:
  192. reader.skipField();
  193. break;
  194. }
  195. }
  196. return msg;
  197. };
  198. /**
  199. * Serializes the message to binary data (in protobuf wire format).
  200. * @return {!Uint8Array}
  201. */
  202. proto.routeguide.Point.prototype.serializeBinary = function() {
  203. var writer = new jspb.BinaryWriter();
  204. proto.routeguide.Point.serializeBinaryToWriter(this, writer);
  205. return writer.getResultBuffer();
  206. };
  207. /**
  208. * Serializes the given message to binary data (in protobuf wire
  209. * format), writing to the given BinaryWriter.
  210. * @param {!proto.routeguide.Point} message
  211. * @param {!jspb.BinaryWriter} writer
  212. * @suppress {unusedLocalVariables} f is only used for nested messages
  213. */
  214. proto.routeguide.Point.serializeBinaryToWriter = function(message, writer) {
  215. var f = undefined;
  216. f = message.getLatitude();
  217. if (f !== 0) {
  218. writer.writeInt32(
  219. 1,
  220. f
  221. );
  222. }
  223. f = message.getLongitude();
  224. if (f !== 0) {
  225. writer.writeInt32(
  226. 2,
  227. f
  228. );
  229. }
  230. };
  231. /**
  232. * optional int32 latitude = 1;
  233. * @return {number}
  234. */
  235. proto.routeguide.Point.prototype.getLatitude = function() {
  236. return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0));
  237. };
  238. /**
  239. * @param {number} value
  240. * @return {!proto.routeguide.Point} returns this
  241. */
  242. proto.routeguide.Point.prototype.setLatitude = function(value) {
  243. return jspb.Message.setProto3IntField(this, 1, value);
  244. };
  245. /**
  246. * optional int32 longitude = 2;
  247. * @return {number}
  248. */
  249. proto.routeguide.Point.prototype.getLongitude = function() {
  250. return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0));
  251. };
  252. /**
  253. * @param {number} value
  254. * @return {!proto.routeguide.Point} returns this
  255. */
  256. proto.routeguide.Point.prototype.setLongitude = function(value) {
  257. return jspb.Message.setProto3IntField(this, 2, value);
  258. };
  259. if (jspb.Message.GENERATE_TO_OBJECT) {
  260. /**
  261. * Creates an object representation of this proto.
  262. * Field names that are reserved in JavaScript and will be renamed to pb_name.
  263. * Optional fields that are not set will be set to undefined.
  264. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
  265. * For the list of reserved names please see:
  266. * net/proto2/compiler/js/internal/generator.cc#kKeyword.
  267. * @param {boolean=} opt_includeInstance Deprecated. whether to include the
  268. * JSPB instance for transitional soy proto support:
  269. * http://goto/soy-param-migration
  270. * @return {!Object}
  271. */
  272. proto.routeguide.Rectangle.prototype.toObject = function(opt_includeInstance) {
  273. return proto.routeguide.Rectangle.toObject(opt_includeInstance, this);
  274. };
  275. /**
  276. * Static version of the {@see toObject} method.
  277. * @param {boolean|undefined} includeInstance Deprecated. Whether to include
  278. * the JSPB instance for transitional soy proto support:
  279. * http://goto/soy-param-migration
  280. * @param {!proto.routeguide.Rectangle} msg The msg instance to transform.
  281. * @return {!Object}
  282. * @suppress {unusedLocalVariables} f is only used for nested messages
  283. */
  284. proto.routeguide.Rectangle.toObject = function(includeInstance, msg) {
  285. var f, obj = {
  286. lo: (f = msg.getLo()) && proto.routeguide.Point.toObject(includeInstance, f),
  287. hi: (f = msg.getHi()) && proto.routeguide.Point.toObject(includeInstance, f)
  288. };
  289. if (includeInstance) {
  290. obj.$jspbMessageInstance = msg;
  291. }
  292. return obj;
  293. };
  294. }
  295. /**
  296. * Deserializes binary data (in protobuf wire format).
  297. * @param {jspb.ByteSource} bytes The bytes to deserialize.
  298. * @return {!proto.routeguide.Rectangle}
  299. */
  300. proto.routeguide.Rectangle.deserializeBinary = function(bytes) {
  301. var reader = new jspb.BinaryReader(bytes);
  302. var msg = new proto.routeguide.Rectangle;
  303. return proto.routeguide.Rectangle.deserializeBinaryFromReader(msg, reader);
  304. };
  305. /**
  306. * Deserializes binary data (in protobuf wire format) from the
  307. * given reader into the given message object.
  308. * @param {!proto.routeguide.Rectangle} msg The message object to deserialize into.
  309. * @param {!jspb.BinaryReader} reader The BinaryReader to use.
  310. * @return {!proto.routeguide.Rectangle}
  311. */
  312. proto.routeguide.Rectangle.deserializeBinaryFromReader = function(msg, reader) {
  313. while (reader.nextField()) {
  314. if (reader.isEndGroup()) {
  315. break;
  316. }
  317. var field = reader.getFieldNumber();
  318. switch (field) {
  319. case 1:
  320. var value = new proto.routeguide.Point;
  321. reader.readMessage(value,proto.routeguide.Point.deserializeBinaryFromReader);
  322. msg.setLo(value);
  323. break;
  324. case 2:
  325. var value = new proto.routeguide.Point;
  326. reader.readMessage(value,proto.routeguide.Point.deserializeBinaryFromReader);
  327. msg.setHi(value);
  328. break;
  329. default:
  330. reader.skipField();
  331. break;
  332. }
  333. }
  334. return msg;
  335. };
  336. /**
  337. * Serializes the message to binary data (in protobuf wire format).
  338. * @return {!Uint8Array}
  339. */
  340. proto.routeguide.Rectangle.prototype.serializeBinary = function() {
  341. var writer = new jspb.BinaryWriter();
  342. proto.routeguide.Rectangle.serializeBinaryToWriter(this, writer);
  343. return writer.getResultBuffer();
  344. };
  345. /**
  346. * Serializes the given message to binary data (in protobuf wire
  347. * format), writing to the given BinaryWriter.
  348. * @param {!proto.routeguide.Rectangle} message
  349. * @param {!jspb.BinaryWriter} writer
  350. * @suppress {unusedLocalVariables} f is only used for nested messages
  351. */
  352. proto.routeguide.Rectangle.serializeBinaryToWriter = function(message, writer) {
  353. var f = undefined;
  354. f = message.getLo();
  355. if (f != null) {
  356. writer.writeMessage(
  357. 1,
  358. f,
  359. proto.routeguide.Point.serializeBinaryToWriter
  360. );
  361. }
  362. f = message.getHi();
  363. if (f != null) {
  364. writer.writeMessage(
  365. 2,
  366. f,
  367. proto.routeguide.Point.serializeBinaryToWriter
  368. );
  369. }
  370. };
  371. /**
  372. * optional Point lo = 1;
  373. * @return {?proto.routeguide.Point}
  374. */
  375. proto.routeguide.Rectangle.prototype.getLo = function() {
  376. return /** @type{?proto.routeguide.Point} */ (
  377. jspb.Message.getWrapperField(this, proto.routeguide.Point, 1));
  378. };
  379. /**
  380. * @param {?proto.routeguide.Point|undefined} value
  381. * @return {!proto.routeguide.Rectangle} returns this
  382. */
  383. proto.routeguide.Rectangle.prototype.setLo = function(value) {
  384. return jspb.Message.setWrapperField(this, 1, value);
  385. };
  386. /**
  387. * Clears the message field making it undefined.
  388. * @return {!proto.routeguide.Rectangle} returns this
  389. */
  390. proto.routeguide.Rectangle.prototype.clearLo = function() {
  391. return this.setLo(undefined);
  392. };
  393. /**
  394. * Returns whether this field is set.
  395. * @return {boolean}
  396. */
  397. proto.routeguide.Rectangle.prototype.hasLo = function() {
  398. return jspb.Message.getField(this, 1) != null;
  399. };
  400. /**
  401. * optional Point hi = 2;
  402. * @return {?proto.routeguide.Point}
  403. */
  404. proto.routeguide.Rectangle.prototype.getHi = function() {
  405. return /** @type{?proto.routeguide.Point} */ (
  406. jspb.Message.getWrapperField(this, proto.routeguide.Point, 2));
  407. };
  408. /**
  409. * @param {?proto.routeguide.Point|undefined} value
  410. * @return {!proto.routeguide.Rectangle} returns this
  411. */
  412. proto.routeguide.Rectangle.prototype.setHi = function(value) {
  413. return jspb.Message.setWrapperField(this, 2, value);
  414. };
  415. /**
  416. * Clears the message field making it undefined.
  417. * @return {!proto.routeguide.Rectangle} returns this
  418. */
  419. proto.routeguide.Rectangle.prototype.clearHi = function() {
  420. return this.setHi(undefined);
  421. };
  422. /**
  423. * Returns whether this field is set.
  424. * @return {boolean}
  425. */
  426. proto.routeguide.Rectangle.prototype.hasHi = function() {
  427. return jspb.Message.getField(this, 2) != null;
  428. };
  429. if (jspb.Message.GENERATE_TO_OBJECT) {
  430. /**
  431. * Creates an object representation of this proto.
  432. * Field names that are reserved in JavaScript and will be renamed to pb_name.
  433. * Optional fields that are not set will be set to undefined.
  434. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
  435. * For the list of reserved names please see:
  436. * net/proto2/compiler/js/internal/generator.cc#kKeyword.
  437. * @param {boolean=} opt_includeInstance Deprecated. whether to include the
  438. * JSPB instance for transitional soy proto support:
  439. * http://goto/soy-param-migration
  440. * @return {!Object}
  441. */
  442. proto.routeguide.Feature.prototype.toObject = function(opt_includeInstance) {
  443. return proto.routeguide.Feature.toObject(opt_includeInstance, this);
  444. };
  445. /**
  446. * Static version of the {@see toObject} method.
  447. * @param {boolean|undefined} includeInstance Deprecated. Whether to include
  448. * the JSPB instance for transitional soy proto support:
  449. * http://goto/soy-param-migration
  450. * @param {!proto.routeguide.Feature} msg The msg instance to transform.
  451. * @return {!Object}
  452. * @suppress {unusedLocalVariables} f is only used for nested messages
  453. */
  454. proto.routeguide.Feature.toObject = function(includeInstance, msg) {
  455. var f, obj = {
  456. name: jspb.Message.getFieldWithDefault(msg, 1, ""),
  457. location: (f = msg.getLocation()) && proto.routeguide.Point.toObject(includeInstance, f)
  458. };
  459. if (includeInstance) {
  460. obj.$jspbMessageInstance = msg;
  461. }
  462. return obj;
  463. };
  464. }
  465. /**
  466. * Deserializes binary data (in protobuf wire format).
  467. * @param {jspb.ByteSource} bytes The bytes to deserialize.
  468. * @return {!proto.routeguide.Feature}
  469. */
  470. proto.routeguide.Feature.deserializeBinary = function(bytes) {
  471. var reader = new jspb.BinaryReader(bytes);
  472. var msg = new proto.routeguide.Feature;
  473. return proto.routeguide.Feature.deserializeBinaryFromReader(msg, reader);
  474. };
  475. /**
  476. * Deserializes binary data (in protobuf wire format) from the
  477. * given reader into the given message object.
  478. * @param {!proto.routeguide.Feature} msg The message object to deserialize into.
  479. * @param {!jspb.BinaryReader} reader The BinaryReader to use.
  480. * @return {!proto.routeguide.Feature}
  481. */
  482. proto.routeguide.Feature.deserializeBinaryFromReader = function(msg, reader) {
  483. while (reader.nextField()) {
  484. if (reader.isEndGroup()) {
  485. break;
  486. }
  487. var field = reader.getFieldNumber();
  488. switch (field) {
  489. case 1:
  490. var value = /** @type {string} */ (reader.readString());
  491. msg.setName(value);
  492. break;
  493. case 2:
  494. var value = new proto.routeguide.Point;
  495. reader.readMessage(value,proto.routeguide.Point.deserializeBinaryFromReader);
  496. msg.setLocation(value);
  497. break;
  498. default:
  499. reader.skipField();
  500. break;
  501. }
  502. }
  503. return msg;
  504. };
  505. /**
  506. * Serializes the message to binary data (in protobuf wire format).
  507. * @return {!Uint8Array}
  508. */
  509. proto.routeguide.Feature.prototype.serializeBinary = function() {
  510. var writer = new jspb.BinaryWriter();
  511. proto.routeguide.Feature.serializeBinaryToWriter(this, writer);
  512. return writer.getResultBuffer();
  513. };
  514. /**
  515. * Serializes the given message to binary data (in protobuf wire
  516. * format), writing to the given BinaryWriter.
  517. * @param {!proto.routeguide.Feature} message
  518. * @param {!jspb.BinaryWriter} writer
  519. * @suppress {unusedLocalVariables} f is only used for nested messages
  520. */
  521. proto.routeguide.Feature.serializeBinaryToWriter = function(message, writer) {
  522. var f = undefined;
  523. f = message.getName();
  524. if (f.length > 0) {
  525. writer.writeString(
  526. 1,
  527. f
  528. );
  529. }
  530. f = message.getLocation();
  531. if (f != null) {
  532. writer.writeMessage(
  533. 2,
  534. f,
  535. proto.routeguide.Point.serializeBinaryToWriter
  536. );
  537. }
  538. };
  539. /**
  540. * optional string name = 1;
  541. * @return {string}
  542. */
  543. proto.routeguide.Feature.prototype.getName = function() {
  544. return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
  545. };
  546. /**
  547. * @param {string} value
  548. * @return {!proto.routeguide.Feature} returns this
  549. */
  550. proto.routeguide.Feature.prototype.setName = function(value) {
  551. return jspb.Message.setProto3StringField(this, 1, value);
  552. };
  553. /**
  554. * optional Point location = 2;
  555. * @return {?proto.routeguide.Point}
  556. */
  557. proto.routeguide.Feature.prototype.getLocation = function() {
  558. return /** @type{?proto.routeguide.Point} */ (
  559. jspb.Message.getWrapperField(this, proto.routeguide.Point, 2));
  560. };
  561. /**
  562. * @param {?proto.routeguide.Point|undefined} value
  563. * @return {!proto.routeguide.Feature} returns this
  564. */
  565. proto.routeguide.Feature.prototype.setLocation = function(value) {
  566. return jspb.Message.setWrapperField(this, 2, value);
  567. };
  568. /**
  569. * Clears the message field making it undefined.
  570. * @return {!proto.routeguide.Feature} returns this
  571. */
  572. proto.routeguide.Feature.prototype.clearLocation = function() {
  573. return this.setLocation(undefined);
  574. };
  575. /**
  576. * Returns whether this field is set.
  577. * @return {boolean}
  578. */
  579. proto.routeguide.Feature.prototype.hasLocation = function() {
  580. return jspb.Message.getField(this, 2) != null;
  581. };
  582. if (jspb.Message.GENERATE_TO_OBJECT) {
  583. /**
  584. * Creates an object representation of this proto.
  585. * Field names that are reserved in JavaScript and will be renamed to pb_name.
  586. * Optional fields that are not set will be set to undefined.
  587. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
  588. * For the list of reserved names please see:
  589. * net/proto2/compiler/js/internal/generator.cc#kKeyword.
  590. * @param {boolean=} opt_includeInstance Deprecated. whether to include the
  591. * JSPB instance for transitional soy proto support:
  592. * http://goto/soy-param-migration
  593. * @return {!Object}
  594. */
  595. proto.routeguide.RouteNote.prototype.toObject = function(opt_includeInstance) {
  596. return proto.routeguide.RouteNote.toObject(opt_includeInstance, this);
  597. };
  598. /**
  599. * Static version of the {@see toObject} method.
  600. * @param {boolean|undefined} includeInstance Deprecated. Whether to include
  601. * the JSPB instance for transitional soy proto support:
  602. * http://goto/soy-param-migration
  603. * @param {!proto.routeguide.RouteNote} msg The msg instance to transform.
  604. * @return {!Object}
  605. * @suppress {unusedLocalVariables} f is only used for nested messages
  606. */
  607. proto.routeguide.RouteNote.toObject = function(includeInstance, msg) {
  608. var f, obj = {
  609. location: (f = msg.getLocation()) && proto.routeguide.Point.toObject(includeInstance, f),
  610. message: jspb.Message.getFieldWithDefault(msg, 2, "")
  611. };
  612. if (includeInstance) {
  613. obj.$jspbMessageInstance = msg;
  614. }
  615. return obj;
  616. };
  617. }
  618. /**
  619. * Deserializes binary data (in protobuf wire format).
  620. * @param {jspb.ByteSource} bytes The bytes to deserialize.
  621. * @return {!proto.routeguide.RouteNote}
  622. */
  623. proto.routeguide.RouteNote.deserializeBinary = function(bytes) {
  624. var reader = new jspb.BinaryReader(bytes);
  625. var msg = new proto.routeguide.RouteNote;
  626. return proto.routeguide.RouteNote.deserializeBinaryFromReader(msg, reader);
  627. };
  628. /**
  629. * Deserializes binary data (in protobuf wire format) from the
  630. * given reader into the given message object.
  631. * @param {!proto.routeguide.RouteNote} msg The message object to deserialize into.
  632. * @param {!jspb.BinaryReader} reader The BinaryReader to use.
  633. * @return {!proto.routeguide.RouteNote}
  634. */
  635. proto.routeguide.RouteNote.deserializeBinaryFromReader = function(msg, reader) {
  636. while (reader.nextField()) {
  637. if (reader.isEndGroup()) {
  638. break;
  639. }
  640. var field = reader.getFieldNumber();
  641. switch (field) {
  642. case 1:
  643. var value = new proto.routeguide.Point;
  644. reader.readMessage(value,proto.routeguide.Point.deserializeBinaryFromReader);
  645. msg.setLocation(value);
  646. break;
  647. case 2:
  648. var value = /** @type {string} */ (reader.readString());
  649. msg.setMessage(value);
  650. break;
  651. default:
  652. reader.skipField();
  653. break;
  654. }
  655. }
  656. return msg;
  657. };
  658. /**
  659. * Serializes the message to binary data (in protobuf wire format).
  660. * @return {!Uint8Array}
  661. */
  662. proto.routeguide.RouteNote.prototype.serializeBinary = function() {
  663. var writer = new jspb.BinaryWriter();
  664. proto.routeguide.RouteNote.serializeBinaryToWriter(this, writer);
  665. return writer.getResultBuffer();
  666. };
  667. /**
  668. * Serializes the given message to binary data (in protobuf wire
  669. * format), writing to the given BinaryWriter.
  670. * @param {!proto.routeguide.RouteNote} message
  671. * @param {!jspb.BinaryWriter} writer
  672. * @suppress {unusedLocalVariables} f is only used for nested messages
  673. */
  674. proto.routeguide.RouteNote.serializeBinaryToWriter = function(message, writer) {
  675. var f = undefined;
  676. f = message.getLocation();
  677. if (f != null) {
  678. writer.writeMessage(
  679. 1,
  680. f,
  681. proto.routeguide.Point.serializeBinaryToWriter
  682. );
  683. }
  684. f = message.getMessage();
  685. if (f.length > 0) {
  686. writer.writeString(
  687. 2,
  688. f
  689. );
  690. }
  691. };
  692. /**
  693. * optional Point location = 1;
  694. * @return {?proto.routeguide.Point}
  695. */
  696. proto.routeguide.RouteNote.prototype.getLocation = function() {
  697. return /** @type{?proto.routeguide.Point} */ (
  698. jspb.Message.getWrapperField(this, proto.routeguide.Point, 1));
  699. };
  700. /**
  701. * @param {?proto.routeguide.Point|undefined} value
  702. * @return {!proto.routeguide.RouteNote} returns this
  703. */
  704. proto.routeguide.RouteNote.prototype.setLocation = function(value) {
  705. return jspb.Message.setWrapperField(this, 1, value);
  706. };
  707. /**
  708. * Clears the message field making it undefined.
  709. * @return {!proto.routeguide.RouteNote} returns this
  710. */
  711. proto.routeguide.RouteNote.prototype.clearLocation = function() {
  712. return this.setLocation(undefined);
  713. };
  714. /**
  715. * Returns whether this field is set.
  716. * @return {boolean}
  717. */
  718. proto.routeguide.RouteNote.prototype.hasLocation = function() {
  719. return jspb.Message.getField(this, 1) != null;
  720. };
  721. /**
  722. * optional string message = 2;
  723. * @return {string}
  724. */
  725. proto.routeguide.RouteNote.prototype.getMessage = function() {
  726. return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
  727. };
  728. /**
  729. * @param {string} value
  730. * @return {!proto.routeguide.RouteNote} returns this
  731. */
  732. proto.routeguide.RouteNote.prototype.setMessage = function(value) {
  733. return jspb.Message.setProto3StringField(this, 2, value);
  734. };
  735. if (jspb.Message.GENERATE_TO_OBJECT) {
  736. /**
  737. * Creates an object representation of this proto.
  738. * Field names that are reserved in JavaScript and will be renamed to pb_name.
  739. * Optional fields that are not set will be set to undefined.
  740. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
  741. * For the list of reserved names please see:
  742. * net/proto2/compiler/js/internal/generator.cc#kKeyword.
  743. * @param {boolean=} opt_includeInstance Deprecated. whether to include the
  744. * JSPB instance for transitional soy proto support:
  745. * http://goto/soy-param-migration
  746. * @return {!Object}
  747. */
  748. proto.routeguide.RouteSummary.prototype.toObject = function(opt_includeInstance) {
  749. return proto.routeguide.RouteSummary.toObject(opt_includeInstance, this);
  750. };
  751. /**
  752. * Static version of the {@see toObject} method.
  753. * @param {boolean|undefined} includeInstance Deprecated. Whether to include
  754. * the JSPB instance for transitional soy proto support:
  755. * http://goto/soy-param-migration
  756. * @param {!proto.routeguide.RouteSummary} msg The msg instance to transform.
  757. * @return {!Object}
  758. * @suppress {unusedLocalVariables} f is only used for nested messages
  759. */
  760. proto.routeguide.RouteSummary.toObject = function(includeInstance, msg) {
  761. var f, obj = {
  762. pointCount: jspb.Message.getFieldWithDefault(msg, 1, 0),
  763. featureCount: jspb.Message.getFieldWithDefault(msg, 2, 0),
  764. distance: jspb.Message.getFieldWithDefault(msg, 3, 0),
  765. elapsedTime: jspb.Message.getFieldWithDefault(msg, 4, 0)
  766. };
  767. if (includeInstance) {
  768. obj.$jspbMessageInstance = msg;
  769. }
  770. return obj;
  771. };
  772. }
  773. /**
  774. * Deserializes binary data (in protobuf wire format).
  775. * @param {jspb.ByteSource} bytes The bytes to deserialize.
  776. * @return {!proto.routeguide.RouteSummary}
  777. */
  778. proto.routeguide.RouteSummary.deserializeBinary = function(bytes) {
  779. var reader = new jspb.BinaryReader(bytes);
  780. var msg = new proto.routeguide.RouteSummary;
  781. return proto.routeguide.RouteSummary.deserializeBinaryFromReader(msg, reader);
  782. };
  783. /**
  784. * Deserializes binary data (in protobuf wire format) from the
  785. * given reader into the given message object.
  786. * @param {!proto.routeguide.RouteSummary} msg The message object to deserialize into.
  787. * @param {!jspb.BinaryReader} reader The BinaryReader to use.
  788. * @return {!proto.routeguide.RouteSummary}
  789. */
  790. proto.routeguide.RouteSummary.deserializeBinaryFromReader = function(msg, reader) {
  791. while (reader.nextField()) {
  792. if (reader.isEndGroup()) {
  793. break;
  794. }
  795. var field = reader.getFieldNumber();
  796. switch (field) {
  797. case 1:
  798. var value = /** @type {number} */ (reader.readInt32());
  799. msg.setPointCount(value);
  800. break;
  801. case 2:
  802. var value = /** @type {number} */ (reader.readInt32());
  803. msg.setFeatureCount(value);
  804. break;
  805. case 3:
  806. var value = /** @type {number} */ (reader.readInt32());
  807. msg.setDistance(value);
  808. break;
  809. case 4:
  810. var value = /** @type {number} */ (reader.readInt32());
  811. msg.setElapsedTime(value);
  812. break;
  813. default:
  814. reader.skipField();
  815. break;
  816. }
  817. }
  818. return msg;
  819. };
  820. /**
  821. * Serializes the message to binary data (in protobuf wire format).
  822. * @return {!Uint8Array}
  823. */
  824. proto.routeguide.RouteSummary.prototype.serializeBinary = function() {
  825. var writer = new jspb.BinaryWriter();
  826. proto.routeguide.RouteSummary.serializeBinaryToWriter(this, writer);
  827. return writer.getResultBuffer();
  828. };
  829. /**
  830. * Serializes the given message to binary data (in protobuf wire
  831. * format), writing to the given BinaryWriter.
  832. * @param {!proto.routeguide.RouteSummary} message
  833. * @param {!jspb.BinaryWriter} writer
  834. * @suppress {unusedLocalVariables} f is only used for nested messages
  835. */
  836. proto.routeguide.RouteSummary.serializeBinaryToWriter = function(message, writer) {
  837. var f = undefined;
  838. f = message.getPointCount();
  839. if (f !== 0) {
  840. writer.writeInt32(
  841. 1,
  842. f
  843. );
  844. }
  845. f = message.getFeatureCount();
  846. if (f !== 0) {
  847. writer.writeInt32(
  848. 2,
  849. f
  850. );
  851. }
  852. f = message.getDistance();
  853. if (f !== 0) {
  854. writer.writeInt32(
  855. 3,
  856. f
  857. );
  858. }
  859. f = message.getElapsedTime();
  860. if (f !== 0) {
  861. writer.writeInt32(
  862. 4,
  863. f
  864. );
  865. }
  866. };
  867. /**
  868. * optional int32 point_count = 1;
  869. * @return {number}
  870. */
  871. proto.routeguide.RouteSummary.prototype.getPointCount = function() {
  872. return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0));
  873. };
  874. /**
  875. * @param {number} value
  876. * @return {!proto.routeguide.RouteSummary} returns this
  877. */
  878. proto.routeguide.RouteSummary.prototype.setPointCount = function(value) {
  879. return jspb.Message.setProto3IntField(this, 1, value);
  880. };
  881. /**
  882. * optional int32 feature_count = 2;
  883. * @return {number}
  884. */
  885. proto.routeguide.RouteSummary.prototype.getFeatureCount = function() {
  886. return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0));
  887. };
  888. /**
  889. * @param {number} value
  890. * @return {!proto.routeguide.RouteSummary} returns this
  891. */
  892. proto.routeguide.RouteSummary.prototype.setFeatureCount = function(value) {
  893. return jspb.Message.setProto3IntField(this, 2, value);
  894. };
  895. /**
  896. * optional int32 distance = 3;
  897. * @return {number}
  898. */
  899. proto.routeguide.RouteSummary.prototype.getDistance = function() {
  900. return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0));
  901. };
  902. /**
  903. * @param {number} value
  904. * @return {!proto.routeguide.RouteSummary} returns this
  905. */
  906. proto.routeguide.RouteSummary.prototype.setDistance = function(value) {
  907. return jspb.Message.setProto3IntField(this, 3, value);
  908. };
  909. /**
  910. * optional int32 elapsed_time = 4;
  911. * @return {number}
  912. */
  913. proto.routeguide.RouteSummary.prototype.getElapsedTime = function() {
  914. return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0));
  915. };
  916. /**
  917. * @param {number} value
  918. * @return {!proto.routeguide.RouteSummary} returns this
  919. */
  920. proto.routeguide.RouteSummary.prototype.setElapsedTime = function(value) {
  921. return jspb.Message.setProto3IntField(this, 4, value);
  922. };
  923. goog.object.extend(exports, proto.routeguide);