Class: EMLGeoCoverage

EMLGeoCoverage()

A description of geographic coverage of a dataset, per the EML 2.1.1 metadata standard

Constructor

new EMLGeoCoverage()

Source:

Extends

  • Backbone.Model

Methods

addSpace(msg, front) → {string}

Sometimes we'll need to add a space between error messages, but only if an error has already been triggered. Use addSpace to accomplish this.
Parameters:
Name Type Description
msg string The string that will be appended
front bool A flag that when set will append the whitespace to the front of 'msg'
Source:
Returns:
The string that was passed in, 'msg', with whitespace appended
Type
string

checkForPairs(status) → {bool}

Checks that there are either two or four coordinate values. If there aren't, it means that the user still needs to enter coordinates.
Parameters:
Name Type Description
status The current state of the coordinates
Source:
Returns:
True if there are pairs, false otherwise
Type
bool

generateStatusErrors(status) → {string}

Checks the status object for conditions that warrant an error message to the user. This is called during the validation processes (validate() and updateModel()) after the status object has been created by getCoordinateStatus().
Parameters:
Name Type Description
status The status object, holding the state of the coordinates
Source:
Returns:
Any errors that need to be displayed to the user
Type
string

getCoordinateStatus() → {array}

Generates an object that describes the current state of each latitude and longitude box. The status includes whether there is a value and if the value is valid.
Source:
Returns:
An array containing the current state of each coordinate box
Type
array

getErrorMessage(area) → {string}

Because the same error messages are used in a couple of different places, we centralize the strings and access here.
Parameters:
Name Type Description
area string Specifies the area that the error message belongs to. Browse through the switch statement to find the one you need.
Source:
Returns:
The error message
Type
string

hasMissingPoint(status) → {bool}

Checks for any coordinates with missing counterparts.
Parameters:
Name Type Description
status The status of the coordinates
Source:
Returns:
True if there are missing coordinates, false otherwise
Type
bool

parse()

Based on this example serialization Rhine-Main-Observatory 9.0005 9.0005 50.1600 50.1600
Source:

validate() → {string}

This grabs the various location elements and validates the user input. In the case of an error, we append an error string (errMsg) so that we display all of the messages at the same time. This validates the entire location row by adding extra checks for a description and for coordinate pairs
Source:
Returns:
The error messages that the user will see
Type
string

validateCoordinate(value, min, max) → {bool}

Validate a coordinate String by making sure it can be coerced into a number and is within the given bounds. Note: Min and max are inclusive
Parameters:
Name Type Description
value string The value of the edit area that will be validated
min The minimum value that 'value' can be
max The maximum value that 'value' can be
Source:
Returns:
True if the validation passed, otherwise false
Type
bool