Skip to content

Commit

Permalink
Remove local custom data source data from sample viewer (#1275)
Browse files Browse the repository at this point in the history
  • Loading branch information
duffh authored Aug 3, 2023
1 parent 946f0e2 commit e5de5c7
Show file tree
Hide file tree
Showing 14 changed files with 33 additions and 25,225 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific
// language governing permissions and limitations under the License.

using ArcGIS.Samples.Managers;
using Esri.ArcGISRuntime.ArcGISServices;
using Esri.ArcGISRuntime.Data;
using Esri.ArcGISRuntime.Mapping;
Expand All @@ -25,8 +26,12 @@ namespace ArcGIS.Samples.AddCustomDynamicEntityDataSource
instructions: "Run the sample to view the map and the dynamic entity layer displaying the latest observation from the custom data source. Tap on a dynamic entity to view its attributes in a callout.",
tags: new[] { "data", "dynamic", "entity", "label", "labeling", "live", "real-time", "stream", "track" })]
[ArcGIS.Samples.Shared.Attributes.ClassFile("SimulatedDataSource.cs")]
[ArcGIS.Samples.Shared.Attributes.OfflineData("a8a942c228af4fac96baa78ad60f511f")]
public partial class AddCustomDynamicEntityDataSource
{
// Path to AIS Traffic Data json file.
private readonly string _localJsonFile = DataManager.GetDataFolder("a8a942c228af4fac96baa78ad60f511f", "AIS_MarineCadastre_SelectedVessels_CustomDataSource.json");

public AddCustomDynamicEntityDataSource()
{
InitializeComponent();
Expand All @@ -46,7 +51,7 @@ private void Initialize()
// In this example we are using a json file as our custom data source.
// This field value should be a unique identifier for each entity.
// Adjusting the value for the delay will change the speed at which the entities and their observations are displayed.
var customSource = new SimulatedDataSource("AIS_MarineCadastre_SelectedVessels_CustomDataSource.json", "MMSI", TimeSpan.FromMilliseconds(10));
var customSource = new SimulatedDataSource(_localJsonFile, "MMSI", TimeSpan.FromMilliseconds(10));

// Create the dynamic entity layer using the custom data source.
var dynamicEntityLayer = new DynamicEntityLayer(customSource);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,17 @@ public class SimulatedDataSource : DynamicEntityDataSource
private CancellationTokenSource? _cancellationTokenSource;
private List<Field> _fields;

public SimulatedDataSource(string fileName, string entityIdField, TimeSpan delay)
public SimulatedDataSource(string filePath, string entityIdField, TimeSpan delay)
{
FileName = fileName;
FilePath = filePath;
EntityIdField = entityIdField;
Delay = delay;
}

#region Properties

// Expose the file path, entity ID field, and delay length as properties.
public string FileName { get; }
public string FilePath { get; }
public string EntityIdField { get; }
public TimeSpan Delay { get; }

Expand All @@ -46,7 +46,7 @@ protected override async Task<DynamicEntityDataSourceInfo> OnLoadAsync()
_fields = GetSchema();

// Open the file for processing.
Stream stream = await FileSystem.OpenAppPackageFileAsync(FileName);
Stream stream = File.OpenRead(FilePath);
_streamReader = new StreamReader(stream);

// Create a new DynamicEntityDataSourceInfo using the entity ID field and the fields derived from the attributes of each observation in the custom data source.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Configure the map view:

## About the data

This sample uses a .json file containing observations of marine vessels in the Pacific North West.
This sample uses a [.json file containing observations of marine vessels in the Pacific North West](https://www.arcgis.com/home/item.html?id=a8a942c228af4fac96baa78ad60f511f) hosted on ArcGIS Online.

## Additional information

Expand Down
1 change: 0 additions & 1 deletion src/WPF/WPF.Viewer/ArcGIS.WPF.Viewer.Net.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
<Content Remove="readme.md" />
<None Remove="App.config" />
<None Remove="Resources\github-markdown.css" />
<EmbeddedResource Include="Samples\Layers\AddCustomDynamicEntityDataSource\AIS_MarineCadastre_SelectedVessels_CustomDataSource.json" />
<Compile Update="Samples\**\*.cs">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Compile>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific
// language governing permissions and limitations under the License.

using ArcGIS.Samples.Managers;
using Esri.ArcGISRuntime.ArcGISServices;
using Esri.ArcGISRuntime.Data;
using Esri.ArcGISRuntime.Mapping;
Expand All @@ -28,8 +29,12 @@ namespace ArcGIS.WPF.Samples.AddCustomDynamicEntityDataSource
description: "Create a custom dynamic entity data source and display it using a dynamic entity layer.",
instructions: "Run the sample to view the map and the dynamic entity layer displaying the latest observation from the custom data source. Tap on a dynamic entity to view its attributes in a callout.",
tags: new[] { "data", "dynamic", "entity", "label", "labeling", "live", "real-time", "stream", "track" })]
[ArcGIS.Samples.Shared.Attributes.OfflineData("a8a942c228af4fac96baa78ad60f511f")]
public partial class AddCustomDynamicEntityDataSource
{
// Path to AIS Traffic Data json file.
private readonly string _localJsonFile = DataManager.GetDataFolder("a8a942c228af4fac96baa78ad60f511f", "AIS_MarineCadastre_SelectedVessels_CustomDataSource.json");

public AddCustomDynamicEntityDataSource()
{
InitializeComponent();
Expand All @@ -49,7 +54,7 @@ private void Initialize()
// In this example we are using a json file as our custom data source.
// This field value should be a unique identifier for each entity.
// Adjusting the value for the delay will change the speed at which the entities and their observations are displayed.
var customSource = new SimulatedDataSource("AIS_MarineCadastre_SelectedVessels_CustomDataSource.json", "MMSI", TimeSpan.FromMilliseconds(10));
var customSource = new SimulatedDataSource(_localJsonFile, "MMSI", TimeSpan.FromMilliseconds(10));

// Create the dynamic entity layer using the custom data source.
var dynamicEntityLayer = new DynamicEntityLayer(customSource);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@ public class SimulatedDataSource : DynamicEntityDataSource
private CancellationTokenSource _cancellationTokenSource;
private List<Field> _fields;

public SimulatedDataSource(string fileName, string entityIdField, TimeSpan delay)
public SimulatedDataSource(string filePath, string entityIdField, TimeSpan delay)
{
FileName = fileName;
FilePath = filePath;
EntityIdField = entityIdField;
Delay = delay;
}

#region Properties

// Expose the file path, entity ID field, and delay length as properties.
public string FileName { get; }
public string FilePath { get; }
public string EntityIdField { get; }
public TimeSpan Delay { get; }

Expand All @@ -51,8 +51,7 @@ protected override async Task<DynamicEntityDataSourceInfo> OnLoadAsync()
_fields = GetSchema();

// Open the file for processing.
string resourceStreamName = this.GetType().Assembly.GetManifestResourceNames().Single(str => str.EndsWith(FileName));
Stream stream = this.GetType().Assembly.GetManifestResourceStream(resourceStreamName);
Stream stream = File.OpenRead(FilePath);
_streamReader = new StreamReader(stream);

// Create a new DynamicEntityDataSourceInfo using the entity ID field and the fields derived from the attributes of each observation in the custom data source.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Configure the map view:

## About the data

This sample uses a .json file containing observations of marine vessels in the Pacific North West.
This sample uses a [.json file containing observations of marine vessels in the Pacific North West](https://www.arcgis.com/home/item.html?id=a8a942c228af4fac96baa78ad60f511f) hosted on ArcGIS Online.

## Additional information

Expand Down
4 changes: 0 additions & 4 deletions src/WinUI/ArcGIS.WinUI.Viewer/ArcGIS.WinUI.Viewer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,6 @@
</Content>
</ItemGroup>

<ItemGroup>
<EmbeddedResource Include="Samples\Layers\AddCustomDynamicEntityDataSource\AIS_MarineCadastre_SelectedVessels_CustomDataSource.json" />
</ItemGroup>

<ItemGroup>
<Page Update="ScreenshotTab.xaml">
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
Expand Down
Loading

0 comments on commit e5de5c7

Please sign in to comment.