Styling Rules in Predefined Spatial Geometry Themes

MapViewer Concepts 2-11 however, for a join view there is no ROWID pseudocolumn, so you must specify a key column. For most types of predefined themes but not WMS themes, you can use the Map Builder tool to create and preview themes. For information about the Map Builder tool, see Chapter 9 .

2.3.1.1 Styling Rules in Predefined Spatial Geometry Themes

Each predefined theme is always associated with one or more styling rules, specifications in XML format that control aspects of how the theme is displayed. This section describes styling rules for predefined spatial geometry themes, such as the airport theme shown in Example 2–6 . Other types of themes, such as image, GeoRaster, network, and topology themes, have their own distinct styling rules requirements, and these are discussed in sections that explain these themes. However, the styling rules for all types of themes are grouped under the styling_rules element in an XML document, which is stored in the STYLING_RULES column for each predefined theme in the USER_SDO_THEMES view. The styling_rules DTD is described in Section A.7 . Example 2–6 XML Definition of Styling Rules for an Airport Theme ?xml version=1.0 standalone=yes? styling_rules rule features style=c.black gray runway_number gt; 1 features label column=name style=t.airport name 1 label rule rule features style=m.airplane runway_number = 1 features rule styling_rules Each styling rule has a required features element and an optional label element. The features element specifies which row or rows features in the table or view will be selected based on the user-defined predicate and on the style to be used for the selected features. You can specify any valid SQL predicate as the value of this element. The label element specifies whether or not to annotate the selected features, and if so, which column in the table or view to use for text labels. Note: The following naming conventions are used for prefixes in style names in the examples in this chapter: v. indicates variable advanced style, m. indicates marker, c. indicates color, l. indicates line, and t. indicates text. If the style is not under the current user’s schema, you must specify the owner’s schema name followed by a colon. For example: mdsys:c.red. In the content character data of an XML document, lt; and gt; must be used to represent and , respectively. Otherwise, or , such as in WHERE CATEGORY ’B’, will be interpreted by the XML parser as part of an XML tag. 2-12 Oracle Fusion Middleware Users Guide for Oracle MapViewer In Example 2–6 , there are two styling rules associated with the Airport theme: ■ The first rule specifies that only those rows that satisfy the condition runway_ number gt; 1 that is, runway number greater than 1 will be selected, and these will be rendered using the style named c.black gray. If no value is supplied, no WHERE clause condition is applied. For example, assume that the definition had been the following that is, omitting the runway_number gt; 1 condition: ?xml version=1.0 standalone=yes? styling_rules rule features style=c.black gray label column=name style=t.airport name 1 label rule styling_rules In this case, all airport features would be selected and would be rendered using the color style named c.black gray. The first rule also has a label element, which specifies that the NAME column in the table or view will be used to annotate each airport, using the text style t.airport name. The value of the label element, which can be any SQL expression that evaluates to a numeric value, is used to determine whether or not a feature will be annotated. If the numeric value is greater than zero, the feature will be annotated. In this case, because the value is the constant 1, all features specified by the features element will be annotated, using the values in the NAME column. If the value is less than or equal to zero for a feature, that feature will not be annotated. ■ The second rule, which applies to those airports with only one runway, does not have a label element, thus preventing all such airports from being annotated. In addition, the features that satisfy the second rule will be rendered using a different style m.airplane, as specified in its features element. You can think of each styling rule as a filter into the base table or view of the theme, because it selects only a subset of the rows and applies the rendering and labeling styles of that rule. In fact, MapViewer formulates a complete SQL query for each styling rule. This query string follows a fixed format, as described in Section 2.3.1.2 .

2.3.1.2 How MapViewer Formulates a SQL Query for a Styling Rule