/// <summary> /// Execute the pre-scan operation on the TAG file, returning a boolean success result. /// Sets up local state detailing the pre-scan fields retried from the ATG file /// </summary> public bool Execute(Stream TAGData) { try { Initialise(); using (var Processor = new TAGProcessorPreScanState()) { var Sink = new TAGVisionLinkPrerequisitesValueSink(Processor); using (var Reader = new TAGReader(TAGData)) { var TagFile = new TAGFile(); ReadResult = TagFile.Read(Reader, Sink); } if (ReadResult != TAGReadResult.NoError) { return(false); } IsCSIBCoordSystemTypeOnly = Processor.IsCSIBCoordSystemTypeOnly; SetPublishedState(Processor); } } catch // (Exception E) // make sure any exception is trapped to return correct response to caller { return(false); } return(true); }
/// <summary> /// Grid point from on-machine positions /// Scenarios /// a) Lat/long present /// TFA to use this as the seed location /// b) No Lat/long, but UTM zone present /// Discussion with Grant and Raymond: /// Potential corner case where UTMZone may be different to the projects CSIB. /// safer to convert to lat/long using the UTMZone /// unable to find any samples /// c) No Lat/long, no UTM zone, but has a NEE /// TFA to use project CSIBs and NEE to determine potential LLs /// </summary> /// <param name="processor"></param> private void SetSeedPosition(TAGProcessorPreScanState processor) { PopulateNEE(processor); if (processor.LLHLatRecordedTime.HasValue) { SeedLatitude = Math.Abs(processor.LLHLat - Consts.NullDouble) < Consts.TOLERANCE_DECIMAL_DEGREE ? (double?)null : processor.LLHLat; SeedLongitude = Math.Abs(processor.LLHLon - Consts.NullDouble) < Consts.TOLERANCE_DECIMAL_DEGREE ? (double?)null : processor.LLHLon; SeedHeight = Math.Abs(processor.LLHHeight - Consts.NullDouble) < Consts.TOLERANCE_DECIMAL_DEGREE ? (double?)null : processor.LLHHeight; SeedTimeUTC = processor.LLHLatRecordedTime; //We arbitrarily choose LLHLat, in the majority of cases this will be same for any LLH. } }
/// <summary> /// Fill out the local class properties with the information wanted from the TAG file /// </summary> /// <param name="processor"></param> private void SetPublishedState(TAGProcessorPreScanState processor) { LastDataTime = processor.DataTime; SetSeedPosition(processor); ProcessedEpochCount = processor.ProcessedEpochCount; RadioType = processor.RadioType; RadioSerial = processor.RadioSerial; MachineType = processor.MachineType; MachineID = processor.MachineID; HardwareID = processor.HardwareID; ApplicationVersion = processor.ApplicationVersion; DesignName = processor.Design; PlatformType = processor.GetPlatformType(); }
private void PopulateNEE(TAGProcessorPreScanState processor) { SeedTimeUTC = processor._FirstDataTime; if (processor.HaveReceivedValidTipPositions) { SeedNorthing = (processor.DataLeft.Y + processor.DataRight.Y) / 2; SeedEasting = (processor.DataLeft.X + processor.DataRight.X) / 2; SeedElevation = (processor.DataLeft.Z + processor.DataRight.Z) / 2; } else { if (processor.HaveReceivedValidRearPositions) { SeedNorthing = (processor.DataRearLeft.Y + processor.DataRearRight.Y) / 2; SeedEasting = (processor.DataRearLeft.X + processor.DataRearRight.X) / 2; SeedElevation = (processor.DataRearLeft.Z + processor.DataRearRight.Z) / 2; } else { if (processor.HaveReceivedValidWheelPositions) { SeedNorthing = (processor.DataWheelLeft.Y + processor.DataWheelRight.Y) / 2; SeedEasting = (processor.DataWheelLeft.X + processor.DataWheelRight.X) / 2; SeedElevation = (processor.DataWheelLeft.Z + processor.DataWheelRight.Z) / 2; } else { if (processor.HaveReceivedValidTrackPositions) { SeedNorthing = (processor.DataTrackLeft.Y + processor.DataTrackRight.Y) / 2; SeedEasting = (processor.DataTrackLeft.X + processor.DataTrackRight.X) / 2; SeedElevation = (processor.DataTrackLeft.Z + processor.DataTrackRight.Z) / 2; } } } } }