Algunas modificaciones finales

Elena/develop
Elena 2022-07-04 15:48:40 +02:00
parent 83d5231ab4
commit 28cdbeeab5
23 changed files with 325 additions and 110 deletions

View File

@ -1,11 +1,11 @@
<ArcGIS defaultAssembly="OliviaAddInPro.dll" defaultNamespace="OliviaAddInPro" xmlns="http://schemas.esri.com/DADF/Registry" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schemas.esri.com/DADF/Registry file:///C:/Program%20Files/ArcGIS/Pro/bin/ArcGIS.Desktop.Framework.xsd"> <ArcGIS defaultAssembly="OliviaAddInPro.dll" defaultNamespace="OliviaAddInPro" xmlns="http://schemas.esri.com/DADF/Registry" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schemas.esri.com/DADF/Registry file:///C:/Program%20Files/ArcGIS/Pro/bin/ArcGIS.Desktop.Framework.xsd">
<AddInInfo id="{10742570-cf59-42f2-bea2-2a38002a06ee}" version="1.0" desktopVersion="2.8.29751"> <AddInInfo id="{10742570-cf59-42f2-bea2-2a38002a06ee}" version="3.0" desktopVersion="2.8.29751">
<Name>OliviaAddInPro</Name> <Name>OliviaAddInPro</Name>
<Description>AddIn de Optimización de la Limpieza Viaria para ArcGIs Pro</Description> <Description>AddIn de Optimización de la Limpieza Viaria para ArcGIs Pro</Description>
<Image>Images\AddinDesktop32.png</Image> <Image>Images\AddinDesktop32.png</Image>
<Author>VSM</Author> <Author>VSM</Author>
<Company>VSM - Narvaling</Company> <Company>VSM - Narvaling</Company>
<Date>08/07/2021 12:28:02, 2021</Date> <Date>08/07/2022 12:00:00, 2022</Date>
<Subject>Framework</Subject> <Subject>Framework</Subject>
<!-- Note subject can be one or more of these topics: <!-- Note subject can be one or more of these topics:
Content, Framework, Editing, Geodatabase, Geometry, Geoprocessing, Layouts, Map Authoring, Map Exploration --> Content, Framework, Editing, Geodatabase, Geometry, Geoprocessing, Layouts, Map Authoring, Map Exploration -->

View File

@ -2043,31 +2043,44 @@ namespace OliviaAddInPro.Helper
return res; return res;
} }
//comprueba si extiste ya el dataset //comprueba si extiste ya el dataset
bool repite = false;
bool crea = false;
int idat = 1;
int r = 2;
while(r==2)
{
var task1 = CheckDataset(gdb, datasetName); var task1 = CheckDataset(gdb, datasetName);
task1.Wait(); task1.Wait();
if (task1.Result) if (task1.Result)
{ {
//comprueba si tiene la misma referencia espacial //comprueba si tiene la misma referencia espacial
var r = CheckSpatRefDataset(gdb, datasetName, spatref).Result; r = CheckSpatRefDataset(gdb, datasetName, spatref).Result;
if (r==0) if (r == 0)
{ {
res.Value = 0; //no hay nada que crear, existe y coincide la spatial ref res.Value = 0; //no hay nada que crear, existe y coincide la spatial ref
return res; //return res;
} }
else if(r==2) else if (r == 2)
{ {
//existe ese nombre, pero con otra ref espacial
//crea un nuevo dataset y avisa //crea un nuevo dataset y avisa
datasetName = datasetName + "_1"; datasetName = string.Format("{0}_{1}",datasetName,idat);
datasetNameOut = datasetName; datasetNameOut = datasetName;
idat++;
} }
else else//r==1
{ {
//ha dado error al comprobar //ha dado error al comprobar
res.Value = 1; res.Value = 1;
res.Error.Add("Errores al crear el Dataset " + datasetName); res.Error.Add("Errores al crear el Dataset " + datasetName);
//return res;
}
}
else
r = 3; //no existe, lo crea con ese nombre
};
if (r!=3)
return res; return res;
}
}
//no existe, lo crea //no existe, lo crea
var task = ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run((Func<Respuesta<bool>>)(() => var task = ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run((Func<Respuesta<bool>>)(() =>
{ {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

BIN
Images/help16Pro.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -148,18 +148,39 @@ namespace OliviaAddInPro.Model
} }
/** /**
* Restaura el nombre original del campo si se ha truncado a 10 car al exportar a shp * Devuelve los campos característicos de la capa
*/ */
public override string[] GetCamposRestaura() public override string[] GetCampos(string capa=null)
{ {
string[] camps = { string[] camps=null;
LimpiezaDef.Campos.consulta_entidad, var capa_ = !string.IsNullOrEmpty(capa) ? capa : CapaElems;
LimpiezaDef.Campos.consulta_mecan, if (string.IsNullOrEmpty(capa_))
LimpiezaDef.Campos.consulta_observ, {
LimpiezaDef.Campos.consulta_anch_tip, ErrStr = "Error al comprobar campos en la capa.";
LimpiezaDef.Campos.consulta_tipolo, return camps;
/*LimpiezaDef.Campos.consulta_sector, }
LimpiezaDef.Campos.consulta_secuen */}; GeometryType tipo = HelperGdb.GetGeomType(capa_);
if (tipo == GeometryType.Polyline)
{
int NCAMPS = 5;
camps = new string[NCAMPS];
camps[0] = LimpiezaDef.Campos.consulta_entidad;
camps[1] = LimpiezaDef.Campos.consulta_mecan;
camps[2] = LimpiezaDef.Campos.consulta_observ;
camps[3] = LimpiezaDef.Campos.consulta_anch_tip;
camps[4] = LimpiezaDef.Campos.consulta_tipolo;
}
else if (tipo == GeometryType.Point)//es mobiliario, con el tipo vale
{
int NCAMPS = 1;
camps = new string[NCAMPS];
camps[0] = LimpiezaDef.Campos.consulta_entidad;
}
else
{
ErrStr = "Error al comprobar campos en la capa.";
}
return camps; return camps;
} }
} }

View File

@ -99,6 +99,9 @@ namespace OliviaAddInPro.Model
[Browsable(false)] [Browsable(false)]
public string path_exe { get; set; } public string path_exe { get; set; }
[Browsable(false)]
public string path_manual { get; set; }
[Browsable(false)] [Browsable(false)]
public string path_temp { get; set; } public string path_temp { get; set; }
@ -234,6 +237,20 @@ namespace OliviaAddInPro.Model
[DisplayName("Campo Secuencia")] [DisplayName("Campo Secuencia")]
[Description("Nombre del campo Secuencia donde se indica el orden en que se trata el ámbito dentro de su sector")] [Description("Nombre del campo Secuencia donde se indica el orden en que se trata el ámbito dentro de su sector")]
public string consulta_secuen { get; set; } public string consulta_secuen { get; set; }
[Category("General")]
[PropertyOrder(5)]
[DisplayName("GDB para Importación")]
[Description("Gdb en la que se importarán los resultados de la ejecución")]
[Editor(typeof(PropertyGridFilePickerGDB), typeof(PropertyGridFilePickerGDB))]
public string Path_Gdb_Import { get; set; }
[Category("General")]
[PropertyOrder(5)]
[DisplayName("Carpeta para listados (CSV)")]
[Description("Carpeta en la que se guardarán los listados en CSV de la planificación")]
[Editor(typeof(PropertyGridFilePickerFolder), typeof(PropertyGridFilePickerFolder))]
public string Path_Guarda_Csv { get; set; }
#endregion #endregion
#region 02CamposLimp #region 02CamposLimp

View File

@ -12,6 +12,7 @@ using OliviaAddInPro.Helper;
using System.Net; using System.Net;
using System.Net.Sockets; using System.Net.Sockets;
using System.IO; using System.IO;
using System.Diagnostics;
namespace OliviaAddInPro.Model namespace OliviaAddInPro.Model
{ {
@ -45,6 +46,7 @@ namespace OliviaAddInPro.Model
public static string PathWork; //<Path del directorio de trabajo public static string PathWork; //<Path del directorio de trabajo
public static string PathCfg; //<Path de la configuración general public static string PathCfg; //<Path de la configuración general
public static string PathExeOlivia; //<Path del ejecutable de OliviaTask public static string PathExeOlivia; //<Path del ejecutable de OliviaTask
public static string PathManualOlivia; //<Path del Manual de Olivia
public static string PathTemp; //<Path temporal de generación de archivos intermedios public static string PathTemp; //<Path temporal de generación de archivos intermedios
public static string DirData; //<Dir donde están los shapefiles data y nw public static string DirData; //<Dir donde están los shapefiles data y nw
public static string PathData; //<Path del shp con datos a planificar, ya filtrados e intersecados con las zonas y niveles public static string PathData; //<Path del shp con datos a planificar, ya filtrados e intersecados con las zonas y niveles
@ -55,6 +57,10 @@ namespace OliviaAddInPro.Model
public static string PathGdbNw; //<Path de la gdb referente a la red de carreteras de TOMTOM public static string PathGdbNw; //<Path de la gdb referente a la red de carreteras de TOMTOM
public static string PathSimbVSM; //<Path de la galeria de estilos aplicada por VSM public static string PathSimbVSM; //<Path de la galeria de estilos aplicada por VSM
public static string PathSimbESRI; //<Path de la galeria de estilos de ESRI public static string PathSimbESRI; //<Path de la galeria de estilos de ESRI
//paths import
public static string PathGdbImport; //<Path de la gdb en la que se guardan los resultados
public static string PathGuardCsv; //<Path para guardar CSV de la planificación
}; };
public struct Conexion public struct Conexion
{ {
@ -228,8 +234,6 @@ namespace OliviaAddInPro.Model
DockpaneRecogidaViewModel.Show(); DockpaneRecogidaViewModel.Show();
//SetFlagTipEjec(TiposEjecucion.Reco); //SetFlagTipEjec(TiposEjecucion.Reco);
ViewSetFlagTipEjec(TiposEjecucion.Reco); ViewSetFlagTipEjec(TiposEjecucion.Reco);
} }
else else
{ {
@ -243,8 +247,6 @@ namespace OliviaAddInPro.Model
DockpaneConfigViewModel.Show(); DockpaneConfigViewModel.Show();
SetFlagTipEjec(TiposEjecucion.Props); SetFlagTipEjec(TiposEjecucion.Props);
ViewSetFlagTipEjec(TiposEjecucion.Props); ViewSetFlagTipEjec(TiposEjecucion.Props);
} }
else else
{ {
@ -278,6 +280,22 @@ namespace OliviaAddInPro.Model
camps[3] = ComunDef.CamposNW.cons_fow; camps[3] = ComunDef.CamposNW.cons_fow;
return HelperGdb.CheckFileds(OliviaGlob.Paths.PathGdbNw, camps) == 0; return HelperGdb.CheckFileds(OliviaGlob.Paths.PathGdbNw, camps) == 0;
} }
/**
* Comprueba que no es null y existe
*/
public static bool CompruebaExistePath(string path)
{
if (string.IsNullOrEmpty(path))
return false;
var dir = Path.GetDirectoryName(path);
if (string.IsNullOrEmpty(dir) || !Directory.Exists(path))
return false;
return true;
}
/** /**
* Devuelve una lista de las ips locales * Devuelve una lista de las ips locales
*/ */
@ -362,20 +380,45 @@ namespace OliviaAddInPro.Model
} }
} }
/**
* Abre el pdf del manual de ayuda
*/
public static void OpenManual()
{
string[] archivos = null;
try
{
if (!File.Exists(OliviaGlob.Paths.PathManualOlivia))
HelperGlobal.ponMsg("No se encuentra el archivo " + OliviaGlob.Paths.PathManualOlivia);
else
{
System.Diagnostics.Process.Start(OliviaGlob.Paths.PathManualOlivia);
}
}
catch (Exception)
{
HelperGlobal.ponMsg("Error al abrir el manual de ayuda " + OliviaGlob.Paths.PathManualOlivia);
return;
}
}
/** /**
* Inicializa los nombres por defecto de las variables, para debug por si no hay instalador * Inicializa los nombres por defecto de las variables, para debug por si no hay instalador
*/ */
public static void IniDefault() public static void IniDefault()
{ {
var c = ConfigServ.Serv.Leer(); var c = ConfigServ.Serv.Leer();
Paths.PathCfg = ""; Paths.PathCfg = "";
Paths.PathWork = c.path_work; Paths.PathWork = c.path_work;
Paths.PathExeOlivia = c.path_exe; Paths.PathExeOlivia = c.path_exe;
Paths.PathManualOlivia = c.path_manual;
Paths.DirData = c.path_data; Paths.DirData = c.path_data;
Paths.PathTemp = c.path_temp; Paths.PathTemp = c.path_temp;
c.PathCartela = c.PathCartela; c.PathCartela = c.PathCartela;
Paths.PathGdbImport = c.Path_Gdb_Import;
Paths.PathGuardCsv = c.Path_Guarda_Csv;
HelperGlobal.create_folder(Paths.DirData); HelperGlobal.create_folder(Paths.DirData);
HelperGlobal.create_folder(Paths.PathTemp); HelperGlobal.create_folder(Paths.PathTemp);

View File

@ -157,9 +157,9 @@ namespace OliviaAddInPro.Model
} }
/** /**
* Restaura el nombre original del campo si se ha truncado a 10 car al exportar a shp * Devuelve los campos característicos de la capa
*/ */
public override string[] GetCamposRestaura() public override string[] GetCampos(string capa=null)
{ {
string[] camps = { string[] camps = {
RecogidaDef.campos_def.cons_id, RecogidaDef.campos_def.cons_id,

View File

@ -197,7 +197,7 @@ namespace OliviaAddInPro.Model
/** /**
* Restaura el nombre original del campo si se ha truncado a 10 car al exportar a shp * Restaura el nombre original del campo si se ha truncado a 10 car al exportar a shp
*/ */
public virtual string[] GetCamposRestaura() public virtual string[] GetCampos(string capa=null)
{ {
return null; return null;
} }
@ -213,7 +213,7 @@ namespace OliviaAddInPro.Model
if (fc == null) if (fc == null)
return resp; return resp;
//////////////////////////////////////////////////////// ////////////////////////////////////////////////////////
string[] camps = GetCamposRestaura(); string[] camps = GetCampos();
ObservableCollection<string> fields = HelperGdb.GetFieldsSync(fc); ObservableCollection<string> fields = HelperGdb.GetFieldsSync(fc);
HelperGdb.Free(fc); HelperGdb.Free(fc);

View File

@ -173,6 +173,9 @@
<Compile Include="View\Comun\MarchandoUnaDe.xaml.cs"> <Compile Include="View\Comun\MarchandoUnaDe.xaml.cs">
<DependentUpon>MarchandoUnaDe.xaml</DependentUpon> <DependentUpon>MarchandoUnaDe.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="View\Configuracion\PropertyGridFilePickerFolder.xaml.cs">
<DependentUpon>PropertyGridFilePickerFolder.xaml</DependentUpon>
</Compile>
<Compile Include="View\Configuracion\PropertyGridFilePickerLine.xaml.cs"> <Compile Include="View\Configuracion\PropertyGridFilePickerLine.xaml.cs">
<DependentUpon>PropertyGridFilePickerLine.xaml</DependentUpon> <DependentUpon>PropertyGridFilePickerLine.xaml</DependentUpon>
</Compile> </Compile>
@ -250,6 +253,10 @@
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</Page> </Page>
<Page Include="View\Configuracion\PropertyGridFilePickerFolder.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="View\Configuracion\PropertyGridFilePickerLine.xaml"> <Page Include="View\Configuracion\PropertyGridFilePickerLine.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType> <SubType>Designer</SubType>
@ -323,9 +330,6 @@
<LastGenOutput>Resource1.Designer.cs</LastGenOutput> <LastGenOutput>Resource1.Designer.cs</LastGenOutput>
</EmbeddedResource> </EmbeddedResource>
</ItemGroup> </ItemGroup>
<ItemGroup>
<AddInContent Include="Images\config.png" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<AddInContent Include="DarkImages\GenericButtonGreen16.png" /> <AddInContent Include="DarkImages\GenericButtonGreen16.png" />
</ItemGroup> </ItemGroup>
@ -351,7 +355,6 @@
<Resource Include="Images\openfolder.png" /> <Resource Include="Images\openfolder.png" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<AddInContent Include="Images\config2.png" />
<AddInContent Include="Images\reco2.png" /> <AddInContent Include="Images\reco2.png" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@ -360,6 +363,9 @@
<ItemGroup> <ItemGroup>
<AddInContent Include="Images\config2_olv.png" /> <AddInContent Include="Images\config2_olv.png" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Resource Include="Images\help16Pro.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- <!--
PackageAction can be: PackageAction can be:

View File

@ -8,9 +8,9 @@ using System.Runtime.InteropServices;
[assembly: AssemblyTitle("OliviaAddInPro")] [assembly: AssemblyTitle("OliviaAddInPro")]
[assembly: AssemblyDescription("")] [assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Acme")] [assembly: AssemblyCompany("VSM - Narvaling")]
[assembly: AssemblyProduct("OliviaAddInPro")] [assembly: AssemblyProduct("OliviaAddInPro")]
[assembly: AssemblyCopyright("Copyright © Acme 2021")] [assembly: AssemblyCopyright("Copyright © VSM 2022")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]
@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyVersion("3.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyFileVersion("3.0.0.0")]

View File

@ -15,7 +15,9 @@ namespace OliviaAddInPro.Services
private static string pathConfigDef = "C:\\Olivia\\olv.conf"; private static string pathConfigDef = "C:\\Olivia\\olv.conf";
private static ConfigServ configServ=null; private static ConfigServ configServ=null;
private static string nameDirWork = "%dir_work%"; private static string nameDirWork = "%dir_work%";
public const string OlvRegKey = "SOFTWARE\\Narvaling\\Olivia"; public const string OlvRegKey = "SOFTWARE\\Narvaling\\Olivia_3_0";
public const string OlvRegName = "workdir";
public const string OlvConfigName = "olv.conf";
public static ConfigServ Serv public static ConfigServ Serv
{ {
@ -28,10 +30,12 @@ namespace OliviaAddInPro.Services
public OliviaConf Leer() public OliviaConf Leer()
{ {
OliviaConf res = null; OliviaConf res = Default();
try try
{ {
res= JsonConvert.DeserializeObject<OliviaConf>(File.ReadAllText(GetPathConfig())); var path_cfg = GetPathConfig();
path_cfg = Path.Combine(path_cfg, OlvConfigName);
res = JsonConvert.DeserializeObject<OliviaConf>(File.ReadAllText(path_cfg));
}catch(Exception e) }catch(Exception e)
{ {
var ee = e; var ee = e;
@ -49,6 +53,7 @@ namespace OliviaAddInPro.Services
res.path_exe = pon_path_absoluto(res.path_exe, res.path_work); res.path_exe = pon_path_absoluto(res.path_exe, res.path_work);
res.path_manual = pon_path_absoluto(res.path_manual, res.path_work);
res.path_temp = pon_path_absoluto(res.path_temp, res.path_work); res.path_temp = pon_path_absoluto(res.path_temp, res.path_work);
res.path_data = pon_path_absoluto(res.path_data, res.path_work); res.path_data = pon_path_absoluto(res.path_data, res.path_work);
return res; return res;
@ -57,6 +62,7 @@ namespace OliviaAddInPro.Services
public void Guardar(OliviaConf conf) public void Guardar(OliviaConf conf)
{ {
conf.path_exe = pon_path_relativo(conf.path_exe, conf.path_work); conf.path_exe = pon_path_relativo(conf.path_exe, conf.path_work);
conf.path_manual = pon_path_relativo(conf.path_manual, conf.path_work);
conf.path_temp = pon_path_relativo(conf.path_temp, conf.path_work); conf.path_temp = pon_path_relativo(conf.path_temp, conf.path_work);
conf.path_data = pon_path_relativo(conf.path_data, conf.path_work); conf.path_data = pon_path_relativo(conf.path_data, conf.path_work);
@ -67,10 +73,13 @@ namespace OliviaAddInPro.Services
conf.Path_Eje_via = pon_path_relativo(conf.Path_Eje_via, conf.path_work); conf.Path_Eje_via = pon_path_relativo(conf.Path_Eje_via, conf.path_work);
string jsonString = JsonConvert.SerializeObject(conf); string jsonString = JsonConvert.SerializeObject(conf);
File.WriteAllText(GetPathConfig(), jsonString); var path_cfg = GetPathConfig();
path_cfg = Path.Combine(path_cfg, OlvConfigName);
File.WriteAllText(path_cfg, jsonString);
conf.path_exe = pon_path_absoluto(conf.path_exe, conf.path_work); conf.path_exe = pon_path_absoluto(conf.path_exe, conf.path_work);
conf.path_temp = pon_path_absoluto(conf.path_temp, conf.path_work); conf.path_temp = pon_path_absoluto(conf.path_temp, conf.path_work);
conf.path_manual = pon_path_absoluto(conf.path_manual, conf.path_work);
conf.path_data = pon_path_absoluto(conf.path_data, conf.path_work); conf.path_data = pon_path_absoluto(conf.path_data, conf.path_work);
conf.PathGdbGen = pon_path_absoluto(conf.PathGdbGen, conf.path_work); conf.PathGdbGen = pon_path_absoluto(conf.PathGdbGen, conf.path_work);
conf.PathSimbVSM = pon_path_absoluto(conf.PathSimbVSM, conf.path_work); conf.PathSimbVSM = pon_path_absoluto(conf.PathSimbVSM, conf.path_work);
@ -109,7 +118,7 @@ namespace OliviaAddInPro.Services
str = null; str = null;
if (rkprg.ValueCount > 0) if (rkprg.ValueCount > 0)
{ {
str = (String)rkprg.GetValue("path_cfg"); str = (String)rkprg.GetValue(OlvRegName);
if (!string.IsNullOrEmpty(str)) if (!string.IsNullOrEmpty(str))
return str; return str;
} }
@ -125,6 +134,7 @@ namespace OliviaAddInPro.Services
var path = GetPathConfig(); var path = GetPathConfig();
if(!string.IsNullOrEmpty(path)) if(!string.IsNullOrEmpty(path))
{ {
path = Path.Combine(path, OlvConfigName);
c.path_work = Path.GetDirectoryName(path) + "\\"; c.path_work = Path.GetDirectoryName(path) + "\\";
} }
@ -148,9 +158,12 @@ namespace OliviaAddInPro.Services
c.buffer_export = 1000; c.buffer_export = 1000;
c.path_exe=@"%dir_work%bin\OliviaTasks.exe"; c.path_exe=@"%dir_work%bin\OliviaTasks.exe";
c.path_manual= @"%dir_work%Manual_Olivia_3_0.pdf";
c.path_temp = @"%dir_work%temp\"; c.path_temp = @"%dir_work%temp\";
c.path_data=@"%dir_work%data\"; c.path_data=@"%dir_work%data\";
c.Path_Eje_via = @"%dir_work%Datos\gdbs\TomTom_Q4_2015.gdb\TomTom_Q4_2015___nw"; c.Path_Eje_via = @"%dir_work%Datos\gdbs\TomTom_Q4_2015.gdb\TomTom_Q4_2015___nw";
c.Path_Gdb_Import = "";
c.Path_Guarda_Csv = "";
/*c.eje_via = "TomTom_Q4_2015___nw"; /*c.eje_via = "TomTom_Q4_2015___nw";
c.municipios = "TomTom_Q4_2015___a8";*/ c.municipios = "TomTom_Q4_2015___a8";*/

View File

@ -692,7 +692,13 @@ namespace OliviaAddInPro.Services
string datasetNameOut = string.Empty; string datasetNameOut = string.Empty;
var resp = HelperGdb.CreateDataset(GdbFileName, tratamiento, spatRefData, out datasetNameOut); var resp = HelperGdb.CreateDataset(GdbFileName, tratamiento, spatRefData, out datasetNameOut);
string err_spatref = "Atención, no coincide la proyección de las FeatureClass del Dataset ya creado con la del FeatureClass a importar"; string err_spatref = "Atención, no coincide la proyección de las FeatureClass del Dataset ya creado con la del FeatureClass a importar";
if (resp.Value == 1) if(resp.Value==0)
{
//avisa
HelperGlobal.ponMsg("Se importan los archivos en "+ GdbFileName+"\\"+ datasetNameOut);
tratamiento = datasetNameOut;
}
else if (resp.Value == 1)
{ {
res.Error.Add("Error al crear el Dataset para importar " + tratamiento); res.Error.Add("Error al crear el Dataset para importar " + tratamiento);
return res; return res;
@ -790,7 +796,7 @@ namespace OliviaAddInPro.Services
resp2 = com.RestauraNomCampos(GdbFileName + "\\" + dataset + "\\" + noms_gdb[0]); resp2 = com.RestauraNomCampos(GdbFileName + "\\" + dataset + "\\" + noms_gdb[0]);
if (!resp2.Value) if (!resp2.Value)
{ {
err_st = "Error al renombrar campos " + noms_gdb[i]; err_st = "Error al renombrar campos " + noms_gdb[0];
if (resp2.HasError) if (resp2.HasError)
err_st += " " + resp2.Error.First(); err_st += " " + resp2.Error.First();
res.Error.Add("Errores en la importación: " + err_st); res.Error.Add("Errores en la importación: " + err_st);

View File

@ -212,7 +212,11 @@ namespace OliviaAddInPro.Services
out auxi, out nombre); out auxi, out nombre);
//string Path = HelperGdb.SaveFileDlg(Title, DirData, inst.ServCom.EXT_CSV, Filter); //string Path = HelperGdb.SaveFileDlg(Title, DirData, inst.ServCom.EXT_CSV, Filter);
string Path = HelperGdb.SaveFileDlg(Title, DirData, null, ArcGIS.Desktop.Catalog.ItemFilters.folders); string Path = string.Empty;
if (OliviaGlob.CompruebaExistePath(OliviaGlob.Paths.PathGuardCsv))
Path = OliviaGlob.Paths.PathGuardCsv;
else
Path = HelperGdb.SaveFileDlg(Title, DirData, null, ArcGIS.Desktop.Catalog.ItemFilters.folders);
if (string.IsNullOrEmpty(Path) || Path.Length == 0) if (string.IsNullOrEmpty(Path) || Path.Length == 0)
{ {
@ -238,18 +242,23 @@ namespace OliviaAddInPro.Services
{ {
var res = new Respuesta<string>() { Value = string.Empty }; var res = new Respuesta<string>() { Value = string.Empty };
//Lanza ventana para elegir gdb a la que importar resultados //Lanza ventana para elegir gdb a la que importar resultados
bool sal = true;
string GdbFileName=""; string GdbFileName="";
if (OliviaGlob.CompruebaExistePath(OliviaGlob.Paths.PathGdbImport))
GdbFileName = OliviaGlob.Paths.PathGdbImport;
else
{
bool sal = true;
do do
{ {
sal = true; sal = true;
//repite por si se ha equivocado hasta que elige la gdb //repite por si se ha equivocado hasta que elige la gdb
GdbFileName = HelperGdb.OpenFileDialog(HelperGdb.TiposOpenFileDlg.OpenGdb,"", "Seleccionar GDB a la que importar los resultados"); GdbFileName = HelperGdb.OpenFileDialog(HelperGdb.TiposOpenFileDlg.OpenGdb, "", "Seleccionar GDB a la que importar los resultados");
if(string.IsNullOrEmpty(GdbFileName))
sal= HelperGlobal.ponMsg("¿Desea cancelar el proceso de importación?", if (string.IsNullOrEmpty(GdbFileName))
sal = HelperGlobal.ponMsg("¿Desea cancelar el proceso de importación?",
MessageBoxImage.Question, "OLIVIA", MessageBoxButton.YesNo); MessageBoxImage.Question, "OLIVIA", MessageBoxButton.YesNo);
} while (!sal); } while (!sal);
}
if (string.IsNullOrEmpty(GdbFileName) || !Directory.Exists(GdbFileName)) if (string.IsNullOrEmpty(GdbFileName) || !Directory.Exists(GdbFileName))
{ {
res.Error.Add("Se ha cancelado la importación de resultados. Se cancela la elección de GDB."); res.Error.Add("Se ha cancelado la importación de resultados. Se cancela la elección de GDB.");

View File

@ -20,6 +20,8 @@ namespace OliviaAddInPro.Services
public LimpiezaServ(Limpieza _limp) public LimpiezaServ(Limpieza _limp)
{ {
if (_limp == null)
_limp = OliviaGlob.Limp;
limp = _limp; limp = _limp;
} }
/** /**
@ -147,33 +149,14 @@ namespace OliviaAddInPro.Services
*/ */
public bool CompruebaCamposLimp(string pathCapa) public bool CompruebaCamposLimp(string pathCapa)
{ {
string[] camps; string[] camps = limp.GetCampos(pathCapa);
GeometryType tipo = HelperGdb.GetGeomType(pathCapa); int res = 1;
if (tipo == GeometryType.Polyline) if ((camps == null) || (HelperGdb.CheckFileds(pathCapa, camps) != 0))
{ {
int NCAMPS = 5; ErrStr = HelperGdb.OutStr;
camps = new string[NCAMPS];
camps[0] = LimpiezaDef.Campos.consulta_entidad;
camps[1] = LimpiezaDef.Campos.consulta_mecan;
camps[2] = LimpiezaDef.Campos.consulta_observ;
camps[3] = LimpiezaDef.Campos.consulta_anch_tip;
camps[4] = LimpiezaDef.Campos.consulta_tipolo;
}
else if (tipo == GeometryType.Point)//es mobiliario, con el tipo vale
{
int NCAMPS = 1;
camps = new string[NCAMPS];
camps[0] = LimpiezaDef.Campos.consulta_entidad;
}
else
{
ErrStr = "Error al comprobar campos en la capa.";
return false; return false;
} }
int res = HelperGdb.CheckFileds(pathCapa, camps); return true;
if (res != 0)
ErrStr = HelperGdb.OutStr;
return res==0;
} }
/** /**
* Lee la gdb y devuelve el array de ámbitos en función de si hay en la gdb o no * Lee la gdb y devuelve el array de ámbitos en función de si hay en la gdb o no

View File

@ -17,6 +17,8 @@ namespace OliviaAddInPro.Services
public RecogidaServ(Recogida _reco) public RecogidaServ(Recogida _reco)
{ {
if (_reco == null)
_reco = OliviaGlob.Reco;
reco = _reco; reco = _reco;
} }

View File

@ -0,0 +1,14 @@
<UserControl x:Class="OliviaAddInPro.View.Configuracion.PropertyGridFilePickerFolder"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:OliviaAddInPro.View.Configuracion"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800"
x:Name="TheControl">
<DockPanel>
<Button x:Name="PickFileButton" Content="…" Click="PickFileButton_Click" DockPanel.Dock="Right" Width="15" />
<TextBox Text="{Binding ElementName=TheControl, Path=Value}" />
</DockPanel>
</UserControl>

View File

@ -0,0 +1,63 @@
using Microsoft.Win32;
using OliviaAddInPro.Helper;
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 Xceed.Wpf.Toolkit.PropertyGrid;
using Xceed.Wpf.Toolkit.PropertyGrid.Editors;
using static OliviaAddInPro.Helper.HelperGdb;
namespace OliviaAddInPro.View.Configuracion
{
/// <summary>
/// Lógica de interacción para PropertyGridFilePicker.xaml
/// </summary>
public partial class PropertyGridFilePickerFolder : ITypeEditor
{
public PropertyGridFilePickerFolder()
{
InitializeComponent();
}
public string Value
{
get { return (string)GetValue(ValueProperty); }
set { SetValue(ValueProperty, value); }
}
// Using a DependencyProperty as the backing store for Value. This enables animation, styling, binding, etc...
public static readonly DependencyProperty ValueProperty =
DependencyProperty.Register("Value", typeof(string), typeof(PropertyGridFilePickerFolder), new PropertyMetadata(null));
public FrameworkElement ResolveEditor(PropertyItem propertyItem)
{
Binding binding = new Binding("Value");
binding.Source = propertyItem;
binding.Mode = propertyItem.IsReadOnly ? BindingMode.OneWay : BindingMode.TwoWay;
BindingOperations.SetBinding(this, ValueProperty, binding);
return this;
}
private void PickFileButton_Click(object sender, RoutedEventArgs e)
{
OpenFileDialog fd = new OpenFileDialog();
var st = HelperGdb.SaveFileDlg("Seleccione carpeta", null, null, ArcGIS.Desktop.Catalog.ItemFilters.folders);
if (!string.IsNullOrEmpty(st))
{
Value = st;
}
}
}
}

View File

@ -77,5 +77,12 @@
</ContentPresenter.Content> </ContentPresenter.Content>
</ContentPresenter> </ContentPresenter>
</StackPanel> </StackPanel>
<StackPanel Grid.Row="3" Margin="0,70,10,0">
<Button x:Name="button_help" Content="" Margin="274,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Width="16" Height="16" BorderThickness="0" RenderTransformOrigin="16.875,0.375" Click="button_help_Click">
<Button.Background>
<ImageBrush ImageSource="../../Images/help16Pro.png"/>
</Button.Background>
</Button>
</StackPanel>
</Grid> </Grid>
</UserControl> </UserControl>

View File

@ -13,6 +13,7 @@ using System.Windows.Media.Imaging;
using System.Windows.Navigation; using System.Windows.Navigation;
using System.Windows.Shapes; using System.Windows.Shapes;
using OliviaAddInPro.Helper; using OliviaAddInPro.Helper;
using OliviaAddInPro.Model;
namespace OliviaAddInPro namespace OliviaAddInPro
@ -49,5 +50,10 @@ namespace OliviaAddInPro
} }
} }
private void button_help_Click(object sender, RoutedEventArgs e)
{
OliviaGlob.OpenManual();
}
} }
} }

View File

@ -63,18 +63,25 @@
<ContentPresenter Name="PaneEjecutar"> <ContentPresenter Name="PaneEjecutar">
<ContentPresenter.Content> <ContentPresenter.Content>
<StackPanel Orientation="Vertical"> <StackPanel Orientation="Vertical">
<Grid Margin="0,10,0,0" Height="40 "> <Grid Margin="0,10,0,0">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="30"/> <ColumnDefinition Width="100"/>
<ColumnDefinition Width="150"/> <ColumnDefinition Width="100"/>
<ColumnDefinition Width="120"/> <ColumnDefinition Width="100"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Button x:Name="button_secto" Grid.Column="1" Height="40 " Style="{DynamicResource Esri_Button}" Content="Sectorizar" Margin="10,0,10,0" Click="button_secto_Click" FontStretch="Condensed"/> <Button x:Name="button_secto" Grid.Column="1" Style="{DynamicResource Esri_Button}" Content="Sectorizar" Margin="10,0,10,0" Click="button_secto_Click"/>
<Button x:Name="button_planif" Grid.Column="2" Height="40 " Style="{DynamicResource Esri_Button}" Content="Planificar" Margin="10,0,10,0" Click="button_planif_Click"/> <Button x:Name="button_planif" Grid.Column="2" Style="{DynamicResource Esri_Button}" Content="Planificar" Margin="10,0,10,0" Click="button_planif_Click"/>
</Grid> </Grid>
</StackPanel> </StackPanel>
</ContentPresenter.Content> </ContentPresenter.Content>
</ContentPresenter> </ContentPresenter>
</StackPanel> </StackPanel>
<StackPanel Grid.Row="3" Margin="0,70,10,0">
<Button x:Name="button_help" Content="" Margin="0,0,0,0" HorizontalAlignment="Right" VerticalAlignment="Top" Width="16" Height="16" BorderThickness="0" RenderTransformOrigin="16.875,0.375" Click="button_help_Click">
<Button.Background>
<ImageBrush ImageSource="../../Images/help16Pro.png"/>
</Button.Background>
</Button>
</StackPanel>
</Grid> </Grid>
</UserControl> </UserControl>

View File

@ -13,7 +13,7 @@ using System.Windows.Media.Imaging;
using System.Windows.Navigation; using System.Windows.Navigation;
using System.Windows.Shapes; using System.Windows.Shapes;
using OliviaAddInPro.Helper; using OliviaAddInPro.Helper;
using OliviaAddInPro.Model;
namespace OliviaAddInPro namespace OliviaAddInPro
{ {
@ -43,11 +43,16 @@ namespace OliviaAddInPro
if (DataContext is PaneRecogidaViewModel mod) if (DataContext is PaneRecogidaViewModel mod)
{ {
if (mod.PaneSub1.CapaAbierta) if (mod.PaneSub1.CapaAbierta)
mod.Ejecuta(OliviaAddInPro.Services.ModosEjec.Planifica); mod.Ejecuta(OliviaAddInPro.Services.ModosEjec.SoloPlanifica);
else else
HelperGlobal.ponMsg("No se ha seleccionado ninguna capa de Recogida"); HelperGlobal.ponMsg("No se ha seleccionado ninguna capa de Recogida");
} }
} }
private void button_help_Click(object sender, RoutedEventArgs e)
{
OliviaGlob.OpenManual();
}
} }
} }