skip to main content
Defense > Programmer's documentation > Programming with JViews Maps > Integration > Using symbols through the API
 
Using symbols through the API
Describes symbols and explains how to use them.
*Overview of symbols
*Defines symbols and explains how they are used.
*Storing symbols
*Describes a model that can store symbols.
*Integrating symbols into an application
*Describes how to integrate symbols.
*Populating the SDM model
*Describes how to populate the SDM model with symbols.
*Creating symbol groups
*Describes how to create a symbol group and add a symbol node to it.
Overview of symbols
Symbols are based on JViews Diagrammer technology.
Symbols are nodes of a JViews Diagrammer data model. They are rendered into a graphical view with styling information contained in a Cascading Style Sheet.
See also ““Basic Concepts”” in Introducing JViews Diagrammer.
Storing symbols
You can use a default SDM Model to store your symbols such as:
 
IlvSDMEngine engine = new IlvSDMEngine();
engine.setGrapher((IlvGrapher)view.getManager());
engine.setReferenceView(view);
Integrating symbols into an application
The simplest way to integrate symbols into a map application is to provide a Cascading Style Sheet (see ““Styling”” in Introducing JViews Diagrammer) that describes the symbol rendering, and then use the API to populate the SDM model, for example:
 
// set the rendering style sheet
engine.setStyleSheets(new String[]{"myfile.css"});
You can also use any technique described in ““User Interactions”” in Introducing JViews Diagrammer to integrate your own symbol data model, possibly through an XML stream or database connection.
Populating the SDM model
You can populate the SDM model using the API, for example:
 
Object symbolNode = engine.getModel().createNode("symbol");
engine.getModel().addObject(symbolNode, null, null);
...
engine.getModel().setObjectProperty(symbolNode,
 "longitude", new Double(Math.toRadians(44)));
engine.getModel().setObjectProperty(symbolNode,
 "latitude", new Double(Math.toRadians(-105)));
...
Creating symbol groups
You can also create a symbol group, and add the newly created node to the group:
 
Object symbolGroup = engine.getModel().createNode("group");
Object symbolNode = engine.getModel().createNode("symbol");
engine.getModel().addObject(symbolGroup, null, null);//Add the group itself.
engine.getModel().addObject(symbolNode, symbolGroup, null);//Add the symbol to the group

Copyright © 2018, Rogue Wave Software, Inc. All Rights Reserved.