Class LoadAndZoomHandler
- java.lang.Object
-
- org.openstreetmap.josm.io.remotecontrol.handler.RequestHandler
-
- org.openstreetmap.josm.io.remotecontrol.handler.LoadAndZoomHandler
-
public class LoadAndZoomHandler extends RequestHandler
Handler forload_and_zoom
andzoom
requests.- Since:
- 3707
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.openstreetmap.josm.io.remotecontrol.handler.RequestHandler
RequestHandler.PermissionCache, RequestHandler.RawURLParseRequestHandler, RequestHandler.RequestHandlerBadRequestException, RequestHandler.RequestHandlerErrorException, RequestHandler.RequestHandlerException, RequestHandler.RequestHandlerForbiddenException, RequestHandler.RequestHandlerOsmApiException
-
-
Field Summary
Fields Modifier and Type Field Description static String
command
The remote control command name used to load data and zoom.static String
command2
The remote control command name used to zoom.private static String
CURRENT_SELECTION
private boolean
isKeepingCurrentSelection
private double
maxlat
private double
maxlon
private double
minlat
private double
minlon
private Set<SimplePrimitiveId>
toSelect
-
Fields inherited from class org.openstreetmap.josm.io.remotecontrol.handler.RequestHandler
args, content, contentType, GLOBAL_CONFIRMATION, LOAD_IN_NEW_LAYER, myCommand, OSM_DOWNLOAD_TIMEOUT, PERMISSIONS, request, sender, SPLITTER_COMMA, SPLITTER_SEMIC
-
-
Constructor Summary
Constructors Constructor Description LoadAndZoomHandler()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String[]
getMandatoryParams()
Returns the mandatory parameters.String[]
getOptionalParams()
Returns the optional parameters.String
getPermissionMessage()
Get a specific message to ask the user for permission for the operation requested via remote control.PermissionPrefWithDefault
getPermissionPref()
Get a PermissionPref object containing the name of a special permission preference to individually allow the requested operation and an error message to be displayed when a disabled operation is requested.String
getUsage()
Returns usage description, for bad requests and documentation.String[]
getUsageExamples()
Returns usage examples, for bad requests and documentation.String[]
getUsageExamples(String cmd)
Returns usage examples for the given command.protected void
handleRequest()
Handle a specific command sent as remote control.(package private) static void
parseChangesetTags(Map<String,String> args)
protected void
validateRequest()
Validates the request before attempting to perform it.protected void
zoom(Collection<OsmPrimitive> primitives, Bounds bbox)
-
Methods inherited from class org.openstreetmap.josm.io.remotecontrol.handler.RequestHandler
checkMandatoryParams, checkPermission, getCommand, getContent, getContentType, getDownloadParams, getRequestParameter, handle, parseArgs, setCommand, setSender, setUrl, splitArg, validateDownloadParams
-
-
-
-
Field Detail
-
command
public static final String command
The remote control command name used to load data and zoom.- See Also:
- Constant Field Values
-
command2
public static final String command2
The remote control command name used to zoom.- See Also:
- Constant Field Values
-
CURRENT_SELECTION
private static final String CURRENT_SELECTION
- See Also:
- Constant Field Values
-
minlat
private double minlat
-
maxlat
private double maxlat
-
minlon
private double minlon
-
maxlon
private double maxlon
-
toSelect
private final Set<SimplePrimitiveId> toSelect
-
isKeepingCurrentSelection
private boolean isKeepingCurrentSelection
-
-
Constructor Detail
-
LoadAndZoomHandler
public LoadAndZoomHandler()
-
-
Method Detail
-
getPermissionMessage
public String getPermissionMessage()
Description copied from class:RequestHandler
Get a specific message to ask the user for permission for the operation requested via remote control. This message will be displayed to the user if the preference remotecontrol.always-confirm is true.- Specified by:
getPermissionMessage
in classRequestHandler
- Returns:
- the message
-
getMandatoryParams
public String[] getMandatoryParams()
Description copied from class:RequestHandler
Returns the mandatory parameters. Both used to enforce their presence at runtime and for documentation.- Specified by:
getMandatoryParams
in classRequestHandler
- Returns:
- the mandatory parameters
-
getOptionalParams
public String[] getOptionalParams()
Description copied from class:RequestHandler
Returns the optional parameters. Both used to enforce their presence at runtime and for documentation.- Overrides:
getOptionalParams
in classRequestHandler
- Returns:
- the optional parameters
-
getUsage
public String getUsage()
Description copied from class:RequestHandler
Returns usage description, for bad requests and documentation.- Overrides:
getUsage
in classRequestHandler
- Returns:
- usage description
-
getUsageExamples
public String[] getUsageExamples()
Description copied from class:RequestHandler
Returns usage examples, for bad requests and documentation.- Overrides:
getUsageExamples
in classRequestHandler
- Returns:
- Usage examples
-
getUsageExamples
public String[] getUsageExamples(String cmd)
Description copied from class:RequestHandler
Returns usage examples for the given command. To be overriden only my handlers that define several commands.- Overrides:
getUsageExamples
in classRequestHandler
- Parameters:
cmd
- The command asked- Returns:
- Usage examples for the given command
-
handleRequest
protected void handleRequest() throws RequestHandler.RequestHandlerErrorException
Description copied from class:RequestHandler
Handle a specific command sent as remote control. Any time-consuming operation must be performed asynchronously to avoid delaying the HTTP response. This method of the subclass will do the real work.- Specified by:
handleRequest
in classRequestHandler
- Throws:
RequestHandler.RequestHandlerErrorException
- if an error occurs while processing request
-
parseChangesetTags
static void parseChangesetTags(Map<String,String> args)
-
zoom
protected void zoom(Collection<OsmPrimitive> primitives, Bounds bbox)
-
getPermissionPref
public PermissionPrefWithDefault getPermissionPref()
Description copied from class:RequestHandler
Get a PermissionPref object containing the name of a special permission preference to individually allow the requested operation and an error message to be displayed when a disabled operation is requested. Default is not to check any special preference. Override this in a subclass to define permission preference and error message.- Specified by:
getPermissionPref
in classRequestHandler
- Returns:
- the preference name and error message or null
-
validateRequest
protected void validateRequest() throws RequestHandler.RequestHandlerBadRequestException
Description copied from class:RequestHandler
Validates the request before attempting to perform it.- Specified by:
validateRequest
in classRequestHandler
- Throws:
RequestHandler.RequestHandlerBadRequestException
- if request is invalid
-
-