Exemplo n.º 1
0
 /// <inheritdoc/>
 protected override void ParamValueChanged(Parameter sender)
 {
     if (Param == null) return;
     if (Param.Value == null)
     {
         lblProjection.Text = string.Empty;
         return;
     }
     lblProjection.Text = Param.Value.ToProj4String();
 }
Exemplo n.º 2
0
 protected override void ParamValueChanged(Parameter sender)
 {
     if (Param == null) return;
     if (Param.Value == null)
     {
         lblExtent.Text = string.Empty;
         return;
     }
     lblExtent.Text = Param.Value.ToString();
     base.ParamValueChanged(sender);
 }
Exemplo n.º 3
0
 /// <summary>
 /// Fires when one of the paramters value has beend changed, usually when a user changes a input or output parameters value, this can be used to populate other parameters default values.
 /// </summary>
 /// <param name="sender"></param>
 public virtual void ParameterChanged(Parameter sender) { }
        /// <summary>
        /// Fires when one of the paramters value has beend changed, usually when a user changes a input or output Parameter value, this can be used to populate other Parameter default values.
        /// </summary>
        public override void ParameterChanged(Parameter sender)
        {
            if (sender == _inputParam[0])
            {
                FeatureSet fs = _inputParam[0].Value as FeatureSet;
                ListParam lp = _inputParam[1] as ListParam;
                if (fs != null && lp != null)
                {
                    lp.ValueList.Clear();
                    for (int i = 0; i < fs.DataTable.Columns.Count; i++)
                    {
                        lp.ValueList.Add(fs.DataTable.Columns[i].ColumnName);
                    }

                    lp.Value = -1;
                }
            }
        }
Exemplo n.º 5
0
 /// <summary>
 /// Fires when one of the parameters value has been changed, usually when a user changes a input or
 /// output Parameter value, this can be used to populate input2 Parameter default values.
 /// </summary>
 public override void ParameterChanged(Parameter sender)
 {
     return;
 }
Exemplo n.º 6
0
 /// <summary>
 /// Creates an instance of the Data Element
 /// <param name="parameter">One of Brian's Parameter classes</param>
 /// <param name="modelElements">A list of all the elements in the model</param>
 /// </summary>
 public DataElement(Parameter parameter, List<ModelElement> modelElements)
     : base(modelElements)
 {
     _parameter = parameter;
 }
Exemplo n.º 7
0
 /// <summary>
 /// Adds a data element to the modeler
 /// </summary>
 /// <param name="par">The data set to add to the modeler</param>
 /// <param name="location">A point representing the virtual location of the data element</param>
 /// <param name="name">The name to give the element</param>
 private DataElement AddData(Parameter par, Point location, string name)
 {
     DataElement de = new DataElement(par, _modelElements)
                          {
                              Color = _dataColor,
                              Font = _dataFont,
                              Shape = _dataShape,
                              Name = name
                          };
     de.Name = par.ModelName != string.Empty ? par.ModelName : par.Name;
     AddElement(de, location);
     par.ModelName = de.Name;
     return de;
 }
Exemplo n.º 8
0
 /// <summary>
 /// Adds a data element to the modeler based on a parameter descrition
 /// </summary>
 /// <param name="par">The parameter to add to the modeler</param>
 /// <param name="location">A point representing the virtual location of the element</param>
 private DataElement AddData(Parameter par, Point location)
 {
     return (AddData(par, location, par.Name));
 }
Exemplo n.º 9
0
 /// <summary>
 /// Creates a default output locations for tools.
 /// </summary>
 /// <param name="par"></param>
 public void GenerateDefaultOutput(Parameter par)
 {
     IFeatureSet addedFeatureSet;
     switch (par.ParamType)
     {
         case "DotSpatial FeatureSet Param":
             addedFeatureSet = new Shapefile
                                   {
                                       Filename =
                                           Path.GetTempPath() +
                                           Path.DirectorySeparatorChar + par.ModelName + ".shp"
                                   };
             par.Value = addedFeatureSet;
             break;
         case "DotSpatial LineFeatureSet Param":
             addedFeatureSet = new LineShapefile
                                   {
                                       Filename =
                                           Path.GetTempPath() +
                                           Path.DirectorySeparatorChar + par.ModelName + ".shp"
                                   };
             par.Value = addedFeatureSet;
             break;
         case "DotSpatial PointFeatureSet Param":
             addedFeatureSet = new PointShapefile
                                   {
                                       Filename =
                                           Path.GetTempPath() +
                                           Path.DirectorySeparatorChar + par.ModelName + ".shp"
                                   };
             par.Value = addedFeatureSet;
             break;
         case "DotSpatial PolygonFeatureSet Param":
             addedFeatureSet = new PolygonShapefile
                                   {
                                       Filename =
                                           Path.GetTempPath() +
                                           Path.DirectorySeparatorChar + par.ModelName + ".shp"
                                   };
             par.Value = addedFeatureSet;
             break;
         case "DotSpatial Raster Param":
             break;
         default:
             par.GenerateDefaultOutput(Path.GetTempPath());
             break;
     }
 }
Exemplo n.º 10
0
        /// <summary>
        /// Fires when one of the parameters value has been changed, usually when a user changes a input or output
        /// parameters value, this can be used to populate input2 parameters default values.
        /// </summary>
        public override void ParameterChanged(Parameter sender)
        {
            // This will give the Featureset values to second parameter
            if (sender != _inputParam[0])
            {
                return;
            }

            FeatureSetParam fsp = _inputParam[0] as FeatureSetParam;
            if (fsp == null || fsp.Value == null)
            {
                return;
            }

            _inputParam[1].Value = fsp.Value.Projection;
        }
Exemplo n.º 11
0
        /// <summary>
        /// Fires when one of the paramters value has beend changed, usually when a user changes a input or output Parameter value, this can be used to populate input2 Parameter default values.
        /// </summary>
        public override void ParameterChanged(Parameter sender)
        {
            // This will Diplay NoDataValue(Already exisit) in the Optional input box;
            if (sender != _inputParam[0])
            {
                return;
            }

            IRaster inputTemp = _inputParam[0].Value as IRaster;
            StringParam string1 = _inputParam[1] as StringParam;
            if (string1 != null && inputTemp != null)
            {
                string1.Value = inputTemp.NoDataValue.ToString();
            }
        }
Exemplo n.º 12
0
 /// <summary>
 /// Fires when a parameter is changed
 /// </summary>
 /// <param name="sender"></param>
 private void ParamValueChanged(Parameter sender)
 {
     _tool.ParameterChanged(sender);
 }
Exemplo n.º 13
0
 /// <summary>
 /// Fires whenever the
 /// </summary>
 /// <param name="sender"></param>
 protected virtual void ParamValueChanged(Parameter sender)
 {
     Refresh();
 }
Exemplo n.º 14
0
        /// <summary>
        /// Fires when one of the paramters value has beend changed, usually when a user changes a input or output Parameter value, this can be used to populate input2 Parameter default values.
        /// </summary>
        public override void ParameterChanged(Parameter sender)
        {
            if (sender != _inputParam[0])
            {
                return;
            }

            List<string> fields = new List<string>();
            IFeatureSet fs = _inputParam[0].Value as IFeatureSet;
            if (fs == null)
            {
                return;
            }

            DataTable dt = fs.DataTable;
            if (dt == null)
            {
                return;
            }

            fields.Add("FID [Integer]");
            foreach (DataColumn column in dt.Columns)
            {
                fields.Add(column.ColumnName + " [" + column.DataType.Name + "]");
            }

            ListParam lp = _inputParam[1] as ListParam;
            if (lp == null)
            {
                return;
            }

            lp.ValueList = fields;
            lp.Value = 0;
        }
Exemplo n.º 15
0
        /// <summary>
        /// Fires when one of the paramters value has beend changed, usually when a user changes a input or output parameters value, this can be used to populate input2 parameters default values.
        /// </summary>
        public override void ParameterChanged(Parameter sender)
        {
            // This will give the Featureset values to second parameter
            if (sender != _inputParam[0])
            {
                return;
            }

            FeatureSetParam fsp = _inputParam[0] as FeatureSetParam;
            if (fsp == null || fsp.Value == null)
            {
                return;
            }

            IndexParam ip = _inputParam[1] as IndexParam;
            if (ip != null)
            {
                ip.Fs = fsp.Value as FeatureSet;
            }
        }
Exemplo n.º 16
0
        /// <summary>
        /// Fires when one of the paramters value has beend changed, usually when a user changes a input or output Parameter value, this can be used to populate input2 Parameter default values.
        /// </summary>
        public override void ParameterChanged(Parameter sender)
        {
            // This will Diplay NoDataValue(Already exisit) in the Optional input box;
            if (sender != _inputParam[0])
            {
                return;
            }

            IRaster inputTemp = _inputParam[0].Value as IRaster;
            if (inputTemp == null)
            {
                return;
            }

            DoubleParam inParam1 = _inputParam[1] as DoubleParam;
            if (inParam1 != null)
            {
                inParam1.Value = inputTemp.CellHeight;
            }

            DoubleParam inParam2 = _inputParam[2] as DoubleParam;
            if (inParam2 != null)
            {
                inParam2.Value = inputTemp.CellWidth;
            }
        }