示例#1
0
 ////////////////////////////////////////////////////////////////////////////
 //--------------------------------- REVISIONS ------------------------------
 // Date       name                 Tracking #         Description
 // ---------  -------------------  -------------      ----------------------
 // 21JUN2009  James Shen                 	          Initial Creation
 ////////////////////////////////////////////////////////////////////////////
 /**
  * constructor.
  */
 internal DataTable(TabularData tabularData, DataField[] fields, int recordCount)
 {
     _tabularData = tabularData;
     Fields = fields;
     _recordCount = recordCount;
     _currentIndex = 1;
 }
 ////////////////////////////////////////////////////////////////////////////
 //--------------------------------- REVISIONS ------------------------------
 // Date       Name                 Tracking #         Description
 // ---------  -------------------  -------------      ----------------------
 // 21JUN2009  James Shen                 	          Initial Creation
 ////////////////////////////////////////////////////////////////////////////
 /**
  * Open the map layer.
  */
 public void Open()
 {
     if (!_opened)
     {
         _opened = true;
         _mapFile.Open();
         DataTable = new DataTable(_mapFile.TabularData, _mapFile.Header.Fields,
                 _mapFile.Header.RecordCount);
         int foundName = -1;
         for (int i = 0; i < _mapFile.Header.Fields.Length; i++)
         {
             KeyField = _mapFile.Header.Fields[i];
             if (KeyField.GetName().ToLower().StartsWith("name"))
             {
                 foundName = i;
                 _keyFieldIndex = i;
                 break;
             }
         }
         if (foundName == -1)
         {
             for (int i = 0; i < _mapFile.Header.Fields.Length; i++)
             {
                 KeyField = _mapFile.Header.Fields[i];
                 if (KeyField.GetFieldType() == DataField.TYPE_CHAR)
                 {
                     foundName = i;
                     _keyFieldIndex = i;
                     break;
                 }
             }
         }
         if (foundName == -1)
         {
             KeyField = _mapFile.Header.Fields[0];
             _keyFieldIndex = 0;
         }
         if (_mapFile.Header.DominantType.ToUpper().Equals("POINT"))
         {
             PredominantFeatureType = FEATURE_TYPE_POINT;
         }
         else if (_mapFile.Header.DominantType.ToUpper().Equals("PLINE"))
         {
             PredominantFeatureType = FEATURE_TYPE_PLINE;
         }
         else
         {
             PredominantFeatureType = FEATURE_TYPE_REGION;
         }
         Bounds = _mapFile.Header.MapBounds;
     }
 }