Avances ventana selección de campos
parent
886d285227
commit
41a3070fff
|
|
@ -11,11 +11,14 @@ using System.Collections.ObjectModel;
|
||||||
using ArcGIS.Core.Geometry;
|
using ArcGIS.Core.Geometry;
|
||||||
using ArcGIS.Core.Data;
|
using ArcGIS.Core.Data;
|
||||||
using ArcGIS.Desktop.Mapping;
|
using ArcGIS.Desktop.Mapping;
|
||||||
|
using ArcGIS.Core.Internal.CIM;
|
||||||
|
|
||||||
namespace OliviaAddInPro.Helper
|
namespace OliviaAddInPro.Helper
|
||||||
{
|
{
|
||||||
public static class HelperGdb
|
public static class HelperGdb
|
||||||
{
|
{
|
||||||
|
public static string out_st = string.Empty;
|
||||||
|
|
||||||
[Flags]
|
[Flags]
|
||||||
public enum TiposOpenFileDlg
|
public enum TiposOpenFileDlg
|
||||||
{
|
{
|
||||||
|
|
@ -25,38 +28,28 @@ namespace OliviaAddInPro.Helper
|
||||||
OpenGdb=8,
|
OpenGdb=8,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Dado el tipo de FtClass y una posición inicial abre un diálogo de búsqueda de ftclass
|
||||||
|
//si se cancela o no es una feature class lo que se ha abierto devuelve null
|
||||||
|
//si no, devuelve la featureclass directamente abierta
|
||||||
public static FeatureClass OpenFtClassDialog(TiposOpenFileDlg tipo, string initialLoc = "")
|
public static FeatureClass OpenFtClassDialog(TiposOpenFileDlg tipo, string initialLoc = "")
|
||||||
{
|
{
|
||||||
Item it = OpenFileDialog( tipo, initialLoc);
|
FeatureClass fc = null;
|
||||||
//FeatureClass fc = new FeatureClass();
|
string path = OpenFileDialog( tipo, initialLoc);
|
||||||
// return fc;
|
if(!string.IsNullOrEmpty(path))
|
||||||
return null;
|
{
|
||||||
}
|
fc = GetFtClass(path);
|
||||||
|
}
|
||||||
|
return fc;
|
||||||
|
}
|
||||||
|
|
||||||
public static async Task<Geodatabase> OpenGdb(string path)
|
//Libera el objeto
|
||||||
|
public static void Free(IDisposable obj)
|
||||||
{
|
{
|
||||||
try
|
obj.Dispose();
|
||||||
{
|
|
||||||
await ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() => {
|
|
||||||
// Opens a file geodatabase. This will open the geodatabase if the folder exists and contains a valid geodatabase.
|
|
||||||
using (
|
|
||||||
Geodatabase geodatabase =
|
|
||||||
new Geodatabase(new FileGeodatabaseConnectionPath(new Uri(path))))
|
|
||||||
{
|
|
||||||
return geodatabase;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
catch (GeodatabaseNotFoundOrOpenedException exception)
|
|
||||||
{
|
|
||||||
// Handle Exception.
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Devuelve el Path del archivo seleccionado o un string vacío si se ha cancelado
|
//Devuelve el Path del archivo seleccionado o un string vacío si se ha cancelado
|
||||||
public static Item OpenFileDialog(TiposOpenFileDlg tipo, string initialLoc="")
|
public static string OpenFileDialog(TiposOpenFileDlg tipo, string initialLoc="")
|
||||||
{
|
{
|
||||||
string titulo;
|
string titulo;
|
||||||
titulo = "Abrir Archivo";
|
titulo = "Abrir Archivo";
|
||||||
|
|
@ -100,9 +93,9 @@ namespace OliviaAddInPro.Helper
|
||||||
};
|
};
|
||||||
bool? ok = aNewFilter.ShowDialog();
|
bool? ok = aNewFilter.ShowDialog();
|
||||||
if ((ok ?? true) && aNewFilter.Items.Count() > 0)
|
if ((ok ?? true) && aNewFilter.Items.Count() > 0)
|
||||||
return aNewFilter.Items.First();
|
return aNewFilter.Items.First().Path;
|
||||||
else
|
else
|
||||||
return null;
|
return string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*public static bool SelecPolig(string title, int wnd_handle, out string text_sal, out IGeometry geom_sal)
|
/*public static bool SelecPolig(string title, int wnd_handle, out string text_sal, out IGeometry geom_sal)
|
||||||
|
|
@ -114,31 +107,198 @@ namespace OliviaAddInPro.Helper
|
||||||
|
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
public static Table GetTable(string pathLyr)
|
//Dado un path comprueba que sea de una gdb, termina en .gdb, o si tiene .gdb en medio lo corta ahí
|
||||||
|
//y si no tiene devuelve vacío
|
||||||
|
public static string GetPathGdb(string path)
|
||||||
{
|
{
|
||||||
Table tb=null;
|
string pathGdb = string.Empty;
|
||||||
Geodatabase fileGeodatabase = new Geodatabase(new FileGeodatabaseConnectionPath(new Uri(pathLyr)));
|
int i = 0;
|
||||||
// FeatureLayer lyr = new FeatureLayer();
|
string gdbext = ".gdb";
|
||||||
|
if(path.Contains(gdbext))
|
||||||
|
{
|
||||||
|
i = path.IndexOf(gdbext, 0, path.Length);
|
||||||
|
pathGdb = path.Substring(0, i + 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
return pathGdb;
|
||||||
|
|
||||||
|
}
|
||||||
|
//Dado un path aunque sea de una feature class, devuelve el path de la gdb que la contiene, o si
|
||||||
|
//es de gdb directamente, y si no tiene .gdb, devuelve null
|
||||||
|
public static Task<Geodatabase> GetGdb(string pathGdb)
|
||||||
|
{
|
||||||
|
Geodatabase fileGeodatabase = null;
|
||||||
|
return ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() =>
|
||||||
|
{
|
||||||
|
string path = GetPathGdb(pathGdb);
|
||||||
|
if (!string.IsNullOrEmpty(path))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
fileGeodatabase = new Geodatabase(new FileGeodatabaseConnectionPath(new Uri(path)));
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
out_st = "Error al abrir Geodatabase " + path + ": " + ex.Message;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return fileGeodatabase;
|
||||||
|
});
|
||||||
|
//return fileGeodatabase;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Dado un path de una feature class devuelve la ftclass abierta directamente,
|
||||||
|
//o null si ha habido algún problema o no lo ha encontrado
|
||||||
|
public static FeatureClass GetFtClass(string pathFtClss)
|
||||||
|
{
|
||||||
|
FeatureClass ftclss = null;
|
||||||
|
Geodatabase gdb = GetGdb(pathFtClss).Result;
|
||||||
|
if (gdb != null)
|
||||||
|
{
|
||||||
|
ftclss = GetFtClass(System.IO.Path.GetFileNameWithoutExtension(pathFtClss), gdb).Result;
|
||||||
|
}
|
||||||
|
else //mira a ver si es shapefile
|
||||||
|
{
|
||||||
|
ftclss = GetFtClassFromShp(pathFtClss).Result;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ftclss;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Dado el path de una gdb y el nombre de una feature class, devuelve la
|
||||||
|
//feature class abierta, o null si hay algun problema
|
||||||
|
public static Task<FeatureClass> GetFtClass(string nameFtclss, Geodatabase gdb)
|
||||||
|
{
|
||||||
|
FeatureClass ftclss = null;
|
||||||
|
return ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ftclss = gdb.OpenDataset<FeatureClass>(nameFtclss);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
out_st = "Error al abrir Feature Class " + nameFtclss + ": " + ex.Message;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return ftclss;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//Abre una feature class cuando es un shapefile
|
||||||
|
public static Task<FeatureClass> GetFtClassFromShp(string pathShp)
|
||||||
|
{
|
||||||
|
FeatureClass ftclss = null;
|
||||||
|
return ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() =>
|
||||||
|
{
|
||||||
|
if (pathShp.Contains(".shp"))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string shpname = System.IO.Path.GetFileNameWithoutExtension(pathShp);
|
||||||
|
var shapeFileConnPath = new FileSystemConnectionPath(new Uri(pathShp), FileSystemDatastoreType.Shapefile);
|
||||||
|
var shapefile = new FileSystemDatastore(shapeFileConnPath);
|
||||||
|
ftclss = shapefile.OpenDataset<FeatureClass>(shpname);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
out_st = "Error al abrir Shapefile " + pathShp + ": " + ex.Message;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ftclss;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//devuelve el campo dado el nombre
|
||||||
|
private static Task<ArcGIS.Core.Data.Field> GetFieldByName(FeatureClass ftClss, string fieldName)
|
||||||
|
{
|
||||||
|
FeatureClassDefinition ftcldef = ftClss.GetDefinition();
|
||||||
|
ArcGIS.Core.Data.Field field=null;
|
||||||
|
return ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
field = ftcldef.GetFields().First(x => x.Name.Equals(fieldName));
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
out_st = "No se encuentra el campo " + fieldName + ": " + ex.Message;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return field;
|
||||||
|
});
|
||||||
|
|
||||||
return tb;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ObservableCollection<string> GetFields(FeatureClass fc)
|
//Devuelve una lista con los campos de una feature class
|
||||||
|
public static Task<ObservableCollection<string>> GetFields(FeatureClass fc)
|
||||||
|
{
|
||||||
|
FeatureClassDefinition ftcldef=null;
|
||||||
|
IReadOnlyList<ArcGIS.Core.Data.Field> fields = null;
|
||||||
|
ObservableCollection<string> fields_st = new ObservableCollection<string>();
|
||||||
|
return ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ftcldef = fc.GetDefinition();
|
||||||
|
fields = ftcldef.GetFields();
|
||||||
|
foreach (ArcGIS.Core.Data.Field f in fields)
|
||||||
|
{
|
||||||
|
fields_st.Add(f.Name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
out_st = "Error al leer los campos " + fc.GetName() + ": " + ex.Message;
|
||||||
|
return fields_st;
|
||||||
|
}
|
||||||
|
return fields_st;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//Devuelve comilla simple si el campo es de texto, o nada si es númerico
|
||||||
|
//var whereClause = $"{SelectedField} = {Quote(f)}{FieldValue}{Quote(f)}";
|
||||||
|
public static string Quote(ArcGIS.Core.Data.Field f)
|
||||||
{
|
{
|
||||||
ObservableCollection<string> fields = new ObservableCollection<string>();
|
return f.FieldType == FieldType.String ? "'" : "";
|
||||||
|
|
||||||
|
|
||||||
return fields;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ObservableCollection<string> GetAttributes(FeatureClass fc, string fieldName)
|
//Dado un nombre de campo, devuelve los atributos que aparecen distintos
|
||||||
|
public static Task<ObservableCollection<string>> GetAttributes(FeatureClass fc, string fieldName)
|
||||||
{
|
{
|
||||||
ObservableCollection<string> attribs = new ObservableCollection<string>();
|
ObservableCollection<string> attribs_st = new ObservableCollection<string>();
|
||||||
|
return ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
FeatureClassDefinition ftcldef = fc.GetDefinition();
|
||||||
|
ArcGIS.Core.Data.Field field = ftcldef.GetFields().First(x => x.Name.Equals(fieldName));
|
||||||
|
string whereClause = $"";
|
||||||
|
ArcGIS.Core.Data.QueryFilter queryFilter = new ArcGIS.Core.Data.QueryFilter { WhereClause = whereClause };
|
||||||
|
using (RowCursor rowCursor = fc.Search(queryFilter))
|
||||||
|
{
|
||||||
|
while (rowCursor.MoveNext())
|
||||||
|
{
|
||||||
|
using (Row row = rowCursor.Current)
|
||||||
|
{
|
||||||
|
attribs_st.Add(Convert.ToString(row[fieldName]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
out_st = "Error al leer los campos " + fc.GetName() + ": " + ex.Message;
|
||||||
|
return attribs_st;
|
||||||
|
|
||||||
return attribs;
|
}
|
||||||
|
return attribs_st;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Geometry GetGeomSel(string pathLyr, string selField, ObservableCollection<string> selAttributes, out string textoSal)
|
/*public static Geometry GetGeomSel(string pathLyr, string selField, ObservableCollection<string> selAttributes, out string textoSal)
|
||||||
{
|
{
|
||||||
string _textosal = "";
|
string _textosal = "";
|
||||||
Geometry geomsal = null;
|
Geometry geomsal = null;
|
||||||
|
|
@ -170,9 +330,9 @@ namespace OliviaAddInPro.Helper
|
||||||
//Actualiza el texto de salida
|
//Actualiza el texto de salida
|
||||||
_textosal = _textosal + HelperGlobal.RevisaText(val_st[i]);
|
_textosal = _textosal + HelperGlobal.RevisaText(val_st[i]);
|
||||||
}
|
}
|
||||||
}*/
|
}
|
||||||
textoSal = _textosal;
|
textoSal = _textosal;
|
||||||
return geomsal;
|
return geomsal;
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,69 +0,0 @@
|
||||||
/*
|
|
||||||
|
|
||||||
Copyright 2019 Esri
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
|
|
||||||
*/
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Media;
|
|
||||||
using System.Windows.Media.Imaging;
|
|
||||||
|
|
||||||
namespace OliviaAddInPro
|
|
||||||
{
|
|
||||||
public class OptionsMenuItem : INotifyPropertyChanged
|
|
||||||
{
|
|
||||||
public OptionsMenuItem(BitmapImage imageUri, string optionString, PaneLimpiezaSubBase subPanelViewModel)
|
|
||||||
{
|
|
||||||
_imageSource = imageUri;
|
|
||||||
_optionString = optionString;
|
|
||||||
_subPanelViewModelBase = subPanelViewModel;
|
|
||||||
}
|
|
||||||
|
|
||||||
public event PropertyChangedEventHandler PropertyChanged;
|
|
||||||
private void OnNotifyPropertyChanged(string propName)
|
|
||||||
{
|
|
||||||
if (PropertyChanged != null)
|
|
||||||
PropertyChanged(this, new PropertyChangedEventArgs(propName));
|
|
||||||
}
|
|
||||||
private PaneLimpiezaSubBase _subPanelViewModelBase;
|
|
||||||
|
|
||||||
public PaneLimpiezaSubBase SubPanelViewModel
|
|
||||||
{
|
|
||||||
get { return _subPanelViewModelBase; }
|
|
||||||
set {
|
|
||||||
_subPanelViewModelBase = value;
|
|
||||||
OnNotifyPropertyChanged("SubPanelViewModel");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private ImageSource _imageSource;
|
|
||||||
public ImageSource ImageSource
|
|
||||||
{
|
|
||||||
get { return _imageSource; }
|
|
||||||
set { _imageSource = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
private string _optionString;
|
|
||||||
public string OptionString
|
|
||||||
{
|
|
||||||
get { return _optionString; }
|
|
||||||
set { _optionString = value; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -43,9 +43,9 @@ namespace OliviaAddInPro
|
||||||
|
|
||||||
private void Button_Click(object sender, RoutedEventArgs e)
|
private void Button_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
Item it=HelperGdb.OpenFileDialog(HelperGdb.TiposOpenFileDlg.OpenFtrClassLine | HelperGdb.TiposOpenFileDlg.OpenFtrClassPoint);
|
string capa=HelperGdb.OpenFileDialog(HelperGdb.TiposOpenFileDlg.OpenFtrClassLine | HelperGdb.TiposOpenFileDlg.OpenFtrClassPoint);
|
||||||
if(it!=null && it.Path.Length > 0)
|
if(!string.IsNullOrEmpty(capa))
|
||||||
label_capalimp.Content = it.Name;
|
label_capalimp.Content = System.IO.Path.GetFileNameWithoutExtension(capa);
|
||||||
else
|
else
|
||||||
label_capalimp.Content = Resource1.String_selec_capa;
|
label_capalimp.Content = Resource1.String_selec_capa;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ namespace OliviaAddInPro
|
||||||
string texto="";
|
string texto="";
|
||||||
if (fc != null)
|
if (fc != null)
|
||||||
{
|
{
|
||||||
texto = System.IO.Path.GetFileName(fc.GetName());
|
//texto = fc.GetName();
|
||||||
//saca la ventana de selección de campo
|
//saca la ventana de selección de campo
|
||||||
ShowProWndSelectFields selfwnd = new ShowProWndSelectFields(fc, true);
|
ShowProWndSelectFields selfwnd = new ShowProWndSelectFields(fc, true);
|
||||||
if(selfwnd.SelAttributes.Count>0)
|
if(selfwnd.SelAttributes.Count>0)
|
||||||
|
|
@ -51,11 +51,12 @@ namespace OliviaAddInPro
|
||||||
//HelperGdb.GetGeomSel(it.Path, selfwnd.SelField, selfwnd.SelAttributes, out texto);
|
//HelperGdb.GetGeomSel(it.Path, selfwnd.SelField, selfwnd.SelAttributes, out texto);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!ok)
|
if (!ok)
|
||||||
texto= Resource1.String_selec_capa;
|
{
|
||||||
|
texto = Resource1.String_selec_capa;
|
||||||
|
}
|
||||||
label_caparestr.Content = texto;
|
label_caparestr.Content = texto;
|
||||||
|
HelperGdb.Free(fc);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void button_capaniv_Click(object sender, RoutedEventArgs e)
|
private void button_capaniv_Click(object sender, RoutedEventArgs e)
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
xmlns:extensions="clr-namespace:ArcGIS.Desktop.Extensions;assembly=ArcGIS.Desktop.Extensions"
|
xmlns:extensions="clr-namespace:ArcGIS.Desktop.Extensions;assembly=ArcGIS.Desktop.Extensions"
|
||||||
mc:Ignorable="d" Height="300" Width="243.123"
|
mc:Ignorable="d" Height="300" Width="243.123"
|
||||||
WindowStartupLocation="CenterOwner" Icon="OliviaIconPro.ico" ResizeMode="NoResize" Closed="ProWindow_Closed" Closing="ProWindow_Closing"
|
WindowStartupLocation="CenterOwner" Icon="OliviaIconPro.ico" ResizeMode="NoResize" Closed="ProWindow_Closed" Closing="ProWindow_Closing"
|
||||||
|
d:DataContext="{Binding Path=ui.ShowProWndSelectFields}"
|
||||||
>
|
>
|
||||||
<controls:ProWindow.Resources>
|
<controls:ProWindow.Resources>
|
||||||
<ResourceDictionary>
|
<ResourceDictionary>
|
||||||
|
|
@ -18,9 +19,9 @@
|
||||||
<StackPanel HorizontalAlignment="Left" Height="272" VerticalAlignment="Top" Width="233" Margin="0,0,0,-1.6">
|
<StackPanel HorizontalAlignment="Left" Height="272" VerticalAlignment="Top" Width="233" Margin="0,0,0,-1.6">
|
||||||
<Label Margin="15,0,0,0" Content="Campo"/>
|
<Label Margin="15,0,0,0" Content="Campo"/>
|
||||||
<ComboBox Margin="10,5,9.6,0"
|
<ComboBox Margin="10,5,9.6,0"
|
||||||
ItemsSource="{Binding Path=Fields, Mode = TwoWay}" Name="comboBoxFields" SelectedItem="{Binding Path=SelField, Mode = TwoWay}" SelectionChanged="comboBoxFields_SelectionChanged"/>
|
ItemsSource="{Binding Path=Fields, Mode=TwoWay}" Name="comboBoxFields" SelectedItem="{Binding Path=SelField, Mode = TwoWay}" SelectionChanged="comboBoxFields_SelectionChanged"/>
|
||||||
<Label Margin="15,0,0,0" Content="Atributo"/>
|
<Label Margin="15,0,0,0" Content="Atributo"/>
|
||||||
<ListBox Margin="10,5,9.6,0" Height="127" ItemsSource="{Binding Path=Attributes, Mode = TwoWay}" Name="listBoxAttributes" SelectedItem="{Binding Path=SelAttributes, Mode = TwoWay}" SelectionMode="{Binding SelMode}"/>
|
<ListBox Margin="10,5,9.6,0" Height="127" ItemsSource="{Binding Path=Attributes}" Name="listBoxAttributes" SelectedItem="{Binding Path=SelAttributes, Mode = TwoWay}" SelectionMode="{Binding SelMode}"/>
|
||||||
<Button Margin="167,25,9.6,0" Content="Aceptar" Opacity="0.75" Click="Button_Click"/>
|
<Button Margin="167,25,9.6,0" Content="Aceptar" Opacity="0.75" Click="Button_Click"/>
|
||||||
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,8 @@ using System.Windows.Navigation;
|
||||||
using System.Windows.Shapes;
|
using System.Windows.Shapes;
|
||||||
using OliviaAddInPro.Helper;
|
using OliviaAddInPro.Helper;
|
||||||
using ArcGIS.Core.Data;
|
using ArcGIS.Core.Data;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using ArcGIS.Desktop.Internal.Framework.Controls;
|
||||||
|
|
||||||
namespace OliviaAddInPro.View
|
namespace OliviaAddInPro.View
|
||||||
{
|
{
|
||||||
|
|
@ -24,6 +26,7 @@ namespace OliviaAddInPro.View
|
||||||
{
|
{
|
||||||
private bool ok = false;
|
private bool ok = false;
|
||||||
public FeatureClass fc = null;
|
public FeatureClass fc = null;
|
||||||
|
public string err_st = string.Empty;
|
||||||
public ProWndSelectFields()
|
public ProWndSelectFields()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
@ -33,7 +36,13 @@ namespace OliviaAddInPro.View
|
||||||
{
|
{
|
||||||
if(comboBoxFields.SelectedIndex>0)
|
if(comboBoxFields.SelectedIndex>0)
|
||||||
{
|
{
|
||||||
listBoxAttributes.ItemsSource = HelperGdb.GetAttributes(fc, comboBoxFields.SelectedItem.ToString());
|
ObservableCollection<string> attribs_st =
|
||||||
|
HelperGdb.GetAttributes(fc, comboBoxFields.SelectedItem.ToString()).Result;
|
||||||
|
if (attribs_st.Count==0)
|
||||||
|
{
|
||||||
|
OliviaGlob.ponMsg(HelperGdb.out_st, MessageType.Error);
|
||||||
|
}
|
||||||
|
listBoxAttributes.ItemsSource = attribs_st;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ using ArcGIS.Core.Data;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using ArcGIS.Desktop.Mapping;
|
using ArcGIS.Desktop.Mapping;
|
||||||
using ArcGIS.Desktop.Core;
|
using ArcGIS.Desktop.Core;
|
||||||
|
using ArcGIS.Desktop.Internal.Framework.Controls;
|
||||||
|
|
||||||
namespace OliviaAddInPro.View
|
namespace OliviaAddInPro.View
|
||||||
{
|
{
|
||||||
|
|
@ -24,7 +25,8 @@ namespace OliviaAddInPro.View
|
||||||
private string selField = string.Empty;
|
private string selField = string.Empty;
|
||||||
private bool multiSelAtt = true;
|
private bool multiSelAtt = true;
|
||||||
private string pathLyr = string.Empty;
|
private string pathLyr = string.Empty;
|
||||||
FeatureClass ftClass = null;
|
private FeatureClass ftClass = null;
|
||||||
|
public string err_st=string.Empty;
|
||||||
|
|
||||||
public bool res = false;
|
public bool res = false;
|
||||||
|
|
||||||
|
|
@ -34,11 +36,18 @@ namespace OliviaAddInPro.View
|
||||||
ftClass = fc;
|
ftClass = fc;
|
||||||
//pathLyr = it.Path;
|
//pathLyr = it.Path;
|
||||||
multiSelAtt = _multiSelAtt;
|
multiSelAtt = _multiSelAtt;
|
||||||
fields = HelperGdb.GetFields(fc);
|
fields = HelperGdb.GetFields(ftClass).Result;
|
||||||
attributes.Clear();
|
if (fields.Count == 0)
|
||||||
selAttributes.Clear();
|
{
|
||||||
selField = string.Empty;
|
OliviaGlob.ponMsg(HelperGdb.out_st, MessageType.Error);
|
||||||
muestra();
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
attributes.Clear();
|
||||||
|
selAttributes.Clear();
|
||||||
|
selField = string.Empty;
|
||||||
|
muestra();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
private void muestra()
|
private void muestra()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue