예제 #1
0
        public ConfigFileGeoDataBaseUserControl(FeatureLayer featureLayer)
        {
            InitializeComponent();

            if (EditorUIPlugin.IsRelateAndAliasEnabled)
            {
                GridView.Columns.Insert(GridView.Columns.Count - 2, (GridViewColumn)Resources["AliasColumn"]);
            }

            var types = Enum.GetValues(typeof(GeneralShapeFileType)).Cast <GeneralShapeFileType>().ToList();

            types.RemoveAt(1);
            ShapeFileTypes.ItemsSource = types;

            configLayerStructureViewModel = new ConfigFileGeoLayerStructureViewMode(featureLayer);
            DataContext = configLayerStructureViewModel;
        }
예제 #2
0
        protected override ConfigureFeatureLayerParameters GetFeatureLayerInfoCore()
        {
            ConfigFileGeoLayerStructureViewMode viewModel  = DataContext as ConfigFileGeoLayerStructureViewMode;
            ConfigureFeatureLayerParameters     parameters = new ConfigureFeatureLayerParameters();

            Collection <FeatureSourceColumn> originalColumns = new Collection <FeatureSourceColumn>();

            if (configLayerStructureViewModel.FeatureLayer != null)
            {
                configLayerStructureViewModel.FeatureLayer.SafeProcess(() =>
                {
                    originalColumns = configLayerStructureViewModel.FeatureLayer.FeatureSource.GetColumns();
                });
            }
            IEnumerable <FeatureSourceColumn>     addedColumns       = viewModel.ColumnListItemSource.Where(c => c.ChangedStatus == FeatureSourceColumnChangedStatus.Added).Select(l => l.FeatureSourceColumn);
            IEnumerable <FeatureSourceColumnItem> updatedColumnItems = viewModel.ColumnListItemSource.Where(c => c.ChangedStatus == FeatureSourceColumnChangedStatus.Updated);
            IEnumerable <FeatureSourceColumn>     deletedColumns     = originalColumns.Where(o => viewModel.ColumnListItemSource.All(c => c.ColumnName != o.ColumnName) && updatedColumnItems.All(u => u.OrignalColumnName != o.ColumnName));

            foreach (var item in deletedColumns)
            {
                parameters.DeletedColumns.Add(item);
            }

            foreach (var item in updatedColumnItems)
            {
                parameters.UpdatedColumns[item.OrignalColumnName] = item.FeatureSourceColumn;
            }

            foreach (var item in addedColumns)
            {
                parameters.AddedColumns.Add(item);
            }

            string pathFileName = string.Format(@"{0}\{1}.{2}", viewModel.LayerUri.OriginalString, viewModel.LayerName, "tab");

            parameters.LayerUri = new Uri(Path.GetFullPath(pathFileName));
            switch (viewModel.ShpFileType)
            {
            case GeneralShapeFileType.Point:
                parameters.WellKnownType = WellKnownType.Point;
                break;

            case GeneralShapeFileType.Multipoint:
                parameters.WellKnownType = WellKnownType.Multipoint;
                break;

            case GeneralShapeFileType.Line:
                parameters.WellKnownType = WellKnownType.Line;
                break;

            case GeneralShapeFileType.Area:
                parameters.WellKnownType = WellKnownType.Polygon;
                break;

            default:
                parameters.WellKnownType = WellKnownType.Invalid;
                break;
            }

            return(parameters);
        }