当前位置: 首页>>代码示例>>Java>>正文


Java KmlFeature类代码示例

本文整理汇总了Java中org.osmdroid.bonuspack.kml.KmlFeature的典型用法代码示例。如果您正苦于以下问题:Java KmlFeature类的具体用法?Java KmlFeature怎么用?Java KmlFeature使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


KmlFeature类属于org.osmdroid.bonuspack.kml包,在下文中一共展示了KmlFeature类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: recordCurrentLocationInTrack

import org.osmdroid.bonuspack.kml.KmlFeature; //导入依赖的package包/类
void recordCurrentLocationInTrack(String trackId, String trackName, GeoPoint currentLocation) {
	//Find the KML track in the current KML structure - and create it if necessary:
	KmlTrack t;
	KmlFeature f = mKmlDocument.mKmlRoot.findFeatureId(trackId, false);
	if (f == null)
		t = createTrack(trackId, trackName);
	else if (!(f instanceof KmlPlacemark))
		//id already defined but is not a PlaceMark
		return;
	else {
		KmlPlacemark p = (KmlPlacemark)f;
		if (!(p.mGeometry instanceof KmlTrack))
			//id already defined but is not a Track
			return;
		else
			t = (KmlTrack) p.mGeometry;
	}
	//TODO check if current location is really different from last point of the track
	//record in the track the current location at current time:
	t.add(currentLocation, new Date());
	//refresh KML:
	updateUIWithKml();
}
 
开发者ID:MKergall,项目名称:osmbonuspack,代码行数:24,代码来源:MapActivity.java

示例2: doInBackground

import org.osmdroid.bonuspack.kml.KmlFeature; //导入依赖的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

示例3: onActivityResult

import org.osmdroid.bonuspack.kml.KmlFeature; //导入依赖的package包/类
@Override protected void onActivityResult (int requestCode, int resultCode, Intent intent) {
	switch (requestCode) {
		case FriendsManager.START_SHARING_REQUEST:
		case FriendsManager.FRIENDS_REQUEST:
			mFriendsManager.onActivityResult(requestCode, resultCode, intent);
			break;
		case ROUTE_REQUEST:
			if (resultCode == RESULT_OK) {
				int nodeId = intent.getIntExtra("NODE_ID", 0);
				map.getController().setCenter(mRoads[mSelectedRoad].mNodes.get(nodeId).mLocation);
				Marker roadMarker = (Marker) mRoadNodeMarkers.getItems().get(nodeId);
				roadMarker.showInfoWindow();
			}
			break;
		case POIS_REQUEST:
			if (resultCode == RESULT_OK) {
				int id = intent.getIntExtra("ID", 0);
				map.getController().setCenter(mPOIs.get(id).mLocation);
				Marker poiMarker = mPoiMarkers.getItem(id);
				poiMarker.showInfoWindow();
			}
			break;
		case KmlTreeActivity.KML_TREE_REQUEST:
			mKmlStack.pop();
			updateUIWithKml();
			if (intent == null)
				break;
			KmlFeature selectedFeature = intent.getParcelableExtra("KML_FEATURE");
			if (selectedFeature == null)
				break;
			BoundingBox bb = selectedFeature.getBoundingBox();
			setViewOn(bb);
			break;
		case KmlStylesActivity.KML_STYLES_REQUEST:
			updateUIWithKml();
			break;
		default:
			break;
	}
}
 
开发者ID:MKergall,项目名称:osmbonuspack,代码行数:41,代码来源:MapActivity.java

示例4: addKmlPoint

import org.osmdroid.bonuspack.kml.KmlFeature; //导入依赖的package包/类
void addKmlPoint(GeoPoint position){
	KmlFeature kmlPoint = new KmlPlacemark(position);
	mKmlDocument.mKmlRoot.add(kmlPoint);
	new KMLGeocodingTask().execute(kmlPoint);
	updateUIWithKml();
}
 
开发者ID:MKergall,项目名称:osmbonuspack,代码行数:7,代码来源:MapActivity.java

示例5: onCreate

import org.osmdroid.bonuspack.kml.KmlFeature; //导入依赖的package包/类
@Override protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.kml_main);
	mListView = (ListView) findViewById(R.id.listviewKml);
	registerForContextMenu(mListView);
	
	mCurrentKmlFeature = MapActivity.mKmlStack.peek();
	mKmlClipboard = MapActivity.mKmlClipboard;
	
	eHeader = (EditText)findViewById(R.id.name);
	eHeader.setText(mCurrentKmlFeature.mName);
	
	eDescription = (EditText)findViewById(R.id.description);
	eDescription.setText(mCurrentKmlFeature.mDescription);
	
	sStyleSpinner = (Spinner) findViewById(R.id.styleSpinner);
	ArrayAdapter<String> spinnerAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, stylesWithEmpty());
	spinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
	sStyleSpinner.setAdapter(spinnerAdapter);
	if (mCurrentKmlFeature.mStyle != null){
		int spinnerPosition = spinnerAdapter.getPosition(mCurrentKmlFeature.mStyle);
		sStyleSpinner.setSelection(spinnerPosition);
	}
	
	CheckBox cVisible = (CheckBox)findViewById(R.id.checkbox_visible);
	cVisible.setChecked(mCurrentKmlFeature.mVisibility);
	
	if (mCurrentKmlFeature instanceof KmlFolder){
		mListAdapter = new KmlListAdapter(this, (KmlFolder)mCurrentKmlFeature);
		// setting list adapter
		mListView.setAdapter(mListAdapter);
		// Listview on child click listener
		mListView.setOnItemClickListener(new OnItemClickListener() {
			@Override public void onItemClick(AdapterView<?> arg0, View view, int position, long index) {
				mItemPosition = position;
				KmlFeature item = ((KmlFolder)mCurrentKmlFeature).mItems.get(position);
				Intent myIntent = new Intent(view.getContext(), KmlTreeActivity.class);
				//myIntent.putExtra("KML", item);
				MapActivity.mKmlStack.push(item);
				startActivityForResult(myIntent, KML_TREE_REQUEST);
			}
		});
	}
	
}
 
开发者ID:MKergall,项目名称:osmbonuspack,代码行数:46,代码来源:KmlTreeActivity.java

示例6: getView

import org.osmdroid.bonuspack.kml.KmlFeature; //导入依赖的package包/类
@Override public View getView(int position, View convertView, ViewGroup viewGroup) {
  	KmlFeature item = (KmlFeature)getItem(position);
      if (convertView == null) {
          LayoutInflater inflater = (LayoutInflater) viewGroup.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
          convertView = inflater.inflate(R.layout.kml_list_item, null);
      }
      TextView itemText = (TextView) convertView.findViewById(R.id.listItemTxt);
      itemText.setText(item.mName);
      
      //Handle checkbox:
      /*
      CheckBox checkBoxIsVisible = (CheckBox)convertView.findViewById(R.id.listItemCheckbox);
      checkBoxIsVisible.setChecked(mRoot.mItems.get(position).mVisibility);
      if (checkBoxIsVisible != null) {
       checkBoxIsVisible.setOnClickListener(new OnClickListener(){
		@Override public void onClick(View view) {
			int position = (Integer)view.getTag();
			KmlFeature item = mRoot.mItems.get(position);
			item.mVisibility = ((CheckBox)view).isChecked();
		}
       });
       checkBoxIsVisible.setTag(position);
      }
      */
      
ImageView img = (ImageView)convertView.findViewById(R.id.listItemImg);
if (item instanceof KmlFolder) {
	img.setImageResource(R.drawable.moreinfo_arrow);
} else if (item instanceof KmlPlacemark){
	KmlGeometry geometry = ((KmlPlacemark)item).mGeometry;
	if (geometry instanceof KmlPoint)
		img.setImageResource(R.drawable.marker_kml_point);
	else if (geometry instanceof KmlLineString)
		img.setImageResource(R.drawable.kml_icon_linestring);
	else if (geometry instanceof KmlPolygon)
		img.setImageResource(R.drawable.kml_icon_polygon);
	else if (geometry instanceof KmlMultiGeometry)
		img.setImageResource(R.drawable.kml_icon_multigeometry);
	else if (geometry instanceof KmlTrack)
		img.setImageResource(R.drawable.kml_icon_gxtrack);
	else
		img.setImageDrawable(null);
} else if (item instanceof KmlGroundOverlay){
	img.setImageResource(R.drawable.kml_icon_groundoverlay);
} else
	img.setImageDrawable(null);

      return convertView;
  }
 
开发者ID:MKergall,项目名称:osmbonuspack,代码行数:50,代码来源:KmlListAdapter.java

示例7: onFeature

import org.osmdroid.bonuspack.kml.KmlFeature; //导入依赖的package包/类
@Override
public void onFeature(Overlay overlay, KmlFeature kmlFeature) {
	//If nothing to do, do nothing. 
}
 
开发者ID:MKergall,项目名称:osmbonuspack,代码行数:5,代码来源:MainActivity.java

示例8: onFeature

import org.osmdroid.bonuspack.kml.KmlFeature; //导入依赖的package包/类
@Override
public void onFeature(Overlay overlay, KmlFeature kmlFeature) {

}
 
开发者ID:smartufpa,项目名称:SmartUFPA,代码行数:5,代码来源:BusRouteKmlStyler.java


注:本文中的org.osmdroid.bonuspack.kml.KmlFeature类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。