|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.esri.adf.web.data.WebScaleBar
public class WebScaleBar
The WebScaleBar renders a scale bar within the map control.
To include a scale bar in the map, when declaring the map control in the map tag, a value binding to the scale bar object must be passed.
<a:map value="#{mapContext.webMap}" scaleBar="#{mapContext.attributes['scaleBar']}" ... />
The scale bar may be rendered in one of two ways :
1. Default, calculated in the WebADF.
2. Using ScaleBarFunctionality of the resource.
Default : (Computed in this web control)
<managed-bean>
<managed-bean-name>mapContext</managed-bean-name>
<managed-bean-class>com.esri.adf.web.data.WebContext</managed-bean-class>
...
<map-entry>
<key>scaleBar</key>
<value>#{scaleBar}</value>
</map-entry>
...
</managed-bean>
Declared bean (WEB-INF/context-attributes.xml)
<managed-bean> <managed-bean-name>scaleBar</managed-bean-name> <managed-bean-class>com.esri.adf.web.data.WebScaleBar</managed-bean-class> <managed-bean-scope>none</managed-bean-scope> </managed-bean>
Using functionality (example : Using AGSScaleBarFunctionality)
Declare bean (WEB-INF/functionalities/ags-functionalities.xml)
<managed-bean> <managed-bean-name>agsScaleBar</managed-bean-name> <managed-bean-class>com.esri.adf.web.ags.data.AGSScaleBarFunctionality</managed-bean-class> <managed-bean-scope>none</managed-bean-scope> </managed-bean>
Add agsScaleBar functionality to list of functionalities in the resource. (WEB-INF/faces-config.xml)
<managed-bean>
<managed-bean-name>agsResource</managed-bean-name>
<managed-bean-class>com.esri.adf.web.ags.data.AGSLocalMapResource</managed-bean-class>
...
<managed-property>
<property-name>functionalities</property-name>
<map-entries>
...
<map-entry>
<key>scaleBar</key>
<value>#{agsScaleBar}</value>
</map-entry>
...
</managed-bean>
Specify resource id to use scale bar functionality (WEB-INF/context-attribute.xml).
<managed-bean>
<managed-bean-name>scaleBar</managed-bean-name>
<managed-bean-class>com.esri.adf.web.data.WebScaleBar</managed-bean-class>
...
<managed-property>
<property-name>resourceId</property-name>
<value>agsResource</value>
</managed-property>
</managed-bean>
Note : When using default scale bar implementation, if no spatial reference information is found in the web context, no scale bar is rendered
| Field Summary | |
|---|---|
static java.lang.String |
POSITION_BOTTOM_LEFT
Position of scabe bar within map control : bottom-left |
static java.lang.String |
POSITION_BOTTOM_RIGHT
Position of scabe bar within map control : bottom-right |
static java.lang.String |
POSITION_NONE
Position of scabe bar within map control : none |
static java.lang.String |
POSITION_TOP_LEFT
Position of scabe bar within map control : top-left |
static java.lang.String |
POSITION_TOP_RIGHT
Position of scabe bar within map control : top-right |
static java.lang.String |
TYPE_ALTERNATING
Alternating ![]() |
static java.lang.String |
TYPE_DOUBLE_ALTERNATING
Double Alternating ![]() |
static java.lang.String |
TYPE_SINGLE_DIVISION
Single Division ![]() |
static java.lang.String |
TYPE_STEPPED_SCALE_LINE
Stepped Scale Line ![]() |
static int |
UNITS_FEET
Scale bar display units : Feet |
static int |
UNITS_KILOMETERS
Scale bar display units : Kilometers |
static int |
UNITS_METERS
Scale bar display units : Meters |
static int |
UNITS_MILES
Scale bar display units : Miles |
| Constructor Summary | |
|---|---|
WebScaleBar()
|
|
| Method Summary | |
|---|---|
void |
destroy()
Implements WebContext.destroy() |
int |
getHeight()
Get height of scale bar. |
java.lang.String |
getImageUrl()
If the scale bar uses a ScaleBarFunctionality, this method returns the url to the
image generated by calling ScaleBarFunctionality.exportImage(). |
double |
getMapDistance()
Get map distance represented by scale bar. |
int |
getMaxPrecision()
Get maximum precision set. |
java.lang.String |
getPosition()
Get position of scale bar on the map control. |
ScaleBarFunctionality |
getScaleBarFunctionality()
Return the scaleBarFunctionality used to draw the scale bar |
double |
getScreenDistance()
Get screen distance, in pixels to be drawn by scale bar. |
java.lang.String |
getType()
Get the type of scale bar. |
int |
getUnits()
Get the units to be shown in the scale bar. |
int |
getWidth()
Get width of scale bar. |
void |
init(WebContext context)
Implements WebContextInitialize.init(WebContext) |
boolean |
isScaleBarAvailable()
Returns true if this scale bar is available for use by the user. |
void |
setHeight(int height)
Set height of scale bar. |
void |
setMaxPrecision(int maxPrecision)
Set maximum precision. |
void |
setPosition(java.lang.String position)
Set the position of the scale bar on the map control. |
void |
setResourceId(java.lang.String resourceId)
Set resource id to be used to retrieve scaleBarFunctionality. |
void |
setScaleBarFunctionality(ScaleBarFunctionality scaleBarFunctionality)
Set the ScaleBarFunctionality that must be used to render the scalebar. |
void |
setType(java.lang.String type)
Set the type of scale bar to be rendered. |
void |
setUnits(int units)
Set the units of scale bar to be rendered. |
void |
setWidth(int width)
Set width of scale bar. |
void |
update(WebContext context,
java.lang.Object arg)
Implements WebContextObserver.update(WebContext, Object) |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int UNITS_METERS
public static final int UNITS_KILOMETERS
public static final int UNITS_FEET
public static final int UNITS_MILES
public static final java.lang.String TYPE_ALTERNATING
public static final java.lang.String TYPE_DOUBLE_ALTERNATING
public static final java.lang.String TYPE_SINGLE_DIVISION
public static final java.lang.String TYPE_STEPPED_SCALE_LINE
public static final java.lang.String POSITION_BOTTOM_LEFT
public static final java.lang.String POSITION_BOTTOM_RIGHT
public static final java.lang.String POSITION_TOP_RIGHT
public static final java.lang.String POSITION_TOP_LEFT
public static final java.lang.String POSITION_NONE
| Constructor Detail |
|---|
public WebScaleBar()
| Method Detail |
|---|
public void init(WebContext context)
WebContextInitialize.init(WebContext)
init in interface WebContextInitializecontext - WebContext- the WebContextWebContext.init(WebContext),
WebContext.addResource(String, GISResource, int),
WebContext.removeResource(GISResource)
public void update(WebContext context,
java.lang.Object arg)
WebContextObserver.update(WebContext, Object)
update in interface WebContextObservercontext - the WebContext that has been refreshedarg - the argument passed to the WebContext's refresh(arg) methodWebContext.refresh(Object),
WebContext.addObserver(WebContextObserver),
WebContext.removeObserver(WebContextObserver)public void destroy()
WebContext.destroy()
destroy in interface WebContextInitializeWebContext.destroy()public java.lang.String getImageUrl()
If the scale bar uses a ScaleBarFunctionality, this method returns the url to the
image generated by calling ScaleBarFunctionality.exportImage().
public void setScaleBarFunctionality(ScaleBarFunctionality scaleBarFunctionality)
Set the ScaleBarFunctionality that must be used to render the scalebar.
scaleBarFunctionality - public ScaleBarFunctionality getScaleBarFunctionality()
Return the scaleBarFunctionality used to draw the scale bar
public void setResourceId(java.lang.String resourceId)
resourceId - public int getWidth()
public void setWidth(int width)
width - Width of scale bar in pixels.public int getHeight()
Get height of scale bar.
public void setHeight(int height)
Set height of scale bar. If using functionality, this property is ignored. Default 40.
height - Height of scale bar in pixels.
public java.lang.String getPosition()
Get position of scale bar on the map control.
public void setPosition(java.lang.String position)
Set the position of the scale bar on the map control. Default POSITION_BOTTOM_LEFT.
position - Position of scale bar on map control. Possible values POSITION_BOTTOM_LEFT, POSITION_BOTTOM_RIGHT,
POSITION_TOP_RIGHT, POSITION_TOP_LEFT, POSITION_NONE. If position is POSITION_NONE, style declared in
esri_styles.css is applied.
public double getMapDistance()
Get map distance represented by scale bar. If using functionality, this property is null.
public double getScreenDistance()
Get screen distance, in pixels to be drawn by scale bar. If using functionality, this property is null.
public int getMaxPrecision()
Get maximum precision set.
public void setMaxPrecision(int maxPrecision)
Set maximum precision. Max precision specifies the maximum that the decimal can be moved to the right to calculate map distance. If using functionality, this property is ignored. Default 10.
maxPrecision - public java.lang.String getType()
Get the type of scale bar.
public void setType(java.lang.String type)
Set the type of scale bar to be rendered. If using functionality, this property is ignored.
type - Type of scale bar. Possible values, TYPE_ALTERNATING, TYPE_DOUBLE_ALTERNATING, TYPE_SINGLE_DIVISION,
TYPE_STEPPED_SCALE_LINE. Default TYPE_ALTERNATING.
public int getUnits()
Get the units to be shown in the scale bar.
public void setUnits(int units)
Set the units of scale bar to be rendered. If using functionality, this property is ignored.
units - Type of scale bar. Possible values, UNITS_METERS, UNITS_KILOMETERS, UNITS_FEET, UNITS_MILES. Default
UNITS_METERS.
public boolean isScaleBarAvailable()
Returns true if this scale bar is available for use by the user.
The scale bar is available if it is associated with a ScaleBarFunctionality or if the WebContext
has a spatial reference associated with it.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||