コード例 #1
0
ファイル: ImportExportCS.cs プロジェクト: guchanghai/Cut
        /// <summary>
        /// This function set the OD table name to layerName_OD.
        /// </summary>
        public bool SetTableName(InputLayer layer, string layerName)
        {
            ImportDataMapping tableType;
            tableType = ImportDataMapping.NewObjectDataOnly;
            string tableName = string.Concat(layerName, "_OD");
            string newTableName = null;
            // If the table name already exists, append a number after the table name,
            // until no OD table with the same name found.
            if (TableNameExist(tableName))
            {
                int index = 1;
                do
                {
                    newTableName = string.Concat(tableName, index.ToString());
                    index++;
                }
                while (TableNameExist(newTableName));

                layer.SetDataMapping(tableType, newTableName);
            }
            else
            {
                layer.SetDataMapping(tableType, tableName);
            }

            return true;
        }