Skip to content

Commit

Permalink
fields
Browse files Browse the repository at this point in the history
  • Loading branch information
emmanuelmathot committed Feb 7, 2023
1 parent e95db31 commit 5d6219d
Show file tree
Hide file tree
Showing 37 changed files with 270 additions and 269 deletions.
2 changes: 2 additions & 0 deletions src/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,7 @@ dotnet_diagnostic.IDE0073.severity = warning # Enforce file header
file_header_template = Copyright (c) by Terradue Srl. All Rights Reserved.\nLicense under the AGPL, Version 3.0.\nFile Name: {fileName}

dotnet_diagnostic.SA1101.severity = warning # Prefix local calls with this
dotnet_diagnostic.SA1111.severity = warning # Closing parenthesis should be on line of last parameter
dotnet_diagnostic.SA1116.severity = warning # Split parameters should start on line after declaration
dotnet_diagnostic.SA1119.severity = warning # Statement must not use unnecessary parenthesis
dotnet_diagnostic.SA1124.severity = warning # Do not use regions
Expand All @@ -425,3 +426,4 @@ dotnet_diagnostic.SA1636.severity = none # Disable file header matching
dotnet_diagnostic.SA1642.severity = warning # Constructor summary documentation must begin with standard text
dotnet_diagnostic.SA1649.severity = warning # File name must match first type name
dotnet_diagnostic.SA1651.severity = warning # Do not use placeholders in summaries
dotnet_diagnostic.SX1309.severity = warning # Field names should begin with underscore
3 changes: 1 addition & 2 deletions src/DotNetStac/Collection/StacExtent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@ public static StacExtent Create(IEnumerable<StacItem> items)
items.Max(i => i.GetBoundingBoxFromGeometryExtent()[2]),
items.Max(i => i.GetBoundingBoxFromGeometryExtent()[3])),

new StacTemporalExtent(minDate, maxDate)
);
new StacTemporalExtent(minDate, maxDate));
}

/// <inheritdoc/>
Expand Down
3 changes: 2 additions & 1 deletion src/DotNetStac/Collection/StacSpatialExtent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public StacSpatialExtent(double minX, double minY, double maxX, double maxY)
/// Initializes a new instance of the <see cref="StacSpatialExtent"/> class.
/// Initialize a new Stac Spatial extent from an existing one (clone)
/// </summary>
/// <param name="spatial"></param>
/// <param name="spatial">The spatial extent.</param>
public StacSpatialExtent(StacSpatialExtent spatial)
{
this.BoundingBoxes = (double[][])spatial.BoundingBoxes.Clone();
Expand All @@ -47,6 +47,7 @@ public StacSpatialExtent(StacSpatialExtent spatial)
/// <summary>
/// Clone this Extent
/// </summary>
/// <returns>A new <see cref="StacSpatialExtent" /> that is a clone of this instance.</returns>
public object Clone()
{
return new StacSpatialExtent(this);
Expand Down
12 changes: 6 additions & 6 deletions src/DotNetStac/Collection/StacSummaryItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ public abstract class StacSummaryItem : IStacSummaryItem
/// <summary>
/// Json Object
/// </summary>
protected readonly JToken summary;
private readonly JToken _summary;

/// <summary>
/// Initializes a new instance of the <see cref="StacSummaryItem"/> class.
/// </summary>
/// <param name="summary"></param>
protected StacSummaryItem(JToken summary)
{
this.summary = summary;
this._summary = summary;
}

/// <summary>
Expand All @@ -33,7 +33,7 @@ protected StacSummaryItem(JToken summary)
/// <value>
/// JToken transformer
/// </value>
public JToken AsJToken => this.summary;
public JToken AsJToken => this._summary;

/// <summary>
/// accessor of fields in the object
Expand All @@ -42,7 +42,7 @@ public JToken this[object key]
{
get
{
return this.summary[key];
return this._summary[key];
}
}

Expand All @@ -54,12 +54,12 @@ public JToken this[object key]
/// </summary>
public IEnumerator GetEnumerator()
{
return this.summary.Children().GetEnumerator();
return this._summary.Children().GetEnumerator();
}

IEnumerator<JToken> IEnumerable<JToken>.GetEnumerator()
{
return this.summary.Children().GetEnumerator();
return this._summary.Children().GetEnumerator();
}
}
}
4 changes: 2 additions & 2 deletions src/DotNetStac/Collection/StacSummaryRangeObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public StacSummaryRangeObject(T min, T max)
/// <value>
/// Minimum of the range
/// </value>
public T Min { get => this.summary["minimum"].Value<T>(); set => this.summary["minimum"] = new JValue(value); }
public T Min { get => this.AsJToken["minimum"].Value<T>(); set => this.AsJToken["minimum"] = new JValue(value); }

/// <summary>
/// Gets or sets maximum of the range
Expand All @@ -57,7 +57,7 @@ public StacSummaryRangeObject(T min, T max)
/// <value>
/// Maximum of the range
/// </value>
public T Max { get => this.summary["maximum"].Value<T>(); set => this.summary["maximum"] = new JValue(value); }
public T Max { get => this.AsJToken["maximum"].Value<T>(); set => this.AsJToken["maximum"] = new JValue(value); }

/// <inheritdoc/>
public override IEnumerable<object> Enumerate()
Expand Down
8 changes: 4 additions & 4 deletions src/DotNetStac/Collection/StacSummaryValueSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,28 +52,28 @@ public StacSummaryValueSet(IEnumerable<T> summarySet)
/// <value>
/// Summary Value Set total of items
/// </value>
public int Count => this.summary.Count();
public int Count => this.AsJToken.Count();

/// <summary>
/// Gets get the Summary Value Set as an enumerable
/// </summary>
/// <value>
/// Get the Summary Value Set as an enumerable
/// </value>
public IEnumerable<T> SummarySet { get => this.summary.ToObject<List<T>>(); }
public IEnumerable<T> SummarySet { get => this.AsJToken.ToObject<List<T>>(); }

/// <summary>
/// Add a value item in the Summary Value Set
/// </summary>
/// <param name="item">value item</param>
public void Add(T item)
{
((JArray)this.summary).Add(item);
((JArray)this.AsJToken).Add(item);
}

IEnumerator<T> IEnumerable<T>.GetEnumerator()
{
return this.SummarySet.GetEnumerator();
return this.AsJTokenSet.GetEnumerator();
}

/// <inheritdoc/>
Expand Down
6 changes: 3 additions & 3 deletions src/DotNetStac/Common/Statistics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace Stac.Common
[JsonObject(ItemNullValueHandling = NullValueHandling.Ignore)]
public class Statistics
{
private IDictionary<string, object> properties;
private IDictionary<string, object> _properties;

/// <summary>
/// Initializes a new instance of the <see cref="Statistics"/> class.
Expand All @@ -31,7 +31,7 @@ public Statistics(double? minimum, double? maximum, double? mean, double? stdev,
this.Maximum = maximum;
this.Stdev = stdev;
this.ValidPercent = validPercent;
this.properties = new Dictionary<string, object>();
this._properties = new Dictionary<string, object>();
}

/// <summary>
Expand Down Expand Up @@ -86,6 +86,6 @@ public Statistics(double? minimum, double? maximum, double? mean, double? stdev,
/// Additional fields
/// </value>
[JsonExtensionData]
public IDictionary<string, object> Properties { get => this.properties; set => this.properties = value; }
public IDictionary<string, object> Properties { get => this._properties; set => this._properties = value; }
}
}
26 changes: 13 additions & 13 deletions src/DotNetStac/Extensions/Alternate/AlternateAssetObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ namespace Stac.Extensions.Alternate
public class AlternateAssetObject : IStacPropertiesContainer
{
private readonly IStacObject _parent;
private string href;
private string title;
private string _href;
private string _title;

private string description;
private IDictionary<string, object> properties;
private string _description;
private IDictionary<string, object> _properties;

/// <summary>
/// Initializes a new instance of the <see cref="AlternateAssetObject"/> class.
Expand All @@ -31,11 +31,11 @@ public class AlternateAssetObject : IStacPropertiesContainer
/// <param name="description">A description of the Asset providing additional details, such as how it was processed or created. CommonMark 0.29 syntax MAY be used for rich text representation.</param>
public AlternateAssetObject(string href, IStacObject parent = null, string title = null, string description = null)
{
this.href = href;
this._href = href;
this._parent = parent;
this.title = title;
this.description = description;
this.properties = new Dictionary<string, object>();
this._title = title;
this._description = description;
this._properties = new Dictionary<string, object>();
}

/// <summary>
Expand All @@ -46,7 +46,7 @@ public AlternateAssetObject(string href, IStacObject parent = null, string title
/// </value>
[JsonProperty("href")]
[JsonRequired]
public string Href { get => this.href; set => this.href = value; }
public string Href { get => this._href; set => this._href = value; }

/// <summary>
/// Gets or sets the displayed title for clients and users.
Expand All @@ -55,7 +55,7 @@ public AlternateAssetObject(string href, IStacObject parent = null, string title
/// The displayed title for clients and users.
/// </value>
[JsonProperty("title")]
public string Title { get => this.title; set => this.title = value; }
public string Title { get => this._title; set => this._title = value; }

/// <summary>
/// Gets or sets a description of the Asset providing additional details, such as how it was processed or created. CommonMark 0.29 syntax MAY be used for rich text representation.
Expand All @@ -64,7 +64,7 @@ public AlternateAssetObject(string href, IStacObject parent = null, string title
/// A description of the Asset providing additional details, such as how it was processed or created. CommonMark 0.29 syntax MAY be used for rich text representation.
/// </value>
[JsonProperty("description")]
public string Description { get => this.description; set => this.description = value; }
public string Description { get => this._description; set => this._description = value; }

/// <summary>
/// Gets or sets additional fields
Expand All @@ -73,7 +73,7 @@ public AlternateAssetObject(string href, IStacObject parent = null, string title
/// Additional fields
/// </value>
[JsonExtensionData]
public IDictionary<string, object> Properties { get => this.properties; set => this.properties = value; }
public IDictionary<string, object> Properties { get => this._properties; set => this._properties = value; }

/// <summary>
/// Gets parent Stac Object
Expand All @@ -99,6 +99,6 @@ public AlternateAssetObject(string href, IStacObject parent = null, string title
/// Uri
/// </value>
[JsonIgnore]
public Uri Uri => new Uri(this.href);
public Uri Uri => new Uri(this._href);
}
}
14 changes: 7 additions & 7 deletions src/DotNetStac/Extensions/Datacube/DatacubeDimensionObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace Stac.Extensions.Datacube
[JsonObject(ItemNullValueHandling = NullValueHandling.Ignore)]
public class DatacubeDimension : IStacPropertiesContainer
{
private IDictionary<string, object> properties;
private IDictionary<string, object> _properties;
protected string type;
protected string description;
protected double[] extent;
Expand All @@ -23,7 +23,7 @@ public class DatacubeDimension : IStacPropertiesContainer

public DatacubeDimension()
{
this.properties = new Dictionary<string, object>();
this._properties = new Dictionary<string, object>();
}

/// <summary>
Expand Down Expand Up @@ -78,7 +78,7 @@ public DatacubeDimension()
/// Additional fields
/// </value>
[JsonExtensionData]
public IDictionary<string, object> Properties { get => this.properties; set => this.properties = value; }
public IDictionary<string, object> Properties { get => this._properties; set => this._properties = value; }

/// <inheritdoc/>
[JsonIgnore]
Expand Down Expand Up @@ -125,7 +125,7 @@ public DatacubeDimensionSpatialHorizontal()

public class DatacubeDimensionSpatialVertical : DatacubeDimensionSpatial
{
private string unit;
private string _unit;

public DatacubeDimensionSpatialVertical()
: base()
Expand All @@ -140,7 +140,7 @@ public DatacubeDimensionSpatialVertical()
/// The unit of measurement for the data, preferably compliant to <seealso href="https://ncics.org/portfolio/other-resources/udunits2">UDUNITS-2</seealso> units (singular).
/// </value>
[JsonProperty("unit")]
public string Unit { get => this.unit; set => this.unit = value; }
public string Unit { get => this._unit; set => this._unit = value; }
}

public class DatacubeDimensionTemporal : DatacubeDimension
Expand All @@ -155,7 +155,7 @@ public DatacubeDimensionTemporal()
public class DatacubeDimensionAdditional : DatacubeDimension
{

private string unit;
private string _unit;
protected object reference_system;

public DatacubeDimensionAdditional()
Expand All @@ -170,7 +170,7 @@ public DatacubeDimensionAdditional()
/// The unit of measurement for the data, preferably compliant to <seealso href="https://ncics.org/portfolio/other-resources/udunits2">UDUNITS-2</seealso> units (singular).
/// </value>
[JsonProperty("unit")]
public string Unit { get => this.unit; set => this.unit = value; }
public string Unit { get => this._unit; set => this._unit = value; }

/// <summary>
/// Gets or sets the spatial reference system for the data, specified as <seealso href="http://www.epsg-registry.org/">numerical EPSG code</seealso>, <seealso href="http://docs.opengeospatial.org/is/18-010r7/18-010r7.html">WKT2 (ISO 19162) string</seealso> or <seealso href="https://proj.org/specifications/projjson.html">PROJJSON object</seealso>. Defaults to EPSG code 4326.
Expand Down
10 changes: 5 additions & 5 deletions src/DotNetStac/Extensions/Datacube/DatacubeStacExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ public class DatacubeStacExtension : StacPropertiesContainerExtension, IStacExte
// Extensions identifier and schema url
public const string JsonSchemaUrl = "https://stac-extensions.github.io/datacube/v2.1.0/schema.json";

private readonly IDictionary<string, Type> itemFields;
private readonly IDictionary<string, Type> _itemFields;
private const string DimensionField = "cube:dimensions";
private const string VariableField = "cube:variables";

private DatacubeStacExtension(IStacPropertiesContainer stacPropertiesContainer)
: base(JsonSchemaUrl, stacPropertiesContainer)
{
this.itemFields = new Dictionary<string, Type>();
this.itemFields.Add(DimensionField, typeof(IDictionary<string, DatacubeDimension>));
this.itemFields.Add(VariableField, typeof(IDictionary<string, DatacubeVariable>));
this._itemFields = new Dictionary<string, Type>();
this._itemFields.Add(DimensionField, typeof(IDictionary<string, DatacubeDimension>));
this._itemFields.Add(VariableField, typeof(IDictionary<string, DatacubeVariable>));
}

internal DatacubeStacExtension(StacCollection stacCollection)
Expand Down Expand Up @@ -102,7 +102,7 @@ public IDictionary<string, DatacubeVariable> Variables
/// <value>
/// Potential fields and their types
/// </value>
public override IDictionary<string, Type> ItemFields => this.itemFields;
public override IDictionary<string, Type> ItemFields => this._itemFields;

private void UpdateDimensionField(object sender, NotifyCollectionChangedEventArgs e)
{
Expand Down
10 changes: 5 additions & 5 deletions src/DotNetStac/Extensions/Datacube/DatacubeVariableObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ namespace Stac.Extensions.Datacube
[JsonObject(ItemNullValueHandling = NullValueHandling.Ignore)]
public class DatacubeVariable : IStacPropertiesContainer
{
private IDictionary<string, object> properties;
private IDictionary<string, object> _properties;
protected string[] dimensions;
protected DatacubeVariableType? type;
protected string description;
protected double[] extent;
protected string[] values;
private string unit;
private string _unit;

public DatacubeVariable()
{
this.properties = new Dictionary<string, object>();
this._properties = new Dictionary<string, object>();
}

/// <summary>
Expand Down Expand Up @@ -79,7 +79,7 @@ public DatacubeVariable()
/// The unit of measurement for the data, preferably compliant to <seealso href="https://ncics.org/portfolio/other-resources/udunits2">UDUNITS-2</seealso> units (singular).
/// </value>
[JsonProperty("unit")]
public string Unit { get => this.unit; set => this.unit = value; }
public string Unit { get => this._unit; set => this._unit = value; }

/// <summary>
/// Gets or sets additional fields
Expand All @@ -88,7 +88,7 @@ public DatacubeVariable()
/// Additional fields
/// </value>
[JsonExtensionData]
public IDictionary<string, object> Properties { get => this.properties; set => this.properties = value; }
public IDictionary<string, object> Properties { get => this._properties; set => this._properties = value; }

/// <inheritdoc/>
[JsonIgnore]
Expand Down
Loading

0 comments on commit 5d6219d

Please sign in to comment.