Sending a Request to the MapViewer Service

4-12 Oracle Fusion Middleware Users Guide for Oracle MapViewer than the MapViewer fast unpickling process, but there is never any loss of precision. ■ setThemeOnClickInSVG java.lang.String theme, java.lang.String onClickFunction sets the theme’s onClick function for an SVG map. The onClick function is a JavaScript function defined in the Web page in which the SVG map is embedded. The onClick function is called whenever the SVG map is clicked if both theme feature selection and window selection are disabled. For information about using JavaScript functions with SVG maps, see Appendix B . ■ setThemeScalejava.lang.String name, double minScale, double maxScale sets the minimum and maximum scale values for displaying a theme. ■ setThemeSelectableInSVG java.lang.String theme, boolean sel sets the theme to be selectable TRUE or not selectable FALSE in an SVG map. If the theme is set to selectable, any feature of the theme can be selected in the SVG map by clicking on it. If the feature is selected, its color is changed and its ID its rowid by default is recorded. You can get a list of the ID values of all selected features by calling the JavaScript function getSelectedIdList defined in the SVG map. For information about using JavaScript functions with SVG maps, see Appendix B . ■ setThemeUnitAndResolutionjava.lang.String themeName, java.lang.String unit, double resolution sets the unit and resolution values for an image theme. ■ setThemeVisiblejava.lang.String name, boolean vis sets the theme to be visible TRUE or hidden FALSE in an SVG map. If the theme is set to be hidden, the theme will be still rendered, but will be invisible.

4.3.6 Sending a Request to the MapViewer Service

As an application developer, you typically issue a new map request as a result of certain user input such as a mouse click on the currently displayed map or after you have modified some aspect of the map request such as setting a new background color. In fact, you can issue a map request any time you want, as long as you do not overwhelm the middle-tier MapViewer service with too many rapid requests from the MapViewer bean or beans. The MapViewer service tries to process requests in the order in which they arrive; if you send a second request before receiving the response from the first one, MapViewer continues to process the first request completely before starting to process the second request. Any modifications to the current map request, such as changing to a new background color or moving a theme down in the rendering sequence, do not take effect in the map display until you send the map request, at which time the MapViewer service actually receives the request and processes it. The methods for sending a map request to the MapViewer service include the following: ■ run sends the current map request to the MapViewer service, and obtains a map response as sent back by the MapViewer service. ■ panint x, int y pans to the specified device point. Each coordinate is in the screen or display unit, in this case, pixel. ■ zoomIndouble factor zooms in on the map without changing the other map request parameters. MapViewer JavaBean-Based API 4-13 ■ zoomInint x, int y, double factor zooms in on the specified device point. ■ zoomInint x1, int y1, int x2, int y2 zooms in on the specified device rectangle. ■ zoomOutdouble factor zooms out on the current map without changing the other map request parameters. ■ zoomOutint x, int y, double factor zooms out and recenters the current map. Each of these methods assembles a single XML map request document based on all properties of the current map request, and then sends it to the MapViewer service. After the MapViewer bean receives the response from the MapViewer service, the bean does any necessary postprocessing and makes the response ready for your use. As an alternative to using these methods, you can formulate an XML request string outside the bean, and then use the sendXMLRequestjava.lang.String req method to send the request to the MapViewer service. However, if you use this method, you are responsible for receiving and unpacking the response using the getXMLResponse method, and for parsing and interpreting the response string yourself. The state of the bean remains unchanged, because the methods are only making use of the bean’s capability to open an HTTP connection to send and receive documents over the connection. All methods described in this section throw an exception if any unrecoverable error occurs during the transmission of the request or response, or in the MapViewer service during processing. You are responsible for taking care of such exceptions in any way you consider appropriate, such as by trying the request again or by reporting the problem directly to the user.

4.3.7 Extracting Information from the Current Map Response