package com.googleservice.datatype;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONObject;
import com.googleservice.util.JSONUtil;
public final class Address
{
private static final String TAG_FORMAT_ADDRESS = "formatted_address";
private static final String TAG_ADDERSS_COMPONENTS = "address_components";
private static final String TAG_LONG_NAME = "long_name";
private static final String TAG_TYPES = "types";
private static final String TAG_GEOMETRY = "geometry";
private static final String TAG_LOCATION = "location";
/**
* [https://developers.google.com/maps/documentation/geocoding/?hl=en#Types]
* Address Component Types:
*
* [street_address] indicates a precise street address.
* [route] indicates a named route (such as "US 101").
* [intersection] indicates a major intersection, usually of two major roads.
* [political] indicates a political entity. Usually, this type indicates
* a polygon of some civil administration.
* [country] indicates the national political entity, and is
* typically the highest order type returned by the Geocoder.
* [administrative_area_level_1] indicates a first-order civil entity below
* the country level. Within the United States, these administrative
* levels are states. Not all nations exhibit these administrative levels.
* [administrative_area_level_2] indicates a second-order civil entity below
* the country level. Within the United States, these administrative levels
* are counties. Not all nations exhibit these administrative levels.
* [administrative_area_level_3] indicates a third-order civil entity below
* the country level. This type indicates a minor civil division. Not all
* nations exhibit these administrative levels.
* [colloquial_area] indicates a commonly-used alternative name for the entity.
* [locality] indicates an incorporated city or town political entity.
* [sublocality] indicates an first-order civil entity below a locality
* [neighborhood] indicates a named neighborhood
* [premise] indicates a named location, usually a building or collection
* of buildings with a common name
* [subpremise] indicates a first-order entity below a named location, usually
* a singular building within a collection of buildings with a common name
* [postal_code] indicates a postal code as used to address postal mail within
* the country.
* [natural_feature] indicates a prominent natural feature.
* [airport] indicates an airport.
* [park] indicates a named park.
* [point_of_interest] indicates a named point of interest. Typically, these
* "POI"s are prominent local entities that don't easily fit in another
* category such as "Empire State Building" or "Statue of Liberty."
*
* In addition to the above, address components may exhibit the following types:
*
* [post_box] indicates a specific postal box.
* [street_number] indicates the precise street number.
* [floor] indicates the floor of a building address.
* [room] indicates the room of a building address.
*/
private static final String TYPE_COUNTRY = "country";
private static final String TYPE_AREA_LEVEL_1 = "administrative_area_level_1";
private static final String TYPE_AREA_LEVEL_2 = "administrative_area_level_2";
private static final String TYPE_AREA_LEVEL_3 = "administrative_area_level_3";
private static final String TYPE_COLLOQUIAL_AREA = "colloquial_area";
private static final String TYPE_LOCALITY = "locality";
private static final String TYPE_SUB_LOCALITY = "sublocality";
private static final String TYPE_PREMISE = "premise";
private static final String TYPE_SUB_PREMISE = "subpremise";
private static final String TYPE_NEIGHBORHOOD = "neighborhood";
private static final String TYPE_ROUTE = "route";
private static final String TYPE_STREET_ADDRESS = "street_address";
private static final String TYPE_INTERSECTION = "intersection";
private static final String TYPE_POLITICAL = "political";
private static final String TYPE_NATURAL_FEATURE = "natural_feature";
private static final String TYPE_AIRPORT = "airport";
private static final String TYPE_PARK = "park";
private static final String TYPE_POI = "point_of_interest";
private static final String TYPE_STREET_NUMBER = "street_number";
private static final String TYPE_POSTAL_CODE = "postal_code";
private static final String TYPE_POST_BOX = "post_box";
private static final String TYPE_FLOOR = "floor";
private static final String TYPE_ROOM = "room";
private GSPoint location;
private String country;
private String state;
private String city;
private String region;
private String street;
private String streetNumber;
private String postalCode;
private String addressLabel;
private String formatAddres;
private String addressName;
public Address( )
{}
public String getCountry( )
{
return this.country;
}
public void setCountry( String country )
{
this.country = country;
}
public String getState( )
{
return this.state;
}
public void setState( String state )
{
this.state = state;
}
public String getCity( )
{
return this.city;
}
public void setCity( String city )
{
this.city = city;
}
public String getRegion( )
{
return this.region;
}
public void setRegion( String region )
{
this.region = region;
}
public String getStreet( )
{
return this.street;
}
public void setStreet( String street )
{
this.street = street;
}
public String getStreetNumber( )
{
return this.streetNumber;
}
public void setStreetNumber( String streetNumber )
{
this.streetNumber = streetNumber;
}
public String getPostalCode( )
{
return this.postalCode;
}
public void setPostalCode( String postalCode )
{
this.postalCode = postalCode;
}
public String getAddressLabel( )
{
return this.addressLabel;
}
public void setAddressLabel( String addressLabel )
{
this.addressLabel = addressLabel;
}
public String getFormatAddress( )
{
return this.formatAddres;
}
public void setFormatAddress( String addr )
{
this.formatAddres = addr;
}
public String getShortAddress( )
{
return addressName;
}
public void createShortAddress( )
{
StringBuilder buffer = new StringBuilder( );
if ( this.getAddressLabel( ) != null )
{
buffer.append( this.getCity( ) );
buffer.append( this.getAddressLabel( ) );
}
else if ( this.getStreetNumber( ) != null )
{
buffer.append( this.getStreet( ) );
buffer.append( this.getStreetNumber( ) );
}
else if ( this.getStreet( ) != null )
{
buffer.append( this.getRegion( ) );
buffer.append( this.getStreet( ) );
}
else if ( this.getRegion( ) != null )
{
buffer.append( this.getCity( ) );
buffer.append( this.getRegion( ) );
}
else if ( this.getCity( ) != null )
{
buffer.append( this.getState( ) );
buffer.append( this.getCity( ) );
}
else if ( this.getState( ) != null )
{
buffer.append( this.getCountry( ) );
buffer.append( this.getState( ) );
}
else
{
buffer.append( this.getCountry( ) );
}
this.setShortAddress( buffer.toString( ).trim( ) );
}
public void setShortAddress( String str )
{
this.addressName = str;
}
public GSPoint getLocation( )
{
return this.location;
}
public void setLocation( GSPoint location )
{
this.location = location;
}
public String toString( )
{
StringBuilder buffer = new StringBuilder( );
buffer.append( this.formatAddres );
buffer.append( ' ' );
buffer.append( this.location.toDisplayString( ) );
return buffer.toString( ).trim
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
google_service_java_lib.rar (28个子文件)
google_service_java_lib
src
com
googleservice
IRequestSender.java 150B
IRequestConstant.java 2KB
GoogleServiceManager.java 2KB
datatype
AbstractJSONlizable.java 717B
DirectionResult.java 993B
JSONlizable.java 388B
Step.java 4KB
ElevationResult.java 1KB
Address.java 12KB
ServiceJSONTag.java 1KB
Route.java 3KB
DistanceInfo.java 1KB
DistanceMatrixResult.java 825B
GeocodeResult.java 999B
DistanceMatrix.java 6KB
GSPoint.java 6KB
RouteLeg.java 4KB
BaseResult.java 920B
Elevation.java 2KB
Bounds.java 2KB
util
GSUtil.java 5KB
JSONUtil.java 2KB
RequestHelper.java 5KB
dist
google_service_java_lib.jar 31KB
lib
json_common_lib.jar 30KB
commons-logging-1.1.1.jar 59KB
httpcore-4.2.1.jar 218KB
httpclient-4.2.1.jar 417KB
共 28 条
- 1
资源评论
Flanker109
- 粉丝: 0
- 资源: 5
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功