LuciadCPillar 2023.1.04
luciad::MgrsGridSetting::Builder Class Referencefinal

Builder for a MGRS grid setting. More...

#include <luciad/layers/grids/mgrs/MgrsGrid.h>

Public Member Functions

 Builder (const Builder &other)
 
 ~Builder ()
 
MgrsGridSetting build () const
 Returns the MGRS grid setting. More...
 
BuilderlabelEdgeOffset (double labelEdgeOffset)
 This specifies the offset of the label, away from the edges of the view, in device independent pixels. More...
 
BuilderlabelFormat (const std::string &labelFormat)
 The format pattern to use for the labels of the current MGRS. More...
 
BuilderlabelGridOffset (double labelGridOffset)
 This specifies the offset of the label, in device independent pixels, away from the grid line to which it is attached. More...
 
BuilderlabelOrientation (GridLabelOrientation labelOrientation)
 This specifies the label orientation with respect to the line. More...
 
BuilderlabelPosition (GridLabelPosition labelPosition)
 This specifies the label position with respect to the view. More...
 
BuilderlabelStyle (TextStyle labelStyle)
 Indicates the label style to use for this setting. More...
 
Builderlevel (MgrsLevel level)
 Indicates the MGRS level for which this setting applies. More...
 
BuilderlineLabelPosition (GridLineLabelPosition lineLabelPosition)
 This specifies the label position (with respect to the line) to use for the line labels of the current MGRS type/level/interval combination. More...
 
BuilderlineStyle (LineStyle lineStyle)
 Indicates the line style to use for this setting. More...
 
BuilderscaleRange (MapScale minScale, MapScale maxScale)
 Indicates the scale range for which this setting applies. More...
 
Buildertype (MgrsType type)
 Indicates the MGRS type for which this setting applies. More...
 

Detailed Description

Builder for a MGRS grid setting.

Since
2023.1

Constructor & Destructor Documentation

◆ Builder()

luciad::MgrsGridSetting::Builder::Builder ( const Builder other)

◆ ~Builder()

luciad::MgrsGridSetting::Builder::~Builder ( )

Member Function Documentation

◆ build()

MgrsGridSetting luciad::MgrsGridSetting::Builder::build ( ) const

Returns the MGRS grid setting.

Mandatory parameters:

  • level
  • scale range

Other parameters are optional.

Returns
the MGRS grid setting.
Exceptions
luciad::LogicExceptionwhen not all mandatory parameters are set.

◆ labelEdgeOffset()

Builder & luciad::MgrsGridSetting::Builder::labelEdgeOffset ( double  labelEdgeOffset)

This specifies the offset of the label, away from the edges of the view, in device independent pixels.

It is applied for the labels of the current MGRS type/level/interval combination.

This is optional. Defaults to 6.

Parameters
labelEdgeOffsetthe edge offset value. Must be >= 0.
Returns
this builder.
Exceptions
luciad::InvalidArgumentExceptionwhen an invalid value is passed.

◆ labelFormat()

Builder & luciad::MgrsGridSetting::Builder::labelFormat ( const std::string &  labelFormat)

The format pattern to use for the labels of the current MGRS.

This pattern can be used to specify MGRS coordinates or UTM/UPS coordinates.

The format in BNF notation (expressions enclosed in [] brackets are optional, expressions enclosed in {} brackets may be omitted or repeated):

<pattern>          ::= [<zone>] [<separator> <band>] [<coordinates>]
<zone>             ::= "Z"
<band>             ::= "B"
<coordinates>      ::= <mgrs_coordinates> | <utm_coordinates>
<mgrs_coordinates> ::= [<separator> <id100k>] [<separator> <x> <separator> <y>]
<utm_coordinates>  ::= [<separator> <u> <separator> <v>]
<id100k>           ::= "S"
<x>                ::= "X" <mgrs_precision>
<y>                ::= "Y" <mgrs_precision>
<mgrs_precision>   ::= "0" | "1" | "2" | "3" | "4" | "5"
<u>                ::= "U" <utm_precision>
<v>                ::= "V" <utm_precision>
<utm_precision>    ::= "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7"
<separator>        ::= { ? any character ? }

For example:

  • "33UES 12345 54321" has format "ZBS X5 Y5"
  • "33U 123456 7654321" has format "ZB U6 V7"

Depending on the label, only some parts of the format string will be used. For example, when displaying grid line labels, only the X or Y part of the format string will be used (e.g. it can be used to specify if "12345" or "1234" is displayed).

It is applied for the labels of the current MGRS type/level/interval combination.

This is optional. When not specified a default label format is used, depending on the level.

Parameters
labelFormatthe label format.
Returns
this builder.
Exceptions
luciad::InvalidArgumentExceptionwhen an invalid value is passed.

◆ labelGridOffset()

Builder & luciad::MgrsGridSetting::Builder::labelGridOffset ( double  labelGridOffset)

This specifies the offset of the label, in device independent pixels, away from the grid line to which it is attached.

It is applied for the labels of the current MGRS type/level/interval combination.

This is optional. Defaults to 3.

Parameters
labelGridOffsetthe grid offset value. Must be >= 0.
Returns
this builder.
Exceptions
luciad::InvalidArgumentExceptionwhen an invalid value is passed.

◆ labelOrientation()

Builder & luciad::MgrsGridSetting::Builder::labelOrientation ( GridLabelOrientation  labelOrientation)

This specifies the label orientation with respect to the line.

It is applied for the labels of the current MGRS type/level/interval combination.

This is optional. Defaults to AlongLine.

Parameters
labelOrientationthe label orientation.
Returns
this builder.

◆ labelPosition()

Builder & luciad::MgrsGridSetting::Builder::labelPosition ( GridLabelPosition  labelPosition)

This specifies the label position with respect to the view.

They can for example be placed at the left or at the right edge of the view. For example, when a label is placed at the east or south side of a line, it is placed at the left or lower edge of the view when using a rectangular projection like Mercator.

It is applied for the labels of the current MGRS type/level/interval combination.

This is optional. Defaults to WestAndSouth.

Parameters
labelPositionthe label position.
Returns
this builder.

◆ labelStyle()

Builder & luciad::MgrsGridSetting::Builder::labelStyle ( TextStyle  labelStyle)

Indicates the label style to use for this setting.

This is optional. Defaults to a white text style with font size 14 and a black halo.

Parameters
labelStylethe label style.
Returns
this builder.

◆ level()

Builder & luciad::MgrsGridSetting::Builder::level ( MgrsLevel  level)

Indicates the MGRS level for which this setting applies.

This is mandatory.

Parameters
levelthe MGRS level.
Returns
this builder.

◆ lineLabelPosition()

Builder & luciad::MgrsGridSetting::Builder::lineLabelPosition ( GridLineLabelPosition  lineLabelPosition)

This specifies the label position (with respect to the line) to use for the line labels of the current MGRS type/level/interval combination.

They can for example be placed at the left or at the right of the line.

It is applied for the labels of the current MGRS type/level/interval combination.

This is optional. Defaults to AboveOrLeft.

Parameters
lineLabelPositionthe line label position.
Returns
this builder.

◆ lineStyle()

Builder & luciad::MgrsGridSetting::Builder::lineStyle ( LineStyle  lineStyle)

Indicates the line style to use for this setting.

This is optional. Defaults to a white line style with width 1.

Parameters
lineStylethe line style.
Returns
this builder.

◆ scaleRange()

Builder & luciad::MgrsGridSetting::Builder::scaleRange ( MapScale  minScale,
MapScale  maxScale 
)

Indicates the scale range for which this setting applies.

This is mandatory.

Parameters
minScalethe min scale (most zoomed out).
maxScalethe max scale (most zoomed in).
Returns
this builder.
Exceptions
luciad::InvalidArgumentExceptionwhen the min scale is larger than or equal to the max scale.

◆ type()

Builder & luciad::MgrsGridSetting::Builder::type ( MgrsType  type)

Indicates the MGRS type for which this setting applies.

This is optional. When not called this setting applies to both MGRS types.

Parameters
typethe MGRS type.
Returns
this builder.