|
|||||||||
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 String |
POSITION_BOTTOM_LEFT
Position of scabe bar within map control : bottom-left |
static String |
POSITION_BOTTOM_RIGHT
Position of scabe bar within map control : bottom-right |
static String |
POSITION_NONE
Position of scabe bar within map control : none |
static String |
POSITION_TOP_LEFT
Position of scabe bar within map control : top-left |
static String |
POSITION_TOP_RIGHT
Position of scabe bar within map control : top-right |
static String |
TYPE_ALTERNATING
Alternating ![]() |
static String |
TYPE_DOUBLE_ALTERNATING
Double Alternating ![]() |
static String |
TYPE_SINGLE_DIVISION
Single Division ![]() |
static 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. |
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. |
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. |
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 webContext)
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(String position)
Set the position of the scale bar on the map control. |
void |
setResourceId(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(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 webContext,
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 String TYPE_ALTERNATING
public static final String TYPE_DOUBLE_ALTERNATING
public static final String TYPE_SINGLE_DIVISION
public static final String TYPE_STEPPED_SCALE_LINE
public static final String POSITION_BOTTOM_LEFT
public static final String POSITION_BOTTOM_RIGHT
public static final String POSITION_TOP_RIGHT
public static final String POSITION_TOP_LEFT
public static final String POSITION_NONE
Constructor Detail |
---|
public WebScaleBar()
Method Detail |
---|
public void init(WebContext webContext)
WebContextInitialize.init(WebContext)
init
in interface WebContextInitialize
webContext
- WebContext
- the WebContextWebContext.init(WebContext)
,
WebContext.addResource(String, GISResource, int)
,
WebContext.removeResource(GISResource)
public void update(WebContext webContext, Object arg)
WebContextObserver.update(WebContext, Object)
update
in interface WebContextObserver
webContext
- 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 WebContextInitialize
WebContext.destroy()
public String getImageUrl()
ScaleBarFunctionality
, this method returns the URL to the
image generated by calling ScaleBarFunctionality.exportImage()
.
public void setScaleBarFunctionality(ScaleBarFunctionality scaleBarFunctionality)
ScaleBarFunctionality
that must be used to render the scalebar.
scaleBarFunctionality
- public ScaleBarFunctionality getScaleBarFunctionality()
public void setResourceId(String resourceId)
resourceId
- public int getWidth()
public void setWidth(int width)
width
- Width of scale bar in pixels.public int getHeight()
public void setHeight(int height)
height
- Height of scale bar in pixels.public String getPosition()
public void setPosition(String position)
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()
public double getScreenDistance()
public int getMaxPrecision()
public void setMaxPrecision(int maxPrecision)
maxPrecision
- public String getType()
public void setType(String type)
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()
public void setUnits(int units)
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 |