|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.esri.core.symbol.advanced.MessageProcessor
public class 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
GroupLayer
, which is used to display, update and remove
MultiLayerSymbol
associated with the message. The GroupLayer has to
be added into JMap
, otherwise MessageProcessor will fail to
process the message.
Creates a MessageProcessor object:
Creates a Message object, then process it:
MapView map = new MapView(this);
GroupLayer groupLayers = new GroupLayer();
map.addLayer(groupLayers);
try {
MessageProcessor processor = new MessageProcessor(DictionaryType.Mil2525C, groupLayers);
}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);
Constructor Summary | |
---|---|
MessageProcessor(SymbolDictionary.DictionaryType type,
MessageGroupLayer groupLayer)
|
|
MessageProcessor(SymbolDictionary.DictionaryType type,
MessageGroupLayer groupLayer,
String symbolDictionaryPath)
|
Method Summary | |
---|---|
Message |
createMessageFrom(Graphic graphic)
Creates a Message from a Graphic object. |
Message |
createMessageFrom(String messageID)
Creates a Message from an existing message ID. |
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()
|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MessageProcessor(SymbolDictionary.DictionaryType type, MessageGroupLayer groupLayer)
public MessageProcessor(SymbolDictionary.DictionaryType type, MessageGroupLayer groupLayer, String symbolDictionaryPath)
Method Detail |
---|
public SymbolDictionary getSymbolDictionary()
public boolean processMessage(Message message)
message
- A Message
object
public Message createMessageFrom(Graphic graphic)
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.public Message createMessageFrom(String messageID)
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.public SpatialReference getDefaultMessageSpatialReference()
public void setDefaultMessageSpatialReference(SpatialReference sr)
sr
- the default message spatial reference to set.public SymbolDictionary.DictionaryType getDictionaryType()
public String[] getMessageTypesSupported()
a sample message type file:
{
"type": "position_report",
"layerName": "position_reports",
"renderer":
{
"type" : "dictionary",
"description" : "postion report",
"dictionaryType" : "2525C",
"field" : "sic"
}
}
public Graphic getGraphic(String messageID)
messageID
- message id.
Graphic
object populated with the properties of message
of specified id.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |