Compare commits

..

2 Commits

Author SHA1 Message Date
Gerardo bf4fffcaff Remates version 4.0.0.0 2024-04-12 22:35:29 +02:00
Gerardo a225a6b8af Correccion de errores 2024-04-11 16:29:41 +02:00
17 changed files with 350 additions and 160 deletions

View File

@ -30,13 +30,13 @@ namespace OliviaAddInPro
if (OliviaGlob.TipoView == TiposEjecucion.Ninguno) if (OliviaGlob.TipoView == TiposEjecucion.Ninguno)
{ {
///Comprueba que existe la red navegable configurada ///Comprueba que existe la red navegable configurada
/*if (!OliviaGlob.CompruebaNwYCampos()) if (!OliviaGlob.CompruebaNwYCampos())
{ {
HelperGlobal.ponMsg("No se encuentra red navegable, cambie Configuración: " + HelperGdb.OutStr, HelperGlobal.ponMsg("No se encuentra red navegable, cambie Configuración: " + HelperGdb.OutStr,
System.Windows.MessageBoxImage.Warning); System.Windows.MessageBoxImage.Warning);
} }
else else
{*/ {
OliviaGlob.SetFlagTipEjec(TiposEjecucion.Limp); OliviaGlob.SetFlagTipEjec(TiposEjecucion.Limp);
OliviaGlob.ViewSetFlagTipEjec(TiposEjecucion.Limp); OliviaGlob.ViewSetFlagTipEjec(TiposEjecucion.Limp);
@ -44,7 +44,7 @@ namespace OliviaAddInPro
OliviaGlob.Limp = new Limpieza(); OliviaGlob.Limp = new Limpieza();
DockpaneLimpiezaViewModel.Reset(); DockpaneLimpiezaViewModel.Reset();
DockpaneLimpiezaViewModel.Show(); DockpaneLimpiezaViewModel.Show();
//} }
} }
else if(OliviaGlob.ViewIsProps()) else if(OliviaGlob.ViewIsProps())
{ {

View File

@ -28,13 +28,13 @@ namespace OliviaAddInPro
if (OliviaGlob.TipoView == TiposEjecucion.Ninguno) if (OliviaGlob.TipoView == TiposEjecucion.Ninguno)
{ {
///Comprueba que existe la red navegable configurada ///Comprueba que existe la red navegable configurada
/*if (!OliviaGlob.CompruebaNwYCampos()) if (!OliviaGlob.CompruebaNwYCampos())
{ {
HelperGlobal.ponMsg("No se encuentra red navegable, cambie Configuración: " + HelperGdb.OutStr, HelperGlobal.ponMsg("No se encuentra red navegable, cambie Configuración: " + HelperGdb.OutStr,
System.Windows.MessageBoxImage.Warning); System.Windows.MessageBoxImage.Warning);
} }
else else
{*/ {
OliviaGlob.SetFlagTipEjec(TiposEjecucion.Reco); OliviaGlob.SetFlagTipEjec(TiposEjecucion.Reco);
OliviaGlob.ViewSetFlagTipEjec(TiposEjecucion.Reco); OliviaGlob.ViewSetFlagTipEjec(TiposEjecucion.Reco);
@ -42,7 +42,7 @@ namespace OliviaAddInPro
OliviaGlob.Reco = new Recogida(); OliviaGlob.Reco = new Recogida();
DockpaneRecogidaViewModel.Reset(); DockpaneRecogidaViewModel.Reset();
DockpaneRecogidaViewModel.Show(); DockpaneRecogidaViewModel.Show();
//} }
} }
else if (OliviaGlob.ViewIsProps()) else if (OliviaGlob.ViewIsProps())
{ {

View File

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<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="3.4" desktopVersion="3.0.3.36057"> <AddInInfo id="{10742570-cf59-42f2-bea2-2a38002a06ee}" version="4.0" desktopVersion="3.0.3.36057">
<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>27/11/2023 12:00:00, 2023</Date> <Date>12/04/2024 12:00:00, 2024</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

@ -29,6 +29,7 @@ using ArcGIS.Core.Data.Exceptions;
using Microsoft.Win32; using Microsoft.Win32;
using Microsoft.WindowsAPICodePack.Dialogs; using Microsoft.WindowsAPICodePack.Dialogs;
using System.Security.Cryptography; using System.Security.Cryptography;
using ArcGIS.Desktop.Internal.Mapping;
namespace OliviaAddInPro.Helper namespace OliviaAddInPro.Helper
{ {
@ -706,7 +707,7 @@ namespace OliviaAddInPro.Helper
{ {
if (filt == null) if (filt == null)
filt = new ArcGIS.Core.Data.QueryFilter(); filt = new ArcGIS.Core.Data.QueryFilter();
sel = fc.Select(filt, SelectionType.ObjectID, SelectionOption.Normal); sel = fc.Select(filt, ArcGIS.Core.Data.SelectionType.ObjectID, SelectionOption.Normal);
long nsel = sel.GetCount(); long nsel = sel.GetCount();
IReadOnlyList<long> ids_ = sel.GetObjectIDs(); IReadOnlyList<long> ids_ = sel.GetObjectIDs();
ids = ids_.ToList(); ids = ids_.ToList();
@ -737,7 +738,7 @@ namespace OliviaAddInPro.Helper
{ {
if (filt == null) if (filt == null)
filt = new ArcGIS.Core.Data.QueryFilter(); filt = new ArcGIS.Core.Data.QueryFilter();
sel = fc.Select(filt, SelectionType.ObjectID, SelectionOption.Normal); sel = fc.Select(filt, ArcGIS.Core.Data.SelectionType.ObjectID, SelectionOption.Normal);
var nsel = sel.GetCount(); var nsel = sel.GetCount();
IReadOnlyList<long> ids_ = sel.GetObjectIDs(); IReadOnlyList<long> ids_ = sel.GetObjectIDs();
ids = ids_.ToList(); ids = ids_.ToList();
@ -1183,6 +1184,16 @@ namespace OliviaAddInPro.Helper
geomIni = GeometryEngine.Instance.ConvexHull(geomIni); geomIni = GeometryEngine.Instance.ConvexHull(geomIni);
return geomIni; return geomIni;
} }
public static ArcGIS.Core.Geometry.Geometry GetGeomUnique(String path, ArcGIS.Core.Data.QueryFilter filtro)
{
FeatureClass fc = GetFtClassSync(path);
if (fc == null)
{
OutStr = "Error al abrir Feature Class:" + path;
return null; ;
}
return GetGeomUnique(fc, filtro);
}
/* /*
* A partir de una capa recorre todos los elementos que cumplen el filtro y los une en una única geometría * A partir de una capa recorre todos los elementos que cumplen el filtro y los une en una única geometría
*/ */
@ -1194,6 +1205,7 @@ namespace OliviaAddInPro.Helper
try try
{ {
var geom = new List<ArcGIS.Core.Geometry.Geometry>(); var geom = new List<ArcGIS.Core.Geometry.Geometry>();
using (RowCursor rowCursor = fclss.Search(filtro)) using (RowCursor rowCursor = fclss.Search(filtro))
{ {
@ -1202,7 +1214,10 @@ namespace OliviaAddInPro.Helper
using (Row row = rowCursor.Current) using (Row row = rowCursor.Current)
{ {
if (row is Feature ft) if (row is Feature ft)
{
geom.Add(ft.GetShape()); geom.Add(ft.GetShape());
}
} }
} }
geomsal = GeometryEngine.Instance.Union(geom); geomsal = GeometryEngine.Instance.Union(geom);
@ -1343,7 +1358,7 @@ namespace OliviaAddInPro.Helper
//realiza consulta //realiza consulta
n = 0; n = 0;
//fc.GetDefinition().GetFields().First().Name kfadpskfpasp //fc.GetDefinition().GetFields().First().Name kfadpskfpasp
using (Selection sel = fc.Select(new ArcGIS.Core.Data.QueryFilter { WhereClause = consulta }, SelectionType.ObjectID, SelectionOption.Normal)) using (Selection sel = fc.Select(new ArcGIS.Core.Data.QueryFilter { WhereClause = consulta }, ArcGIS.Core.Data.SelectionType.ObjectID, SelectionOption.Normal))
n = sel.GetCount(); n = sel.GetCount();
} }
} }
@ -1374,7 +1389,7 @@ namespace OliviaAddInPro.Helper
{ {
//realiza consulta //realiza consulta
n = 0; n = 0;
using (Selection sel = fc.Select(new ArcGIS.Core.Data.QueryFilter { WhereClause = consulta }, SelectionType.ObjectID, SelectionOption.Normal)) using (Selection sel = fc.Select(new ArcGIS.Core.Data.QueryFilter { WhereClause = consulta }, ArcGIS.Core.Data.SelectionType.ObjectID, SelectionOption.Normal))
n = sel.GetCount(); n = sel.GetCount();
} }
} }
@ -1464,10 +1479,13 @@ namespace OliviaAddInPro.Helper
if (debug) if (debug)
HelperGlobal.ponMsg("fc " + fc.GetName() + " tipo " + fc.GetType().Name); HelperGlobal.ponMsg("fc " + fc.GetName() + " tipo " + fc.GetType().Name);
///////////////////////////////////////////////////////// /////////////////////////////////////////////////////////
/////TODO comprobar que el object id no está indexado en la capa de nw, cómo hacerlo indexado
///https://pro.arcgis.com/en/pro-app/3.0/tool-reference/data-management/add-attribute-index.htm
///
//Añade a la lista los ids que cumplen el filtro espacial //Añade a la lista los ids que cumplen el filtro espacial
try try
{ {
var aux = fc.Select(filter, SelectionType.ObjectID, SelectionOption.Normal); var aux = fc.Select(filter, ArcGIS.Core.Data.SelectionType.ObjectID, SelectionOption.Normal);
var aux2 = aux.GetObjectIDs(); var aux2 = aux.GetObjectIDs();
//ids = fc.Select(filter, SelectionType.ObjectID, SelectionOption.Normal).GetObjectIDs().ToList(); //ids = fc.Select(filter, SelectionType.ObjectID, SelectionOption.Normal).GetObjectIDs().ToList();
ids = aux2.ToList(); ids = aux2.ToList();
@ -1750,11 +1768,49 @@ namespace OliviaAddInPro.Helper
ArcGIS.Core.Geometry.Geometry geomBuff = null; ArcGIS.Core.Geometry.Geometry geomBuff = null;
try try
{ {
geomBuff = GeometryEngine.Instance.Buffer(geom, buffer); //GeometryEngine.Instance.Buffer(geom.)
} //geomBuff= GeometryEngine.Instance.ConvexHull(geom);
catch //convierte las unidades del buffer a las unidades de la geometría
double buff_aux = buffer;
//comprueba que la geometría tenga unidades de metros para aplicar el buffer
if (geom.SpatialReference.Unit.FactoryCode != (int)ArcGIS.Core.Geometry.UnitTypeCode.Meters)
{ {
switch (geom.SpatialReference.Unit.FactoryCode)
{
case (int)ArcGIS.Core.Geometry.UnitTypeCode.Degrees://9102
//360º = 40.075 km
buff_aux = 360 * buffer / 40075000;
break;
case (int)ArcGIS.Core.Geometry.UnitTypeCode.Radians:
//2pi
buff_aux = 2 * Math.PI * buffer / 40075000;
break;
default:
if (geom.SpatialReference.Unit.UnitType == ArcGIS.Core.Geometry.UnitType.Linear)
{
//es de tipo lineal pero otras unidades que no son metros
buff_aux = ArcGIS.Core.Geometry.LinearUnit.Meters.ConvertTo(buffer, (ArcGIS.Core.Geometry.LinearUnit)geom.SpatialReference.Unit);
}
else
{
resp.Error = new List<string>();
resp.Error.Add("Error al aplicar buffer, la geometría del polígono de entrada es de tipo " + geom.SpatialReference.Unit.Name);
geomBuff = null;
buff_aux = 0;
}
break;
}
}
if(resp.Error.IsNullOrEmpty())
geomBuff = GeometryEngine.Instance.Buffer(geom, buff_aux);
}
catch( Exception e)
{
//resp.HasError = true;
if (resp.Error.IsNullOrEmpty())
resp.Error = new List<string>();
resp.Error.Add(e.Message);
return resp;
} }
resp.Value = geomBuff; resp.Value = geomBuff;
return resp; return resp;
@ -1799,7 +1855,7 @@ namespace OliviaAddInPro.Helper
} }
while (repite);*/ while (repite);*/
buffer = buff; buffer = buff;
geom_pto = GeometryEngine.Instance.Buffer(pto.ToMapPoint(), buffer); geom_pto = HelperGdb.BufferGeom((ArcGIS.Core.Geometry.Geometry)pto.ToMapPoint(geom.SpatialReference),buffer).Value; //GeometryEngine.Instance.Buffer(pto.ToMapPoint(), buffer);
if (geom_pto == null || geom_pto.IsEmpty) if (geom_pto == null || geom_pto.IsEmpty)
{ {
resp.Value = null; resp.Value = null;
@ -2356,7 +2412,7 @@ namespace OliviaAddInPro.Helper
/** /**
* Importa el shp en la gdb y el dataset, como una featureclass * Importa el shp en la gdb y el dataset, como una featureclass
*/ */
public static Respuesta<bool> ImportShp(string nom_shp, string Gdb_dataset, string namefc) public static Respuesta<bool> ImportShp(string nom_shp, string Gdb_dataset, string namefc, ArcGIS.Core.Geometry.SpatialReference spatref=null)
{ {
var res = new Respuesta<bool> { Value = false }; var res = new Respuesta<bool> { Value = false };
string[] args = { nom_shp, Gdb_dataset, namefc }; string[] args = { nom_shp, Gdb_dataset, namefc };
@ -2364,7 +2420,8 @@ namespace OliviaAddInPro.Helper
try try
{ {
ArcGIS.Core.Geometry.SpatialReference spatref = GetSpatRef(nom_shp); if(spatref==null)
spatref = GetSpatRef(nom_shp);
var environments = Geoprocessing.MakeEnvironmentArray(outputCoordinateSystem: spatref); var environments = Geoprocessing.MakeEnvironmentArray(outputCoordinateSystem: spatref);
//CancelableProgressorSource cps = new CancelableProgressorSource(); //CancelableProgressorSource cps = new CancelableProgressorSource();
var _cts = new System.Threading.CancellationTokenSource(); var _cts = new System.Threading.CancellationTokenSource();

View File

@ -51,9 +51,9 @@ namespace OliviaAddInPro.Model
public enum OpsNW public enum OpsNW
{ {
nw_0, nw_0, //TomTom
nw_1, nw_1, //Streetmap
nw_2, nw_2, //
nw_3, nw_3,
nw_4, nw_4,

View File

@ -275,7 +275,7 @@ namespace OliviaAddInPro.Model
if (ft == null) if (ft == null)
return false; return false;
HelperGdb.Free(ft); HelperGdb.Free(ft);
int NCAMPS = 5; /*int NCAMPS = 5;
string[] camps; string[] camps;
camps = new string[NCAMPS]; camps = new string[NCAMPS];
camps[0] = ComunDef.CamposNW.cons_onewFT; camps[0] = ComunDef.CamposNW.cons_onewFT;
@ -283,7 +283,8 @@ namespace OliviaAddInPro.Model
camps[2] = ComunDef.CamposNW.cons_kph; camps[2] = ComunDef.CamposNW.cons_kph;
camps[3] = ComunDef.CamposNW.cons_name; camps[3] = ComunDef.CamposNW.cons_name;
camps[4] = ComunDef.CamposNW.cons_fow; camps[4] = ComunDef.CamposNW.cons_fow;
return HelperGdb.CheckFileds(OliviaGlob.Paths.PathGdbNw, camps) == 0; return HelperGdb.CheckFileds(OliviaGlob.Paths.PathGdbNw, camps) == 0;*/
return true;
} }
/** /**

View File

@ -405,9 +405,13 @@ namespace OliviaAddInPro.Model
int n, i_def, icar, iveh; int n, i_def, icar, iveh;
//Rellena las opciones de carga máxima por vehículo //Rellena las opciones de carga máxima por vehículo
//////////////////////////////////////////////////
//Carga Trasera
////////////////////////////////////////////////
//Trasera-satelite //Trasera-satelite
n = 4; n = 4;
i_def = 2; i_def = 2;
//Rellena volumenes
info[0] = 2; info[0] = 2;
info[1] = 3; info[1] = 3;
info[2] = 5; info[2] = 5;
@ -425,6 +429,7 @@ namespace OliviaAddInPro.Model
//Trasera-2 ejes //Trasera-2 ejes
n = 6; n = 6;
i_def = 2; i_def = 2;
//Rellena volumenes
info[0] = 8; info[0] = 8;
info[1] = 10; info[1] = 10;
info[2] = 12; info[2] = 12;
@ -447,6 +452,7 @@ namespace OliviaAddInPro.Model
//Trasera-3ejes //Trasera-3ejes
n = 4; n = 4;
i_def = 3; i_def = 3;
//Rellena volumenes
info[0] = 18; info[0] = 18;
info[1] = 20; info[1] = 20;
info[2] = 22; info[2] = 22;
@ -454,6 +460,9 @@ namespace OliviaAddInPro.Model
rellena_carg((int)RecogidaDef.TiposCarga.Trasera, rellena_carg((int)RecogidaDef.TiposCarga.Trasera,
(int)RecogidaDef.TiposVehic.Ejes3, n, i_def, info); (int)RecogidaDef.TiposVehic.Ejes3, n, i_def, info);
//////////////////////////////////////////////////
//Carga Lateral
////////////////////////////////////////////////
//Lateral-satelite, no hay //Lateral-satelite, no hay
rellena_carg((int)RecogidaDef.TiposCarga.Lateral, rellena_carg((int)RecogidaDef.TiposCarga.Lateral,
(int)RecogidaDef.TiposVehic.Satelite, 0, 0, null); (int)RecogidaDef.TiposVehic.Satelite, 0, 0, null);
@ -461,6 +470,7 @@ namespace OliviaAddInPro.Model
//Lateral - 2 ejes //Lateral - 2 ejes
n = 2; n = 2;
i_def = 1; i_def = 1;
//Rellena volumenes
info[0] = 15; info[0] = 15;
info[1] = 17; info[1] = 17;
rellena_carg((int)RecogidaDef.TiposCarga.Lateral, rellena_carg((int)RecogidaDef.TiposCarga.Lateral,
@ -476,6 +486,7 @@ namespace OliviaAddInPro.Model
//Lateral - 3 ejes //Lateral - 3 ejes
n = 3; n = 3;
i_def = 2; i_def = 2;
//Rellena volumenes
info[0] = 21; info[0] = 21;
info[1] = 23; info[1] = 23;
info[2] = 26; info[2] = 26;
@ -486,9 +497,13 @@ namespace OliviaAddInPro.Model
rellena_carg((int)RecogidaDef.TiposCarga.Superior, rellena_carg((int)RecogidaDef.TiposCarga.Superior,
(int)RecogidaDef.TiposVehic.Satelite, 0, 0, null); (int)RecogidaDef.TiposVehic.Satelite, 0, 0, null);
//////////////////////////////////////////////////
//Carga Superior
////////////////////////////////////////////////
//Superior - 2 ejes //Superior - 2 ejes
n = 2; n = 2;
i_def = 0; i_def = 0;
//Rellena volumenes
info[0] = 16; info[0] = 16;
info[1] = 17; info[1] = 17;
rellena_carg((int)RecogidaDef.TiposCarga.Superior, rellena_carg((int)RecogidaDef.TiposCarga.Superior,
@ -497,6 +512,7 @@ namespace OliviaAddInPro.Model
//Superior - 3 ejes //Superior - 3 ejes
n = 3; n = 3;
i_def = 2; i_def = 2;
//Rellena volumenes
info[0] = 20; info[0] = 20;
info[1] = 23; info[1] = 23;
info[2] = 25; info[2] = 25;
@ -507,47 +523,9 @@ namespace OliviaAddInPro.Model
rellena_carg((int)RecogidaDef.TiposCarga.Bilateral, rellena_carg((int)RecogidaDef.TiposCarga.Bilateral,
(int)RecogidaDef.TiposVehic.Satelite, 0, 0, null); (int)RecogidaDef.TiposVehic.Satelite, 0, 0, null);
//Bilateral - 2 ejes //////////////////////////////////////////////////
n = 3; //Carga Bilateral
i_def = 1; ////////////////////////////////////////////////
info[0] = 14;
info[1] = 16;
info[2] = 18;
rellena_carg((int)RecogidaDef.TiposCarga.Bilateral,
(int)RecogidaDef.TiposVehic.Ejes2, n, i_def, info);
//Bilateral - 3 ejes
n = 3;
i_def = 1;
info[0] = 20;
info[1] = 23;
info[2] = 26;
rellena_carg((int)RecogidaDef.TiposCarga.Bilateral,
(int)RecogidaDef.TiposVehic.Ejes3, n, i_def, info);
//Bolseo - todas, no hay
//Lavado - todas, no hay
//Otra - todas, no hay
for (icar = (int)RecogidaDef.TiposCarga.BolseoPtaPta; icar < (int)RecogidaDef.TiposCarga.N; icar++)
{
for (iveh = (int)RecogidaDef.TiposVehic.Ejes3; iveh < (int)RecogidaDef.TiposVehic.N; iveh++)
{
rellena_carg(icar, iveh, 0, 0, null);
}
}
////////////////////////////////////////////////////////
//Barcelona new
rellena_offsets_bcn();
}
private static void rellena_offsets_bcn()
{
int[] info = new int[10];
int n, i_def;
////////////////////////////////////////////////////////
//Barcelona new
//Bilateral - satelite //Bilateral - satelite
n = 1; n = 1;
i_def = 0; i_def = 0;
@ -577,6 +555,50 @@ namespace OliviaAddInPro.Model
info[0] = -2050; info[0] = -2050;
rellena_carg_offset((int)RecogidaDef.TiposCarga.Bilateral, rellena_carg_offset((int)RecogidaDef.TiposCarga.Bilateral,
(int)RecogidaDef.TiposVehic.Satelite, (int)RecogidaDef.TiposFracción.Vidrio, n, info); (int)RecogidaDef.TiposVehic.Satelite, (int)RecogidaDef.TiposFracción.Vidrio, n, info);
//Bilateral - 2 ejes
n = 3;
i_def = 1;
//Rellena volumenes
info[0] = 14;
info[1] = 16;
info[2] = 18;
rellena_carg((int)RecogidaDef.TiposCarga.Bilateral,
(int)RecogidaDef.TiposVehic.Ejes2, n, i_def, info);
//Bilateral - 3 ejes
n = 3;
i_def = 1;
//Rellena volumenes
info[0] = 20;
info[1] = 23;
info[2] = 26;
rellena_carg((int)RecogidaDef.TiposCarga.Bilateral,
(int)RecogidaDef.TiposVehic.Ejes3, n, i_def, info);
//Bolseo - todas, no hay
//Lavado - todas, no hay
//Otra - todas, no hay
for (icar = (int)RecogidaDef.TiposCarga.BolseoPtaPta; icar < (int)RecogidaDef.TiposCarga.N; icar++)
{
for (iveh = (int)RecogidaDef.TiposVehic.Ejes3; iveh < (int)RecogidaDef.TiposVehic.N; iveh++)
{
rellena_carg(icar, iveh, 0, 0, null);
}
}
////////////////////////////////////////////////////////
//Rellena offsets
rellena_offsets_bcn();
}
private static void rellena_offsets_bcn()
{
int[] info = new int[10];
int n, i_def;
////////////////////////////////////////////////////////
//Barcelona revisado abril 24
//////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////
//Trasera - satélite - organico, resto //Trasera - satélite - organico, resto
@ -817,19 +839,12 @@ namespace OliviaAddInPro.Model
(int)RecogidaDef.TiposVehic.Ejes3, (int)RecogidaDef.TiposFracción.Vidrio, n, info); (int)RecogidaDef.TiposVehic.Ejes3, (int)RecogidaDef.TiposFracción.Vidrio, n, info);
//Bilateral - 2 ejes - papel //Bilateral - 2 ejes - papel
info[0] = 1820; info[0] = 1540;
info[1] = 2080; info[1] = 1760;
info[2] = 2340; info[2] = 1980;
rellena_carg_offset((int)RecogidaDef.TiposCarga.Bilateral, rellena_carg_offset((int)RecogidaDef.TiposCarga.Bilateral,
(int)RecogidaDef.TiposVehic.Ejes2, (int)RecogidaDef.TiposFracción.Papel, n, info); (int)RecogidaDef.TiposVehic.Ejes2, (int)RecogidaDef.TiposFracción.Papel, n, info);
//Bilateral - 2 ejes - vidrio
info[0] = -140;
info[1] = -160;
info[2] = -180;
rellena_carg_offset((int)RecogidaDef.TiposCarga.Bilateral,
(int)RecogidaDef.TiposVehic.Ejes2, (int)RecogidaDef.TiposFracción.Vidrio, n, info);
//////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////
//Bilateral - 3 ejes - resto, org //Bilateral - 3 ejes - resto, org
n = 3; n = 3;

View File

@ -28,11 +28,16 @@ namespace OliviaAddInPro.Model
/** /**
* Tipo modo de viaje * Tipo modo de viaje
*/ */
public int TipoMV { get; set; } = 1; public int TipoMV { get; set; } = -1;
/** /**
* Capa de ámbitos * Capa de ámbitos
*/ */
public string CapaElems { get; set; } = string.Empty; public string CapaElems { get; set; } = string.Empty;
/**
* Capa de ámbitos de referencia.
* Cuando se hace tratamiento con ejes de calle, se guarda la capa de referencia
*/
public string CapaElemsRef { get; set; } = string.Empty;
/** /**
* Capa de ámbitos después de haber planificado * Capa de ámbitos después de haber planificado
*/ */

View File

@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("VSM - Narvaling")] [assembly: AssemblyCompany("VSM - Narvaling")]
[assembly: AssemblyProduct("OliviaAddInPro")] [assembly: AssemblyProduct("OliviaAddInPro")]
[assembly: AssemblyCopyright("Copyright © VSM 2023")] [assembly: AssemblyCopyright("Copyright © VSM 2024")]
[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("3.2.0.0")] [assembly: AssemblyVersion("4.0.0.0")]
[assembly: AssemblyFileVersion("3.2.0.0")] [assembly: AssemblyFileVersion("4.0.0.0")]

View File

@ -16,10 +16,10 @@ namespace OliviaAddInPro.Services
private static string pathConfigDef = "C:\\Olivia"; private static string pathConfigDef = "C:\\Olivia";
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_3_1"; public const string OlvRegKey = "SOFTWARE\\Narvaling\\Olivia_4_0";
public const string OlvRegName = "workdir"; public const string OlvRegName = "workdir";
public const string OlvConfigName = "olv.conf"; public const string OlvConfigName = "olv.conf";
public const string VersionConfiguracion = "1.1.0.2"; public const string VersionConfiguracion = "1.2.0.0";
public static ConfigServ Serv public static ConfigServ Serv
{ {
get { get {
@ -309,7 +309,7 @@ namespace OliviaAddInPro.Services
c.v_desp_LS=0; c.v_desp_LS=0;
//Reco //Reco
c.id= "ID"; c.id= "_ID";
c.nomrec= "NOMB_TIP_REC"; c.nomrec= "NOMB_TIP_REC";
c.lateralidad= "LATERALIDAD"; c.lateralidad= "LATERALIDAD";
c.frac= "FRACCION"; c.frac= "FRACCION";
@ -354,13 +354,13 @@ namespace OliviaAddInPro.Services
c.dens_vehi_org=500; c.dens_vehi_org=500;
c.dens_vehi_res=500; c.dens_vehi_res=500;
c.dens_vehi_env=120; c.dens_vehi_env=120;
c.dens_vehi_pap=250; c.dens_vehi_pap=360;
c.dens_vehi_vid=350; c.dens_vehi_vid=350;
c.dens_vehi_otr=100; c.dens_vehi_otr=100;
c.dens_cont_org=150; c.dens_cont_org=200;
c.dens_cont_res=100; c.dens_cont_res=100;
c.dens_cont_env=28; c.dens_cont_env=28;
c.dens_cont_pap=90; c.dens_cont_pap=75;
c.dens_cont_vid=250; c.dens_cont_vid=250;
c.dens_cont_otr=100; c.dens_cont_otr=100;
c.anch_vehi_3=2.4000000; c.anch_vehi_3=2.4000000;
@ -398,16 +398,16 @@ namespace OliviaAddInPro.Services
c.Giro_max_vehiculo = 175.0000000; c.Giro_max_vehiculo = 175.0000000;
c.Desv_max = 0.1500000; c.Desv_max = 0.1500000;
c.Desv_max_abs = 1800.0000000; c.Desv_max_abs = 1800.0000000;
c.Tipo_eje_via = OpsNW.nw_1; c.Tipo_eje_via = OpsNW.nw_0;
c.ListaNw = new List<OliviaConfNW>(); c.ListaNw = new List<OliviaConfNW>();
c.ListaNw.Add(new OliviaConfNW() c.ListaNw.Add(new OliviaConfNW()
{ {
nombre = "TomTom", nombre = "TomTom",
campo_velocidad = "$feature.KPH", campo_velocidad = "$feature.KPH",
campo_nombre = "$feature.NAME", campo_nombre = "$feature.NAME",
campo_peatonal = "IIf( $feature.FOW == 14 || $feature.ONEWAY == 'N', 1, 0)", campo_peatonal = "IIf( $feature.FOW == 14 || $feature.FOW == 15 || $feature.FOW == 19 || $feature.ONEWAY == 'N', 1, 0)",
campo_sentidoFT = "IIF($feature.ONEWAY== 'FT' || $feature.ONEWAY == '', 1 , 0)", campo_sentidoFT = "IIF($feature.ONEWAY== 'TF' || $feature.ONEWAY == 'N', 0 , 1)",
campo_sentidoTf = "IIF($feature.ONEWAY == 'TF' || $feature.ONEWAY == '', 1, 0)", campo_sentidoTf = "IIF($feature.ONEWAY == 'FT' || $feature.ONEWAY == 'N', 0, 1)",
campo_elevacion_from = "$feature.F_ELEV", campo_elevacion_from = "$feature.F_ELEV",
campo_elevacion_to = "$feature.T_ELEV", campo_elevacion_to = "$feature.T_ELEV",
comprueba_elevacion = true, comprueba_elevacion = true,
@ -416,6 +416,7 @@ namespace OliviaAddInPro.Services
revisa_angulos = false, revisa_angulos = false,
campo_angulos = "0" campo_angulos = "0"
}); ; }); ;
/*
c.ListaNw.Add(new OliviaConfNW() c.ListaNw.Add(new OliviaConfNW()
{ {
nombre = "StreetMapPremiun", nombre = "StreetMapPremiun",
@ -432,40 +433,50 @@ namespace OliviaAddInPro.Services
revisa_angulos = true, revisa_angulos = true,
campo_angulos = "IIF($feature.ROAD_CLASS== '3 - Highway Ramp' || $feature.ROAD_CLASS== '6 - Major Road' || $feature.ROAD_CLASS == '1 - Surface Street', 90 , 0)" campo_angulos = "IIF($feature.ROAD_CLASS== '3 - Highway Ramp' || $feature.ROAD_CLASS== '6 - Major Road' || $feature.ROAD_CLASS == '1 - Surface Street', 90 , 0)"
}); });
*/
c.ListaMV = new List<OliviaConfMV>(); c.ListaMV = new List<OliviaConfMV>();
c.ListaMV.Add(new OliviaConfMV() c.ListaMV.Add(new OliviaConfMV()
{ {
nombre = "Default", nombre = "Default",
filtro_omitir = "", filtro_omitir = "",
campo_prioridad = "0" campo_prioridad = "0",
vehiculo_def_reco = -1,
}); vehiculo_def_lim = -1
}) ;
c.ListaMV.Add(new OliviaConfMV() c.ListaMV.Add(new OliviaConfMV()
{ {
nombre = "Peaton", nombre = "Peaton",
filtro_omitir = "", filtro_omitir = "(FREEWAY <> 1 AND SLIPRD = 0)",
campo_prioridad = "0" campo_prioridad = "0",
vehiculo_def_reco = -1,
vehiculo_def_lim = 0
}); });
c.ListaMV.Add(new OliviaConfMV() c.ListaMV.Add(new OliviaConfMV()
{ {
nombre = "Vehiculo pequeño", nombre = "Vehiculo pequeño",
filtro_omitir = "", filtro_omitir = "(FREEWAY <> 1 AND SLIPRD = 0)",
campo_prioridad = "0" campo_prioridad = "IIF($feature.PRIVATERD>1 || ($feature.FOW>13 && $feature.FOW<16) , -2 , 0)",
vehiculo_def_reco = 2,
vehiculo_def_lim = 1
}); });
c.ListaMV.Add(new OliviaConfMV() c.ListaMV.Add(new OliviaConfMV()
{ {
nombre = "Vehiculo mediano", nombre = "Vehiculo mediano",
filtro_omitir = "", filtro_omitir = "(ONEWAY <> 'N' AND FOW NOT IN (14, 15, 19))",
campo_prioridad = "0" campo_prioridad = "IIF($feature.PRIVATERD>1 || $feature.RDCOND>1 , -2 , 0)",
vehiculo_def_reco = 1,
vehiculo_def_lim = -1
}); });
c.ListaMV.Add(new OliviaConfMV() c.ListaMV.Add(new OliviaConfMV()
{ {
nombre = "Vehiculo grande", nombre = "Vehiculo grande",
filtro_omitir = "", filtro_omitir = "(ONEWAY <> 'N' AND FOW NOT IN (14, 15, 19))",
campo_prioridad = "0" campo_prioridad = "IIF($feature.RDCOND>1,-3, (IIF($feature.PRIVATERD>1 , -2 , 0)))",
vehiculo_def_reco =0,
vehiculo_def_lim = -1
}); });
return c; return c;

View File

@ -11,6 +11,7 @@ using ArcGIS.Core.Internal.Data;
using ArcGIS.Desktop.Framework.Threading.Tasks; using ArcGIS.Desktop.Framework.Threading.Tasks;
using System.Windows; using System.Windows;
using System.IO; using System.IO;
using ArcGIS.Core.Data.UtilityNetwork.Trace;
namespace OliviaAddInPro.Services namespace OliviaAddInPro.Services
{ {
@ -73,7 +74,7 @@ namespace OliviaAddInPro.Services
//Comprueba que tiene las columnas necesarias para planificar //Comprueba que tiene las columnas necesarias para planificar
if ((modo == ModosEjec.Planifica) && !CompruebaPlanif()) if ((modo == ModosEjec.Planifica) && !CompruebaPlanif())
{ {
ErrStr = "En la capa de ámbitos seleccionada no se encuentran columnas de SECTOR y/o SECUENCIA, necesarias para planificar"; ErrStr = "En la capa de ámbitos seleccionada no se encuentran columnas de SECTOR y/o SECUENCIA, necesarias para planificar, o bien han cambiado los datos configurados";
return false; return false;
} }
if (com.ProgrSrc._ProgrSrc.Getcancelled()) if (com.ProgrSrc._ProgrSrc.Getcancelled())
@ -145,8 +146,17 @@ namespace OliviaAddInPro.Services
return false; return false;
} }
//mira spatialreference de los datos de entrada //mira spatialreference de los datos de entrada
spatRefData = geom_export.SpatialReference; spatref = HelperGdb.GetSpatRefSync(com.CapaElemsRef);
spatRefData = spatref;
if (spatref != null)
{
geom_export = HelperGdb.ReproyectaGeom(geom_export, spatref);
}
if (geom_export == null)
{
ErrStr = "Error al reproyectar geometría para la exportacion de los ámbitos";
return false;
}
//crea el filtro de exportación //crea el filtro de exportación
filtroEspacial = HelperGdb.CreateFiler(com.ConsultaAmbs, geom_export); filtroEspacial = HelperGdb.CreateFiler(com.ConsultaAmbs, geom_export);
if (filtroEspacial == null) if (filtroEspacial == null)
@ -172,7 +182,7 @@ namespace OliviaAddInPro.Services
//Guarda el nombre //Guarda el nombre
OliviaGlob.Paths.PathData = OliviaGlob.Paths.DirData + com.NombreShpExport; OliviaGlob.Paths.PathData = OliviaGlob.Paths.DirData + com.NombreShpExport;
//exporta los datos de entrada //exporta los datos de entrada
if (!HelperGdb.ExportShp2(com.CapaElems, filtroEspacial, com.NombreShpExport, OliviaGlob.Paths.DirData, com.ProgrSrc._ProgrSrc, null, 50)) if (!HelperGdb.ExportShp2(com.CapaElems, filtroEspacial, com.NombreShpExport, OliviaGlob.Paths.DirData, com.ProgrSrc._ProgrSrc, spatref, 50))
{ {
ErrStr = "Error al exportar los ámbitos: " + HelperGdb.OutStr; ErrStr = "Error al exportar los ámbitos: " + HelperGdb.OutStr;
return false; return false;
@ -186,7 +196,7 @@ namespace OliviaAddInPro.Services
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
///Comprueba si está la columna de ObjectId y si no, la crea ///Comprueba si está la columna de ObjectId y si no, la crea
if(!ComprCreaColOid(OliviaGlob.Paths.PathData, com.CapaElems, filtroEspacial)) if(!ComprCreaColOid(OliviaGlob.Paths.PathData, com.CapaElems, null))
{ {
ErrStr = "Error al exportar columna " + ComunDef.CamposCom.camp_oid; ErrStr = "Error al exportar columna " + ComunDef.CamposCom.camp_oid;
return false; return false;
@ -338,14 +348,17 @@ namespace OliviaAddInPro.Services
//guarda la mima de la geometría de la red navegable a exportar //guarda la mima de la geometría de la red navegable a exportar
com.MimaNw = geom_export.Extent; com.MimaNw = geom_export.Extent;
////////////////////////////////////// //////////////////////////////////////
///
//Hace el filtro con la geometría final
//ComunDef.configMV
var where = String.Empty; var where = String.Empty;
if (!String.IsNullOrEmpty(ComunDef.configMV.filtro_omitir)) if (!String.IsNullOrEmpty(ComunDef.configMV.filtro_omitir))
{ {
where = ComunDef.configMV.filtro_omitir; where = ComunDef.configMV.filtro_omitir;
} }
if (com.ProgrSrc._ProgrSrc.Getcancelled())
{
ErrStr = Resource1.String_cancel_progreso;
return false;
}
filtroEspacial = HelperGdb.CreateFiler(where, geom_export); filtroEspacial = HelperGdb.CreateFiler(where, geom_export);
if (filtroEspacial == null) if (filtroEspacial == null)
{ {
@ -353,11 +366,6 @@ namespace OliviaAddInPro.Services
return false; return false;
} }
if (com.ProgrSrc._ProgrSrc.Getcancelled())
{
ErrStr = Resource1.String_cancel_progreso;
return false;
}
com.ProgrSrc.IncMessage(10, "Exportando red navegable");//60% com.ProgrSrc.IncMessage(10, "Exportando red navegable");//60%
//Prepara nombre de exportación //Prepara nombre de exportación
@ -365,11 +373,12 @@ namespace OliviaAddInPro.Services
//guarda los nombres del shape //guarda los nombres del shape
OliviaGlob.Paths.PathNW = OliviaGlob.Paths.DirData + com.NombreShpExportNw; OliviaGlob.Paths.PathNW = OliviaGlob.Paths.DirData + com.NombreShpExportNw;
//exporta los datos de entrada //exporta los datos de entrada
if (!HelperGdb.ExportShp2(OliviaGlob.Paths.PathGdbNw, filtroEspacial, com.NombreShpExportNw, OliviaGlob.Paths.DirData, com.ProgrSrc._ProgrSrc, spatRefData,100)) if (!HelperGdb.ExportShp2(OliviaGlob.Paths.PathGdbNw, filtroEspacial, com.NombreShpExportNw, OliviaGlob.Paths.DirData, com.ProgrSrc._ProgrSrc, spatref,100))
{ {
ErrStr = "Error al exportar la red navegable: " + HelperGdb.OutStr; ErrStr = "Error al exportar la red navegable: " + HelperGdb.OutStr;
return false; return false;
} }
//OliviaGlob.Paths.PathGdbNw.Replace("1.", ".");
if (com.ProgrSrc._ProgrSrc.Getcancelled()) if (com.ProgrSrc._ProgrSrc.Getcancelled())
{ {
ErrStr = Resource1.String_cancel_progreso; ErrStr = Resource1.String_cancel_progreso;
@ -395,9 +404,19 @@ namespace OliviaAddInPro.Services
} }
} }
/////////////////////////////////////////////////////////////////////
///Comprueba si está la columna de ObjectId y si no, la crea
/*if (!ComprCreaColOid(OliviaGlob.Paths.PathNW, OliviaGlob.Paths.PathGdbNw, null))
{
ErrStr = "Error al exportar columna " + ComunDef.CamposCom.camp_oid;
return false;
}
//lo añade la siguiente función
*/
//prepara campos estandar //prepara campos estandar
com.ProgrSrc.IncMessage(10, "Estandarizando campos de la red");//60% com.ProgrSrc.IncMessage(10, "Estandarizando campos de la red");//60%
if (!EstandarizaCamposNW(OliviaGlob.Paths.DirData+com.NombreShpExportNw)) if (!EstandarizaCamposNW(OliviaGlob.Paths.PathNW))
{ {
ErrStr = "Error al estandarizar campos red navegable: " + HelperGdb.OutStr; ErrStr = "Error al estandarizar campos red navegable: " + HelperGdb.OutStr;
return false; return false;
@ -413,7 +432,7 @@ namespace OliviaAddInPro.Services
} }
bool EstandarizaCamposNW(string pathNW) bool EstandarizaCamposNW(string pathNW)
{ {
HelperGdb.FieldToAdd[] fields = new HelperGdb.FieldToAdd[9]; HelperGdb.FieldToAdd[] fields = new HelperGdb.FieldToAdd[10];
//campo SECTOR //campo SECTOR
int i = 0; int i = 0;
fields[i].Name = ComunDef.CamposNW.cons_kph; fields[i].Name = ComunDef.CamposNW.cons_kph;
@ -468,7 +487,12 @@ namespace OliviaAddInPro.Services
fields[i].Alias = ComunDef.CamposNW.cons_angulo; fields[i].Alias = ComunDef.CamposNW.cons_angulo;
fields[i].Tipo = "FLOAT"; fields[i].Tipo = "FLOAT";
fields[i].Length = 128; fields[i].Length = 128;
i++;
fields[i].Name = ComunDef.CamposCom.camp_oid;
fields[i].Alias = ComunDef.CamposCom.camp_oid;
fields[i].Tipo = "LONG";
fields[i].Length = 0;
if (!HelperGdb.AddFieldsSync(pathNW, fields)) if (!HelperGdb.AddFieldsSync(pathNW, fields))
return false; return false;
@ -494,6 +518,11 @@ namespace OliviaAddInPro.Services
if (!HelperGdb.CalculateFieldsSync(pathNW, ComunDef.CamposNW.cons_angulo, ComunDef.CamposNW.config.campo_angulos)) if (!HelperGdb.CalculateFieldsSync(pathNW, ComunDef.CamposNW.cons_angulo, ComunDef.CamposNW.config.campo_angulos))
return false; return false;
using (FeatureClass fc =HelperGdb.GetFtClassSync(pathNW))
{
if (!HelperGdb.CalculateFieldsSync(pathNW, ComunDef.CamposCom.camp_oid, "$feature."+fc.GetDefinition().GetObjectIDField()))
return false;
}
return true; return true;
} }
/** /**
@ -636,7 +665,7 @@ namespace OliviaAddInPro.Services
/** /**
* Comrpueba si existe la columna de oid y si no, la crea y la rellena * Comrpueba si existe la columna de oid y si no, la crea y la rellena
*/ */
public bool ComprCreaColOid(string pathCapa, string pathCapaOrig, SpatialQueryFilter filter) public bool ComprCreaColOid(string pathCapa, string pathCapaOrig, SpatialQueryFilter filter=null)
{ {
//comprueba si está el campo //comprueba si está el campo
bool compCamp = HelperGdb.CheckField(pathCapa, ComunDef.CamposCom.camp_oid); bool compCamp = HelperGdb.CheckField(pathCapa, ComunDef.CamposCom.camp_oid);
@ -655,6 +684,7 @@ namespace OliviaAddInPro.Services
if (!HelperGdb.AddFieldsSync(pathCapa, fields)) if (!HelperGdb.AddFieldsSync(pathCapa, fields))
return false; return false;
//vuelve a cerrar la capa //vuelve a cerrar la capa
string capa_principal = System.IO.Path.GetFileNameWithoutExtension(pathCapa); string capa_principal = System.IO.Path.GetFileNameWithoutExtension(pathCapa);
HelperGdb.CloseLayer(capa_principal); HelperGdb.CloseLayer(capa_principal);
@ -662,9 +692,22 @@ namespace OliviaAddInPro.Services
///////////////////////////////////////////////////// /////////////////////////////////////////////////////
//Coge los ids de la capa de la que ha exportado //Coge los ids de la capa de la que ha exportado
using (FeatureClass fc_orig = HelperGdb.GetFtClassSync(pathCapaOrig)) using (FeatureClass fc_orig = HelperGdb.GetFtClassSync(pathCapaOrig))
{
using (FeatureClass fc_shp = HelperGdb.GetFtClassSync(pathCapa))
{ {
if (fc_orig == null) if (fc_orig == null)
return false; return false;
if (fc_shp == null)
return false;
if (filter == null)
{
filter = HelperGdb.CreateFiler("", null);
//coge la geom de todos los ámbitos del shp
var geomExport = HelperGdb.GetGeomUnique(fc_shp, filter);
filter = HelperGdb.CreateFiler("", geomExport);
}
List<long> ids = new List<long>(); List<long> ids = new List<long>();
//Añade a la lista los ids que cumplen el filtro espacial //Añade a la lista los ids que cumplen el filtro espacial
try try
@ -676,10 +719,6 @@ namespace OliviaAddInPro.Services
ids = new List<long>(); ids = new List<long>();
} }
//Comprueba que hay tantos ids como elementos en el shp //Comprueba que hay tantos ids como elementos en el shp
using (FeatureClass fc_shp = HelperGdb.GetFtClassSync(pathCapa))
{
if (fc_shp == null)
return false;
long nelem_shp = HelperGdb.GetNumElemsSync(fc_shp); long nelem_shp = HelperGdb.GetNumElemsSync(fc_shp);
if (nelem_shp != ids.Count) if (nelem_shp != ids.Count)
return false; return false;
@ -731,6 +770,48 @@ namespace OliviaAddInPro.Services
/** /**
* Prepara la geometría para exportar los ámbitos * Prepara la geometría para exportar los ámbitos
*/ */
public Geometry GetZonasBuffer()
{
Geometry geomAux = null;
ErrStr = string.Empty;
//Hace la intersección de zonas y niveles
geomAux = null;
/*
if (com.GeomNiv != null || com.GeomZon != null)
{
geomAux = HelperGdb.IntersectGeom(com.GeomNiv, com.GeomZon);
if (geomAux == null)
{
ErrStr = "Error al intersecar zonas y/o niveles.";
return null;
}
if (geomAux.IsEmpty)
{
ErrStr = "No existen ámbitos en la intersección entre zonas y/o niveles.";
return null;
}
}
else
{
return null;
}*/
FeatureClass fc = HelperGdb.GetFtClassSync(OliviaGlob.Paths.PathData);
if (fc == null)
{
ErrStr = "No se ha podido abrir la clase " + OliviaGlob.Paths.PathData;
return null;
}
SpatialQueryFilter filtro = HelperGdb.CreateFiler("",null);
var geomAmbits = HelperGdb.GetGeomUnique(fc, filtro);
if (geomAmbits == null || geomAmbits.IsEmpty)
{
ErrStr = "No se ha podido generar geometría de los ámbitos" + com.ConsultaAmbs + HelperGdb.OutStr;
HelperGdb.Free(fc);
return null;
}
return geomAmbits;
}
public Geometry GetGeomAmbitsExport() public Geometry GetGeomAmbitsExport()
{ {
Geometry geomAux = null; Geometry geomAux = null;
@ -1124,7 +1205,7 @@ namespace OliviaAddInPro.Services
} }
} }
resp2 = HelperGdb.ImportShp(dir_shp + "\\" + noms_shp[i] + HelperGdb.SHP_EXT, GdbFileName + "\\" + dataset, noms_gdb[i]); resp2 = HelperGdb.ImportShp(dir_shp + "\\" + noms_shp[i] + HelperGdb.SHP_EXT, GdbFileName + "\\" + dataset, noms_gdb[i], spatRefData);
if (!resp2.Value) if (!resp2.Value)
{ {
err_st = "Error al importar la capa " + noms_gdb[i]; err_st = "Error al importar la capa " + noms_gdb[i];

View File

@ -216,10 +216,8 @@ namespace OliviaAddInPro.Services
string consulta; string consulta;
long numero_lin; long numero_lin;
bool[] amb_gdb = new bool[(int)LimpiezaDef.AmbitsTra.AmbN];//se inician a false bool[] amb_gdb = new bool[(int)LimpiezaDef.AmbitsTra.AmbN];//se inician a false
string ftclass;
//mira a ver si hay ejes de calle //mira a ver si hay ejes de calle
ftclass = LimpiezaDef.ftclass[(int)LimpiezaDef.AmbitsTra.AmbEjeCalle];
consulta = LimpiezaDef.filtro_str[(int)LimpiezaDef.AmbitsTra.AmbEjeCalle]; consulta = LimpiezaDef.filtro_str[(int)LimpiezaDef.AmbitsTra.AmbEjeCalle];
numero_lin = HelperGdb.GetNumElems(OliviaGlob.Paths.PathGdbNw, consulta); numero_lin = HelperGdb.GetNumElems(OliviaGlob.Paths.PathGdbNw, consulta);
if (numero_lin > 0) if (numero_lin > 0)

View File

@ -64,20 +64,20 @@
<ContentPresenter Name="PaneEjecutar"> <ContentPresenter Name="PaneEjecutar">
<ContentPresenter.Content> <ContentPresenter.Content>
<StackPanel Orientation="Vertical"> <StackPanel Orientation="Vertical">
<Grid Margin="0,10,0,0"> <Grid Margin="0,30,0,0">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="100"/> <ColumnDefinition Width="100"/>
<ColumnDefinition Width="100"/> <ColumnDefinition Width="100"/>
<ColumnDefinition Width="100"/> <ColumnDefinition Width="100"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<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_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" 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,0,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"> <StackPanel Grid.Row="3" Margin="0,90,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 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> <Button.Background>
<ImageBrush ImageSource="../../Images/help16Pro.png"/> <ImageBrush ImageSource="../../Images/help16Pro.png"/>

View File

@ -135,6 +135,7 @@ namespace OliviaAddInPro
} }
} }
private int tipoTto = -1; private int tipoTto = -1;
private int tipoTto_old = -2;
public int TipoTto public int TipoTto
{ {
get { return tipoTto; } get { return tipoTto; }
@ -269,19 +270,22 @@ namespace OliviaAddInPro
} }
public void ComboMvSel(int tto) public void ComboMvSel(int tto)
{ {
tipoMv = tto; if (tto < 0)
return;
TipoMv = tto;
} }
/** /**
* Realiza los cambios en los ámbitos cuando se ha seleccionado un tratamiento * Realiza los cambios en los ámbitos cuando se ha seleccionado un tratamiento
*/ */
public void ComboTtoSel(int tto) public void ComboTtoSel(int tto)
{ {
if (tto < 0) if (tto < 0 || tto== tipoTto_old)
return; return;
TipoTto = tto; TipoTto = tto;
cambia_tiempo_tto(); cambia_tiempo_tto();
ambitosSel = new bool[(int)LimpiezaDef.AmbitsTra.AmbN]; //reinicia los ambitos seleccionados ambitosSel = new bool[(int)LimpiezaDef.AmbitsTra.AmbN]; //reinicia los ambitos seleccionados
tipoTto_old = tto;
//////////////////////////////////////// ////////////////////////////////////////
//Otros cambios que dependen del tratamiento //Otros cambios que dependen del tratamiento
if (TipoTto != (int)LimpiezaDef.TiposTto.TtoNoDef) if (TipoTto != (int)LimpiezaDef.TiposTto.TtoNoDef)

View File

@ -80,6 +80,7 @@ namespace OliviaAddInPro
return false; return false;
} }
limp.CapaElems = _subPanel1ViewModel.CapaElems; limp.CapaElems = _subPanel1ViewModel.CapaElems;
limp.CapaElemsRef = limp.CapaElems;
//pone que la capa de elementos es la red navegable, que es la que va a exportar //pone que la capa de elementos es la red navegable, que es la que va a exportar
if (_subPanel1ViewModel.SelOpAmb == 1) if (_subPanel1ViewModel.SelOpAmb == 1)
{ {

View File

@ -68,7 +68,9 @@ namespace OliviaAddInPro
} }
public void ComboMvSel(int tto) public void ComboMvSel(int tto)
{ {
tipoMv = tto; if (tto < 0)
return;
TipoMv = tto;
} }
public override string DisplayName public override string DisplayName
@ -121,6 +123,7 @@ namespace OliviaAddInPro
} }
} }
private int tipoFrac = -1; private int tipoFrac = -1;
private int tipoFrac_old = -2;
public int TipoFrac public int TipoFrac
{ {
get { return tipoFrac; } get { return tipoFrac; }
@ -131,6 +134,7 @@ namespace OliviaAddInPro
} }
} }
private int tipoCarg = -1; private int tipoCarg = -1;
private int tipoCarg_old = -2;
public int TipoCarg public int TipoCarg
{ {
get { return tipoCarg; } get { return tipoCarg; }
@ -141,6 +145,7 @@ namespace OliviaAddInPro
} }
} }
private int tipoVehic = -1; private int tipoVehic = -1;
private int tipoVehic_old = -2;
public int TipoVehic public int TipoVehic
{ {
get { return tipoVehic; } get { return tipoVehic; }
@ -151,6 +156,7 @@ namespace OliviaAddInPro
} }
} }
private int tipoCapac = -1; private int tipoCapac = -1;
private int tipoCapac_old = -2;
public int TipoCapac public int TipoCapac
{ {
get { return tipoCapac; } get { return tipoCapac; }
@ -161,6 +167,7 @@ namespace OliviaAddInPro
} }
} }
private int tipoLate = -1; private int tipoLate = -1;
private int tipoLate_old = -2;
public int TipoLate public int TipoLate
{ {
get { return tipoLate; } get { return tipoLate; }
@ -433,7 +440,7 @@ namespace OliviaAddInPro
*/ */
public bool ComboFracSel(int tto) public bool ComboFracSel(int tto)
{ {
if (tto < 0) if (tto < 0 || tto== tipoFrac_old)
return false; return false;
if (!tipos_fracc_bool[tto]) if (!tipos_fracc_bool[tto])
{ {
@ -444,6 +451,7 @@ namespace OliviaAddInPro
{ {
//cuando se selecciona un item pintado en gris (que no existe en la GDB) se actúa como si no se hubiera seleccionado item //cuando se selecciona un item pintado en gris (que no existe en la GDB) se actúa como si no se hubiera seleccionado item
TipoFrac = tto; TipoFrac = tto;
tipoFrac_old = tto;
if ((TipoVehic >= 0) && (TipoCarg >= 0)) if ((TipoVehic >= 0) && (TipoCarg >= 0))
{ {
//si también se ha seleccionado tipo de carga y de vehículo, se rellena la lista de capacidades //si también se ha seleccionado tipo de carga y de vehículo, se rellena la lista de capacidades
@ -546,7 +554,7 @@ namespace OliviaAddInPro
public bool ComboCargSel(int tto) public bool ComboCargSel(int tto)
{ {
VisCombLate = Visibility.Hidden; VisCombLate = Visibility.Hidden;
if (tto < 0) if (tto < 0 || tto== tipoCarg_old)
return false; return false;
if (!tipos_carg_bool[tto]) if (!tipos_carg_bool[tto])
{ {
@ -555,6 +563,8 @@ namespace OliviaAddInPro
try try
{ {
TipoCarg=tto; TipoCarg=tto;
tipoCarg_old = tto;
if (TipoCarg == (int)RecogidaDef.TiposCarga.Lateral) if (TipoCarg == (int)RecogidaDef.TiposCarga.Lateral)
VisCombLate = Visibility.Visible; VisCombLate = Visibility.Visible;
@ -595,21 +605,25 @@ namespace OliviaAddInPro
*/ */
public void ComboVehicSel(int tto) public void ComboVehicSel(int tto)
{ {
if (tto < 0) if (tto < 0 )
return; return;
try try
{ {
TipoVehic = tto; TipoVehic = tto;
if (TipoVehic >= 0) if (TipoVehic >= 0)
{ {
int tmv =new LimpiezaServ(null).GetModosViajesDefecto(TipoVehic); if (tipoVehic_old != tto)
if(tmv>=0) {
int tmv = new LimpiezaServ(null).GetModosViajesDefecto(TipoVehic);
if (tmv >= 0)
{ {
TipoMv = tmv; TipoMv = tmv;
} }
}
//si también se ha seleccionado tipo de carga, se rellena la lista de capacidades //si también se ha seleccionado tipo de carga, se rellena la lista de capacidades
rellena_capac(); rellena_capac();
} }
tipoVehic_old = tto;
} }
catch (Exception) catch (Exception)
{ {
@ -628,6 +642,7 @@ namespace OliviaAddInPro
try try
{ {
TipoCapac = tto; TipoCapac = tto;
tipoCapac_old = tto;
rellena_kgmax(); rellena_kgmax();
} }
catch (Exception) catch (Exception)
@ -641,11 +656,12 @@ namespace OliviaAddInPro
*/ */
public void ComboLatSel(int tto) public void ComboLatSel(int tto)
{ {
if (tto < 0) if (tto < 0 || tto== tipoLate_old)
return; return;
try try
{ {
TipoLate = tto; TipoLate = tto;
tipoLate_old = tto;
} }
catch (Exception) catch (Exception)
{ {

View File

@ -105,6 +105,7 @@ namespace OliviaAddInPro
return false; return false;
} }
reco.CapaElems = _subPanel1ViewModel.CapaElems; reco.CapaElems = _subPanel1ViewModel.CapaElems;
reco.CapaElemsRef = reco.CapaElems;
//lee la fracción //lee la fracción
reco.TipoFrac = _subPanel1ViewModel.TipoFrac; reco.TipoFrac = _subPanel1ViewModel.TipoFrac;
if (reco.TipoFrac == -1) if (reco.TipoFrac == -1)