Style: Overrides

 

Style: Overrides

Style properties shown in the Style panel normally apply to all items in the active layer.  Style overrides allow individual objects or labels to ignore the overall Style properties for the layer and instead to use their own, individual styles.   This topic is intended to be read together with the Example: Style Overrides topic.

 

 

By default, style overrides are not allowed and the system ignores any style specifications found in a record.  When we check the option box to use style overrides, if a record contains a style specification the system will use that specification, overriding whatever has been set by the Style panel for the layer.  Only those style properties changed by the override will be changed.   All other style properties will continue to be applied as specified by the Style panel.

 

When style overrides are in use they allow us to individually specify style properties for specific objects or labels.

 

To use style overrides:

 

  1. Open the drawing or labels component or click on its tab in an open map window.

  2. Open the Style panel in the Contents pane.

  3. Click on the Options tab and check the Use style overrides box.

  4. Choose the text field to be used or allow the system to create a new field, named 'Style' by default.

  5. Press the Create button when creating a new field, or Apply when using an existing text field.

 

 

To specify a style override for an object or label:

 

  1. Open the drawing or labels component or click on its tab in an open map window.

  2. Alt-click onto the object or label desired.

  3. In the Record panel's Style tab, choose the desired style properties.

  4. Press Update Record.

 

 

To remove a style override from an object or label:

 

  1. Open the drawing or labels component or click on its tab in an open map window.

  2. Alt-click onto the object or label desired.

  3. In the Record panel's Style tab, click the desired style property and choose Default.

  4. Press Update Record.

 

 

To find all records/objects/labels with style overrides:

 

  1. Open the drawing's table for the drawing or labels component desired.

  2. In the Select panel choose the Style field and the Is not NULL template.

  3. Press Replace Selection.   

 

All records for which the Style field is not <NULL> will be selected, and their corresponding drawing objects or labels will also be selected.  

 

Style Overrides are just Fields in Tables

A style override is nothing more than a string of human-readable text in a record.    The text specifies style properties using JSON style.   If the Use style override box is checked in the main Style panel, Option tab for the layer, Manifold will look at the specified text field for each record to see if is empty or if it contains a style override.  If it is not empty, Manifold uses whatever style properties it finds in the string for that record.  

 

il_style_override_table.png

 

The table above has a text field called Style that contains NULLs for all records except one record, which has a style override in that field.  The Style field for the Centre-Val de Loire record specifies use of a green color for the fill color for areas.    That one record has a style override while all the other records have NULLs.

 

il_style_override_map.png

 

Manifold draws objects for that layer using whatever style properties are specified by the Style panel.   If we turn on style overrides,  the override for the Centre-Val de Loire record will be used for that object in preference to what the Style panel says.   No matter what the Style panel specifies, the Centre-Val de Loire object will have green fill color within the area.  The override for Centre-Val de Loire  does not mention any other style properties, so all other style properties like the color of the area border will continue as specified by the Style panel.  

 

When we specify a style override for an object or label by clicking style buttons and choosing a color or other property, Manifold writes the appropriate JSON test for us into the table for that object.  We do not need to learn how to write style overrides in JSON.  However, if we do understand JSON we can use queries and scripts to automate the creation of style overrides.   Even if we do not understand how to write a style override in JSON from scratch, we can create an override and then copy and paste that style override from the record in which it was created to other records.  Using the Select and Transform panels we can copy it into thousands of records at once with a few mouse clicks.

 

See the Example: Style Overrides topic for a detailed, step-by-step example of using style overrides.

 

Notes

Is the field named 'Style' special?   - Yes and no.  The Use style overrides facility will look for a text field called Style in the drawing's table and, if a field named Style exists, that field will be used by default to store any style overrides.  We can choose a different text field if we like.   If a field named Style does not exist, the (new field) choice will create an nvarchar text field called Style.   If we already have a field called Style and we choose (new field), that will create a field called Style 2 and so on.   But there is nothing special about the name 'Style' other than it is short, easy to remember, and more self-documenting than using the name 'Ringo' or 'Beatrice' for a field that will store style override text.

 

Why nvarchar?  Can it be a varchar?  - Yes, if you prefer.  Manifold uses nvarchar text type by default because supporting Unicode is good karma in an application that is used in many different countries.

 

More than one style overrides field. - We can have more than one text field in the table that is used for style overrides.  Whichever field has been chosen in the field box by the Use style overrides check box is the field that will be used.

 

Are style overrides a replacement for thematic formatting?   - No.  Style overrides generally are intended for special case needs, to be applied in an ad hoc manner.   For example, suppose we have thematically formatted a map for cartographic reasons but when it comes time to print there is one area that just does not look right, for which a slightly lighter color would look better.   If we are in a hurry, instead of spending more time tinkering with thematic formats we could simply take a brute force approach and use a style override to color that one area exactly the color which looks good in the layout.

 

Another good use for style overrides is when creating labels manually to annotate a map.   Style overrides allow us to manually specify the style of each label, such as size, font and color that we create.   When the numbers of labels are limited it is often easier to simply use style overrides than to organize a limited number of labels into several different layers that can all be formatted in the usual way.  

 

See Also

Maps

 

Drawings

 

Labels

 

Style

 

Style: Drawings

 

Style: Labels

 

Contents Pane

 

Contents - Record

 

Contents - Select

 

Contents - Transform

 

Example: Style Panel Quickstart - A tutorial introduction to using the Style panel in the Contents pane to apply color, symbology, size and rotation to areas, lines and points in drawings.

 

Example: Style Overrides - Working with style overrides to individually style areas, to use or not use style overrides, to find all records using style overrides and to clear style overrides.