Example #1
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 other Parameter default values.
 /// </summary>
 void ITool.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;
         }
     }
 }
 /// <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>
 void ITool.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;
 }
 /// <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>
 void ITool.ParameterChanged(Parameter sender)
 {
     return;
 }
 /// <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>
 void ITool.ParameterChanged(Parameter sender)
 {
     if (sender == _inputParam[0])
     {
         _inputParam[1].Value = 255;
         _inputParam[2].Value = 255;
     }
 }
 /// <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>
 void ITool.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;
 }
 /// <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(Param.Parameter Parameter, List<ModelElement> modelElements) : base(modelElements)
 {
     _parameter = Parameter;
 }
 /// <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>
 void ITool.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;
 }
 /// <summary>
 /// Fires whenever the 
 /// </summary>
 /// <param name="sender"></param>
 protected virtual void ParamValueChanged(Parameter sender)
 {
     Refresh();
 }
Example #9
0
        public void ParameterChanged(Parameter sender)
        {

        }
Example #10
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));
 }
Example #11
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);
     de.Color = _dataColor;
     de.Font = _dataFont;
     de.Shape = _dataShape;
     if (par.ModelName != "")
         de.Name = par.ModelName;
     else
         de.Name = par.Name;
     AddElement(de, location);
     par.ModelName = de.Name;
     return de;
 }
Example #12
0
 /// <summary>
 /// Creates a default output locations for tools.
 /// </summary>
 /// <param name="par"></param>
 public void GenerateDefaultOutput(Parameter par)
 {
     Data.IFeatureSet addedFeatureSet;
     switch (par.ParamType)
     {
         case "MapWindow FeatureSet Param":
             addedFeatureSet = new Data.Shapefile();
             addedFeatureSet.Filename = System.IO.Path.GetDirectoryName(_toolManager.TempPath) + System.IO.Path.DirectorySeparatorChar + par.ModelName + ".shp";
             par.Value = addedFeatureSet;
             break;
         case "MapWindow LineFeatureSet Param":
             addedFeatureSet = new Data.LineShapefile();
             addedFeatureSet.Filename = System.IO.Path.GetDirectoryName(_toolManager.TempPath) + System.IO.Path.DirectorySeparatorChar + par.ModelName + ".shp";
             par.Value = addedFeatureSet;
             break;
         case "MapWindow PointFeatureSet Param":
             addedFeatureSet = new Data.PointShapefile();
             addedFeatureSet.Filename = System.IO.Path.GetDirectoryName(_toolManager.TempPath) + System.IO.Path.DirectorySeparatorChar + par.ModelName + ".shp";
             par.Value = addedFeatureSet;
             break;
         case "MapWindow PolygonFeatureSet Param":
             addedFeatureSet = new Data.PolygonShapefile();
             addedFeatureSet.Filename = System.IO.Path.GetDirectoryName(_toolManager.TempPath) + System.IO.Path.DirectorySeparatorChar + par.ModelName + ".shp";
             par.Value = addedFeatureSet;
             break;
         case "MapWindow Raster Param":
             break;
         default:
             par.GenerateDefaultOutput(_toolManager.TempPath);
             break;
     }
 }
 /// <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>
 void ITool.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;
     }
 }
 /// <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>
 void ITool.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();
 }
 /// <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>
 void ITool.ParameterChanged(Parameter sender)
 {
     //This will Diplay NoDataValue(Already exisit) in the Optional input box;
     if (sender == _inputParam[0])
     {
         try
         {
             if ((_inputParam[0] as RasterParam).Value != null)
             {
                 (_inputParam[1] as DoubleParam).Min = (_inputParam[0] as RasterParam).Value.Minimum;
                 (_inputParam[1] as DoubleParam).Max = (_inputParam[0] as RasterParam).Value.Maximum;
             }
         }
         catch
         { }
     }
 }
Example #16
0
 /// <summary>
 /// Fires when a parameter is changed
 /// </summary>
 /// <param name="sender"></param>
 private void param_ValueChanged(Parameter sender)
 {
     _tool.ParameterChanged(sender);
 }