Class RenderingCLI
- java.lang.Object
-
- org.openstreetmap.josm.gui.mappaint.RenderingCLI
-
- All Implemented Interfaces:
CLIModule
public class RenderingCLI extends Object implements CLIModule
Command line interface for rendering osm data to an image file.- Since:
- 12906
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
RenderingCLI.Option
(package private) static class
RenderingCLI.RenderingArea
Data class to hold return values fordetermineRenderingArea(DataSet)
.
-
Field Summary
Fields Modifier and Type Field Description private LatLon
argAnchor
private Bounds
argBounds
private RenderingHelper.StyleData
argCurrentStyle
private boolean
argDebug
private Double
argHeightM
private Integer
argHeightPx
private String
argInput
private Integer
argMaxImageSize
private String
argOutput
private String
argProjection
private Double
argScale
private List<RenderingHelper.StyleData>
argStyles
private boolean
argTrace
private Double
argWidthM
private Integer
argWidthPx
private Integer
argZoom
private static int
DEFAULT_MAX_IMAGE_SIZE
static RenderingCLI
INSTANCE
The singleton instance of this class.private static double
PIXEL_PER_METER
-
Constructor Summary
Constructors Constructor Description RenderingCLI()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
checkPreconditions(RenderingHelper rh)
(package private) RenderingCLI.RenderingArea
determineRenderingArea(DataSet ds)
Find the area to render and the scale, given certain command line options and the dataset.String
getActionKeyword()
Get the action keyword that the user needs to provide as first command line argument to invoke this module.private static String
getHelp()
private Level
getLogLevel()
private void
handleOption(RenderingCLI.Option o)
private void
handleOption(RenderingCLI.Option o, String arg)
(package private) void
initialize()
Initialization.private DataSet
loadDataset()
(package private) void
parseArguments(String[] argArray)
Parse command line arguments and do some low-level error checking.void
processArguments(String[] argArray)
Process the remaining command line arguments and run any of the requested actions.static void
showHelp()
Displays help on the consoleprivate void
writeImageToFile(BufferedImage image)
-
-
-
Field Detail
-
INSTANCE
public static final RenderingCLI INSTANCE
The singleton instance of this class.
-
PIXEL_PER_METER
private static final double PIXEL_PER_METER
- See Also:
- Constant Field Values
-
DEFAULT_MAX_IMAGE_SIZE
private static final int DEFAULT_MAX_IMAGE_SIZE
- See Also:
- Constant Field Values
-
argDebug
private boolean argDebug
-
argTrace
private boolean argTrace
-
argStyles
private List<RenderingHelper.StyleData> argStyles
-
argHeightM
private Double argHeightM
-
argWidthPx
private Integer argWidthPx
-
argHeightPx
private Integer argHeightPx
-
argProjection
private String argProjection
-
argMaxImageSize
private Integer argMaxImageSize
-
argCurrentStyle
private RenderingHelper.StyleData argCurrentStyle
-
-
Constructor Detail
-
RenderingCLI
RenderingCLI()
-
-
Method Detail
-
getActionKeyword
public String getActionKeyword()
Description copied from interface:CLIModule
Get the action keyword that the user needs to provide as first command line argument to invoke this module.- Specified by:
getActionKeyword
in interfaceCLIModule
- Returns:
- the action keyword of this module
-
processArguments
public void processArguments(String[] argArray)
Description copied from interface:CLIModule
Process the remaining command line arguments and run any of the requested actions.- Specified by:
processArguments
in interfaceCLIModule
- Parameters:
argArray
- command line arguments without the initial action keyword
-
parseArguments
void parseArguments(String[] argArray)
Parse command line arguments and do some low-level error checking.- Parameters:
argArray
- the arguments array
-
handleOption
private void handleOption(RenderingCLI.Option o)
-
handleOption
private void handleOption(RenderingCLI.Option o, String arg)
-
showHelp
public static void showHelp()
Displays help on the console
-
initialize
void initialize()
Initialization. Requires arguments to be parsed already (parseArguments(java.lang.String[])
).
-
getLogLevel
private Level getLogLevel()
-
determineRenderingArea
RenderingCLI.RenderingArea determineRenderingArea(DataSet ds)
Find the area to render and the scale, given certain command line options and the dataset.- Parameters:
ds
- the dataset- Returns:
- area to render and the scale
-
loadDataset
private DataSet loadDataset() throws IOException, IllegalDataException
- Throws:
IOException
IllegalDataException
-
checkPreconditions
private void checkPreconditions(RenderingHelper rh)
-
writeImageToFile
private void writeImageToFile(BufferedImage image) throws IOException
- Throws:
IOException
-
-