Ejemplo n.º 1
0
        private void GetInfo(string url, out GGeoImageInfo info)
        {
            HttpWebRequest  r      = HttpWebRequest.Create(url) as HttpWebRequest;
            HttpWebResponse result = r.GetResponse() as HttpWebResponse;

            System.IO.Stream mem = result.GetResponseStream();

            XmlDocument doc = new XmlDocument();

            doc.Load(mem);

            XmlElement elm = doc.DocumentElement;

            info          = new GGeoImageInfo();
            info.MinLevel = Convert.ToInt32(elm["MinLevel"].InnerText);
            info.MaxLevel = Convert.ToInt32(elm["MaxLevel"].InnerText);
            info.MinRow   = Convert.ToInt32(elm["MinRow"].InnerText);
            info.MaxRow   = Convert.ToInt32(elm["MaxRow"].InnerText);
            info.MinCol   = Convert.ToInt32(elm["MinCol"].InnerText);
            info.MaxCol   = Convert.ToInt32(elm["MaxCol"].InnerText);

            info.outFormat = (LCompressFormat)Convert.ToInt32(elm["Format"].InnerText);

            info.Region.MinLon = Convert.ToDouble(elm["MinLon"].InnerText);
            info.Region.MaxLon = Convert.ToDouble(elm["MaxLon"].InnerText);
            info.Region.MinLat = Convert.ToDouble(elm["MinLat"].InnerText);
            info.Region.MaxLat = Convert.ToDouble(elm["MaxLat"].InnerText);
        }
Ejemplo n.º 2
0
        public override string Open(string path)
        {
            filepath = path;
            string url = "";

            url = System.Configuration.ConfigurationManager.AppSettings["URL"];
            url = string.Format("http://{0}/ImageServer/GetImageInfo.ashx?name={1}", url, filepath);

            GGeoImageInfo info = new GGeoImageInfo();

            try
            {
                GetInfo(url, out info);
            }
            catch (Exception)
            {
                // throw "error";
                return("wrong");
            }
            MinLevel = info.MinLevel;
            MaxLevel = info.MaxLevel;

            MinRow    = info.MinRow;
            MaxRow    = info.MaxRow;
            MinCol    = info.MinCol;
            MaxCol    = info.MaxCol;
            outFormat = info.outFormat;
            _region   = info.Region;

            this.CFormat = outFormat;

            CurGeoRegion = _region;
            return("");
        }
Ejemplo n.º 3
0
        public virtual string Open(string path)
        {
            try
            {
                fs = File.Open(path, FileMode.Open, FileAccess.Read, FileShare.Read);
                br = new BinaryReader(fs);

                MinLevel = br.ReadInt32();
                MaxLevel = br.ReadInt32();

                MinRow         = br.ReadInt32();
                MaxRow         = br.ReadInt32();
                MinCol         = br.ReadInt32();
                MaxCol         = br.ReadInt32();
                outFormat      = (LCompressFormat)(br.ReadInt32());
                _region        = new GeoRegion();
                _region.MinLon = br.ReadDouble();
                _region.MaxLon = br.ReadDouble();
                _region.MinLat = br.ReadDouble();
                _region.MaxLat = br.ReadDouble();
                this.CFormat   = outFormat;
                int dt = br.ReadInt32();

                DataType = (LDataType)dt;

                _bitsPerPixel = br.ReadInt32() * 8;
                CurGeoRegion  = _region;

                MinX         = CurGeoRegion.MinLon;
                MaxX         = CurGeoRegion.MaxLon;
                MinY         = CurGeoRegion.MinLat;
                MaxY         = CurGeoRegion.MaxLat;
                _info        = new GGeoImageInfo();
                _info.MaxCol = MaxCol;
                _info.MinCol = MinCol;
                _info.MaxRow = MaxRow;
                _info.MinRow = MinRow;

                _info.MaxLevel  = MaxLevel;
                _info.MinLevel  = MinLevel;
                _info.outFormat = outFormat;
                _info.Region    = CurGeoRegion;
                this.Tag        = _info;
                //ResolutionX =
            }
            catch
            {
                return("wrong");
            }

            return("");
        }