Exemplo n.º 1
0
 public IRecord GetData(int index)
 {
     if (ContentsFile != null)
     {
         ShxRecord shxRecord = (ShxRecord)RecordSet[index];
         IRecord   shpRecord = ContentsFile.GetData(ShpType, shxRecord.Offset, shxRecord.Length);
         return(shpRecord);
     }
     else
     {
         return(null);
     }
 }
Exemplo n.º 2
0
        public void Load()
        {
            FileCode = Util.FromBigEndian(br.ReadInt32());
            br.BaseStream.Seek(20, SeekOrigin.Current);
            FileLength  = Util.FromBigEndian(br.ReadInt32()) * 2;
            FileVersion = br.ReadInt32();
            ShpType     = (ShapeType)br.ReadInt32();

            TotalXYRange = new RangeXY();
            ZRange       = new Range();
            MRange       = new Range();
            TotalXYRange.Load(ref br);
            ZRange.Load(ref br);
            MRange.Load(ref br);

            int  ContentLength = FileLength - 100;
            long curPoint      = 0;

            RecordSet = new List <ShxRecord>();
            while (curPoint < ContentLength)
            {
                ShxRecord record = new ShxRecord();
                record.Load(ref br);
                RecordSet.Add(record);

                curPoint += record.GetLength();
            }
            try
            {
                ContentsFile = (ShpFile)FileFactory.CreateInstance(shpPath);
            }
            catch (Exception)
            {
                ContentsFile = null;
            }
        }