Probado ventana guardar nombre ftclass

Gerardo/Compilacion.net
Elena 2022-12-21 15:31:15 +01:00
parent 39757fce61
commit 31ded359f6
8 changed files with 27 additions and 157 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -148,9 +148,6 @@
<Compile Include="Model\TratamientoComun.cs" />
<Compile Include="Model\Limpieza.cs" />
<Compile Include="Model\LimpiezaDef.cs" />
<Compile Include="View\ProWindowSaveFileName.xaml.cs">
<DependentUpon>ProWindowSaveFileName.xaml</DependentUpon>
</Compile>
<Compile Include="Services\EjecServ.cs" />
<Compile Include="Model\OliviaConf.cs" />
<Compile Include="Model\OliviaDef.cs" />
@ -162,7 +159,6 @@
<Compile Include="Services\LimpiezaServ.cs" />
<Compile Include="Services\ProcesoEjecServ.cs" />
<Compile Include="Services\RecogidaServ.cs" />
<Compile Include="ViewModel\ShowProWindowSaveFileName.cs" />
<Compile Include="ViewModel\Comun\MarchandoUnaDeViewModel.cs" />
<Compile Include="ViewModel\Configuracion\DockpaneConfigViewModel.cs" />
<Compile Include="ViewModel\Configuracion\PaneConfigViewModel.cs" />
@ -256,10 +252,6 @@
<Resource Include="OliviaIconPro.ico" />
</ItemGroup>
<ItemGroup>
<Page Include="View\ProWindowSaveFileName.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="View\Comun\MarchandoUnaDe.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@ -381,12 +373,6 @@
<ItemGroup>
<Resource Include="Images\help16Pro.png" />
</ItemGroup>
<ItemGroup>
<AddInContent Include="Images\GenericButtonPurple16.png" />
</ItemGroup>
<ItemGroup>
<AddInContent Include="Images\GenericButtonPurple32.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!--
PackageAction can be:

View File

@ -10,6 +10,7 @@ using OliviaAddInPro.Helper;
using ArcGIS.Core.Internal.Data;
using ArcGIS.Desktop.Framework.Threading.Tasks;
using System.Windows;
using System.IO;
namespace OliviaAddInPro.Services
{
@ -615,10 +616,10 @@ namespace OliviaAddInPro.Services
/**
* Realiza las funciones de importación de la sectorización
*/
public Respuesta<string> ImportSecto(string GdbFileName)
public Respuesta<string> ImportSecto(string GdbFileName, string FtClssName)
{
com.ProgrSrc.IncMessage(10,"Importando capas");
var res = Import(GdbFileName, 0);
var res = Import(GdbFileName, 0, FtClssName);
if (res.HasError || string.IsNullOrEmpty(res.Value))
{
return res;
@ -644,10 +645,10 @@ namespace OliviaAddInPro.Services
/**
* Realiza las funciones de importación de la planificación
*/
public Respuesta<string> ImportPlanif(string GdbFileName)
public Respuesta<string> ImportPlanif(string GdbFileName, string FtClssName)
{
com.ProgrSrc.IncMessage(10, "Importando capas");
var res = Import(GdbFileName, 1);
var res = Import(GdbFileName, 1, FtClssName);
if (res.HasError || string.IsNullOrEmpty(res.Value))
{
res.Value = string.Empty;
@ -703,7 +704,7 @@ namespace OliviaAddInPro.Services
/**
* Realiza las funciones de importación, modo 0 secto, modo 1 planif
*/
public Respuesta<string> Import(string GdbFileName, int modo)
public Respuesta<string> Import(string GdbFileName, int modo, string FtClssName="")
{
var res = new Respuesta<string> { Value = string.Empty };
@ -755,11 +756,13 @@ namespace OliviaAddInPro.Services
/////////////////////////////////////////
//no tiene un dataset configurado, saca ventana para elegir uno
//saca ventana para elegir Dataset, si se cancela, se guarda en el nombre por defecto en función del tratamiento y los ámbitos
HelperGlobal.ponMsg("A continuación, introduzca nombre de Feature Class y ubicación (Dataset) para importación. Si cancela el proceso, se establecerán el nombre y Dataset por defecto en función de los ámbitos y el tratamiento");
string path_aux = HelperGdb.SaveFileDlg("Introduzca nombre de Feature Class a importar", GdbFileName, null, ArcGIS.Desktop.Catalog.ItemFilters.featureClasses_all);
//HelperGlobal.ponMsg("A continuación, introduzca nombre de Feature Class y ubicación (Dataset) para importación. Si cancela el proceso, se establecerán el nombre y Dataset por defecto en función de los ámbitos y el tratamiento");
string path_aux = FtClssName;
//HelperGdb.SaveFileDlg("Introduzca nombre de Feature Class a importar", GdbFileName, null, ArcGIS.Desktop.Catalog.ItemFilters.featureClasses_all);
if (!string.IsNullOrEmpty(path_aux))
{
tratamiento = System.IO.Path.GetDirectoryName(path_aux);
tratamiento = new DirectoryInfo(System.IO.Path.GetDirectoryName(path_aux)).Name;
//tratamiento = System.IO.Path.GetFileName(System.IO.Path.GetDirectoryName(path_aux));
amb_aux = System.IO.Path.GetFileNameWithoutExtension(path_aux);
//comprueba si ya existe ese ft class
FeatureClass ft = HelperGdb.GetFtClass(path_aux);
@ -790,6 +793,10 @@ namespace OliviaAddInPro.Services
//HelperGlobal.ponMsg(err_spatref +", se ha creado un nuevo dataset "+ datasetNameOut );
tratamiento = datasetNameOut;
}
//avisa ahora para dar tiempo?
if (!string.IsNullOrEmpty(msg_avisa))
HelperGlobal.ponMsg(msg_avisa);
string dataset = tratamiento;
/////////////////////////////////////////
if (!string.IsNullOrEmpty(amb_aux))
@ -884,9 +891,6 @@ namespace OliviaAddInPro.Services
res.Error.Add("Errores en la importación: "+err_st);
return res;
}
//avisa ahora para dar tiempo?
if(!string.IsNullOrEmpty(msg_avisa))
HelperGlobal.ponMsg(msg_avisa);
//cambia el nombre de los campos que había truncado a 10 caracteres al exportar a shp
//solo para la capa original

View File

@ -42,7 +42,8 @@ namespace OliviaAddInPro.Services
//actualiza los flags
OliviaGlob.RemoveFlagTipEjec(TiposEjecucion.FinEjecOk);
//importa resultados
resp = IniImport();
string FtClssName = "";
resp = IniImport(out FtClssName);
if (resp.HasError)
{
msg = resp.Error.First();
@ -59,7 +60,7 @@ namespace OliviaAddInPro.Services
//actualiza los flags
//OliviaGlob.RemoveFlagTipEjec(TiposEjecucion.EjecSecto);
//acciones de importación
resp2 = inst.ServCom.ImportSecto(GdbFileName);
resp2 = inst.ServCom.ImportSecto(GdbFileName, FtClssName);
}
else if (OliviaGlob.HasFlagTipEjec(TiposEjecucion.EjecPlanif)) //Ha terminado bien la planificación
{
@ -68,7 +69,7 @@ namespace OliviaAddInPro.Services
//guarda csv
//GuardaCsv(inst); en finEjecuta3
//acciones de importación
resp2 = inst.ServCom.ImportPlanif(GdbFileName);
resp2 = inst.ServCom.ImportPlanif(GdbFileName, FtClssName);
}
Application.Current.Dispatcher.BeginInvoke(new Action<Respuesta<string>, Respuesta<string>, bool, string, TratamientoComun>((p, v, x, u, w) => finEjecuta3(p, v, x, u, w)), resp, resp2, mal, msg, inst);
@ -246,9 +247,10 @@ namespace OliviaAddInPro.Services
/*
* Inicializa la importación
*/
public Respuesta<string> IniImport()
public Respuesta<string> IniImport(out string FtClssName)
{
var res = new Respuesta<string>() { Value = string.Empty };
FtClssName = string.Empty;
//Lanza ventana para elegir gdb a la que importar resultados
string GdbFileName="";
if (OliviaGlob.CompruebaExistePath(OliviaGlob.Paths.PathGdbImport))
@ -273,6 +275,12 @@ namespace OliviaAddInPro.Services
return res;
}
res.Value = GdbFileName;
if (string.IsNullOrEmpty(OliviaGlob.Paths.PathDatasetImport))
{ //ahora pide elegir nombre de ftclass
FtClssName = HelperGdb.SaveFileDlg("Seleccione ubicación e introduzca nombre de Feature Class a importar", GdbFileName, null, ArcGIS.Desktop.Catalog.ItemFilters.featureClasses_all);
}
return res;
}
}

View File

@ -1,24 +0,0 @@
<controls:ProWindow x:Class="OliviaAddInPro.ProWindowSaveFileName"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:controls="clr-namespace:ArcGIS.Desktop.Framework.Controls;assembly=ArcGIS.Desktop.Framework"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:extensions="clr-namespace:ArcGIS.Desktop.Extensions;assembly=ArcGIS.Desktop.Extensions"
mc:Ignorable="d"
Title="Guardar elemento como..." Height="145.946" Width="544.144"
WindowStartupLocation="CenterOwner" Closed="ProWindow_Closed" Closing="ProWindow_Closing"
>
<controls:ProWindow.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<extensions:DesignOnlyResourceDictionary Source="pack://application:,,,/ArcGIS.Desktop.Framework;component\Themes\Default.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</controls:ProWindow.Resources>
<StackPanel Height="108" VerticalAlignment="Top" Margin="0,0,2,0">
<TextBox HorizontalAlignment="Left" Height="35" Margin="20,8,0,0" TextWrapping="Wrap" Text="{Binding Path=Texto, Mode = TwoWay}" VerticalAlignment="Top" Width="491" KeyUp="TextBox_KeyUp"/>
<Button Content="Guardar" HorizontalAlignment="Left" Height="35" Margin="387,20,0,0" Width="124" Click="Button_Click"/>
</StackPanel>
</controls:ProWindow>

View File

@ -1,57 +0,0 @@
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;
namespace OliviaAddInPro
{
/// <summary>
/// Interaction logic for ProWindowSaveFileName.xaml
/// </summary>
public partial class ProWindowSaveFileName : ArcGIS.Desktop.Framework.Controls.ProWindow
{
private bool ok = false;
public ProWindowSaveFileName()
{
InitializeComponent();
}
private void Button_Click(object sender, RoutedEventArgs e)
{
ok = true;
Close();
}
private void ProWindow_Closed(object sender, EventArgs e)
{
}
private void ProWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
if (ok)
DialogResult = true;
else
DialogResult = false;
}
private void TextBox_KeyUp(object sender, KeyEventArgs e)
{
if(e.Key==Key.Enter)
{
ok = true;
Close();
}
}
}
}

View File

@ -1,47 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ArcGIS.Desktop.Framework;
using ArcGIS.Desktop.Framework.Contracts;
namespace OliviaAddInPro
{
internal class ShowProWindowSaveFileName : Button
{
private ProWindowSaveFileName _prowindowsavefilename = null;
private string texto;
public string Texto
{
get { return texto; }
set { base.SetProperty(ref texto, value, () => Texto); }
}
public ShowProWindowSaveFileName(string text_in)
{
Texto = text_in;
crea();
}
public string GetName()
{
bool? res = _prowindowsavefilename.ShowDialog();
if (res ?? true)
{
return Texto;
}
return string.Empty;
}
private void crea()
{
//already open?
if (_prowindowsavefilename != null)
return;
_prowindowsavefilename = new ProWindowSaveFileName();
_prowindowsavefilename.Owner = FrameworkApplication.Current.MainWindow;
}
}
}