//////////////////////////////////////////////////////////////////////////// //--------------------------------- REVISIONS ------------------------------ // Date Name Tracking # Description // --------- ------------------- ------------- ---------------------- // 21JUN2009 James Shen Initial Creation //////////////////////////////////////////////////////////////////////////// /** * read from the geoset file. */ private void ReadGeoSet(BinaryReader reader) { if (reader == null) { throw new IOException("can not read from null reader!"); } _mapFeatureLayerInfos.Clear(); DataReader.Seek(reader, 0); string fileVersion = DataReader.ReadString(reader); DataReader.Seek(reader, 16); string fileFormat = DataReader.ReadString(reader); DataReader.Seek(reader, 32); string pstType = DataReader.ReadString(reader); DataReader.Seek(reader, 48); if (!(fileFormat.ToUpper().Equals("JAVA") && pstType.ToUpper().Equals("PST"))) { throw new IOException("Invalid file format!"); } DataReader.ReadString(reader); DataReader.Seek(reader, 128); _mapUnit = DataReader.ReadInt(reader); DataReader.ReadDouble(reader); int mapLayerCount = DataReader.ReadInt(reader); for (int i = 0; i < mapLayerCount; i++) { DataReader.Seek(reader, (long)(i * 512 + 144)); string layerName = DataReader.ReadString(reader); string description = DataReader.ReadString(reader); byte layerVisible = reader.ReadByte(); double zoomMax = DataReader.ReadDouble(reader); double zoomMin = DataReader.ReadDouble(reader); MapFeatureLayerInfo mapLayerInfo = new MapFeatureLayerInfo(); mapLayerInfo.Description = description; mapLayerInfo.LayerName = layerName; if (layerVisible == 1) { mapLayerInfo.Visible = true; } else { mapLayerInfo.Visible = false; } mapLayerInfo.ZoomMax = zoomMax; mapLayerInfo.ZoomMin = zoomMin; if (zoomMax == zoomMin && zoomMin < 0.001) { mapLayerInfo.ZoomLevel = false; } else { mapLayerInfo.ZoomLevel = true; } _mapFeatureLayerInfos.Add(mapLayerInfo); } reader.Close(); if (_mapFeatureLayerInfos.Count > 0) { _layerNames = new string[_mapFeatureLayerInfos.Count]; for (int i = 0; i < _mapFeatureLayerInfos.Count; i++) { _layerNames[i] = ((MapFeatureLayerInfo)_mapFeatureLayerInfos[i]).LayerName; } } }