ToString() публичный Метод

public ToString ( ) : string
Результат string
Пример #1
1
            public bool LoadFile(string filename)
            {
                FileName = filename;

                log.InfoFormat("GeoTiff {0}", filename);

                using (Tiff tiff = Tiff.Open(filename, "r"))
                {
                    width = tiff.GetField(TiffTag.IMAGEWIDTH)[0].ToInt();
                    height = tiff.GetField(TiffTag.IMAGELENGTH)[0].ToInt();
                    bits = tiff.GetField(TiffTag.BITSPERSAMPLE)[0].ToInt();

                    if (bits != 16)
                        return false;

                    var modelscale = tiff.GetField(TiffTag.GEOTIFF_MODELPIXELSCALETAG);
                    var tiepoint = tiff.GetField(TiffTag.GEOTIFF_MODELTIEPOINTTAG);

                    i = BitConverter.ToDouble(tiepoint[1].ToByteArray(), 0);
                    j = BitConverter.ToDouble(tiepoint[1].ToByteArray(), 0 + 8);
                    k = BitConverter.ToDouble(tiepoint[1].ToByteArray(), 0 + 16);
                    x = BitConverter.ToDouble(tiepoint[1].ToByteArray(), 0 + 24);
                    y = BitConverter.ToDouble(tiepoint[1].ToByteArray(), 0 + 32);
                    z = BitConverter.ToDouble(tiepoint[1].ToByteArray(), 0 + 40);

                    log.InfoFormat("Tie Point ({0},{1},{2}) --> ({3},{4},{5})", i, j, k, x, y, z);

                    xscale = BitConverter.ToDouble(modelscale[1].ToByteArray(), 0);
                    yscale = BitConverter.ToDouble(modelscale[1].ToByteArray(), 0 + 8);
                    zscale = BitConverter.ToDouble(modelscale[1].ToByteArray(), 0 + 16);

                    log.InfoFormat("Scale ({0},{1},{2})", xscale, yscale, zscale);

                    Area = new RectLatLng(y, x, width*xscale, height*yscale);

                    log.InfoFormat("Coverage {0}", Area.ToString());

                    GeoTiff.index.Add(this);

                    /*

                short numberOfDirectories = tiff.NumberOfDirectories();
                for (short d = 0; d < numberOfDirectories; ++d)
                {
                    tiff.SetDirectory((short)d);

                    for (ushort t = ushort.MinValue; t < ushort.MaxValue; ++t)
                    {
                        TiffTag tag = (TiffTag)t;
                        FieldValue[] value = tiff.GetField(tag);
                        if (value != null)
                        {
                            for (int j2 = 0; j2 < value.Length; j2++)
                            {
                                Console.WriteLine("{0} : {1} : {2}", tag.ToString(), value[j2].Value.GetType().ToString(), value[j2].ToString());
                            }
                        }
                    }
                }
                     */
                }

                return true;
            }
Пример #2
0
            public void LoadFile(string filename)
            {
                log.InfoFormat("DTED {0}", filename);

                using (var stream = File.OpenRead(filename))
                {
                    byte[] buffer = new byte[80];
                    stream.Read(buffer, 0, buffer.Length);

                    var UHL = user_header_label.Match(ASCIIEncoding.ASCII.GetString(buffer));

                    buffer = new byte[648];
                    stream.Read(buffer, 0, buffer.Length);

                    var DSI = data_set_identification.Match(ASCIIEncoding.ASCII.GetString(buffer));

                    buffer = new byte[2700];
                    stream.Read(buffer, 0, buffer.Length);

                    var ACC = accuracy_description.Match(ASCIIEncoding.ASCII.GetString(buffer));

                    width = int.Parse(UHL.Groups[10].Value);
                    height = int.Parse(UHL.Groups[11].Value);

                    log.InfoFormat("Size ({0},{1})", width, height);

                    // lower left corner
                    x = DDDMMSSH2DD(UHL.Groups[3].Value);
                    y = DDDMMSSH2DD(UHL.Groups[4].Value);

                    log.InfoFormat("Start Point ({0},{1})", x, y);

                    // scales
                    xscale = SSSS2DD(UHL.Groups[5].Value);
                    yscale = SSSS2DD(UHL.Groups[6].Value);

                    log.InfoFormat("Scale ({0},{1})", xscale, yscale);

                    // switch top for bottom
                    y += height * yscale;

                    Area = new RectLatLng(y, x, width * xscale, height * yscale);

                    log.InfoFormat("Coverage {0}", Area.ToString());

                    FileName = filename;
                    index.Add(this);
                }
            }