Пример #1
0
        private void AddNDVISetting(NDVISettingItem item)
        {
            RadTreeNode node = new RadTreeNode(item.Name);

            node.Tag = item;
            _tree.Nodes.Add(node);
            _settingList.Add(item);
        }
Пример #2
0
        private void txtAvgMax_Leave(object sender, EventArgs e)
        {
            float avgMax;

            if (float.TryParse(txtAvgMax.Text, out avgMax))
            {
                if (_tree.SelectedNode != null && _tree.SelectedNode.Tag != null)
                {
                    NDVISettingItem item = _tree.SelectedNode.Tag as NDVISettingItem;
                    item.MaxValue = avgMax;
                }
            }
        }
Пример #3
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            RadTreeNode node = _tree.SelectedNode;

            if (node == null)
            {
                return;
            }
            NDVISettingItem item = node.Tag as NDVISettingItem;

            _settingList.Remove(item);
            _tree.Nodes.Remove(node);
        }
Пример #4
0
        private void txtMaxLat_Leave(object sender, EventArgs e)
        {
            double maxLat;

            if (double.TryParse(txtMaxLat.Text, out maxLat))
            {
                if (_tree.SelectedNode != null && _tree.SelectedNode.Tag != null)
                {
                    NDVISettingItem item   = _tree.SelectedNode.Tag as NDVISettingItem;
                    double          minLat = item.Envelope.MinY;
                    double          minLon = item.Envelope.MinX;
                    double          maxLon = item.Envelope.MaxX;
                    item.Envelope = new RSS.Core.DF.CoordEnvelope(minLon, maxLon, minLat, maxLat);
                }
            }
        }
Пример #5
0
        private void btnAddRegion_Click(object sender, EventArgs e)
        {
            errorProvider1.Clear();
            string name = txtName.Text;
            double minx = txtMinLon.Value;
            double maxx = txtMaxLon.Value;
            double miny = txtMinLat.Value;
            double maxy = txtMaxLat.Value;

            RSS.Core.DF.CoordEnvelope env = new RSS.Core.DF.CoordEnvelope(minx, maxx, miny, maxy);
            if (string.IsNullOrWhiteSpace(name))
            {
                errorProvider1.SetError(txtName, "名字不能为空");
                return;
            }
            if (env == null || env.Width <= 0 || env.Height <= 0 ||
                env.MinX < -180 || env.MaxX > 180 ||
                env.MinY < -90 || env.MaxY > 90)
            {
                errorProvider1.SetError(panel2, "范围不合法");
                return;
            }
            if (ContainItem(name))
            {
                errorProvider1.SetError(txtName, "已经含有该名字的范围定义");
                return;
            }
            float minValue;

            if (float.TryParse(txtAvgMin.Text, out minValue))
            {
                errorProvider1.SetError(txtAvgMin, "未指定最小端元值");
            }
            float maxValue;

            if (float.TryParse(txtAvgMax.Text, out maxValue))
            {
                errorProvider1.SetError(txtAvgMin, "未指定最大端元值");
            }
            NDVISettingItem item = new NDVISettingItem();

            item.Envelope = env;
            item.Name     = name;
            item.MinValue = minValue;
            item.MaxValue = maxValue;
            AddNDVISetting(item);
        }
Пример #6
0
        private void ParseDefaultValue(XElement valueElement)
        {
            if (_settingItemList != null)
            {
                _settingItemList.Clear();
            }
            IEnumerable <XElement> items = valueElement.Elements("ValueItem");

            if (items == null || items.Count() < 1)
            {
                return;
            }
            XElement ele;

            for (int i = 0; i < items.Count(); i++)
            {
                ele = items.ElementAt(i);
                if (ele == null)
                {
                    continue;
                }
                NDVISettingItem item = new NDVISettingItem();
                item.Name = ele.Attribute("name").Value;
                float value;
                if (float.TryParse(ele.Attribute("minvalue").Value, out value))
                {
                    item.MinValue = value;
                }
                if (float.TryParse(ele.Attribute("maxvalue").Value, out value))
                {
                    item.MaxValue = value;
                }
                bool isUse;
                if (bool.TryParse(ele.Attribute("isuse").Value, out isUse))
                {
                    item.IsUse = isUse;
                }
                string envelope = ele.Attribute("envelope").Value;
                item.Envelope = ParseEnvelope(envelope);
                _settingItemList.Add(item);
            }
        }
Пример #7
0
 void _tree_SelectedNodeChanged(object sender, RadTreeViewEventArgs e)
 {
     if (_tree.SelectedNode != null)
     {
         if (_tree.SelectedNode.Tag != null)
         {
             NDVISettingItem item = _tree.SelectedNode.Tag as NDVISettingItem;
             if (item != null)
             {
                 txtName.Text   = item.Name;
                 txtAvgMax.Text = item.MaxValue.ToString();
                 txtAvgMin.Text = item.MinValue.ToString();
                 txtMinLon.Text = item.Envelope.MinX.ToString();
                 txtMaxLon.Text = item.Envelope.MaxX.ToString();
                 txtMinLat.Text = item.Envelope.MinY.ToString();
                 txtMaxLat.Text = item.Envelope.MaxY.ToString();
             }
         }
     }
 }
Пример #8
0
        public object ParseArgumentValue(System.Xml.Linq.XElement ele)
        {
            //<DefaultValue>
            //   <ValueItem name="太湖" envelope="" minvalue="" maxvalue="" isuse="false"/>
            //   <ValueItem name="巢湖" envelope="" minvalue="" maxvalue="" isuse="false"/>
            //   <ValueItem name="滇池" envelope="" minvalue="" maxvalue="" isuse="false"/>
            //</DefaultValue>
            IEnumerable <XElement> nodes    = ele.Elements("ValueItem");
            List <NDVISettingItem> settings = new List <NDVISettingItem>();

            if (nodes != null && nodes.Count() != 0)
            {
                foreach (XElement item in nodes)
                {
                    bool  isUse;
                    float minvalue, maxvalue;
                    if (bool.TryParse(item.Attribute("isuse").Value, out isUse))
                    {
                        if (!isUse)
                        {
                            return(null);
                        }
                        else
                        {
                            NDVISettingItem settingItem = new NDVISettingItem();
                            settingItem.IsUse = true;
                            settingItem.Name  = item.Attribute("name").Value;
                            if (float.TryParse(item.Attribute("minvalue").Value, out minvalue) &&
                                float.TryParse(item.Attribute("maxvalue").Value, out maxvalue))
                            {
                                settingItem.MaxValue = minvalue;
                                settingItem.MinValue = maxvalue;
                                //解析envelope
                                string   envelopeStr = item.Attribute("envelope").Value;
                                string[] strArray    = envelopeStr.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                                if (strArray == null || strArray.Length != 4)
                                {
                                    continue;
                                }
                                CoordEnvelope envelope = new CoordEnvelope(double.Parse(strArray[0]), double.Parse(strArray[1]),
                                                                           double.Parse(strArray[2]), double.Parse(strArray[3]));
                                settingItem.Envelope = envelope;
                                settings.Add(settingItem);
                            }
                            else
                            {
                                continue;
                            }
                        }
                    }
                }
                if (settings != null && settings.Count > 0)
                {
                    _settingItems = settings.ToArray();
                }
                if (_handler != null)
                {
                    _handler(GetArgumentValue());
                }
            }
            return(null);
        }