public IGPDataType GetDataType(string Name) { IGPDataType returnGPDataType = null; // attempt to read the cached versions first switch (Name) { case "HttpBasicAuthenticationDataType": if (m_DataTypes.ContainsKey(Name)) { returnGPDataType = m_DataTypes[Name]; } break; default: break; } // if nothing had been previously cached create the data type now if (returnGPDataType == null) { returnGPDataType = CreateDataType(Name); m_DataTypes.Add(Name, returnGPDataType); } return(returnGPDataType); }
/// <summary> /// Constructs the value table used for the /// </summary> /// <returns></returns> private IGPValueTableType BuildWhereClauseValueTable() { IGPValueTableType vt = new GPValueTableTypeClass(); IGPDataType type = null; int columnIndex = 0; m_whereClauseIndices.Clear(); // First column: attribute names (based on the selected feature class) type = new FieldTypeClass(); vt.AddDataType(type, Properties.Resources.DESC_ADC_VT_ATTRIBUTE, 150, null); m_whereClauseIndices.Add(C_ID_VT_ATTRIBUTE, columnIndex++); // Second column: comparison operators (fixed, based on what Workflow Manager supports) type = new GPStringTypeClass(); vt.AddDataType(type, Properties.Resources.DESC_ADC_VT_OPERATOR, 50, null); m_whereClauseIndices.Add(C_ID_VT_OPERATOR, columnIndex++); // Third column: values (based on the selected attribute) type = new GPStringTypeClass(); vt.AddDataType(type, Properties.Resources.DESC_ADC_VT_VALUE, 150, null); m_whereClauseIndices.Add(C_ID_VT_VALUE, columnIndex++); return(vt); }
/// <summary> /// Helper function to assemble the parameter objects for the GP tool /// </summary> /// <param name="dir"> /// The "direction" of the parameter (input, output, ...); one of the /// esriGPParameterDirection enum values</param> /// <param name="paramType">One of the esriGPParameterType enum values</param> /// <param name="dispName">The name of the parameter displayed to the user</param> /// <param name="name">The internal name of the parameter</param> /// <param name="dataType">The type of data stored by the parameter</param> /// <param name="value">The initial value of the parameter</param> /// <param name="domainDependsOnWmxDb"> /// Specifying true will cause the parameter's domain to be set to null when /// the selected Workflow Manager database changes; false will leave the domain /// unchanged. /// </param> /// <returns>The GP parameter object that was created</returns> protected IGPParameterEdit3 BuildParameter( esriGPParameterDirection dir, esriGPParameterType paramType, string dispName, string name, IGPDataType dataType, IGPValue value, bool domainDependsOnWmxDb) { IGPParameterEdit3 param = new GPParameterClass(); param.Direction = dir; param.ParameterType = paramType; param.Enabled = true; param.DisplayName = dispName; param.Name = name; param.DataType = dataType; if (value == null) { param.Value = dataType.CreateValue(string.Empty); } else { param.Value = value; } if (domainDependsOnWmxDb) { m_dependentParamNames.Add(name); } return(param); }
/// <summary> /// Helper function to assemble the parameter objects for the GP tool. Assumes /// that the parameter's domain is not dependent on the chosen Workflow Manager /// database. /// </summary> /// <param name="dir"> /// The "direction" of the parameter (input, output, ...); one of the /// esriGPParameterDirection enum values</param> /// <param name="paramType">One of the esriGPParameterType enum values</param> /// <param name="dispName">The name of the parameter displayed to the user</param> /// <param name="name">The internal name of the parameter</param> /// <param name="dataType">The type of data stored by the parameter</param> /// <param name="value">The initial value of the parameter</param> /// <returns>The GP parameter object that was created</returns> protected IGPParameterEdit3 BuildParameter( esriGPParameterDirection dir, esriGPParameterType paramType, string dispName, string name, IGPDataType dataType, IGPValue value) { return(BuildParameter(dir, paramType, dispName, name, dataType, value, false)); }
/// <summary> /// Provides the data type object given the name. /// </summary> /// <param name="Name"></param> /// <returns></returns> public IGPDataType GetDataType(string Name) { IGPDataType dataType = null; switch (Name) { case "GPAutoValueDataType": dataType = new GPAutoValueType <TValue>(); break; } return(dataType); }
/// <summary> /// Validates the type of the data. /// </summary> /// <param name="type">The type.</param> /// <returns></returns> public IGPMessage ValidateDataType(IGPDataType type) { IGPMessage message = new GPMessageClass(); IGPAutoValueType targetType = type as IGPAutoValueType; if (targetType == null) { message.ErrorCode = 501; message.Type = esriGPMessageType.esriGPMessageTypeError; message.Description = @"The value is not an auto value."; } return(message); }
public static IGPParameterEdit CreateParameterEdit(string name, string displayName, esriGPParameterDirection paramDirection, esriGPParameterType paramType, IGPDataType gpDataType, bool enabled) { IGPParameterEdit parameterEdit = new GPParameterClass(); parameterEdit.DataType = gpDataType; parameterEdit.Value = gpDataType.CreateValue(""); parameterEdit.ParameterType = paramType; parameterEdit.Direction = paramDirection; parameterEdit.DisplayName = displayName; parameterEdit.Name = name; parameterEdit.Enabled = enabled; return parameterEdit; }
private IGPDataType CreateDataType(string Name) { IGPDataType createdDataType = null; switch (Name) { case "HttpBasicAuthenticationDataType": createdDataType = new HttpBasicDataType() as IGPDataType; break; default: break; } return(createdDataType); }
private IGPParameter CreateParameter(IGPDataType dataType, IGPValue value, esriGPParameterDirection direction, string displayName, string name, esriGPParameterType parameterType) { // Area field parameter IGPParameterEdit3 inputParameter = new GPParameterClass(); inputParameter.DataType = dataType; inputParameter.Value = value; // Set field name parameter properties inputParameter.Direction = direction; inputParameter.DisplayName = displayName; inputParameter.Name = name; inputParameter.ParameterType = parameterType; return((IGPParameter)inputParameter); }
public object Describe(string Name) { string describeReturn = String.Empty; if (Name.Equals(m_xmlElementName)) { describeReturn = "OpenStreetMap Authentication"; } if (Name.Equals("DataType")) { IGPDataType currentDataType = this.DataType; describeReturn = currentDataType.Name; } return(describeReturn); }
public IGPMessage ValidateDataType(IGPDataType Type) { IGPMessage validateDataTypeMessage = new GPMessageClass(); IHttpBasicDataType targetType = Type as IHttpBasicDataType; if (targetType == null) { IGPStringType targetTypeString = Type as IGPStringType; if (targetTypeString != null) { return(validateDataTypeMessage); } } if (targetType == null) { validateDataTypeMessage.ErrorCode = 501; validateDataTypeMessage.Type = esriGPMessageType.esriGPMessageTypeError; validateDataTypeMessage.Description = resourceManager.GetString("GPTools_Authentication_HttpBasicDataType_typevalidation"); } return(validateDataTypeMessage); }
public IGPMessage ValidateDataType(IGPDataType Type) { IGPMessage validateDataTypeMessage = new GPMessageClass(); IHttpBasicDataType targetType = Type as IHttpBasicDataType; if (targetType == null) { IGPStringType targetTypeString = Type as IGPStringType; if (targetTypeString != null) return validateDataTypeMessage; } if (targetType == null) { validateDataTypeMessage.ErrorCode = 501; validateDataTypeMessage.Type = esriGPMessageType.esriGPMessageTypeError; validateDataTypeMessage.Description = resourceManager.GetString("GPTools_Authentication_HttpBasicDataType_typevalidation"); } return validateDataTypeMessage; }
/// <summary> /// Creates a simple parameter. /// </summary> /// <param name="source">The source.</param> /// <param name="name"> /// The name is the language-independent name for the parameter (not localized) and must not contain /// spaces and must be unique within a function. /// </param> /// <param name="displayName"> /// The display name is the localized name (as it appears in the dialog) and is contained in /// resource string. /// </param> /// <param name="category"> /// The category for the parameter in the tool dialog. Parameters that belong to the same category /// are listed in a text box that is expandable and collapsible in the tool dialog box. /// </param> /// <param name="parameterType">Type of the parameter.</param> /// <param name="parameterDirection">The parameter direction.</param> /// <param name="dataType">Type of the data.</param> /// <returns> /// Returns a <see cref="IGPParameterEdit3" /> representing the parameter. /// </returns> public static IGPParameterEdit3 CreateParameter(this IGPFunction source, string name, string displayName, string category, esriGPParameterType parameterType, esriGPParameterDirection parameterDirection, IGPDataType dataType) { var parameter = source.CreateParameter(name, displayName, parameterType, parameterDirection, dataType); parameter.Category = category; return(parameter); }
/// <summary> /// Creates a simple parameter. /// </summary> /// <param name="source">The source.</param> /// <param name="name"> /// The name is the language-independent name for the parameter (not localized) and must not contain /// spaces and must be unique within a function. /// </param> /// <param name="displayName"> /// The display name is the localized name (as it appears in the dialog) and is contained in /// resource string. /// </param> /// <param name="parameterType">Type of the parameter.</param> /// <param name="parameterDirection">The parameter direction.</param> /// <param name="dataType">Type of the data.</param> /// <returns> /// Returns a <see cref="IGPParameterEdit3" /> representing the parameter. /// </returns> public static IGPParameterEdit3 CreateParameter(this IGPFunction source, string name, string displayName, esriGPParameterType parameterType, esriGPParameterDirection parameterDirection, IGPDataType dataType) { return(new GPParameterClass { IGPParameterEdit3_DataType = dataType, IGPParameterEdit3_DisplayName = displayName, IGPParameterEdit3_Name = name, IGPParameterEdit3_ParameterType = parameterType, IGPParameterEdit3_Direction = parameterDirection }); }
/// <summary> /// Creates the a coded value domain an assigns it to the parameter. /// </summary> /// <param name="source">The source.</param> /// <param name="name"> /// The name is the language-independent name for the parameter (not localized) and must not contain /// spaces and must be unique within a function. /// </param> /// <param name="displayName"> /// The display name is the localized name (as it appears in the dialog) and is contained in /// resource string. /// </param> /// <param name="parameterType">Type of the parameter.</param> /// <param name="parameterDirection">The parameter direction.</param> /// <param name="values">The values (strings) for the domain.</param> /// <param name="names">The names (strings) for the domain.</param> /// <param name="dataType">Type of the data.</param> /// <returns> /// Returns a <see cref="IGPParameterEdit3" /> representing the parameter. /// </returns> /// <exception cref="System.ArgumentNullException"> /// values /// or /// names /// </exception> /// <exception cref="System.ArgumentOutOfRangeException"> /// values;The values and names arrays must contain the same number of /// elements. /// </exception> public static IGPParameterEdit3 CreateParameter(this IGPFunction source, string name, string displayName, esriGPParameterType parameterType, esriGPParameterDirection parameterDirection, object[] values, object[] names, IGPDataType dataType) { if (values == null) { throw new ArgumentNullException("values"); } if (names == null) { throw new ArgumentNullException("names"); } if (values.Length != names.Length) { throw new ArgumentOutOfRangeException("values", "The values and names arrays must contain the same number of elements."); } IGPCodedValueDomain codedValueDomain = new GPCodedValueDomainClass(); for (int i = 0; i < values.Length; i++) { codedValueDomain.AddStringCode(values[i].ToString(), names[i].ToString()); } var parameter = source.CreateParameter(name, displayName, parameterType, parameterDirection, dataType); parameter.Domain = codedValueDomain as IGPDomain; return(parameter); }
/// <summary> /// Creates a parameter that supports multiple inputs of the same data type. /// </summary> /// <param name="source">The source.</param> /// <param name="name"> /// The name is the language-independent name for the parameter (not localized) and must not contain /// spaces and must be unique within a function. /// </param> /// <param name="displayName"> /// The display name is the localized name (as it appears in the dialog) and is contained in /// resource string. /// </param> /// <param name="parameterType">Type of the parameter.</param> /// <param name="parameterDirection">The parameter direction.</param> /// <param name="dataType">Type of the data.</param> /// <param name="control">The ActiveX control should that should be used to display the contents.</param> /// <returns> /// Returns a <see cref="IGPParameterEdit3" /> representing the parameter. /// </returns> public static IGPParameterEdit3 CreateMultiValueParameter(this IGPFunction source, string name, string displayName, esriGPParameterType parameterType, esriGPParameterDirection parameterDirection, IGPDataType dataType, UID control) { var multiValueType = new GPMultiValueTypeClass(); multiValueType.MemberDataType = dataType; IGPParameterEdit3 parameter = new GPParameterClass { IGPParameterEdit3_DataType = multiValueType, IGPParameterEdit3_DisplayName = displayName, IGPParameterEdit3_Name = name, IGPParameterEdit3_ParameterType = parameterType, IGPParameterEdit3_Direction = parameterDirection, IGPParameterEdit3_ControlCLSID = control }; return(parameter); }
/// <summary> /// Creates a parameter that supports multiple inputs of the same data type. /// </summary> /// <param name="source">The source.</param> /// <param name="name"> /// The name is the language-independent name for the parameter (not localized) and must not contain /// spaces and must be unique within a function. /// </param> /// <param name="displayName"> /// The display name is the localized name (as it appears in the dialog) and is contained in /// resource string. /// </param> /// <param name="parameterType">Type of the parameter.</param> /// <param name="parameterDirection">The parameter direction.</param> /// <param name="dataType">Type of the data.</param> /// <param name="checkBoxes"> /// if set to <c>true</c> if the values should be displayed in a list box with check boxes (the /// values are driven by the Domain). /// </param> /// <returns> /// Returns a <see cref="IGPParameterEdit3" /> representing the parameter. /// </returns> public static IGPParameterEdit3 CreateMultiValueParameter(this IGPFunction source, string name, string displayName, esriGPParameterType parameterType, esriGPParameterDirection parameterDirection, IGPDataType dataType, bool checkBoxes) { var multiValueType = new GPMultiValueTypeClass(); multiValueType.MemberDataType = dataType; IGPParameterEdit3 parameter = new GPParameterClass { IGPParameterEdit3_DataType = multiValueType, IGPParameterEdit3_DisplayName = displayName, IGPParameterEdit3_Name = name, IGPParameterEdit3_ParameterType = parameterType, IGPParameterEdit3_Direction = parameterDirection, IGPParameterEdit3_ControlCLSID = (checkBoxes) ? new UIDClass { Value = "{38C34610-C7F7-11D5-A693-0008C711C8C1}" } : null }; return(parameter); }
private IGPParameter CreateParameter(IGPDataType dataType, IGPValue value, esriGPParameterDirection direction, string displayName, string name, esriGPParameterType parameterType) { // Area field parameter IGPParameterEdit3 inputParameter = new GPParameterClass(); inputParameter.DataType = dataType; inputParameter.Value = value; // Set field name parameter properties inputParameter.Direction = direction; inputParameter.DisplayName = displayName; inputParameter.Name = name; inputParameter.ParameterType = parameterType; return (IGPParameter)inputParameter; }