コード例 #1
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);
        }