示例#1
0
 /// <summary>
 /// Initializes a new instance of the XtfMainHeader class that has default zero values.
 /// </summary>
 public XtfMainHeader()
 {
     _FileFormat              = 123;
     _SystemType              = 1;
     _RecordingProgramName    = "nd";
     _RecordingProgramVersion = "223";
     _SonarName    = "nd";
     _SonarType    = 0;
     _NoteString   = "nd";
     _ThisFileName = "nd";
     _NavigationCoordinateUnits      = 0;
     _NumberOfSonarChannels          = 0;
     _NumberOfBathymetryChannels     = 0;
     _NumberOfSnippetChannels        = 0;
     _NumberOfForwardLookArrays      = 0;
     _NumberOfEchoStrengthChannels   = 0;
     _NumberOfInterferometryChannels = 0;
     _ReferencePointHeight           = 0;
     _NavigationLatency   = 0;
     _NavigationOffsetY   = 0;
     _NavigationOffsetX   = 0;
     _NavigationOffsetZ   = 0;
     _NavigationOffsetYaw = 0;
     _MRUOffsetY          = 0;
     _MRUOffsetX          = 0;
     _MRUOffsetZ          = 0;
     _MRUOffsetYaw        = 0;
     _MRUOffsetPitch      = 0;
     _MRUOffsetRoll       = 0;
 }
示例#2
0
        public ProductInfo(Iso8211Reader reader)
        {
            DataSetGeneralInformationRecord = reader.ReadDataRecord();
            var dsid = DataSetGeneralInformationRecord.Fields.GetFieldByTag("DSID");

            if (dsid != null)
            {
                IntendedUsage = dsid.GetUInt32("INTU");
            }
            DataSetGeographicReferenceRecord = reader.ReadDataRecord();
            var dspm = DataSetGeographicReferenceRecord.Fields.GetFieldByTag("DSPM");

            if (dspm != null)
            {
                horizontalGeodeticDatum        = dspm.GetUInt32("HDAT");
                verticalDatum                  = dspm.GetUInt32("VDAT");
                soundingDatum                  = dspm.GetUInt32("SDAT");
                compilationScaleOfData         = dspm.GetUInt32("CSCL");
                unitsOfDepthMeasurement        = dspm.GetUInt32("DUNI");
                unitsOfHeightMeasurement       = dspm.GetUInt32("HUNI");
                unitsOfPositionalAccuracy      = dspm.GetUInt32("PUNI");
                coordinateUnits                = (CoordinateUnits)dspm.GetUInt32("COUN");
                coordinateMultiplicationFactor = dspm.GetUInt32("COMF");
                soundingMultiplicationFactor   = dspm.GetUInt32("SOMF");
                // COMT
            }
        }
示例#3
0
        public ProductInfo(Iso8211Reader reader)
        {
            DataSetGeneralInformationRecord = reader.ReadDataRecord();
            var dsid = DataSetGeneralInformationRecord.Fields.GetFieldByTag("DSID");

            if (dsid != null)
            {
                IntendedUsage = dsid.subFields.GetUInt32(0, "INTU");
            }
            DataSetGeographicReferenceRecord = reader.ReadDataRecord();
            var dspm = DataSetGeographicReferenceRecord.Fields.GetFieldByTag("DSPM");

            if (dspm != null)
            {
                subFieldRow                    = dspm.subFields.Values[0];
                tagLookup                      = dspm.subFields.TagIndex;
                horizontalGeodeticDatum        = subFieldRow.GetUInt32(tagLookup["HDAT"]);
                verticalDatum                  = subFieldRow.GetUInt32(tagLookup["VDAT"]);
                soundingDatum                  = subFieldRow.GetUInt32(tagLookup["SDAT"]);
                compilationScaleOfData         = subFieldRow.GetUInt32(tagLookup["CSCL"]);
                unitsOfDepthMeasurement        = subFieldRow.GetUInt32(tagLookup["DUNI"]);
                unitsOfHeightMeasurement       = subFieldRow.GetUInt32(tagLookup["HUNI"]);
                unitsOfPositionalAccuracy      = subFieldRow.GetUInt32(tagLookup["PUNI"]);
                coordinateUnits                = (CoordinateUnits)subFieldRow.GetUInt32(tagLookup["COUN"]);
                coordinateMultiplicationFactor = subFieldRow.GetUInt32(tagLookup["COMF"]);
                soundingMultiplicationFactor   = subFieldRow.GetUInt32(tagLookup["SOMF"]);
                // COMT
            }
        }
示例#4
0
        //public static System.Enum FromByte(this byte value)
        //{
        //    // Add check for the type of enum to parse
        //    if (!System.Enum.IsDefined(typeof(ChannelSampleFormats), value))
        //        return ChannelSampleFormats.Legacy;
        //    return (ChannelSampleFormats)value;
        //}

        #endregion "Enums stored as byte"

        #region "Enums stored as 16 bit unsigned integers"

        /// <summary>
        /// Return an unsigned integer of 16 bit that represent the value of the enum.
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        public static ushort ToUInt16(this CoordinateUnits value)
        {
            return((ushort)value);
        }
示例#5
0
        public BaseFile(Iso8211Reader reader)
        {
            //Current this works because we know the two records are special
            DataSetGeneralInformationRecord = reader.ReadDataRecord();
            var dssi = DataSetGeneralInformationRecord.Fields.GetFieldByTag("DSSI");

            if (dssi != null)
            {
                vectorDataStructure          = (VectorDataStructure)dssi.GetUInt32("DSTR");
                ATTFLexicalLevel             = (LexicalLevel)dssi.GetUInt32("AALL");
                NATFLexicalLevel             = (LexicalLevel)dssi.GetUInt32("NALL");
                numberOfMetaRecords          = dssi.GetUInt32("NOMR");
                numberOfCartographicRecords  = dssi.GetUInt32("NOCR");
                numberOfGeoRecords           = dssi.GetUInt32("NOGR");
                numberOfCollectionRecords    = dssi.GetUInt32("NOLR");
                numberOfIsolatedNodeRecords  = dssi.GetUInt32("NOIN");
                numberOfConnectedNodeRecords = dssi.GetUInt32("NOCN");
                numberOfEdgeRecords          = dssi.GetUInt32("NOED");
                numberOfFaceRecords          = dssi.GetUInt32("NOFA");
            }

            DataSetGeographicReferenceRecord = reader.ReadDataRecord();
            var dspm = DataSetGeographicReferenceRecord.Fields.GetFieldByTag("DSPM");

            if (dspm != null)
            {
                horizontalGeodeticDatum        = dspm.GetUInt32("HDAT");
                verticalDatum                  = dspm.GetUInt32("VDAT");
                soundingDatum                  = dspm.GetUInt32("SDAT");
                compilationScaleOfData         = dspm.GetUInt32("CSCL");
                unitsOfDepthMeasurement        = dspm.GetUInt32("DUNI");
                unitsOfHeightMeasurement       = dspm.GetUInt32("HUNI");
                unitsOfPositionalAccuracy      = dspm.GetUInt32("PUNI");
                coordinateUnits                = (CoordinateUnits)dspm.GetUInt32("COUN");
                coordinateMultiplicationFactor = dspm.GetUInt32("COMF");
                soundingMultiplicationFactor   = dspm.GetUInt32("SOMF");
                // COMT
            }

            // DSPR Dataset projection
            // DSRC Dataset registration control
            // DSHT Dataset history
            // DSAC Dataset accuracy
            // CATD catalogue directory
            // CATX Catalogue cross reference

            List <DataRecord> fr = new List <DataRecord>();
            List <DataRecord> vr = new List <DataRecord>();

            var nextRec = reader.ReadDataRecord();

            while (nextRec != null)
            {
                if (nextRec.Fields.FindFieldByTag("VRID"))
                {
                    vr.Add(nextRec);
                }
                else
                {
                    if (nextRec.Fields.FindFieldByTag("FRID"))
                    {
                        fr.Add(nextRec);
                    }
                }
                nextRec = reader.ReadDataRecord();
            }

            FeatureRecords = fr;
            VectorRecords  = vr;
        }
示例#6
0
        /// <summary>
        /// Initializes a new instance of the XtfMainHeader class that contain the values extracted from the given byte array.
        /// </summary>
        /// <param name="byteArray">The size of array need to be at least of 256 bytes.</param>
        public XtfMainHeader(Byte[] byteArray)
        {
            _FileFormat              = 123;
            _SystemType              = 1;
            _RecordingProgramName    = "nd";
            _RecordingProgramVersion = "223";
            _SonarName    = "nd";
            _SonarType    = 0;
            _NoteString   = "nd";
            _ThisFileName = "nd";
            _NavigationCoordinateUnits      = 0;
            _NumberOfSonarChannels          = 0;
            _NumberOfBathymetryChannels     = 0;
            _NumberOfSnippetChannels        = 0;
            _NumberOfForwardLookArrays      = 0;
            _NumberOfEchoStrengthChannels   = 0;
            _NumberOfInterferometryChannels = 0;
            _ReferencePointHeight           = 0;
            _NavigationLatency   = 0;
            _NavigationOffsetY   = 0;
            _NavigationOffsetX   = 0;
            _NavigationOffsetZ   = 0;
            _NavigationOffsetYaw = 0;
            _MRUOffsetY          = 0;
            _MRUOffsetX          = 0;
            _MRUOffsetZ          = 0;
            _MRUOffsetYaw        = 0;
            _MRUOffsetPitch      = 0;
            _MRUOffsetRoll       = 0;

            if (byteArray.Length >= 256)
            {
                using (BinaryReader dp = new BinaryReader(ArrayToStream.BytesToMemory(byteArray)))
                {
                    _FileFormat              = dp.ReadByte();                           // 0
                    _SystemType              = dp.ReadByte();                           // 1
                    _RecordingProgramName    = new String(dp.ReadChars(8));             // 2-3-4-5-6-7-8-9
                    _RecordingProgramVersion = new String(dp.ReadChars(8));             // 10-11-12-13-14-15-16-17
                    _SonarName    = new String(dp.ReadChars(16));                       // 18-19-20-21-22-23-24-25-26-27-28-29-30-31-32-33
                    _SonarType    = dp.ReadUInt16();                                    // 34-35
                    _NoteString   = new String(dp.ReadChars(64));                       // 36 -> 99
                    _ThisFileName = new String(dp.ReadChars(64));                       // 100 -> 163
                    _NavigationCoordinateUnits      = (CoordinateUnits)dp.ReadUInt16(); // 164-165
                    _NumberOfSonarChannels          = dp.ReadUInt16();                  // 166-167
                    _NumberOfBathymetryChannels     = dp.ReadUInt16();                  // 168-169
                    _NumberOfSnippetChannels        = dp.ReadByte();                    // 170
                    _NumberOfForwardLookArrays      = dp.ReadByte();                    // 171
                    _NumberOfEchoStrengthChannels   = dp.ReadUInt16();                  // 172-173
                    _NumberOfInterferometryChannels = dp.ReadByte();                    // 174
                    dp.ReadByte();                                                      // 175 Reserved
                    dp.ReadUInt16();                                                    // 176-177 Reserved
                    _ReferencePointHeight = dp.ReadSingle();                            // 178-179-180-181
                    dp.ReadBytes(12);                                                   // 182 -> 193 ProjectionType Not currently used
                    dp.ReadBytes(10);                                                   // 194 -> 203 SpheroidType Not currently used
                    _NavigationLatency = dp.ReadInt32();                                // 204-205-206-207
                    dp.ReadSingle();                                                    // 208-209-210-211 OriginY Not currently used
                    dp.ReadSingle();                                                    // 212-213-214-215 OriginX Not currently used
                    _NavigationOffsetY   = dp.ReadSingle();                             // 216-217-218-219
                    _NavigationOffsetX   = dp.ReadSingle();                             // 220-221-222-223
                    _NavigationOffsetZ   = dp.ReadSingle();                             // 224-225-226-227
                    _NavigationOffsetYaw = dp.ReadSingle();                             // 228-229-230-231
                    _MRUOffsetY          = dp.ReadSingle();                             // 232-233-234-235
                    _MRUOffsetX          = dp.ReadSingle();                             // 236-237-238-239
                    _MRUOffsetZ          = dp.ReadSingle();                             // 240-241-242-243
                    _MRUOffsetYaw        = dp.ReadSingle();                             // 244-245-246-247
                    _MRUOffsetPitch      = dp.ReadSingle();                             // 248-249-250-251
                    _MRUOffsetRoll       = dp.ReadSingle();                             // 252-253-254-255
                }
            }

            #endregion contructors
        }
示例#7
0
        public BaseFile(Iso8211Reader reader)
        {
            //Current this works because we know the two records are special
            DataSetGeneralInformationRecord = reader.ReadDataRecord();
            var dssi = DataSetGeneralInformationRecord.Fields.GetFieldByTag("DSSI");

            if (dssi != null)
            {
                subFieldRow                  = dssi.subFields.Values[0];
                tagLookup                    = dssi.subFields.TagIndex;
                vectorDataStructure          = (VectorDataStructure)subFieldRow.GetUInt32(tagLookup.IndexOf("DSTR"));
                ATTFLexicalLevel             = (S57LexicalLevel)subFieldRow.GetUInt32(tagLookup.IndexOf("AALL"));
                NATFLexicalLevel             = (S57LexicalLevel)subFieldRow.GetUInt32(tagLookup.IndexOf("NALL"));
                numberOfMetaRecords          = subFieldRow.GetUInt32(tagLookup.IndexOf("NOMR"));
                numberOfCartographicRecords  = subFieldRow.GetUInt32(tagLookup.IndexOf("NOCR"));
                numberOfGeoRecords           = subFieldRow.GetUInt32(tagLookup.IndexOf("NOGR"));
                numberOfCollectionRecords    = subFieldRow.GetUInt32(tagLookup.IndexOf("NOLR"));
                numberOfIsolatedNodeRecords  = subFieldRow.GetUInt32(tagLookup.IndexOf("NOIN"));
                numberOfConnectedNodeRecords = subFieldRow.GetUInt32(tagLookup.IndexOf("NOCN"));
                numberOfEdgeRecords          = subFieldRow.GetUInt32(tagLookup.IndexOf("NOED"));
                numberOfFaceRecords          = subFieldRow.GetUInt32(tagLookup.IndexOf("NOFA"));
            }

            DataSetGeographicReferenceRecord = reader.ReadDataRecord();
            var dspm = DataSetGeographicReferenceRecord.Fields.GetFieldByTag("DSPM");

            if (dspm != null)
            {
                subFieldRow                    = dspm.subFields.Values[0];
                tagLookup                      = dspm.subFields.TagIndex;
                horizontalGeodeticDatum        = subFieldRow.GetUInt32(tagLookup.IndexOf("HDAT"));
                verticalDatum                  = subFieldRow.GetUInt32(tagLookup.IndexOf("VDAT"));
                soundingDatum                  = subFieldRow.GetUInt32(tagLookup.IndexOf("SDAT"));
                compilationScaleOfData         = subFieldRow.GetUInt32(tagLookup.IndexOf("CSCL"));
                unitsOfDepthMeasurement        = subFieldRow.GetUInt32(tagLookup.IndexOf("DUNI"));
                unitsOfHeightMeasurement       = subFieldRow.GetUInt32(tagLookup.IndexOf("HUNI"));
                unitsOfPositionalAccuracy      = subFieldRow.GetUInt32(tagLookup.IndexOf("PUNI"));
                coordinateUnits                = (CoordinateUnits)subFieldRow.GetUInt32(tagLookup.IndexOf("COUN"));
                coordinateMultiplicationFactor = subFieldRow.GetUInt32(tagLookup.IndexOf("COMF"));
                soundingMultiplicationFactor   = subFieldRow.GetUInt32(tagLookup.IndexOf("SOMF"));
                // COMT
            }

            // DSPR Dataset projection
            // DSRC Dataset registration control
            // DSHT Dataset history
            // DSAC Dataset accuracy
            // CATD catalogue directory
            // CATX Catalogue cross reference

            eFeatureRecords = new Dictionary <NAMEkey, Feature>();
            eFeatureObjects = new Dictionary <LongName, Feature>();
            eVectorRecords  = new Dictionary <NAMEkey, Vector>();

            var nextRec = reader.ReadDataRecord();

            while (nextRec != null)
            {
                if (nextRec.Fields.FindFieldByTag("VRID"))
                {
                    vrid = nextRec.Fields.GetFieldByTag("VRID");
                    rcnm = vrid.subFields.GetUInt32(0, "RCNM");
                    rcid = vrid.subFields.GetUInt32(0, "RCID");
                    var    key    = new NAMEkey(rcnm, rcid);
                    Vector newVec = new Vector(key, nextRec);
                    eVectorRecords.Add(key, newVec);
                }
                else
                {
                    if (nextRec.Fields.FindFieldByTag("FRID"))
                    {
                        frid = nextRec.Fields.GetFieldByTag("FRID");
                        rcnm = frid.subFields.GetUInt32(0, "RCNM");
                        rcid = frid.subFields.GetUInt32(0, "RCID");
                        //consider using lnam as key (from FOID field), challenge: update files deleting a feature record do not encode lnam of that feature record
                        var     key     = new NAMEkey(rcnm, rcid);
                        Feature newFeat = new Feature(key, nextRec);
                        eFeatureRecords.Add(key, newFeat);
                    }
                }
                nextRec = reader.ReadDataRecord();
            }
        }