A.7 Themes: Styling Rules

A theme definition contains one <styling_rules> element, which may have several other elements depending on the theme type.

This <styling_rules> element is specified in the STYLING_RULES column of the USER_SDO_THEMES metadata view, using the following DTD:

<!ELEMENT styling_rules (rule+, hidden_info?, join_table?, join_columns?, operations?, bitmap_masks?, parameters?)>
<!ATTLIST styling_rules theme_type         CDATA #IMPLIED
                        key_column         CDATA #IMPLIED
                        caching            CDATA #IMPLIED "NORMAL"
                        image_format       CDATA #IMPLIED
                        image_column       CDATA #IMPLIED
                        image_resolution   CDATA #IMPLIED
                        image_unit         CDATA #IMPLIED
                        raster_id          CDATA #IMPLIED
                        raster_table       CDATA #IMPLIED
                        raster_pyramid     CDATA #IMPLIED
                        raster_bands       CDATA #IMPLIED
                        polygon_mask       CDATA #IMPLIED
                        transparent_nodata CDATA #IMPLIED
                        network_name       CDATA #IMPLIED
                        network_level      CDATA #IMPLIED
                        topology_name      CDATA #IMPLIED
                        service_url        CDATA #IMPLIED
                        srs                CDATA #IMPLIED
                        feature_ids        CDATA #IMPLIED
                        provider_id        CDATA #IMPLIED
                        srid               CDATA #IMPLIED>

<!ELEMENT rule (features, label?, rendering?)>
<!ATTLIST rule column CDATA #IMPLIED>
 
<!ELEMENT features (#PCDATA?, link?, node?, path?)>
<!ATTLIST features style CDATA #REQUIRED>
 
<!ELEMENT label (#PCDATA?, link?, node?, path?)>
<!ATTLIST label column CDATA #REQUIRED
                style  CDATA #REQUIRED>
 
<!ELEMENT link (#PCDATA)>
<!ATTLIST link style                CDATA #REQUIRED
               direction_style      CDATA #IMPLIED
               direction_position   CDATA #IMPLIED
               direction_markersize CDATA #IMPLIED
               column               CDATA #REQUIRED>
 
<!ELEMENT node (#PCDATA)>
<!ATTLIST node style      CDATA #REQUIRED
               markersize CDATA #IMPLIED
               column     CDATA #REQUIRED>
 
<!ELEMENT path (#PCDATA)>
<!ATTLIST path ids    CDATA #REQUIRED
               styles CDATA #REQUIRED
               style  CDATA #REQUIRED
               column CDATA #REQUIRED>

<!ELEMENT hidden_info (field+)>
 
<!ELEMENT field (#PCDATA)> 
<!ATTLIST field column CDATA #REQUIRED
                name   CDATA #IMPLIED>

<!ELEMENT join_table EMPTY> 
<!ATTLIST join_table name          CDATA #REQUIRED 
                     start_measure CDATA #IMPLIED
                     end_measure   CDATA #IMPLIED
                     measure       CDATA #IMPLIED>

<!ELEMENT join_columns EMPTY> 
<!ATTLIST columns lrs_table_column  CDATA #REQUIRED 
                  join_table_column CDATA #REQUIRED>

<!ELEMENT rendering (style+)>
 
<!ELEMENT style (substyle?)>
<!ATTLIST style name          CDATA #REQUIRED
                value_columns CDATA #IMPLIED>
 
<!ELEMENT substyle (#PCDATA)>
<!ATTLIST substyle name          CDATA #REQUIRED
                   value_columns CDATA #REQUIRED
                   changes       CDATA #IMPLIED>
 
<!ELEMENT operations (operation?)>
 
<!ELEMENT operation (parameter?)>
<!ATTLIST operation name CDATA #REQUIRED>
 
<!ELEMENT parameters (parameter?)>
 
<!ELEMENT parameter (#PCDATA)>
<!ATTLIST parameter name  CDATA #REQUIRED
                    value DATA #REQUIRED>
 
<!ELEMENT bitmap_masks (mask+)>
 
<!ELEMENT mask (#PCDATA)>
<!ATTLIST mask raster_id    CDATA #REQUIRED
               raster_table CDATA #REQUIRED
               layers       CDATA #REQUIRED
               zeromapping  CDATA #IMPLIED
               onemapping   CDATA #IMPLIED>

The <styling_rules> element can have a theme_type attribute, which is used mainly for certain types of predefined themes. (The default theme_type attribute value is geometry, which indicates that the theme is based on spatial geometries.) The theme_type attribute values for these special types of predefined themes are as follows:

  • annotation specifies an annotation text theme. Annotation text themes are explained in Annotation Text Themes.

  • geom_custom specifies a custom geometry theme. You must also specify the provider_id and srid attributes. Custom geometry themes are explained in Custom Geometry Themes.

  • georaster specifies a GeoRaster theme. To use specified GeoRaster data (but not if you use a query condition to retrieve the GeoRaster data), you must also specify the raster_id and raster_table attributes. You can also specify the raster_pyramid, raster_bands, polygon_mask, and transparent_nodata attributes. GeoRaster themes are explained in GeoRaster Themes.

  • image specifies an image theme. You must also specify the image_format and image_column attributes, and you can specify the image_resolution and image_unit attributes. Image themes are explained in Image Themes.

  • network specifies a network theme. You must also specify the network_name attribute. You can specify the network_level attribute, but the default value (1) is the only value currently supported. Network themes are explained in Network Themes.

  • topology specifies a topology theme. You must also specify the topology_name attribute. Topology themes are explained in Topology Themes.

  • wfs specifies a WFS theme. You must also specify the service_url and srs attributes. WFS themes are explained in WFS Themes.

The <styling_rules> element can have a key_column attribute. This attribute is needed only if the theme is defined on a join view (a view created from multiple tables). In such a case, you must specify a column in the view that will serve as the key column to uniquely identify the geometries or images in that view. Without this key column information, the map visualization component will not be able to cache geometries or images in a join view.

The <styling_rules> element can have a caching attribute, which specifies the caching scheme for each predefined theme. The caching attribute can have one of the following values: NORMAL (the default), NONE, or ALL.

  • NORMAL causes the map visualization component to try to cache the geometry data that was just viewed, to avoid repeating the costly unpickling process when it needs to reuse the geometries. Geometries are always fetched from the database, but they are not used if unpickled versions are already in the cache.

  • NONE means that no geometries from this theme will be cached. This value is useful when you are frequently editing the data for a theme and you need to display the data as you make edits.

  • ALL causes the map visualization component to pin all geometry data of this theme entirely in the cache before any viewing request. In contrast to the default value of NORMAL, a value of ALL caches all geometries from the base table the first time the theme is viewed, and the geometries are not subsequently fetched from the database.

For detailed information about the caching of predefined themes, see Caching of Predefined Themes.

Each <rule> element must have a <features> element and can have a <label> element and a <rendering> element. The <rendering> element can be used to define multiple render styles, and in this case the render style in the <features> element may be undefined. If the render style in the <features> element is defined and <rendering> element is also defined, the map visualization component will first render the style in the <features> element and then render the styles in <rendering> element. (The <rendering> element is explained later in this section.)

The optional column attribute of a <rule> element specifies one or more attribute columns (in a comma-delimited list) from the base table to be put in the SELECT list of the query generated by the map visualization component. The values from such columns are usually processed by an advanced style for this theme. The following example shows the use of the column attribute:

<?xml version="1.0" standalone="yes"?>
<styling_rules >
  <rule column="TOTPOP">
    <features style="V.COUNTY_POP_DENSITY">  </features>
  </rule>
</styling_rules>

In the preceding example, the theme's geometry features will be rendered using an advanced style named V.COUNTY_POP_DENSITY. This style will determine the color for filling a county geometry by looking up numeric values in the column named TOTPOP in the base table for this theme.

Each <features> element for a network theme must have a <link>, <node>, or <path> element, or some combination of them. (The <link>, <node>, and <path> elements apply only to network themes, which are explained in Network Themes.) The following example shows the styling rules for a network theme to render links and nodes.

<?xml version="1.0" standalone="yes"?>
<styling_rules theme_type="network"
           network_name="LRS_TEST" network_level="1">
 <rule>
   <features>
     <link style="C.RED"
           direction_style="M.IMAGE105_BW"
           direction_position="0.85"
           direction_markersize="8"></link>
     <node style="M.CIRCLE" markersize="5"></node>
   </features>
 </rule>
</styling_rules>

A <label> element must have a SQL expression as its element value for determining whether or not a label will be applied to a feature. The column attribute specifies a SQL expression for text values to label features, and the style attribute specifies a text style for rendering labels.

The <rendering> element can be used to define multiple rendering styles. The styles are rendered in the order that they appear. Each style in a <rendering> element is defined by a <style> element, which must specify the name attribute and can specify the value_columns attribute. (The value_columns attribute is used with advanced styles, and the column names are added to the list of attributes defined in the column attribute of <rule> element.)

In the <rendering> element, each <style> element can have a <substyle> element that defines the attributes for filling the feature. A <substyle> element must specify the name attribute and can specify the value_columns and changes attributes. For the changes attribute, only the FILL_COLOR value is supported.

The following example shows the styling rules for a geometry theme using the <rendering> element. It defines an advanced style named V.POIVMK to render the feature shape and an advanced substyle named V.POIBKT to fill the feature shape.

<?xml version="1.0" standalone="yes"?>
<styling_rules>
  <rule>
    <features> </features>
    <label column="NAME" style="T.STREET2"> 1 </label>
    <rendering>
      <style name="V.POIVMK" value_columns="FEATURE_CODE">
        <substyle name="V.POIVBKT" value_columns="POINT_ID" changes="FILL_COLOR"/>
      </style>
    </rendering>
  </rule>
</styling_rules>

For more information about using the <rendering> element to apply multiple rendering styles in a single styling rule, see Applying Multiple Rendering Styles in a Single Styling Rule.

The <hidden_info> element specifies the list of attributes from the base table to be displayed when the user moves the mouse over the theme's features. The attributes are specified by a list of <field> elements.

Each <field> element must have a column attribute, which specifies the name of the column from the base table, and it can have a name attribute, which specifies the display name of the column. (The name attribute is useful if you want a text string other than the column name to be displayed.)

The <join_table> element specifies the table name and its one or two columns for the measurements. It may contain one measure column for features of point type or two measure columns for features of line string type. The measure column or columns are used for the linear referencing process when joining with a LRS table, which has an LRS geometry column.

The <join_columns> element specifies one column of the LRS table (which has a LRS geometry column), and one column from the join table (which has one or two measure columns). These two columns are used to join the LRS table and the join table.

The <operations> element specifies the list of image processing operations to be applied on a GeoRaster theme. The operations are specified by a list of <operation> elements.

The <operation> element specifies the image processing operator and its parameters to be applied on a GeoRaster theme. Each <operation> element may have a list of <parameters> elements.

The <parameters> element defines a list of parameters to be used on a specific task. The parameters are specified by a list of <parameter> elements.

The <parameter> element must have the name and value attributes defined.

The <bitmap_masks> element defines the image mask attributes to be used with a GeoRaster theme. The bitmap masks are specified by a list of <mask> elements.

The <mask> element specifies a bitmap mask to be applied on a GeoRaster object. The raster_id, raster_table, and layers attributes must be defined, while the zeromapping and onemapping attributes are optional.

See Styling Rules in Predefined Spatial Geometry Themes for more information about styling rules and for an example.