Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove local custom data source data from sample viewer #1275

Merged
merged 1 commit into from
Aug 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

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.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your choice: "Vessel AIS Traffic Data" would more closely match name of online item and could be slightly clearer.

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
Loading