public static void UpdateSpreadPoints(Document document)
        {
            var vm     = new SpreadPointSettingsViewModel();
            var dialog = new SpreadPointSettingsDlg()
            {
                DataContext = vm
            };
            var dlgResult = dialog.ShowDialog();

            if (dlgResult == null || !dlgResult.Value)
            {
                return;
            }

            var mapScale = MapScaleUtils.GetApplicationMapScale();

            if (mapScale == null)
            {
                return;
            }

            var settings = new SpreadPointSettings()
            {
                InsertCode = vm.ShowPointCode,
                InsertId   = vm.ShowPointId,
                Scale      = mapScale.Value / 1000.0
            };

            SpreadPointUtils.UpdateSpreadPoints(document, settings);
        }
        public static void ImportSpreadPoints(Document document, bool insertId, bool insertCode)
        {
            var mapScale = MapScaleUtils.GetApplicationMapScale();

            if (mapScale == null || mapScale.Value.EqualsWithTolerance(0.0))
            {
                bool success = SetMapScale(document);
                if (!success)
                {
                    return;
                }
                mapScale = MapScaleUtils.GetApplicationMapScale();
            }

            // Open file dialog to select dat file
            // http://through-the-interface.typepad.com/through_the_interface/2007/08/using-autocads-.html
            var fileDialog = new OpenFileDialog("导入展点文件", defaultName: null,
                                                extension: "dat;*", dialogName: "SelectFile",
                                                flags: OpenFileDialog.OpenFileDialogFlags.DoNotTransferRemoteFiles);
            var dialogResult = fileDialog.ShowDialog();

            if (dialogResult != DialogResult.OK)
            {
                return;
            }

            // Create settings.
            var settings = new SpreadPointSettings()
            {
                InsertId   = insertId,
                InsertCode = insertCode,
                Scale      = mapScale.Value / 1000.0
            };

            var spreadPoints = SpreadPointUtils.ReadSpreadPointsFromFile(fileDialog.Filename);
            var ids          = SpreadPointUtils.InsertSpreadPoints(document, spreadPoints, settings);

            if (!ids.Any())
            {
                return;
            }

            Extents3d extents = GeometryUtils.SafeGetGeometricExtents(ids);

            EditorUtils.ZoomToWin(document.Editor, extents, 1.2);
        }