144 lines
4.6 KiB
Plaintext
144 lines
4.6 KiB
Plaintext
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows;
|
|
using System.Windows.Controls;
|
|
using System.Windows.Data;
|
|
using System.Windows.Documents;
|
|
using System.Windows.Input;
|
|
using System.Windows.Media;
|
|
using System.Windows.Media.Imaging;
|
|
using System.Windows.Navigation;
|
|
using System.Windows.Shapes;
|
|
using ArcGIS.Core.Data;
|
|
using ArcGIS.Desktop.Core;
|
|
using OliviaAddInPro.Helper;
|
|
using OliviaAddInPro.View;
|
|
using OliviaAddInPro.Model;
|
|
using ArcGIS.Core.Geometry;
|
|
using ArcGIS.Desktop.Mapping;
|
|
using ArcGIS.Desktop.Internal.Framework.Controls;
|
|
|
|
namespace OliviaAddInPro
|
|
{
|
|
/// <summary>
|
|
/// Interaction logic for PaneRecogidaSub2View.xaml
|
|
/// </summary>
|
|
public partial class PaneRecogidaSub2View : UserControl
|
|
{
|
|
public PaneRecogidaSub2View()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
/*
|
|
private void TextBox_PreviewTextInput(object sender, TextCompositionEventArgs e)
|
|
{
|
|
e.Handled = !PanelGlobal.IsValid(((TextBox)sender).Text + e.Text,0,9999);
|
|
}
|
|
|
|
/*
|
|
* Saca ventana para seleccionar el campo del que leer para elegir la geometría
|
|
*
|
|
private ArcGIS.Core.Geometry.Geometry SelecLeeGeom(FeatureClass fc, out string _texto, bool multisel)
|
|
{
|
|
ArcGIS.Core.Geometry.Geometry geomsal = null;
|
|
string texto = "";
|
|
|
|
if (fc != null)
|
|
{
|
|
//saca la ventana de selección de campo
|
|
ShowProWndSelectFields selfwnd = new ShowProWndSelectFields(fc, multisel);
|
|
if (selfwnd.SelFieldVals.Count > 0)
|
|
{
|
|
geomsal = HelperGdb.GetGeomSel(fc, selfwnd.SelField, selfwnd.SelFieldVals).Result;
|
|
texto = HelperGdb.TextoSal;
|
|
}
|
|
}
|
|
|
|
_texto = texto;
|
|
return geomsal;
|
|
}
|
|
|
|
private ArcGIS.Core.Geometry.Geometry AbreGeom(out string texto)
|
|
{
|
|
//inicialmente
|
|
ArcGIS.Core.Geometry.Geometry geom = null;
|
|
texto = Resource1.String_selec_capa;
|
|
|
|
//abre
|
|
FeatureClass fc = HelperGdb.OpenFtClassDialog(HelperGdb.TiposOpenFileDlg.OpenFtrClassPolygon);
|
|
if (fc != null)
|
|
{
|
|
//hace geom
|
|
geom = SelecLeeGeom(fc, out texto, true);
|
|
if (geom == null && (HelperGdb.OutStr.Length > 0))
|
|
HelperGlobal.ponMsg(HelperGdb.OutStr, System.Windows.MessageBoxImage.Error);
|
|
|
|
HelperGdb.Free(fc);
|
|
}
|
|
return geom;
|
|
}
|
|
|
|
private void button_caparestr_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
string texto = "";
|
|
ArcGIS.Core.Geometry.Geometry geom = AbreGeom(out texto);
|
|
if (DataContext is PaneLimpiezaSub2ViewModel mod)
|
|
{
|
|
mod.GeomRestr = geom;
|
|
}
|
|
if (geom != null)
|
|
label_caparestr.Content = texto;
|
|
else
|
|
label_caparestr.Content =Resource1.String_selec_capa;
|
|
}
|
|
|
|
private void button_capaniv_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
string texto = "";
|
|
ArcGIS.Core.Geometry.Geometry geom = AbreGeom(out texto);
|
|
if (DataContext is PaneLimpiezaSub2ViewModel mod)
|
|
{
|
|
mod.GeomNiv = geom;
|
|
}
|
|
if (geom != null)
|
|
label_capaniv.Content = texto;
|
|
else
|
|
label_capaniv.Content = Resource1.String_selec_capa;
|
|
}
|
|
|
|
private void button_capazon_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
string texto = "";
|
|
ArcGIS.Core.Geometry.Geometry geom = AbreGeom(out texto);
|
|
if (DataContext is PaneLimpiezaSub2ViewModel mod)
|
|
{
|
|
mod.GeomZon = geom;
|
|
}
|
|
|
|
if (geom != null)
|
|
label_capazon.Content = texto;
|
|
else
|
|
label_capazon.Content = Resource1.String_selec_capa;
|
|
}
|
|
|
|
private void button_capainst_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
string texto = "";
|
|
|
|
ArcGIS.Core.Geometry.Geometry geomsal = AbreGeom(out texto);
|
|
|
|
if ((DataContext is PaneLimpiezaSub2ViewModel mod) && geomsal != null && geomsal is MapPoint mp)
|
|
{
|
|
mod.CoordsInstal = mp.Coordinate2D;
|
|
}
|
|
if (geomsal != null)
|
|
label_capainst.Content = texto;
|
|
else
|
|
label_capainst.Content = Resource1.String_selec_capa;
|
|
}*/
|
|
}
|
|
}
|