本文整理汇总了Java中org.osmdroid.bonuspack.kml.KmlFolder类的典型用法代码示例。如果您正苦于以下问题:Java KmlFolder类的具体用法?Java KmlFolder怎么用?Java KmlFolder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
KmlFolder类属于org.osmdroid.bonuspack.kml包,在下文中一共展示了KmlFolder类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: insertOverlaysInKml
import org.osmdroid.bonuspack.kml.KmlFolder; //导入依赖的package包/类
void insertOverlaysInKml(){
KmlFolder root = mKmlDocument.mKmlRoot;
//Insert relevant overlays inside:
if (mItineraryMarkers.getItems().size()>0)
root.addOverlay(mItineraryMarkers, mKmlDocument);
if (mRoadOverlays != null){
for (int i=0; i<mRoadOverlays.length; i++)
root.addOverlay(mRoadOverlays[i], mKmlDocument);
}
if (mRoadNodeMarkers.getItems().size()>0)
root.addOverlay(mRoadNodeMarkers, mKmlDocument);
root.addOverlay(mDestinationPolygon, mKmlDocument);
if (mPoiMarkers.getItems().size()>0){
root.addOverlay(mPoiMarkers, mKmlDocument);
}
}
示例2: onCreate
import org.osmdroid.bonuspack.kml.KmlFolder; //导入依赖的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);
}
});
}
}
示例3: KmlListAdapter
import org.osmdroid.bonuspack.kml.KmlFolder; //导入依赖的package包/类
public KmlListAdapter(Context context, KmlFolder root) {
mRoot = root;
}
示例4: getView
import org.osmdroid.bonuspack.kml.KmlFolder; //导入依赖的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;
}