Scaling the Size of a Style Scalable Styles

MapViewer Concepts 2-3 All styles for a database user are stored in that user’s USER_SDO_STYLES view, which is described in Section 2.9 and Section 2.9.3 . You can also create dynamically defined styles that is, temporary styles of any style type as part of a map request. The way to create them depends on which API you are using: ■ With the native XML API, define the style using its XML elements within the map_request element. ■ With the JavaBean API, add a dynamically defined style to a map request, as explained in Section 4.3.4 . ■ With the Oracle Maps JavaScript API, use classes and methods to create all types of styles dynamically. In each case, what you are actually creating is the XML definition of the styles; it is the MapViewer server that actually creates such dynamically defined styles from the definitions when it processes the map request, and it discards the dynamically created styles when the request is completed. For more detailed information about the types of styles, including information about the XML format for defining each type, see Appendix A .

2.2.1 Scaling the Size of a Style Scalable Styles

If you specify a unit other than the default of pixels px in a style definition, the style becomes scalable: that is, the size of features associated with the style is scaled as users zoom in or out on a map. For example, if you specify a marker style’s width and height as 100m, the marker is displayed as a square 100 meters on each side according to the map scale at the current zoom level. The following are style types and the attributes that can have an associated size unit: ■ Marker styles: marker size height and width and text attributes font size, label offsets ■ Line styles: overall line width, center line width and dash pattern, wing line width and dash pattern, hash mark, and marker pattern size, offset, interval ■ Text styles: font size, halo width ■ Bar chart styles: bar width and height ■ Dot density styles: dot width and height ■ Pie chart styles: pit radius Example 2–1 defines a star-shaped marker within a bounding box 15 kilometers 15.0km on each size. This definition might be useful for identifying capital cities of Table 2–1 Style Types and Applicable Geometry Types Style Type Applicable Geometry Types Color any type Marker point, line Line line Area polygon Text any type Advanced any type 2-4 Oracle Fusion Middleware Users Guide for Oracle MapViewer states on a map showing all or a large part of a country; however, it would not be useful for a display zoomed in on a specific city and its local surrounding area. Example 2–1 Scalable Marker Style style name=M.STAR_CAPITAL_CITY svg width=1in height=1in desc g class=marker style=stroke:000000;fill:FF0000;fill-opacity:0;width:15.0km;height:15.0km;font- family:Dialog;font-size:12;font-fill:FF0000 polyline points=138.0,123.0,161.0,198.0,100.0,152.0,38.0,198.0,61.0,123.0,0.0,76.0,76.0,76 .0,100.0,0.0,123.0,76.0,199.0,76.0 g svg style Example 2–2 defines a line style with an overall line width of 10 meters 10.0m and a border line width of 1 meter 1.0m. This definition might be useful for identifying capital cities of primary highways. Example 2–2 Scalable Line Style style name=L.PRIMARY_HIGHWAY svg width=1in height=1in descdesc g class=line cased=true style=fill:33a9ff;stroke-width:10.0m line class=parallel style=fill:aa55cc;stroke-width:1.0m g svg style When MapViewer renders or labels styles that have size units other than pixel, it first transforms the size units into screen pixels based on the current map area and display area, and it then renders the or labels the style. The size of a scalable style changes as users zoom in or out on a map. If zooming out results in an overall style size less than or equal to zero, the style is not rendered or labeled. Size units can be used only with data associated with a known spatial reference system SRS. If the data has no SRS or an unknown SRS, pixels are used for all size values. Note also that pixel values are used instead of any specified size unit in legends and in previews rendered by the Map Builder utility. Legends are explained in Section 2.4.2 . Scalable styles work with MapViewer Release 11g 11.1.1 or later; they cannot be used with earlier releases of MapViewer.

2.2.2 Specifying a Label Style for a Bucket