001 package com.google.gwt.maps.client.services;
002
003 /**
004 * The valid unit systems that can be specified in a DirectionsRequest.
005 * <br><br>
006 * See <a href="https://developers.google.com/maps/documentation/javascript/reference#UnitSystem">UnitSystem API Doc</a>
007 */
008 public enum UnitSystem {
009
010 /**
011 * Specifies that distances in the DirectionsResult should be expressed in imperial units.
012 */
013 IMPERIAL(1),
014
015 /**
016 * Specifies that distances in the DirectionsResult should be expressed in metric units.
017 */
018 METRIC(0);
019
020 private int type;
021
022 UnitSystem(int type) {
023 this.type = type;
024 }
025
026 public int value() {
027 return type;
028 }
029
030 public static UnitSystem fromValue(int type) {
031 UnitSystem u = null;
032 switch (type) {
033 case 0:
034 u = UnitSystem.METRIC;
035 break;
036 case 1:
037 u = UnitSystem.IMPERIAL;
038 break;
039 }
040 return u;
041 }
042
043 public String toString() {
044 return name() + "(" + type + ")";
045 }
046
047 }