Ejemplo n.º 1
0
 /// <summary>
 /// Adds pattern to the list
 /// </summary>
 internal void AddPattern(MapWinGIS.LinePattern pattern)
 {
     if (pattern != null && pattern.Count > 0)
     {
         _patterns.Add(pattern);
         this.ItemCount = _patterns.Count;
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Draws the next icon from the list
        /// </summary>
        void Control_OnDrawItem(Graphics graphics, RectangleF rect, int itemIndex, bool selected)
        {
            IntPtr ptr = graphics.GetHdc();

            MapWinGIS.LinePattern pattern = _patterns[itemIndex];
            pattern.Draw(ptr.ToInt32(), rect.X + 1.0f, rect.Y + 1.0f, (int)rect.Width - 2, (int)rect.Height - 2, Colors.ColorToUInteger(this.BackColor));
            graphics.ReleaseHdc();
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Adds default patterns to the list
        /// </summary>
        private void AddDefaultPatterns()
        {
            _patterns.Clear();

            MapWinGIS.LinePattern pattern = new MapWinGIS.LinePattern();
            MapWinGIS.Utils       utils   = new MapWinGIS.Utils();
            pattern.AddLine(utils.ColorByName(MapWinGIS.tkMapColor.Red), 1, MapWinGIS.tkDashStyle.dsSolid);
            _patterns.Add(pattern);

            // TODO: mode patterns can be added

            this.ItemCount = _patterns.Count;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Loads all the icons form the current path
        /// </summary>
        /// <param name="path"></param>
        public void LoadFromXML()
        {
            _patterns.Clear();

            XmlDocument xmlDoc   = new XmlDocument();
            string      filename = this.get_FileName();

            // reading from the file
            if (System.IO.File.Exists(filename))
            {
                xmlDoc.Load(filename);

                XmlElement xelSchemes = xmlDoc.DocumentElement["LinePatters"];
                if (xelSchemes != null)
                {
                    foreach (XmlNode nodePatter in xelSchemes.ChildNodes)
                    {
                        MapWinGIS.LinePattern pattern = new MapWinGIS.LinePattern();
                        pattern.Deserialize(nodePatter.InnerText);
                        if (pattern.Count > 0)
                        {
                            _patterns.Add(pattern);
                        }
                    }
                }
            }

            // load some default ones if none were loaded
            if (_patterns.Count == 0)
            {
                this.AddDefaultPatterns();
            }

            this.ItemCount = _patterns.Count;

            if (this.ItemCount > 0)
            {
                this.SelectedIndex = 0;
            }
        }