Example #1
0
        private static void AreEqual(XmlNode tlgNode, string currentPath, OperationData operationData)
        {
            var isoSpatialRecords = GetIsoSpatialRecords(tlgNode.Attributes["A"].Value, currentPath).ToList();
            var adaptSpatialRecords = operationData.GetSpatialRecords().ToList();

            var sections = operationData.GetAllSections();
            var meters = sections.SelectMany(x => x.GetWorkingDatas()).ToList();

            SpatialRecordAssert.AreEqual(isoSpatialRecords, adaptSpatialRecords, meters);
        }
        private static Dictionary<int, IEnumerable<WorkingData>> GetWorkingData(OperationData operationData)
        {
            var workingDataWithDepth = new Dictionary<int, IEnumerable<WorkingData>>();
            for (var i = 0; i <= operationData.MaxDepth; i++)
            {
                var meters = operationData.GetDeviceElementUses(i).SelectMany(x=> x.GetWorkingDatas()).Where(x => x.Representation != null);

                workingDataWithDepth.Add(i, meters);
            }
            return workingDataWithDepth;
        }
        public void Setup()
        {
            _workingDatas = new List<WorkingData>();
            _deviceElementUses = new Dictionary<int, List<DeviceElementUse>>();
            _spatialRecords = new List<SpatialRecord>();
            _operationData = new OperationData
            {
                GetSpatialRecords = () => _spatialRecords,
                GetDeviceElementUses = x => _deviceElementUses[x],
                MaxDepth = 0
            };

            _operationDataProcessor = new OperationDataProcessor();

        }
Example #4
0
        private TLG Map(OperationData operationData, string taskDataPath, TaskDocumentWriter taskDocumentWriter)
        {
            var tlgId = operationData.Id.FindIsoId() ?? "TLG" + operationData.Id.ReferenceId;
            taskDocumentWriter.Ids.Add(tlgId, operationData.Id);

            var tlg = new TLG { A = tlgId};
            var sections = operationData.GetAllSections();
            var meters = sections.SelectMany(x => x.GetWorkingDatas()).ToList();
            var spatialRecords = operationData.GetSpatialRecords != null ? operationData.GetSpatialRecords() : null;

            var timHeader = _timHeaderMapper.Map(meters);
            _xmlReader.WriteTlgXmlData(taskDataPath, tlg.A + ".xml", timHeader);

            var binFilePath = Path.Combine(taskDataPath, tlg.A + ".bin");
            _binaryWriter.Write(binFilePath, meters, spatialRecords);

            return tlg;
        }
        public DataTable ProcessOperationData(OperationData operationData)
        {
            _dataTable = new DataTable();

            if (operationData.GetSpatialRecords != null)
            {
                var spatialRecords = operationData.GetSpatialRecords().ToList();
                var meters = GetWorkingData(operationData);

                CreateColumns(meters);

                foreach (var spatialRecord in spatialRecords)
                {
                    CreateRow(meters, spatialRecord);
                }

                UpdateColumnNamesWithUom(meters, spatialRecords);
            }

            return _dataTable;
        }
Example #6
0
        private OperationData Map(TLG tlg, int? prescrptionId, string datacardPath, Dictionary<string, List<UniqueId>> linkedIds)
        {
            var tim = _xmlReader.ReadTlgXmlData(datacardPath, tlg.A + ".xml").First();
            var isoRecords = _binaryReader.Read(datacardPath, tlg.A + ".bin", tim).ToList();
            var sections = _sectionMapper.Map(new List<TIM> {tim}, isoRecords);
            var meters = sections != null ? sections.SelectMany(x => x.GetWorkingDatas()).ToList() : new List<WorkingData>();

            var operationData = new OperationData
            {
                GetSpatialRecords = () => _spatialRecordMapper.Map(isoRecords, meters),
                MaxDepth = 0,
                GetDeviceElementUses = x => x == 0 ? sections : new List<DeviceElementUse>(),
                PrescriptionId = prescrptionId
            };
            operationData.Id.UniqueIds.Add(_uniqueIdMapper.Map(tlg.A));

            if(linkedIds.ContainsKey(tlg.A))
            {
                foreach (var linkedId in linkedIds[tlg.A])
                    operationData.Id.UniqueIds.Add(linkedId);
            }

            return operationData;
        }
Example #7
0
        public void Setup()
        {
            _operationData = new OperationData();
            _operationDatas = new List<OperationData> { _operationData };

            _binaryWriterMock = new Mock<IBinaryWriter>();
            _xmlReaderMock = new Mock<IXmlReader>();
            _timHeaderMock = new Mock<ITimHeaderMapper>();
            _datacardPath = "";
            _taskDocumentWriter = new TaskDocumentWriter();

            _tlgMapper = new TlgMapper(_xmlReaderMock.Object, _timHeaderMock.Object, _binaryWriterMock.Object);
        }