/// <summary> /// Find a metadata tag /// </summary> /// <param name="layer">The layer object</param> /// <param name="key_to_find">the metadata key to search for</param> /// <returns></returns> public static string FindMetadata(layerObj layer, string key_to_find) { string key = layer.getFirstMetaDataKey(); while (key != null) { if (key.StartsWith(key_to_find)) { return(key); } key = layer.getNextMetaDataKey(key); } return(null); }
/// <summary> /// Check whether this layer has a metadata tag /// </summary> /// <param name="layer">The layer object</param> /// <param name="key_to_find">the metadata key to search for</param> /// <returns></returns> public static bool HasMetadata(layerObj layer, string key_to_find) { string key = layer.getFirstMetaDataKey(); while (key != null) { if (key == key_to_find) { return(true); } key = layer.getNextMetaDataKey(key); } return(false); }
/// <summary> /// Append a value to an existing metadata or create a new tag if that doesn't exist /// </summary> /// <param name="layer">The layer object</param> /// <param name="key">The metadata key</param> /// <param name="value">The value to append</param> /// <param name="value">The separator to be used when appending</param> public static void AppendMetadata(layerObj layer, string key_to_find, string value, string separator) { string key = layer.getFirstMetaDataKey(); while (key != null) { if (key == key_to_find) { layer.setMetaData(key_to_find, layer.getMetaData(key_to_find) + separator + value); return; } key = layer.getNextMetaDataKey(key); } layer.setMetaData(key_to_find, value); }
/// <summary> /// Check whether this layer has a metadata tag /// </summary> /// <param name="layer">The layer object</param> /// <param name="key_to_find">the metadata key to search for</param> /// <returns></returns> public static bool HasMetadata(layerObj layer, string key_to_find) { string key = layer.getFirstMetaDataKey(); while (key != null) { if (key == key_to_find) { return true; } key = layer.getNextMetaDataKey(key); } return false; }
/// <summary> /// Find a metadata tag /// </summary> /// <param name="layer">The layer object</param> /// <param name="key_to_find">the metadata key to search for</param> /// <returns></returns> public static string FindMetadata(layerObj layer, string key_to_find) { string key = layer.getFirstMetaDataKey(); while (key != null) { if (key.StartsWith(key_to_find)) { return key; } key = layer.getNextMetaDataKey(key); } return null; }