showing polygon, line, and markers together #1716

This commit is contained in:
Nicholas Hallahan
2015-07-16 18:26:58 -07:00
parent e1cdc8209c
commit ed650b4128
2 changed files with 10 additions and 1 deletions

View File

@@ -296,6 +296,12 @@ public class MainActivity extends ActionBarActivity {
.position(backLot)
.title("Back Lot")
.snippet("The back lot behind my house"));
LatLng cheeseRoom = new LatLng(38.531577,-122.010646);
map.addMarker(new MarkerOptions()
.position(cheeseRoom)
.title("Cheese Room")
.snippet("The only air conditioned room on the property!"));
}
private void addPolyline() {
@@ -321,7 +327,7 @@ public class MainActivity extends ActionBarActivity {
LatLng[] latLngs = Util.parseGeoJSONCoordinates(geojsonStr);
MapView map = mMapFragment.getMap();
Polygon polygon = map.addPolygon(new PolygonOptions()
.add(new LatLng(0, 0), new LatLng(0, 5), new LatLng(3, 5), new LatLng(0, 0))
.add(latLngs)
.strokeColor(Color.MAGENTA)
.fillColor(Color.BLUE));
} catch (IOException e) {

View File

@@ -7,6 +7,7 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.mapbox.mapboxgl.geometry.LatLng;
import com.mapbox.mapboxgl.views.MapView;
import java.io.BufferedReader;
@@ -77,6 +78,8 @@ public class MapFragment extends Fragment {
// Need to pass on to view
mMap.onStart();
mMap.setCenterCoordinate(new LatLng(38.247887,-121.843872));
mMap.setZoomLevel(7);
}
// Called when the fragment is invisible