public void DeleteActiveFeature()
        {
            FeatureLabel temp = activeFeature;

            ResetActiveFeature();
            features.Remove(temp);
        }
        public FeatureLabel CreateLabel()
        {
            FeatureLabel label = new FeatureLabel();

            label.id = this.prefix + counter.ToString();

            return(label);
        }
        public void AddLabel(FeatureLabel label)
        {
            if (false == IsLabelInList(label.id))
            {
                features.Add(label);
            }

            counter++;
        }
 public bool FindActiveFeature(int x, int y)
 {
     for (int i = 0; i < features.Count; i++)
     {
         if (true == features[i].Contains(x, y))
         {
             activeFeature = features[i];
             return(true);
         }
     }
     return(false);
 }
 public void ResetActiveFeature()
 {
     activeFeature = null;
 }
        public void LoadFromString(string input)
        {
            try
            {
                using (StringReader sr = new StringReader(input))
                {
                    XmlTextReader xtr = new XmlTextReader(sr);

                    this.features.Clear();

                    do
                    {
                        xtr.Read();

                        if (xtr.NodeType == XmlNodeType.None)
                        {
                            return;
                        }
                    }while (!(xtr.NodeType == XmlNodeType.Element && xtr.Name == "Feature"));


                    while ((xtr.NodeType == XmlNodeType.Element && xtr.Name == "Feature"))
                    {
                        FeatureLabel label = new FeatureLabel();

                        label.id   = xtr.GetAttribute("ID");
                        label.name = xtr.GetAttribute("Name");
                        label.type = label.ReadType(xtr.GetAttribute("Type"));
                        label.pos  = label.ReadPoint(xtr.GetAttribute("Pos"));

                        this.features.Add(label);

                        xtr.Read();

                        while (!(xtr.NodeType == XmlNodeType.Element && xtr.Name == "Feature") &&
                               !(xtr.NodeType == XmlNodeType.EndElement && xtr.Name == "features"))
                        {
                            xtr.Read();
                            if (xtr.ReadState == ReadState.EndOfFile)
                            {
                                return;
                            }
                        }

                        /*
                         * if (xtr.NodeType != XmlNodeType.None)
                         * {
                         *  xtr.Read();
                         *  if (xtr.ReadState == ReadState.EndOfFile)
                         *  {
                         *      return;
                         *  }
                         * }
                         */
                    }
                }
            }
            catch (System.Exception ex)
            {
                throw ex;
            }
        }