Attributes ========== .. index:: sdcat ; SDCat.App attribute .. js:attribute:: SDCat.App.sdcat :noindex: (*SDCat*) - This is the SDCat object which will be used to query the API. It will be created automatically using the parameters specified in the SDCat.App constructor. .. index:: now .. js:attribute:: SDCat.App.now :noindex: (*Date*) - A Javascript Date object containing the current time and date when the object was created. .. index:: preSelectedDateRanges .. _preSelectedDateRanges: .. js:attribute:: SDCat.App.preselectedDateRanges :noindex: (*Object*) - Object containing the preselected date ranges for use in the Date Range dropdown box. A number of preselected date ranges have already been specified: - Current Day - Current Month - Current Year - Last 7 Days - Previous Day - Previous Month - Previous Year To add additional date ranges, add another object to this object where the attribute name is the name of the text that will appear in the dropdown box. The new object must have the following attributes: .. attribute:: start :noindex: (*Date*) - Start date of the date range in UTC. .. attribute:: end :noindex: (*Date*) - End date of the date range in UTC. Example:: app.preSelectedDateRanges["Last Month"] = { start: new Date(Date.UTC(app.now.getUTCFullYear(), app.now.getUTCMonth() - 1, 1, 0, 0, 0)), end: new Date(Date.UTC(app.now.getUTCFullYear(), app.now.getUTCMonth(), 0, 23, 59, 59)) }; This will add a new date range called "Last Month" to the list of date ranges. .. index:: items .. _items: .. js:attribute:: SDCat.App.items :noindex: (*Object*) - This stores all of the various data components required for the app. The content of the various controls on the app are populated from this object. Each "component" is an object with the following attributes: .. attribute:: sort :noindex: (*Boolean*) - Determines whether or not to sort these items into alphabetical order when displayed on the page. .. attribute:: clearable :noindex: (*Boolean*) - Determines whether or not to clear the selected items when the "Clear Selection" button is pressed. .. attribute:: list :noindex: (*Object*) - List of items that will populate the appropriate control. Each attribute of this object will be another object containing component specific information. The name of the attribute is the text that will appear in the control on the app. See below for the component specific information. .. attribute:: filterFunction :noindex: (*Function*) - User specified function to return a filtered list of the items. This should return an array of required item names. .. attribute:: changeButtonState :noindex: (*Boolean*) - Determines whether selected elements of this item can change the state of the **Generate Plot** button. If it is not defined, it is assumed to be ``false``. .. attribute:: coverageAttributes :noindex: (*Object*) - Contains the information required to match up the items in the components ``list`` with the coverage objects that will be returned. In this object ``source`` is the attribute in the ``list`` object and ``coverage`` is the attribute in the coverage object. .. attribute:: help :noindex: (*Array*) - Array of bullet points to show in the help tooltip when the cursor hovers over the control's help button. .. attribute:: filtersRadars :noindex: (*Boolean*) - Determines whether these items can filter the radars. You should not need to change the value of this attribute. .. _items.default: .. attribute:: default :noindex: (*String* or *Array*) - List of items that are to be automatically preselected when the sidemenu is created. If this attribute is a *String*, it will be converted to an *Array*. For all items, by default this attribute is undefined. The next sections contained detailed information about the components which can be found in the ``items`` object: .. index:: radars .. js:attribute:: SDCat.App.items.radars :noindex: Contains information about the radars. The ``list`` object contains objects with the following attributes: .. attribute:: selected :noindex: (*Boolean*) - Determines if this radar has been selected by the user. (Default: ``false``) .. attribute:: latitude :noindex: (*Number*) - The latitude of this radar in WGS84. .. attribute:: longitude :noindex: (*Number*) - The longitude of this radar in WGS84. .. attribute:: name :noindex: (*String*) - The name of the radar. .. attribute:: institute :noindex: (*String*) - The name of the institute that maintains the radar. .. attribute:: country :noindex: (*String*) - The name of the country the radar is located in. .. attribute:: code :noindex: (*String*) - The radar's three letter identification code. .. attribute:: show :noindex: (*Boolean*) - Determines whether or not to show the radar on the app. Radars can be referenced from the ``list`` attribute by using their three-letter ID code. At initialisation, ``show``, ``clearable`` and ``changeButtonState`` are set to ``true`` and the default ``filterFunction`` returns all the radars found in the API. ``coverageAttributes`` uses ``code`` as the ``source`` attribute and ``radar_code`` as the ``coverage`` attribute. An example of manipulating this object is as follows:: // Set the name of the hal radar to Halley VI app.items.radars.list.hal.name = "Halley VI"; // Preselect this radar app.items.radars.list.hal.selected = true; This renames the ``hal`` radar and then programatically selects it. .. index:: fileTypes .. js:attribute:: SDCat.App.items.fileTypes :noindex: Contains information about the file types. The ``list`` object contains objects with the following attributes: .. attribute:: selected :noindex: (*Boolean*) - Determines if this file type has been selected by the user. (Default: ``false``) .. attribute:: name :noindex: (*String*) - The name of this file type. .. attribute:: show :noindex: (*Boolean*) - Determines whether or not to show the file type on the app. File types can be referenced from the ``list`` attribute by using their name. At initialisation, ``show``, ``clearable`` and ``changeButtonState`` are set to ``true`` and the default ``filterFunction`` returns all the file types found in the API. ``coverageAttributes`` uses ``name`` as the ``source`` attribute and ``file_type`` as the ``coverage`` attribute. An example of manipulating this object is as follows:: // Create an array of the different file types and sort them var fileTypes = Object.keys(app.items.fileTypes.list).sort() This sets a variable containing an array of the different fileTypes, sorted into alphabetical order. .. index:: dateTypes .. js:attribute:: SDCat.App.items.dateTypes :noindex: Contains information about the different date types. The different date types currently available are dates based on the file name (**File**) or dates based on the data within the file (**Data**). As a result, this object has been hardcoded, though you can override the information if you require. The definition of this object is as follows:: dateTypes: { sort: false, clearable: false, list: { file: { selected: true, value: "File", show: true }, data: { selected: false, value: "Data", show: true } }, changeButtonState: true, coverageAttributes: { source: "value", coverage: "coverage_type" }, help: [ "Select the date type you are interested in", "File dates are dates inferred from the file names", "Data dates are dates calculated from the data within a file", "Only one date type can be selected" ] .. index:: institutes .. js:attribute:: SDCat.App.items.institutes :noindex: Contains information about the institutes. The ``list`` object contains objects with the following attributes: .. attribute:: selected :noindex: (*Boolean*) - Determines if this institute has been selected by the user. (Default: ``false``) Institutes can be referenced from the ``list`` attribute by using their name. At initialisation, ``show`` and ``filtersRadars`` are set to ``true`` and ``clearable`` is set to ``false``. .. index:: countries .. js:attribute:: SDCat.App.items.countries :noindex: Contains information about the countries. The ``list`` object contains objects with the following attributes: .. attribute:: selected :noindex: (*Boolean*) - Determines if this country has been selected by the user. (Default: ``false``) Countries can be referenced from the ``list`` attribute by using their name. At initialisation, ``show`` and ``filtersRadars`` are set to ``true`` and ``clearable`` is set to ``false``. .. note:: The ``countries`` list only contains the countries that contain radars. The countries of institutes are not included .. index:: dateRanges (SDCat.App.items attribute) .. js:attribute:: SDCat.App.items.dateRanges :noindex: Contains information about the date ranges. The ``list`` object contains the :ref:`preSelectedDateRanges ` and can be referenced by using their name. At initialisation, ``show`` and ``clearable`` are set to ``false``. .. index:: radarNameOptions .. js:attribute:: SDCat.App.items.radarNameOptions :noindex: Contains information about the radar name options. The information in this item is used to create a control which will allow the user to display the radars by either their identification code or their name. As a result, this object has been hardcoded, though you can override the information if you require. The definition of this object is as follows:: radarNameOptions: { sort: false, clearable: false, list: { code: { selected: true, value: "Radar Code", show: true }, name: { selected: false, value: "Radar Name", show: true } }, help: [ "Use these options to switch between displaying radars as their 3 letter code or by their actual name" ] }; .. index:: sidemenuButtons .. _sidemenuButtons: .. js:attribute:: SDCat.App.sidemenuButtons :noindex: (*Array*) - This consists of a list of single action buttons that will appear in the sidemenu. Each element of this array is in another array and it is that inner array that contains the button information. The outer arrays are there to allow the buttons to be grouped together with gaps placed between the groups. The buttons that are created via this array are the **Select All**, **Clear Selection**, **Show/Hide Help**, **Reset View** and **Generate Plot** buttons. By default, **Select All**, **Clear Selection**, **Show/Hide Help** and **Reset View** are in one group and **Generate Plot** is in another group, though you can rearrange this or add new buttons if required. The button objects contain the following attributes: .. attribute:: id :noindex: (*String*) - The ID for the HTML element of this button. .. attribute:: title :noindex: (*String*) - The text that will appear on this button. .. attribute:: action :noindex: (*String*) - Name of the SDCat.App function that will be run when this button is clicked. .. attribute:: show :noindex: (*Boolean*) - Determines whether or not to display this button on the page. The default value for this is the value of the appropriate option in the SDCat.App constructor. .. attribute:: enable :noindex: (*Boolean*) - Determines whether or not to enable this button. .. attribute:: help :noindex: (*String*) - Text that appears when help is to be displayed and the cursor hovers over the button. .. index:: dateRanges (SDCat.App attribute) .. js:attribute:: SDCat.App.dateRanges :noindex: (*Object*) - Contains information about the date ranges of different parts of the app: .. attribute:: plot :noindex: (*Object*) - Contains the date range that the plot will cover: .. attribute:: start :noindex: (*Date*) - Start date of the plot. (Default: 00:00:00 on January 01 of the current year) .. attribute:: end :noindex: (*Date*) - End date of the plot. (Default: 23:59:59 on December 31 of the current year) .. attribute:: coverage :noindex: (*Object*) - Contains the date range over which coverage is available .. attribute:: start :noindex: (*Date*) - Earliest date of available coverage. (Default: null) .. attribute:: end :noindex: (*Date*) - Latest date of available coverage. This usually gets set to 23:59:59 on December 31 of the last year of the coverage. (Default: null) .. attribute:: help :noindex: (*Array*) - Array of bullet points to show in the help tooltip when the cursor hovers over the control's help button. .. index:: containerDiv .. js:attribute:: SDCat.App.containerDiv :noindex: (*JQuery DIV element*) - This is the div that the app will be inserted into. The ID of this div is specified in ``SDCat.options.containerDivId``. .. index:: helpBox .. js:attribute:: SDCat.App.helpBox :noindex: (*Object*) - Contains information about the tooltip that appears when the cursor hovers over the help button. Contains the following attributes: .. attribute:: div :noindex: (*JQuery DIV element*) - The div of the help box itself. The ID of this element is ``helpbox``. .. attribute:: show :noindex: (*Boolean*) - Determines whether or not to show the help box on the app. (Default: ``true``) .. index:: sidemenu .. js:attribute:: SDCat.App.sidemenu :noindex: (*Object*) - Contains information about the app's sidemenu. Contains the following attributes: .. attribute:: div :noindex: (*JQuery DIV element*) - The div of the sidemenu itself. The ID of this element is ``sidemenu``. .. attribute:: buttons :noindex: (*Object*) - Collection of buttons to add to the sidemenu. These are added programatically. (Default: ``{}``) .. index:: mainBody .. js:attribute:: SDCat.App.mainBody :noindex: (*Object*) - Contains information about the main body of the app (i.e. where the plot appears). Contains the following attributes: .. attribute:: div :noindex: (*JQuery DIV element*) - The div of the main body itself. The ID of this element is ``main``.