Example #1
0
        private void ParseOptions(int width, int height, object[] options, out ISpatialReference spatialRef, out CoordEnvelope coordEnvelope, out HdrMapInfo mapInfo,
                                  out bool isWithHdr, out int extHeaderSize)
        {
            mapInfo       = null;
            spatialRef    = null;
            coordEnvelope = null;
            isWithHdr     = true;
            extHeaderSize = 0;
            if (options == null || options.Length == 0)
            {
                return;
            }
            foreach (object option in options)
            {
                string param = option.ToString();
                int    k     = param.IndexOf('=');
                string key   = param.Substring(0, k).ToUpper().Trim();
                string value = param.Substring(k + 1).ToUpper().Trim();
                switch (key.ToUpper())
                {
                case "SPATIALREF":
                    spatialRef = SpatialReferenceFactory.GetSpatialReferenceByProj4String(value);
                    break;

                case "MAPINFO":
                    mapInfo       = ParseMapInfoFromOptionValue(value);
                    coordEnvelope = CoordEnvelope.FromMapInfoString(value, new Size(width, height));
                    break;

                case "WITHHDR":
                    isWithHdr = value.ToUpper() == "TRUE" || value == "1";
                    break;

                case "EXTHEADERSIZE":
                    extHeaderSize = int.Parse(value);
                    break;

                default:
                    break;
                }
            }
        }