Class SecomScope
- Namespace
- EncDotNet.S100.Collections.Library
- Assembly
- EncDotNet.S100.Collections.dll
A scope of a SECOM service (issue #804): the service's objects counted per
product, read through GetSummary with the source's
Identity (#883), with the products as the one group. A source
can be kept in sync (#807; Sync) and narrowed to the current
map view (InMapView).
public sealed class SecomScope : LibraryCatalogueScope
- Inheritance
-
SecomScope
- Inherited Members
Remarks
A service that can't be read yet (it needs a certificate or a signed request, refused the identity, has an untrusted server or can't be reached) can still be added with Wait(IEnumerable<string>?, string?): the source starts with no datasets, scoped to the products the service is known for, and lists once it can be read (#883 "Add and wait").
Constructors
SecomScope(Uri, Func<Uri, string?, string?, CancellationToken, Task<SecomServiceDescription>>, Func<GeoBounds?>?)
Creates a scope of the service at serviceUri.
public SecomScope(Uri serviceUri, Func<Uri, string?, string?, CancellationToken, Task<SecomServiceDescription>> describe, Func<GeoBounds?>? currentMapView = null)
Parameters
serviceUriUriThe service's endpoint.
describeFunc<Uri, string, string, CancellationToken, Task<SecomServiceDescription>>Reads what the service offers, optionally within an area (WKT), with an identity setting.
currentMapViewFunc<GeoBounds?>The map view the service can be narrowed to, or null when there is none.
Properties
CanScopeToMapView
True when there is a map view to narrow the service to.
public bool CanScopeToMapView { get; }
Property Value
CurrentFilter
The filter for the ticked products.
public SecomFilter CurrentFilter { get; }
Property Value
EverythingSummary
"All 1,735 objects · 8.6 MB" (or "First 5,000 of 67,640 objects …") for the whole service.
public override string EverythingSummary { get; }
Property Value
Groups
One group: the products.
public override IReadOnlyList<LibraryChoiceGroup> Groups { get; }
Property Value
Identity
The identity the service is read with, and the source presents (#883):
default (the default), none or an sc-ident: reference.
Changing it takes effect on the next LoadAsync(CancellationToken).
public string Identity { get; set; }
Property Value
Exceptions
- ArgumentException
The value is none of the three.
InMapView
True when the service is read only within the map view as it was when this was set. Setting it takes effect on the next LoadAsync(CancellationToken); it stays false when there is no map view.
public bool InMapView { get; set; }
Property Value
IsEverything
The selection is everything only when no products are picked and the map view is not narrowed to.
public override bool IsEverything { get; }
Property Value
IsLoaded
True once the catalogue has been read.
public override bool IsLoaded { get; }
Property Value
IsWaiting
True when the source is added before the service can be read (Wait(IEnumerable<string>?, string?)): it starts with no datasets.
public bool IsWaiting { get; }
Property Value
Products
The service's products.
public IReadOnlyList<LibraryChoice> Products { get; }
Property Value
SelectionSummary
What the ticked choices (or, with none, the whole catalogue) amount to, e.g. "12 cells · 3 MB".
public override string SelectionSummary { get; }
Property Value
SingleEntry
The catalogue's only download, when it lists just one (there is nothing to choose); otherwise null.
public override LibraryChoice? SingleEntry { get; }
Property Value
Sync
True to keep a local copy of every object, downloaded and pruned on each refresh. On by default while the selection is small and complete, until set.
public bool Sync { get; set; }
Property Value
SyncHint
"Downloads 9.8 MB now", or why syncing is not advised; null until the service is read.
public string? SyncHint { get; }
Property Value
WaitingReason
Why the service couldn't be read when it was added to wait, if known.
public string? WaitingReason { get; }
Property Value
Methods
Build(Guid, string?)
The source the scope describes.
public override CollectionSource Build(Guid id, string? name)
Parameters
idGuidThe new source's id.
namestringThe source's name when everything is included (the catalogue's name); a selection names it after the selection. A manifest source always takes it.
Returns
DescribeSelection()
The ticked products and whether the map view is narrowed to ("S-124, map area"), or null for everything.
public override string? DescribeSelection()
Returns
LoadAsync(CancellationToken)
Reads the catalogue and creates its choices.
public override Task<string?> LoadAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenCancels the read.
Returns
Wait(IEnumerable<string>?, string?)
Adds the service without reading it ("Add and wait", #883): the products it is known for (from its directory entry; none for every product) become the choices, all ticked. The source starts with no datasets and lists once the service can be read. LoadAsync(CancellationToken) leaves this.
public void Wait(IEnumerable<string>? products, string? reason = null)
Parameters
productsIEnumerable<string>The products the service is known for, e.g.
S-124.reasonstringWhy the service can't be read yet, as the last read said.
Wkt(GeoBounds)
A WKT polygon (longitude, latitude) for view, as SECOM's geometry filter takes it.
public static string Wkt(GeoBounds view)
Parameters
viewGeoBoundsThe area.