Example #1
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;
        }
Example #2
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();
            }
        }