Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Map / Background layer / Fix active layer on load. #7126

Merged
merged 5 commits into from
Jun 13, 2023
Merged

Conversation

fxprunayre
Copy link
Member

@fxprunayre fxprunayre commented May 31, 2023

Test:

  • Open the map
  • Reload page
  • Active background is not enabled.

Pasted image 1

This was related to the fact that the search map is also affecting bgLayers.

Only the main map viewer is defining the bgLayers which is used for the base switcher directive. In case of the context has no active background, use the first one (and log a warning). Reset default map :

  • may fail if no context defined. Add a fallback to the default one (and log a warning).
  • tried to use the map layer config if no context defined as it was ignored (but not working - require more work or removal of those unused ? settings)

Add configuration to define default active tool and active tool after map load

image

Fix various rare error:

  • JSON extension in layer may contains XML formatting space which can trigger error
  • Clear map queue when loading a new context (if loading multiple contexts quickly can cause loading indicator issue)

@fxprunayre fxprunayre added this to the 4.2.5 milestone May 31, 2023
@fxprunayre fxprunayre requested a review from josegar74 May 31, 2023 14:46
Test:
* Open the map
* Reload page
* Active background is not enabled.

This was related to the fact that the search map is also affecting bgLayers.

Only the main map viewer is defining the bgLayers which is used for the base switcher directive.
In case of the context has no active background, use the first one (and log a warning).
Reset default map :
* may fail if no context defined. Add a fallback to the default one (and log a warning).
* tried to use the map layer config if no context defined as it was ignored (but not working - require more work or removal of those unused ? settings)
queue on context load.

Context layer can contain a JSON extension which could be formatted and
XML formatting may add extra space which needs to be clean up for proper
JSON string:

```xml
       <ows-context:Layer name="surval_parametre_point" group="/Human Activities" hidden="false" opacity="1"
                           showLayerInfo="true">
            <ows:Title>Surval données par paramètre (point)</ows:Title>
            <ows-context:Server service="urn:ogc:serviceType:WMS" version="1.3.0">
                <ows-context:OnlineResource xlink:href="https://sextant.ifremer.fr/services/wms/environnement_marin"/>
            </ows-context:Server>
            <ows-context:Extension>{"uuid":"cf5048f6-5bbf-4e44-ba74-e6f429af51ea","label":"Surval données par paramètre
                (point)","filters":{"qParams":{"ft_LIEU_LIBELLE_s":{"type":"terms","values":{"001-P-003 - Zuydcoote
                filière":true}}}},"wfsUrl":"https://sextant.ifremer.fr/services/wfs/environnement_marin"}
            </ows-context:Extension>
        </ows-context:Layer>
```

Clear map queue on load - may have side effect when loading differents
maps quickly.

Avoid JS error if server layer is not defined (which should not be the
case unless custom context with new layer types was created).
Copy link
Member

@josegar74 josegar74 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I go directly to http://localhost:8080/geonetwork/srv/eng/catalog.search#/map or refresh the window, the layer is selected, but the layer panel is displayed open:

map-layer-list

@fxprunayre
Copy link
Member Author

When I go directly to http://localhost:8080/geonetwork/srv/eng/catalog.search#/map or refresh the window, the layer is selected, but the layer panel is displayed open:

When you open a map from whatever location (can be from metadata record, from URL, from map library panel, from the home page), It makes sense to open the list of layers no ? It is done with https://github.com/geonetwork/core-geonetwork/pull/7126/files#diff-9bd74fbb2a2845e3f336ce49bf2295841e725862c1813532d41c32be94b9bf3dR383

@fxprunayre
Copy link
Member Author

fxprunayre commented Jun 12, 2023

When I go directly to http://localhost:8080/geonetwork/srv/eng/catalog.search#/map or refresh the window, the layer is selected, but the layer panel is displayed open:

When you open a map from whatever location (can be from metadata record, from URL, from map library panel, from the home page), It makes sense to open the list of layers no ? It is done with https://github.com/geonetwork/core-geonetwork/pull/7126/files#diff-9bd74fbb2a2845e3f336ce49bf2295841e725862c1813532d41c32be94b9bf3dR383

Added options to configure default tools.

@fxprunayre fxprunayre closed this Jun 12, 2023
@fxprunayre fxprunayre reopened this Jun 12, 2023
fxprunayre added a commit that referenced this pull request Jun 13, 2023
fxprunayre added a commit that referenced this pull request Jun 13, 2023
* Map / Layer manager / Add support for multilingual layer title.

Metadata may be multilingual and provide multilingual layer name in the
online source description field. GetCapabilities document do not provide
multilingual support, so this adds the possibility to translate layer
name in maps.

A multilingual description in a link:

```xml
<gmd:onLine>
  <gmd:CI_OnlineResource>
    <gmd:linkage>
      <gmd:URL>https://data.apps.fao.org/map/gsrv/gsrv1/geonetwork/ows?SERVICE=WMS&amp;</gmd:URL>
    </gmd:linkage>
    <gmd:protocol>
      <gmx:MimeFileType type="">OGC:WMS</gmx:MimeFileType>
    </gmd:protocol>
    <gmd:name xsi:type="gmd:PT_FreeText_PropertyType">
      <gco:CharacterString>geonetwork:basins_296</gco:CharacterString>
      <gmd:PT_FreeText>
        <gmd:textGroup>
          <gmd:LocalisedCharacterString locale="#EN">geonetwork:basins_296</gmd:LocalisedCharacterString>
        </gmd:textGroup>
        <gmd:textGroup>
          <gmd:LocalisedCharacterString locale="#FR" />
        </gmd:textGroup>
      </gmd:PT_FreeText>
    </gmd:name>
    <gmd:description xsi:type="gmd:PT_FreeText_PropertyType">
      <gco:CharacterString>Hydrological basins in Africa</gco:CharacterString>
      <gmd:PT_FreeText>
        <gmd:textGroup>
          <gmd:LocalisedCharacterString locale="#EN">Hydrological basins in Africa</gmd:LocalisedCharacterString>
        </gmd:textGroup>
        <gmd:textGroup>
          <gmd:LocalisedCharacterString locale="#FR">Bassins versants en Afrique</gmd:LocalisedCharacterString>
        </gmd:textGroup>
      </gmd:PT_FreeText>
    </gmd:description>
  </gmd:CI_OnlineResource>
</gmd:onLine>
```

The description is retrieved from the metadata on load from the metadata
UUID which is attached to the layer (and saved in the OWS context
extension of the layer) using the service URL and the layer name.

This also allows to override layer name when a group of layer (eg.
`a,b,c`) is used in the online source name.

* Map / When loading a map, switch to layer tool panel.

* Map / Layer manager / Add support for multilingual layer title / Layer search.

* Map / Layer manager / Add support for multilingual layer title / Layer filter.

* Remove openTool after map load.

Configuration done in #7126
var res = { href: "" };
if (layer.server) {
var server = layer.server[0];
res = server.onlineResource[0];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess server.onlineResource[0] contains an object like { href: "XXXXX" }?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Usually yes, but it is a corner case in Sextant where the map context can define custom layer types without server.

@sonarcloud
Copy link

sonarcloud bot commented Jun 13, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@fxprunayre fxprunayre merged commit f37bac7 into main Jun 13, 2023
@fxprunayre fxprunayre deleted the 425-resetmapfix branch June 13, 2023 09:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants