-
Notifications
You must be signed in to change notification settings - Fork 509
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add line annotations #33
Merged
Changes from 4 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
ec854be
Add line Annotations
yoavrofe 9035e17
add line properties to examples
yoavrofe d7c70a2
Add onLineTapped
yoavrofe 47bfffd
Merge branch 'master' into yr-line
yoavrofe 0c22b6a
change forEach to for
yoavrofe 61ee5b4
Merge branch 'yr-line' of https://github.com/tobrun/flutter-mapbox-gl…
yoavrofe 1dc24af
Merge branch 'master' into yr-line
yoavrofe b0936a8
fix error in merge
yoavrofe f3c64f5
fix methods order
yoavrofe File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
78 changes: 78 additions & 0 deletions
78
android/src/main/java/com/mapbox/mapboxgl/LineBuilder.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,78 @@ | ||
// 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 java.util.List; | ||
import com.mapbox.geojson.Point; | ||
import com.mapbox.mapboxsdk.geometry.LatLng; | ||
import com.mapbox.mapboxsdk.plugins.annotation.Line; | ||
import com.mapbox.mapboxsdk.plugins.annotation.LineManager; | ||
import com.mapbox.mapboxsdk.plugins.annotation.LineOptions; | ||
|
||
class LineBuilder implements LineOptionsSink { | ||
private final LineManager lineManager; | ||
private final LineOptions lineOptions; | ||
|
||
LineBuilder(LineManager lineManager) { | ||
this.lineManager = lineManager; | ||
this.lineOptions = new LineOptions(); | ||
} | ||
|
||
Line build() { | ||
return lineManager.create(lineOptions); | ||
} | ||
|
||
@Override | ||
public void setLineJoin(String lineJoin) { | ||
lineOptions.withLineJoin(lineJoin); | ||
} | ||
|
||
@Override | ||
public void setLineOpacity(float lineOpacity) { | ||
lineOptions.withLineOpacity(lineOpacity); | ||
} | ||
|
||
@Override | ||
public void setLineColor(String lineColor) { | ||
lineOptions.withLineColor(lineColor); | ||
} | ||
|
||
@Override | ||
public void setLineWidth(float lineWidth) { | ||
lineOptions.withLineWidth(lineWidth); | ||
} | ||
|
||
@Override | ||
public void setLineGapWidth(float lineGapWidth) { | ||
lineOptions.withLineGapWidth(lineGapWidth); | ||
} | ||
|
||
@Override | ||
public void setLineOffset(float lineOffset) { | ||
lineOptions.withLineOffset(lineOffset); | ||
} | ||
|
||
@Override | ||
public void setLineBlur(float lineBlur) { | ||
lineOptions.withLineBlur(lineBlur); | ||
} | ||
|
||
@Override | ||
public void setLinePattern(String linePattern) { | ||
lineOptions.withLinePattern(linePattern); | ||
} | ||
|
||
@Override | ||
public void setGeometry(List<LatLng> geometry) { | ||
lineOptions.withLatLngs(geometry); | ||
} | ||
|
||
@Override | ||
public void setDraggable(boolean draggable) { | ||
lineOptions.setDraggable(draggable); | ||
} | ||
} |
98 changes: 98 additions & 0 deletions
98
android/src/main/java/com/mapbox/mapboxgl/LineController.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,98 @@ | ||
// 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 java.util.List; | ||
|
||
import android.graphics.PointF; | ||
import android.util.Log; | ||
|
||
import com.mapbox.geojson.Point; | ||
import com.mapbox.mapboxsdk.geometry.LatLng; | ||
import com.mapbox.mapboxsdk.plugins.annotation.Line; | ||
import com.mapbox.mapboxsdk.plugins.annotation.LineManager; | ||
import com.mapbox.mapboxsdk.utils.ColorUtils; | ||
|
||
/** | ||
* Controller of a single Line on the map. | ||
*/ | ||
class LineController implements LineOptionsSink { | ||
private final Line line; | ||
private final OnLineTappedListener onTappedListener; | ||
private boolean consumeTapEvents; | ||
|
||
LineController(Line line, boolean consumeTapEvents, OnLineTappedListener onTappedListener) { | ||
this.line = line; | ||
this.consumeTapEvents = consumeTapEvents; | ||
this.onTappedListener = onTappedListener; | ||
} | ||
|
||
boolean onTap() { | ||
if (onTappedListener != null) { | ||
onTappedListener.onLineTapped(line); | ||
} | ||
return consumeTapEvents; | ||
} | ||
|
||
void remove(LineManager lineManager) { | ||
lineManager.delete(line); | ||
} | ||
|
||
@Override | ||
public void setLineJoin(String lineJoin) { | ||
line.setLineJoin(lineJoin); | ||
} | ||
|
||
@Override | ||
public void setLineOpacity(float lineOpacity) { | ||
line.setLineOpacity(lineOpacity); | ||
} | ||
|
||
@Override | ||
public void setLineColor(String lineColor) { | ||
line.setLineColor(ColorUtils.rgbaToColor(lineColor)); | ||
} | ||
|
||
@Override | ||
public void setLineWidth(float lineWidth) { | ||
line.setLineWidth(lineWidth); | ||
} | ||
|
||
@Override | ||
public void setLineGapWidth(float lineGapWidth) { | ||
line.setLineGapWidth(lineGapWidth); | ||
} | ||
|
||
@Override | ||
public void setLineOffset(float lineOffset) { | ||
line.setLineOffset(lineOffset); | ||
} | ||
|
||
@Override | ||
public void setLineBlur(float lineBlur) { | ||
line.setLineBlur(lineBlur); | ||
} | ||
|
||
@Override | ||
public void setLinePattern(String linePattern) { | ||
line.setLinePattern(linePattern); | ||
} | ||
|
||
@Override | ||
public void setGeometry(List<LatLng> geometry) { | ||
line.setLatLngs(geometry); | ||
} | ||
|
||
@Override | ||
public void setDraggable(boolean draggable) { | ||
line.setDraggable(draggable); | ||
} | ||
|
||
public void update(LineManager lineManager) { | ||
lineManager.update(line); | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
android/src/main/java/com/mapbox/mapboxgl/LineOptionsSink.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,36 @@ | ||
// 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 java.util.List; | ||
import com.mapbox.mapboxsdk.geometry.LatLng; | ||
|
||
/** | ||
* Receiver of Line configuration options. | ||
*/ | ||
interface LineOptionsSink { | ||
|
||
void setLineJoin(String lineJoin); | ||
|
||
void setLineOpacity(float lineOpacity); | ||
|
||
void setLineColor(String lineColor); | ||
|
||
void setLineWidth(float lineWidth); | ||
|
||
void setLineGapWidth(float lineGapWidth); | ||
|
||
void setLineOffset(float lineOffset); | ||
|
||
void setLineBlur(float lineBlur); | ||
|
||
void setLinePattern(String linePattern); | ||
|
||
void setGeometry(List<LatLng> geometry); | ||
|
||
void setDraggable(boolean draggable); | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Call requires API level 24?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I changed it to a for loop.