zoukankan      html  css  js  c++  java
  • How to use value tables

    http://resources.esri.com/help/9.3/arcgisengine/dotnet/84349562-e062-44ee-8db0-9fcdcd64708b.htm   Using value tables A value table is a flexible object that can be used as input for a multivalue parameter. Examples of multivalue parameter values focus on the text value of the parameter that may become difficult to use when there are numerous values with complex paths. The value table is used to organize the values into a table so values can be easily added or removed, eliminating the complexity of parsing a multivalue text string. The table can be thought of as a virtual matrix of values that is not persisted as an actual table because it is a device for managing many values in a program.  A value table can contain many columns. Each column corresponds to a value in the parameter being defined. Intersect, for example, requires the path to a dataset or a layer name and an optional priority rank for each input entry. A value table for Intersect will require two columns, one for the data and one for the priority rank. The following code example shows how to create and populate a value table for Union. In this example, you need to add a reference to the ESRI.ArcGIS.Geoprocessing assembly to have access to GPValueTableObjectclass.  AddRow's row argument is space delimited. Any value used in the row argument that contains spaces must be enclosed in quotation marks. In the following example, a value table with two columns has a feature class and an index value added; for example, vt.AddRow("'c:/temp/land use.shp' 2"): [C#] using ESRI.ArcGIS.Geoprocessor;using ESRI.ArcGIS.Geoprocessing;using ESRI.ArcGIS.esriSystem;public void ExampleUsingValueTables(Geoprocessor GP){ // Create a value table with two columns. IGpValueTableObject vtobject = new GpValueTableObjectClass(); vtobject.SetColumns(2); // Iterate the enumeration of feature classes and add them to the value table. // In this case, the inputs and ranks are being set for Intersect. GP.SetEnvironmentValue("workspace", @"C:\GP\PortlandOR.gdb"); IGpEnumList fcColl = GP.ListFeatureClasses("*", "POLYLINE", ""); string inputfeatures = fcColl.Next(); object row = ""; while (inputfeatures != "") { if (inputfeatures == "streets") { row = inputfeatures + " 1"; vtobject.AddRow(ref row); } else { row = inputfeatures + " 2"; vtobject.AddRow(ref row); } inputfeatures = fcColl.Next(); } IVariantArray pVarArray = new VarArrayClass(); pVarArray.Add(vtobject); pVarArray.Add("C:\\Gp\\PortlandOR.gdb\\streets_bike"); // Execute the Intersect tool. GP.Execute("intersect_analysis", pVarArray, null);} [VB.NET] Imports ESRI.ArcGIS.GeoprocessorImports ESRI.ArcGIS.esriSystemPublic Sub ExampleUsingValueTables(ByVal GP As Geoprocessor) ' Create a value table with two columns. Dim vtobject As ESRI.ArcGIS.Geoprocessing.IGpValueTableObject = New ESRI.ArcGIS.Geoprocessing.GpValueTableObjectClass() vtobject.SetColumns(2) ' Iterate the enumeration of feature classes and add them to the value table. ' In this case, the inputs and ranks are being set for Intersect. GP.SetEnvironmentValue("workspace", "C:\GP\PortlandOR.gdb") Dim fcColl As ESRI.ArcGIS.Geoprocessing.IGpEnumList = GP.ListFeatureClasses("*", "POLYLINE", "") Dim inputfeatures As String = fcColl.Next() Dim row As Object = "" Do While inputfeatures <> "" If inputfeatures = "streets" Then row = inputfeatures & " 1" vtobject.AddRow(row) Else row = inputfeatures & " 2" vtobject.AddRow(row) End If inputfeatures = fcColl.Next() Loop Dim pVarArray As IVariantArray = New VarArrayClass() pVarArray.Add(vtobject) pVarArray.Add("C:\Gp\PortlandOR.gdb\streets_bike") ' Execute the Intersect tool. GP.Execute("intersect_analysis", pVarArray, Nothing) End SubThe following example shows how a value table can be populated with a multivalue string that has been passed to a script as an argument, making it easy to extract each record: [C#] IGpValueTableObject vtobject = new GpValueTableObjectClass();// Where input features is a multivalue of input feature classes.vtobject.LoadFromString(inputfeatures); [VB.NET] Dim vtobject As ESRI.ArcGIS.Geoprocessing.IGpValueTableObject = New ESRI.ArcGIS.Geoprocessing.GpValueTableObjectClass()' Where input features is a multivalue of input feature classes.vtobject.LoadFromString(inputfeatures)
  • 相关阅读:
    sizeof,终极无惑(上)
    send,recv,sendto,recvfrom
    【问卷调查】社团对海大学生成长的影响研究(及部分调查结果)
    Opencv cvCircle函数
    墨菲定律、二八法则、马太效应、手表定理、“不值得”定律、彼得原理、零和游戏、华盛顿合作规律、酒与污水定律、水桶定律、蘑菇管理原理、钱的问题、奥卡姆剃刀等13条是左右人生的金科玉律
    C#操作Excel文件(读取Excel,写入Excel)
    秋风秋雨愁煞人
    Java Applet读写client串口——终极篇
    数据库索引的作用和长处缺点
    EasyARM i.mx28学习笔记——开箱试用总结
  • 原文地址:https://www.cnblogs.com/adodo1/p/4327914.html
Copyright © 2011-2022 走看看