52
|
Chapter 4
Configuring and Using the Sample Applications
code processes a capabilities document and the result is used by the JSP code
to create JavaScript data structures dynamically in the resulting HTML page.
These data structures are used to populate the WMS Viewer page’s SRS list,
layer list, image-format list, and other elements. The HTML and JavaScript
code is available via your browser’s View Source command.
Adding a contact-information retrieval feature
This example adds to the WMS Viewer page a small icon that, when clicked,
retrieves contact information and displays it in a pop-up HTML page. The
script retrieves contact information from the capabilities document.
To add a contact-information retrieval feature to WMS Viewer
1
Place an image file (
contact.jpg,
in this example) for the Contact icon in
WMS Viewer’s
images
subfolder.
2
Add an image link for
contact.jpg
to the JSP page
WmsViewer.jsp,
so that the
Contact icon appears to the right of the History icon. The new code is
shown here relative to the
history.jpg
image:
<img src="../images/history.jpg" align="absbottom"></a>
<img src="../images/contact.jpg" align="absbottom">
The Contact icon (here, a cell-phone image) will appear next to the His-
tory icon, as shown here:
3
To make the Contact icon clickable, add a handler for the
showContact-
Info()
function:
<a href="javascript:showContactInfo()">
<img src="../images/contact.jpg" align="absbottom">
</a>
4
In the declarations section, declare a variable that will reference the Con-
tact window:
var contactWindow
5
In the declarations section, declare variables to hold the contact informa-
tion, and initialize them with values parsed from the capabilities docu-
ment. The JSP code (between the
<%=
and
%>
symbols) initializes the val-
ues and generates the necessary JavaScript code.
//contact information
var contactName = '<%= svi != null?
svi.getContactName(): "" %>'
Содержание 15606-011408-9330 - MAPGUIDE R6.3 SITE LIC-UPG R6
Страница 1: ...April 2004 Autodesk MapGuide LiteView Developer s Guide ...
Страница 12: ...8 Chapter 1 Introduction ...
Страница 38: ...34 Chapter 2 Understanding Requests ...
Страница 90: ...86 Chapter 4 Configuring and Using the Sample Applications ...