-
Notifications
You must be signed in to change notification settings - Fork 509
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [flutter] [android] - add fill support * Resolved merge conflict. * A first working version for ios (after some extensive rebasing). * Minor cleanup * Minor cleanup. * Fix broken build Android. * A working version for Android. * Minor cleanup. * Added fill pattern example. Works on Android not on iOS. Seems to break consecutive fills though. * For the first queried feature (when filter is set) create a fill. * Fix lint issue (unused method). * Updated code formatting. * Added interior polygon to iOS. * [docs] update readme support table * fixup Co-authored-by: Timothy Sealy <timothy.sealy@gmail.com>
- Loading branch information
1 parent
10788a7
commit 95b7d7b
Showing
23 changed files
with
956 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
android/src/main/java/com/mapbox/mapboxgl/FillBuilder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// This file is generated. | ||
|
||
// Copyright 2018 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
package com.mapbox.mapboxgl; | ||
|
||
import com.mapbox.mapboxsdk.geometry.LatLng; | ||
import com.mapbox.mapboxsdk.plugins.annotation.Fill; | ||
import com.mapbox.mapboxsdk.plugins.annotation.FillManager; | ||
import com.mapbox.mapboxsdk.plugins.annotation.FillOptions; | ||
|
||
import java.util.List; | ||
|
||
class FillBuilder implements FillOptionsSink { | ||
private final FillManager fillManager; | ||
private final FillOptions fillOptions; | ||
|
||
FillBuilder(FillManager fillManager) { | ||
this.fillManager = fillManager; | ||
this.fillOptions = new FillOptions(); | ||
} | ||
|
||
Fill build() { | ||
return fillManager.create(fillOptions); | ||
} | ||
|
||
@Override | ||
public void setFillOpacity(float fillOpacity) { | ||
fillOptions.withFillOpacity(fillOpacity); | ||
} | ||
|
||
@Override | ||
public void setFillColor(String fillColor) { | ||
fillOptions.withFillColor(fillColor); | ||
} | ||
|
||
@Override | ||
public void setFillOutlineColor(String fillOutlineColor) { | ||
fillOptions.withFillOutlineColor(fillOutlineColor); | ||
} | ||
|
||
@Override | ||
public void setFillPattern(String fillPattern) { | ||
fillOptions.withFillPattern(fillPattern); | ||
} | ||
|
||
@Override | ||
public void setGeometry(List<List<LatLng>> geometry) { | ||
fillOptions.withGeometry(Convert.interpretListLatLng(geometry)); | ||
} | ||
|
||
@Override | ||
public void setDraggable(boolean draggable) { | ||
fillOptions.withDraggable(draggable); | ||
} | ||
} |
74 changes: 74 additions & 0 deletions
74
android/src/main/java/com/mapbox/mapboxgl/FillController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
// This file is generated. | ||
|
||
// Copyright 2018 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
package com.mapbox.mapboxgl; | ||
|
||
import android.graphics.Color; | ||
import com.mapbox.mapboxsdk.geometry.LatLng; | ||
import com.mapbox.mapboxsdk.plugins.annotation.Fill; | ||
import com.mapbox.mapboxsdk.plugins.annotation.FillManager; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* Controller of a single Fill on the map. | ||
*/ | ||
class FillController implements FillOptionsSink { | ||
private final Fill fill; | ||
private final OnFillTappedListener onTappedListener; | ||
private boolean consumeTapEvents; | ||
|
||
FillController(Fill fill, boolean consumeTapEvents, OnFillTappedListener onTappedListener) { | ||
this.fill = fill; | ||
this.consumeTapEvents = consumeTapEvents; | ||
this.onTappedListener = onTappedListener; | ||
} | ||
|
||
boolean onTap() { | ||
if (onTappedListener != null) { | ||
onTappedListener.onFillTapped(fill); | ||
} | ||
return consumeTapEvents; | ||
} | ||
|
||
void remove(FillManager fillManager) { | ||
fillManager.delete(fill); | ||
} | ||
|
||
@Override | ||
public void setFillOpacity(float fillOpacity) { | ||
fill.setFillOpacity(fillOpacity); | ||
} | ||
|
||
@Override | ||
public void setFillColor(String fillColor) { | ||
fill.setFillColor(Color.parseColor(fillColor)); | ||
} | ||
|
||
@Override | ||
public void setFillOutlineColor(String fillOutlineColor) { | ||
fill.setFillOutlineColor(Color.parseColor(fillOutlineColor)); | ||
} | ||
|
||
@Override | ||
public void setFillPattern(String fillPattern) { | ||
fill.setFillPattern(fillPattern); | ||
} | ||
|
||
@Override | ||
public void setGeometry(List<List<LatLng>> geometry) { | ||
fill.setGeometry(Convert.interpretListLatLng(geometry)); | ||
} | ||
|
||
@Override | ||
public void setDraggable(boolean draggable) { | ||
fill.setDraggable(draggable); | ||
} | ||
|
||
public void update(FillManager fillManager) { | ||
fillManager.update(fill); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
android/src/main/java/com/mapbox/mapboxgl/FillOptionsSink.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// This file is generated. | ||
|
||
// Copyright 2018 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
package com.mapbox.mapboxgl; | ||
|
||
import com.mapbox.mapboxsdk.geometry.LatLng; | ||
|
||
import java.util.List; | ||
|
||
/** Receiver of Fill configuration options. */ | ||
interface FillOptionsSink { | ||
|
||
void setFillOpacity(float fillOpacity); | ||
|
||
void setFillColor(String fillColor); | ||
|
||
void setFillOutlineColor(String fillOutlineColor); | ||
|
||
void setFillPattern(String fillPattern); | ||
|
||
void setGeometry(List<List<LatLng>> geometry); | ||
|
||
void setDraggable(boolean draggable); | ||
} |
Oops, something went wrong.