-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* expand BitmapMarker api * StyleStringGenerator shouldnt be singleton & add ability to set MarkerOptions size * Rm unused code * Add support for drawable in marker options * bgcolor to color rename * update documentation
- Loading branch information
1 parent
0a40f84
commit 110c7ae
Showing
11 changed files
with
408 additions
and
36 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
22 changes: 22 additions & 0 deletions
22
core/src/main/java/com/mapzen/android/graphics/internal/EaseTypeConverter.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,22 @@ | ||
package com.mapzen.android.graphics.internal; | ||
|
||
import com.mapzen.android.graphics.model.EaseType; | ||
import com.mapzen.tangram.MapController; | ||
|
||
import java.util.HashMap; | ||
|
||
/** | ||
* Converts between SDK {@link EaseType} and internal {@link MapController.EaseType}. | ||
*/ | ||
public class EaseTypeConverter { | ||
|
||
public static final HashMap<EaseType, MapController.EaseType> | ||
EASE_TYPE_TO_MAP_CONTROLLER_EASE_TYPE = new HashMap(); | ||
|
||
static { | ||
EASE_TYPE_TO_MAP_CONTROLLER_EASE_TYPE.put(EaseType.LINEAR, MapController.EaseType.LINEAR); | ||
EASE_TYPE_TO_MAP_CONTROLLER_EASE_TYPE.put(EaseType.CUBIC, MapController.EaseType.CUBIC); | ||
EASE_TYPE_TO_MAP_CONTROLLER_EASE_TYPE.put(EaseType.QUINT, MapController.EaseType.QUINT); | ||
EASE_TYPE_TO_MAP_CONTROLLER_EASE_TYPE.put(EaseType.SINE, MapController.EaseType.SINE); | ||
} | ||
} |
59 changes: 59 additions & 0 deletions
59
core/src/main/java/com/mapzen/android/graphics/internal/StyleStringGenerator.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,59 @@ | ||
package com.mapzen.android.graphics.internal; | ||
|
||
/** | ||
* Handles updating properties used to generate a style string for a Tangram | ||
* {@link com.mapzen.tangram.Marker}. Used directly by | ||
* {@link com.mapzen.android.graphics.model.BitmapMarker}. | ||
*/ | ||
public class StyleStringGenerator { | ||
|
||
private int width = 50; | ||
private int height = 50; | ||
private boolean interactive = true; | ||
private String colorHex = "#FFFFFF"; | ||
|
||
/** | ||
* Set the width and height in pixels. | ||
* @param width | ||
* @param height | ||
*/ | ||
public void setSize(int width, int height) { | ||
this.width = width; | ||
this.height = height; | ||
} | ||
|
||
/** | ||
* Set whether or not the marker can be selected. | ||
* @param interactive | ||
*/ | ||
public void setInteractive(boolean interactive) { | ||
this.interactive = interactive; | ||
} | ||
|
||
/** | ||
* Sets the hex value for color to be used. | ||
* @param hex | ||
*/ | ||
public void setColor(String hex) { | ||
this.colorHex = hex; | ||
} | ||
|
||
/** | ||
* Return the style string given the current property configurations. | ||
* @return | ||
*/ | ||
public String getStyleString() { | ||
return new StringBuilder() | ||
.append("{ style: 'points', color: '") | ||
.append(colorHex) | ||
.append("', size: [") | ||
.append(width) | ||
.append("px, ") | ||
.append(height) | ||
.append("px], ") | ||
.append("collide: false, interactive: ") | ||
.append(interactive) | ||
.append(" }") | ||
.toString(); | ||
} | ||
} |
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
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
Oops, something went wrong.