.. _integrator_ngeo: ngeo ==== Organisation ------------ The main page where we can redefine the header is in the file: ``/templates/.html``. Where ```` is the interface name or "index" for the default interface. The viewer (map and all related tools) is define in the file: ``/static-ngeo/js/.js``. Where ```` is the interface name or "main" for the default interface. And finally the image should be placed in the folder is ``/static-ngeo/images/``. The style sheet file for all the project is ``/static-ngeo/less/.less``. The style sheet file for one interface is ``/static-ngeo/less/.less``. HTML file --------- In this file you can add some blocks like: .. code:: html Witch is used to include a directive. You can find the available directive in the `ngeo documentation `_ in the sections ``gmf/Directives`` and ``ngeo/Directives``. All the directives should provide an example. The controller (js file) is commonly named ``mainCtrl``. So you can use a value from the controller by doing this (here, the controller is the DesktopController): .. code:: html ... ... ... The js constants of the application are defined at the end of the file: .. code:: html Controller (js file) -------------------- In the controler you have some lines like: .. code:: javascript /** @suppress {extraRequire} */ goog.require('gmf.authenticationDirective'); This is needed to include the javascript of the used directives. The map configuration will be here: .. code:: javascript goog.base( this, { srid: 21781, mapViewConfig: { center: [632464, 185457], zoom: 3, resolutions: [250, 100, 50, 20, 10, 5, 2, 1, 0.5, 0.25, 0.1, 0.05] } }, $scope, $injector); .. note:: The resolutions should be the same as in the previus CGXP application to have backward compatible permalinks. Background layers ----------------- The background layers are configured in the database, with the layer group named **background** (by default). WMTS Layers ----------- To make the WMTS queryable you should add those ``Metadata``: * ``ogcServer`` with the name of the used ``OGC server``, * ``wmsLayers`` or ``queryLayers`` with the layers to query (groups not supported). To print the layers in the high quality you you should add those ``Metadata``: * ``ogcServer`` with the name of the used ``OGC server``, * ``wmsLayers`` or ``printLayers`` with the layers to print. .. note:: See also: :ref:`administrator_administrate_metadata`, :ref:`administrator_administrate_ogc_server`. .. _integrator_ngeo_add: Add a new interface ------------------- Be sure you have all the required files: .. prompt:: bash mkdir demo/static-ngeo cp -r CONST_create_template/demo/static-ngeo/components demo/static-ngeo/ cp -r CONST_create_template/demo/static-ngeo/images demo/static-ngeo/ mkdir demo/static-ngeo/js cp CONST_create_template/demo/static-ngeo/js/module.js demo/static-ngeo/js/ mkdir demo/static-ngeo/less cp CONST_create_template/demo/static-ngeo/less/.less demo/static-ngeo/less/ # Add all the new files to Git git add demo/static-ngeo Get the default interface files, for the mobile: .. prompt:: bash cp CONST_create_template//templates/mobile.html /templates/.html cp CONST_create_template//static-ngeo/less/mobile.less /templates/.less cp CONST_create_template//static-ngeo/js/mobile.js /static-ngeo/js/.js Get the default interface files, for the desktop: .. prompt:: bash cp CONST_create_template//templates/desktop.html /templates/.html cp CONST_create_template//static-ngeo/less/desktop.less /templates/.less cp CONST_create_template//static-ngeo/js/desktop.js /static-ngeo/js/.js Add them to Git: .. prompt:: bash git add /templates/.html git add /templates/.less git add /static-ngeo/js/.js Update the interface in your ``/__init__.py`` file: .. code:: python add_interface(config, "", INTERFACE_TYPE_NGEO) The used method has the following API: .. code:: python add_interface(config, interface_name="desktop", interface_type=INTERFACE_TYPE_CGXP, **kwargs) Where ``config`` is the application configuration object, ``interface_name`` is the name specified in the ``interface`` table, also used to create the route path, ``interface_type`` may be either ``INTERFACE_TYPE_CGXP``, ``INTERFACE_TYPE_NGEO`` or ``INTERFACE_TYPE_NGEO_CATALOGUE``. Constants available in ``c2cgeoportal``. Database -------- The administration interface gives access to an ``interface`` table that lists the available interfaces (or pages) of the application. The default interfaces are ``desktop`` add ``mobile``. Checker ------- Enable the checker for the new interface. We suggest to add only the main checker in the ``defaults`` it is what is done by default. And in the ``all`` (``vars.checker.all``) check all the ngeo interface in standard and debug mode: .. code:: yaml phantomjs_routes: - name: param: no_redirect: true - name: param: no_redirect: true debug: true By default it is done for the desktop and mobile interface. Externs ------- Adding additional external dependencies requires `declaring them as externs `_. This prevents the closure-compiler from renaming the objects and their properties and allows type-checking. Good examples for such externs can be found in `ngeo `_ or directly in the `closure-compiler `_ project. Project-specific externs are best placed in ``/static-ngeo/externs/``. These externs need to be referenced in the ``MAKO_BUILD_ARGS`` variable in your ``.mk``, example:: MAKO_BUILD_ARGS = --var externs=package/static-ngeo/externs/recaptcha.js,package/static-ngeo/externs/anotherdep.js