Terradue.OpenSearch.OpenSearchParameterValueSet.GetValuesByIdentifier C# (CSharp) Method

GetValuesByIdentifier() public method

Returns the values of the parameter specified by its identifier namespace URI and local name.
public GetValuesByIdentifier ( string namespaceUri, string localName ) : string[]
namespaceUri string The namespace URI part of the fully qualified identifier of this parameter as defined in the OpenSearch description URL template, e.g. "http://a9.com/-/opensearch/extensions/geo/1.0/".
localName string The local name part of the fully qualified identifier of this parameter as defined in the OpenSearch description URL template, e.g. "box".
return string[]
        public string[] GetValuesByIdentifier(string namespaceUri, string localName)
        {
            namespaceUri = nameTable.Get(namespaceUri);
            if (namespaceUri == null) return null;

            OpenSearchParameterDefinition paramDef = parametersByIdentifier.Values.SingleOrDefault(p => namespaceUri.Equals(p.IdentifierNamespaceUri) && localName == p.IdentifierLocalName);
            if (paramDef == null || !values.ContainsKey(paramDef)) return null;
            return values[paramDef];
        }

Same methods

OpenSearchParameterValueSet::GetValuesByIdentifier ( string identifier ) : string[]

Usage Example

コード例 #1
0
 //---------------------------------------------------------------------------------------------------------------------
 /// <summary>Sets the parameter values based on the values of another instance.</summary>
 /// <remarks>Only matching parameters are taken into account. The match is made by the fully qualified identifier of the OpenSearch parameters. In the default case it is assumed that the namespace prefixes used for the identifiers refer to the same namespaces in both value sets, however, the namespaces can be verified fully.</remarks>
 /// <param name="source">The OpenSearchParameterValueSet that serves as source.</param>
 /// <param name="verifyNamespaces">If set to <c>true</c>, the parameters are matched by namespace URI and local name, rather than just prefix and local name. The default is <c>false</c>.</param>
 public void TranslateFrom(OpenSearchParameterValueSet source, bool verifyNamespaces = false)
 {
     foreach (string identifier in parametersByIdentifier.Keys) {
         OpenSearchParameterDefinition paramDef = parametersByIdentifier[identifier];
         string[] sourceValues;
         if (verifyNamespaces && paramDef.IdentifierNamespaceUri != null) {
             sourceValues = source.GetValuesByIdentifier(paramDef.IdentifierNamespaceUri, paramDef.IdentifierLocalName);
         } else {
             sourceValues = source.GetValuesByIdentifier(identifier);
         }
         if (sourceValues != null) this.values[parametersByIdentifier[identifier]] = sourceValues;
     }
 }