コード例 #1
0
        /// <summary>
        /// Adds a new entry to the drop down list from data provider
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnAddDataClick(object sender, EventArgs e)
        {
            /////////////////////////////////
            //Replace with something that uses the default data provider
            IFeatureSet tempFeatureSet = DataManager.DefaultDataManager.OpenVector();

            //If the feature is null don't do anything the user probably hit cancel on the dialog
            if (tempFeatureSet == null)
            {
                return;
            }

            //Else if the wrong feature type is returned don't add it and indicate whats wrong
            if (tempFeatureSet.FeatureType != FeatureType.Line)
            {
                MessageBox.Show(ModelingMessageStrings.FeatureTypeException);
            }

            //If its good add the feature set and save it
            else
            {
                _addedFeatureSet = new DataSetArray(Path.GetFileNameWithoutExtension(tempFeatureSet.Filename), tempFeatureSet);
                Param.ModelName  = _addedFeatureSet.Name;
                Param.Value      = _addedFeatureSet.DataSet;
            }
        }
コード例 #2
0
        private void btnAddData_Click(object sender, EventArgs e)
        {
            using (OpenFileDialog dialog = new OpenFileDialog())
            {
                dialog.Title = ModelingMessageStrings.OpenFileElement_btnAddDataClick_SelectFileName;
                if (Param == null)
                {
                    Param = new FileParam("open filename");
                }
                FileParam p = Param as FileParam;
                if (p != null)
                {
                    dialog.Filter = p.DialogFilter;
                }

                if (dialog.ShowDialog() == DialogResult.OK)
                {
                    TextFile tmpTextFile = new TextFile(dialog.FileName);
                    _addedTextFile = new DataSetArray(Path.GetFileNameWithoutExtension(dialog.FileName), tmpTextFile);

                    Param.ModelName = _addedTextFile.Name;
                    Param.Value     = _addedTextFile.DataSet;
                    Refresh();
                    base.Status = ToolStatus.Ok;
                }
            }
        }
コード例 #3
0
            //Copy this list into another one.
            public void copyTo(DataSetArray to)
            {
                to.clear();                 //Get rid of old data.
                int count = data.Count;     //Get number of elements in array.

                //Elementwise copy from this list to given list.
                for (int i = 0; i < count; i++)
                {
                    to.add(data[i]);
                }
            }
コード例 #4
0
            //Copy another list into this one.
            public void copyFrom(DataSetArray from)
            {
                data.Clear();               //Get rid of old data.
                int count = from.count();   //Get number of elements in array.

                //Elementwise copy from given list to this list.
                for (int i = 0; i < count; i++)
                {
                    data.Add(from.getDataPoint(i));
                }
            }
コード例 #5
0
 /// <summary>
 /// This fires when the selected value in the combo box is changed
 /// </summary>
 /// <param name="sender">Sender that raised the event.</param>
 /// <param name="e">The event args.</param>
 private void ComboFeatureSelectedValueChanged(object sender, EventArgs e)
 {
     if (_refreshCombo)
     {
         DataSetArray dsa = comboFeatures.SelectedItem as DataSetArray;
         if (dsa != null)
         {
             Param.ModelName = dsa.Name;
             Param.Value     = dsa.DataSet;
         }
     }
 }
コード例 #6
0
        /// <summary>
        /// This changes the color of the light and the tooltip of the light based on the status of the text in the box.
        /// </summary>
        /// <param name="sender">Sender that raised the event.</param>
        /// <param name="e">The event args.</param>
        private void ComboRasterSelectedValueChanged(object sender, EventArgs e)
        {
            if (!_refreshCombo)
            {
                return;
            }
            DataSetArray dsa = comboRaster.SelectedItem as DataSetArray;

            if (dsa == null)
            {
                return;
            }
            Param.ModelName = dsa.Name;
            Param.Value     = dsa.DataSet;
        }
コード例 #7
0
        /// <summary>
        /// Adds a new entry to the drop down list from data provider
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAddData_Click(object sender, EventArgs e)
        {
            //Replace with something that uses the default data provider
            IFeatureSet tempFeatureSet = DataManager.DefaultDataManager.OpenVector();

            //If the feature is null don't do anything the user probably hit cancel on the dialog
            if (tempFeatureSet == null)
            {
                return;
            }

            //If its good add the feature set and save it
            _addedFeatureSet = new DataSetArray(Path.GetFileNameWithoutExtension(tempFeatureSet.Filename), tempFeatureSet);
            Param.ModelName  = _addedFeatureSet.Name;
            Param.Value      = _addedFeatureSet.DataSet;
        }
コード例 #8
0
ファイル: OpenFileElement.cs プロジェクト: osome/DotSpatial
        private void btnAddData_Click(object sender, EventArgs e)
        {
            OpenFileDialog dialog = new OpenFileDialog();
            dialog.Title = "Select File Name";
            if (Param == null) Param = new FileParam("open filename");
            FileParam p = Param as FileParam;
            if (p != null) dialog.Filter = p.DialogFilter;

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                TextFile tmpTextFile = new TextFile(dialog.FileName);
                _addedTextFile = new DataSetArray(Path.GetFileNameWithoutExtension(dialog.FileName), tmpTextFile);

                Param.ModelName = _addedTextFile.Name;
                Param.Value = _addedTextFile.DataSet;
                Refresh();
                base.Status = ToolStatus.Ok;
            }
            else
            {
                return;
            }
        }