Class RenderingCLI
- java.lang.Object
-
- org.openstreetmap.josm.gui.mappaint.RenderingCLI
-
- All Implemented Interfaces:
CLIModule
public class RenderingCLI extends java.lang.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 classRenderingCLI.Option(package private) static classRenderingCLI.RenderingAreaData class to hold return values fordetermineRenderingArea(DataSet).
-
Field Summary
Fields Modifier and Type Field Description private LatLonargAnchorprivate BoundsargBoundsprivate RenderingHelper.StyleDataargCurrentStyleprivate booleanargDebugprivate java.lang.DoubleargHeightMprivate java.lang.IntegerargHeightPxprivate java.lang.StringargInputprivate java.lang.IntegerargMaxImageSizeprivate java.lang.StringargOutputprivate java.lang.StringargProjectionprivate java.lang.DoubleargScaleprivate java.util.List<RenderingHelper.StyleData>argStylesprivate booleanargTraceprivate java.lang.DoubleargWidthMprivate java.lang.IntegerargWidthPxprivate java.lang.IntegerargZoomprivate static intDEFAULT_MAX_IMAGE_SIZEstatic RenderingCLIINSTANCEThe singleton instance of this class.private static doublePIXEL_PER_METER
-
Constructor Summary
Constructors Constructor Description RenderingCLI()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidcheckPreconditions(RenderingHelper rh)(package private) RenderingCLI.RenderingAreadetermineRenderingArea(DataSet ds)Find the area to render and the scale, given certain command line options and the dataset.java.lang.StringgetActionKeyword()Get the action keyword that the user needs to provide as first command line argument to invoke this module.private static java.lang.StringgetHelp()private java.util.logging.LevelgetLogLevel()private voidhandleOption(RenderingCLI.Option o)private voidhandleOption(RenderingCLI.Option o, java.lang.String arg)(package private) voidinitialize()Initialization.private DataSetloadDataset()(package private) voidparseArguments(java.lang.String[] argArray)Parse command line arguments and do some low-level error checking.voidprocessArguments(java.lang.String[] argArray)Process the remaining command line arguments and run any of the requested actions.static voidshowHelp()Displays help on the consoleprivate voidwriteImageToFile(java.awt.image.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
-
argInput
private java.lang.String argInput
-
argOutput
private java.lang.String argOutput
-
argStyles
private java.util.List<RenderingHelper.StyleData> argStyles
-
argZoom
private java.lang.Integer argZoom
-
argScale
private java.lang.Double argScale
-
argWidthM
private java.lang.Double argWidthM
-
argHeightM
private java.lang.Double argHeightM
-
argWidthPx
private java.lang.Integer argWidthPx
-
argHeightPx
private java.lang.Integer argHeightPx
-
argProjection
private java.lang.String argProjection
-
argMaxImageSize
private java.lang.Integer argMaxImageSize
-
argCurrentStyle
private RenderingHelper.StyleData argCurrentStyle
-
-
Constructor Detail
-
RenderingCLI
RenderingCLI()
-
-
Method Detail
-
getActionKeyword
public java.lang.String getActionKeyword()
Description copied from interface:CLIModuleGet the action keyword that the user needs to provide as first command line argument to invoke this module.- Specified by:
getActionKeywordin interfaceCLIModule- Returns:
- the action keyword of this module
-
processArguments
public void processArguments(java.lang.String[] argArray)
Description copied from interface:CLIModuleProcess the remaining command line arguments and run any of the requested actions.- Specified by:
processArgumentsin interfaceCLIModule- Parameters:
argArray- command line arguments without the initial action keyword
-
parseArguments
void parseArguments(java.lang.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, java.lang.String arg)
-
showHelp
public static void showHelp()
Displays help on the console
-
getHelp
private static java.lang.String getHelp()
-
initialize
void initialize()
Initialization. Requires arguments to be parsed already (parseArguments(java.lang.String[])).
-
getLogLevel
private java.util.logging.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 java.io.IOException, IllegalDataException
- Throws:
java.io.IOExceptionIllegalDataException
-
checkPreconditions
private void checkPreconditions(RenderingHelper rh)
-
writeImageToFile
private void writeImageToFile(java.awt.image.BufferedImage image) throws java.io.IOException
- Throws:
java.io.IOException
-
-