Package edu.tufts.hrilab.map.gui
Class MapAdapter
java.lang.Object
edu.tufts.hrilab.gui.GuiAdapter
edu.tufts.hrilab.map.gui.MapAdapter
Handles WebSocket messages for MapComponent-related functionalities within the web interface.
This class processes and responds to various navigation and location requests, converting
them into TRADEService calls and updates within the application.
-
Field Summary
Fields inherited from class edu.tufts.hrilab.gui.GuiAdapter
groups -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionconvertPGMtoPNG(String pgmPathStr) Converts a PGM image file to a PNG image file and returns the new filename.Enforce implementation of path root getter forgetPath().protected voidhandleMessage(com.google.gson.JsonObject message) Handles incoming WebSocket messages by identifying the action requested and delegating to the appropriate method.protected booleanForce implementing classes to declare whether they provide TRADE services.Methods inherited from class edu.tufts.hrilab.gui.GuiAdapter
createAndRegisterInstance, getPath, init, sendMessage
-
Constructor Details
-
MapAdapter
-
-
Method Details
-
handleMessage
protected void handleMessage(com.google.gson.JsonObject message) Handles incoming WebSocket messages by identifying the action requested and delegating to the appropriate method.- Overrides:
handleMessagein classGuiAdapter- Parameters:
message- The text message received from the client.
-
convertPGMtoPNG
public String convertPGMtoPNG(String pgmPathStr) throws org.apache.commons.imaging.ImageReadException, org.apache.commons.imaging.ImageWriteException, IOException Converts a PGM image file to a PNG image file and returns the new filename.- Parameters:
pgmPathStr- The path string of the PGM file to convert.- Returns:
- The filename of the converted PNG image.
- Throws:
org.apache.commons.imaging.ImageReadExceptionorg.apache.commons.imaging.ImageWriteExceptionIOException
-
getPathRoot
Enforce implementation of path root getter forgetPath(). This is usually based on the component's/adapter's name; e.g., the belief GUI's path root isbelief.- Specified by:
getPathRootin classGuiAdapter- Returns:
- the path root as a
String.
-
providesTradeServices
protected boolean providesTradeServices()Force implementing classes to declare whether they provide TRADE services. This is to decide whether or not to register any new instances of that class with TRADE.- Specified by:
providesTradeServicesin classGuiAdapter- Returns:
- true iff the adapter provides TRADE services.
-