Class LoadAndZoomHandler
java.lang.Object
org.openstreetmap.josm.io.remotecontrol.handler.RequestHandler
org.openstreetmap.josm.io.remotecontrol.handler.LoadAndZoomHandler
Handler for
load_and_zoom and zoom 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
FieldsModifier and TypeFieldDescriptionprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringstatic final StringThe remote control command name used to load data and zoom.static final StringThe remote control command name used to zoom.private static final Stringprivate booleanprivate doubleprivate doubleprivate doubleprivate doubleprivate static final Stringprivate static final Stringprivate final Set<SimplePrimitiveId>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 -
Method Summary
Modifier and TypeMethodDescriptionprivate voidprivate voidaddTags(Collection<OsmPrimitive> forTagAdd) private voiddownload()String[]Returns the mandatory parameters.String[]Returns the optional parameters.Get a specific message to ask the user for permission for the operation requested via remote control.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.getUsage()Returns usage description, for bad requests and documentation.String[]Returns usage examples, for bad requests and documentation.String[]getUsageExamples(String cmd) Returns usage examples for the given command.protected voidHandle a specific command sent as remote control.(package private) static voidparseChangesetTags(Map<String, String> args) private voidperformDownload(DownloadOsmTask osmTask, DownloadParams settings) Perform the actual download; this is synchronized to ensure that we only have one download going on at a timeprivate Collection<OsmPrimitive>private AreaRemove areas that has already been downloadedprivate voidsearchAndZoom(Collection<OsmPrimitive> forTagAdd, Bounds bbox) private voidselectAndZoom(Collection<OsmPrimitive> forTagAdd, Bounds bbox) protected voidValidates the request before attempting to perform it.private voidprotected voidzoom(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 Details
-
command
The remote control command name used to load data and zoom.- See Also:
-
command2
The remote control command name used to zoom.- See Also:
-
CURRENT_SELECTION
- See Also:
-
SELECT
- See Also:
-
ADDTAGS
- See Also:
-
CHANGESET_COMMENT
- See Also:
-
CHANGESET_SOURCE
- See Also:
-
CHANGESET_HASHTAGS
- See Also:
-
CHANGESET_TAGS
- See Also:
-
SEARCH
- See Also:
-
minlat
-
maxlat
-
minlon
-
maxlon
-
toSelect
-
isKeepingCurrentSelection
-
-
Constructor Details
-
LoadAndZoomHandler
public LoadAndZoomHandler()
-
-
Method Details
-
getPermissionMessage
Description copied from class:RequestHandlerGet 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:
getPermissionMessagein classRequestHandler- Returns:
- the message
-
getMandatoryParams
Description copied from class:RequestHandlerReturns the mandatory parameters. Both used to enforce their presence at runtime and for documentation.- Specified by:
getMandatoryParamsin classRequestHandler- Returns:
- the mandatory parameters
-
getOptionalParams
Description copied from class:RequestHandlerReturns the optional parameters. Both used to enforce their presence at runtime and for documentation.- Overrides:
getOptionalParamsin classRequestHandler- Returns:
- the optional parameters
-
getUsage
Description copied from class:RequestHandlerReturns usage description, for bad requests and documentation.- Overrides:
getUsagein classRequestHandler- Returns:
- usage description
-
getUsageExamples
Description copied from class:RequestHandlerReturns usage examples, for bad requests and documentation.- Overrides:
getUsageExamplesin classRequestHandler- Returns:
- Usage examples
-
getUsageExamples
Description copied from class:RequestHandlerReturns usage examples for the given command. To be overridden only my handlers that define several commands.- Overrides:
getUsageExamplesin classRequestHandler- Parameters:
cmd- The command asked- Returns:
- Usage examples for the given command
-
handleRequest
Description copied from class:RequestHandlerHandle 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:
handleRequestin classRequestHandler- Throws:
RequestHandler.RequestHandlerErrorException- if an error occurs while processing request
-
download
-
removeAlreadyDownloadedArea
Remove areas that has already been downloaded- Returns:
- The area to download
-
performDownload
private void performDownload(DownloadOsmTask osmTask, DownloadParams settings) throws RequestHandler.RequestHandlerErrorException Perform the actual download; this is synchronized to ensure that we only have one download going on at a time- Parameters:
osmTask- The task that will show a dialogsettings- The download settings- Throws:
RequestHandler.RequestHandlerErrorException- If there is an issue getting data
-
performSearchZoom
private Collection<OsmPrimitive> performSearchZoom() throws RequestHandler.RequestHandlerErrorException -
selectAndZoom
-
searchAndZoom
private void searchAndZoom(Collection<OsmPrimitive> forTagAdd, Bounds bbox) throws RequestHandler.RequestHandlerErrorException -
addChangesetTags
-
addTags
-
parseChangesetTags
-
zoom
-
getPermissionPref
Description copied from class:RequestHandlerGet 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:
getPermissionPrefin classRequestHandler- Returns:
- the preference name and error message or null
-
validateRequest
Description copied from class:RequestHandlerValidates the request before attempting to perform it.- Specified by:
validateRequestin classRequestHandler- Throws:
RequestHandler.RequestHandlerBadRequestException- if request is invalid
-
validateSelect
-