Search in sources :

Example 1 with KmlMultiGeometry

use of org.osmdroid.bonuspack.kml.KmlMultiGeometry in project osmbonuspack by MKergall.

the class KmlListAdapter method getView.

@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;
}
Also used : KmlPoint(org.osmdroid.bonuspack.kml.KmlPoint) KmlMultiGeometry(org.osmdroid.bonuspack.kml.KmlMultiGeometry) KmlFeature(org.osmdroid.bonuspack.kml.KmlFeature) KmlGroundOverlay(org.osmdroid.bonuspack.kml.KmlGroundOverlay) LayoutInflater(android.view.LayoutInflater) KmlFolder(org.osmdroid.bonuspack.kml.KmlFolder) TextView(android.widget.TextView) KmlGeometry(org.osmdroid.bonuspack.kml.KmlGeometry) ImageView(android.widget.ImageView) KmlPlacemark(org.osmdroid.bonuspack.kml.KmlPlacemark) KmlPolygon(org.osmdroid.bonuspack.kml.KmlPolygon) KmlLineString(org.osmdroid.bonuspack.kml.KmlLineString) KmlTrack(org.osmdroid.bonuspack.kml.KmlTrack)

Example 2 with KmlMultiGeometry

use of org.osmdroid.bonuspack.kml.KmlMultiGeometry in project osmbonuspack by MKergall.

the class OverpassAPIProvider method buildMultiGeometry.

protected KmlMultiGeometry buildMultiGeometry(JsonArray jMembers) {
    KmlMultiGeometry geometry = new KmlMultiGeometry();
    for (JsonElement j : jMembers) {
        JsonObject jMember = j.getAsJsonObject();
        KmlGeometry item = buildGeometry(jMember);
        geometry.addItem(item);
    }
    return geometry;
}
Also used : JsonElement(com.google.gson.JsonElement) KmlMultiGeometry(org.osmdroid.bonuspack.kml.KmlMultiGeometry) JsonObject(com.google.gson.JsonObject) KmlGeometry(org.osmdroid.bonuspack.kml.KmlGeometry)

Aggregations

KmlGeometry (org.osmdroid.bonuspack.kml.KmlGeometry)2 KmlMultiGeometry (org.osmdroid.bonuspack.kml.KmlMultiGeometry)2 LayoutInflater (android.view.LayoutInflater)1 ImageView (android.widget.ImageView)1 TextView (android.widget.TextView)1 JsonElement (com.google.gson.JsonElement)1 JsonObject (com.google.gson.JsonObject)1 KmlFeature (org.osmdroid.bonuspack.kml.KmlFeature)1 KmlFolder (org.osmdroid.bonuspack.kml.KmlFolder)1 KmlGroundOverlay (org.osmdroid.bonuspack.kml.KmlGroundOverlay)1 KmlLineString (org.osmdroid.bonuspack.kml.KmlLineString)1 KmlPlacemark (org.osmdroid.bonuspack.kml.KmlPlacemark)1 KmlPoint (org.osmdroid.bonuspack.kml.KmlPoint)1 KmlPolygon (org.osmdroid.bonuspack.kml.KmlPolygon)1 KmlTrack (org.osmdroid.bonuspack.kml.KmlTrack)1