Compare commits

..

No commits in common. "bf4fffcaffde0f84d2e9b56e0f4bd207547474cb" and "3f57544e9d494eb7ac1e44ff260fc897c8e401cd" have entirely different histories.

17 changed files with 160 additions and 350 deletions

View File

@ -30,13 +30,13 @@ namespace OliviaAddInPro
if (OliviaGlob.TipoView == TiposEjecucion.Ninguno)
{
///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,
System.Windows.MessageBoxImage.Warning);
}
else
{
{*/
OliviaGlob.SetFlagTipEjec(TiposEjecucion.Limp);
OliviaGlob.ViewSetFlagTipEjec(TiposEjecucion.Limp);
@ -44,7 +44,7 @@ namespace OliviaAddInPro
OliviaGlob.Limp = new Limpieza();
DockpaneLimpiezaViewModel.Reset();
DockpaneLimpiezaViewModel.Show();
}
//}
}
else if(OliviaGlob.ViewIsProps())
{

View File

@ -28,13 +28,13 @@ namespace OliviaAddInPro
if (OliviaGlob.TipoView == TiposEjecucion.Ninguno)
{
///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,
System.Windows.MessageBoxImage.Warning);
}
else
{
{*/
OliviaGlob.SetFlagTipEjec(TiposEjecucion.Reco);
OliviaGlob.ViewSetFlagTipEjec(TiposEjecucion.Reco);
@ -42,7 +42,7 @@ namespace OliviaAddInPro
OliviaGlob.Reco = new Recogida();
DockpaneRecogidaViewModel.Reset();
DockpaneRecogidaViewModel.Show();
}
//}
}
else if (OliviaGlob.ViewIsProps())
{

View File

@ -1,12 +1,12 @@
<?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">
<AddInInfo id="{10742570-cf59-42f2-bea2-2a38002a06ee}" version="4.0" desktopVersion="3.0.3.36057">
<AddInInfo id="{10742570-cf59-42f2-bea2-2a38002a06ee}" version="3.4" desktopVersion="3.0.3.36057">
<Name>OliviaAddInPro</Name>
<Description>AddIn de Optimización de la Limpieza Viaria para ArcGIs Pro</Description>
<Image>Images\AddinDesktop32.png</Image>
<Author>VSM</Author>
<Company>VSM - Narvaling</Company>
<Date>12/04/2024 12:00:00, 2024</Date>
<Date>27/11/2023 12:00:00, 2023</Date>
<Subject>Framework</Subject>
<!-- Note subject can be one or more of these topics:
Content, Framework, Editing, Geodatabase, Geometry, Geoprocessing, Layouts, Map Authoring, Map Exploration -->

View File

@ -29,7 +29,6 @@ using ArcGIS.Core.Data.Exceptions;
using Microsoft.Win32;
using Microsoft.WindowsAPICodePack.Dialogs;
using System.Security.Cryptography;
using ArcGIS.Desktop.Internal.Mapping;
namespace OliviaAddInPro.Helper
{
@ -707,7 +706,7 @@ namespace OliviaAddInPro.Helper
{
if (filt == null)
filt = new ArcGIS.Core.Data.QueryFilter();
sel = fc.Select(filt, ArcGIS.Core.Data.SelectionType.ObjectID, SelectionOption.Normal);
sel = fc.Select(filt, SelectionType.ObjectID, SelectionOption.Normal);
long nsel = sel.GetCount();
IReadOnlyList<long> ids_ = sel.GetObjectIDs();
ids = ids_.ToList();
@ -738,7 +737,7 @@ namespace OliviaAddInPro.Helper
{
if (filt == null)
filt = new ArcGIS.Core.Data.QueryFilter();
sel = fc.Select(filt, ArcGIS.Core.Data.SelectionType.ObjectID, SelectionOption.Normal);
sel = fc.Select(filt, SelectionType.ObjectID, SelectionOption.Normal);
var nsel = sel.GetCount();
IReadOnlyList<long> ids_ = sel.GetObjectIDs();
ids = ids_.ToList();
@ -1184,16 +1183,6 @@ namespace OliviaAddInPro.Helper
geomIni = GeometryEngine.Instance.ConvexHull(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
*/
@ -1205,7 +1194,6 @@ namespace OliviaAddInPro.Helper
try
{
var geom = new List<ArcGIS.Core.Geometry.Geometry>();
using (RowCursor rowCursor = fclss.Search(filtro))
{
@ -1214,10 +1202,7 @@ namespace OliviaAddInPro.Helper
using (Row row = rowCursor.Current)
{
if (row is Feature ft)
{
geom.Add(ft.GetShape());
}
geom.Add(ft.GetShape());
}
}
geomsal = GeometryEngine.Instance.Union(geom);
@ -1358,7 +1343,7 @@ namespace OliviaAddInPro.Helper
//realiza consulta
n = 0;
//fc.GetDefinition().GetFields().First().Name kfadpskfpasp
using (Selection sel = fc.Select(new ArcGIS.Core.Data.QueryFilter { WhereClause = consulta }, ArcGIS.Core.Data.SelectionType.ObjectID, SelectionOption.Normal))
using (Selection sel = fc.Select(new ArcGIS.Core.Data.QueryFilter { WhereClause = consulta }, SelectionType.ObjectID, SelectionOption.Normal))
n = sel.GetCount();
}
}
@ -1389,7 +1374,7 @@ namespace OliviaAddInPro.Helper
{
//realiza consulta
n = 0;
using (Selection sel = fc.Select(new ArcGIS.Core.Data.QueryFilter { WhereClause = consulta }, ArcGIS.Core.Data.SelectionType.ObjectID, SelectionOption.Normal))
using (Selection sel = fc.Select(new ArcGIS.Core.Data.QueryFilter { WhereClause = consulta }, SelectionType.ObjectID, SelectionOption.Normal))
n = sel.GetCount();
}
}
@ -1479,13 +1464,10 @@ namespace OliviaAddInPro.Helper
if (debug)
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
try
{
var aux = fc.Select(filter, ArcGIS.Core.Data.SelectionType.ObjectID, SelectionOption.Normal);
var aux = fc.Select(filter, SelectionType.ObjectID, SelectionOption.Normal);
var aux2 = aux.GetObjectIDs();
//ids = fc.Select(filter, SelectionType.ObjectID, SelectionOption.Normal).GetObjectIDs().ToList();
ids = aux2.ToList();
@ -1768,49 +1750,11 @@ namespace OliviaAddInPro.Helper
ArcGIS.Core.Geometry.Geometry geomBuff = null;
try
{
//GeometryEngine.Instance.Buffer(geom.)
//geomBuff= GeometryEngine.Instance.ConvexHull(geom);
//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);
geomBuff = GeometryEngine.Instance.Buffer(geom, buffer);
}
catch( Exception e)
catch
{
//resp.HasError = true;
if (resp.Error.IsNullOrEmpty())
resp.Error = new List<string>();
resp.Error.Add(e.Message);
return resp;
}
resp.Value = geomBuff;
return resp;
@ -1853,9 +1797,9 @@ namespace OliviaAddInPro.Helper
}
}
}
while (repite);*/
while (repite);*/
buffer = buff;
geom_pto = HelperGdb.BufferGeom((ArcGIS.Core.Geometry.Geometry)pto.ToMapPoint(geom.SpatialReference),buffer).Value; //GeometryEngine.Instance.Buffer(pto.ToMapPoint(), buffer);
geom_pto = GeometryEngine.Instance.Buffer(pto.ToMapPoint(), buffer);
if (geom_pto == null || geom_pto.IsEmpty)
{
resp.Value = null;
@ -2412,7 +2356,7 @@ namespace OliviaAddInPro.Helper
/**
* 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, ArcGIS.Core.Geometry.SpatialReference spatref=null)
public static Respuesta<bool> ImportShp(string nom_shp, string Gdb_dataset, string namefc)
{
var res = new Respuesta<bool> { Value = false };
string[] args = { nom_shp, Gdb_dataset, namefc };
@ -2420,8 +2364,7 @@ namespace OliviaAddInPro.Helper
try
{
if(spatref==null)
spatref = GetSpatRef(nom_shp);
ArcGIS.Core.Geometry.SpatialReference spatref = GetSpatRef(nom_shp);
var environments = Geoprocessing.MakeEnvironmentArray(outputCoordinateSystem: spatref);
//CancelableProgressorSource cps = new CancelableProgressorSource();
var _cts = new System.Threading.CancellationTokenSource();

View File

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

View File

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

View File

@ -405,13 +405,9 @@ namespace OliviaAddInPro.Model
int n, i_def, icar, iveh;
//Rellena las opciones de carga máxima por vehículo
//////////////////////////////////////////////////
//Carga Trasera
////////////////////////////////////////////////
//Trasera-satelite
n = 4;
i_def = 2;
//Rellena volumenes
info[0] = 2;
info[1] = 3;
info[2] = 5;
@ -429,7 +425,6 @@ namespace OliviaAddInPro.Model
//Trasera-2 ejes
n = 6;
i_def = 2;
//Rellena volumenes
info[0] = 8;
info[1] = 10;
info[2] = 12;
@ -452,7 +447,6 @@ namespace OliviaAddInPro.Model
//Trasera-3ejes
n = 4;
i_def = 3;
//Rellena volumenes
info[0] = 18;
info[1] = 20;
info[2] = 22;
@ -460,9 +454,6 @@ namespace OliviaAddInPro.Model
rellena_carg((int)RecogidaDef.TiposCarga.Trasera,
(int)RecogidaDef.TiposVehic.Ejes3, n, i_def, info);
//////////////////////////////////////////////////
//Carga Lateral
////////////////////////////////////////////////
//Lateral-satelite, no hay
rellena_carg((int)RecogidaDef.TiposCarga.Lateral,
(int)RecogidaDef.TiposVehic.Satelite, 0, 0, null);
@ -470,7 +461,6 @@ namespace OliviaAddInPro.Model
//Lateral - 2 ejes
n = 2;
i_def = 1;
//Rellena volumenes
info[0] = 15;
info[1] = 17;
rellena_carg((int)RecogidaDef.TiposCarga.Lateral,
@ -486,7 +476,6 @@ namespace OliviaAddInPro.Model
//Lateral - 3 ejes
n = 3;
i_def = 2;
//Rellena volumenes
info[0] = 21;
info[1] = 23;
info[2] = 26;
@ -497,13 +486,9 @@ namespace OliviaAddInPro.Model
rellena_carg((int)RecogidaDef.TiposCarga.Superior,
(int)RecogidaDef.TiposVehic.Satelite, 0, 0, null);
//////////////////////////////////////////////////
//Carga Superior
////////////////////////////////////////////////
//Superior - 2 ejes
n = 2;
i_def = 0;
//Rellena volumenes
info[0] = 16;
info[1] = 17;
rellena_carg((int)RecogidaDef.TiposCarga.Superior,
@ -512,7 +497,6 @@ namespace OliviaAddInPro.Model
//Superior - 3 ejes
n = 3;
i_def = 2;
//Rellena volumenes
info[0] = 20;
info[1] = 23;
info[2] = 25;
@ -523,9 +507,47 @@ namespace OliviaAddInPro.Model
rellena_carg((int)RecogidaDef.TiposCarga.Bilateral,
(int)RecogidaDef.TiposVehic.Satelite, 0, 0, null);
//////////////////////////////////////////////////
//Carga Bilateral
////////////////////////////////////////////////
//Bilateral - 2 ejes
n = 3;
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
n = 1;
i_def = 0;
@ -555,50 +577,6 @@ namespace OliviaAddInPro.Model
info[0] = -2050;
rellena_carg_offset((int)RecogidaDef.TiposCarga.Bilateral,
(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
@ -836,15 +814,22 @@ namespace OliviaAddInPro.Model
//Bilateral - 2 ejes - vidrio
rellena_carg_offset((int)RecogidaDef.TiposCarga.Superior,
(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
info[0] = 1540;
info[1] = 1760;
info[2] = 1980;
info[0] = 1820;
info[1] = 2080;
info[2] = 2340;
rellena_carg_offset((int)RecogidaDef.TiposCarga.Bilateral,
(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
n = 3;

View File

@ -28,16 +28,11 @@ namespace OliviaAddInPro.Model
/**
* Tipo modo de viaje
*/
public int TipoMV { get; set; } = -1;
public int TipoMV { get; set; } = 1;
/**
* Capa de ámbitos
*/
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
*/

View File

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

View File

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

View File

@ -11,7 +11,6 @@ using ArcGIS.Core.Internal.Data;
using ArcGIS.Desktop.Framework.Threading.Tasks;
using System.Windows;
using System.IO;
using ArcGIS.Core.Data.UtilityNetwork.Trace;
namespace OliviaAddInPro.Services
{
@ -74,7 +73,7 @@ namespace OliviaAddInPro.Services
//Comprueba que tiene las columnas necesarias para planificar
if ((modo == ModosEjec.Planifica) && !CompruebaPlanif())
{
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";
ErrStr = "En la capa de ámbitos seleccionada no se encuentran columnas de SECTOR y/o SECUENCIA, necesarias para planificar";
return false;
}
if (com.ProgrSrc._ProgrSrc.Getcancelled())
@ -145,18 +144,9 @@ namespace OliviaAddInPro.Services
ErrStr = Resource1.String_cancel_progreso;
return false;
}
//mira spatialreference de los datos de entrada
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;
}
//mira spatialreference de los datos de entrada
spatRefData = geom_export.SpatialReference;
//crea el filtro de exportación
filtroEspacial = HelperGdb.CreateFiler(com.ConsultaAmbs, geom_export);
if (filtroEspacial == null)
@ -182,7 +172,7 @@ namespace OliviaAddInPro.Services
//Guarda el nombre
OliviaGlob.Paths.PathData = OliviaGlob.Paths.DirData + com.NombreShpExport;
//exporta los datos de entrada
if (!HelperGdb.ExportShp2(com.CapaElems, filtroEspacial, com.NombreShpExport, OliviaGlob.Paths.DirData, com.ProgrSrc._ProgrSrc, spatref, 50))
if (!HelperGdb.ExportShp2(com.CapaElems, filtroEspacial, com.NombreShpExport, OliviaGlob.Paths.DirData, com.ProgrSrc._ProgrSrc, null, 50))
{
ErrStr = "Error al exportar los ámbitos: " + HelperGdb.OutStr;
return false;
@ -196,7 +186,7 @@ namespace OliviaAddInPro.Services
/////////////////////////////////////////////////////////////////////
///Comprueba si está la columna de ObjectId y si no, la crea
if(!ComprCreaColOid(OliviaGlob.Paths.PathData, com.CapaElems, null))
if(!ComprCreaColOid(OliviaGlob.Paths.PathData, com.CapaElems, filtroEspacial))
{
ErrStr = "Error al exportar columna " + ComunDef.CamposCom.camp_oid;
return false;
@ -348,17 +338,14 @@ namespace OliviaAddInPro.Services
//guarda la mima de la geometría de la red navegable a exportar
com.MimaNw = geom_export.Extent;
//////////////////////////////////////
///
//Hace el filtro con la geometría final
//ComunDef.configMV
var where = String.Empty;
if (!String.IsNullOrEmpty(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);
if (filtroEspacial == null)
{
@ -366,6 +353,11 @@ namespace OliviaAddInPro.Services
return false;
}
if (com.ProgrSrc._ProgrSrc.Getcancelled())
{
ErrStr = Resource1.String_cancel_progreso;
return false;
}
com.ProgrSrc.IncMessage(10, "Exportando red navegable");//60%
//Prepara nombre de exportación
@ -373,12 +365,11 @@ namespace OliviaAddInPro.Services
//guarda los nombres del shape
OliviaGlob.Paths.PathNW = OliviaGlob.Paths.DirData + com.NombreShpExportNw;
//exporta los datos de entrada
if (!HelperGdb.ExportShp2(OliviaGlob.Paths.PathGdbNw, filtroEspacial, com.NombreShpExportNw, OliviaGlob.Paths.DirData, com.ProgrSrc._ProgrSrc, spatref,100))
if (!HelperGdb.ExportShp2(OliviaGlob.Paths.PathGdbNw, filtroEspacial, com.NombreShpExportNw, OliviaGlob.Paths.DirData, com.ProgrSrc._ProgrSrc, spatRefData,100))
{
ErrStr = "Error al exportar la red navegable: " + HelperGdb.OutStr;
return false;
}
//OliviaGlob.Paths.PathGdbNw.Replace("1.", ".");
}
if (com.ProgrSrc._ProgrSrc.Getcancelled())
{
ErrStr = Resource1.String_cancel_progreso;
@ -404,19 +395,9 @@ 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
com.ProgrSrc.IncMessage(10, "Estandarizando campos de la red");//60%
if (!EstandarizaCamposNW(OliviaGlob.Paths.PathNW))
if (!EstandarizaCamposNW(OliviaGlob.Paths.DirData+com.NombreShpExportNw))
{
ErrStr = "Error al estandarizar campos red navegable: " + HelperGdb.OutStr;
return false;
@ -432,7 +413,7 @@ namespace OliviaAddInPro.Services
}
bool EstandarizaCamposNW(string pathNW)
{
HelperGdb.FieldToAdd[] fields = new HelperGdb.FieldToAdd[10];
HelperGdb.FieldToAdd[] fields = new HelperGdb.FieldToAdd[9];
//campo SECTOR
int i = 0;
fields[i].Name = ComunDef.CamposNW.cons_kph;
@ -476,7 +457,7 @@ namespace OliviaAddInPro.Services
fields[i].Tipo = "LONG";
fields[i].Length = 0;
i++;
fields[i].Name = ComunDef.CamposNW.cons_name;
fields[i].Alias = ComunDef.CamposNW.cons_name;
fields[i].Tipo = "TEXT";
@ -487,18 +468,13 @@ namespace OliviaAddInPro.Services
fields[i].Alias = ComunDef.CamposNW.cons_angulo;
fields[i].Tipo = "FLOAT";
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))
return false;
if (!HelperGdb.CalculateFieldsSync(pathNW, ComunDef.CamposNW.cons_kph, ComunDef.CamposNW.config.campo_velocidad))
return false;
if (!HelperGdb.CalculateFieldsSync(pathNW, ComunDef.CamposNW.cons_name, ComunDef.CamposNW.config.campo_nombre))
return false;
if (!HelperGdb.CalculateFieldsSync(pathNW, ComunDef.CamposNW.cons_fow, ComunDef.CamposNW.config.campo_peatonal))
@ -515,14 +491,9 @@ namespace OliviaAddInPro.Services
if (!HelperGdb.CalculateFieldsSync(pathNW, ComunDef.CamposNW.cons_evit, ComunDef.configMV.campo_prioridad))
return false;
if (!HelperGdb.CalculateFieldsSync(pathNW, ComunDef.CamposNW.cons_angulo, ComunDef.CamposNW.config.campo_angulos))
return false;
using (FeatureClass fc =HelperGdb.GetFtClassSync(pathNW))
{
if (!HelperGdb.CalculateFieldsSync(pathNW, ComunDef.CamposCom.camp_oid, "$feature."+fc.GetDefinition().GetObjectIDField()))
return false;
}
return true;
}
/**
@ -665,7 +636,7 @@ namespace OliviaAddInPro.Services
/**
* Comrpueba si existe la columna de oid y si no, la crea y la rellena
*/
public bool ComprCreaColOid(string pathCapa, string pathCapaOrig, SpatialQueryFilter filter=null)
public bool ComprCreaColOid(string pathCapa, string pathCapaOrig, SpatialQueryFilter filter)
{
//comprueba si está el campo
bool compCamp = HelperGdb.CheckField(pathCapa, ComunDef.CamposCom.camp_oid);
@ -684,7 +655,6 @@ namespace OliviaAddInPro.Services
if (!HelperGdb.AddFieldsSync(pathCapa, fields))
return false;
//vuelve a cerrar la capa
string capa_principal = System.IO.Path.GetFileNameWithoutExtension(pathCapa);
HelperGdb.CloseLayer(capa_principal);
@ -693,32 +663,23 @@ namespace OliviaAddInPro.Services
//Coge los ids de la capa de la que ha exportado
using (FeatureClass fc_orig = HelperGdb.GetFtClassSync(pathCapaOrig))
{
if (fc_orig == null)
return false;
List<long> ids = new List<long>();
//Añade a la lista los ids que cumplen el filtro espacial
try
{
ids = fc_orig.Select(filter, SelectionType.ObjectID, SelectionOption.Normal).GetObjectIDs().ToList();
}
catch
{
ids = new List<long>();
}
//Comprueba que hay tantos ids como elementos en el shp
using (FeatureClass fc_shp = HelperGdb.GetFtClassSync(pathCapa))
{
if (fc_orig == null)
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>();
//Añade a la lista los ids que cumplen el filtro espacial
try
{
ids = fc_orig.Select(filter, SelectionType.ObjectID, SelectionOption.Normal).GetObjectIDs().ToList();
}
catch
{
ids = new List<long>();
}
//Comprueba que hay tantos ids como elementos en el shp
long nelem_shp = HelperGdb.GetNumElemsSync(fc_shp);
if (nelem_shp != ids.Count)
return false;
@ -770,48 +731,6 @@ namespace OliviaAddInPro.Services
/**
* 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()
{
Geometry geomAux = null;
@ -1205,7 +1124,7 @@ namespace OliviaAddInPro.Services
}
}
resp2 = HelperGdb.ImportShp(dir_shp + "\\" + noms_shp[i] + HelperGdb.SHP_EXT, GdbFileName + "\\" + dataset, noms_gdb[i], spatRefData);
resp2 = HelperGdb.ImportShp(dir_shp + "\\" + noms_shp[i] + HelperGdb.SHP_EXT, GdbFileName + "\\" + dataset, noms_gdb[i]);
if (!resp2.Value)
{
err_st = "Error al importar la capa " + noms_gdb[i];

View File

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

View File

@ -64,20 +64,20 @@
<ContentPresenter Name="PaneEjecutar">
<ContentPresenter.Content>
<StackPanel Orientation="Vertical">
<Grid Margin="0,30,0,0">
<Grid Margin="0,10,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100"/>
<ColumnDefinition Width="100"/>
<ColumnDefinition Width="100"/>
</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_planif" Grid.Column="2" Style="{DynamicResource Esri_Button}" Content="Planificar" Margin="10,0,0,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>
</StackPanel>
</ContentPresenter.Content>
</ContentPresenter>
</StackPanel>
<StackPanel Grid.Row="3" Margin="0,90,10,0">
<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"/>

View File

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

View File

@ -80,7 +80,6 @@ namespace OliviaAddInPro
return false;
}
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
if (_subPanel1ViewModel.SelOpAmb == 1)
{

View File

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

View File

@ -104,8 +104,7 @@ namespace OliviaAddInPro
err_str = "No se ha seleccionado ninguna Capa de Limpieza";
return false;
}
reco.CapaElems = _subPanel1ViewModel.CapaElems;
reco.CapaElemsRef = reco.CapaElems;
reco.CapaElems = _subPanel1ViewModel.CapaElems;
//lee la fracción
reco.TipoFrac = _subPanel1ViewModel.TipoFrac;
if (reco.TipoFrac == -1)