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_zoomandzoomrequests.- 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 private static java.lang.StringADDTAGSprivate static java.lang.StringCHANGESET_COMMENTprivate static java.lang.StringCHANGESET_HASHTAGSprivate static java.lang.StringCHANGESET_SOURCEprivate static java.lang.StringCHANGESET_TAGSstatic java.lang.StringcommandThe remote control command name used to load data and zoom.static java.lang.Stringcommand2The remote control command name used to zoom.private static java.lang.StringCURRENT_SELECTIONprivate booleanisKeepingCurrentSelectionprivate doublemaxlatprivate doublemaxlonprivate doubleminlatprivate doubleminlonprivate static java.lang.StringSEARCHprivate static java.lang.StringSELECTprivate java.util.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 private voidaddChangesetTags()private voidaddTags(java.util.Collection<OsmPrimitive> forTagAdd)private voiddownload()java.lang.String[]getMandatoryParams()Returns the mandatory parameters.java.lang.String[]getOptionalParams()Returns the optional parameters.java.lang.StringgetPermissionMessage()Get a specific message to ask the user for permission for the operation requested via remote control.PermissionPrefWithDefaultgetPermissionPref()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.java.lang.StringgetUsage()Returns usage description, for bad requests and documentation.java.lang.String[]getUsageExamples()Returns usage examples, for bad requests and documentation.java.lang.String[]getUsageExamples(java.lang.String cmd)Returns usage examples for the given command.protected voidhandleRequest()Handle a specific command sent as remote control.(package private) static voidparseChangesetTags(java.util.Map<java.lang.String,java.lang.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 java.util.Collection<OsmPrimitive>performSearchZoom()private java.awt.geom.ArearemoveAlreadyDownloadedArea()Remove areas that has already been downloadedprivate voidsearchAndZoom(java.util.Collection<OsmPrimitive> forTagAdd, Bounds bbox)private voidselectAndZoom(java.util.Collection<OsmPrimitive> forTagAdd, Bounds bbox)protected voidvalidateRequest()Validates the request before attempting to perform it.private voidvalidateSelect()protected voidzoom(java.util.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 java.lang.String command
The remote control command name used to load data and zoom.- See Also:
- Constant Field Values
-
command2
public static final java.lang.String command2
The remote control command name used to zoom.- See Also:
- Constant Field Values
-
CURRENT_SELECTION
private static final java.lang.String CURRENT_SELECTION
- See Also:
- Constant Field Values
-
SELECT
private static final java.lang.String SELECT
- See Also:
- Constant Field Values
-
ADDTAGS
private static final java.lang.String ADDTAGS
- See Also:
- Constant Field Values
-
CHANGESET_COMMENT
private static final java.lang.String CHANGESET_COMMENT
- See Also:
- Constant Field Values
-
CHANGESET_SOURCE
private static final java.lang.String CHANGESET_SOURCE
- See Also:
- Constant Field Values
-
CHANGESET_HASHTAGS
private static final java.lang.String CHANGESET_HASHTAGS
- See Also:
- Constant Field Values
-
CHANGESET_TAGS
private static final java.lang.String CHANGESET_TAGS
- See Also:
- Constant Field Values
-
SEARCH
private static final java.lang.String SEARCH
- See Also:
- Constant Field Values
-
minlat
private double minlat
-
maxlat
private double maxlat
-
minlon
private double minlon
-
maxlon
private double maxlon
-
toSelect
private final java.util.Set<SimplePrimitiveId> toSelect
-
isKeepingCurrentSelection
private boolean isKeepingCurrentSelection
-
-
Constructor Detail
-
LoadAndZoomHandler
public LoadAndZoomHandler()
-
-
Method Detail
-
getPermissionMessage
public java.lang.String 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
public java.lang.String[] 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
public java.lang.String[] 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
public java.lang.String getUsage()
Description copied from class:RequestHandlerReturns usage description, for bad requests and documentation.- Overrides:
getUsagein classRequestHandler- Returns:
- usage description
-
getUsageExamples
public java.lang.String[] getUsageExamples()
Description copied from class:RequestHandlerReturns usage examples, for bad requests and documentation.- Overrides:
getUsageExamplesin classRequestHandler- Returns:
- Usage examples
-
getUsageExamples
public java.lang.String[] getUsageExamples(java.lang.String cmd)
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
protected void handleRequest() throws RequestHandler.RequestHandlerErrorException
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
private void download() throws RequestHandler.RequestHandlerErrorException
-
removeAlreadyDownloadedArea
private java.awt.geom.Area 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 java.util.Collection<OsmPrimitive> performSearchZoom() throws RequestHandler.RequestHandlerErrorException
-
selectAndZoom
private void selectAndZoom(java.util.Collection<OsmPrimitive> forTagAdd, Bounds bbox)
-
searchAndZoom
private void searchAndZoom(java.util.Collection<OsmPrimitive> forTagAdd, Bounds bbox) throws RequestHandler.RequestHandlerErrorException
-
addChangesetTags
private void addChangesetTags()
-
addTags
private void addTags(java.util.Collection<OsmPrimitive> forTagAdd)
-
parseChangesetTags
static void parseChangesetTags(java.util.Map<java.lang.String,java.lang.String> args)
-
zoom
protected void zoom(java.util.Collection<OsmPrimitive> primitives, Bounds bbox)
-
getPermissionPref
public PermissionPrefWithDefault 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
protected void validateRequest() throws RequestHandler.RequestHandlerBadRequestException
Description copied from class:RequestHandlerValidates the request before attempting to perform it.- Specified by:
validateRequestin classRequestHandler- Throws:
RequestHandler.RequestHandlerBadRequestException- if request is invalid
-
validateSelect
private void validateSelect()
-
-