You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 14 Next »




Contents


Intro

It is possible to view related documents or pictures through the document viewer. There are two options to configure this.

The first option is available since FEWS 2013.01. However since FEWS 2020.01 a new option is available. 

The option will be described below (XML configuration in the Explorer.xml). The second option will be described after this block.

XML configuration in Explorer.xml

To enable this feature the document viewer should be configured as an explorer task only.

<explorerTask name="Document viewer">
  <mnemonic>X</mnemonic>
  <taskClass>nl.wldelft.fews.gui.plugin.information.ForecasterAidDocumentPanel</taskClass>
  <toolbarTask>false</toolbarTask>
  <menubarTask>false</menubarTask>
  <toolWindow>true</toolWindow>
  <loadAtStartup>true</loadAtStartup>
</explorerTask>

Optionally you also may need to configure some credentials for links to websites or hosts that need a user/password.
You can have one general credential for all URLs:

<documentViewer>
  <hostCredentials>
    <user>user</user>
    <password>pw</password>
  </hostCredentials>
</documentViewer>

You can also have multiple credentials for different websites:

<documentViewer>
  <hostCredentials>
    <hostName>http://xxxx.com</hostName>
    <user>user</user>
    <password>pw</password>
  </hostCredentials>
  <hostCredentials>
    <hostName>http://yyyyy.com</hostName>
    <user>user</user>
    <password>pw</password>
  </hostCredentials>
</documentViewer>


Configuration in the TimeSeriesDisplay.xml

The downside of the approach described above is that the url references were stored in the comments of a time series. The downside of that was it was not possible anymore to use the comments fields.

In the new approach which is available since FEWS 2020.01 the url references are determines by url templates which are configured in the TimeSeriesDisplay.xml.

If for a certain timestep of a time series an image is available then this will indicated by the value of the flag source which should be set to to UR. This new flagsource value is now also supported in the pi-xml import.


A time series filter will determine for which time series the url reference template can be used. To determine the actual url reference for a the time step of time series the url template will be used.

The template can contain location attributes and a datetime-pattern. The url reference to be used will be determined by appylying the location attributes and the actual date and time to the datetime-pattern.


Below an example to explain this concept is in more detail. The code snippet contains the part of the TimSeriesDisplay.xml in which two external image sources are configured.

<documentViewer>
   <externalImagesSource>
      <user>myUser</user>
      <password>myPassword</password>
      <externalImages>
            <timeSeriesFilter>
					<parameterId>myParameter</parameterId>
					<qualifierId>myQualifier</qualifierId>
					<locationId>myLocation</locationId>
					<timeSeriesType>external historical</timeSeriesType>
					<timeStep unit="day"/>
					<ensembleId>myEnsembleId</ensembleId>
				</timeSeriesFilter>
         <urlTemplate>
            <baseUrl>http://myserver:8080/images</baseUrl>
            <fileUrl>'%myAttribute%'yyyy/MM/dd'/myimage.gif'</fileUrl>
         </urlTemplate>
      </externalImages>
   </externalImagesSource>
   <externalImagesSource>
      <user>myUser</user>
      <password>myPassword</password>
      <externalImages>
         <timeSeriesFilter>
            <locationId>H-2002</locationId>
         </timeSeriesFilter>
         <urlTemplate>
            <baseUrl>http://anotherserver:8080/images</baseUrl>
            <fileUrl>'%locationId%'yyyy/MM/dd'/myimage.gif'</fileUrl>
         </urlTemplate>
      </externalImages>
   </externalImagesSource>
</documentViewer>

In the example above we have 2 servers to hosts our images (myserver and anotherserver). When FEWS detects that for an certain time series an image is available (flag source is equal to "UR" then it will start searching for a matching template by using the time series filter).

In our example, if any time series is selected with location H-2001 the first external image source will be used. When multiple external image sources match then the first one found will be used. FEWS will also log a warning that multiple external image sources were found.  The actual url will be determined by combining the baseUrl with the fileUrl.  For the first external image source that would lead the following url http://myserver:8080/images/

'%myAttribute%'yyyy/MM/dd'/myimage.gif'. If the user selects time step 20-01-2020 18:00 then the url would be after applying this date http://myserver:8080/images/%myAttribute%2020/01/20/myimage.gif

The last step would be applying the actual values of the location attributes to the url templates.  In our example that would be lead to the following url, when the attribute myAttribute has the value measurement 

http://myserver:8080/images/measurement2020/01/20/myimage.gif

Also note the use of the quotes ' in the fileUrl. The parts of the fileUrl which are not a datetime pattern should be in between these quotes!

The actual url will be used to retrieved the external image from the external server and will be shown in the document viewer.




  • No labels