當前位置: 首頁>>代碼示例>>Java>>正文


Java KmlDocument類代碼示例

本文整理匯總了Java中org.osmdroid.bonuspack.kml.KmlDocument的典型用法代碼示例。如果您正苦於以下問題:Java KmlDocument類的具體用法?Java KmlDocument怎麽用?Java KmlDocument使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


KmlDocument類屬於org.osmdroid.bonuspack.kml包,在下文中一共展示了KmlDocument類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: doInBackground

import org.osmdroid.bonuspack.kml.KmlDocument; //導入依賴的package包/類
@Override protected Boolean doInBackground(Object... params) {
	mUri = (String)params[0];
	mOnCreate = (Boolean)params[1];
	boolean isOverpassRequest = (Boolean)params[2];
	mKmlDocument = new KmlDocument();
	boolean ok = false;
	if (isOverpassRequest){
		//mUri contains the query
		ok = getKMLFromOverpass(mUri);
	} else if (mUri.startsWith("file:/")){
		mUri = mUri.substring("file:/".length());
		File file = new File(mUri);
		if (mUri.endsWith(".json"))
			ok = mKmlDocument.parseGeoJSON(file);
		else if (mUri.endsWith(".kmz"))
			ok = mKmlDocument.parseKMZFile(file);
		else //assume KML
			ok = mKmlDocument.parseKMLFile(file);
	} else if (mUri.startsWith("http")) {
		ok = mKmlDocument.parseKMLUrl(mUri);
	}
	return ok;
}
 
開發者ID:MKergall,項目名稱:osmbonuspack,代碼行數:24,代碼來源:MapActivity.java

示例2: doInBackground

import org.osmdroid.bonuspack.kml.KmlDocument; //導入依賴的package包/類
@Override
protected Overlay doInBackground(Void... voids) {
    OverpassAPIProvider overpassProvider = new OverpassAPIProvider();
    // For overpass queries, use the following order of coordinates: (south,west,north,east)
    final String[] mapRegionBounds = ConfigHelper.getConfigValue(mapFragment.getContext(), Constants.MAP_REGION_BOUNDS).split(",");
    double north = Double.valueOf(mapRegionBounds[0]);
    double east = Double.valueOf(mapRegionBounds[1]);
    double south = Double.valueOf(mapRegionBounds[2]);
    double west = Double.valueOf(mapRegionBounds[3]);

    // Build the query
    StringBuilder builder = new StringBuilder();
    builder.append(Constants.URL_OVERPASS_SERVER);
    final String query = String.format(Locale.US,Constants.QUERY_OVERPASS_BUS_ROUTE,
            south,west,north,east,
            south,west,north,east,
            south,west,north,east);
    try {
        builder.append(URLEncoder.encode(query,"UTF-8"));
    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
    }
    final String finalUrl = builder.toString();

    KmlDocument kmlDocument = new KmlDocument();
    // true if ok, false if technical error.
    if(overpassProvider.addInKmlFolder(kmlDocument.mKmlRoot, finalUrl)){
        KmlFeature.Styler busRouteStyler = new BusRouteKmlStyler(mapFragment.getContext());
        return kmlDocument.mKmlRoot.buildOverlay(mapView,null, busRouteStyler, kmlDocument);
    }
    taskStatus = ServerResponse.CONNECTION_FAILED;
    return null;
}
 
開發者ID:smartufpa,項目名稱:SmartUFPA,代碼行數:34,代碼來源:BusRouteTask.java


注:本文中的org.osmdroid.bonuspack.kml.KmlDocument類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。