コード例 #1
0
        public int ReadFrom(byte[] Buffer, int StartIndex = 0)
        {
            int cursor = StartIndex;

            Width   = BitConverter.ToUInt32(Buffer, cursor);
            cursor += TypeSizes.INT;

            Height  = BitConverter.ToUInt32(Buffer, cursor);
            cursor += TypeSizes.INT;

            XOffset = BitConverter.ToInt32(Buffer, cursor);
            cursor += TypeSizes.INT;

            YOffset = BitConverter.ToInt32(Buffer, cursor);
            cursor += TypeSizes.INT;

            byte HotSpotCount = Buffer[cursor];

            cursor++;

            HotSpots.Clear();
            HotSpots.Capacity = HotSpotCount;
            for (int i = 0; i < HotSpotCount; i++)
            {
                BgfBitmapHotspot hotspot = new BgfBitmapHotspot(Buffer, cursor);
                cursor += hotspot.ByteLength;

                HotSpots.Add(hotspot);
            }

            isCompressed = BitConverter.ToBoolean(Buffer, cursor);
            cursor++;

            CompressedLength = BitConverter.ToInt32(Buffer, cursor);
            cursor          += TypeSizes.INT;

            if (IsCompressed)
            {
                PixelData = new byte[CompressedLength];
                Array.Copy(Buffer, cursor, PixelData, 0, CompressedLength);
                cursor += CompressedLength;
            }
            else
            {
                PixelData = new byte[UncompressedLength];
                Array.Copy(Buffer, cursor, PixelData, 0, UncompressedLength);
                cursor += UncompressedLength;
            }
            return(ByteLength);
        }
コード例 #2
0
        protected void loadCountiesHotSpots()
        {
            HotSpots.Clear();

            string hotSpotsXml = Page.ClientScript.GetWebResourceUrl(this.GetType(), "HotSpotMapNorway.HotSpots.xml");

            hotSpotsXml = GetAbsolutePath(hotSpotsXml);

            XmlDocument hotSpots = new XmlDocument();

            hotSpots.Load(hotSpotsXml);

            XmlNodeList nodes = hotSpots.SelectNodes("//county");

            foreach (XmlElement node in nodes)
            {
                PolygonHotSpot phs = new PolygonHotSpot();
                phs.PostBackValue = "1:" + node.GetAttribute("name");
                phs.Coordinates   = node.FirstChild.InnerText;
                HotSpots.Add(phs);
            }
        }