java.lang.Object | |
↳ | com.esri.core.symbol.advanced.MessageProcessor |
A MessageProcessor allows you to process a Message
from external resources. For example, display a military
symbol by passing a 2525C message to a MessageProcesor. Each MessageProcessor comes with a SymbolDictionary.DictionaryType
,
which dictates message format understood by MessageProcessor, e.g. a message needs to have one or more properties
from 'wkid', ''sic', '_Type', '_Action' and '_Control_Points' in order to be successfully processed by a 2525C
MessageProcessor. Each dictionary type is backed by a resource bundle which includes dictionary data file and message
type files. The path to the resource files needs to be specified when a MessageProcessor object is initialized. A
MessageProcessor is bound to a MessageGroupLayer
, which is used to display, update and remove
MultiLayerSymbol
associated with the message. The MessageGroupLayer has to be added into MapView
, otherwise
MessageProcessor will fail to process the message.
Creates a MessageProcessor object:
Creates a Message object, then process it:
MapView map = new MapView(this);
try {
MessageGroupLayer mgroupLayer= new MessageGroupLayer(DictionaryType.MIL2525C);
map.addLayer(mgroupLayer);
MessageProcessor processor = mgroupLayer.getMessageProcessor();
catch(FileNotFoundException ex) {
ex.printStackTrace();
}
Message message = new Message();
UUID uuid = UUID.randomUUID();
message.setID(uuid.toString());
message.setProperty("_Type", "position_report");
message.setProperty("_Action", "update");
message.setProperty("_Control_Points", "7846271.25206,4091857.83028");
message.setProperty("sic", "SFGPUCRRL--E---");
message.setProperty("_WKID", "3857");
message.setProperty("UniqueDesignation", "Mad dog");
processor.processMessage(message);
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
String | DEFAULT_DICTIONARY_FOLDER |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
MessageProcessor(SymbolDictionary.DictionaryType type, GroupLayer groupLayer)
This constructor is deprecated.
No replacement.
| |||||||||||
MessageProcessor(SymbolDictionary.DictionaryType type, MessageGroupLayer mgroupLayer)
Constructs a MessageProcesor object using specified
SymbolDictionary.DictionaryType and GroupLayer . | |||||||||||
MessageProcessor(SymbolDictionary.DictionaryType type, GroupLayer groupLayer, String symbolDictionaryPath)
This constructor is deprecated.
No replacement.
| |||||||||||
MessageProcessor(SymbolDictionary.DictionaryType type, MessageGroupLayer mgroupLayer, String symbolDictionaryPath)
Constructs a MessageProcesor object using specified
SymbolDictionary.DictionaryType , MessageGroupLayer and resource bundle
path. |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Message |
createMessageFrom(String messageID)
Creates a
Message from an existing message ID. | ||||||||||
Message | createMessageFrom(Graphic graphic) | ||||||||||
SpatialReference |
getDefaultMessageSpatialReference()
Gets the default message spatial reference.
| ||||||||||
SymbolDictionary.DictionaryType |
getDictionaryType()
Gets the dictionary type.
| ||||||||||
Graphic |
getGraphic(String messageID)
Retrieves the graphic which originates from the message with specified id.
| ||||||||||
String[] |
getMessageTypesSupported()
Gets the message types supported.
| ||||||||||
SymbolDictionary |
getSymbolDictionary()
Gets the
SymbolDictionary instance. | ||||||||||
boolean |
processMessage(Message message)
Processes the message which conforms to the format dictated by the dictionary type.
| ||||||||||
void |
setDefaultMessageSpatialReference(SpatialReference sr)
Sets the default message spatial reference.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
This constructor is deprecated.
No replacement.
Constructs a MessageProcesor object using specified SymbolDictionary.DictionaryType
and GroupLayer
. Default
path(/sdcard/ArcGIS/SymbolDictionary) to the resource bundle is used
type | processor type. Only Mil252C is supported for now. |
---|---|
groupLayer | GroupLayer which displays symbols. |
FileNotFoundException | the file not found exception |
---|
Constructs a MessageProcesor object using specified SymbolDictionary.DictionaryType
and GroupLayer
. Default
path(/sdcard/ArcGIS/SymbolDictionary) to the resource bundle is used
type | processor type. Only Mil252C is supported for now. |
---|---|
mgroupLayer | MessageGroupLayer which displays symbols. |
FileNotFoundException | the file not found exception |
---|
This constructor is deprecated.
No replacement.
Constructs a MessageProcesor object using specified SymbolDictionary.DictionaryType
, GroupLayer
and resource bundle
path.
type | processor type. Only Mil2525C is supported for now. |
---|---|
groupLayer | GroupLayer which displays symbols |
symbolDictionaryPath | path to the symbol dictionary source bundle directory. |
FileNotFoundException | the file not found exception |
---|
Constructs a MessageProcesor object using specified SymbolDictionary.DictionaryType
, MessageGroupLayer
and resource bundle
path.
type | processor type. Only Mil2525C is supported for now. |
---|---|
mgroupLayer | MessageGroupLayer which displays symbols |
symbolDictionaryPath | path to the symbol dictionary source bundle directory. |
FileNotFoundException | the file not found exception |
---|
Creates a Message
from an existing message ID. The message ID is used previously to create or update a
graphic. The returned message has the same attributes as the previous message with specified message ID except that
'_Action' property is empty.
messageID | message ID |
---|
Message
object with attributes from previous message with same message id.Creates a Message
from a Graphic
object. The message gets populated with properties understood by
the message processor. If the specified graphic is created from previous message, the returned message is the same
as the previous one except that '_Action' property is empty.
graphic | a Graphic object. |
---|
Message
object populated with attributes/geometry from the specified graphic.Gets the default message spatial reference. Message spatial reference is used by control points inside the message. Usually a WKID or WKT property indicates the message spatial reference. If WKID or WKT property is omitted, this default message spatial reference is treated as the message spatial reference. If default message spatial reference is not set, it will be the same as the map's spatial reference.
Gets the dictionary type. The dictionary type is associated with a resource bundle, which includes dictionary data file and message type configuration files. Only Mil2525C dictionary type is available for now.
Retrieves the graphic which originates from the message with specified id.
messageID | message id. |
---|
Graphic
object populated with the properties of message of specified id.Gets the message types supported. A message requires a type property which describes how message is processed. The message type is defined in the resource bundle as a configuration file in JSON format. A message type contains properties like type name, layer name and renderer.
a sample message type file:
{
"type": "position_report",
"layerName": "position_reports",
"renderer":
{
"type" : "dictionary",
"description" : "postion report",
"dictionaryType" : "2525C",
"field" : "sic"
}
}
Gets the SymbolDictionary
instance.
Processes the message which conforms to the format dictated by the dictionary type. MessageProcessor uses message properties to create, update, delete or otherwise change the state of the graphic(geometry and attributes). MessageProcessor determines which message properties should be persisted on graphic as attributes.
message | A Message object |
---|
Sets the default message spatial reference. Message spatial reference is used by control points inside the message. Usually a WKID or WKT property indicates the message spatial reference. If WKID or WKT property is omitted, this default message spatial reference is treated as the message spatial reference. If default message spatial reference is not set, it will be the same as the map's spatial reference.
sr | the default message spatial reference to set. |
---|