001 /*
002 * Apache License
003 * Version 2.0, January 2004
004 * http://www.apache.org/licenses/
005 *
006 * Copyright 2008 by chenillekit.org
007 *
008 * Licensed under the Apache License, Version 2.0 (the "License");
009 * you may not use this file except in compliance with the License.
010 * You may obtain a copy of the License at
011 *
012 * http://www.apache.org/licenses/LICENSE-2.0
013 *
014 */
015
016 package org.chenillekit.google.utils.geocode;
017
018 import org.chenillekit.google.utils.JSONException;
019 import org.chenillekit.google.utils.JSONObject;
020
021 /**
022 * @version $Id: Placemark.java 351 2008-11-25 12:40:18Z homburgs $
023 */
024 public class Placemark
025 {
026 private AddressDetails addressDetails;
027 private LatLng latLng;
028 private String address;
029 private String id;
030
031 public Placemark(JSONObject json)
032 {
033 buildFromJSON(json);
034 }
035
036 private void buildFromJSON(JSONObject json)
037 {
038 try
039 {
040 address = json.getString("address");
041 id = json.getString("id");
042 addressDetails = new AddressDetails(json.getJSONObject("AddressDetails"));
043 latLng = new LatLng(json.getJSONObject("Point"));
044 }
045 catch (JSONException e)
046 {
047 throw new RuntimeException(e);
048 }
049 }
050
051 public AddressDetails getAddressDetails()
052 {
053 return addressDetails;
054 }
055
056 public String getAddress()
057 {
058 return address;
059 }
060
061 public String getId()
062 {
063 return id;
064 }
065
066 public LatLng getLatLng()
067 {
068 return latLng;
069 }
070 }