Styling
Explains the principle of styling in JViews Maps for Defense.
Explains in a few words how styling is achieved in
JViews Maps for Defense.
Describes what a map theme consists of.
Explains the principle of style sheets.
Explains the use of symbols in maps.
Explains how to make an advanced use of graphics through the
JViews Framework SDK.
Overview
Styling is a key feature in Rogue Wave mapping products. In
JViews Maps for Defense, styling of maps is achieved through properties associated with layers. In
JViews Diagrammer, styling is applied through CSS style rules written to a
style sheet.
The map theme
The map theme is the sum of all the style sets defined in the map layers.
In addition to data sources, most layers also contain
styling information, for example, about grids, labels, terrain analysis, measurements. See
Themes and styling for more details about styling in maps.
Most map layers are used to manage graphic objects created from map features imported from various map data files. The styling options differ according to the content of each file and the map features imported by the different readers.
JViews Diagrammer style sheets
Styling in JViews Diagrammer involves the following constructs:
Style rules
Composite graphics
Backgrounds
JViews Diagrammer style rules
The StyleSheet renderer applies a
style sheet to a data model. The style sheet contains
style rules in
CSS2 format that describe how the objects in the data model are displayed in the diagram.
A style rule consists of two parts:
The condition part called the selector applies to the data model, and is used for pattern-matching.
The action part called the declarations applies to the corresponding graphic objects, and is used for rendering.
When designing a notation, you create many style rules, each of them matching a particular case in the data model. You define rules that apply to objects represented as nodes, and rules that apply to objects represented as links.
The style rules are usually defined from the most generic to the most specific. The generic rules usually create the base symbol for each type of object. The more specific rules add new shapes, or change graphics properties for the symbol defined in the generic rule.
The style rules are also used to specify the options of a diagram. Such rules have no selector and the declarations customize the way the options operate.
The Designer for
JViews Diagrammer is perfectly suited for creating style sheets that define the look-and-feel of diagrams. Within the Designer, styling takes place, but the
CSS syntax is largely hidden: selectors are defined in a natural-language editor and declarations are defined by setting graphic properties through panels called Styling Customizers. The style sheet generated by the Designer can be loaded into your application at run time.
Composite graphics are used to create the symbols for your application.
The Composite Graphics capability consists of a set of classes that help you to combine simple graphic objects to build more complex graphic objects according to one of several possible composite layouts.
The composite layout declares the way additional elements are attached to the base shape of the composite graphics.
Composite graphics are designed to be used with style rules that define which elements are displayed and how according to data model conditions. For example, you can dynamically add an alarm icon to a symbol when the status property of a node is equal to alarm.
Composite graphics can be nested to reuse simpler symbols within more complex ones.
When the SDM engine parses the data model, it applies the style rules, and depending on which rules apply, it creates the composite graphics appropriately to display the nodes.
Ultimately, the composite graphics facility creates and deletes graphics objects in the grapher.
Here again, the Designer for JViews Diagrammer helps you to create composite graphics for your application.
Backgrounds and maps
facilities to read map formats—vector or raster—and to display nodes according to their latitude and longitude.
Symbols
Symbols are moving objects on top of a background map.
JViews Maps for Defense includes the
APP-6a symbol library that conforms to NATO symbology. These are predefined military symbols that you can use as is, through their API.
You should use the Map Builder to create a map, and then load the map into the Designer for JViews Diagrammer and add nodes or links to the model. You can then select which symbols should represent your model. If your symbols are all known at design time, you can also prepare and specify them in the Map Builder. In this case, you should not use the Designer.
The Symbol Editor for JViews Diagrammer provides a way to design your own set of rich symbols. Symbols can be nested to reuse simpler symbols within more complex ones. Style rules are bundled within symbols and the symbols themselves are grouped into palettes.
Graphics SDK for experts
The
JViews Framework SDK is used to manage graphic objects. You need to be comfortable with writing Java™ code to use this SDK. There is no user-friendly GUI to help you out, although some classes are available as JavaBeans™ for use in your favorite IDE. See
Framework classes available as JavaBeans in
The Essential JViews Framework.
This topic summarizes the main features of handling graphic objects. The mapping products do not have wrapped classes of their own to do this, so if you write your own code you will have to use JViews Framework directly.
For map applications, the supplied source code of the Map Builder shows you how to do this. The easiest way is to adapt the Map Builder code to the needs of your application.
An IlvManager object is the data structure that contains graphic objects, such as rectangle, polylines, and so on.
The base class for graphic objects is IlvGraphic.
Graphic objects can be stored in the manager. The manager is composed of several storage areas called layers and you can specify in which
layer an object is to be stored. Objects in a higher layer are displayed in front of objects in lower layers. A layer is an instance of the class
IlvManagerLayer.
NOTE Do not confuse the storage layer in JViews Framework with the map layer, which is used mainly for styling.
Graphic objects stored in a manager can be displayed in several views. A view is an instance of the class IlvManagerView. This class is a subclass of the AWT class java.awt.Container.
IlvGrapher is a manager that contains nodes and links. Nodes can be any type of graphic object. (Links are instances of the class IlvLinkImage.) A graphic object becomes a node of a graph if it is added to the grapher by the addNode method. (A link must be added by the addLink method.) When a node is removed from a grapher, all the links that come from and go to this node are also removed. When changing the position of a node, the connection points of the links are automatically recomputed.
IlvGraphic is the abstract base class of graphic objects managed by an instance of IlvManager.
The extensive graphics API of JViews Framework does far more than the basic management of graphic objects. It is a powerful tool for customizing and refining Java™ development. The mapping products give you access to the full JJViews Framework. For example, JViews Framework also includes APIs for deploying thin-client applications.
Copyright © 2018, Rogue Wave Software, Inc. All Rights Reserved.