public class CustomGrid extends AbstractLayer implements Capturable
Modifier and Type | Class and Description |
---|---|
static interface |
CustomGrid.OnChangedListener |
Modifier and Type | Field and Description |
---|---|
static int |
CEIL |
static java.lang.String |
COLOR_PREF |
static int |
FLOOR |
static java.lang.String |
LABELS_PREF |
static int |
ROUND |
static java.lang.String |
SPACING_PREF |
static java.lang.String |
UNITS_PREF |
Constructor and Description |
---|
CustomGrid(MapView mapView,
java.lang.String uid)
Construct a custom grid overlay.
|
Modifier and Type | Method and Description |
---|---|
void |
addOnChangedListener(CustomGrid.OnChangedListener ocl) |
void |
clear()
Unset the coordinates for the layer.
|
void |
drawCanvas(CapturePP cap,
android.os.Bundle data)
Draw the item to the canvas
|
void |
drawFittedGrid(ImageryCapturePP cap)
Draw fitted grid to canvas
|
static double |
gcf(double val1,
double val2) |
GeoBounds |
getBounds() |
GeoPoint |
getCenter() |
Marker |
getCenterMarker() |
int |
getColor()
Returns the color used for the grid lines.
|
GeoPoint[] |
getCorners() |
int |
getHorizontalLineCount() |
int |
getLabelPrecision()
Get the appropriate label value precision based on spacing
|
java.lang.String[] |
getLabels(boolean trunc)
Get the list of grid labels (horizontal first then vertical)
|
int |
getNumColumns() |
int |
getNumRows() |
double |
getSpacing()
Return grid spacing
|
float |
getStrokeWeight() |
int |
getVerticalLineCount() |
boolean |
isDrawingLabels(double lat,
double mapRes)
Test whether this grid is drawing it's labels
This is different than showLabels since it also depends on
the map zoom level
|
boolean |
isValid()
Return true if the coordinates for the layer are valid.
|
boolean |
isVisible() |
void |
onChanged(boolean recalcGrid) |
boolean |
place(GeoPoint c) |
boolean |
place(GeoPoint c,
int cols,
int rows)
Define grid extends based on center and size
|
android.os.Bundle |
preDrawCanvas(CapturePP cap)
Save forwarded points to meta data holder
These will be used later in drawCanvas
|
void |
removeOnChangedListener(CustomGrid.OnChangedListener ocl) |
static double |
round(double val,
double nearest,
int roundType) |
void |
setColor(int color)
Sets the color of the grid lines used for the Custom grid
|
void |
setCorners(GeoPointMetaData corner1,
GeoPointMetaData corner2)
Sets the four corners of the customized grid.
|
void |
setLabelPrecision(int precision)
Set the label precision manually
|
void |
setShowLabels(boolean show) |
void |
setSpacing(double meters) |
void |
setStrokeWeight(float strokeWeight)
Sets the stroke weight of the custom Grid
|
void |
setVisible(boolean visible) |
boolean |
showLabels() |
public static final java.lang.String SPACING_PREF
public static final java.lang.String COLOR_PREF
public static final java.lang.String UNITS_PREF
public static final java.lang.String LABELS_PREF
public static final int FLOOR
public static final int ROUND
public static final int CEIL
public CustomGrid(MapView mapView, java.lang.String uid)
mapView
- the mapviewuid
- the uidpublic void setCorners(GeoPointMetaData corner1, GeoPointMetaData corner2)
corner1
- upper leftcorner2
- lower rightpublic void clear()
public boolean isValid()
public void setVisible(boolean visible)
public boolean isVisible()
public void setColor(int color)
color
- the color as an integer value where the alpha is ignored.public int getColor()
public void setStrokeWeight(float strokeWeight)
strokeWeight
- the weightpublic float getStrokeWeight()
public void setShowLabels(boolean show)
public boolean showLabels()
public void setSpacing(double meters)
public double getSpacing()
public int getVerticalLineCount()
public int getHorizontalLineCount()
public int getNumColumns()
public int getNumRows()
public GeoBounds getBounds()
public GeoPoint[] getCorners()
public GeoPoint getCenter()
public Marker getCenterMarker()
public boolean place(GeoPoint c, int cols, int rows)
c
- Grid centercols
- Number of grid columnsrows
- Number of grid rowspublic boolean place(GeoPoint c)
public boolean isDrawingLabels(double lat, double mapRes)
lat
- Draw latitudemapRes
- Map resolutionpublic int getLabelPrecision()
public void setLabelPrecision(int precision)
precision
- Precision from 0 to 5 (0 means use automatic)public java.lang.String[] getLabels(boolean trunc)
trunc
- Truncate according to the default precisionpublic android.os.Bundle preDrawCanvas(CapturePP cap)
Capturable
preDrawCanvas
in interface Capturable
cap
- Capture instance (use forward() to convert)public void drawCanvas(CapturePP cap, android.os.Bundle data)
Capturable
drawCanvas
in interface Capturable
cap
- Canvas to draw to (use getCanvas())data
- Point data saved in preDrawCanvaspublic void drawFittedGrid(ImageryCapturePP cap)
cap
- Capture post-processorpublic static double round(double val, double nearest, int roundType)
public static double gcf(double val1, double val2)
public void onChanged(boolean recalcGrid)
public void addOnChangedListener(CustomGrid.OnChangedListener ocl)
public void removeOnChangedListener(CustomGrid.OnChangedListener ocl)