/// <summary> /// Initialize a new asset with a Uri /// </summary> /// <param name="stacObject">parent stac object</param> /// <param name="uri">uri to the asset</param> public StacAsset(IStacObject stacObject, Uri uri) : this() { if (!(stacObject == null || stacObject is StacItem || stacObject is StacCollection)) { throw new InvalidOperationException("An asset cannot be defined in " + stacObject.GetType().Name); } parentStacObject = stacObject; Uri = uri; }
/// <summary> /// Initialize a new asset from an existing one /// </summary> /// <param name="source">asset source to be copied</param> /// <param name="stacObject">new parent stac object</param> public StacAsset(StacAsset source, IStacObject stacObject) { if (!(stacObject == null || stacObject is StacItem || stacObject is StacCollection)) { throw new InvalidOperationException("An asset cannot be defined in " + stacObject.GetType().Name); } if (source == null) { throw new ArgumentNullException("source"); } base_uri = source.base_uri; href = source.href; if (source.Roles != null) { Roles = new SortedSet <string>(source.Roles); } else { Roles = new SortedSet <string>(); } title = source.title; type = source.type; description = source.description; if (source.properties != null) { properties = new Dictionary <string, object>(source.properties); } parentStacObject = stacObject; }