Ejemplo n.º 1
0
        public void ReadRecords(IProgressTracker tracker)
        {
            lock (_fsMainFile)
            {
                if (_isLoaded)
                {
                    return;
                }
                try
                {
                    _dbfReader    = new DbaseReader(_dbffile);
                    _featureCount = 0;
                    _features     = new List <Feature>();
                    while (_fsMainFile.Position < _fileLength)
                    {
                        //Record header
                        int oid         = ToLocalEndian.ToInt32FromBig(_brMainFile.ReadBytes(4));
                        int contentSize = ToLocalEndian.ToInt32FromBig(_brMainFile.ReadBytes(4));//16bit 字为单位
                        //if (contentSize < 0)
                        //    Console.WriteLine("");
                        byte[] contentBytes = _brMainFile.ReadBytes(contentSize * 2);
                        object obj          = BytesToFeature(contentBytes, oid);
                        _features.Add(obj as Feature);
                        //
                        _featureCount++;
                    }

                    if (_argOfLeveling != null && _argOfLeveling.Enabled && _shapeType == enumShapeType.Point)
                    {
                        //int bTime = Environment.TickCount;
                        using (LevelAdjuster set = new LevelAdjuster())
                        {
                            set.BeginLevel = _argOfLeveling.BeginLevel;
                            set.GridSize   = _argOfLeveling.GridSize;
                            set.Features   = _features.ToArray();
                            set.Do();
                        }
                        //int eTime = Environment.TickCount - bTime;
                    }
                }
                catch
                {
                    throw;
                }
                finally
                {
                    _isLoaded = true;
                }
            }
        }
Ejemplo n.º 2
0
 private void AutoLeveling(Feature[] features)
 {
     if (_argOfLeveling != null && _argOfLeveling.Enabled && _shapeType == enumShapeType.Point)
     {
         //int bTime = Environment.TickCount;
         using (LevelAdjuster set = new LevelAdjuster())
         {
             set.BeginLevel = _argOfLeveling.BeginLevel;
             set.GridSize   = _argOfLeveling.GridSize;
             set.Features   = features.ToArray();
             set.Do();
         }
         //int eTime = Environment.TickCount - bTime;
     }
 }
Ejemplo n.º 3
0
 public Feature[] GetFeatures_NEW(Envelope envelope)
 {
     lock (lockObject)
     {
         if (envelope == null)
         {
             return(null);
         }
         if (_features == null && _featureCount == -1)
         {
             ReadRecords(null);
         }
         Envelope validExtent = _envelope.IntersectWith(envelope);
         if (validExtent == null)
         {
             return(null);
         }
         List <Feature> retFets = new List <Feature>();
         FetchFeatures((fet) =>
         {
             if (validExtent.Contains(fet.Geometry.Envelope))
             {
                 retFets.Add(fet);
             }
             else
             {
                 if (fet.Geometry.Envelope.IsInteractived(validExtent))
                 {
                     retFets.Add(fet);
                     fet.IsRepeatedOverGrids = true;
                 }
             }
         }
                       );
         if (_argOfLeveling != null && _argOfLeveling.Enabled && _shapeType == enumShapeType.Point)
         {
             using (LevelAdjuster set = new LevelAdjuster())
             {
                 set.BeginLevel = _argOfLeveling.BeginLevel;
                 set.GridSize   = _argOfLeveling.GridSize;
                 set.Features   = retFets.ToArray();
                 set.Do();
             }
         }
         return(retFets.Count > 0 ? retFets.ToArray() : null);
     }
 }
Ejemplo n.º 4
0
 public void ReLeveling()
 {
     if (_grids == null || _grids.Count == 0)
     {
         return;
     }
     using (LevelAdjuster set = new LevelAdjuster())
     {
         int n = _grids.Count;
         for (int i = n - 1; i >= 0; i--)
         {
             set.Features   = _grids[i].VectorFeatures.ToArray();
             set.BeginLevel = _dataSource.ArgOfLeveling.BeginLevel;
             set.GridSize   = _dataSource.ArgOfLeveling.GridSize;
             set.Do();
         }
     }
 }