├── .editorconfig
├── .github
└── workflows
│ ├── ci.yml
│ └── release.yml
├── .gitignore
├── .vscode
├── launch.json
└── tasks.json
├── AcceptanceTests
├── AcceptanceTests.csproj
├── Asserts
│ ├── Export
│ │ ├── DlvHeaderAssert.cs
│ │ ├── IsoSpatialRecordAssert.cs
│ │ ├── SpatialValueAssert.cs
│ │ ├── TaskDataAssert.cs
│ │ ├── TimAssert.cs
│ │ ├── TlgAssert.cs
│ │ └── TskAssert.cs
│ └── Import
│ │ ├── ApplicationDataModelAssert.cs
│ │ ├── CatalogAssert.cs
│ │ ├── CropAssert.cs
│ │ ├── CropVarietyAssert.cs
│ │ ├── DocumentsAssert.cs
│ │ ├── FarmAssert.cs
│ │ ├── FertilizerProductAssert.cs
│ │ ├── FieldAssert.cs
│ │ ├── GrowerAssert.cs
│ │ ├── GuidanceGroupAssert.cs
│ │ ├── LoggedDataAssert.cs
│ │ ├── MultiPolygonAssert.cs
│ │ ├── OperationDataAssert.cs
│ │ ├── PointAssert.cs
│ │ ├── ProductAssert.cs
│ │ ├── ProductComponentAssert.cs
│ │ ├── ProductMixAssert.cs
│ │ ├── RingAssert.cs
│ │ ├── SpatialRecordAssert.cs
│ │ ├── SpatialValueAssert.cs
│ │ ├── TimeScopeAssert.cs
│ │ └── UniqueIdAssert.cs
├── Features
│ ├── ImportLogData.feature
│ └── ImportLogData.feature.cs
├── ScenarioContextExtensions.cs
└── Steps
│ └── ImportLogDataSteps.cs
├── AgGatewayISOPlugin.nuspec
├── AgGatewayISOPlugin.targets
├── Examples
├── Examples.csproj
├── Program.cs
└── RasterPrescriptions.cs
├── ISOv4Plugin.sln
├── ISOv4Plugin
├── ExtensionMethods
│ ├── ExtensionMethods.cs
│ └── XmlExtensions.cs
├── ISOEnumerations
│ ├── ISOAllocationStampType.cs
│ ├── ISOAttachedFilePreserve.cs
│ ├── ISOCodedCommentScope.cs
│ ├── ISODeviceElementType.cs
│ ├── ISOGuidancePatternExtension.cs
│ ├── ISOGuidancePatternGNSSMethod.cs
│ ├── ISOGuidancePatternOption.cs
│ ├── ISOGuidancePatternPropagationDirection.cs
│ ├── ISOGuidancePatternType.cs
│ ├── ISOLineStringType.cs
│ ├── ISOLinkGroupType.cs
│ ├── ISOPointType.cs
│ ├── ISOPolygonType.cs
│ ├── ISOPositionStatus.cs
│ ├── ISOProductGroupType.cs
│ ├── ISOProductType.cs
│ ├── ISOTaskDataTransferOrigin.cs
│ ├── ISOTaskStatus.cs
│ ├── ISOTimeType.cs
│ └── ISOTransferMode.cs
├── ISOModels
│ ├── ISO11783_LinkList.cs
│ ├── ISO11783_TaskData.cs
│ ├── ISOAllocationStamp.cs
│ ├── ISOAttachedFile.cs
│ ├── ISOCodedComment.cs
│ ├── ISOCodedCommentListValue.cs
│ ├── ISOCommentAllocation.cs
│ ├── ISOConnection.cs
│ ├── ISOCropType.cs
│ ├── ISOCropVariety.cs
│ ├── ISOCulturalPractice.cs
│ ├── ISOCustomer.cs
│ ├── ISODataLogTrigger.cs
│ ├── ISODataLogValue.cs
│ ├── ISODevice.cs
│ ├── ISODeviceAllocation.cs
│ ├── ISODeviceElement.cs
│ ├── ISODeviceObjectReference.cs
│ ├── ISODeviceProcessData.cs
│ ├── ISODeviceProperty.cs
│ ├── ISODeviceValuePresentation.cs
│ ├── ISOElement.cs
│ ├── ISOFarm.cs
│ ├── ISOGrid.cs
│ ├── ISOGuidanceAllocation.cs
│ ├── ISOGuidanceGroup.cs
│ ├── ISOGuidancePattern.cs
│ ├── ISOGuidanceShift.cs
│ ├── ISOLineString.cs
│ ├── ISOLink.cs
│ ├── ISOLinkGroup.cs
│ ├── ISOOperTechPractice.cs
│ ├── ISOOperationTechnique.cs
│ ├── ISOOperationTechniqueReference.cs
│ ├── ISOPartfield.cs
│ ├── ISOPoint.cs
│ ├── ISOPolygon.cs
│ ├── ISOPosition.cs
│ ├── ISOProcessDataVariable.cs
│ ├── ISOProduct.cs
│ ├── ISOProductAllocation.cs
│ ├── ISOProductGroup.cs
│ ├── ISOProductRelation.cs
│ ├── ISOTask.cs
│ ├── ISOTaskControllerCapabilities.cs
│ ├── ISOTime.cs
│ ├── ISOTimeLog.cs
│ ├── ISOTreatmentZone.cs
│ ├── ISOValuePresentation.cs
│ ├── ISOWorker.cs
│ └── ISOWorkerAllocation.cs
├── ISOv4Plugin.csproj
├── Mappers
│ ├── AllocationStampMapper.cs
│ ├── BaseMapper.cs
│ ├── CodedCommentListMapper.cs
│ ├── CodedCommentMapper.cs
│ ├── CommentAllocationMapper.cs
│ ├── ConnectionMapper.cs
│ ├── CropTypeMapper.cs
│ ├── CropVarietyMapper.cs
│ ├── CustomerMapper.cs
│ ├── DataLogTriggerMapper.cs
│ ├── DeviceElementMapper.cs
│ ├── DeviceMapper.cs
│ ├── Factories
│ │ └── TimeLogMapperFactory.cs
│ ├── FarmMapper.cs
│ ├── GridMapper.cs
│ ├── GuidanceAllocationMapper.cs
│ ├── GuidanceGroupMapper.cs
│ ├── GuidancePatternMapper.cs
│ ├── GuidanceShiftMapper.cs
│ ├── LineStringMapper.cs
│ ├── LoggedDataMappers
│ │ ├── Export
│ │ │ ├── EnumeratedValueMapper.cs
│ │ │ └── NumericValueMapper.cs
│ │ └── Import
│ │ │ ├── ActualLoadingSystemStatusMeterCreator.cs
│ │ │ ├── CondensedWorkStateMeterCreator.cs
│ │ │ ├── ConnectorTypeMeterCreator.cs
│ │ │ ├── EnumeratedMeterFactory.cs
│ │ │ ├── IEnumeratedMeterCreator.cs
│ │ │ ├── NetWeightStateMeterCreator.cs
│ │ │ ├── PrescriptionControlMeterCreator.cs
│ │ │ ├── RepresentationValueInterpolator.cs
│ │ │ ├── SectionControlStateMeterCreator.cs
│ │ │ ├── SectionMapper.cs
│ │ │ ├── SkyConditionsMeterCreator.cs
│ │ │ ├── SpatialRecordMapper.cs
│ │ │ ├── WorkStateMeterCreator.cs
│ │ │ └── WorkingDataMapper.cs
│ ├── Manufacturers
│ │ ├── CNH.cs
│ │ └── ManufacturerFactory.cs
│ ├── MultiFileTimeLogMapper.cs
│ ├── PartfieldMapper.cs
│ ├── PointMapper.cs
│ ├── PolygonMapper.cs
│ ├── PrescriptionMapper.cs
│ ├── ProductGroupMapper.cs
│ ├── ProductMapper.cs
│ ├── TaskDataMapper.cs
│ ├── TaskMapper.cs
│ ├── TimeLogMapper.cs
│ ├── UniqueIdMapper.cs
│ ├── WorkerAllocationMapper.cs
│ └── WorkerMapper.cs
├── ObjectModel
│ ├── DeviceElementHierarchy.cs
│ ├── DeviceOperationTypes.cs
│ ├── Error.cs
│ ├── GridDescriptor.cs
│ ├── ISOOperationData.cs
│ ├── ISOSpatialRow.cs
│ ├── ISOUnit.cs
│ ├── InstanceIDMap.cs
│ └── SpatialValue.cs
├── Plugin.cs
├── Representation
│ ├── DdiDefinition.cs
│ ├── DdiLoader.cs
│ ├── DdiToUnitOfMeasureMapping.cs
│ ├── IsoUnitOfMeasureList.cs
│ ├── RepresentationMapper.cs
│ └── UnitFactory.cs
├── Resources
│ ├── IsoUnitOfMeasure.xml
│ └── ddiExport.txt
└── TaskDocumentWriter.cs
├── ISOv4PluginLogTest
├── ExportMappers
│ ├── BinaryWriterTest.cs
│ ├── DlvHeaderMapperTest.cs
│ ├── EnumeratedValueMapperTest.cs
│ ├── NumericValueMapperTest.cs
│ ├── PtnHeaderMapperTest.cs
│ ├── TaskMapperTest.cs
│ ├── TimHeaderMapperTest.cs
│ ├── TimeMapperTest.cs
│ └── TlgMapperTest.cs
├── ExporterTest.cs
├── Extensions
│ └── ExtensionMethodTest.cs
├── ISOv4PluginLogTest.csproj
├── ImportMappers
│ ├── LogMappers
│ │ ├── AcutalLoadingSystemStatusMeterCreatorTest.cs
│ │ ├── BinaryReaderTest.cs
│ │ ├── CondensedSectionOverrideStateMeterCreatorTest.cs
│ │ ├── CondensedWorkStateMeterCreatorTest.cs
│ │ ├── ConnectorTypeMeterCreatorTest.cs
│ │ ├── DocumentMapperTest.cs
│ │ ├── EnumeratedMeterFactoryTest.cs
│ │ ├── LoggedDataMapperTest.cs
│ │ ├── MeterMapperTest.cs
│ │ ├── NetWeightStateMeterCreatorTest.cs
│ │ ├── OperationDataMapperTest.cs
│ │ ├── PrescriptionControlMeterCreatorTest.cs
│ │ ├── RepresentationValueInterpolatorTest.cs
│ │ ├── SectionControlStateMeterCreatorTest.cs
│ │ ├── SectionMapperTest.cs
│ │ ├── SkyConditionsMeterCreatorTest.cs
│ │ ├── SpatialRecordMapperTest.cs
│ │ ├── StatusUpdateMapperTest.cs
│ │ ├── WorkOrderMapperTest.cs
│ │ ├── WorkStateMeterCreatorTest.cs
│ │ └── XmlReaders
│ │ │ ├── DlvReaderTest.cs
│ │ │ ├── PtnReaderTest.cs
│ │ │ ├── TimReaderTest.cs
│ │ │ └── XmlReaderTest.cs
│ ├── TimeScopeMapperTest.cs
│ └── UniqueIdMapperTest.cs
├── ImporterTest.cs
├── Models
│ ├── CTPTest.cs
│ ├── CTRTest.cs
│ ├── CVTTest.cs
│ ├── FRMTest.cs
│ ├── LSGTest.cs
│ ├── PDTTest.cs
│ ├── PFDTest.cs
│ ├── PLNTest.cs
│ ├── PNTTest.cs
│ ├── TIMTest.cs
│ ├── TLGTest.cs
│ └── TSKTest.cs
├── PluginTest.cs
├── Readers
│ ├── GrdReaderTest.cs
│ ├── TaskDataReaderTest.cs
│ ├── TaskdataTimReaderTest.cs
│ ├── TlgReaderTest.cs
│ └── TsksReaderTest.cs
└── Representation
│ ├── DdiLoaderTest.cs
│ ├── RepresentationMapperTest.cs
│ └── UomLookupTest.cs
├── ISOv4PluginTest
├── ISOv4PluginTest.csproj
├── Loaders
│ ├── AllocationTimestampLoaderTests.cs
│ ├── CommentLoaderTests.cs
│ ├── CropLoaderTests.cs
│ ├── CustomerLoaderTests.cs
│ ├── FarmLoaderTests.cs
│ ├── FieldLoaderTests.cs
│ ├── GuidanceShiftLoaderTest.cs
│ ├── LinkGroupLoaderTest.cs
│ ├── PrescriptionLoaderTest.cs
│ ├── ProductLoaderTests.cs
│ ├── ProductMixLoaderTests.cs
│ └── TaskSummaryLoaderTests.cs
├── TestData
│ ├── AllocationTimestamp
│ │ ├── Timestamp1.xml
│ │ ├── Timestamp2.xml
│ │ ├── Timestamp3.xml
│ │ ├── Timestamp4.xml
│ │ ├── Timestamp5.xml
│ │ ├── Timestamp6.xml
│ │ ├── Timestamp7.xml
│ │ └── Timestamp8.xml
│ ├── Comment
│ │ ├── CCT00002.xml
│ │ ├── Comment1.xml
│ │ ├── Comment10.xml
│ │ ├── Comment2.xml
│ │ ├── Comment3.xml
│ │ ├── Comment4.xml
│ │ ├── Comment5.xml
│ │ ├── Comment6.xml
│ │ ├── Comment7.xml
│ │ ├── Comment8.xml
│ │ └── Comment9.xml
│ ├── Crop
│ │ ├── CTP00003.xml
│ │ ├── Crop1.xml
│ │ ├── Crop2.xml
│ │ ├── Crop3.xml
│ │ ├── Crop4.xml
│ │ ├── Crop5.xml
│ │ └── Crop6.xml
│ ├── Customer
│ │ ├── CTR00005.xml
│ │ ├── Customer1.xml
│ │ ├── Customer2.xml
│ │ ├── Customer3.xml
│ │ ├── Customer4.xml
│ │ ├── Customer5.xml
│ │ ├── Customer6.xml
│ │ ├── Customer7.xml
│ │ └── Customer8.xml
│ ├── Farm
│ │ ├── FRM00004.xml
│ │ ├── Farm1.xml
│ │ ├── Farm2.xml
│ │ ├── Farm3.xml
│ │ ├── Farm4.xml
│ │ ├── Farm5.xml
│ │ ├── Farm6.xml
│ │ └── Farm7.xml
│ ├── Field
│ │ ├── Field1.xml
│ │ ├── Field10.xml
│ │ ├── Field11.xml
│ │ ├── Field12.xml
│ │ ├── Field3.xml
│ │ ├── Field5.xml
│ │ ├── Field6.xml
│ │ ├── Field7.xml
│ │ ├── Field8.xml
│ │ ├── Field9.xml
│ │ └── PFD00006.xml
│ ├── Guidance
│ │ ├── AllPatterns.json
│ │ ├── AllPatternsOutput.xml
│ │ ├── GroupsNoPatternsOrBoundary.json
│ │ ├── GroupsNoPatternsOrBoundaryOutput.xml
│ │ ├── GroupsWithBoundaryAndNoPatterns.json
│ │ ├── GroupsWithBoundaryAndNoPatternsOutput.xml
│ │ ├── GroupsWithBoundaryAndPatterns.json
│ │ └── GroupsWithBoundaryAndPatternsOutput.xml
│ ├── Prescription
│ │ ├── SingleProduct.json
│ │ ├── SingleProductOutput.txt
│ │ └── SingleProductOutput.xml
│ ├── Product
│ │ ├── PDT00005.xml
│ │ ├── PGP00001.xml
│ │ ├── PGP00002.xml
│ │ ├── Product1.xml
│ │ ├── Product2.xml
│ │ ├── Product3.xml
│ │ ├── Product4.xml
│ │ ├── Product5.xml
│ │ ├── Product6.xml
│ │ ├── Product7.xml
│ │ ├── Product8.xml
│ │ └── Product9.xml
│ ├── ProductMix
│ │ ├── PDT00002.xml
│ │ ├── ProductMix1.xml
│ │ ├── ProductMix2.xml
│ │ ├── ProductMix3.xml
│ │ └── ProductMix4.xml
│ ├── Summary
│ │ ├── Summary1.xml
│ │ ├── Summary2.xml
│ │ ├── Summary3.xml
│ │ ├── Summary4.xml
│ │ └── Summary5.xml
│ ├── TestData.Designer.cs
│ ├── TestData.resx
│ ├── TestData1.Designer.cs
│ ├── TreatmentZone
│ │ ├── MissingUnit.json
│ │ ├── MissingUnitOutput.xml
│ │ ├── MultipleVariables.json
│ │ ├── MultipleVariablesOutput.xml
│ │ ├── NoVariables.json
│ │ ├── NoVariablesOutput.xml
│ │ ├── UnsupportedUnitDimension.json
│ │ └── UnsupportedUnitDimensionOutput.xml
│ └── Worker
│ │ ├── NoWorkersPresent.json
│ │ ├── WorkersWithAllData.json
│ │ ├── WorkersWithAllDataOutput.xml
│ │ ├── WorkersWithNoContacts.json
│ │ ├── WorkersWithNoContactsOutput.xml
│ │ └── ZeroWorkersPresent.json
├── TestHelpers.cs
└── Writers
│ ├── GuidanceGroupWriterTests.cs
│ ├── GuidancePatternWriterTests.cs
│ ├── LinkListWriterTest.cs
│ ├── PrescriptionWriterTests.cs
│ ├── ShapeWriterTests.cs
│ ├── TreatmentZoneWriterTests.cs
│ └── WorkerWriterTests.cs
├── LICENSE
├── README.md
└── TestUtilities
├── DataCardUtility.cs
├── Datacards
├── Agco-MicroTrak.zip
├── KV.zip
├── agco c100 tc & jd sprayer 900-short.zip
└── agco c100 tc & jd sprayer 900.zip
└── TestUtilities.csproj
/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | charset = utf-8
5 | indent_style = space
6 | indent_size = 2
7 | trim_trailing_whitespace = true
8 | insert_final_newline = true
9 |
10 | [*.{html,ejs,css,scss,cs}]
11 | indent_size = 4
12 |
13 | [*.md]
14 | trim_trailing_whitespace = false
15 |
--------------------------------------------------------------------------------
/.github/workflows/ci.yml:
--------------------------------------------------------------------------------
1 | name: CI
2 |
3 | on:
4 | push:
5 | branches:
6 | - master
7 | - develop
8 | pull_request:
9 | branches:
10 | - master
11 | - develop
12 |
13 | jobs:
14 | build:
15 | runs-on: ubuntu-latest
16 |
17 | steps:
18 | - uses: actions/checkout@v4.1.6
19 | - name: Setup .NET Core SDK '8.0'
20 | uses: actions/setup-dotnet@v4.0.0
21 | with:
22 | dotnet-version: '8.0'
23 | - name: Install dependencies
24 | run: dotnet restore
25 | - name: Build
26 | run: dotnet build ./ISOv4Plugin/ISOv4Plugin.csproj -c Release -f netstandard2.0 --no-restore
--------------------------------------------------------------------------------
/.github/workflows/release.yml:
--------------------------------------------------------------------------------
1 | name: Release
2 |
3 | on:
4 | push:
5 | tags:
6 | - "v[0-9]+.[0-9]+.[0-9]+"
7 |
8 | jobs:
9 | build:
10 | runs-on: ubuntu-latest
11 |
12 | steps:
13 | - name: Checkout
14 | uses: actions/checkout@v2
15 | - name: Set VERSION variable from tag
16 | run: echo "VERSION=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_ENV
17 | - name: Set VERSION_NUMBER
18 | run: echo "VERSION_NUMBER=$(echo $VERSION | grep -i -P -o '^\d+\.\d+\.\d+')" >> $GITHUB_ENV
19 | - name: Build and Package
20 | run: dotnet pack ./ISOv4Plugin/ISOv4Plugin.csproj -c Release -o ./dist -p:NuspecFile=../AgGatewayISOPlugin.nuspec -p:NuspecProperties=version=${{ env.VERSION }} -p:FileVersion=${{ env.VERSION_NUMBER }}+${{ github.run_number }}
21 | - name: Push release to Github
22 | uses: svenstaro/upload-release-action@v2
23 | with:
24 | repo_token: ${{ secrets.GITHUB_TOKEN }}
25 | file: ./dist/AgGatewayISOPlugin.${{ env.VERSION }}.nupkg
26 | tag: ${{ github.ref }}
27 | - name: Push release to public Nuget
28 | run: dotnet nuget push ./dist/AgGatewayISOPlugin.${{ env.VERSION }}.nupkg --source https://api.nuget.org/v3/index.json --api-key ${NUGET_API_KEY}
29 | env:
30 | NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
31 |
--------------------------------------------------------------------------------
/.vscode/launch.json:
--------------------------------------------------------------------------------
1 | {
2 | // Use IntelliSense to find out which attributes exist for C# debugging
3 | // Use hover for the description of the existing attributes
4 | // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
5 | "version": "0.2.0",
6 | "configurations": [
7 | {
8 | "name": ".NET Core Attach",
9 | "type": "coreclr",
10 | "request": "attach",
11 | "processId": "${command:pickProcess}"
12 | }
13 | ]
14 | }
15 |
--------------------------------------------------------------------------------
/.vscode/tasks.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "2.0.0",
3 | "tasks": [
4 | {
5 | "label": "build",
6 | "command": "dotnet",
7 | "type": "process",
8 | "args": [
9 | "build",
10 | "${workspaceFolder}/ISOv4Plugin.sln"
11 | ],
12 | "problemMatcher": "$msCompile",
13 | "group": {
14 | "kind": "build",
15 | "isDefault": true
16 | }
17 | }
18 | ]
19 | }
20 |
--------------------------------------------------------------------------------
/AcceptanceTests/AcceptanceTests.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp2.0
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/AcceptanceTests/Asserts/Export/DlvHeaderAssert.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Linq;
3 | using AgGateway.ADAPT.ApplicationDataModel.LoggedData;
4 | using AgGateway.ADAPT.ISOv4Plugin.Extensions;
5 | using AgGateway.ADAPT.ISOv4Plugin.Models;
6 | using AgGateway.ADAPT.Representation.RepresentationSystem;
7 | using NUnit.Framework;
8 |
9 | namespace AcceptanceTests.Asserts.Export
10 | {
11 | public class DlvHeaderAssert
12 | {
13 | public static void AreEqual(List meters, List dlVs)
14 | {
15 | Assert.AreEqual(meters.Count(), dlVs.Count);
16 |
17 | var sortedMeters = meters.OrderBy(x => x.Id.FindIntIsoId()).ToList();
18 | for (int i = 0; i < sortedMeters.Count; i++)
19 | {
20 | var meter = sortedMeters[i];
21 | var dlv = dlVs[i];
22 | var matchingRepresentation = RepresentationManager.Instance.Representations.FirstOrDefault(x => x.DomainId == meter.Representation.Code);
23 | if (matchingRepresentation != null)
24 | Assert.AreEqual(matchingRepresentation.Ddi, dlv.A);
25 | }
26 | }
27 | }
28 | }
--------------------------------------------------------------------------------
/AcceptanceTests/Asserts/Export/IsoSpatialRecordAssert.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using AgGateway.ADAPT.ApplicationDataModel.LoggedData;
3 | using AgGateway.ADAPT.ApplicationDataModel.Shapes;
4 | using AgGateway.ADAPT.ISOv4Plugin.ObjectModel;
5 | using NUnit.Framework;
6 |
7 | namespace AcceptanceTests.Asserts.Export
8 | {
9 | public class IsoSpatialRecordAssert
10 | {
11 | private const double CoordinateMultiplier = 0.0000001;
12 |
13 | public static void AreEqual(IEnumerable adaptSpatialRecords, List meters, IEnumerable isoSpatialRecords)
14 | {
15 | using (var adaptSpatialRecordEnumerator = adaptSpatialRecords.GetEnumerator())
16 | using (var isoSpatialRecordEnumerator = isoSpatialRecords.GetEnumerator())
17 | {
18 | while (adaptSpatialRecordEnumerator.MoveNext())
19 | {
20 | isoSpatialRecordEnumerator.MoveNext();
21 | AreEqual(adaptSpatialRecordEnumerator.Current, isoSpatialRecordEnumerator.Current, meters);
22 | }
23 | }
24 | }
25 |
26 | private static void AreEqual(SpatialRecord adaptSpatialRecord, ISOSpatialRow isoSpatialRow, List meters)
27 | {
28 | Assert.AreEqual(adaptSpatialRecord.Timestamp, isoSpatialRow.TimeStart);
29 |
30 | var point = (Point)adaptSpatialRecord.Geometry;
31 | Assert.AreEqual((int)(point.X / CoordinateMultiplier), isoSpatialRow.EastPosition, CoordinateMultiplier);
32 | Assert.AreEqual((int)(point.Y / CoordinateMultiplier), isoSpatialRow.NorthPosition, CoordinateMultiplier);
33 | Assert.AreEqual(point.Z, isoSpatialRow.Elevation);
34 |
35 | SpatialValueAssert.AreEqual(isoSpatialRow, adaptSpatialRecord, meters);
36 | }
37 | }
38 | }
--------------------------------------------------------------------------------
/AcceptanceTests/Asserts/Export/TaskDataAssert.cs:
--------------------------------------------------------------------------------
1 | using System.Linq;
2 | using AgGateway.ADAPT.ApplicationDataModel.ADM;
3 | using AgGateway.ADAPT.ISOv4Plugin.Models;
4 |
5 | namespace AcceptanceTests.Asserts.Export
6 | {
7 | public class TaskDataAssert
8 | {
9 | public static void AreEqual(ApplicationDataModel applicationDataModel, ISO11783_TaskData isoTaskData, string cardPath)
10 | {
11 | var loggedData = applicationDataModel.Documents.LoggedData.ToList();
12 | var tasks = isoTaskData.Items.Where(x => x.GetType() == typeof (TSK)).Cast().ToList();
13 |
14 | TskAssert.AreEqual(loggedData, tasks, applicationDataModel.Catalog, cardPath);
15 | }
16 | }
17 | }
--------------------------------------------------------------------------------
/AcceptanceTests/Asserts/Export/TimAssert.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Linq;
3 | using AgGateway.ADAPT.ApplicationDataModel.Common;
4 | using AgGateway.ADAPT.ISOv4Plugin.Models;
5 | using NUnit.Framework;
6 |
7 | namespace AcceptanceTests.Asserts.Export
8 | {
9 | public class TimAssert
10 | {
11 | public static void AreEqual(List timescopes, List tims)
12 | {
13 | for (var i = 0; i < timescopes.Count(); i++)
14 | {
15 | AreEqual(timescopes[i], tims[i]);
16 | }
17 | }
18 |
19 | private static void AreEqual(TimeScope timeScope, TIM tim)
20 | {
21 | Assert.AreEqual(timeScope.TimeStamp1, tim.A);
22 | Assert.AreEqual(timeScope.TimeStamp2, tim.B);
23 |
24 | // todo. check other attributes and PTN, dlvs,....
25 | }
26 | }
27 | }
--------------------------------------------------------------------------------
/AcceptanceTests/Asserts/Export/TlgAssert.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Diagnostics;
4 | using System.IO;
5 | using System.Linq;
6 | using AgGateway.ADAPT.ApplicationDataModel.ADM;
7 | using AgGateway.ADAPT.ApplicationDataModel.Common;
8 | using AgGateway.ADAPT.ApplicationDataModel.LoggedData;
9 | using AgGateway.ADAPT.ISOv4Plugin;
10 | using AgGateway.ADAPT.ISOv4Plugin.Extensions;
11 | using AgGateway.ADAPT.ISOv4Plugin.ImportMappers.LogMappers.XmlReaders;
12 | using AgGateway.ADAPT.ISOv4Plugin.Models;
13 | using Moq;
14 | using NUnit.Framework;
15 | using BinaryReader = AgGateway.ADAPT.ISOv4Plugin.ImportMappers.LogMappers.BinaryReader;
16 |
17 | namespace AcceptanceTests.Asserts.Export
18 | {
19 | public class TlgAssert
20 | {
21 | public static void AreEqual(List operationDatas, List tlgs, Catalog catalog, string cardPath)
22 | {
23 | foreach (var operationData in operationDatas)
24 | {
25 | var matchingTlg = tlgs.SingleOrDefault(x => x.A == operationData.Id.FindIsoId());
26 | AreEqual(operationData, catalog.TimeScopes, matchingTlg, cardPath);
27 | }
28 | }
29 |
30 | private static void AreEqual(OperationData operationData, List timeScopes, TLG tlg, string cardPath)
31 | {
32 | var fileName = tlg.A + ".xml";
33 | var tlgXmlHeaderFilePath = Path.Combine(cardPath, "TASKDATA", fileName);
34 | Assert.IsTrue(File.Exists(tlgXmlHeaderFilePath));
35 |
36 | var tims = new XmlReader().ReadTlgXmlData(cardPath, fileName);
37 | TimAssert.AreEqual(timeScopes, tims);
38 |
39 | var sections = operationData.GetAllSections();
40 | var meters = sections.SelectMany(x => x.GetWorkingDatas()).ToList();
41 | var adaptSpatialRecords = operationData.GetSpatialRecords();
42 | var binaryReader = new BinaryReader();
43 | var isoSpatialRecords = binaryReader.Read(cardPath, tlg.A + ".bin", tims.First());
44 |
45 | IsoSpatialRecordAssert.AreEqual(adaptSpatialRecords, meters, isoSpatialRecords);
46 | }
47 | }
48 | }
--------------------------------------------------------------------------------
/AcceptanceTests/Asserts/Export/TskAssert.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Linq;
3 | using AgGateway.ADAPT.ApplicationDataModel.ADM;
4 | using AgGateway.ADAPT.ApplicationDataModel.LoggedData;
5 | using AgGateway.ADAPT.ISOv4Plugin;
6 | using AgGateway.ADAPT.ISOv4Plugin.Extensions;
7 | using AgGateway.ADAPT.ISOv4Plugin.Models;
8 | using NUnit.Framework;
9 |
10 | namespace AcceptanceTests.Asserts.Export
11 | {
12 | public class TskAssert
13 | {
14 | public static void AreEqual(List loggedDatas, List tsks, Catalog catalog, string cardPath)
15 | {
16 | tsks = tsks.OrderBy(x => x.A).ToList();
17 | for (int i = 0; i < loggedDatas.Count; i++)
18 | {
19 | var loggedData = loggedDatas[i];
20 | var matchingTask = tsks[tsks.Count - loggedDatas.Count + i];
21 | AreEqual(loggedData, matchingTask, catalog, cardPath);
22 | }
23 | }
24 |
25 | private static void AreEqual(LoggedData loggedData, TSK tsk, Catalog catalog, string cardPath)
26 | {
27 | var grower = catalog.Growers.SingleOrDefault(x => x.Id.ReferenceId == loggedData.GrowerId);
28 | var farm = catalog.Farms.SingleOrDefault(x => x.Id.ReferenceId == loggedData.FarmId);
29 | var field = catalog.Fields.SingleOrDefault(x => x.Id.ReferenceId == loggedData.FieldId);
30 |
31 | if(grower != null)
32 | Assert.AreEqual(grower.Id.FindIsoId(), tsk.C);
33 | if (farm != null)
34 | Assert.AreEqual(farm.Id.FindIsoId(), tsk.D);
35 | if (field != null)
36 | Assert.AreEqual(field.Id.FindIsoId(), tsk.E);
37 |
38 | if(loggedData.TimeScopes != null && loggedData.TimeScopes.Any())
39 | {
40 | var tims = tsk.Items.Where(x => x.GetType() == typeof(TIM)).Cast().ToList();
41 | TimAssert.AreEqual(loggedData.TimeScopes, tims);
42 | }
43 |
44 | if(loggedData.OperationData != null && loggedData.OperationData.Any())
45 | {
46 | var tlgs = tsk.Items.Where(x => x.GetType() == typeof(TLG)).Cast().ToList();
47 | TlgAssert.AreEqual(loggedData.OperationData.ToList(), tlgs, catalog, cardPath);
48 | }
49 | }
50 |
51 | }
52 | }
--------------------------------------------------------------------------------
/AcceptanceTests/Asserts/Import/ApplicationDataModelAssert.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Xml;
3 | using AcceptanceTests.Steps;
4 | using AgGateway.ADAPT.ApplicationDataModel.ADM;
5 | using AgGateway.ADAPT.ApplicationDataModel.Common;
6 | using AgGateway.ADAPT.ISOv4Plugin.Models;
7 |
8 | namespace AcceptanceTests.Asserts.Import
9 | {
10 | public class ApplicationDataModelAssert
11 | {
12 | public static void AreEqual(XmlNode taskData, ApplicationDataModel applicationDataModel, string currentPath, Dictionary> linkList)
13 | {
14 | CatalogAssert.AreEqual(taskData, applicationDataModel.Catalog, linkList);
15 | DocumentsAssert.AreEqual(taskData, applicationDataModel.Documents, applicationDataModel.Catalog, currentPath);
16 | }
17 | }
18 | }
--------------------------------------------------------------------------------
/AcceptanceTests/Asserts/Import/CatalogAssert.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Xml;
3 | using AgGateway.ADAPT.ApplicationDataModel.ADM;
4 | using AgGateway.ADAPT.ApplicationDataModel.Common;
5 |
6 | namespace AcceptanceTests.Asserts.Import
7 | {
8 | public class CatalogAssert
9 | {
10 | public static void AreEqual(XmlNode taskData, Catalog catalog, Dictionary> linkList)
11 | {
12 | CropAssert.AreEqual(taskData.SelectNodes("CTP"), catalog.Crops, catalog, linkList);
13 | FarmAssert.AreEqual(taskData.SelectNodes("FRM"), catalog.Farms, catalog, linkList);
14 | FieldAssert.AreEqual(taskData.SelectNodes("PFD"), catalog.Fields, catalog, linkList);
15 | GrowerAssert.AreEqual(taskData.SelectNodes("CTR"), catalog.Growers, linkList);
16 | ProductAssert.AreEqual(taskData.SelectNodes("PDT"), catalog, linkList);
17 | }
18 | }
19 | }
--------------------------------------------------------------------------------
/AcceptanceTests/Asserts/Import/CropAssert.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Linq;
3 | using System.Xml;
4 | using AgGateway.ADAPT.ApplicationDataModel.ADM;
5 | using AgGateway.ADAPT.ApplicationDataModel.Common;
6 | using AgGateway.ADAPT.ApplicationDataModel.Products;
7 | using AgGateway.ADAPT.ISOv4Plugin.Extensions;
8 | using NUnit.Framework;
9 |
10 | namespace AcceptanceTests.Asserts.Import
11 | {
12 | public class CropAssert
13 | {
14 | public static void AreEqual(XmlNodeList ctpNodes, List crops, Catalog catalog, Dictionary> linkList)
15 | {
16 | for (var i = 0; i < ctpNodes.Count; i++)
17 | {
18 | AreEqual(ctpNodes[i], crops[i], catalog, linkList);
19 | }
20 | }
21 |
22 | private static void AreEqual(XmlNode ctpNode, Crop crop, Catalog catalog, Dictionary> linkList)
23 | {
24 | UniqueIdAssert.AreEqual(linkList, ctpNode.GetXmlAttribute("A"), crop.Id.UniqueIds);
25 | Assert.AreEqual(ctpNode.GetXmlAttribute("A"), crop.Id.FindIsoId());
26 | Assert.AreEqual(ctpNode.GetXmlAttribute("B"), crop.Name);
27 |
28 | var matchingCropVarieties = catalog.Products.Where(x => x is CropVarietyProduct).Cast().Where(cv => cv.CropId == crop.Id.ReferenceId).ToList();
29 | CropVarietyAssert.AreEqual(ctpNode.SelectNodes("CVT"), matchingCropVarieties, linkList);
30 | }
31 | }
32 | }
--------------------------------------------------------------------------------
/AcceptanceTests/Asserts/Import/CropVarietyAssert.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Linq;
3 | using System.Xml;
4 | using AgGateway.ADAPT.ApplicationDataModel.Common;
5 | using AgGateway.ADAPT.ApplicationDataModel.Products;
6 | using AgGateway.ADAPT.ISOv4Plugin.Extensions;
7 | using NUnit.Framework;
8 |
9 | namespace AcceptanceTests.Asserts.Import
10 | {
11 | public class CropVarietyAssert
12 | {
13 | public static void AreEqual(XmlNodeList cropVarietyNodes, List cropVarieties, Dictionary> linkList)
14 | {
15 | for (var i = 0; i < cropVarieties.Count(); ++i)
16 | {
17 | AreEqual(cropVarietyNodes[i], cropVarieties[i], linkList);
18 | }
19 | }
20 |
21 | private static void AreEqual(XmlNode cropVarietyNode, CropVarietyProduct cropVariety, Dictionary> linkList)
22 | {
23 | UniqueIdAssert.AreEqual(linkList, cropVarietyNode.GetXmlAttribute("A"), cropVariety.Id.UniqueIds);
24 | Assert.AreEqual(cropVarietyNode.GetXmlAttribute("A"), cropVariety.Id.FindIsoId());
25 | Assert.AreEqual(cropVarietyNode.GetXmlAttribute("B"), cropVariety.Description);
26 | }
27 | }
28 | }
--------------------------------------------------------------------------------
/AcceptanceTests/Asserts/Import/DocumentsAssert.cs:
--------------------------------------------------------------------------------
1 | using System.Linq;
2 | using System.Xml;
3 | using AgGateway.ADAPT.ApplicationDataModel.ADM;
4 | using AgGateway.ADAPT.ISOv4Plugin.Extensions;
5 | using AgGateway.ADAPT.ISOv4Plugin.Models;
6 |
7 | namespace AcceptanceTests.Asserts.Import
8 | {
9 | public class DocumentsAssert
10 | {
11 | public static void AreEqual(XmlNode taskData, Documents documents, Catalog catalog, string currentPath)
12 | {
13 | var tskNodes = taskData.SelectNodes("TSK");
14 |
15 | LoggedDataAssert.AreEqual(tskNodes, currentPath, documents.LoggedData.ToList(), catalog);
16 | }
17 | }
18 | }
--------------------------------------------------------------------------------
/AcceptanceTests/Asserts/Import/FarmAssert.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Xml;
5 | using AgGateway.ADAPT.ApplicationDataModel.ADM;
6 | using AgGateway.ADAPT.ApplicationDataModel.Common;
7 | using AgGateway.ADAPT.ApplicationDataModel.Logistics;
8 | using AgGateway.ADAPT.ISOv4Plugin.Extensions;
9 | using NUnit.Framework;
10 |
11 | namespace AcceptanceTests.Asserts.Import
12 | {
13 | public class FarmAssert
14 | {
15 | public static void AreEqual(XmlNodeList farmNodes, List farms, Catalog catalog, Dictionary> linkList)
16 | {
17 | for (int i = 0; i < farmNodes.Count; i++)
18 | {
19 | AreEqual(farmNodes[i], farms[i], catalog, linkList);
20 | }
21 | }
22 |
23 | private static void AreEqual(XmlNode farmNode, Farm farm, Catalog catalog, Dictionary> linkList)
24 | {
25 | UniqueIdAssert.AreEqual(linkList, farmNode.GetXmlAttribute("A"), farm.Id.UniqueIds);
26 | Assert.AreEqual(farmNode.GetXmlAttribute("A"), farm.Id.FindIsoId());
27 | Assert.AreEqual(farmNode.GetXmlAttribute("B"), farm.Description);
28 |
29 | Assert.AreEqual(farmNode.GetXmlAttribute("C"), farm.ContactInfo.AddressLine1);
30 | Assert.AreEqual(farmNode.GetXmlAttribute("D"), farm.ContactInfo.PoBoxNumber);
31 | Assert.AreEqual(farmNode.GetXmlAttribute("E"), farm.ContactInfo.PostalCode);
32 | Assert.AreEqual(farmNode.GetXmlAttribute("F"), farm.ContactInfo.City);
33 | Assert.AreEqual(farmNode.GetXmlAttribute("G"), farm.ContactInfo.StateOrProvince);
34 | Assert.AreEqual(farmNode.GetXmlAttribute("H"), farm.ContactInfo.Country);
35 |
36 | var customerId = farmNode.GetXmlAttribute("I");
37 | if(!String.IsNullOrEmpty(customerId))
38 | {
39 | var grower = catalog.Growers.Single(x => x.Id.ReferenceId == farm.GrowerId);
40 | Assert.AreEqual(customerId, grower.Id.FindIsoId());
41 | }
42 | }
43 | }
44 | }
--------------------------------------------------------------------------------
/AcceptanceTests/Asserts/Import/FertilizerProductAssert.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Xml;
3 | using AgGateway.ADAPT.ApplicationDataModel.Common;
4 | using AgGateway.ADAPT.ApplicationDataModel.Products;
5 | using AgGateway.ADAPT.ISOv4Plugin.Extensions;
6 | using NUnit.Framework;
7 |
8 | namespace AcceptanceTests.Asserts.Import
9 | {
10 | public class FertilizerProductAssert
11 | {
12 | public static void AreEqual(XmlNode productNode, CropNutritionProduct fertilizerProduct, Dictionary> linkList)
13 | {
14 | if (productNode.GetXmlAttribute("A") == null || productNode.GetXmlAttribute("B") == null)
15 | return;
16 |
17 | UniqueIdAssert.AreEqual(linkList, productNode.GetXmlAttribute("A"), fertilizerProduct.Id.UniqueIds);
18 | Assert.AreEqual(productNode.GetXmlAttribute("A"), fertilizerProduct.Id.FindIsoId());
19 | Assert.AreEqual(productNode.GetXmlAttribute("B"), fertilizerProduct.Description);
20 | }
21 | }
22 | }
--------------------------------------------------------------------------------
/AcceptanceTests/Asserts/Import/GuidanceGroupAssert.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Xml;
4 | using AgGateway.ADAPT.ApplicationDataModel.ADM;
5 | using AgGateway.ADAPT.ApplicationDataModel.Common;
6 | using AgGateway.ADAPT.ApplicationDataModel.Guidance;
7 |
8 | namespace AcceptanceTests.Asserts.Import
9 | {
10 | public class GuidanceGroupAssert
11 | {
12 | public static void AreEqual(XmlNodeList ggpNodes, IEnumerable guidanceGroups, Catalog catalog, Dictionary> linkList)
13 | {
14 | throw new NotImplementedException();
15 | }
16 | }
17 | }
--------------------------------------------------------------------------------
/AcceptanceTests/Asserts/Import/LoggedDataAssert.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Linq;
3 | using System.Xml;
4 | using AgGateway.ADAPT.ApplicationDataModel.ADM;
5 | using AgGateway.ADAPT.ApplicationDataModel.LoggedData;
6 | using AgGateway.ADAPT.ISOv4Plugin.Extensions;
7 | using NUnit.Framework;
8 |
9 | namespace AcceptanceTests.Asserts.Import
10 | {
11 | public class LoggedDataAssert
12 | {
13 | public static void AreEqual(XmlNodeList tskNodes, string currentPath, List loggedData, Catalog catalog)
14 | {
15 | int tsksWithTlgs = 0;
16 | foreach (XmlNode node in tskNodes)
17 | {
18 | if (node.SelectNodes("TLG").Count > 0)
19 | {
20 | tsksWithTlgs++;
21 |
22 | var matchingLoggedData = loggedData.SingleOrDefault(x => x.Id.FindIsoId() == node.Attributes["A"].Value);
23 | AreEqual(node, currentPath, matchingLoggedData, catalog);
24 | }
25 | }
26 |
27 | Assert.AreEqual(tsksWithTlgs, loggedData.Count);
28 | }
29 |
30 | private static void AreEqual(XmlNode tskNode, string currentPath, LoggedData loggedData, Catalog catalog)
31 | {
32 | var tlgNodes = tskNode.SelectNodes("TLG");
33 | OperationDataAssert.AreEqual(tlgNodes, currentPath, loggedData.OperationData.ToList());
34 | }
35 | }
36 | }
--------------------------------------------------------------------------------
/AcceptanceTests/Asserts/Import/MultiPolygonAssert.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Xml;
3 | using AgGateway.ADAPT.ApplicationDataModel.Shapes;
4 | using AgGateway.ADAPT.ISOv4Plugin.Extensions;
5 |
6 | namespace AcceptanceTests.Asserts.Import
7 | {
8 | public class MultiPolygonAssert
9 | {
10 | public static void AreEqual(XmlNodeList polygonNodes, MultiPolygon multiPolygon)
11 | {
12 | for (int i = 0; i < polygonNodes.Count; i++)
13 | {
14 | AreEqual(polygonNodes[i], multiPolygon.Polygons[i]);
15 | }
16 | }
17 |
18 | private static void AreEqual(XmlNode polygonNode, Polygon polygon)
19 | {
20 | var lineNodes = polygonNode.SelectNodes("LSG");
21 | var exteriorNode = GetExteriorNode(lineNodes);
22 | var interiorNodes = GetInteriorNodes(lineNodes);
23 | var exteriorRing = polygon.ExteriorRing;
24 | var interiorRings = polygon.InteriorRings;
25 |
26 | RingAssert.AreEqual(exteriorNode, exteriorRing);
27 | RingAssert.AreEqual(interiorNodes, interiorRings);
28 | }
29 |
30 | private static XmlNode GetExteriorNode(XmlNodeList lineNodes)
31 | {
32 | for (int i = 0; i < lineNodes.Count; i++)
33 | {
34 | if (lineNodes[i].GetXmlAttribute("A") == "1")
35 | return lineNodes[i];
36 | }
37 | return null;
38 | }
39 |
40 | private static List GetInteriorNodes(XmlNodeList lineNodes)
41 | {
42 | var nodes = new List();
43 | for (int i = 0; i < lineNodes.Count; i++)
44 | {
45 | if (lineNodes[i].GetXmlAttribute("A") == "2")
46 | nodes.Add(lineNodes[i]);
47 | }
48 | return nodes;
49 | }
50 | }
51 | }
--------------------------------------------------------------------------------
/AcceptanceTests/Asserts/Import/OperationDataAssert.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Linq;
3 | using System.Xml;
4 | using AgGateway.ADAPT.ApplicationDataModel.LoggedData;
5 | using AgGateway.ADAPT.ISOv4Plugin.Extensions;
6 | using AgGateway.ADAPT.ISOv4Plugin.ImportMappers.LogMappers;
7 | using AgGateway.ADAPT.ISOv4Plugin.ObjectModel;
8 | using NUnit.Framework;
9 | using XmlReader = AgGateway.ADAPT.ISOv4Plugin.ImportMappers.LogMappers.XmlReaders.XmlReader;
10 |
11 | namespace AcceptanceTests.Asserts.Import
12 | {
13 | public class OperationDataAssert
14 | {
15 | public static void AreEqual(XmlNodeList tlgNodes, string currentPath, List operationData)
16 | {
17 | Assert.AreEqual(tlgNodes.Count, operationData.Count);
18 | for (int i = 0; i < tlgNodes.Count; i++)
19 | {
20 | var matchingOperationData = operationData.SingleOrDefault(x => x.Id.FindIsoId() == tlgNodes[i].Attributes["A"].Value);
21 | AreEqual(tlgNodes[i], currentPath, matchingOperationData);
22 | }
23 | }
24 |
25 | private static void AreEqual(XmlNode tlgNode, string currentPath, OperationData operationData)
26 | {
27 | var isoSpatialRecords = GetIsoSpatialRecords(tlgNode.Attributes["A"].Value, currentPath).ToList();
28 | var adaptSpatialRecords = operationData.GetSpatialRecords().ToList();
29 |
30 | var sections = operationData.GetAllSections();
31 | var meters = sections.SelectMany(x => x.GetWorkingDatas()).ToList();
32 |
33 | SpatialRecordAssert.AreEqual(isoSpatialRecords, adaptSpatialRecords, meters);
34 | }
35 |
36 | private static IEnumerable GetIsoSpatialRecords(string tlgA, string currentPath)
37 | {
38 | var xmlReader = new XmlReader();
39 | var timHeader = xmlReader.ReadTlgXmlData(currentPath, tlgA + ".xml");
40 | var binaryReader = new BinaryReader();
41 | return binaryReader.Read(currentPath, tlgA + ".bin", timHeader.First()).ToList();
42 | }
43 | }
44 | }
--------------------------------------------------------------------------------
/AcceptanceTests/Asserts/Import/PointAssert.cs:
--------------------------------------------------------------------------------
1 | using System.Xml;
2 | using AgGateway.ADAPT.ApplicationDataModel.Shapes;
3 | using AgGateway.ADAPT.ISOv4Plugin.Extensions;
4 | using NUnit.Framework;
5 |
6 | namespace AcceptanceTests.Asserts.Import
7 | {
8 | public class PointAssert
9 | {
10 | public static void AreEqual(XmlNode pointNode, Point point)
11 | {
12 | Assert.AreEqual(double.Parse(pointNode.GetXmlAttribute("C")), point.Y);
13 | Assert.AreEqual(double.Parse(pointNode.GetXmlAttribute("D")), point.X);
14 | }
15 | }
16 | }
--------------------------------------------------------------------------------
/AcceptanceTests/Asserts/Import/ProductAssert.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Linq;
3 | using System.Xml;
4 | using AgGateway.ADAPT.ApplicationDataModel.ADM;
5 | using AgGateway.ADAPT.ApplicationDataModel.Common;
6 | using AgGateway.ADAPT.ApplicationDataModel.Products;
7 | using AgGateway.ADAPT.ISOv4Plugin.Extensions;
8 |
9 | namespace AcceptanceTests.Asserts.Import
10 | {
11 | public class ProductAssert
12 | {
13 | public static void AreEqual(XmlNodeList productNodes, Catalog catalog, Dictionary> linkList)
14 | {
15 | for (int i = 0; i < productNodes.Count; i++)
16 | {
17 | if (productNodes[i].GetXmlAttribute("F") == "1")//fertilizerProduct
18 | {
19 | var matchingFertilizer = catalog.Products.Single(fp => fp.Id.FindIsoId() == productNodes[i].GetXmlAttribute("A")) as CropNutritionProduct;
20 | FertilizerProductAssert.AreEqual(productNodes[i], matchingFertilizer, linkList);
21 |
22 | }
23 | else if (productNodes[i].GetXmlAttribute("F") == "2")//productMix
24 | {
25 | var matchingProductMix = catalog.Products.Single(pm => pm.Id.FindIsoId() == productNodes[i].GetXmlAttribute("A")) as MixProduct;
26 | ProductMixAssert.AreEqual(productNodes[i], productNodes, matchingProductMix, catalog, linkList);
27 | }
28 | }
29 | }
30 | }
31 | }
--------------------------------------------------------------------------------
/AcceptanceTests/Asserts/Import/ProductComponentAssert.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Xml;
5 | using AgGateway.ADAPT.ApplicationDataModel.ADM;
6 | using AgGateway.ADAPT.ApplicationDataModel.Common;
7 | using AgGateway.ADAPT.ApplicationDataModel.Products;
8 | using AgGateway.ADAPT.ISOv4Plugin.Extensions;
9 | using AgGateway.ADAPT.ISOv4Plugin.Representation;
10 | using NUnit.Framework;
11 |
12 | namespace AcceptanceTests.Asserts.Import
13 | {
14 | public class ProductComponentAssert
15 | {
16 | public static void AreEqual(XmlNodeList prnNodes, List productComponents, XmlNodeList productNodes, Catalog catalog, Dictionary> linkList)
17 | {
18 | for (int i = 0; i < prnNodes.Count; i++)
19 | {
20 | AreEqual(prnNodes[i], productComponents[i], productNodes, catalog, linkList);
21 | }
22 | }
23 |
24 | private static void AreEqual(XmlNode prnNode, ProductComponent productComponent, XmlNodeList productNodes, Catalog catalog, Dictionary> linkList)
25 | {
26 | var productNode = FindMatchingProductNode(prnNode.GetXmlAttribute("A"), productNodes);
27 | if (productNode == null)
28 | return;
29 |
30 | var quantityDdi = Int32.Parse(productNode.GetXmlAttribute("E"));
31 | var uom = new RepresentationMapper().GetUnitForDdi(quantityDdi);
32 | Assert.AreEqual(uom, productComponent.Quantity.Value.UnitOfMeasure);
33 | Assert.AreEqual(prnNode.GetXmlAttribute("B"), productComponent.Quantity.Value.Value);
34 |
35 | var ingredient = catalog.Ingredients.Single(x => x.Id.ReferenceId == productComponent.IngredientId);
36 | Assert.AreEqual(productNode.GetXmlAttribute("B"), ingredient.Description);
37 | }
38 |
39 | private static XmlNode FindMatchingProductNode(string productReferenceId, XmlNodeList productNodes)
40 | {
41 | for (int i = 0; i < productNodes.Count; i++)
42 | {
43 | if (productNodes[i].GetXmlAttribute("A") == productReferenceId)
44 | return productNodes[i];
45 | }
46 | return null;
47 | }
48 | }
49 | }
--------------------------------------------------------------------------------
/AcceptanceTests/Asserts/Import/ProductMixAssert.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Xml;
3 | using AgGateway.ADAPT.ApplicationDataModel.ADM;
4 | using AgGateway.ADAPT.ApplicationDataModel.Common;
5 | using AgGateway.ADAPT.ApplicationDataModel.Products;
6 | using AgGateway.ADAPT.ISOv4Plugin.Extensions;
7 | using NUnit.Framework;
8 |
9 | namespace AcceptanceTests.Asserts.Import
10 | {
11 | public class ProductMixAssert
12 | {
13 | public static void AreEqual(XmlNode productNode, XmlNodeList productNodes, MixProduct productMix, Catalog catalog, Dictionary> linkList)
14 | {
15 | if (productNode.GetXmlAttribute("A") == null || productNode.GetXmlAttribute("B") == null)
16 | return;
17 |
18 | UniqueIdAssert.AreEqual(linkList, productNode.GetXmlAttribute("A"), productMix.Id.UniqueIds);
19 | Assert.AreEqual(productNode.GetXmlAttribute("A"), productMix.Id.FindIsoId());
20 | Assert.AreEqual(productNode.GetXmlAttribute("B"), productMix.Description);
21 |
22 | var prnNodes = productNode.SelectNodes("PRN");
23 | ProductComponentAssert.AreEqual(prnNodes, productMix.ProductComponents, productNodes, catalog, linkList);
24 | }
25 | }
26 | }
--------------------------------------------------------------------------------
/AcceptanceTests/Asserts/Import/RingAssert.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Xml;
3 | using AgGateway.ADAPT.ApplicationDataModel.Shapes;
4 |
5 | namespace AcceptanceTests.Asserts.Import
6 | {
7 | public class RingAssert
8 | {
9 | public static void AreEqual(List nodes, List rings)
10 | {
11 | for (int i = 0; i < nodes.Count; i++)
12 | {
13 | AreEqual(nodes[i], rings[i]);
14 | }
15 | }
16 |
17 | public static void AreEqual(XmlNode node, LinearRing ring)
18 | {
19 | var pointNodes = node.SelectNodes("PNT");
20 | var points = ring.Points;
21 | for (int i = 0; i < pointNodes.Count; i++)
22 | {
23 | PointAssert.AreEqual(pointNodes[i], points[i]);
24 | }
25 | }
26 | }
27 | }
--------------------------------------------------------------------------------
/AcceptanceTests/Asserts/Import/SpatialRecordAssert.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Linq;
3 | using AgGateway.ADAPT.ApplicationDataModel.LoggedData;
4 | using AgGateway.ADAPT.ApplicationDataModel.Shapes;
5 | using AgGateway.ADAPT.ISOv4Plugin.ObjectModel;
6 | using NUnit.Framework;
7 |
8 | namespace AcceptanceTests.Asserts.Import
9 | {
10 | public class SpatialRecordAssert
11 | {
12 | private const double CoordinateMultiplier = 0.0000001;
13 |
14 | public static void AreEqual(IEnumerable isoSpatialRows, IEnumerable adaptSpatialRecords, IEnumerable meters)
15 | {
16 | Assert.AreEqual(isoSpatialRows.Count(), adaptSpatialRecords.Count());
17 | for (int i = 0; i < isoSpatialRows.Count(); i++)
18 | {
19 | AreEqual(isoSpatialRows.ElementAt(i), adaptSpatialRecords.ElementAt(i), meters);
20 | }
21 | }
22 |
23 | private static void AreEqual(ISOSpatialRow isoSpatialRow, SpatialRecord adaptSpatialRecord, IEnumerable meters)
24 | {
25 | Assert.AreEqual(isoSpatialRow.TimeStart, adaptSpatialRecord.Timestamp);
26 |
27 | var point = adaptSpatialRecord.Geometry as Point;
28 | Assert.AreEqual(isoSpatialRow.EastPosition * CoordinateMultiplier, point.X, 0.000001);
29 | Assert.AreEqual(isoSpatialRow.NorthPosition * CoordinateMultiplier, point.Y, 0.000001);
30 | Assert.AreEqual(isoSpatialRow.Elevation, point.Z);
31 |
32 | SpatialValueAssert.AreEqual(isoSpatialRow, adaptSpatialRecord, meters);
33 | }
34 | }
35 | }
--------------------------------------------------------------------------------
/AcceptanceTests/Asserts/Import/SpatialValueAssert.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Linq;
3 | using AgGateway.ADAPT.ApplicationDataModel.LoggedData;
4 | using AgGateway.ADAPT.ApplicationDataModel.Representations;
5 | using AgGateway.ADAPT.ISOv4Plugin;
6 | using AgGateway.ADAPT.ISOv4Plugin.Extensions;
7 | using AgGateway.ADAPT.ISOv4Plugin.ImportMappers.LogMappers;
8 | using AgGateway.ADAPT.ISOv4Plugin.ObjectModel;
9 | using NUnit.Framework;
10 |
11 | namespace AcceptanceTests.Asserts.Import
12 | {
13 | public class SpatialValueAssert
14 | {
15 | public static void AreEqual(ISOSpatialRow isoSpatialRow, SpatialRecord adaptSpatialRecord, IEnumerable meters)
16 | {
17 | foreach (var meter in meters)
18 | {
19 | var isoValue = isoSpatialRow.SpatialValues.SingleOrDefault(v => v.Id == meter.Id.FindIntIsoId());
20 |
21 | if(isoValue == null)
22 | continue;
23 |
24 | if (meter is NumericWorkingData)
25 | {
26 | var numericMeter = meter as NumericWorkingData;
27 |
28 | var numericRepresentationValue = (NumericRepresentationValue)adaptSpatialRecord.GetMeterValue(numericMeter);
29 | if (isoValue != null)
30 | Assert.AreEqual(isoValue.Value, numericRepresentationValue.Value.Value);
31 | }
32 | if (meter is EnumeratedWorkingData)
33 | {
34 | //var isoEnumeratedMeter = meter as ISOEnumeratedMeter;
35 | //var enumeratedValue = isoEnumeratedMeter.GetEnumeratedValue(isoValue, isoEnumeratedMeter);
36 | //Assert.AreEqual(enumeratedValue.Representation.Description, meter.Representation.Description);
37 | }
38 | }
39 | }
40 | }
41 | }
--------------------------------------------------------------------------------
/AcceptanceTests/Asserts/Import/TimeScopeAssert.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Linq;
3 | using AgGateway.ADAPT.ApplicationDataModel.Common;
4 | using AgGateway.ADAPT.ISOv4Plugin.Models;
5 | using NUnit.Framework;
6 |
7 | namespace AcceptanceTests.Asserts.Import
8 | {
9 | public class TimeScopeAssert
10 | {
11 | public static void AreEqual(List tims, IEnumerable timescopes)
12 | {
13 | var timescopeList = timescopes.ToList();
14 |
15 | for (int i = 0; i < tims.Count; i++)
16 | {
17 | Assert.AreEqual(tims[i].A, timescopeList[i].TimeStamp1);
18 | Assert.AreEqual(DateContextEnum.ActualStart, timescopeList[i].DateContext);
19 | Assert.AreEqual(tims[i].B, timescopeList[i].TimeStamp2);
20 | }
21 | }
22 | }
23 | }
--------------------------------------------------------------------------------
/AcceptanceTests/Asserts/Import/UniqueIdAssert.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Linq;
3 | using AgGateway.ADAPT.ApplicationDataModel.Common;
4 | using NUnit.Framework;
5 |
6 | namespace AcceptanceTests.Asserts.Import
7 | {
8 | public class UniqueIdAssert
9 | {
10 | public static void AreEqual(Dictionary> linkList, string isoRefId, List adaptIds)
11 | {
12 | if(!linkList.ContainsKey(isoRefId))
13 | return;
14 |
15 | var links = linkList[isoRefId];
16 |
17 | foreach (var link in links)
18 | {
19 | var matchingAdaptId = adaptIds.Single(x => x.Id == link.Id);
20 | Assert.AreEqual(link.Source, matchingAdaptId.Source);
21 | Assert.AreEqual(link.SourceType, matchingAdaptId.SourceType);
22 | Assert.AreEqual(link.IdType, matchingAdaptId.IdType);
23 | }
24 | }
25 | }
26 | }
--------------------------------------------------------------------------------
/AcceptanceTests/Features/ImportLogData.feature:
--------------------------------------------------------------------------------
1 | Feature: ImportLogData
2 |
3 | Scenario Outline: Import ISO to Adapt
4 | Given I have datacard
5 | When I import with the plugin
6 | Then iso is imported to adapt
7 | Examples:
8 | | cardname |
9 | | agco_c100_tc___jd_sprayer_900 |
10 | | KV |
11 | | Agco_MicroTrak |
12 |
13 | Scenario Outline: Import ISO to Adapt Export Adapt to ISO
14 | Given I have datacard
15 | When I import with the plugin
16 | And I export to Iso
17 | Then Adapt is exported to ISO
18 | Examples:
19 | | cardname |
20 | | agco_c100_tc___jd_sprayer_900 |
21 | | KV |
22 | | Agco_MicroTrak |
23 | | agco_c100_tc___jd_sprayer_900_short |
--------------------------------------------------------------------------------
/AgGatewayISOPlugin.nuspec:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | AgGatewayISOPlugin
5 | 0.0.0
6 | AgGateway and ADAPT Contributors
7 | AgGateway and ADAPT Contributors
8 | https://www.eclipse.org/legal/epl-v10.html
9 | https://github.com/ADAPT/ISOv4Plugin
10 | true
11 | AgGateway ISO v4 Plugin for the ADAPT framework
12 | Copyright (C) 2015-22 AgGateway and ADAPT Contributors
13 | agriculture aggateway adapt isoxml isoxmlv4 11783 11783-10
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/AgGatewayISOPlugin.targets:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Resources\ddiExport.txt
5 | Always
6 |
7 |
8 | Resources\IsoUnitOfMeasure.xml
9 | Always
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/Examples/Examples.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 | Exe
13 | net8.0
14 | enable
15 | enable
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/Examples/Program.cs:
--------------------------------------------------------------------------------
1 | //Currently one 1 example
2 | RasterPrescriptions.ExportExamplePrescription();
--------------------------------------------------------------------------------
/ISOv4Plugin.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 15
4 | VisualStudioVersion = 15.0.27130.2027
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ISOv4Plugin", "ISOv4Plugin\ISOv4Plugin.csproj", "{CC947BE8-9CB6-4994-9EFD-F4B2EFC8BB09}"
7 | EndProject
8 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestUtilities", "TestUtilities\TestUtilities.csproj", "{98DBD0C7-5677-4B64-8DDA-BDA1E3B3DFCB}"
9 | EndProject
10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Examples", "Examples\Examples.csproj", "{22ECC922-F80E-4142-9835-455B02A70B63}"
11 | EndProject
12 | Global
13 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
14 | Debug|Any CPU = Debug|Any CPU
15 | Release|Any CPU = Release|Any CPU
16 | EndGlobalSection
17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
18 | {CC947BE8-9CB6-4994-9EFD-F4B2EFC8BB09}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
19 | {CC947BE8-9CB6-4994-9EFD-F4B2EFC8BB09}.Debug|Any CPU.Build.0 = Debug|Any CPU
20 | {CC947BE8-9CB6-4994-9EFD-F4B2EFC8BB09}.Release|Any CPU.ActiveCfg = Release|Any CPU
21 | {CC947BE8-9CB6-4994-9EFD-F4B2EFC8BB09}.Release|Any CPU.Build.0 = Release|Any CPU
22 | {98DBD0C7-5677-4B64-8DDA-BDA1E3B3DFCB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
23 | {98DBD0C7-5677-4B64-8DDA-BDA1E3B3DFCB}.Debug|Any CPU.Build.0 = Debug|Any CPU
24 | {98DBD0C7-5677-4B64-8DDA-BDA1E3B3DFCB}.Release|Any CPU.ActiveCfg = Release|Any CPU
25 | {98DBD0C7-5677-4B64-8DDA-BDA1E3B3DFCB}.Release|Any CPU.Build.0 = Release|Any CPU
26 | {22ECC922-F80E-4142-9835-455B02A70B63}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
27 | {22ECC922-F80E-4142-9835-455B02A70B63}.Debug|Any CPU.Build.0 = Debug|Any CPU
28 | {22ECC922-F80E-4142-9835-455B02A70B63}.Release|Any CPU.ActiveCfg = Release|Any CPU
29 | {22ECC922-F80E-4142-9835-455B02A70B63}.Release|Any CPU.Build.0 = Release|Any CPU
30 | EndGlobalSection
31 | GlobalSection(SolutionProperties) = preSolution
32 | HideSolutionNode = FALSE
33 | EndGlobalSection
34 | GlobalSection(ExtensibilityGlobals) = postSolution
35 | SolutionGuid = {FEF79CB3-DE15-4781-8EAE-784FE217ECFD}
36 | EndGlobalSection
37 | EndGlobal
38 |
--------------------------------------------------------------------------------
/ISOv4Plugin/ISOEnumerations/ISOAllocationStampType.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * ISO standards can be purchased through the ANSI webstore at https://webstore.ansi.org
3 | */
4 |
5 | namespace AgGateway.ADAPT.ISOv4Plugin.ISOEnumerations
6 | {
7 | public enum ISOAllocationStampType
8 | {
9 | Planned = 1,
10 | Effective = 4
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/ISOv4Plugin/ISOEnumerations/ISOAttachedFilePreserve.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * ISO standards can be purchased through the ANSI webstore at https://webstore.ansi.org
3 | */
4 |
5 | namespace AgGateway.ADAPT.ISOv4Plugin.ISOEnumerations
6 | {
7 | public enum ISOAttachedFilePreserve
8 | {
9 | NotRequired = 1,
10 | Preserve = 2
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/ISOv4Plugin/ISOEnumerations/ISOCodedCommentScope.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * ISO standards can be purchased through the ANSI webstore at https://webstore.ansi.org
3 | */
4 |
5 | namespace AgGateway.ADAPT.ISOv4Plugin.ISOEnumerations
6 | {
7 | public enum ISOCodedCommentScope
8 | {
9 | Point = 1,
10 | Global = 2,
11 | Continuous = 3
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/ISOv4Plugin/ISOEnumerations/ISODeviceElementType.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * ISO standards can be purchased through the ANSI webstore at https://webstore.ansi.org
3 | */
4 |
5 | namespace AgGateway.ADAPT.ISOv4Plugin.ISOEnumerations
6 | {
7 | public enum ISODeviceElementType
8 | {
9 | Device = 1,
10 | Function = 2,
11 | Bin = 3,
12 | Section = 4,
13 | Unit = 5,
14 | Connector = 6,
15 | Navigation = 7
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/ISOv4Plugin/ISOEnumerations/ISOGuidancePatternExtension.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * ISO standards can be purchased through the ANSI webstore at https://webstore.ansi.org
3 | */
4 |
5 | namespace AgGateway.ADAPT.ISOv4Plugin.ISOEnumerations
6 | {
7 | public enum ISOGuidancePatternExtension
8 | {
9 | FromBothFirstAndLast = 1,
10 | FromAOnly = 2,
11 | FromBOnly = 3,
12 | NoExtensions = 4
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/ISOv4Plugin/ISOEnumerations/ISOGuidancePatternGNSSMethod.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * ISO standards can be purchased through the ANSI webstore at https://webstore.ansi.org
3 | */
4 |
5 | namespace AgGateway.ADAPT.ISOv4Plugin.ISOEnumerations
6 | {
7 | public enum ISOGuidancePatternGNSSMethod
8 | {
9 | GNSSFix = 1,
10 | DGNSSFix = 2,
11 | PreciseGNSS = 3,
12 | RTKFixedInteger = 4,
13 | RTKFloat = 5,
14 | EstDRMode = 6,
15 | ManualInput = 7,
16 | SimulateMode = 8,
17 | DesktopGeneratedData = 16,
18 | Other = 17
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/ISOv4Plugin/ISOEnumerations/ISOGuidancePatternOption.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * ISO standards can be purchased through the ANSI webstore at https://webstore.ansi.org
3 | */
4 |
5 | namespace AgGateway.ADAPT.ISOv4Plugin.ISOEnumerations
6 | {
7 | public enum ISOGuidancePatternOption
8 | {
9 | Clockwise = 1,
10 | CounterClockwise = 2,
11 | FullCircle = 3
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/ISOv4Plugin/ISOEnumerations/ISOGuidancePatternPropagationDirection.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * ISO standards can be purchased through the ANSI webstore at https://webstore.ansi.org
3 | */
4 |
5 | namespace AgGateway.ADAPT.ISOv4Plugin.ISOEnumerations
6 | {
7 | public enum ISOGuidancePatternPropagationDirection
8 | {
9 | BothDirections = 1,
10 | LeftDirectionOnly = 2,
11 | RightDirectionOnly = 3,
12 | NoPropagation = 4
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/ISOv4Plugin/ISOEnumerations/ISOGuidancePatternType.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * ISO standards can be purchased through the ANSI webstore at https://webstore.ansi.org
3 | */
4 |
5 | namespace AgGateway.ADAPT.ISOv4Plugin.ISOEnumerations
6 | {
7 | public enum ISOGuidancePatternType
8 | {
9 | AB = 1,
10 | APlus = 2,
11 | Curve = 3,
12 | Pivot = 4,
13 | Spiral = 5
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/ISOv4Plugin/ISOEnumerations/ISOLineStringType.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * ISO standards can be purchased through the ANSI webstore at https://webstore.ansi.org
3 | */
4 |
5 | namespace AgGateway.ADAPT.ISOv4Plugin.ISOEnumerations
6 | {
7 | public enum ISOLineStringType
8 | {
9 | PolygonExterior = 1,
10 | PolygonInterior = 2,
11 | TramLine = 3,
12 | SamplingRoute = 4,
13 | GuidancePattern = 5,
14 | Drainage = 6,
15 | Fence = 7,
16 | Flag = 8,
17 | Obstacle = 9
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/ISOv4Plugin/ISOEnumerations/ISOLinkGroupType.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * ISO standards can be purchased through the ANSI webstore at https://webstore.ansi.org
3 | */
4 |
5 | namespace AgGateway.ADAPT.ISOv4Plugin.ISOEnumerations
6 | {
7 | public enum ISOLinkGroupType
8 | {
9 | UUID = 1,
10 | ManufacturerProprietary = 2,
11 | UniqueResolvable = 3,
12 | InformationalResolvable = 4
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/ISOv4Plugin/ISOEnumerations/ISOPointType.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * ISO standards can be purchased through the ANSI webstore at https://webstore.ansi.org
3 | */
4 |
5 | namespace AgGateway.ADAPT.ISOv4Plugin.ISOEnumerations
6 | {
7 | public enum ISOPointType
8 | {
9 | Flag = 1,
10 | Other = 2,
11 | FieldAccess = 3,
12 | Storage = 4,
13 | Obstacle = 5,
14 | GuidanceReferenceA = 6,
15 | GuidanceReferenceB = 7,
16 | GuidanceReferenceCenter = 8,
17 | GuidancePoint = 9,
18 | PartfieldReference = 10,
19 | Homebase = 11
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/ISOv4Plugin/ISOEnumerations/ISOPolygonType.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * ISO standards can be purchased through the ANSI webstore at https://webstore.ansi.org
3 | */
4 |
5 | namespace AgGateway.ADAPT.ISOv4Plugin.ISOEnumerations
6 | {
7 | public enum ISOPolygonType
8 | {
9 | PartfieldBoundary = 1,
10 | TreatmentZone = 2,
11 | WaterSurface = 3,
12 | Building = 4,
13 | Road = 5,
14 | Obstacle = 6,
15 | Flag = 7,
16 | Other = 8,
17 | Mainfield = 9,
18 | Headland = 10,
19 | BufferZone = 11,
20 | Windbreak = 12
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/ISOv4Plugin/ISOEnumerations/ISOPositionStatus.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * ISO standards can be purchased through the ANSI webstore at https://webstore.ansi.org
3 | */
4 |
5 | namespace AgGateway.ADAPT.ISOv4Plugin.ISOEnumerations
6 | {
7 | public enum ISOPositionStatus
8 | {
9 | NoGPSFix = 0,
10 | GNSSFix = 1,
11 | DGNSSFix = 2,
12 | PreciseGNSS = 3,
13 | RTKFixedInteger = 4,
14 | RTKFloat = 5,
15 | EstDRMode = 6,
16 | ManualInput = 7,
17 | SimulateMode = 8,
18 | Error = 14,
19 | NotAvailable = 15
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/ISOv4Plugin/ISOEnumerations/ISOProductGroupType.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * ISO standards can be purchased through the ANSI webstore at https://webstore.ansi.org
3 | */
4 |
5 | namespace AgGateway.ADAPT.ISOv4Plugin.ISOEnumerations
6 | {
7 | public enum ISOProductGroupType
8 | {
9 | ProductGroup = 1,
10 | CropType = 2
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/ISOv4Plugin/ISOEnumerations/ISOProductType.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * ISO standards can be purchased through the ANSI webstore at https://webstore.ansi.org
3 | */
4 |
5 | namespace AgGateway.ADAPT.ISOv4Plugin.ISOEnumerations
6 | {
7 | public enum ISOProductType
8 | {
9 | Single = 1,
10 | Mixture = 2,
11 | TemporaryMixture = 3
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/ISOv4Plugin/ISOEnumerations/ISOTaskDataTransferOrigin.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * ISO standards can be purchased through the ANSI webstore at https://webstore.ansi.org
3 | */
4 |
5 | namespace AgGateway.ADAPT.ISOv4Plugin.ISOEnumerations
6 | {
7 | public enum ISOTaskDataTransferOrigin
8 | {
9 | FMIS = 1,
10 | MICS = 2
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/ISOv4Plugin/ISOEnumerations/ISOTaskStatus.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * ISO standards can be purchased through the ANSI webstore at https://webstore.ansi.org
3 | */
4 |
5 | namespace AgGateway.ADAPT.ISOv4Plugin.ISOEnumerations
6 | {
7 | public enum ISOTaskStatus
8 | {
9 | Planned = 1,
10 | Running = 2,
11 | Paused = 3,
12 | Completed = 4,
13 | Template = 5,
14 | Canceled = 6
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/ISOv4Plugin/ISOEnumerations/ISOTimeType.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * ISO standards can be purchased through the ANSI webstore at https://webstore.ansi.org
3 | */
4 |
5 | namespace AgGateway.ADAPT.ISOv4Plugin.ISOEnumerations
6 | {
7 | public enum ISOTimeType
8 | {
9 | Planned = 1,
10 | Preliminary = 2,
11 | Effective = 4,
12 | Ineffective = 5,
13 | Repair = 6,
14 | Clearing = 7,
15 | PoweredDown = 8
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/ISOv4Plugin/ISOEnumerations/ISOTransferMode.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * ISO standards can be purchased through the ANSI webstore at https://webstore.ansi.org
3 | */
4 |
5 | namespace AgGateway.ADAPT.ISOv4Plugin.ISOEnumerations
6 | {
7 | public enum ISOTransferMode
8 | {
9 | Filling = 1,
10 | Emptying = 2,
11 | Remainder = 3
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/ISOv4Plugin/ISOModels/ISOCodedCommentListValue.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * ISO standards can be purchased through the ANSI webstore at https://webstore.ansi.org
3 | */
4 |
5 | using System.Xml;
6 | using AgGateway.ADAPT.ISOv4Plugin.ExtensionMethods;
7 | using System.Collections.Generic;
8 | using AgGateway.ADAPT.ISOv4Plugin.ObjectModel;
9 | using AgGateway.ADAPT.ApplicationDataModel.ADM;
10 |
11 | namespace AgGateway.ADAPT.ISOv4Plugin.ISOModels
12 | {
13 | public class ISOCodedCommentListValue : ISOElement
14 | {
15 | //Attributes
16 | public string CodedCommentListValueId { get; set; }
17 | public string CodedCommentListValueDesignator { get; set; }
18 |
19 | public override XmlWriter WriteXML(XmlWriter xmlBuilder)
20 | {
21 | xmlBuilder.WriteStartElement("CCL");
22 | xmlBuilder.WriteXmlAttribute("A", CodedCommentListValueId);
23 | xmlBuilder.WriteXmlAttribute("B", CodedCommentListValueDesignator);
24 | base.WriteXML(xmlBuilder);
25 | xmlBuilder.WriteEndElement();
26 | return xmlBuilder;
27 | }
28 |
29 | public static ISOCodedCommentListValue ReadXML(XmlNode commentListValueNode)
30 | {
31 | ISOCodedCommentListValue value = new ISOCodedCommentListValue();
32 | value.CodedCommentListValueId = commentListValueNode.GetXmlNodeValue("@A");
33 | value.CodedCommentListValueDesignator = commentListValueNode.GetXmlNodeValue("@B");
34 | return value;
35 | }
36 |
37 | public static IEnumerable ReadXML(XmlNodeList listValueNodes)
38 | {
39 | List values = new List();
40 | foreach (XmlNode valueNode in listValueNodes)
41 | {
42 | values.Add(ISOCodedCommentListValue.ReadXML(valueNode));
43 | }
44 | return values;
45 | }
46 |
47 | public override List Validate(List errors)
48 | {
49 | RequireString(this, x => x.CodedCommentListValueId, 14, errors, "A");
50 | RequireString(this, x => x.CodedCommentListValueDesignator, 32, errors, "B");
51 | return errors;
52 | }
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/ISOv4Plugin/ISOModels/ISOConnection.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * ISO standards can be purchased through the ANSI webstore at https://webstore.ansi.org
3 | */
4 |
5 | using System.Xml;
6 | using AgGateway.ADAPT.ISOv4Plugin.ExtensionMethods;
7 | using System.Collections.Generic;
8 | using AgGateway.ADAPT.ISOv4Plugin.ObjectModel;
9 | using AgGateway.ADAPT.ApplicationDataModel.ADM;
10 |
11 | namespace AgGateway.ADAPT.ISOv4Plugin.ISOModels
12 | {
13 | public class ISOConnection : ISOElement
14 | {
15 | //Attributes
16 | public string DeviceIdRef_0 { get; set; }
17 | public string DeviceElementIdRef_0 { get; set; }
18 | public string DeviceIdRef_1 { get; set; }
19 | public string DeviceElementIdRef_1 { get; set; }
20 |
21 | public override XmlWriter WriteXML(XmlWriter xmlBuilder)
22 | {
23 | xmlBuilder.WriteStartElement("CNN");
24 | xmlBuilder.WriteXmlAttribute("A", DeviceIdRef_0);
25 | xmlBuilder.WriteXmlAttribute("B", DeviceElementIdRef_0);
26 | xmlBuilder.WriteXmlAttribute("C", DeviceIdRef_1);
27 | xmlBuilder.WriteXmlAttribute("D", DeviceElementIdRef_1);
28 | base.WriteXML(xmlBuilder);
29 | xmlBuilder.WriteEndElement();
30 | return xmlBuilder;
31 | }
32 |
33 | public static ISOConnection ReadXML(XmlNode node)
34 | {
35 | ISOConnection item = new ISOConnection();
36 | item.DeviceIdRef_0 = node.GetXmlNodeValue("@A");
37 | item.DeviceElementIdRef_0 = node.GetXmlNodeValue("@B");
38 | item.DeviceIdRef_1 = node.GetXmlNodeValue("@C");
39 | item.DeviceElementIdRef_1 = node.GetXmlNodeValue("@D");
40 |
41 | return item;
42 | }
43 |
44 | public static IEnumerable ReadXML(XmlNodeList nodes)
45 | {
46 | List items = new List();
47 | foreach (XmlNode node in nodes)
48 | {
49 | items.Add(ISOConnection.ReadXML(node));
50 | }
51 | return items;
52 | }
53 |
54 | public override List Validate(List errors)
55 | {
56 | RequireString(this, x => x.DeviceIdRef_0, 14, errors, "A");
57 | RequireString(this, x => x.DeviceElementIdRef_0, 14, errors, "B");
58 | RequireString(this, x => x.DeviceIdRef_1, 14, errors, "C");
59 | RequireString(this, x => x.DeviceElementIdRef_1, 14, errors, "D");
60 | return errors;
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/ISOv4Plugin/ISOModels/ISOCropVariety.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * ISO standards can be purchased through the ANSI webstore at https://webstore.ansi.org
3 | */
4 |
5 | using System.Xml;
6 | using AgGateway.ADAPT.ISOv4Plugin.ExtensionMethods;
7 | using System.Collections.Generic;
8 | using AgGateway.ADAPT.ISOv4Plugin.ObjectModel;
9 | using AgGateway.ADAPT.ApplicationDataModel.ADM;
10 |
11 | namespace AgGateway.ADAPT.ISOv4Plugin.ISOModels
12 | {
13 | public class ISOCropVariety : ISOElement
14 | {
15 | public ISOCropVariety()
16 | : this(4)
17 | {
18 | }
19 |
20 | public ISOCropVariety(int version)
21 | :base(version)
22 | {
23 | }
24 |
25 | //Attributes
26 | public string CropVarietyId { get; set; }
27 | public string CropVarietyDesignator { get; set; }
28 | public string ProductIdRef { get; set; }
29 |
30 | public override XmlWriter WriteXML(XmlWriter xmlBuilder)
31 | {
32 | xmlBuilder.WriteStartElement("CVT");
33 | xmlBuilder.WriteXmlAttribute("A", CropVarietyId);
34 | xmlBuilder.WriteXmlAttribute("B", CropVarietyDesignator);
35 | if (Version > 3)
36 | {
37 | xmlBuilder.WriteXmlAttribute("C", ProductIdRef);
38 | }
39 | base.WriteXML(xmlBuilder);
40 | xmlBuilder.WriteEndElement();
41 | return xmlBuilder;
42 | }
43 |
44 | public static ISOCropVariety ReadXML(XmlNode node)
45 | {
46 | ISOCropVariety item = new ISOCropVariety();
47 | item.CropVarietyId = node.GetXmlNodeValue("@A");
48 | item.CropVarietyDesignator = node.GetXmlNodeValue("@B");
49 | item.ProductIdRef = node.GetXmlNodeValue("@C");
50 |
51 | return item;
52 | }
53 |
54 | public static IEnumerable ReadXML(XmlNodeList nodes)
55 | {
56 | List items = new List();
57 | foreach (XmlNode node in nodes)
58 | {
59 | items.Add(ISOCropVariety.ReadXML(node));
60 | }
61 | return items;
62 | }
63 |
64 | public override List Validate(List errors)
65 | {
66 | RequireString(this, x => x.CropVarietyId, 14, errors, "A");
67 | RequireString(this, x => x.CropVarietyDesignator, 32, errors, "B");
68 | ValidateString(this, x => x.ProductIdRef, 14, errors, "C");
69 | return errors;
70 | }
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/ISOv4Plugin/ISOModels/ISODeviceObjectReference.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * ISO standards can be purchased through the ANSI webstore at https://webstore.ansi.org
3 | */
4 |
5 | using System.Xml;
6 | using AgGateway.ADAPT.ISOv4Plugin.ExtensionMethods;
7 | using System.Collections.Generic;
8 | using AgGateway.ADAPT.ISOv4Plugin.ObjectModel;
9 | using AgGateway.ADAPT.ApplicationDataModel.ADM;
10 |
11 | namespace AgGateway.ADAPT.ISOv4Plugin.ISOModels
12 | {
13 | public class ISODeviceObjectReference : ISOElement
14 | {
15 | //Attributes
16 | public uint DeviceObjectId { get; set; }
17 |
18 | public override XmlWriter WriteXML(XmlWriter xmlBuilder)
19 | {
20 | xmlBuilder.WriteStartElement("DOR");
21 | xmlBuilder.WriteXmlAttribute("A", DeviceObjectId );
22 | base.WriteXML(xmlBuilder);
23 | xmlBuilder.WriteEndElement();
24 | return xmlBuilder;
25 | }
26 |
27 | public static ISODeviceObjectReference ReadXML(XmlNode node)
28 | {
29 | ISODeviceObjectReference item = new ISODeviceObjectReference();
30 | item.DeviceObjectId = node.GetXmlNodeValueAsUInt("@A");
31 | return item;
32 | }
33 |
34 | public static IEnumerable ReadXML(XmlNodeList nodes)
35 | {
36 | List items = new List();
37 | foreach (XmlNode node in nodes)
38 | {
39 | items.Add(ISODeviceObjectReference.ReadXML(node));
40 | }
41 | return items;
42 | }
43 |
44 | public override List Validate(List errors)
45 | {
46 | RequireRange(this, x => x.DeviceObjectId, 1, 65534, errors, "A");
47 | return errors;
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/ISOv4Plugin/ISOModels/ISOLink.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * ISO standards can be purchased through the ANSI webstore at https://webstore.ansi.org
3 | */
4 |
5 | using AgGateway.ADAPT.ApplicationDataModel.ADM;
6 | using AgGateway.ADAPT.ISOv4Plugin.ExtensionMethods;
7 | using AgGateway.ADAPT.ISOv4Plugin.ISOEnumerations;
8 | using AgGateway.ADAPT.ISOv4Plugin.ObjectModel;
9 | using System;
10 | using System.Collections.Generic;
11 | using System.Xml;
12 |
13 | namespace AgGateway.ADAPT.ISOv4Plugin.ISOModels
14 | {
15 | public class ISOLink : ISOElement
16 | {
17 | //Attributes
18 | public string ObjectIdRef { get; set; }
19 | public string LinkValue { get; set; }
20 | public string LinkDesignator { get; set; }
21 |
22 | public override XmlWriter WriteXML(XmlWriter xmlBuilder)
23 | {
24 | xmlBuilder.WriteStartElement("LNK");
25 | xmlBuilder.WriteXmlAttribute("A", ObjectIdRef);
26 | xmlBuilder.WriteXmlAttribute("B", LinkValue);
27 | xmlBuilder.WriteXmlAttribute("C", LinkDesignator);
28 | xmlBuilder.WriteEndElement();
29 |
30 | return xmlBuilder;
31 | }
32 |
33 | public static ISOLink ReadXML(XmlNode node)
34 | {
35 | if (node == null)
36 | return null;
37 |
38 | ISOLink item = new ISOLink();
39 | item.ObjectIdRef = node.GetXmlNodeValue("@A");
40 | item.LinkValue = node.GetXmlNodeValue("@B");
41 | item.LinkDesignator = node.GetXmlNodeValue("@C");
42 | return item;
43 | }
44 |
45 | public static List ReadXML(XmlNodeList nodes)
46 | {
47 | List items = new List();
48 | foreach (XmlNode node in nodes)
49 | {
50 | items.Add(ISOLink.ReadXML(node));
51 | }
52 | return items;
53 | }
54 |
55 | public override List Validate(List errors)
56 | {
57 | RequireString(this, x => x.ObjectIdRef, 14, errors, "A");
58 | RequireString(this, x => x.LinkValue, 255, errors, "B");
59 | ValidateString(this, x => x.LinkDesignator, 32, errors, "C");
60 | return errors;
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/ISOv4Plugin/ISOModels/ISOOperTechPractice.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * ISO standards can be purchased through the ANSI webstore at https://webstore.ansi.org
3 | */
4 |
5 | using System.Xml;
6 | using AgGateway.ADAPT.ISOv4Plugin.ExtensionMethods;
7 | using System.Collections.Generic;
8 | using AgGateway.ADAPT.ISOv4Plugin.ObjectModel;
9 | using AgGateway.ADAPT.ApplicationDataModel.ADM;
10 |
11 | namespace AgGateway.ADAPT.ISOv4Plugin.ISOModels
12 | {
13 | public class ISOOperTechPractice : ISOElement
14 | {
15 | //Attributes
16 | public string CulturalPracticeIdRef { get; set; }
17 | public string OperationTechniqueIdRef { get; set; }
18 |
19 | public override XmlWriter WriteXML(XmlWriter xmlBuilder)
20 | {
21 | xmlBuilder.WriteStartElement("OTP");
22 | xmlBuilder.WriteXmlAttribute("A", CulturalPracticeIdRef);
23 | xmlBuilder.WriteXmlAttribute("B", OperationTechniqueIdRef);
24 | xmlBuilder.WriteEndElement();
25 | return xmlBuilder;
26 | }
27 |
28 | public static ISOOperTechPractice ReadXML(XmlNode node)
29 | {
30 | ISOOperTechPractice item = new ISOOperTechPractice();
31 | item.CulturalPracticeIdRef = node.GetXmlNodeValue("@A");
32 | item.OperationTechniqueIdRef = node.GetXmlNodeValue("@B");
33 | return item;
34 | }
35 |
36 | public static IEnumerable ReadXML(XmlNodeList nodes)
37 | {
38 | List items = new List();
39 | foreach (XmlNode node in nodes)
40 | {
41 | items.Add(ISOOperTechPractice.ReadXML(node));
42 | }
43 | return items;
44 | }
45 |
46 | public override List Validate(List errors)
47 | {
48 | RequireString(this, x => x.CulturalPracticeIdRef, 14, errors, "A");
49 | RequireString(this, x => x.OperationTechniqueIdRef, 14, errors, "B");
50 | return errors;
51 | }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/ISOv4Plugin/ISOModels/ISOOperationTechnique.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * ISO standards can be purchased through the ANSI webstore at https://webstore.ansi.org
3 | */
4 |
5 | using System.Xml;
6 | using AgGateway.ADAPT.ISOv4Plugin.ExtensionMethods;
7 | using System.Collections.Generic;
8 | using AgGateway.ADAPT.ISOv4Plugin.ObjectModel;
9 | using AgGateway.ADAPT.ApplicationDataModel.ADM;
10 |
11 | namespace AgGateway.ADAPT.ISOv4Plugin.ISOModels
12 | {
13 | public class ISOOperationTechnique : ISOElement
14 | {
15 | //Attributes
16 | public string OperationTechniqueId { get; set; }
17 | public string OperationTechniqueDesignator { get; set; }
18 |
19 | public override XmlWriter WriteXML(XmlWriter xmlBuilder)
20 | {
21 | xmlBuilder.WriteStartElement("OTQ");
22 | xmlBuilder.WriteXmlAttribute("A", OperationTechniqueId);
23 | xmlBuilder.WriteXmlAttribute("B", OperationTechniqueDesignator);
24 |
25 | xmlBuilder.WriteEndElement();
26 |
27 | return xmlBuilder;
28 | }
29 |
30 | public static ISOOperationTechnique ReadXML(XmlNode node)
31 | {
32 | ISOOperationTechnique item = new ISOOperationTechnique();
33 | item.OperationTechniqueId = node.GetXmlNodeValue("@A");
34 | item.OperationTechniqueDesignator = node.GetXmlNodeValue("@B");
35 |
36 | return item;
37 | }
38 |
39 | public static IEnumerable ReadXML(XmlNodeList nodes)
40 | {
41 | List items = new List();
42 | foreach (XmlNode node in nodes)
43 | {
44 | items.Add(ISOOperationTechnique.ReadXML(node));
45 | }
46 | return items;
47 | }
48 |
49 | public override List Validate(List errors)
50 | {
51 | RequireString(this, x => x.OperationTechniqueId, 14, errors, "A");
52 | RequireString(this, x => x.OperationTechniqueDesignator, 32, errors, "B");
53 | return errors;
54 | }
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/ISOv4Plugin/ISOModels/ISOOperationTechniqueReference.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * ISO standards can be purchased through the ANSI webstore at https://webstore.ansi.org
3 | */
4 |
5 | using System.Xml;
6 | using AgGateway.ADAPT.ISOv4Plugin.ExtensionMethods;
7 | using System.Collections.Generic;
8 | using AgGateway.ADAPT.ISOv4Plugin.ObjectModel;
9 | using AgGateway.ADAPT.ApplicationDataModel.ADM;
10 |
11 | namespace AgGateway.ADAPT.ISOv4Plugin.ISOModels
12 | {
13 | public class ISOOperationTechniqueReference : ISOElement
14 | {
15 | //Attributes
16 | public string OperationTechniqueIdRef { get; set; }
17 |
18 | public override XmlWriter WriteXML(XmlWriter xmlBuilder)
19 | {
20 | xmlBuilder.WriteStartElement("OTR");
21 | xmlBuilder.WriteXmlAttribute("A", OperationTechniqueIdRef);
22 | xmlBuilder.WriteEndElement();
23 |
24 | return xmlBuilder;
25 | }
26 |
27 | public static ISOOperationTechniqueReference ReadXML(XmlNode node)
28 | {
29 | ISOOperationTechniqueReference item = new ISOOperationTechniqueReference();
30 | item.OperationTechniqueIdRef = node.GetXmlNodeValue("@A");
31 | return item;
32 | }
33 |
34 | public static IEnumerable ReadXML(XmlNodeList nodes)
35 | {
36 | List items = new List();
37 | foreach (XmlNode node in nodes)
38 | {
39 | items.Add(ISOOperationTechniqueReference.ReadXML(node));
40 | }
41 | return items;
42 | }
43 |
44 | public override List Validate(List errors)
45 | {
46 | RequireString(this, x => x.OperationTechniqueIdRef, 14, errors, "A");
47 | return errors;
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/ISOv4Plugin/ISOModels/ISOProductRelation.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * ISO standards can be purchased through the ANSI webstore at https://webstore.ansi.org
3 | */
4 |
5 | using System.Xml;
6 | using AgGateway.ADAPT.ISOv4Plugin.ExtensionMethods;
7 | using System.Collections.Generic;
8 | using AgGateway.ADAPT.ISOv4Plugin.ObjectModel;
9 | using System;
10 | using AgGateway.ADAPT.ApplicationDataModel.ADM;
11 |
12 | namespace AgGateway.ADAPT.ISOv4Plugin.ISOModels
13 | {
14 | public class ISOProductRelation : ISOElement
15 | {
16 | //Attributes
17 | public string ProductIdRef { get; set; }
18 | public int QuantityValue { get; set; }
19 |
20 | public override XmlWriter WriteXML(XmlWriter xmlBuilder)
21 | {
22 | xmlBuilder.WriteStartElement("PRN");
23 | xmlBuilder.WriteXmlAttribute("A", ProductIdRef);
24 | xmlBuilder.WriteXmlAttribute("B", QuantityValue);
25 | xmlBuilder.WriteEndElement();
26 | return xmlBuilder;
27 | }
28 |
29 | public static ISOProductRelation ReadXML(XmlNode node)
30 | {
31 | ISOProductRelation item = new ISOProductRelation();
32 | item.ProductIdRef = node.GetXmlNodeValue("@A");
33 | item.QuantityValue = node.GetXmlNodeValueAsInt("@B");
34 | return item;
35 | }
36 |
37 | public static IEnumerable ReadXML(XmlNodeList nodes)
38 | {
39 | List items = new List();
40 | foreach (XmlNode node in nodes)
41 | {
42 | items.Add(ISOProductRelation.ReadXML(node));
43 | }
44 | return items;
45 | }
46 |
47 | public override List Validate(List errors)
48 | {
49 | RequireString(this, x => x.ProductIdRef, 14, errors, "A");
50 | RequireRange(this, x => x.QuantityValue, 0, Int32.MaxValue - 1, errors, "B");
51 | return errors;
52 | }
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/ISOv4Plugin/ISOModels/ISOWorkerAllocation.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * ISO standards can be purchased through the ANSI webstore at https://webstore.ansi.org
3 | */
4 |
5 | using System.Xml;
6 | using AgGateway.ADAPT.ISOv4Plugin.ExtensionMethods;
7 | using System.Collections.Generic;
8 | using AgGateway.ADAPT.ISOv4Plugin.ObjectModel;
9 | using AgGateway.ADAPT.ApplicationDataModel.ADM;
10 |
11 | namespace AgGateway.ADAPT.ISOv4Plugin.ISOModels
12 | {
13 | public class ISOWorkerAllocation : ISOElement
14 | {
15 | //Attributes
16 | public string WorkerIdRef { get; set; }
17 |
18 | //Child Elements
19 | public ISOAllocationStamp AllocationStamp { get; set; }
20 |
21 | public override XmlWriter WriteXML(XmlWriter xmlBuilder)
22 | {
23 | xmlBuilder.WriteStartElement("WAN");
24 | xmlBuilder.WriteXmlAttribute("A", WorkerIdRef);
25 | if (AllocationStamp != null)
26 | {
27 | AllocationStamp.WriteXML(xmlBuilder);
28 | }
29 | xmlBuilder.WriteEndElement();
30 | return xmlBuilder;
31 | }
32 |
33 | public static ISOWorkerAllocation ReadXML(XmlNode node)
34 | {
35 | ISOWorkerAllocation item = new ISOWorkerAllocation();
36 | item.WorkerIdRef = node.GetXmlNodeValue("@A");
37 | item.AllocationStamp = ISOAllocationStamp.ReadXML(node.SelectSingleNode("ASP"));
38 | return item;
39 | }
40 |
41 | public static IEnumerable ReadXML(XmlNodeList nodes)
42 | {
43 | List items = new List();
44 | foreach (XmlNode node in nodes)
45 | {
46 | items.Add(ISOWorkerAllocation.ReadXML(node));
47 | }
48 | return items;
49 | }
50 |
51 | public override List Validate(List errors)
52 | {
53 | RequireString(this, x => x.WorkerIdRef, 14, errors, "A");
54 | if (AllocationStamp != null) AllocationStamp.Validate(errors);
55 | return errors;
56 | }
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/ISOv4Plugin/ISOv4Plugin.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0
5 | AgGateway.ADAPT.ISOv4Plugin
6 | AgGateway.ADAPT.ISOv4Plugin
7 | 2.0.0
8 | English (United States)
9 | Copyright (C) 2015-19 AgGateway and ADAPT Contributors
10 | ISOv4Plugin
11 | AgGateway
12 | AgGateway and ADAPT Contributors
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 | Always
22 |
23 |
24 | Always
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/ISOv4Plugin/Mappers/LoggedDataMappers/Export/EnumeratedValueMapper.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * ISO standards can be purchased through the ANSI webstore at https://webstore.ansi.org
3 | */
4 |
5 | using System;
6 | using System.Collections.Generic;
7 | using System.Linq;
8 | using AgGateway.ADAPT.ApplicationDataModel.LoggedData;
9 | using AgGateway.ADAPT.ApplicationDataModel.Representations;
10 | using AgGateway.ADAPT.ISOv4Plugin.ExtensionMethods;
11 | using AgGateway.ADAPT.ISOv4Plugin.Representation;
12 |
13 | namespace AgGateway.ADAPT.ISOv4Plugin.Mappers
14 | {
15 | public interface IEnumeratedValueMapper
16 | {
17 | UInt32? Map(EnumeratedWorkingData currentMeter, List meters, SpatialRecord spatialRecord);
18 | }
19 |
20 | public class EnumeratedValueMapper : IEnumeratedValueMapper
21 | {
22 | private readonly IEnumeratedMeterFactory _enumeratedMeterFactory;
23 | private readonly IRepresentationMapper _representationMapper;
24 |
25 | public EnumeratedValueMapper() : this (new EnumeratedMeterFactory(), new RepresentationMapper())
26 | {
27 |
28 | }
29 |
30 | public EnumeratedValueMapper(IEnumeratedMeterFactory enumeratedMeterFactory, IRepresentationMapper representationMapper)
31 | {
32 | _enumeratedMeterFactory = enumeratedMeterFactory;
33 | _representationMapper = representationMapper;
34 | }
35 |
36 | public UInt32? Map(EnumeratedWorkingData currentMeter, List meters, SpatialRecord spatialRecord)
37 | {
38 | var ddi = _representationMapper.Map(currentMeter.Representation);
39 | if (ddi == null)
40 | {
41 | return null;
42 | }
43 |
44 | var creator = _enumeratedMeterFactory.GetMeterCreator(ddi.GetValueOrDefault());
45 | //The intent of the meters parameter below is to send in those meters that reconcile to a single DLV.
46 | //Since we are not exporting condensed DDIS at this time, just passing in the collection.
47 | return creator.GetMetersValue(meters, spatialRecord);
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/ISOv4Plugin/Mappers/LoggedDataMappers/Export/NumericValueMapper.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * ISO standards can be purchased through the ANSI webstore at https://webstore.ansi.org
3 | */
4 |
5 | using System;
6 | using System.Collections.Generic;
7 | using AgGateway.ADAPT.ApplicationDataModel.LoggedData;
8 | using AgGateway.ADAPT.ApplicationDataModel.Representations;
9 | using AgGateway.ADAPT.ISOv4Plugin.ExtensionMethods;
10 | using AgGateway.ADAPT.ISOv4Plugin.Representation;
11 |
12 | namespace AgGateway.ADAPT.ISOv4Plugin.Mappers
13 | {
14 | public interface INumericValueMapper
15 | {
16 | UInt32 Map(NumericWorkingData meter, SpatialRecord spatialRecord);
17 | }
18 |
19 | public class NumericValueMapper : INumericValueMapper
20 | {
21 | private readonly IRepresentationMapper _representationMapper;
22 | private readonly Dictionary _ddis;
23 |
24 | public NumericValueMapper() : this(new RepresentationMapper())
25 | {
26 |
27 | }
28 |
29 | public NumericValueMapper(IRepresentationMapper representationMapper)
30 | {
31 | _representationMapper = representationMapper;
32 | _ddis = DdiLoader.Ddis;
33 | }
34 |
35 | public uint Map(NumericWorkingData meter, SpatialRecord spatialRecord)
36 | {
37 | var value = (NumericRepresentationValue)spatialRecord.GetMeterValue(meter);
38 | if (value == null)
39 | return 0;
40 |
41 | var resolution = GetResolution(value);
42 | return (UInt32)(value.Value.Value / resolution);
43 | }
44 |
45 | private double GetResolution(NumericRepresentationValue value)
46 | {
47 | var ddi = _representationMapper.Map(value.Representation);
48 | var resolution = 1d;
49 | if (_ddis.ContainsKey(ddi.GetValueOrDefault()))
50 | {
51 | resolution = _ddis[ddi.GetValueOrDefault()].Resolution;
52 | }
53 | return resolution;
54 | }
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/ISOv4Plugin/Mappers/LoggedDataMappers/Import/EnumeratedMeterFactory.cs:
--------------------------------------------------------------------------------
1 | namespace AgGateway.ADAPT.ISOv4Plugin.Mappers
2 | {
3 | public interface IEnumeratedMeterFactory
4 | {
5 | IEnumeratedMeterCreator GetMeterCreator(int? ddi);
6 | }
7 |
8 | public class EnumeratedMeterFactory : IEnumeratedMeterFactory
9 | {
10 | public IEnumeratedMeterCreator GetMeterCreator(int? ddi)
11 | {
12 | if (ddi == null)
13 | return null;
14 |
15 | if (ddi == 141)
16 | return new WorkStateMeterCreator((int)ddi);
17 | if (ddi == 157)
18 | return new ConnectorTypeMeterCreator((int)ddi);
19 | if (ddi == 158)
20 | return new PrescriptionControlMeterCreator((int)ddi);
21 | if (ddi == 160)
22 | return new SectionControlStateMeterCreator((int)ddi);
23 | if (ddi >= 161 && ddi <= 176)
24 | return new CondensedWorkStateMeterCreator((int)ddi, 161);
25 | if (ddi == 210)
26 | return new SkyConditionsMeterCreator((int)ddi);
27 | if (ddi == 230)
28 | return new NetWeightStateMeterCreator((int)ddi);
29 | if (ddi == 240)
30 | return new ActualLoadingSystemStatusMeterCreator((int)ddi);
31 | //if (ddi >= 290 && ddi < 305) //Github Issue 92
32 | // return new CondensedWorkStateMeterCreator((int)ddi, 290);
33 | if (ddi >= 367 && ddi <= 382)
34 | return new CondensedSectionOverrideStateMeterCreator((int)ddi);
35 | return null;
36 | }
37 |
38 | public static bool IsCondensedMeter(int? ddi)
39 | {
40 | return (ddi >= 161 && ddi <= 176) || (ddi >= 290 && ddi < 305) || (ddi >= 367 && ddi <= 382);
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/ISOv4Plugin/Mappers/LoggedDataMappers/Import/IEnumeratedMeterCreator.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using AgGateway.ADAPT.ApplicationDataModel.LoggedData;
3 | using AgGateway.ADAPT.ApplicationDataModel.Representations;
4 | using AgGateway.ADAPT.ISOv4Plugin.ObjectModel;
5 | using System;
6 | using AgGateway.ADAPT.ISOv4Plugin.ISOModels;
7 |
8 | namespace AgGateway.ADAPT.ISOv4Plugin.Mappers
9 | {
10 | public interface IEnumeratedMeterCreator
11 | {
12 | int DDI { get; set; }
13 | int StartingSection { get; }
14 | List CreateMeters(IEnumerable spatialRows, ISODataLogValue dlv); //CondensedWorkstateMeter is necessarily forcing CreateMeters process to read spatial data to create meters.
15 | EnumeratedValue GetValueForMeter(SpatialValue value, ISOEnumeratedMeter workingData);
16 | UInt32 GetMetersValue(List meters, SpatialRecord spatialRecord);
17 | }
18 |
19 | public class ISOEnumeratedMeter : EnumeratedWorkingData
20 | {
21 | public Func GetEnumeratedValue { get; set;}
22 | public int SectionIndex { get; set; }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/ISOv4Plugin/Mappers/Manufacturers/ManufacturerFactory.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using AgGateway.ADAPT.ApplicationDataModel.LoggedData;
3 | using AgGateway.ADAPT.ApplicationDataModel.Products;
4 | using AgGateway.ADAPT.ApplicationDataModel.Shapes;
5 | using AgGateway.ADAPT.ISOv4Plugin.ExtensionMethods;
6 | using AgGateway.ADAPT.ISOv4Plugin.ISOModels;
7 | using AgGateway.ADAPT.ISOv4Plugin.ObjectModel;
8 |
9 | namespace AgGateway.ADAPT.ISOv4Plugin.Mappers.Manufacturers
10 | {
11 | internal interface IManufacturer
12 | {
13 | string GetCropName(ISOElement isoElement);
14 | ProductFormEnum? GetProductForm(ISOProduct isoProduct);
15 | ProductTypeEnum? GetProductType(ISOProduct isoProduct);
16 | CategoryEnum? GetProductCategory(ISOProduct isoProduct);
17 | string GetProductManufacturer(ISOProduct isoProduct);
18 |
19 | IEnumerable PostProcessOperationData(TaskDataMapper taskDataMapper, ISOTask isoTask, IEnumerable operationDatas);
20 | void PostProcessPolygons(List polygons);
21 | void PostProcessModel(ApplicationDataModel.ADM.ApplicationDataModel model, DeviceElementHierarchies deviceElementHierarchies);
22 | void ProcessDeviceElementHierarchy(DeviceHierarchyElement hierarchyElement, Dictionary> missingGeometryDefinitions);
23 | }
24 |
25 | internal static class ManufacturerFactory
26 | {
27 | private const string CNHManufacturer = "CNH Industrial N.V.";
28 |
29 | public static IManufacturer GetManufacturer(TaskDataMapper taskDataMapper)
30 | {
31 | if (taskDataMapper.ISOTaskData.TaskControllerManufacturer.EqualsIgnoreCase(CNHManufacturer))
32 | {
33 | return new CNH();
34 | }
35 | return null;
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/ISOv4Plugin/Mappers/ProductGroupMapper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using AgGateway.ADAPT.ISOv4Plugin.ExtensionMethods;
7 | using AgGateway.ADAPT.ISOv4Plugin.ISOModels;
8 |
9 | namespace AgGateway.ADAPT.ISOv4Plugin.Mappers
10 | {
11 | public interface IProductGroupMapper
12 | {
13 | ISOProductGroup ExportProductGroup(string productGroupName, bool isCropType);
14 | }
15 |
16 | public class ProductGroupMapper : BaseMapper, IProductGroupMapper
17 | {
18 | public ProductGroupMapper(TaskDataMapper taskDataMapper) : base(taskDataMapper, "PGP") { }
19 |
20 | public ISOProductGroup ExportProductGroup(string productGroupName, bool isCropType)
21 | {
22 | if (productGroupName == "Variety")
23 | {
24 | return this.ExportProductGroup("CropType", true);
25 | }
26 | else if (ISOTaskData.ChildElements.OfType().Any(g => g.ProductGroupDesignator == productGroupName))
27 | {
28 | //return the prexisting value
29 | return ISOTaskData.ChildElements.OfType().Single(g => g.ProductGroupDesignator == productGroupName);
30 | }
31 | else
32 | {
33 | ISOProductGroup pgp = new ISOProductGroup();
34 |
35 | //ID
36 | pgp.ProductGroupId = GenerateId();
37 |
38 | //Designator
39 | pgp.ProductGroupDesignator = productGroupName;
40 |
41 | //Type
42 | if (isCropType)
43 | {
44 | pgp.ProductGroupType = ISOEnumerations.ISOProductGroupType.CropType;
45 | }
46 | else
47 | {
48 | pgp.ProductGroupType = ISOEnumerations.ISOProductGroupType.ProductGroup;
49 | }
50 |
51 | //Add to the TaskData
52 | ISOTaskData.ChildElements.Add(pgp);
53 |
54 | return pgp;
55 | }
56 | }
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/ISOv4Plugin/ObjectModel/Error.cs:
--------------------------------------------------------------------------------
1 | using AgGateway.ADAPT.ApplicationDataModel.ADM;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace AgGateway.ADAPT.ISOv4Plugin.ObjectModel
9 | {
10 | public class Error : IError
11 | {
12 | public string Id { get; set; }
13 |
14 | public string Source { get; set; }
15 |
16 | public string Description { get; set; }
17 |
18 | public string StackTrace { get; set; }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/ISOv4Plugin/ObjectModel/ISOSpatialRow.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * ISO standards can be purchased through the ANSI webstore at https://webstore.ansi.org
3 | */
4 |
5 | using System;
6 | using System.Collections.Generic;
7 |
8 | namespace AgGateway.ADAPT.ISOv4Plugin.ObjectModel
9 | {
10 | public class ISOSpatialRow
11 | {
12 | public DateTime TimeStart { get; set; }
13 | public int NorthPosition { get; set; }
14 | public int EastPosition { get; set; }
15 | public int? Elevation { get; set; }
16 | public byte? PositionStatus { get; set; }
17 | public ushort? PDOP { get; set; }
18 | public ushort? HDOP { get; set; }
19 | public byte? NumberOfSatellites { get; set; }
20 | public uint? GpsUtcTime { get; set; }
21 | public ushort? GpsUtcDate { get; set; }
22 | public DateTime? GpsUtcDateTime { get; set; }
23 | public List SpatialValues { get; set; }
24 |
25 | ///
26 | /// Merge SpatialValues from provided SpatialRow into this one.
27 | ///
28 | ///
29 | ///
30 | public ISOSpatialRow Merge(ISOSpatialRow otherRow)
31 | {
32 | if (otherRow == null)
33 | {
34 | return this;
35 | }
36 |
37 | if (SpatialValues == null)
38 | {
39 | SpatialValues = new List();
40 | }
41 | if (otherRow.SpatialValues != null)
42 | {
43 | SpatialValues.AddRange(otherRow.SpatialValues);
44 | }
45 |
46 | return this;
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/ISOv4Plugin/ObjectModel/ISOUnit.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * ISO standards can be purchased through the ANSI webstore at https://webstore.ansi.org
3 | */
4 |
5 | using AgGateway.ADAPT.ISOv4Plugin.ISOModels;
6 |
7 | namespace AgGateway.ADAPT.ISOv4Plugin.ObjectModel
8 | {
9 | public class ISOUnit
10 | {
11 | public string Code { get; private set; }
12 | public int Offset { get; private set; }
13 | public double Scale { get; private set; }
14 |
15 | public ISOUnit(string code, double scale, int offset)
16 | {
17 | Code = code;
18 | Offset = offset;
19 | Scale = scale;
20 | }
21 |
22 | public ISOUnit(ISODeviceValuePresentation dvp)
23 | :this (dvp.UnitDesignator, dvp.Scale, dvp.Offset)
24 | {
25 | }
26 |
27 | public ISOUnit(ISOValuePresentation vpn)
28 | : this(vpn.UnitDesignator, vpn.Scale, vpn.Offset)
29 | {
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/ISOv4Plugin/ObjectModel/InstanceIDMap.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace AgGateway.ADAPT.ISOv4Plugin.ObjectModel
8 | {
9 | public class InstanceIDMap
10 | {
11 | private Dictionary _adaptIDs;
12 | private Dictionary _isoIDs;
13 |
14 | public InstanceIDMap()
15 | {
16 | _adaptIDs = new Dictionary();
17 | _isoIDs = new Dictionary();
18 | }
19 |
20 | public bool Add(int adaptID, string isoID)
21 | {
22 | if (!_adaptIDs.ContainsKey(isoID) && !_isoIDs.ContainsKey(adaptID))
23 | {
24 | _adaptIDs.Add(isoID, adaptID);
25 | _isoIDs.Add(adaptID, isoID);
26 | return true;
27 | }
28 | return false;
29 | }
30 |
31 | public void ReplaceADAPTID(string isoID, int newAdaptID)
32 | {
33 | if (_adaptIDs.ContainsKey(isoID))
34 | {
35 | _adaptIDs[isoID] = newAdaptID;
36 | }
37 |
38 | if (!_isoIDs.ContainsKey(newAdaptID))
39 | {
40 | _isoIDs.Add(newAdaptID, isoID);
41 | }
42 | }
43 |
44 |
45 |
46 | public void ReplaceISOID(int adaptID, string newISOID)
47 | {
48 | if (_isoIDs.ContainsKey(adaptID))
49 | {
50 | _isoIDs[adaptID] = newISOID;
51 | }
52 |
53 | if (!_adaptIDs.ContainsKey(newISOID))
54 | {
55 | _adaptIDs.Add(newISOID, adaptID);
56 | }
57 | }
58 |
59 | public int? GetADAPTID(string isoID)
60 | {
61 | if (isoID != null && _adaptIDs.ContainsKey(isoID))
62 | {
63 | return _adaptIDs[isoID];
64 | }
65 | return null;
66 | }
67 |
68 | public string GetISOID(int adaptID)
69 | {
70 | if (_isoIDs.ContainsKey(adaptID))
71 | {
72 | return _isoIDs[adaptID];
73 | }
74 | return null;
75 | }
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/ISOv4Plugin/ObjectModel/SpatialValue.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * ISO standards can be purchased through the ANSI webstore at https://webstore.ansi.org
3 | */
4 |
5 | using AgGateway.ADAPT.ISOv4Plugin.ISOModels;
6 |
7 | namespace AgGateway.ADAPT.ISOv4Plugin.ObjectModel
8 | {
9 | public class SpatialValue
10 | {
11 | public int Id { get; set; }
12 |
13 | public ISODataLogValue DataLogValue { get; set; }
14 |
15 | public double Value { get; set; }
16 |
17 | public ISODeviceProcessData DeviceProcessData { get; set; }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/ISOv4Plugin/Representation/DdiDefinition.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * ISO standards can be purchased through the ANSI webstore at https://webstore.ansi.org
3 | */
4 |
5 | namespace AgGateway.ADAPT.ISOv4Plugin.Representation
6 | {
7 | public class DdiDefinition
8 | {
9 | public int Id { get; set; }
10 | public string Definition { get; set; }
11 | public string Name { get; set; }
12 | public string Unit { get; set; }
13 | public double Resolution { get; set; }
14 | }
15 | }
--------------------------------------------------------------------------------
/ISOv4Plugin/Representation/DdiToUnitOfMeasureMapping.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * ISO standards can be purchased through the ANSI webstore at https://webstore.ansi.org
3 | */
4 |
5 | using System.Xml.Serialization;
6 |
7 | namespace AgGateway.ADAPT.ISOv4Plugin.Representation
8 | {
9 | [XmlRoot("ddiToUnitOfMeasureMapping")]
10 | public class DdiToUnitOfMeasureMapping
11 | {
12 | [XmlArray("mappings")]
13 | [XmlArrayItem("mapping", typeof(DdiToUnitOfMeasure))]
14 | public DdiToUnitOfMeasure[] Mappings { get; set; }
15 | }
16 |
17 | public class DdiToUnitOfMeasure
18 | {
19 | [XmlAttribute("unit")]
20 | public string Unit { get; set; }
21 |
22 | [XmlAttribute("domainId")]
23 | public string AdaptCode { get; set; }
24 |
25 | [XmlAttribute("operationType")]
26 | public string OperationType { get; set; }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/ISOv4Plugin/Representation/IsoUnitOfMeasureList.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * ISO standards can be purchased through the ANSI webstore at https://webstore.ansi.org
3 | */
4 |
5 | using System;
6 | using System.Collections.Generic;
7 | using System.IO;
8 | using System.Linq;
9 |
10 | namespace AgGateway.ADAPT.ISOv4Plugin.Representation
11 | {
12 | public static class IsoUnitOfMeasureList
13 | {
14 | private static List _isoMappings;
15 |
16 | private static string _isoUOMDataLocation = null;
17 |
18 | ///
19 | /// Static property to allow applications (particuarly web and cloud) to override the default location of resources as they may require.
20 | /// Set AgGateway.ADAPT.ISOv4Plugin.Representation.IsoUnitOfMeasureList.ISOUOMDataFile = {Path to IsoUnitOfMeasure.xml}
21 | ///
22 | public static string ISOUOMDataFile
23 | {
24 | get
25 | {
26 | if (_isoUOMDataLocation == null)
27 | {
28 | return Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Resources", "IsoUnitOfMeasure.xml");
29 | }
30 | else
31 | {
32 | return _isoUOMDataLocation;
33 | }
34 | }
35 | set { _isoUOMDataLocation = value; }
36 | }
37 |
38 |
39 | public static List Mappings
40 | {
41 | get
42 | {
43 | if (_isoMappings == null)
44 | {
45 | var serializer = new System.Xml.Serialization.XmlSerializer(typeof(DdiToUnitOfMeasureMapping));
46 | using (var stringReader = new StringReader(File.ReadAllText(ISOUOMDataFile)))
47 | _isoMappings = ((DdiToUnitOfMeasureMapping)serializer.Deserialize(stringReader)).Mappings.ToList();
48 | }
49 | return _isoMappings;
50 | }
51 | }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/ISOv4Plugin/Resources/IsoUnitOfMeasure.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/ISOv4PluginLogTest/ISOv4PluginLogTest.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp2.0
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/ISOv4PluginLogTest/ImportMappers/LogMappers/SectionMapperTest.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Linq;
3 | using AgGateway.ADAPT.ApplicationDataModel.LoggedData;
4 | using AgGateway.ADAPT.ISOv4Plugin.ImportMappers.LogMappers;
5 | using AgGateway.ADAPT.ISOv4Plugin.Models;
6 | using AgGateway.ADAPT.ISOv4Plugin.ObjectModel;
7 | using Moq;
8 | using NUnit.Framework;
9 |
10 | namespace ISOv4PluginLogTest.ImportMappers.LogMappers
11 | {
12 | [TestFixture]
13 | public class SectionMapperTest
14 | {
15 | [Test]
16 | public void GivenTimHeaderWhenMapThenGetMetersIsMapped()
17 | {
18 | var tim = new TIM();
19 | var tims = new List {tim};
20 | var isoSpatialRows = new List();
21 |
22 | var meterMapperMock = new Mock();
23 |
24 | var meters = new List();
25 | meterMapperMock.Setup(x => x.Map(tim, isoSpatialRows, It.IsAny())).Returns(meters);
26 |
27 | var result = new SectionMapper(meterMapperMock.Object).Map(tims, isoSpatialRows).First();
28 |
29 | Assert.AreSame(meters, result.GetWorkingDatas());
30 | }
31 |
32 | [Test]
33 | public void GivenTwoTimHeadersWhenMapThenGetMetersIsMapped()
34 | {
35 | var tim1 = new TIM();
36 | var tim2 = new TIM();
37 | var tims = new List { tim1, tim2 };
38 | var isoSpatialRows = new List();
39 |
40 | var meterMapperMock = new Mock();
41 |
42 | var meters1 = new List();
43 | var meters2 = new List();
44 | meterMapperMock.Setup(x => x.Map(tim1, isoSpatialRows, It.IsAny())).Returns(meters1);
45 | meterMapperMock.Setup(x => x.Map(tim2, isoSpatialRows, It.IsAny())).Returns(meters2);
46 |
47 | var result = new SectionMapper(meterMapperMock.Object).Map(tims, isoSpatialRows);
48 |
49 | Assert.AreEqual(2, result.Count);
50 | Assert.AreSame(meters1, result.ElementAt(0).GetWorkingDatas());
51 | Assert.AreSame(meters2, result.ElementAt(1).GetWorkingDatas());
52 | }
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/ISOv4PluginLogTest/ImportMappers/LogMappers/StatusUpdateMapperTest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using AgGateway.ADAPT.ApplicationDataModel.Documents;
7 | using AgGateway.ADAPT.ISOv4Plugin.ImportMappers.LogMappers;
8 | using AgGateway.ADAPT.ISOv4Plugin.Models;
9 | using NUnit.Framework;
10 |
11 | namespace ISOv4PluginLogTest.ImportMappers.LogMappers
12 | {
13 | [TestFixture]
14 | public class StatusUpdateMapperTest
15 | {
16 | private StatusUpdateMapper _mapper;
17 |
18 | [SetUp]
19 | public void Setup()
20 | {
21 | _mapper = new StatusUpdateMapper();
22 | }
23 |
24 | [Test]
25 | public void GivenTskgItem1WhenMapThenStatusIsScheduled()
26 | {
27 | var result = _mapper.Map(TSKG.Item1);
28 | Assert.AreEqual(WorkStatusEnum.Scheduled, result.Status);
29 | }
30 |
31 | [Test]
32 | public void GivenTskgItem2WhenMapThenStatusIsInProgress()
33 | {
34 | var result = _mapper.Map(TSKG.Item2);
35 | Assert.AreEqual(WorkStatusEnum.InProgress, result.Status);
36 | }
37 |
38 | [Test]
39 | public void GivenTskgItem3WhenMapThenStatusIsPaused()
40 | {
41 | var result = _mapper.Map(TSKG.Item3);
42 | Assert.AreEqual(WorkStatusEnum.Paused, result.Status);
43 | }
44 |
45 | [Test]
46 | public void GivenTskgItem4WhenMapThenStatusIsCompleted()
47 | {
48 | var result = _mapper.Map(TSKG.Item4);
49 | Assert.AreEqual(WorkStatusEnum.Completed, result.Status);
50 | }
51 |
52 | [Test]
53 | public void GivenTskgItem5WhenMapThenStatusIsScheduled()
54 | {
55 | var result = _mapper.Map(TSKG.Item5);
56 | Assert.AreEqual(WorkStatusEnum.Scheduled, result.Status);
57 | }
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/ISOv4PluginLogTest/ImportMappers/UniqueIdMapperTest.cs:
--------------------------------------------------------------------------------
1 | using AgGateway.ADAPT.ApplicationDataModel.Common;
2 | using AgGateway.ADAPT.ISOv4Plugin.ImportMappers;
3 | using NUnit.Framework;
4 |
5 | namespace ISOv4PluginLogTest.ImportMappers
6 | {
7 | [TestFixture]
8 | public class UniqueIdMapperTest
9 | {
10 | private string _id;
11 | private UniqueIdMapper _uniqueIdMapper;
12 |
13 | [SetUp]
14 | public void Setup()
15 | {
16 | _uniqueIdMapper = new UniqueIdMapper();
17 | }
18 |
19 | [Test]
20 | public void GivenIdWhenMapThenIdIsMapped()
21 | {
22 | _id = "DLV1";
23 |
24 | var uniqueId = Map();
25 | Assert.AreEqual(_id, uniqueId.Id);
26 | }
27 |
28 | [Test]
29 | public void GivenIdWhenMapThenSourceIsMapped()
30 | {
31 | _id = "DLV1";
32 |
33 | var uniqueId = Map();
34 |
35 | const string expectedSource = "http://dictionary.isobus.net/isobus/";
36 | Assert.AreEqual(expectedSource, uniqueId.Source);
37 | }
38 |
39 | [Test]
40 | public void GivenIdWhenMapThenIdTypeIsMapped()
41 | {
42 | _id = "DLV1";
43 |
44 | var uniqueId = Map();
45 |
46 | const IdTypeEnum expected = IdTypeEnum.String;
47 | Assert.AreEqual(expected, uniqueId.IdType);
48 | }
49 |
50 | [Test]
51 | public void GivenIdWhenMapThenSourceTypeIsMapped()
52 | {
53 | _id = "DLV1";
54 |
55 | var uniqueId = Map();
56 |
57 | const IdSourceTypeEnum expected = IdSourceTypeEnum.URI;
58 | Assert.AreEqual(expected, uniqueId.SourceType);
59 | }
60 |
61 | private UniqueId Map()
62 | {
63 | return _uniqueIdMapper.Map(_id);
64 | }
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/ISOv4PluginLogTest/Models/CTPTest.cs:
--------------------------------------------------------------------------------
1 | using System.Text;
2 | using System.Xml;
3 | using AgGateway.ADAPT.ISOv4Plugin.Models;
4 | using NUnit.Framework;
5 |
6 | namespace ISOv4PluginLogTest.Models
7 | {
8 | [TestFixture]
9 | public class CTPTest
10 | {
11 | private CTP _ctp;
12 | private StringBuilder _output;
13 | private XmlWriter _xmlBuilder;
14 |
15 | [SetUp]
16 | public void Setup()
17 | {
18 | _ctp = new CTP();
19 | _output = new StringBuilder();
20 | _xmlBuilder = XmlWriter.Create(_output);
21 | }
22 |
23 | [Test]
24 | public void GivenCTPWhenWriteXmlThenStartAndEndTagsAreWritten()
25 | {
26 | _ctp.WriteXML(_xmlBuilder);
27 | _xmlBuilder.Flush();
28 | Assert.True(_output.ToString().Contains(" _mockInteriorObject;
14 | private StringBuilder _output;
15 | private XmlWriter _xmlBuilder;
16 |
17 | [SetUp]
18 | public void Setup()
19 | {
20 | _mockInteriorObject = new Mock();
21 | _lsg = new LSG();
22 | _output = new StringBuilder();
23 | _xmlBuilder = XmlWriter.Create(_output, new XmlWriterSettings{ConformanceLevel = ConformanceLevel.Fragment});
24 | }
25 |
26 | [Test]
27 | public void GivenLSGWhenWriteXmlThenAttributeAIsInlcuded()
28 | {
29 | _lsg.A = LSGA.Item2;
30 | _lsg.WriteXML(_xmlBuilder);
31 | _xmlBuilder.Flush();
32 | Assert.True(_output.ToString().Contains("A=\"2\""));
33 | }
34 |
35 | [Test]
36 | public void GivenLSGWhenWriteXmlThenStartAndEndTagsAreWritten()
37 | {
38 | _lsg.WriteXML(_xmlBuilder);
39 | _xmlBuilder.Flush();
40 | Assert.True(_output.ToString().Contains(" m.Unit == "mg/m²").AdaptCode;
32 |
33 | Assert.AreEqual(expected, result.Code);
34 | }
35 |
36 | [Test]
37 | public void GivenDdiWithEnumeratedRepresentationWhenGetUnitThenReturnsNull()
38 | {
39 | var result = _representationMapper.GetUnitForDdi(161); //Condensed working state
40 |
41 | Assert.IsNull(result);
42 | }
43 |
44 | [Test]
45 | public void GivenDdiWithoutARepresentationWhenMapThenIsNumericRepresentationWithDdiCode()
46 | {
47 | var result = _representationMapper.Map(67);
48 | Assert.AreEqual(67.ToString(), result.Code);
49 | }
50 |
51 | [Test]
52 | public void GivenDdiWithoutARepresentationWhenMapThenIsNumericRepresentationWithCodeSourceDdi()
53 | {
54 | var result = _representationMapper.Map(67);
55 | Assert.AreEqual(RepresentationCodeSourceEnum.ISO11783_DDI, result.CodeSource);
56 | }
57 |
58 | [TearDown]
59 | public void TearDown()
60 | {
61 | _representationMapper = null;
62 | }
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/ISOv4PluginLogTest/Representation/UomLookupTest.cs:
--------------------------------------------------------------------------------
1 | using System.Linq;
2 | using AgGateway.ADAPT.ISOv4Plugin.Representation;
3 | using AgGateway.ADAPT.Representation.UnitSystem;
4 | using NUnit.Framework;
5 |
6 | namespace ISOv4PluginLogTest.Representation
7 | {
8 | [TestFixture]
9 | public class UomLookupTest
10 | {
11 | [Test]
12 | public void GivenAdaptUomWhenGetIsoMappingThenIsoUomExists()
13 | {
14 | var uom = UnitSystemManager.GetUnitOfMeasure("l1ha-1");
15 | var isoUom = IsoUnitOfMeasureList.Mappings.SingleOrDefault(x => x.AdaptCode == "l1ha-1");
16 |
17 | Assert.IsNotNull(uom);
18 | Assert.IsNotNull(isoUom);
19 | Assert.AreEqual("l/ha", isoUom.Unit.ToLower());
20 | }
21 |
22 | [Test]
23 | public void GivenIsoUomLookupThenAdaptUomMillimetersIsMapped()
24 | {
25 | var uom = UnitSystemManager.GetUnitOfMeasure("mm");
26 | var isoMapping = IsoUnitOfMeasureList.Mappings.Single(x => x.Unit == "mm");
27 |
28 | Assert.AreEqual(uom.Code, isoMapping.AdaptCode);
29 | }
30 |
31 | [Test]
32 | public void GivenIsoUomLookupThenAdaptUomKgHaIsMapped()
33 | {
34 | var uom = UnitSystemManager.GetUnitOfMeasure("kg1ha-1");
35 | var isoUom = IsoUnitOfMeasureList.Mappings.SingleOrDefault(x => x.AdaptCode == "kg1ha-1");
36 |
37 | Assert.IsNotNull(uom);
38 | Assert.IsNotNull(isoUom);
39 | Assert.AreEqual("kg/ha", isoUom.Unit.ToLower());
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/ISOv4PluginTest.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp2.0
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/AllocationTimestamp/Timestamp1.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/AllocationTimestamp/Timestamp2.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/AllocationTimestamp/Timestamp3.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/AllocationTimestamp/Timestamp4.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/AllocationTimestamp/Timestamp5.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/AllocationTimestamp/Timestamp6.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/AllocationTimestamp/Timestamp7.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/AllocationTimestamp/Timestamp8.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Comment/CCT00002.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Comment/Comment1.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Comment/Comment10.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Comment/Comment2.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Comment/Comment3.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Comment/Comment4.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Comment/Comment5.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Comment/Comment6.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Comment/Comment7.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Comment/Comment8.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Comment/Comment9.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Crop/CTP00003.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Crop/Crop1.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Crop/Crop2.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Crop/Crop3.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Crop/Crop4.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Crop/Crop5.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Crop/Crop6.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Customer/CTR00005.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Customer/Customer1.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Customer/Customer2.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Customer/Customer3.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Customer/Customer4.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Customer/Customer5.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Customer/Customer6.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Customer/Customer7.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Customer/Customer8.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Farm/FRM00004.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Farm/Farm1.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Farm/Farm2.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Farm/Farm3.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Farm/Farm4.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Farm/Farm5.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Farm/Farm6.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Farm/Farm7.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Field/Field1.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Field/Field10.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Field/Field11.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Field/Field12.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Field/Field3.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Field/Field5.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Field/Field6.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Field/Field7.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Field/Field8.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Field/Field9.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Field/PFD00006.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Guidance/AllPatternsOutput.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Guidance/GroupsNoPatternsOrBoundary.json:
--------------------------------------------------------------------------------
1 | {
2 | "Catalog": {
3 | "Fields": [
4 | {
5 | "Id": {
6 | "ReferenceId": -1
7 | },
8 | "Description": "Field",
9 | "GuidanceGroupIds": [
10 | -2,
11 | -3,
12 | -4
13 | ]
14 | }
15 | ],
16 | "GuidanceGroups": [
17 | {
18 | "Id": {
19 | "ReferenceId": -2
20 | },
21 | "Description": "guidance group 1"
22 | },
23 | {
24 | "Id": {
25 | "ReferenceId": -3
26 | },
27 | "Description": "guidance group 2"
28 | },
29 | {
30 | "Id": {
31 | "ReferenceId": -4
32 | },
33 | "Description": "guidance group 3",
34 | "GuidancePatternIds": []
35 | }
36 | ]
37 | }
38 | }
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Guidance/GroupsNoPatternsOrBoundaryOutput.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Guidance/GroupsWithBoundaryAndNoPatterns.json:
--------------------------------------------------------------------------------
1 | {
2 | "Catalog": {
3 | "Fields": [
4 | {
5 | "Id": {
6 | "ReferenceId": -1
7 | },
8 | "Description": "Field",
9 | "GuidanceGroupIds": [
10 | -2,
11 | -3
12 | ]
13 | }
14 | ],
15 | "GuidanceGroups": [
16 | {
17 | "Id": {
18 | "ReferenceId": -2
19 | },
20 | "Description": "guidance group 1",
21 | "BoundingPolygon": {
22 | "Polygons": [
23 | {
24 | "ExteriorRing": {
25 | "Points": [
26 | {
27 | "X": 1,
28 | "Y": 2,
29 | "Type": 5
30 | }
31 | ],
32 | "Type": 0
33 | },
34 | "Type": 6
35 | }
36 | ],
37 | "Type": 4
38 | }
39 | },
40 | {
41 | "Id": {
42 | "ReferenceId": -3
43 | },
44 | "Description": "guidance group 2",
45 | "BoundingPolygon": {
46 | "Polygons": [
47 | {
48 | "ExteriorRing": {
49 | "Points": [
50 | {
51 | "X": 10,
52 | "Y": 20,
53 | "Type": 5
54 | }
55 | ],
56 | "Type": 0
57 | },
58 | "Type": 6
59 | }
60 | ],
61 | "Type": 4
62 | }
63 | }
64 | ]
65 | }
66 | }
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Guidance/GroupsWithBoundaryAndNoPatternsOutput.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Guidance/GroupsWithBoundaryAndPatternsOutput.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Prescription/SingleProduct.json:
--------------------------------------------------------------------------------
1 | {
2 | "Catalog": {
3 | "Prescriptions": [
4 | {
5 | "$type": "AgGateway.ADAPT.ApplicationDataModel.Prescriptions.RasterGridPrescription, AgGateway.ADAPT.ApplicationDataModel",
6 | "RowCount": 3,
7 | "ColumnCount": 3,
8 | "Origin": {
9 | "X": 1,
10 | "Y": 2
11 | },
12 | "CellWidth": {
13 | "Value": {
14 | "Value": 0.0001
15 | }
16 | },
17 | "CellHeight": {
18 | "Value": {
19 | "Value": 0.0002
20 | }
21 | },
22 | "RateUnit": {
23 | "Code": "kg1[m2]-1",
24 | "Dimension": 76,
25 | },
26 | "Description": "test",
27 | "ProductIds": [ -1 ],
28 | "RxProductLookups":[
29 | { "RxProductLookup": [ { "Id": { "ReferenceId": -1 } } ] },
30 | { "RxProductLookup": [ { "Id": { "ReferenceId": -2 } } ] },
31 | ],
32 | "Rates": [
33 | {"RxRate": [ { "RxProductLookupId": -1, "Rate": 1 }]},
34 | {"RxRate": [ { "RxProductLookupId": -1, "Rate": 2 }]},
35 | {"RxRate": [ { "RxProductLookupId": -2, "Rate": 3 }]},
36 | {"RxRate": [ { "RxProductLookupId": -1, "Rate": 4 }]},
37 | {"RxRate": [ { "RxProductLookupId": -2, "Rate": 5 }]},
38 | {"RxRate": [ { "RxProductLookupId": -1, "Rate": 6 }]},
39 | {"RxRate": [ { "RxProductLookupId": -2, "Rate": 7 }]},
40 | {"RxRate": [ { "RxProductLookupId": -1, "Rate": 8 }]},
41 | {"RxRate": [ { "RxProductLookupId": -1, "Rate": 9 }]}
42 | ]
43 | }
44 | ]
45 | }
46 | }
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Prescription/SingleProductOutput.txt:
--------------------------------------------------------------------------------
1 | 010000000200000003000000040000000500000006000000070000000800000009000000
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Prescription/SingleProductOutput.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Product/PDT00005.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Product/PGP00001.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Product/PGP00002.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Product/Product1.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Product/Product2.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Product/Product3.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Product/Product4.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Product/Product5.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Product/Product6.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Product/Product7.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Product/Product8.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Product/Product9.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/ProductMix/PDT00002.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/ProductMix/ProductMix1.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/ProductMix/ProductMix2.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/ProductMix/ProductMix3.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/ProductMix/ProductMix4.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Summary/Summary1.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Summary/Summary2.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Summary/Summary3.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Summary/Summary4.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Summary/Summary5.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/TreatmentZone/MissingUnit.json:
--------------------------------------------------------------------------------
1 | {
2 | "Name": "zone1",
3 | "Variables": [
4 | {
5 | "ProductId": "PDT1",
6 | "Value": 100
7 | }
8 | ]
9 | }
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/TreatmentZone/MissingUnitOutput.xml:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ADAPT/ISOv4Plugin/7c25a8d4525a2012aed47469b2dbd23f913a281c/ISOv4PluginTest/TestData/TreatmentZone/MissingUnitOutput.xml
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/TreatmentZone/MultipleVariables.json:
--------------------------------------------------------------------------------
1 | {
2 | "Name": "zone1",
3 | "Variables": [
4 | {
5 | "ProductId": "PDT1",
6 | "IsoUnit": {
7 | "Code": "kg1ha-1",
8 | "Scale": 0.01,
9 | "Offset": 0
10 | },
11 | "Value": 100
12 | },
13 | {
14 | "ProductId": "PDT2",
15 | "IsoUnit": {
16 | "Code": "l1ha-1",
17 | "Scale": 0.0001,
18 | "Offset": 0
19 | },
20 | "Value": 200
21 | },
22 | {
23 | "ProductId": "PDT3",
24 | "IsoUnit": {
25 | "Code": "g1sec-1",
26 | "Scale": 0.001,
27 | "Offset": 0
28 | },
29 | "Value": 300
30 | }
31 | ]
32 | }
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/TreatmentZone/MultipleVariablesOutput.xml:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ADAPT/ISOv4Plugin/7c25a8d4525a2012aed47469b2dbd23f913a281c/ISOv4PluginTest/TestData/TreatmentZone/MultipleVariablesOutput.xml
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/TreatmentZone/NoVariables.json:
--------------------------------------------------------------------------------
1 | {
2 | "Name": "zone1"
3 | }
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/TreatmentZone/NoVariablesOutput.xml:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ADAPT/ISOv4Plugin/7c25a8d4525a2012aed47469b2dbd23f913a281c/ISOv4PluginTest/TestData/TreatmentZone/NoVariablesOutput.xml
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/TreatmentZone/UnsupportedUnitDimension.json:
--------------------------------------------------------------------------------
1 | {
2 | "Name": "zone1",
3 | "Variables": [
4 | {
5 | "ProductId": "PDT1",
6 | "IsoUnit": {
7 | "Code": "l",
8 | "Scale": 0.01,
9 | "Offset": 0
10 | },
11 | "Value": 100
12 | }
13 | ]
14 | }
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/TreatmentZone/UnsupportedUnitDimensionOutput.xml:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ADAPT/ISOv4Plugin/7c25a8d4525a2012aed47469b2dbd23f913a281c/ISOv4PluginTest/TestData/TreatmentZone/UnsupportedUnitDimensionOutput.xml
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Worker/NoWorkersPresent.json:
--------------------------------------------------------------------------------
1 | {
2 | "Catalog": {
3 | "ContactInfo": [
4 | {
5 | "AddressLine1": "line",
6 | "City": "city",
7 | "Country": "country",
8 | "Id": { "ReferenceId": -1 },
9 | "PoBoxNumber": "po box",
10 | "PostalCode": "postal code",
11 | "StateOrProvince": "state"
12 | }
13 | ],
14 | "Persons": [
15 | ]
16 | }
17 | }
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Worker/WorkersWithAllData.json:
--------------------------------------------------------------------------------
1 | {
2 | "Catalog": {
3 | "ContactInfo": [
4 | {
5 | "AddressLine1": "line",
6 | "City": "city",
7 | "Country": "country",
8 | "Id": { "ReferenceId": -1 },
9 | "PoBoxNumber": "po box",
10 | "PostalCode": "postal code",
11 | "StateOrProvince": "state",
12 | "Contacts": [
13 | {
14 | "Number": "Fixed",
15 | "Type": "FixedPhone"
16 | },
17 | {
18 | "Number": "Mobile",
19 | "Type": "MobilePhone"
20 | },
21 | {
22 | "Number": "Fax",
23 | "Type": "Fax"
24 | },
25 | {
26 | "Number": "Email",
27 | "Type": "Email"
28 | }
29 | ]
30 | },
31 | {
32 | "AddressLine1": "line2",
33 | "City": "city2",
34 | "Country": "country2",
35 | "Id": { "ReferenceId": -2 },
36 | "PoBoxNumber": "po box2",
37 | "PostalCode": "postal code2",
38 | "StateOrProvince": "state2",
39 | "Contacts": [
40 | {
41 | "Number": "Fixed2",
42 | "Type": "FixedPhone"
43 | },
44 | {
45 | "Number": "Mobile2",
46 | "Type": "MobilePhone"
47 | },
48 | {
49 | "Number": "Fax2",
50 | "Type": "Fax"
51 | },
52 | {
53 | "Number": "Email2",
54 | "Type": "Email"
55 | }
56 | ]
57 | }
58 | ],
59 | "Persons": [
60 | {
61 | "LastName": "last",
62 | "FirstName": "first",
63 | "ContactInfoId": -1,
64 | },
65 | {
66 | "LastName": "last2",
67 | "FirstName": "first2",
68 | "ContactInfoId": -2
69 | }
70 | ]
71 | }
72 | }
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Worker/WorkersWithAllDataOutput.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Worker/WorkersWithNoContacts.json:
--------------------------------------------------------------------------------
1 | {
2 | "Catalog": {
3 | "ContactInfo": [
4 | {
5 | "AddressLine1": "line",
6 | "City": "city",
7 | "Country": "country",
8 | "Id": { "ReferenceId": -1 },
9 | "PoBoxNumber": "po box",
10 | "PostalCode": "postal code",
11 | "StateOrProvince": "state"
12 | },
13 | {
14 | "Id": { "ReferenceId": -3 },
15 | "Contacts": [ ]
16 | }
17 | ],
18 | "Persons": [
19 | {
20 | "LastName": "last",
21 | "FirstName": "first",
22 | "ContactInfoId": -2
23 | },
24 | {
25 | "LastName": "last2",
26 | "FirstName": "first2"
27 | },
28 | {
29 | "LastName": "last3",
30 | "FirstName": "first3",
31 | "ContactInfoId": -3
32 | }
33 | ]
34 | }
35 | }
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Worker/WorkersWithNoContactsOutput.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestData/Worker/ZeroWorkersPresent.json:
--------------------------------------------------------------------------------
1 | {
2 | "Catalog": {
3 | "ContactInfo": [
4 | {
5 | "AddressLine1": "line",
6 | "City": "city",
7 | "Country": "country",
8 | "Id": { "ReferenceId": -1 },
9 | "PoBoxNumber": "po box",
10 | "PostalCode": "postal code",
11 | "StateOrProvince": "state"
12 | }
13 | ]
14 | }
15 | }
--------------------------------------------------------------------------------
/ISOv4PluginTest/TestHelpers.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Runtime.Serialization.Formatters;
4 | using System.Text;
5 | using AgGateway.ADAPT.ApplicationDataModel.ADM;
6 | using AgGateway.ADAPT.ISOv4Plugin;
7 | using AgGateway.ADAPT.ISOv4Plugin.Writers;
8 | using Newtonsoft.Json;
9 |
10 | namespace ISOv4PluginTest
11 | {
12 | internal static class TestHelpers
13 | {
14 | private static JsonSerializer _jsonSerializer = JsonSerializer.Create(
15 | new JsonSerializerSettings
16 | {
17 | TypeNameHandling = TypeNameHandling.Auto,
18 | TypeNameAssemblyFormat = FormatterAssemblyStyle.Simple,
19 | NullValueHandling = NullValueHandling.Ignore
20 | });
21 |
22 | internal static string LoadFromFile(string filePath)
23 | {
24 | return File.ReadAllText(filePath);
25 | }
26 |
27 | internal static string LoadFromFileAsHexString(string filePath)
28 | {
29 | return BitConverter.ToString(File.ReadAllBytes(filePath)).Replace("-", "");
30 | }
31 |
32 | internal static T LoadFromJson(string filePath)
33 | {
34 | using (var reader = File.OpenText(filePath))
35 | {
36 | using (var jsonReader = new JsonTextReader(reader))
37 | {
38 | return _jsonSerializer.Deserialize(jsonReader);
39 | }
40 | }
41 | }
42 |
43 | public static T LoadFromJson(byte[] workersWithAllData)
44 | {
45 | using (var stream = new MemoryStream(workersWithAllData))
46 | using (var reader = new StreamReader(stream))
47 | {
48 | return (T)_jsonSerializer.Deserialize(reader, typeof (T));
49 | }
50 | }
51 |
52 | public static string Export(TaskDocumentWriter taskWriter, ApplicationDataModel adaptDocument, string datacardPath)
53 | {
54 | new Exporter().Export(adaptDocument, datacardPath, taskWriter);
55 | taskWriter.RootWriter.Flush();
56 | var actual = Encoding.UTF8.GetString(taskWriter.XmlStream.ToArray());
57 | return actual;
58 | }
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/Writers/GuidancePatternWriterTests.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Text;
4 | using AgGateway.ADAPT.ApplicationDataModel.ADM;
5 | using AgGateway.ADAPT.ISOv4Plugin.Writers;
6 | using NUnit.Framework;
7 |
8 | namespace ISOv4PluginTest.Writers
9 | {
10 | [TestFixture]
11 | public class GuidancePatternWriterTests
12 | {
13 | private string _exportPath;
14 |
15 | [SetUp]
16 | public void Setup()
17 | {
18 | _exportPath = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
19 | Directory.CreateDirectory(_exportPath);
20 | }
21 |
22 | [Test]
23 | public void ShouldWriteAllTypesOfPatterns()
24 | {
25 | // Setup
26 | var taskWriter = new TaskDocumentWriter();
27 | var adaptDocument = TestHelpers.LoadFromJson(TestData.TestData.AllPatterns);
28 |
29 | // Act
30 | using (taskWriter)
31 | {
32 | var actual = TestHelpers.Export(taskWriter, adaptDocument, _exportPath);
33 |
34 | Assert.AreEqual(TestData.TestData.AllPatternsOutput, actual);
35 | }
36 | }
37 |
38 | [TearDown]
39 | public void Cleanup()
40 | {
41 | if (Directory.Exists(_exportPath))
42 | Directory.Delete(_exportPath, true);
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/Writers/PrescriptionWriterTests.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Text;
4 | using AgGateway.ADAPT.ApplicationDataModel.ADM;
5 | using AgGateway.ADAPT.ApplicationDataModel.Products;
6 | using AgGateway.ADAPT.ISOv4Plugin.Writers;
7 | using NUnit.Framework;
8 |
9 | namespace ISOv4PluginTest.Writers
10 | {
11 | [TestFixture]
12 | public class PrescriptionWriterTests
13 | {
14 | private string _exportPath;
15 |
16 | [SetUp]
17 | public void Setup()
18 | {
19 | _exportPath = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
20 | Directory.CreateDirectory(_exportPath);
21 | }
22 |
23 | [Test]
24 | public void ShouldWritePrescription()
25 | {
26 | // Setup
27 | var taskWriter = new TaskDocumentWriter();
28 | var adaptDocument = TestHelpers.LoadFromJson(TestData.TestData.SingleProduct);
29 | var fertilizerProduct = new CropNutritionProduct{ Description = "product", ProductType = ProductTypeEnum.Fertilizer};
30 | fertilizerProduct.Id.ReferenceId = -1;
31 | adaptDocument.Catalog.Products.Add(fertilizerProduct);
32 |
33 | // Act
34 | using (taskWriter)
35 | {
36 | var actualXml = TestHelpers.Export(taskWriter, adaptDocument, _exportPath);
37 | Assert.AreEqual(TestData.TestData.SingleProductOutputXml, actualXml);
38 | }
39 |
40 | // Verify
41 | var expectedPath = Path.Combine(_exportPath, "TASKDATA", "GRD00000.BIN");
42 | Assert.AreEqual(TestData.TestData.SingleProductOutputTxt, TestHelpers.LoadFromFileAsHexString(expectedPath));
43 | }
44 |
45 | [TearDown]
46 | public void Cleanup()
47 | {
48 | if (Directory.Exists(_exportPath))
49 | Directory.Delete(_exportPath, true);
50 | }
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/ISOv4PluginTest/Writers/ShapeWriterTests.cs:
--------------------------------------------------------------------------------
1 | using System.IO;
2 | using NUnit.Framework;
3 |
4 | namespace ISOv4PluginTest.Writers
5 | {
6 | [TestFixture]
7 | public class ShapeWriterTests
8 | {
9 |
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # ISOv4Plugin
2 |
--------------------------------------------------------------------------------
/TestUtilities/DataCardUtility.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.IO.Compression;
4 |
5 | namespace AgGateway.ADAPT.TestUtilities
6 | {
7 | public class DataCardUtility
8 | {
9 | public static string WriteDatacard(string name)
10 | {
11 | var directory = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
12 | Directory.CreateDirectory(directory);
13 | WriteDatacard(name, directory);
14 | return directory;
15 | }
16 |
17 | public static void WriteDatacard(string name, string directory)
18 | {
19 | var bytes = GetDatacard(name);
20 | Directory.CreateDirectory(directory);
21 |
22 | var zipFilePath = Path.Combine(directory, "DataCard.zip");
23 | File.WriteAllBytes(zipFilePath, bytes);
24 |
25 | ZipFile.ExtractToDirectory(zipFilePath, directory);
26 | }
27 |
28 | public static byte[] GetDatacard(string name)
29 | {
30 | var path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "DataCards", Path.ChangeExtension(name.Replace(" ", "_"), ".zip"));
31 | return File.ReadAllBytes(path);
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/TestUtilities/Datacards/Agco-MicroTrak.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ADAPT/ISOv4Plugin/7c25a8d4525a2012aed47469b2dbd23f913a281c/TestUtilities/Datacards/Agco-MicroTrak.zip
--------------------------------------------------------------------------------
/TestUtilities/Datacards/KV.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ADAPT/ISOv4Plugin/7c25a8d4525a2012aed47469b2dbd23f913a281c/TestUtilities/Datacards/KV.zip
--------------------------------------------------------------------------------
/TestUtilities/Datacards/agco c100 tc & jd sprayer 900-short.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ADAPT/ISOv4Plugin/7c25a8d4525a2012aed47469b2dbd23f913a281c/TestUtilities/Datacards/agco c100 tc & jd sprayer 900-short.zip
--------------------------------------------------------------------------------
/TestUtilities/Datacards/agco c100 tc & jd sprayer 900.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ADAPT/ISOv4Plugin/7c25a8d4525a2012aed47469b2dbd23f913a281c/TestUtilities/Datacards/agco c100 tc & jd sprayer 900.zip
--------------------------------------------------------------------------------
/TestUtilities/TestUtilities.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net8.0
5 | AgGateway.ADAPT.TestUtilities
6 | AgGateway.ADAPT.TestUtilities
7 |
8 |
9 |
10 |
11 | Always
12 |
13 |
14 | Always
15 |
16 |
17 | Always
18 |
19 |
20 | Always
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------