[mapserver-commits] r11924 - in sandbox/inspire_soc2011: mapserver msautotest/wxs

svn at osgeo.org svn at osgeo.org
Wed Jul 13 08:46:44 EDT 2011


Author: stefanl
Date: 2011-07-13 05:46:44 -0700 (Wed, 13 Jul 2011)
New Revision: 11924

Removed:
   sandbox/inspire_soc2011/mapserver/README-inspire.txt
Modified:
   sandbox/inspire_soc2011/mapserver/mapwms.c
   sandbox/inspire_soc2011/msautotest/wxs/wms_inspire_scenario1.map
   sandbox/inspire_soc2011/msautotest/wxs/wms_inspire_scenario2.map
Log:
inspire view service metadata support (scenario1+2)

Deleted: sandbox/inspire_soc2011/mapserver/README-inspire.txt
===================================================================
--- sandbox/inspire_soc2011/mapserver/README-inspire.txt	2011-07-13 12:30:04 UTC (rev 11923)
+++ sandbox/inspire_soc2011/mapserver/README-inspire.txt	2011-07-13 12:46:44 UTC (rev 11924)
@@ -1,49 +0,0 @@
-INSPIRE View Service - Settings
-
-
-wms_inspire_capabilities {"url"|"embed"|""}
-    generally enable extened capabilities for the inspire view service 
-    and distinguish between use-case 1 and 2 in order to give appropriate 
-    warnings in the GetCapabilities output
-
-wms_metadataurl_href
-    existing metadata_href mapped into the inspire extension
-
-wms_metadataurl_format "application/vnd.iso.19139+xml" # fixed string ???
-    existing metadata_href mapped into the inspire extension
-
-wms_inspire_languages "eng,ger,dut,..."
-    first token is the default language; required to print the language 
-    block in the GetCapbilities output and to identify language specific
-    titles and abstracts
-
-wms_inspire_languagesubstitution ""
-    alter online_resource in the GetCapabilities output, in order that 
-    %language% may be used as variable substitution
-
-default_language "eng"
-    see run-time variable substitution; this default value must match 
-    the default language in wms_inspire_languages
-    
-language_validation_pattern "^(eng|ger)$"
-    see run-time variable substitution; the pattern must be valid for 
-    all values listed in wms_inspire_languages
-
-wms_title_eng "Example for language specific title"
-wms_title_ger "Beispiel für sprachspezifischen Titel"
-
-wms_abstract_eng "Example for language specific abstract"
-wms_abstract_ger "Beispiel für sprachspezifische Zusammenfassung"
-
-wms_rootlayer_title_eng "Example for language specific root layer title"
-wms_rootlayer_title_ger "Beispiel für sprachspezifischen Titel"
-
-wms_rootlayer_abstract_eng "Example for language specific root layer abstract"
-wms_rootlayer_abstract_ger "Beispiel für sprachspezifische Zusammenfassung"
-
-
-Examples for language specific layer properties using run-time subtsition
-     DATA "shapes/rivers_%language%.shp"
-     CONNECTION "user=... password=... dbname=rivers_%language%"
-     FILTER ("lang='%language%')
-     CLASSITEM "lang" => EXPRESSION "%language%"

Modified: sandbox/inspire_soc2011/mapserver/mapwms.c
===================================================================
--- sandbox/inspire_soc2011/mapserver/mapwms.c	2011-07-13 12:30:04 UTC (rev 11923)
+++ sandbox/inspire_soc2011/mapserver/mapwms.c	2011-07-13 12:46:44 UTC (rev 11924)
@@ -1726,28 +1726,35 @@
    /* wms_legendurl_... metadatas it's in the styles metadata, */
    /* In wms_style_<style_name>_lengendurl_... metadata. So we have to detect */
    /* the current style before reading it. Also in the Style block, we need */
-   /* a Title and a name. We can get those in wms_style. */
+   /* a Title and a name. Title is derived from wms_style_<style>_title, */
+   /* which allows mutiple style definitions, e.g. by using classgroups. */
+   bufferSize = 512; /* We don't know about possible style name lengths, yet */
+   pszMetadataName = (char*)msSmallMalloc(bufferSize);
    pszStyle = msOWSLookupMetadata(&(lp->metadata), "MO", "style");
    if (pszStyle)
    {
-       bufferSize = strlen(pszStyle)+205;
-       pszMetadataName = (char*)msSmallMalloc(bufferSize);
        snprintf(pszMetadataName, bufferSize, "style_%s_legendurl_href", pszStyle);
        pszLegendURL = msOWSLookupMetadata(&(lp->metadata), "MO", pszMetadataName);
    }
    else
      pszStyle = "default";
 
-       
+
    if(nVersion <= OWS_1_0_0 && pszLegendURL)
    {
        /* First, print the style block */
        msIO_fprintf(stdout, "        <Style>\n");
        msIO_fprintf(stdout, "          <Name>%s</Name>\n", pszStyle);
-       msIO_fprintf(stdout, "          <Title>%s</Title>\n", pszStyle);
+       /* Print the real Title or Style name otherwise */
+       snprintf(pszMetadataName, bufferSize, "style_%s_title", pszStyle);
+       msOWSPrintEncodeMetadata(stdout, &(lp->metadata), "MO",
+                                pszMetadataName,
+                                OWS_NOERR,
+                                "          <Title>%s</Title>\n",
+                                pszStyle);
 
-          
        /* Inside, print the legend url block */
+       snprintf(pszMetadataName, bufferSize, "style_%s_legendurl_href", pszStyle);
        msOWSPrintEncodeMetadata(stdout, &(lp->metadata), "MO", 
                                 pszMetadataName,
                                 OWS_NOERR, 
@@ -1765,7 +1772,13 @@
            /* First, print the style block */
            msIO_fprintf(stdout, "        <Style>\n");
            msIO_fprintf(stdout, "          <Name>%s</Name>\n", pszStyle);
-           msIO_fprintf(stdout, "          <Title>%s</Title>\n", pszStyle);
+           /* Print the real Title or Style name otherwise */
+           snprintf(pszMetadataName, bufferSize, "style_%s_title", pszStyle);
+           msOWSPrintEncodeMetadata(stdout, &(lp->metadata), "MO",
+                                    pszMetadataName,
+                                    OWS_NOERR,
+                                    "          <Title>%s</Title>\n",
+                                    pszStyle);
 
            
            /* Inside, print the legend url block */
@@ -1886,22 +1899,47 @@
 
                                msIO_fprintf(stdout, "        <Style>\n");
                                msIO_fprintf(stdout, "          <Name>%s</Name>\n",  classgroups[i]);
-                               msIO_fprintf(stdout, "          <Title>%s</Title>\n", classgroups[i]);
+                               snprintf(pszMetadataName, bufferSize, "style_%s_title", classgroups[i]);
+                               msOWSPrintEncodeMetadata(stdout, &(lp->metadata), "MO",
+                                                        pszMetadataName,
+                                                        OWS_NOERR,
+                                                        "          <Title>%s</Title>\n",
+                                                        classgroups[i]);
                       
-                               msOWSPrintURLType(stdout, NULL, 
-                                                 "O", "ttt",
-                                                 OWS_NOERR, NULL, 
-                                                 "LegendURL", NULL, 
-                                                 " width=\"%s\"", " height=\"%s\"", 
-                                                 ">\n             <Format>%s</Format", 
-                                                 "\n             <OnlineResource "
-                                                 "xmlns:xlink=\"http://www.w3.org/1999/xlink\""
-                                                 " xlink:type=\"simple\" xlink:href=\"%s\"/>\n"
-                                                 "          ",
-                                                 MS_FALSE, MS_FALSE, MS_FALSE, MS_FALSE, MS_FALSE, 
-                                                 NULL, width, height, mimetype, legendurl, "          ");
-                       
-
+                               /* A legendurl from wms_style_<style>_legendurl_href will override a self generated legend graphic */
+                               snprintf(pszMetadataName, bufferSize, "style_%s_legendurl_href", classgroups[i]);
+                               pszLegendURL = msOWSLookupMetadata(&(lp->metadata), "MO", pszMetadataName);
+                               if (pszLegendURL)
+                               {
+                                   snprintf(pszMetadataName, bufferSize, "style_%s_legendurl", classgroups[i]);
+                                   msOWSPrintURLType(stdout, &(lp->metadata),
+                                                     "MO", pszMetadataName,
+                                                     OWS_NOERR, NULL,
+                                                     "LegendURL", NULL,
+                                                     " width=\"%s\"", " height=\"%s\"",
+                                                     ">\n             <Format>%s</Format",
+                                                     "\n             <OnlineResource "
+                                                     "xmlns:xlink=\"http://www.w3.org/1999/xlink\""
+                                                     " xlink:type=\"simple\" xlink:href=\"%s\"/>\n"
+                                                     "          ",
+                                                     MS_FALSE, MS_TRUE, MS_TRUE, MS_TRUE, MS_TRUE,
+                                                     NULL, NULL, NULL, NULL, NULL, "          ");
+                               }
+                               else
+                               {
+                                   msOWSPrintURLType(stdout, NULL,
+                                                     "O", "ttt",
+                                                     OWS_NOERR, NULL,
+                                                     "LegendURL", NULL,
+                                                     " width=\"%s\"", " height=\"%s\"",
+                                                     ">\n             <Format>%s</Format",
+                                                     "\n             <OnlineResource "
+                                                     "xmlns:xlink=\"http://www.w3.org/1999/xlink\""
+                                                     " xlink:type=\"simple\" xlink:href=\"%s\"/>\n"
+                                                     "          ",
+                                                     MS_FALSE, MS_FALSE, MS_FALSE, MS_FALSE, MS_FALSE,
+                                                     NULL, width, height, mimetype, legendurl, "          ");
+                               }
                                msIO_fprintf(stdout, "        </Style>\n");
                            }
                            msFree(legendurl);
@@ -2252,7 +2290,7 @@
   }
   else if (nVersion >= OWS_1_3_0 && msOWSLookupMetadata(&(map->web.metadata), "MO", "inspire_capabilities") )
   {
-        msOWSPrintEncodeMetadata(stdout, &(map->web.metadata), "MO", "inspire_keyword", OWS_WARN, "  <KeywordList>\n    <Keyword vocabulary='ISO'>%s</Keyword>\n  </KeywordList>\n", "");
+        msOWSPrintEncodeMetadata(stdout, &(map->web.metadata), "MO", "inspire_keyword", OWS_WARN, "  <KeywordList>\n    <Keyword vocabulary=\"ISO\">%s</Keyword>\n  </KeywordList>\n", "");
 
         if (msOWSLookupMetadata(&(map->web.metadata), "MO", "keywordlist") != NULL)
             msIO_fprintf(stdout, "<!-- WARNING: ignoring service keywords provided in keywordlist -->");
@@ -2624,12 +2662,19 @@
   if (nVersion >= OWS_1_3_0 && msOWSLookupMetadata(&(map->web.metadata), "MO", "inspire_capabilities") )
   {
       msIO_fprintf(stdout, "    <Style>\n");
-      msIO_fprintf(stdout, "       <Name>inspire_common:DEFAULT</Name>\n");
-      msIO_fprintf(stdout, "       <Title>inspire_common:DEFAULT</Title>\n");
+      msOWSPrintEncodeMetadata(stdout, &(map->web.metadata), "MO",
+                               "inspire_style_name",
+                               OWS_NOERR,
+                               "       <Name>%s</Name>\n",
+                               "inspire_common:DEFAULT");
+      msOWSPrintEncodeMetadata(stdout, &(map->web.metadata), "MO",
+                               "inspire_style_title",
+                               OWS_NOERR,
+                               "       <Title>%s</Title>\n",
+                               "inspire_common:DEFAULT");
       msIO_fprintf(stdout, "    </Style>\n");
   }
 
-
   /*  */
   /* Dump list of layers organized by groups.  Layers with no group are listed */
   /* individually, at the same level as the groups in the layer hierarchy */

Modified: sandbox/inspire_soc2011/msautotest/wxs/wms_inspire_scenario1.map
===================================================================
--- sandbox/inspire_soc2011/msautotest/wxs/wms_inspire_scenario1.map	2011-07-13 12:30:04 UTC (rev 11923)
+++ sandbox/inspire_soc2011/msautotest/wxs/wms_inspire_scenario1.map	2011-07-13 12:46:44 UTC (rev 11924)
@@ -71,6 +71,8 @@
   "wms_rootlayer_abstract" "myrootlayerabstract"            #to test fallback
   "wms_rootlayer_abstract_ger" "myrootlayerabstractger"
   "wms_rootlayer_keywordlist" "myrootlayerkeyword1,myrootlayerkeyword2"
+  "wms_inspire_style_name" "inspire_common:DEFAULT"         #style name
+  "wms_inspire_style_title" "mystyletitle"                  #style title
   "wms_enable_request" "*"
   "wms_sld_enabled" "false"
   "wms_getmap_formatlist" "image/png,image/png; mode=24bit,image/jpeg,image/gif,image/png; mode=8bit,image/tiff"
@@ -95,6 +97,11 @@
   "wms_abstract" "mylayerabstract"                          #to test fallback
   "wms_abstract_ger" "mylayerabstractger"
   "wms_keywordlist" "mylayerkeyword1,mylayerkeyword2"
+  "wms_style_inspire_common:DEFAULT_title" "mylayerstyletitle"                      #override style title
+  "wms_style_inspire_common:DEFAULT_legendurl_width" "mylayerstylelegendurlwidth"   #override style legendurl (mandatory: width, height, format, href)
+  "wms_style_inspire_common:DEFAULT_legendurl_height" "mylayerstylelegendurlheight"
+  "wms_style_inspire_common:DEFAULT_legendurl_format" "mylayerstylelegendurlformat"
+  "wms_style_inspire_common:DEFAULT_legendurl_href" "mylayerstylelegendurlhref"
  END
  TYPE LINE
  STATUS ON

Modified: sandbox/inspire_soc2011/msautotest/wxs/wms_inspire_scenario2.map
===================================================================
--- sandbox/inspire_soc2011/msautotest/wxs/wms_inspire_scenario2.map	2011-07-13 12:30:04 UTC (rev 11923)
+++ sandbox/inspire_soc2011/msautotest/wxs/wms_inspire_scenario2.map	2011-07-13 12:46:44 UTC (rev 11924)
@@ -74,6 +74,8 @@
   "wms_rootlayer_abstract" "myrootlayerabstract"            #to test fallback
   "wms_rootlayer_abstract_ger" "myrootlayerabstractger"
   "wms_rootlayer_keywordlist" "myrootlayerkeyword1,myrootlayerkeyword2"
+  "wms_inspire_style_name" "inspire_common:DEFAULT"         #style name
+  "wms_inspire_style_title" "mystyletitle"                  #style title
   "wms_enable_request" "*"
   "wms_sld_enabled" "false"
   "wms_getmap_formatlist" "image/png,image/png; mode=24bit,image/jpeg,image/gif,image/png; mode=8bit,image/tiff"
@@ -98,6 +100,11 @@
   "wms_abstract" "mylayerabstract"                          #to test fallback
   "wms_abstract_ger" "mylayerabstractger"
   "wms_keywordlist" "mylayerkeyword1,mylayerkeyword2"
+  "wms_style_inspire_common:DEFAULT_title" "mylayerstyletitle"                      #override style title
+  "wms_style_inspire_common:DEFAULT_legendurl_width" "mylayerstylelegendurlwidth"   #override style legendurl (mandatory: width, height, format, href)
+  "wms_style_inspire_common:DEFAULT_legendurl_height" "mylayerstylelegendurlheight"
+  "wms_style_inspire_common:DEFAULT_legendurl_format" "mylayerstylelegendurlformat"
+  "wms_style_inspire_common:DEFAULT_legendurl_href" "mylayerstylelegendurlhref"
  END
  TYPE LINE
  STATUS ON



More information about the mapserver-commits mailing list