Beispiel #1
0
        /// <summary>
        /// Retrieves the field of _hluFeatureClass that corresponds to the column of _hluLayerStructure whose name is passed in.
        /// </summary>
        /// <param name="columnName">Name of the column of _hluLayerStructure.</param>
        /// <returns>The field of _hluFeatureClass corresponding to column _hluLayerStructure[columnName].</returns>
        public static IField GetField(string columnName, IFeatureClass _hluFeatureClass,
                                      HluGISLayer.incid_mm_polygonsDataTable _hluLayerStructure, int[] _hluFieldMap)
        {
            if ((_hluLayerStructure == null) || (_hluFieldMap == null) ||
                (_hluFeatureClass == null) || String.IsNullOrEmpty(columnName))
            {
                return(null);
            }
            DataColumn c = _hluLayerStructure.Columns[columnName.Trim()];

            if ((c == null) || (c.Ordinal >= _hluFieldMap.Length))
            {
                return(null);
            }
            int fieldOrdinal = _hluFieldMap[c.Ordinal];

            if ((fieldOrdinal >= 0) && (fieldOrdinal <= _hluFieldMap.Length))
            {
                return(_hluFeatureClass.Fields.get_Field(fieldOrdinal));
            }
            else
            {
                return(null);
            }
        }
Beispiel #2
0
        protected List <SqlFilterCondition> MapWhereClauseFields(
            HluGISLayer.incid_mm_polygonsDataTable _hluLayerStructure, List <SqlFilterCondition> whereClause)
        {
            List <SqlFilterCondition> outWhereClause = new List <SqlFilterCondition>();

            for (int i = 0; i < whereClause.Count; i++)
            {
                SqlFilterCondition cond = whereClause[i];
                if (!_hluLayerStructure.Columns.Contains(cond.Column.ColumnName))
                {
                    if ((!String.IsNullOrEmpty(cond.CloseParentheses)) && (outWhereClause.Count > 0))
                    {
                        SqlFilterCondition condPrev = outWhereClause[outWhereClause.Count - 1];
                        condPrev.CloseParentheses += cond.CloseParentheses;
                        outWhereClause[outWhereClause.Count - 1] = condPrev;
                    }
                    if ((!String.IsNullOrEmpty(cond.OpenParentheses)) && (i < whereClause.Count - 1))
                    {
                        SqlFilterCondition condNext = whereClause[i + 1];
                        condNext.OpenParentheses += cond.OpenParentheses;
                        whereClause[i + 1]        = condNext;
                    }
                    continue;
                }
                string columnName = GetFieldName(_hluLayerStructure.Columns[cond.Column.ColumnName].Ordinal);
                if (!String.IsNullOrEmpty(columnName))
                {
                    cond.Column = new DataColumn(columnName, cond.Column.DataType);
                    outWhereClause.Add(cond);
                }
            }
            return(outWhereClause);
        }
Beispiel #3
0
        private string OpenTable(out string path)
        {
            string tabName;
            path = null;

            OpenFileDialog openFileDlg = new OpenFileDialog();
            openFileDlg.Filter = "MapInfo Tables (*.tab)|*.tab";
            openFileDlg.CheckPathExists = true;
            openFileDlg.CheckFileExists = true;
            openFileDlg.ValidateNames = true;
            openFileDlg.Multiselect = false;
            openFileDlg.RestoreDirectory = false;
            openFileDlg.InitialDirectory =
                Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            if (openFileDlg.ShowDialog(App.GetActiveWindow()) != true)
            {
                _hluMapWindowID = -1;
                _hluLayerStructure = null;
                _hluFieldNames = null;
                _hluFieldMap = null;
                _hluLayer = null;
                return null;
            }
            else
            {
                path = openFileDlg.FileName;
                tabName = _mapInfoApp.Eval(String.Format("PathToTableName$({0})", QuoteValue(path)));
                _mapInfoApp.Do(String.Format("Open Table {0}", QuoteValue(path)));
                tabName = _mapInfoApp.Eval(String.Format("TableInfo(0, {0})",
                    (int)MapInfoConstants.TableInfo.TAB_INFO_NAME));
                //_hluLayer = tabName;
                return tabName;
            }
        }
Beispiel #4
0
        //---------------------------------------------------------------------
        /// <summary>
        /// Checks whether the layer/table that field hluLayer points to is an HLU layer,
        /// as determined by its data structure. The data structure must follow the template of the
        /// HLU.Data.Model.HluGISLayer.incid_mm_polygonsDataTable (same column names and data types,
        /// as per type maps _typeMapSystemToSQL and _typeMapSQLToSystem).
        /// If hluLayer points to a proper HLU layer _hluLayer, _hluFieldNames and _hluFieldMap
        /// are initialized to their correct values; otherwise they are set to null.
        /// </summary>
        /// <param name="hluLayer">The HLU layer that will be switched to.</param>
        /// <returns></returns>
        protected bool IsHluLayer(string hluLayer)
        {
            try
            {
                if (_mapInfoApp == null)
                    throw new Exception("No MapInfo application.");

                if (String.IsNullOrEmpty(hluLayer))
                    throw new Exception("No HLU layer.");

                // Check various characteristics of the layer and throw exceptions if not valid
                if (Int32.Parse(_mapInfoApp.Eval(String.Format("TableInfo({0}, {1})", hluLayer,
                    (int)MapInfoConstants.TableInfo.TAB_INFO_TYPE))) != (int)MapInfoConstants.TableInfoType.TAB_TYPE_BASE)
                    throw new Exception(String.Format("Table {0} is not a base table.", hluLayer));

                if (_mapInfoApp.Eval(String.Format("TableInfo({0}, {1})", hluLayer,
                    (int)MapInfoConstants.TableInfo.TAB_INFO_READONLY)) == "T")
                    throw new Exception(String.Format("Table {0} is read only.", hluLayer));

                if (_mapInfoApp.Eval(String.Format("TableInfo({0}, {1})", hluLayer,
                    (int)MapInfoConstants.TableInfo.TAB_INFO_MAPPABLE)) == "F")
                    throw new Exception(String.Format("Table {0} is not mappable.", hluLayer));

                // Store the number of columns in the layer
                int numColumns = Int32.Parse(_mapInfoApp.Eval(String.Format("TableInfo({0}, {1})",
                    hluLayer, (int)MapInfoConstants.TableInfo.TAB_INFO_NCOLS)));

                if (_hluLayerStructure == null)
                    _hluLayerStructure = new HluGISLayer.incid_mm_polygonsDataTable();

                int[] hluFieldMap = _hluLayerStructure.Columns.Cast<DataColumn>().Select(c => -1).ToArray();
                string[] hluFieldNames = new string[numColumns];

                // Loop through all the columns in the layer
                for (int i = 1; i <= numColumns; i++)
                {
                    // Store the column field name
                    hluFieldNames[i - 1] = _mapInfoApp.Eval(String.Format("ColumnInfo({0}, {1}, {2})",
                        hluLayer, QuoteValue(String.Format("Col{0}", i)), (int)MapInfoConstants.ColumnInfo.COL_INFO_NAME));

                    DataColumn hluColumn = _hluLayerStructure.Columns.Contains(hluFieldNames[i - 1]) ?
                        _hluLayerStructure.Columns[hluFieldNames[i - 1]] : null;

                    if (hluColumn != null)
                    {
                        hluFieldMap[hluColumn.Ordinal] = i;

                        // Check the field type and length
                        Type colSysType;
                        if (!_typeMapSQLToSystem.TryGetValue(Int32.Parse(_mapInfoApp.Eval(String.Format(
                            "ColumnInfo({0}, {1}, {2})", hluLayer, QuoteValue(String.Format("Col{0}", i)),
                            (int)MapInfoConstants.ColumnInfo.COL_INFO_TYPE))), out colSysType) ||
                            (hluColumn.DataType != colSysType))
                            throw new Exception("Field type does not match the HLU GIS layer structure.");

                        if ((colSysType == typeof(string)) && (Int32.Parse(_mapInfoApp.Eval(
                            String.Format("ColumnInfo({0}, {1}, {2})", hluLayer, QuoteValue(String.Format("Col{0}", i)),
                            (int)MapInfoConstants.ColumnInfo.COL_INFO_WIDTH))) > hluColumn.MaxLength))
                            throw new Exception("Field length does not match the HLU GIS layer structure.");
                    }
                }

                if (!hluFieldMap.All(o => o != -1))
                    throw new Exception("Layer is missing some fields of the HLU GIS layer structure.");

                //---------------------------------------------------------------------
                // CHANGED: CR31 (Switching between GIS layers)
                // Enable the user to switch between different HLU layers, where
                // there is more than one valid layer in the current document.
                //
                // Only set the current HLU layer properties (i.e. _hluLayer, etc)
                // if this valid HLU layer is to replace an existing layer.
                if (_hluLayer == null)
                {
                    // The layer is a valid HLU layer so store the layer properties.
                    _hluLayer = hluLayer;
                    _hluFieldMap = hluFieldMap;
                    _hluFieldNames = hluFieldNames;

                    if (_hluLayerOld != null)
                    {
                        // Turn off speed edits ('Undo Off' and 'FastEdit Off') on the old HLU layer
                        // and allow the user to remove if from the map or close it.
                        _mapInfoApp.Do(String.Format("Set Table {0} Undo On", _hluLayerOld));
                        //_mapInfoApp.Do(String.Format("Set Table {0} FastEdit Off", _hluLayerOld));
                        _mapInfoApp.Do(String.Format("Set Table {0} UserRemoveMap On", _hluLayerOld));
                        _mapInfoApp.Do(String.Format("Set Table {0} UserClose On", _hluLayerOld));
                        _mapInfoApp.Do(String.Format("Set Table {0} UserMap On", _hluLayerOld));
                    }

                    // The layer is a valid HLU layer so speed up edits ('Undo Off' and 'FastEdit Off')
                    // and stop the user from being able to remove the layer from the map or close it.
                    _mapInfoApp.Do(String.Format("Set Table {0} Undo Off", _hluLayer));
                    //_mapInfoApp.Do(String.Format("Set Table {0} FastEdit On", _hluLayer));
                    _mapInfoApp.Do(String.Format("Set Table {0} UserRemoveMap Off", _hluLayer));
                    _mapInfoApp.Do(String.Format("Set Table {0} UserClose Off", _hluLayer));
                    _mapInfoApp.Do(String.Format("Set Table {0} UserMap Off", _hluLayer));

                    _hluColumnList = ColumnList(_hluLayer, null, true);
                }
                //---------------------------------------------------------------------

                return true;
            }
            catch
            {
                //_hluMapWindowID = -1;
                //_hluLayerStructure = null;
                //_hluFieldNames = null;
                //_hluFieldMap = null;
                //_hluLayer = null;
                //_hluColumnList = null;
                return false;
            }
        }
        public void Startup(ref object initializationData)
        {
            _application = initializationData as IApplication;
            if (_application == null) return;

            ArcMapAppHelperClass.GetValidWorkspaces(out _validWorkspaces);
            ArcMapAppHelperClass.GetTypeMaps(out _sqlPredicates, out _typeMapSystemToSql, out _typeMapSQLToSystem);
            _hluLayerStructure = new HluGISLayer.incid_mm_polygonsDataTable();

            SetupDocumentEvents(_application.Document);

            if (PipeManager == null)
            {
                _pipeName = String.Format("{0}.{1}", ArcMapApp.PipeBaseName, _application.hWnd);
                PipeManager = new PipeManager();
                PipeManager.Initialize(_pipeName, _pipeMaxReadBytes);
                PipeManager.IncomingDataReady += new EventHandler(_pipeManager_IncomingDataReady);

                _dummyControl = new System.Windows.Forms.Control();
                _dummyControl.CreateControl();

                _pipeSelDel = new PipeSelectionDelegate(PipeSelection);
                _selectedRowsUniqueDel = new SelectedRowsUniqueDelegate(SelectedRowsUnique);
                _flashSelFeatDel = new FlashSelectedFeatureDelegate(FlashFeature);
                _splitFeatDel = new SplitFeatureDelegate(SplitFeature);
                _splitFeatLogDel = new SplitFeaturesLogicallyDelegate(SplitFeaturesLogically);
                _mergeFeatDel = new MergeFeaturesDelegate(MergeFeatures);
                _mergeFeatLogDel = new MergeFeaturesLogicallyDelegate(MergeFeaturesLogically);
                _updAttsDel = new UpdateAttributesDelegate(UpdateAttributes);
                _updAttsSelDel = new UpdateAttributesSelectionDelegate(UpdateAttributes);
                _updAttsBulkDel = new UpdateAttributesBulkDelegate(UpdateAttributes);
                _selByQDefDel = new SelectByQueryDefDelegate(SelectByQueryDef);
                _selByQFilterDel = new SelectByQueryFilterDelegate(SelectByQueryFilter);
                _selByJoinDel = new SelectByJoinDelegate(SelectByJoin);
                _zoomSelDel = new ZoomSelectedDelegate(ZoomSelected);
                _zoomSelCursorDel = new ZoomSelectedCursorDelegate(ZoomSelectedCursor);
                _exportDel = new ExportDelegate(Export);
                _isHluWorkspaceDel = new IsHluWorkspaceDelegate(IsHluWorkspace);
                _ListHluLayersDel = new ListHluLayersDelegate(ListHluLayers);
                _isHluLayerDel = new IsHluLayerDelegate(IsHluLayer);
                _isEditingDel = new IsEditingDelegate(IsEditing);
            }
        }
Beispiel #6
0
        public static bool IsHluLayer(IFeatureLayer layer, IFields origFields,
                                      IFieldChecker fieldChecker, object[] validWorkspaces, Dictionary <Type, int> typeMapSystemToSQL,
                                      ref HluGISLayer.incid_mm_polygonsDataTable hluLayerStructure,
                                      out int[] hluFieldMap, out string[] hluFieldNames)
        {
            hluFieldMap   = null;
            hluFieldNames = null;

            if ((layer == null) || !layer.Valid || (((IFeatureLayerDefinition)layer).DefinitionSelectionSet != null))
            {
                return(false);
            }

            bool isHlu = true;

            try
            {
                IFeatureClass testFeatureClass = layer.FeatureClass;

                if (hluLayerStructure == null)
                {
                    hluLayerStructure = new HluGISLayer.incid_mm_polygonsDataTable();
                }
                IFeatureWorkspace testWorkspace = ((IDataset)testFeatureClass).Workspace as IFeatureWorkspace;
                if (testWorkspace == null)
                {
                    throw (new Exception("Invalid feature workspace."));
                }
                if (System.Array.IndexOf(validWorkspaces, ((IWorkspace)testWorkspace).WorkspaceFactory.GetClassID().Value) == -1)
                {
                    throw (new Exception("Invalid workspace type."));
                }

                if (testFeatureClass.ShapeType != esriGeometryType.esriGeometryPolygon)
                {
                    throw (new Exception("Invalid geometry type."));
                }

                IFieldsEdit fieldsEdit = (IFieldsEdit)origFields;
                foreach (DataColumn c in hluLayerStructure.Columns)
                {
                    IField      newField     = new FieldClass();
                    IFieldEdit2 newFieldEdit = (IFieldEdit2)newField;
                    newFieldEdit.Name_2 = c.ColumnName;
                    int fieldType;
                    if (!typeMapSystemToSQL.TryGetValue(c.DataType, out fieldType))
                    {
                        throw (new Exception("Invalid field type."));
                    }
                    newFieldEdit.Type_2 = (esriFieldType)fieldType;
                    if ((c.MaxLength != -1) && (newField.Type == esriFieldType.esriFieldTypeString))
                    {
                        newFieldEdit.Length_2 = c.MaxLength;
                    }
                    fieldsEdit.AddField(newField);
                }

                fieldChecker.ValidateWorkspace = (IWorkspace)testWorkspace;

                IEnumFieldError error;
                IFields         fixedFields;
                fieldChecker.Validate(origFields, out error, out fixedFields);

                hluFieldMap   = new int[origFields.FieldCount];
                hluFieldNames = new string[hluFieldMap.Length];

                for (int i = 0; i < fixedFields.FieldCount; i++)
                {
                    IField fixedField = fixedFields.get_Field(i);

                    int ordinal = testFeatureClass.Fields.FindField(fixedField.Name);

                    if (ordinal == -1)
                    {
                        throw (new Exception("Field name does not match the HLU GIS layer structure."));
                    }
                    IField fcField = testFeatureClass.Fields.get_Field(ordinal);
                    if (fcField.Type != fixedField.Type)
                    {
                        throw (new Exception("Field type does not match the HLU GIS layer structure."));
                    }
                    if ((fcField.Type == esriFieldType.esriFieldTypeString) && (fcField.Length > fixedField.Length))
                    {
                        throw (new Exception("Field length does not match the HLU GIS layer structure."));
                    }

                    hluFieldMap[i]   = ordinal;
                    hluFieldNames[i] = fixedField.Name;
                }
            }
            catch { return(false); }

            return(isHlu);
        }
        public static bool IsHluLayer(IFeatureLayer layer, IFields origFields,
            IFieldChecker fieldChecker, object[] validWorkspaces, Dictionary<Type, int> typeMapSystemToSQL,
            ref HluGISLayer.incid_mm_polygonsDataTable hluLayerStructure,
            out int[] hluFieldMap, out string[] hluFieldNames)
        {
            hluFieldMap = null;
            hluFieldNames = null;

            if ((layer == null) || !layer.Valid || (((IFeatureLayerDefinition)layer).DefinitionSelectionSet != null))
                return false;

            bool isHlu = true;

            try
            {
                IFeatureClass testFeatureClass = layer.FeatureClass;

                if (hluLayerStructure == null) hluLayerStructure = new HluGISLayer.incid_mm_polygonsDataTable();
                IFeatureWorkspace testWorkspace = ((IDataset)testFeatureClass).Workspace as IFeatureWorkspace;
                if (testWorkspace == null)
                    throw (new Exception("Invalid feature workspace."));
                if (System.Array.IndexOf(validWorkspaces, ((IWorkspace)testWorkspace).WorkspaceFactory.GetClassID().Value) == -1)
                    throw (new Exception("Invalid workspace type."));

                if (testFeatureClass.ShapeType != esriGeometryType.esriGeometryPolygon)
                    throw (new Exception("Invalid geometry type."));

                IFieldsEdit fieldsEdit = (IFieldsEdit)origFields;
                foreach (DataColumn c in hluLayerStructure.Columns)
                {
                    IField newField = new FieldClass();
                    IFieldEdit2 newFieldEdit = (IFieldEdit2)newField;
                    newFieldEdit.Name_2 = c.ColumnName;
                    int fieldType;
                    if (!typeMapSystemToSQL.TryGetValue(c.DataType, out fieldType))
                        throw (new Exception("Invalid field type."));
                    newFieldEdit.Type_2 = (esriFieldType)fieldType;
                    if ((c.MaxLength != -1) && (newField.Type == esriFieldType.esriFieldTypeString))
                        newFieldEdit.Length_2 = c.MaxLength;
                    fieldsEdit.AddField(newField);
                }

                fieldChecker.ValidateWorkspace = (IWorkspace)testWorkspace;

                IEnumFieldError error;
                IFields fixedFields;
                fieldChecker.Validate(origFields, out error, out fixedFields);

                hluFieldMap = new int[origFields.FieldCount];
                hluFieldNames = new string[hluFieldMap.Length];

                for (int i = 0; i < fixedFields.FieldCount; i++)
                {
                    IField fixedField = fixedFields.get_Field(i);

                    int ordinal = testFeatureClass.Fields.FindField(fixedField.Name);

                    if (ordinal == -1)
                        throw (new Exception("Field name does not match the HLU GIS layer structure."));
                    IField fcField = testFeatureClass.Fields.get_Field(ordinal);
                    if (fcField.Type != fixedField.Type)
                        throw (new Exception("Field type does not match the HLU GIS layer structure."));
                    if ((fcField.Type == esriFieldType.esriFieldTypeString) && (fcField.Length > fixedField.Length))
                        throw (new Exception("Field length does not match the HLU GIS layer structure."));

                    hluFieldMap[i] = ordinal;
                    //---------------------------------------------------------------------
                    // FIXED: KI107 (GIS layer column names)
                    // Use the field names from the GIS layer so that they can be found
                    // when performing any SELECT statements.
                    hluFieldNames[i] = fcField.Name;
                    //hluFieldNames[i] = fixedField.Name;
                    //---------------------------------------------------------------------
                }
            }
            catch { return false; }

            return isHlu;
        }
Beispiel #8
0
        /// <summary>
        /// Checks whether the layer/table that field _hluLayer points to is an HLU layer, 
        /// as determined by its data structure. The data structure must follow the template of the 
        /// HLU.Data.Model.HluGISLayer.incid_mm_polygonsDataTable (same column names and data types, 
        /// as per type maps _typeMapSystemToSQL and _typeMapSQLToSystem).
        /// If _hluLayer points to a proper HLU layer _hluLayer, _hluFieldNames and _hluFieldMap 
        /// are initialized to their correct values; otherwise they are set to null.
        /// </summary>
        /// <returns></returns>
        protected override bool IsHluLayer()
        {
            try
            {
                if (_mapInfoApp == null)
                    throw new Exception("No MapInfo application.");

                if (String.IsNullOrEmpty(_hluLayer))
                    throw new Exception("No HLU layer.");

                if (Int32.Parse(_mapInfoApp.Eval(String.Format("TableInfo({0}, {1})", _hluLayer,
                    (int)MapInfoConstants.TableInfo.TAB_INFO_TYPE))) != (int)MapInfoConstants.TableInfoType.TAB_TYPE_BASE)
                    throw new Exception(String.Format("Table {0} is not a base table.", _hluLayer));

                if (_mapInfoApp.Eval(String.Format("TableInfo({0}, {1})", _hluLayer,
                    (int)MapInfoConstants.TableInfo.TAB_INFO_READONLY)) == "T")
                    throw new Exception(String.Format("Table {0} is read only.", _hluLayer));

                if (_mapInfoApp.Eval(String.Format("TableInfo({0}, {1})", _hluLayer,
                    (int)MapInfoConstants.TableInfo.TAB_INFO_MAPPABLE)) == "F")
                    throw new Exception(String.Format("Table {0} is not mappable.", _hluLayer));

                int numColumns = Int32.Parse(_mapInfoApp.Eval(String.Format("TableInfo({0}, {1})",
                    _hluLayer, (int)MapInfoConstants.TableInfo.TAB_INFO_NCOLS)));

                if (_hluLayerStructure == null)
                    _hluLayerStructure = new HluGISLayer.incid_mm_polygonsDataTable();

                _hluFieldMap = _hluLayerStructure.Columns.Cast<DataColumn>().Select(c => -1).ToArray();
                _hluFieldNames = new string[numColumns];

                for (int i = 1; i <= numColumns; i++)
                {
                    _hluFieldNames[i - 1] = _mapInfoApp.Eval(String.Format("ColumnInfo({0}, {1}, {2})",
                        _hluLayer, QuoteValue(String.Format("Col{0}", i)), (int)MapInfoConstants.ColumnInfo.COL_INFO_NAME));

                    DataColumn hluColumn = _hluLayerStructure.Columns.Contains(_hluFieldNames[i - 1]) ?
                        _hluLayerStructure.Columns[_hluFieldNames[i - 1]] : null;

                    if (hluColumn != null)
                    {
                        _hluFieldMap[hluColumn.Ordinal] = i;

                        Type colSysType;
                        if (!_typeMapSQLToSystem.TryGetValue(Int32.Parse(_mapInfoApp.Eval(String.Format(
                            "ColumnInfo({0}, {1}, {2})", _hluLayer, QuoteValue(String.Format("Col{0}", i)),
                            (int)MapInfoConstants.ColumnInfo.COL_INFO_TYPE))), out colSysType) ||
                            (hluColumn.DataType != colSysType))
                            throw new Exception("Field type does not match the HLU GIS layer structure.");

                        if ((colSysType == typeof(string)) && (Int32.Parse(_mapInfoApp.Eval(
                            String.Format("ColumnInfo({0}, {1}, {2})", _hluLayer, QuoteValue(String.Format("Col{0}", i)),
                            (int)MapInfoConstants.ColumnInfo.COL_INFO_WIDTH))) > hluColumn.MaxLength))
                            throw new Exception("Field length does not match the HLU GIS layer structure.");
                    }
                }

                if (!_hluFieldMap.All(o => o != -1))
                    throw new Exception("Layer is missing some fields of the HLU GIS layer structure.");

                _mapInfoApp.Do(String.Format("Set Table {0} Undo Off", _hluLayer));
                _mapInfoApp.Do(String.Format("Set Table {0} FastEdit Off", _hluLayer));
                _mapInfoApp.Do(String.Format("Set Table {0} UserRemoveMap Off", _hluLayer));
                _mapInfoApp.Do(String.Format("Set Table {0} UserClose Off", _hluLayer));
                _mapInfoApp.Do(String.Format("Set Table {0} UserMap Off", _hluLayer));

                _hluColumnList = ColumnList(_hluLayer, null, true);

                return true;
            }
            catch
            {
                _hluMapWindowID = -1;
                _hluLayerStructure = null;
                _hluFieldNames = null;
                _hluFieldMap = null;
                _hluLayer = null;
                _hluColumnList = null;
                return false;
            }
        }