Compare commits

..

16 Commits

34 changed files with 1336 additions and 2998 deletions

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.2" desktopVersion="3.0.3.36057"> <AddInInfo id="{10742570-cf59-42f2-bea2-2a38002a06ee}" version="4.2.2.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>18/04/2023 12:00:00, 2023</Date> <Date>26/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

@ -28,6 +28,8 @@ using System.Threading;
using ArcGIS.Core.Data.Exceptions; using ArcGIS.Core.Data.Exceptions;
using Microsoft.Win32; using Microsoft.Win32;
using Microsoft.WindowsAPICodePack.Dialogs; using Microsoft.WindowsAPICodePack.Dialogs;
using System.Security.Cryptography;
using ArcGIS.Desktop.Internal.Mapping;
namespace OliviaAddInPro.Helper namespace OliviaAddInPro.Helper
{ {
@ -466,7 +468,7 @@ namespace OliviaAddInPro.Helper
{ {
ftclss = dtset.OpenDataset<FeatureClass>(ftclassName); ftclss = dtset.OpenDataset<FeatureClass>(ftclassName);
} }
catch (Exception ex) catch/* (Exception ex)*/
{ {
ftclss = null; ftclss = null;
} }
@ -477,7 +479,7 @@ namespace OliviaAddInPro.Helper
{ {
ftclss = gdb.OpenDataset<FeatureClass>(ftclassName); ftclss = gdb.OpenDataset<FeatureClass>(ftclassName);
} }
catch (Exception ex) catch /*(Exception ex)*/
{ {
ftclss = null; ftclss = null;
} }
@ -525,7 +527,7 @@ namespace OliviaAddInPro.Helper
{ {
ftclss = dtset.OpenDataset<FeatureClass>(ftclassName); ftclss = dtset.OpenDataset<FeatureClass>(ftclassName);
} }
catch (Exception ex) catch /*(Exception ex)*/
{ {
ftclss = null; ftclss = null;
} }
@ -536,7 +538,7 @@ namespace OliviaAddInPro.Helper
{ {
ftclss = gdb.OpenDataset<FeatureClass>(ftclassName); ftclss = gdb.OpenDataset<FeatureClass>(ftclassName);
} }
catch (Exception ex) catch /*(Exception ex)*/
{ {
ftclss = null; ftclss = null;
} }
@ -672,7 +674,7 @@ namespace OliviaAddInPro.Helper
public static ArcGIS.Core.Data.SpatialQueryFilter CreateFiler(string consulta, ArcGIS.Core.Geometry.Geometry geom, SpatialRelationship rel = SpatialRelationship.Contains) public static ArcGIS.Core.Data.SpatialQueryFilter CreateFiler(string consulta, ArcGIS.Core.Geometry.Geometry geom, SpatialRelationship rel = SpatialRelationship.Contains)
{ {
ArcGIS.Core.Data.SpatialQueryFilter filt = null; ArcGIS.Core.Data.SpatialQueryFilter filt = null;
if (geom != null) if (geom != null && !geom.IsEmpty)
{ {
SpatialQueryFilter filtSpat = new SpatialQueryFilter SpatialQueryFilter filtSpat = new SpatialQueryFilter
{ {
@ -705,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();
@ -736,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();
@ -1182,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
*/ */
@ -1193,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))
{ {
@ -1201,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);
@ -1342,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();
} }
} }
@ -1373,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();
} }
} }
@ -1444,7 +1460,7 @@ namespace OliviaAddInPro.Helper
if (!System.IO.Directory.Exists(outpath)) if (!System.IO.Directory.Exists(outpath))
System.IO.Directory.CreateDirectory(outpath); System.IO.Directory.CreateDirectory(outpath);
FeatureClass fc = null; FeatureClass fc = null;
bool debug = true; bool debug = false;
///////////////////////////////////////////////////////// /////////////////////////////////////////////////////////
//Prepara una where_clause con las entidades que cumplen el filtro //Prepara una where_clause con las entidades que cumplen el filtro
//Abre la featureclass //Abre la featureclass
@ -1463,12 +1479,19 @@ 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
{ {
ids = fc.Select(filter, SelectionType.ObjectID, SelectionOption.Normal).GetObjectIDs().ToList(); var aux = fc.Select(filter, ArcGIS.Core.Data.SelectionType.ObjectID, SelectionOption.Normal);
var aux2 = aux.GetObjectIDs();
//ids = fc.Select(filter, SelectionType.ObjectID, SelectionOption.Normal).GetObjectIDs().ToList();
ids = aux2.ToList();
} }
catch(Exception ex) catch (Exception ex)
{ {
OutStr = "Error al seleccionar IDs. "+ex.Message; OutStr = "Error al seleccionar IDs. "+ex.Message;
ids = new List<long>(); ids = new List<long>();
@ -1489,6 +1512,8 @@ namespace OliviaAddInPro.Helper
OutStr = "Error al aplicar filtro espacial en exportación: "+ OutStr; OutStr = "Error al aplicar filtro espacial en exportación: "+ OutStr;
return false; return false;
} }
if (debug)
HelperGlobal.ponMsg("Número de líneas a exportar "+ids.Count);
///////////////////////////////////////////////////////// /////////////////////////////////////////////////////////
if (cps.Getcancelled()) if (cps.Getcancelled())
{ {
@ -1498,7 +1523,8 @@ namespace OliviaAddInPro.Helper
//convierte la lista de ids a string para la clause de la forma //convierte la lista de ids a string para la clause de la forma
//(id1, id2, id3..) //(id1, id2, id3..)
string whereClause = GetWhereClauseFromIds(ids,fc.GetDefinition().GetObjectIDField()); string whereClause = GetWhereClauseFromIds(ids,fc.GetDefinition().GetObjectIDField());
if (debug)
HelperGlobal.ponMsg(whereClause);
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
///Exporta ///Exporta
string[] args = { pathLayerIn, outpath, nameShp, whereClause }; string[] args = { pathLayerIn, outpath, nameShp, whereClause };
@ -1742,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);
//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 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;
@ -1758,7 +1822,7 @@ namespace OliviaAddInPro.Helper
{ {
Respuesta<ArcGIS.Core.Geometry.Geometry> resp = new Respuesta<ArcGIS.Core.Geometry.Geometry>(); Respuesta<ArcGIS.Core.Geometry.Geometry> resp = new Respuesta<ArcGIS.Core.Geometry.Geometry>();
double buffer = 0;//m de distancia desde la instalación double buffer = 0;//m de distancia desde la instalación
bool repite = true; //bool repite = true;
ArcGIS.Core.Geometry.Geometry geom_pto, geom_sal; ArcGIS.Core.Geometry.Geometry geom_pto, geom_sal;
try try
{ {
@ -1791,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;
@ -2069,7 +2133,7 @@ namespace OliviaAddInPro.Helper
MapView.Active.Map.RemoveLayer(lyr); MapView.Active.Map.RemoveLayer(lyr);
return true; return true;
} }
catch (Exception ex) catch/*(Exception ex)*/
{ {
return false; return false;
} }
@ -2129,7 +2193,7 @@ namespace OliviaAddInPro.Helper
else else
return string.Empty; return string.Empty;
} }
catch(Exception ex) catch/*(Exception ex)*/
{ {
return string.Empty; return string.Empty;
} }
@ -2217,7 +2281,7 @@ namespace OliviaAddInPro.Helper
return 0; return 0;
return 2; return 2;
} }
catch (Exception ex) catch /*(Exception ex)*/
{ {
return 1; return 1;
} }
@ -2247,8 +2311,8 @@ namespace OliviaAddInPro.Helper
return res; return res;
} }
//comprueba si extiste ya el dataset //comprueba si extiste ya el dataset
bool repite = false; //bool repite = false;
bool crea = false; //bool crea = false;
int idat = 1; int idat = 1;
int r = 2; int r = 2;
bool refspatdif = false; bool refspatdif = false;
@ -2348,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 };
@ -2356,11 +2420,12 @@ 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();
var completa = false; //var completa = false;
var gpres = Geoprocessing.ExecuteToolAsync("FeatureClassToFeatureClass_conversion", args, environments, _cts.Token, var gpres = Geoprocessing.ExecuteToolAsync("FeatureClassToFeatureClass_conversion", args, environments, _cts.Token,
(event_name, o) => // implement delegate and handle events (event_name, o) => // implement delegate and handle events
{ {
@ -2675,7 +2740,7 @@ namespace OliviaAddInPro.Helper
featureLayer.SetRenderer(uniqueValueRenderer); featureLayer.SetRenderer(uniqueValueRenderer);
} }
catch (Exception ex) catch /*(Exception ex)*/
{ {
} }
@ -2747,7 +2812,7 @@ namespace OliviaAddInPro.Helper
/* /*
* Renombra un campo de la feature class dada * Renombra un campo de la feature class dada
*/ */
public static bool AddFieldsSync(string fcname, FieldToAdd[] fields) public static bool AddFieldsSync(string fcname, FieldToAdd[] fields)
{ {
bool res = false; bool res = false;
@ -2807,6 +2872,69 @@ namespace OliviaAddInPro.Helper
{ {
} }
return res;
}
public static bool ExplodeAll(string pahtFc)
{
/*
var ft = GetFtClassSync(pahtFc);
var ids=ft.Select(new ArcGIS.Core.Data.QueryFilter() { WhereClause = "true" }, SelectionType.ObjectID, SelectionOption.Normal).GetObjectIDs().ToList();
var explodeFeatures = new EditOperation();
explodeFeatures.Name = "Explode Features";
//Take a multipart and convert it into one feature per part
//Provide a list of ids to convert multiple
explodeFeatures.Explode(ft, ids, true);
//Execute to execute the operation
//Must be called within QueuedTask.Run
if (!explodeFeatures.IsEmpty)
{
var result = explodeFeatures.Execute(); //Execute and ExecuteAsync will return true if the operation was successful and false if not
}
return true;
//or use async flavor
//await explodeFeatures.ExecuteAsync();
*/
return true;
}
/*
* Añadir columna calculada
*/
public static bool CalculateFieldsSync(string fcname, string field, string sqlquery)
{
bool res = false;
var args = Geoprocessing.MakeValueArray(fcname, field, sqlquery, "ARCADE");
// run the tool
try
{
var gpres = Geoprocessing.ExecuteToolAsync("management.CalculateField", args);
while (!gpres.IsCompleted && !gpres.IsCanceled && !gpres.IsFaulted)
Thread.Sleep(10);
if (gpres.IsFaulted)
{
var gpResult = gpres.Result;
string msg;
if (gpResult.ErrorMessages != null)
msg = gpResult.ErrorMessages.First().Text;
else
msg = "Errores al calcular campo "+ field;
}
else
{
res = true; //ha ido bien
}
gpres.Dispose();
return res;
}
catch
{
}
return res; return res;
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -10,18 +10,28 @@ namespace OliviaAddInPro.Model
//************************************************************************************* //*************************************************************************************
//Enums y structs generales //Enums y structs generales
public static int BuffExport = 1000; public static int BuffExport = 1000;
//public static int MaxCaracteresBBDD = 10;
//public static int MaxCaracteresBBDD = 10;
public static OliviaConfMV configMV; //configuracion para modos de viaje
/** /**
* Nombre de los campos de la cartografía de la red navegable que se consultan para la exportación * Nombre de los campos de la cartografía de la red navegable que se consultan para la exportación
*/ */
public struct CamposNW public struct CamposNW
{ {
public static string cons_onew; //<Campo que indica el sentido public static string cons_onewFT="_sen_ft"; //<Campo que indica el sentido
public static string cons_kph; //<Campo que indica la velocidad en kph public static string cons_onewTF="_sen_tf"; //<Campo que indica el sentido
public static string cons_name; //<Campo que indica el nombre de la calle
public static string cons_fow; //Campo que indica el tipo de vial, si es peatonal o no public static string cons_kph="_vel"; //<Campo que indica la velocidad en kph
public static string cons_name="_dir"; //<Campo que indica el nombre de la calle
public static string cons_fow="_pea"; //Campo que indica el tipo de vial, si es peatonal o no
public static string cons_evit = "_evita"; //Campo que indica si el vial es evitable
public static string cons_ele_f = "_elev_f"; //altura from
public static string cons_ele_t = "_elev_t"; //altura to
public static string cons_angulo = "_angulo"; //altura to
public static OliviaConfNW config; //configuracion para sacar capmos por defecto
}; };
/** /**
* Nombre de los Atributos de la cartografía de la red navegable que se consultan para la exportación * Nombre de los Atributos de la cartografía de la red navegable que se consultan para la exportación
*/ */

View File

@ -65,6 +65,9 @@ namespace OliviaAddInPro.Model
Respuesta<bool> res = new Respuesta<bool> { Value=false}; Respuesta<bool> res = new Respuesta<bool> { Value=false};
Respuesta<TiposEjecucion> res2 = new Respuesta<TiposEjecucion> (){ Value = TiposEjecucion.FinEjecNOk }; Respuesta<TiposEjecucion> res2 = new Respuesta<TiposEjecucion> (){ Value = TiposEjecucion.FinEjecNOk };
Serv.TipoMv = TipoMV;
res = Serv.Ejecuta(modo); res = Serv.Ejecuta(modo);
if (res.Value) if (res.Value)
{ {

View File

@ -11,9 +11,14 @@ using System.Windows;
using Xceed.Wpf.Toolkit.PropertyGrid; using Xceed.Wpf.Toolkit.PropertyGrid;
using Xceed.Wpf.Toolkit.PropertyGrid.Editors; using Xceed.Wpf.Toolkit.PropertyGrid.Editors;
using Xceed.Wpf.Toolkit.PropertyGrid.Attributes; using Xceed.Wpf.Toolkit.PropertyGrid.Attributes;
using static OliviaAddInPro.Model.OliviaConf;
using System.Reflection;
using System.Collections.ObjectModel;
namespace OliviaAddInPro.Model namespace OliviaAddInPro.Model
{ {
[CategoryOrder("General", 1)] [CategoryOrder("General", 1)]
[CategoryOrder("Campos Limpieza", 2)] [CategoryOrder("Campos Limpieza", 2)]
[CategoryOrder("Atributos Limpieza", 3)] [CategoryOrder("Atributos Limpieza", 3)]
@ -44,12 +49,30 @@ namespace OliviaAddInPro.Model
[Description("Usa 'Kg por Defecto'")] [Description("Usa 'Kg por Defecto'")]
UsaKgDef UsaKgDef
} }
[TypeConverter(typeof(EnumOpsNWToString))]
public enum OpsNW
{
nw_0/*, //TomTom
nw_1, //Streetmap
nw_2, //
nw_3,
nw_4,
*/
}
private string m2s(int min) private string m2s(int min)
{ {
var val = min; var val = min;
int horas = val / 60; int horas = val / 60;
return string.Format("{0}:{1:D2}", horas, val - (horas * 60)); return string.Format("{0}:{1:D2}", horas, val - (horas * 60));
} }
public OliviaConfNW GetOliviaConfNW()
{
int i = (int)Tipo_eje_via;
if (ListaNw != null && ListaNw.Count() > i)
return ListaNw[i];
return null;
}
private int s2m(string str, int defec) private int s2m(string str, int defec)
{ {
var match = Regex.Match(str, @"^([0-9]*):([0-9]*)"); var match = Regex.Match(str, @"^([0-9]*):([0-9]*)");
@ -66,16 +89,20 @@ namespace OliviaAddInPro.Model
} }
return defec; return defec;
} }
public OliviaConf() public OliviaConf()
{ {
Ip = "127.0.0.1"; Ip = "127.0.0.1";
Puerto = 19995; Puerto = 19995;
TiempoOutSocket = 20; TiempoOutSocket = 20;
}
}
#region PropiedadesOcultas #region PropiedadesOcultas
#region parametrosConexion #region parametrosConexion
/**
* Version de las configuraciones
*/
[Browsable(false)]
public string Version { get; set; }
/** /**
* IP donde va a realizar la conexión a OliviaTask, se inicializa al arrancar con la local * IP donde va a realizar la conexión a OliviaTask, se inicializa al arrancar con la local
*/ */
@ -174,7 +201,10 @@ namespace OliviaAddInPro.Model
#endregion #endregion
#region ParametrosReco_Ocultos #region ParametrosReco_Ocultos
[Browsable(false)]
public List<OliviaConfNW> ListaNw { get; set; }
[Browsable(false)]
public List<OliviaConfMV> ListaMV { get; set; }
[Browsable(false)] [Browsable(false)]
public int t_vaciado_max { get; set; } public int t_vaciado_max { get; set; }
[Browsable(false)] [Browsable(false)]
@ -218,6 +248,19 @@ namespace OliviaAddInPro.Model
[Description("Red de carreteras que se usa para la navegación")] [Description("Red de carreteras que se usa para la navegación")]
[Editor(typeof(PropertyGridFilePickerLine), typeof(PropertyGridFilePickerLine))] [Editor(typeof(PropertyGridFilePickerLine), typeof(PropertyGridFilePickerLine))]
public string Path_Eje_via { get; set; } public string Path_Eje_via { get; set; }
[Category("General")]
[DisplayName("Conjunciones red de carreteras")]
[PropertyOrder(1)]
[Description("Conjunciones red de carreteras que se usa para la navegación")]
[Editor(typeof(PropertyGridFilePickerPto), typeof(PropertyGridFilePickerPto))]
public string Path_Conj_Eje_via { get; set; }
[Category("General")]
[DisplayName("Tipo Red de carreteras")]
[PropertyOrder(1)]
[Description("Tipo de Red de carreteras que se usa para la navegación")]
[RefreshProperties(System.ComponentModel.RefreshProperties.All)]
//[Editor(typeof(PropertyGridFilePickerLine), typeof(PropertyGridFilePickerLine))]
public OpsNW Tipo_eje_via { get; set; }
[Category("General")] [Category("General")]
[PropertyOrder(2)] [PropertyOrder(2)]
@ -448,6 +491,7 @@ namespace OliviaAddInPro.Model
{ {
val= OpsRecoCont.UsaKgDef; val= OpsRecoCont.UsaKgDef;
} }
check(val);
return val; return val;
} }
set set
@ -475,14 +519,23 @@ namespace OliviaAddInPro.Model
{ {
PropertyDescriptor propDescrKgDef = TypeDescriptor.GetProperties(this.GetType())["kgrec_val"]; PropertyDescriptor propDescrKgDef = TypeDescriptor.GetProperties(this.GetType())["kgrec_val"];
PropertyDescriptor propDescrKgTabla = TypeDescriptor.GetProperties(this.GetType())["kgrec"]; PropertyDescriptor propDescrKgTabla = TypeDescriptor.GetProperties(this.GetType())["kgrec"];
if (propDescrKgDef == null && propDescrKgTabla == null)
{
return;
}
ReadOnlyAttribute attrKgDef = propDescrKgDef.Attributes[typeof(ReadOnlyAttribute)] as ReadOnlyAttribute; ReadOnlyAttribute attrKgDef = propDescrKgDef.Attributes[typeof(ReadOnlyAttribute)] as ReadOnlyAttribute;
ReadOnlyAttribute attrKgTabla = propDescrKgTabla.Attributes[typeof(ReadOnlyAttribute)] as ReadOnlyAttribute; ReadOnlyAttribute attrKgTabla = propDescrKgTabla.Attributes[typeof(ReadOnlyAttribute)] as ReadOnlyAttribute;
if (attrKgDef != null && attrKgTabla != null) if (attrKgDef != null && attrKgTabla != null)
{ {
System.Reflection.FieldInfo aFieldKgDef = attrKgDef.GetType().GetField("isReadOnly", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance); //System.Reflection.FieldInfo aFieldKgDef = attrKgDef.GetType().GetField(/*"isReadOnly"*/nameof(ReadOnlyAttribute.IsReadOnly), System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance | BindingFlags.IgnoreCase);
System.Reflection.FieldInfo aFieldKgTabla = attrKgTabla.GetType().GetField("isReadOnly", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance); // System.Reflection.FieldInfo aFieldKgTabla = attrKgTabla.GetType().GetField(/*"isReadOnly"*/nameof(ReadOnlyAttribute.IsReadOnly), System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance | BindingFlags.IgnoreCase);
aFieldKgDef.SetValue(attrKgDef, val!= OpsRecoCont.UsaKgDef); System.Reflection.FieldInfo aFieldKgDef = attrKgDef.GetType().GetField("<IsReadOnly>k__BackingField", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance | BindingFlags.IgnoreCase);
aFieldKgDef.SetValue(attrKgTabla, val != OpsRecoCont.LeeCampoTabla); System.Reflection.FieldInfo aFieldKgTabla = attrKgTabla.GetType().GetField("<IsReadOnly>k__BackingField", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance | BindingFlags.IgnoreCase);
if (aFieldKgDef!=null)
aFieldKgDef.SetValue(attrKgDef, val!= OpsRecoCont.UsaKgDef);
if(aFieldKgDef!=null)
aFieldKgDef.SetValue(attrKgTabla, val != OpsRecoCont.LeeCampoTabla);
} }
} }
@ -589,21 +642,25 @@ namespace OliviaAddInPro.Model
#endregion #endregion
#region 06CambosNW #region 06CambosNW
[Browsable(false)]
[Category("Campos Red Navegable")] [Category("Campos Red Navegable")]
[DisplayName("Sentido de la vía")] [DisplayName("Sentido de la vía")]
[Description("Nombre del campo que indica si la vía es de doble sentido o no")] [Description("Nombre del campo que indica si la vía es de doble sentido o no")]
public string cons_onew { get; set; } public string cons_onew { get; set; }
[Browsable(false)]
[Category("Campos Red Navegable")] [Category("Campos Red Navegable")]
[DisplayName("Velocidad de la vía")] [DisplayName("Velocidad de la vía")]
[Description("Nombre del campo que indica la velociad máxima permitida de la vía")] [Description("Nombre del campo que indica la velociad máxima permitida de la vía")]
public string cons_kph { get; set; } public string cons_kph { get; set; }
[Browsable(false)]
[Category("Campos Red Navegable")] [Category("Campos Red Navegable")]
[DisplayName("Tipo de vía")] [DisplayName("Tipo de vía")]
[Description("Nombre del campo que indica el tipo de la vía (usado para ver si es vía peatonal).")] [Description("Nombre del campo que indica el tipo de la vía (usado para ver si es vía peatonal).")]
public string cons_fow { get; set; } public string cons_fow { get; set; }
[Browsable(false)]
[Category("Campos Red Navegable")] [Category("Campos Red Navegable")]
[DisplayName("Nombre de la vía")] [DisplayName("Nombre de la vía")]
[Description("Nombre del campo que indica el nombre de la vía")] [Description("Nombre del campo que indica el nombre de la vía")]
@ -611,24 +668,28 @@ namespace OliviaAddInPro.Model
#endregion #endregion
#region 07AtrNw #region 07AtrNw
[Browsable(false)]
[Category("Atributos Red Navegable")] [Category("Atributos Red Navegable")]
[PropertyOrder(1)] [PropertyOrder(1)]
[DisplayName("To-From")] [DisplayName("To-From")]
[Description("Valor del campo 'Sentido de la vía' que indica sentido de la vía To-From")] [Description("Valor del campo 'Sentido de la vía' que indica sentido de la vía To-From")]
public string atr_TF { get; set; } public string atr_TF { get; set; }
[Browsable(false)]
[Category("Atributos Red Navegable")] [Category("Atributos Red Navegable")]
[PropertyOrder(2)] [PropertyOrder(2)]
[DisplayName("From-To")] [DisplayName("From-To")]
[Description("Valor del campo 'Sentido de la vía' que indica sentido de la vía From-To")] [Description("Valor del campo 'Sentido de la vía' que indica sentido de la vía From-To")]
public string atr_FT { get; set; } public string atr_FT { get; set; }
[Browsable(false)]
[Category("Atributos Red Navegable")] [Category("Atributos Red Navegable")]
[PropertyOrder(3)] [PropertyOrder(3)]
[DisplayName("Sin circulación")] [DisplayName("Sin circulación")]
[Description("Valor del campo 'Sentido de la vía' que indica no circulación")] [Description("Valor del campo 'Sentido de la vía' que indica no circulación")]
public string atr_N { get; set; } public string atr_N { get; set; }
[Browsable(false)]
[Category("Atributos Red Navegable")] [Category("Atributos Red Navegable")]
[PropertyOrder(4)] [PropertyOrder(4)]
[DisplayName("Peatonal")] [DisplayName("Peatonal")]
@ -1327,9 +1388,55 @@ namespace OliviaAddInPro.Model
public string atr_suelo { get; set; } public string atr_suelo { get; set; }
#endregion #endregion
}
public class EnumOpsNWToString : TypeConverter
{
public static List<OliviaConfNW> ListaNw { get; set; }
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
{
return (sourceType.Equals(typeof(OpsNW)));
}
public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
{
return (destinationType.Equals(typeof(String)));
}
public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value)
{
return base.ConvertFrom(context, culture, value);
}
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
{
if (!destinationType.Equals(typeof(String)))
{
throw new ArgumentException("Can only convert to string.", "destinationType");
}
if (!value.GetType().Equals(typeof(OpsNW)))
{
throw new ArgumentException("Can only convert an instance of enum.", "value");
}
int i = 0;
if (int.TryParse(value.ToString().Substring(3), out i) && ListaNw != null && i < ListaNw.Count())
{
var aux = ListaNw[i];
if (aux == null)
return "";
else
return aux.nombre;
}
return "";
}
} }
public class EnumToStringUsingDescription : TypeConverter public class EnumToStringUsingDescription : TypeConverter
{ {
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
{ {
return (sourceType.Equals(typeof(Enum))); return (sourceType.Equals(typeof(Enum)));

34
Model/OliviaConfMV.cs Normal file
View File

@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
namespace OliviaAddInPro.Model
{
[Serializable]
public class OliviaConfMV
{
public OliviaConfMV()
{
nombre = "default";
filtro_omitir = "";
campo_prioridad = "0";
vehiculo_def_reco = -1;
vehiculo_def_lim = -1;
sentidoAmbitos = 0;
}
public string nombre { get; set; }
public string filtro_omitir { get; set; }
public string campo_prioridad { get; set; }
public int vehiculo_def_reco { get; set; }
public int vehiculo_def_lim { get; set; }
//si 0 ambitos no tienen sentido 1 ambitos con sentido
public int sentidoAmbitos { get; set; }
}
}

31
Model/OliviaConfNW.cs Normal file
View File

@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
namespace OliviaAddInPro.Model
{
[Serializable]
public class OliviaConfNW
{
public OliviaConfNW()
{
}
public string nombre { get; set; }
public string campo_velocidad { get; set; }
public string campo_nombre { get; set; }
public string campo_sentidoFT { get; set; }
public string campo_sentidoTf { get; set; }
public string campo_peatonal { get; set; }
public string campo_elevacion_to { get; set; }
public string campo_elevacion_from { get; set; }
public bool comprueba_elevacion { get; set; }
public bool revisa_topologia { get; set; }
public bool revisa_conjunciones { get; set; }
public bool revisa_angulos { get; set; }
public string campo_angulos { get; set; }
}
}

View File

@ -142,6 +142,7 @@ namespace OliviaAddInPro.Model
public const string GG_pt = "path_temp"; public const string GG_pt = "path_temp";
public const string GG_pd = "path_data"; public const string GG_pd = "path_data";
public const string GG_pn = "path_nw"; public const string GG_pn = "path_nw";
public const string GG_pnj = "path_cnw";
public const string GG_pcar = "path_cart"; public const string GG_pcar = "path_cart";
public const string GG_pcfg = "path_cfgeo"; public const string GG_pcfg = "path_cfgeo";
public const string GG_strtto = "str_tto"; public const string GG_strtto = "str_tto";
@ -160,6 +161,11 @@ namespace OliviaAddInPro.Model
public const string GG_hini = "h_inicio"; public const string GG_hini = "h_inicio";
public const string GG_trafic = "trafico"; public const string GG_trafic = "trafico";
public const string GG_ais = "aislados"; public const string GG_ais = "aislados";
public const string GG_elev = "elevacion";
public const string GG_topo = "reviTopo";
public const string GG_conj = "reviConj";
public const string GG_angu = "reviAng";
public const string GG_senAmb = "sentAmb";
/** /**
* Define las propiedades de limpieza a enviar a oliviatasks * Define las propiedades de limpieza a enviar a oliviatasks
@ -599,6 +605,16 @@ namespace OliviaAddInPro.Model
* Define el nombre para mandar a oliviatasks la configuración para planificación, ya se ha hecho sectorización * Define el nombre para mandar a oliviatasks la configuración para planificación, ya se ha hecho sectorización
*/ */
public const string SockConfTodo = "CONFIG_TODO"; public const string SockConfTodo = "CONFIG_TODO";
//atributos network por defecto------------------------------------------------------------------------------
public const string cons_camp_sentido_tf = "_sen_ft"; //<Campo que indica el sentido 0 1
public const string cons_camp_sentido_ft = "_sen_tf"; //<Campo que indica el sentido 0 1
public const string cons__camp_vel= "_vel"; //<Campo que indica la velocidad en kph
public const string cons_name="_nom"; //<Campo que indica el nombre de la calle
public const string cons_peat="_peat"; //Campo que indica el tipo de vial, si es peatonal o no
public const string cons_ev = "_ev"; //Campo que indica si hay que intentar evitar o no (0-1)
//-----------------------------------------------------------------------------------------------------------
//************************************************************************************* //*************************************************************************************
} }
} }

View File

@ -51,10 +51,12 @@ namespace OliviaAddInPro.Model
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
public static string PathNW; //<Path del shp con la red navegable public static string PathNW; //<Path del shp con la red navegable
public static string PathNW_c; //<Path del shp con las conjunciones de la red navegable
//paths GDBs //paths GDBs
public static string PathGdbGen; //<Path de la gdb general de la que se extraen los datos de interés public static string PathGdbGen; //<Path de la gdb general de la que se extraen los datos de interés
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
public static string PathGdbNw_conj; //<Path de la gdb referente a las conjunciones de la red de carreteras
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
@ -84,8 +86,8 @@ namespace OliviaAddInPro.Model
public struct Capas public struct Capas
{ {
public static string pathEjeVia; public static string pathEjeVia;
public static string ftclass_ejes; //<Nombre de la capa de ejes de carretera //public static string ftclass_ejes; //<Nombre de la capa de ejes de carretera
public static string ftclass_muni; //<Nombre de la capa de municipios de TOMTOM //public static string ftclass_muni; //<Nombre de la capa de municipios de TOMTOM
}; };
private static TiposEjecucion tipoEjec; private static TiposEjecucion tipoEjec;
public static Limpieza limp; public static Limpieza limp;
@ -273,14 +275,16 @@ namespace OliviaAddInPro.Model
if (ft == null) if (ft == null)
return false; return false;
HelperGdb.Free(ft); HelperGdb.Free(ft);
int NCAMPS = 4; /*int NCAMPS = 5;
string[] camps; string[] camps;
camps = new string[NCAMPS]; camps = new string[NCAMPS];
camps[0] = ComunDef.CamposNW.cons_onew; camps[0] = ComunDef.CamposNW.cons_onewFT;
camps[1] = ComunDef.CamposNW.cons_kph; camps[1] = ComunDef.CamposNW.cons_onewTF;
camps[2] = ComunDef.CamposNW.cons_name; camps[2] = ComunDef.CamposNW.cons_kph;
camps[3] = ComunDef.CamposNW.cons_fow; camps[3] = ComunDef.CamposNW.cons_name;
return HelperGdb.CheckFileds(OliviaGlob.Paths.PathGdbNw, camps) == 0; camps[4] = ComunDef.CamposNW.cons_fow;
return HelperGdb.CheckFileds(OliviaGlob.Paths.PathGdbNw, camps) == 0;*/
return true;
} }
/** /**
@ -389,7 +393,7 @@ namespace OliviaAddInPro.Model
*/ */
public static void OpenManual() public static void OpenManual()
{ {
string[] archivos = null; //string[] archivos = null;
try try
{ {
@ -429,6 +433,7 @@ namespace OliviaAddInPro.Model
Paths.PathGdbGen = c.PathGdbGen; Paths.PathGdbGen = c.PathGdbGen;
Paths.PathGdbNw = c.Path_Eje_via; Paths.PathGdbNw = c.Path_Eje_via;
Paths.PathGdbNw_conj = c.Path_Conj_Eje_via;
Paths.PathSimbVSM = c.PathSimbVSM; Paths.PathSimbVSM = c.PathSimbVSM;
Paths.PathSimbESRI = c.PathSimbESRI; Paths.PathSimbESRI = c.PathSimbESRI;
Conexion.Puerto = c.Puerto; Conexion.Puerto = c.Puerto;
@ -440,6 +445,7 @@ namespace OliviaAddInPro.Model
//Capas.ftclass_ejes = c.eje_via; //Capas.ftclass_ejes = c.eje_via;
//Capas.ftclass_muni = c.municipios; //Capas.ftclass_muni = c.municipios;
Capas.pathEjeVia = c.Path_Eje_via; Capas.pathEjeVia = c.Path_Eje_via;
//Capas.Path_Conj_Eje_via = c.Path_Conj_Eje_via;
/////////////////////////////////////// ///////////////////////////////////////
//Capas, consultas, atributos y filtros de LIMPIEZA //Capas, consultas, atributos y filtros de LIMPIEZA
LimpiezaDef.Campos.consulta_entidad = c.cons_tip_ent; LimpiezaDef.Campos.consulta_entidad = c.cons_tip_ent;
@ -493,6 +499,7 @@ namespace OliviaAddInPro.Model
LimpiezaDef.Parametros.h_inicio = c.hora_inicio; LimpiezaDef.Parametros.h_inicio = c.hora_inicio;
LimpiezaDef.Parametros.reduc_traf = c.reduc_traf; LimpiezaDef.Parametros.reduc_traf = c.reduc_traf;
LimpiezaDef.Parametros.igno_ais = c.Igno_ais; LimpiezaDef.Parametros.igno_ais = c.Igno_ais;
LimpiezaDef.Parametros.ancho_viaM = c.ancho_via_max; LimpiezaDef.Parametros.ancho_viaM = c.ancho_via_max;
LimpiezaDef.Parametros.ancho_viam = c.ancho_via_min; LimpiezaDef.Parametros.ancho_viam = c.ancho_via_min;
LimpiezaDef.Parametros.ancho_via = c.ancho_via; LimpiezaDef.Parametros.ancho_via = c.ancho_via;
@ -620,16 +627,16 @@ namespace OliviaAddInPro.Model
ComunDef.BuffExport = c.buffer_export; ComunDef.BuffExport = c.buffer_export;
//Campos de la red navegable que se leen //Campos de la red navegable que se leen
ComunDef.CamposNW.cons_onew = c.cons_onew; /*ComunDef.CamposNW.cons_onew = c.cons_onew;
ComunDef.CamposNW.cons_kph = c.cons_kph; ComunDef.CamposNW.cons_kph = "_vel";
ComunDef.CamposNW.cons_fow = c.cons_fow; ComunDef.CamposNW.cons_fow = "_peat";
ComunDef.CamposNW.cons_name = c.cons_name; ComunDef.CamposNW.cons_name = c.cons_name;*/
//Atributos de la red navegable que se leen //Atributos de la red navegable que se leen
ComunDef.AtributosNW.atr_TF = c.atr_TF; ComunDef.AtributosNW.atr_TF = c.atr_TF;
ComunDef.AtributosNW.atr_FT = c.atr_FT; ComunDef.AtributosNW.atr_FT = c.atr_FT;
ComunDef.AtributosNW.atr_N = c.atr_N; ComunDef.AtributosNW.atr_N = c.atr_N;
ComunDef.AtributosNW.atr_pedes = c.atr_pedes; ComunDef.AtributosNW.atr_pedes = c.atr_pedes;
ComunDef.CamposNW.config = c.GetOliviaConfNW();
ComunDef.CamposCom.camp_oid = c.id; ComunDef.CamposCom.camp_oid = c.id;
ComunDef.CamposCom.consulta_sector = c.consulta_sector; ComunDef.CamposCom.consulta_sector = c.consulta_sector;
ComunDef.CamposCom.consulta_secuen = c.consulta_secuen; ComunDef.CamposCom.consulta_secuen = c.consulta_secuen;

View File

@ -91,6 +91,7 @@ namespace OliviaAddInPro.Model
{ {
Respuesta<bool> res = new Respuesta<bool> { Value = false }; Respuesta<bool> res = new Respuesta<bool> { Value = false };
Respuesta<TiposEjecucion> res2 = new Respuesta<TiposEjecucion>() { Value = TiposEjecucion.FinEjecNOk }; Respuesta<TiposEjecucion> res2 = new Respuesta<TiposEjecucion>() { Value = TiposEjecucion.FinEjecNOk };
Serv.TipoMv = TipoMV;
res = Serv.Ejecuta(modo); res = Serv.Ejecuta(modo);
if (res.Value) if (res.Value)
{ {

View File

@ -405,40 +405,46 @@ 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 = 3;
i_def = 2; i_def = 2;
info[0] = 2; //Rellena volumenes
info[1] = 3; info[0] = 3;
info[2] = 5; info[1] = 5;
info[3] = 7; info[2] = 7;
rellena_carg((int)RecogidaDef.TiposCarga.Trasera, rellena_carg((int)RecogidaDef.TiposCarga.Trasera,
(int)RecogidaDef.TiposVehic.Satelite, n, i_def, info); (int)RecogidaDef.TiposVehic.Satelite, n, i_def, info);
//rellena la corrección de la carga máxima //rellena la corrección de la carga máxima
info[0] = info[1] = -500; info[0] = - 850;
info[2] = info[3] = 0; info[1] = -1000;
info[2] =-1500;
rellena_carg_offset((int)RecogidaDef.TiposCarga.Trasera, rellena_carg_offset((int)RecogidaDef.TiposCarga.Trasera,
(int)RecogidaDef.TiposVehic.Satelite, (int)RecogidaDef.TiposFracción.Resto, n, info); (int)RecogidaDef.TiposVehic.Satelite, (int)RecogidaDef.TiposFracción.Resto, n, info);
rellena_carg_offset((int)RecogidaDef.TiposCarga.Trasera, rellena_carg_offset((int)RecogidaDef.TiposCarga.Trasera,
(int)RecogidaDef.TiposVehic.Satelite, (int)RecogidaDef.TiposFracción.Organica, n, info); (int)RecogidaDef.TiposVehic.Satelite, (int)RecogidaDef.TiposFracción.Organica, n, info);
//Trasera-2 ejes //Trasera-2 ejes
n = 6; n = 5;
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;
info[3] = 14; info[3] = 14;
info[4] = 16; info[4] = 16;
info[5] = 17; //info[5] = 17;
rellena_carg((int)RecogidaDef.TiposCarga.Trasera, rellena_carg((int)RecogidaDef.TiposCarga.Trasera,
(int)RecogidaDef.TiposVehic.Ejes2, n, i_def, info); (int)RecogidaDef.TiposVehic.Ejes2, n, i_def, info);
//rellena la corrección de la carga máxima //rellena la corrección de la carga máxima
info[1] = -500; info[0] = 0;
info[2] = -1000; info[1] = 500;
info[2] = 0;
info[3] = -1500; info[3] = -1500;
info[4] = -2000; info[4] = -3500;
info[0] = info[5] = 0;
rellena_carg_offset((int)RecogidaDef.TiposCarga.Trasera, rellena_carg_offset((int)RecogidaDef.TiposCarga.Trasera,
(int)RecogidaDef.TiposVehic.Ejes2, (int)RecogidaDef.TiposFracción.Resto, n, info); (int)RecogidaDef.TiposVehic.Ejes2, (int)RecogidaDef.TiposFracción.Resto, n, info);
rellena_carg_offset((int)RecogidaDef.TiposCarga.Trasera, rellena_carg_offset((int)RecogidaDef.TiposCarga.Trasera,
@ -447,6 +453,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 +461,19 @@ 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);
info[0] = 1500;
info[1] = 0;
info[2] = 0;
info[3] = 0;
rellena_carg_offset((int)RecogidaDef.TiposCarga.Trasera,
(int)RecogidaDef.TiposVehic.Ejes3, (int)RecogidaDef.TiposFracción.Resto, n, info);
rellena_carg_offset((int)RecogidaDef.TiposCarga.Trasera,
(int)RecogidaDef.TiposVehic.Ejes3, (int)RecogidaDef.TiposFracción.Organica, n, 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,67 +481,141 @@ 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,
(int)RecogidaDef.TiposVehic.Ejes2, n, i_def, info); (int)RecogidaDef.TiposVehic.Ejes2, n, i_def, info);
//rellena la corrección de la carga máxima //rellena la corrección de la carga máxima
info[0] = -500; info[0] = -3400;
info[1] = -1000; info[1] = -4500;
rellena_carg_offset((int)RecogidaDef.TiposCarga.Lateral, rellena_carg_offset((int)RecogidaDef.TiposCarga.Lateral,
(int)RecogidaDef.TiposVehic.Ejes2, (int)RecogidaDef.TiposFracción.Resto, n, info); (int)RecogidaDef.TiposVehic.Ejes2, (int)RecogidaDef.TiposFracción.Resto, n, info);
rellena_carg_offset((int)RecogidaDef.TiposCarga.Lateral, rellena_carg_offset((int)RecogidaDef.TiposCarga.Lateral,
(int)RecogidaDef.TiposVehic.Ejes2, (int)RecogidaDef.TiposFracción.Organica, n, info); (int)RecogidaDef.TiposVehic.Ejes2, (int)RecogidaDef.TiposFracción.Organica, n, info);
//Lateral - 3 ejes //Lateral - 3 ejes
n = 3; n = 4;
i_def = 2; i_def = 2;
info[0] = 21; //Rellena volumenes
info[1] = 23; info[0] = 19;
info[2] = 26; info[1] = 21;
info[2] = 23;
info[3] = 26;
rellena_carg((int)RecogidaDef.TiposCarga.Lateral, rellena_carg((int)RecogidaDef.TiposCarga.Lateral,
(int)RecogidaDef.TiposVehic.Ejes3, n, i_def, info); (int)RecogidaDef.TiposVehic.Ejes3, n, i_def, info);
info[0] = -400;
info[1] = -1500;
info[2] = -2400;
info[3] = -3000;
rellena_carg_offset((int)RecogidaDef.TiposCarga.Lateral,
(int)RecogidaDef.TiposVehic.Ejes3, (int)RecogidaDef.TiposFracción.Resto, n, info);
rellena_carg_offset((int)RecogidaDef.TiposCarga.Lateral,
(int)RecogidaDef.TiposVehic.Ejes3, (int)RecogidaDef.TiposFracción.Organica, n, info);
//////////////////////////////////////////////////
//Carga Superior
////////////////////////////////////////////////
///
//Superior - satelite, no hay //Superior - satelite, no hay
n = 1;
i_def = 0;
//Rellena volumenes
info[0] = 11;
info[1] = 17;
rellena_carg((int)RecogidaDef.TiposCarga.Superior, rellena_carg((int)RecogidaDef.TiposCarga.Superior,
(int)RecogidaDef.TiposVehic.Satelite, 0, 0, null); (int)RecogidaDef.TiposVehic.Satelite, i_def, 0, null);
//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,
(int)RecogidaDef.TiposVehic.Ejes2, n, i_def, info); (int)RecogidaDef.TiposVehic.Ejes2, n, i_def, info);
info[0] = -5500;
info[1] = -8500;
rellena_carg_offset((int)RecogidaDef.TiposCarga.Superior,
(int)RecogidaDef.TiposVehic.Ejes2, (int)RecogidaDef.TiposFracción.Resto, n, info);
rellena_carg_offset((int)RecogidaDef.TiposCarga.Superior,
(int)RecogidaDef.TiposVehic.Ejes2, (int)RecogidaDef.TiposFracción.Organica, n, info);
//Superior - 3 ejes //Superior - 3 ejes
n = 3; n = 2;
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;
rellena_carg((int)RecogidaDef.TiposCarga.Superior, rellena_carg((int)RecogidaDef.TiposCarga.Superior,
(int)RecogidaDef.TiposVehic.Ejes3, n, i_def, info); (int)RecogidaDef.TiposVehic.Ejes3, n, i_def, info);
info[1] = -4000;
rellena_carg_offset((int)RecogidaDef.TiposCarga.Superior,
(int)RecogidaDef.TiposVehic.Ejes3, (int)RecogidaDef.TiposFracción.Resto, n, info);
rellena_carg_offset((int)RecogidaDef.TiposCarga.Superior,
(int)RecogidaDef.TiposVehic.Ejes3, (int)RecogidaDef.TiposFracción.Organica, n, info);
//////////////////////////////////////////////////
//Carga Bilateral
////////////////////////////////////////////////
//Bilateral - satelite
n = 1;
i_def = 0;
info[0] = 11;
//Bilateral - satelite, no hay //Bilateral - satelite, no hay
rellena_carg((int)RecogidaDef.TiposCarga.Bilateral, rellena_carg((int)RecogidaDef.TiposCarga.Bilateral,
(int)RecogidaDef.TiposVehic.Satelite, 0, 0, null); (int)RecogidaDef.TiposVehic.Satelite, i_def, 0, null);
//Bilateral - 2 ejes //bilateral -satélite - envases
n = 3; info[0] = -3850;
rellena_carg_offset((int)RecogidaDef.TiposCarga.Bilateral,
(int)RecogidaDef.TiposVehic.Satelite, (int)RecogidaDef.TiposFracción.Resto, n, info);
rellena_carg_offset((int)RecogidaDef.TiposCarga.Bilateral,
(int)RecogidaDef.TiposVehic.Satelite, (int)RecogidaDef.TiposFracción.Organica, n, info);
//bilateral -satélite - envases
info[0] = 480;
rellena_carg_offset((int)RecogidaDef.TiposCarga.Bilateral,
(int)RecogidaDef.TiposVehic.Satelite, (int)RecogidaDef.TiposFracción.Envases, n, info);
//bilateral -satélite - papel
info[0] = 7;
rellena_carg_offset((int)RecogidaDef.TiposCarga.Bilateral,
(int)RecogidaDef.TiposVehic.Satelite, (int)RecogidaDef.TiposFracción.Papel, n, info);
//bilateral -satélite - vidrio
info[0] = 0;
rellena_carg_offset((int)RecogidaDef.TiposCarga.Bilateral,
(int)RecogidaDef.TiposVehic.Satelite, (int)RecogidaDef.TiposFracción.Vidrio, n, info);
//Bilateral - 2 ejes------------------------------------------------------
n = 1;
i_def = 1; i_def = 1;
//Rellena volumenes
info[0] = 14; info[0] = 14;
info[1] = 16; //info[1] = 16;
info[2] = 18; //info[2] = 18;
rellena_carg((int)RecogidaDef.TiposCarga.Bilateral, rellena_carg((int)RecogidaDef.TiposCarga.Bilateral,
(int)RecogidaDef.TiposVehic.Ejes2, n, i_def, info); (int)RecogidaDef.TiposVehic.Ejes2, n, (int)RecogidaDef.TiposFracción.Resto, info);
//Bilateral - 3 ejes //Bilateral - 3 ejes
n = 3; n = 2;
i_def = 1; i_def = 1;
//Rellena volumenes
info[0] = 20; info[0] = 20;
info[1] = 23; info[1] = 23;
info[2] = 26; // info[2] = 26;
rellena_carg((int)RecogidaDef.TiposCarga.Bilateral, rellena_carg((int)RecogidaDef.TiposCarga.Bilateral,
(int)RecogidaDef.TiposVehic.Ejes3, n, i_def, info); (int)RecogidaDef.TiposVehic.Ejes3, n, i_def, info);
@ -537,8 +631,126 @@ namespace OliviaAddInPro.Model
} }
//////////////////////////////////////////////////////// ////////////////////////////////////////////////////////
//Barcelona new //Rellena offsets
rellena_offsets_bcn(); //rellena_offsets_bcn();
n = 4;
info[0] = 240;
info[1] = 0;
info[2] = 0;
info[3] = 0;
rellena_carg_offset((int)RecogidaDef.TiposCarga.Lateral,
(int)RecogidaDef.TiposVehic.Ejes3, (int)RecogidaDef.TiposFracción.Envases, n, info);
n = 2;
info[0] = 0;
info[1] = -2040;
rellena_carg_offset((int)RecogidaDef.TiposCarga.Superior,
(int)RecogidaDef.TiposVehic.Ejes2, (int)RecogidaDef.TiposFracción.Envases, n, info);
//papel
n =3;
info[0] = -430;
info[1] = -500;
info[2] = -770;
rellena_carg_offset((int)RecogidaDef.TiposCarga.Trasera,
(int)RecogidaDef.TiposVehic.Satelite, (int)RecogidaDef.TiposFracción.Papel, n, info);
info[0] = -400;
info[1] = -250;
info[2] = -450;
rellena_carg_offset((int)RecogidaDef.TiposCarga.Trasera,
(int)RecogidaDef.TiposVehic.Satelite, (int)RecogidaDef.TiposFracción.Vidrio, n, info);
n = 4;
info[0] = 700;
info[1] = 0;
info[2] = 0;
info[3] = 0;
rellena_carg_offset((int)RecogidaDef.TiposCarga.Lateral,
(int)RecogidaDef.TiposVehic.Ejes3, (int)RecogidaDef.TiposFracción.Vidrio, n, info);
info[0] = -1590;
info[1] = -2310;
info[2] = -2530;
info[3] = -2860;
rellena_carg_offset((int)RecogidaDef.TiposCarga.Lateral,
(int)RecogidaDef.TiposVehic.Ejes3, (int)RecogidaDef.TiposFracción.Papel, n, info);
n = 2;
info[0] = -3100;
info[1] = -5950;
rellena_carg_offset((int)RecogidaDef.TiposCarga.Superior,
(int)RecogidaDef.TiposVehic.Ejes2, (int)RecogidaDef.TiposFracción.Vidrio, n, info);
info[0] = -1760;
info[1] = -6120;
rellena_carg_offset((int)RecogidaDef.TiposCarga.Superior,
(int)RecogidaDef.TiposVehic.Ejes2, (int)RecogidaDef.TiposFracción.Papel, n, info);
info[0] = 0;
info[1] = -550;
rellena_carg_offset((int)RecogidaDef.TiposCarga.Superior,
(int)RecogidaDef.TiposVehic.Ejes3, (int)RecogidaDef.TiposFracción.Vidrio, n, info);
info[0] = -2200;
info[1] = -2530;
rellena_carg_offset((int)RecogidaDef.TiposCarga.Superior,
(int)RecogidaDef.TiposVehic.Ejes3, (int)RecogidaDef.TiposFracción.Papel, n, info);
info[0] = 0;
info[1] = -2450;
rellena_carg_offset((int)RecogidaDef.TiposCarga.Bilateral,
(int)RecogidaDef.TiposVehic.Ejes3, (int)RecogidaDef.TiposFracción.Vidrio, n, info);
info[0] = -2200;
info[1] = -2530;
rellena_carg_offset((int)RecogidaDef.TiposCarga.Bilateral,
(int)RecogidaDef.TiposVehic.Ejes3, (int)RecogidaDef.TiposFracción.Papel, n, info);
n = 1;
info[0] = -2540;
rellena_carg_offset((int)RecogidaDef.TiposCarga.Bilateral,
(int)RecogidaDef.TiposVehic.Ejes2, (int)RecogidaDef.TiposFracción.Papel, n, info);
info[0] = -2400;
rellena_carg_offset((int)RecogidaDef.TiposCarga.Bilateral,
(int)RecogidaDef.TiposVehic.Ejes2, (int)RecogidaDef.TiposFracción.Vidrio, n, info);
n = 5;
info[0] = -880;
info[1] = -1100;
info[2] = -1320;
info[3] = -1540;
info[4] = -1760;
rellena_carg_offset((int)RecogidaDef.TiposCarga.Trasera,
(int)RecogidaDef.TiposVehic.Ejes2, (int)RecogidaDef.TiposFracción.Papel, n, info);
n = 4;
info[0] = -1980;
info[1] = -2200;
info[2] = -2420;
info[3] = -2530;
rellena_carg_offset((int)RecogidaDef.TiposCarga.Trasera,
(int)RecogidaDef.TiposVehic.Ejes3, (int)RecogidaDef.TiposFracción.Papel, n, info);
n = 2;
info[0] = -1650;
info[1] = -1770;
rellena_carg_offset((int)RecogidaDef.TiposCarga.Lateral,
(int)RecogidaDef.TiposVehic.Ejes2, (int)RecogidaDef.TiposFracción.Papel, n, info);
} }
private static void rellena_offsets_bcn() private static void rellena_offsets_bcn()
@ -546,37 +758,9 @@ namespace OliviaAddInPro.Model
int[] info = new int[10]; int[] info = new int[10];
int n, i_def; int n, i_def;
//////////////////////////////////////////////////////// ////////////////////////////////////////////////////////
//Barcelona new //Barcelona revisado abril 24
//Bilateral - satelite
n = 1;
i_def = 0;
info[0] = 11;
rellena_carg((int)RecogidaDef.TiposCarga.Bilateral,
(int)RecogidaDef.TiposVehic.Satelite, n, i_def, info);
//offsets
//Bilateral - satelite - resto, org
info[0] = -3700;
rellena_carg_offset((int)RecogidaDef.TiposCarga.Bilateral,
(int)RecogidaDef.TiposVehic.Satelite, (int)RecogidaDef.TiposFracción.Resto, n, info);
rellena_carg_offset((int)RecogidaDef.TiposCarga.Bilateral,
(int)RecogidaDef.TiposVehic.Satelite, (int)RecogidaDef.TiposFracción.Organica, n, info);
//bilateral -satélite - envases
info[0] = 480;
rellena_carg_offset((int)RecogidaDef.TiposCarga.Bilateral,
(int)RecogidaDef.TiposVehic.Satelite, (int)RecogidaDef.TiposFracción.Envases, n, info);
//bilateral -satélite - papel
info[0] = -2160;
rellena_carg_offset((int)RecogidaDef.TiposCarga.Bilateral,
(int)RecogidaDef.TiposVehic.Satelite, (int)RecogidaDef.TiposFracción.Papel, n, info);
//bilateral -satélite - vidrio
info[0] = -2050;
rellena_carg_offset((int)RecogidaDef.TiposCarga.Bilateral,
(int)RecogidaDef.TiposVehic.Satelite, (int)RecogidaDef.TiposFracción.Vidrio, n, info);
//////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////
//Trasera - satélite - organico, resto //Trasera - satélite - organico, resto
@ -817,19 +1001,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

@ -25,10 +25,19 @@ namespace OliviaAddInPro.Model
* String para Tipo de tratamiento, se guarda como columna en el shp * String para Tipo de tratamiento, se guarda como columna en el shp
*/ */
public string TipoTtoStr { get; set; } = String.Empty; public string TipoTtoStr { get; set; } = String.Empty;
/**
* Tipo modo de viaje
*/
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
*/ */
@ -45,6 +54,7 @@ namespace OliviaAddInPro.Model
* Nombre dle shp exportado de nw * Nombre dle shp exportado de nw
*/ */
public string NombreShpExportNw { get; set; } = string.Empty; public string NombreShpExportNw { get; set; } = string.Empty;
public string NombreShpExportNw_C { get; set; } = string.Empty;
/** /**
* Velocidad de desplazamiento, en km/h. Si es 0, es determinada por la vía * Velocidad de desplazamiento, en km/h. Si es 0, es determinada por la vía
*/ */

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

@ -7,6 +7,7 @@ using System.Threading.Tasks;
using System.IO; using System.IO;
using Newtonsoft.Json; using Newtonsoft.Json;
using Microsoft.Win32; using Microsoft.Win32;
using static OliviaAddInPro.Model.OliviaConf;
namespace OliviaAddInPro.Services namespace OliviaAddInPro.Services
{ {
@ -15,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.2.0.1";
public static ConfigServ Serv public static ConfigServ Serv
{ {
get { get {
@ -41,11 +42,12 @@ namespace OliviaAddInPro.Services
var ee = e; var ee = e;
res = null; res = null;
} }
if(res==null) if(res==null || res.Version==null || res.Version != VersionConfiguracion)
res = Default(); res = Default();
EnumOpsNWToString.ListaNw = res.ListaNw;
//pilla la IP //pilla la IP
if(res.Ip.CompareTo("0.0.0.0")==0) if (res.Ip.CompareTo("0.0.0.0")==0)
{ {
//coge la IP local //coge la IP local
res.Ip = OliviaGlob.Conexion.Ip; res.Ip = OliviaGlob.Conexion.Ip;
@ -169,7 +171,7 @@ namespace OliviaAddInPro.Services
c.path_work = "C:\\Olivia\\"; c.path_work = "C:\\Olivia\\";
} }
c.Version = VersionConfiguracion;
c.PathGdbGen = @"%dir_work%gdb\\BASE DE DATOS.gdb"; c.PathGdbGen = @"%dir_work%gdb\\BASE DE DATOS.gdb";
c.PathSimbVSM = @"%dir_work%styles\\Simbologia.style"; c.PathSimbVSM = @"%dir_work%styles\\Simbologia.style";
c.PathSimbESRI = @"%dir_work%styles\\ESRI.style"; c.PathSimbESRI = @"%dir_work%styles\\ESRI.style";
@ -307,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";
@ -352,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;
@ -396,7 +398,93 @@ 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_0;
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_elevacion_from = "$feature.F_ELEV",
campo_elevacion_to = "$feature.T_ELEV",
comprueba_elevacion = true,
revisa_topologia = false,
revisa_conjunciones = false,
revisa_angulos = false,
campo_angulos = "0"
}); ;
/*
c.ListaNw.Add(new OliviaConfNW()
{
nombre = "StreetMapPremiun",
campo_velocidad = "max($feature.FT_RST_SPE, $feature.TF_RST_SPE)",
campo_nombre = "$feature.FULL_STREE",
campo_peatonal = "IIF( $feature.FT_RST_AUT == 'Y' && $feature.TF_RST_AUT == 'Y', 1, 0)",
campo_sentidoFT = "IIf( $feature.FT_RST_AUT == 'N', 1, 0)",
campo_sentidoTf = "IIf( $feature.TF_RST_AUT == 'N', 1, 0)",
campo_elevacion_from = "IIf( $feature.F_ZLEV != null, $feature.F_ZLEV, 0)",
campo_elevacion_to = "IIf( $feature.T_ZLEV != null, $feature.T_ZLEV, 0)",
comprueba_elevacion = false,
revisa_topologia = false,
revisa_conjunciones = 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)"
});
*/
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,
sentidoAmbitos = 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,
sentidoAmbitos = 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,
sentidoAmbitos=1,
});
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,
sentidoAmbitos = 1
});
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,
sentidoAmbitos = 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
{ {
@ -28,6 +29,7 @@ namespace OliviaAddInPro.Services
public string PREF_NAME_EXPORT = "data_"; public string PREF_NAME_EXPORT = "data_";
public string EXT_SHP = ".shp"; public string EXT_SHP = ".shp";
public string PREF_NAME_EXPORT_NW = "nw_"; public string PREF_NAME_EXPORT_NW = "nw_";
public string PREF_NAME_EXPORT_NW_CONJ = "nw_c_";
public string NAME_CSV = "_L"; public string NAME_CSV = "_L";
public string EXT_CSV = ".csv"; public string EXT_CSV = ".csv";
public string NAME_RUTA2 = "_R2"; public string NAME_RUTA2 = "_R2";
@ -42,9 +44,10 @@ namespace OliviaAddInPro.Services
public string NAME_INSTAL = "_I"; public string NAME_INSTAL = "_I";
public string NAME_INSTAL_OUT = "_Instalacion"; public string NAME_INSTAL_OUT = "_Instalacion";
public int TipoMv { get; set; }
public string ErrStr = ""; public string ErrStr = "";
SpatialQueryFilter filtroEspacial = null; SpatialQueryFilter filtroEspacial = null;
SpatialReference spatRef = null; //SpatialReference spatRef = null;
SpatialReference spatRefData = null; SpatialReference spatRefData = null;
public TratamientoComun com; public TratamientoComun com;
@ -59,6 +62,7 @@ namespace OliviaAddInPro.Services
ErrStr = string.Empty; ErrStr = string.Empty;
OliviaGlob.Paths.PathData = string.Empty; OliviaGlob.Paths.PathData = string.Empty;
OliviaGlob.Paths.PathNW = string.Empty; OliviaGlob.Paths.PathNW = string.Empty;
OliviaGlob.Paths.PathNW_c= string.Empty;
if (com.ProgrSrc._ProgrSrc.Getcancelled()) if (com.ProgrSrc._ProgrSrc.Getcancelled())
{ {
ErrStr = Resource1.String_cancel_progreso; ErrStr = Resource1.String_cancel_progreso;
@ -70,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())
@ -142,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)
@ -169,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;
@ -183,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;
@ -250,7 +263,7 @@ namespace OliviaAddInPro.Services
//a todos los ámbitos y la instalación, ampliada un buffer, mayor si hay //a todos los ámbitos y la instalación, ampliada un buffer, mayor si hay
//restricciones de circulación //restricciones de circulación
geom_export = HelperGdb.BufferGeom(geom_export, com.BuffExport).Value; geom_export = HelperGdb.BufferGeom(geom_export, com.BuffExport).Value;
if (geom_export == null) if (geom_export == null || geom_export.IsEmpty)
{ {
ErrStr = "Error al añadir buffer a la geometría"; ErrStr = "Error al añadir buffer a la geometría";
return false; return false;
@ -335,20 +348,24 @@ 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;
////////////////////////////////////// //////////////////////////////////////
/// var where = String.Empty;
//Hace el filtro con la geometría final if (!String.IsNullOrEmpty(ComunDef.configMV.filtro_omitir))
filtroEspacial = HelperGdb.CreateFiler(String.Empty, geom_export); {
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) if (filtroEspacial == null)
{ {
ErrStr = "Error al crear el filtro de exportacion de la red navegable"; ErrStr = "Error al crear el filtro de exportacion de la red navegable";
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
@ -356,17 +373,54 @@ 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;
return false; return false;
} }
com.ProgrSrc.IncMessage(10, "Termina de exportar red navegable");//60%
com.NombreShpExportNw_C = PREF_NAME_EXPORT_NW_CONJ + fechaHora + EXT_SHP;
OliviaGlob.Paths.PathNW_c = OliviaGlob.Paths.DirData + com.NombreShpExportNw_C;
if (ComunDef.CamposNW.config.revisa_conjunciones)
{
filtroEspacial = HelperGdb.CreateFiler(String.Empty, geom_export);
com.ProgrSrc.IncMessage(10, "Revisando conjunciones de la red");//60%
if (!HelperGdb.ExportShp2(OliviaGlob.Paths.PathGdbNw_conj, filtroEspacial, com.NombreShpExportNw_C, OliviaGlob.Paths.DirData, com.ProgrSrc._ProgrSrc, spatRefData, 100))
{
ErrStr = "Error al exportar la red navegable: " + HelperGdb.OutStr;
return false;
}
if (com.ProgrSrc._ProgrSrc.Getcancelled())
{
ErrStr = Resource1.String_cancel_progreso;
return false;
}
}
/////////////////////////////////////////////////////////////////////
///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))
{
ErrStr = "Error al estandarizar campos red navegable: " + HelperGdb.OutStr;
return false;
}
com.ProgrSrc.IncMessage(40, "Finalizada Exportación. Conectando con Olivia Tasks.");//100% com.ProgrSrc.IncMessage(40, "Finalizada Exportación. Conectando con Olivia Tasks.");//100%
} }
catch (Exception ex) catch (Exception ex)
@ -376,6 +430,101 @@ namespace OliviaAddInPro.Services
} }
return true; return true;
} }
bool EstandarizaCamposNW(string pathNW)
{
HelperGdb.FieldToAdd[] fields = new HelperGdb.FieldToAdd[10];
//campo SECTOR
int i = 0;
fields[i].Name = ComunDef.CamposNW.cons_kph;
fields[i].Alias = ComunDef.CamposNW.cons_kph;
fields[i].Tipo = "FLOAT";
fields[i].Length = 0;
i++;
fields[i].Name = ComunDef.CamposNW.cons_ele_f;
fields[i].Alias = ComunDef.CamposNW.cons_ele_f;
fields[i].Tipo = "FLOAT";
fields[i].Length = 0;
i++;
fields[i].Name = ComunDef.CamposNW.cons_ele_t;
fields[i].Alias = ComunDef.CamposNW.cons_ele_t;
fields[i].Tipo = "FLOAT";
fields[i].Length = 0;
i++;
fields[i].Name = ComunDef.CamposNW.cons_fow;
fields[i].Alias = ComunDef.CamposNW.cons_fow;
fields[i].Tipo = "LONG";
fields[i].Length = 0;
i++;
fields[i].Name = ComunDef.CamposNW.cons_onewFT;
fields[i].Alias = ComunDef.CamposNW.cons_onewFT;
fields[i].Tipo = "LONG";
fields[i].Length = 0;
i++;
fields[i].Name = ComunDef.CamposNW.cons_onewTF;
fields[i].Alias = ComunDef.CamposNW.cons_onewTF;
fields[i].Tipo = "LONG";
fields[i].Length = 0;
i++;
fields[i].Name = ComunDef.CamposNW.cons_evit;
fields[i].Alias = ComunDef.CamposNW.cons_evit;
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";
fields[i].Length = 128;
i++;
fields[i].Name = ComunDef.CamposNW.cons_angulo;
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))
return false;
if (!HelperGdb.CalculateFieldsSync(pathNW, ComunDef.CamposNW.cons_onewTF, ComunDef.CamposNW.config.campo_sentidoTf))
return false;
if (!HelperGdb.CalculateFieldsSync(pathNW, ComunDef.CamposNW.cons_onewFT, ComunDef.CamposNW.config.campo_sentidoFT))
return false;
if (!HelperGdb.CalculateFieldsSync(pathNW, ComunDef.CamposNW.cons_ele_t, ComunDef.CamposNW.config.campo_elevacion_to))
return false;
if (!HelperGdb.CalculateFieldsSync(pathNW, ComunDef.CamposNW.cons_ele_f, ComunDef.CamposNW.config.campo_elevacion_from))
return false;
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;
}
/** /**
* Actualiza la capa dada añadiendo una columna de sector y una de secuencia * Actualiza la capa dada añadiendo una columna de sector y una de secuencia
*/ */
@ -516,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);
@ -535,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);
@ -543,23 +693,32 @@ 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))
{ {
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)) using (FeatureClass fc_shp = HelperGdb.GetFtClassSync(pathCapa))
{ {
if (fc_orig == null)
return false;
if (fc_shp == null) if (fc_shp == null)
return false; 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); long nelem_shp = HelperGdb.GetNumElemsSync(fc_shp);
if (nelem_shp != ids.Count) if (nelem_shp != ids.Count)
return false; return false;
@ -603,7 +762,7 @@ namespace OliviaAddInPro.Services
{ {
return false; return false;
} }
return true; //return true;
} }
} }
} }
@ -611,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;
@ -878,6 +1079,8 @@ namespace OliviaAddInPro.Services
//HelperGdb.SaveFileDlg("Introduzca nombre de Feature Class a importar", GdbFileName, null, ArcGIS.Desktop.Catalog.ItemFilters.featureClasses_all); //HelperGdb.SaveFileDlg("Introduzca nombre de Feature Class a importar", GdbFileName, null, ArcGIS.Desktop.Catalog.ItemFilters.featureClasses_all);
if (!string.IsNullOrEmpty(path_aux)) if (!string.IsNullOrEmpty(path_aux))
{ {
/*var aux = path_aux.Split("\\");
tratamiento = aux[aux.Length-1];*/
tratamiento = new DirectoryInfo(System.IO.Path.GetDirectoryName(path_aux)).Name; tratamiento = new DirectoryInfo(System.IO.Path.GetDirectoryName(path_aux)).Name;
//tratamiento = System.IO.Path.GetFileName(System.IO.Path.GetDirectoryName(path_aux)); //tratamiento = System.IO.Path.GetFileName(System.IO.Path.GetDirectoryName(path_aux));
amb_aux = System.IO.Path.GetFileNameWithoutExtension(path_aux); amb_aux = System.IO.Path.GetFileNameWithoutExtension(path_aux);
@ -1004,7 +1207,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];
@ -1058,6 +1261,11 @@ namespace OliviaAddInPro.Services
string capa_principal_nw = System.IO.Path.GetFileNameWithoutExtension(OliviaGlob.Paths.PathNW); string capa_principal_nw = System.IO.Path.GetFileNameWithoutExtension(OliviaGlob.Paths.PathNW);
HelperGdb.CloseLayer(capa_principal_nw); HelperGdb.CloseLayer(capa_principal_nw);
} }
if (!string.IsNullOrEmpty(OliviaGlob.Paths.PathNW_c))
{
string capa_principal_nw_c = System.IO.Path.GetFileNameWithoutExtension(OliviaGlob.Paths.PathNW_c);
HelperGdb.CloseLayer(capa_principal_nw_c);
}
} }
} }
} }

View File

@ -123,15 +123,20 @@ namespace OliviaAddInPro.Services
} }
else else
{ {
//actualiza la capa de la que tiene que leer ahora para planificar
inst.CapaPlanif = resp2.Value;
//pone modo config2
OliviaGlob.AddFlagTipEjec(TiposEjecucion.Config2);
if (OliviaGlob.HasFlagTipEjec(TiposEjecucion.EjecPlanif)) //Ha terminado bien la planificación if (OliviaGlob.HasFlagTipEjec(TiposEjecucion.EjecPlanif)) //Ha terminado bien la planificación
{ {
//guarda csv //guarda csv
GuardaCsv(inst,resp2.Value); GuardaCsv(inst,resp2.Value);
} }
else
{
//actualiza la capa de la que tiene que leer ahora para planificar
inst.CapaPlanif = resp2.Value;
//pone modo config2
OliviaGlob.AddFlagTipEjec(TiposEjecucion.Config2);
}
msg = Resource1.String_exito; msg = Resource1.String_exito;
} }
@ -162,7 +167,7 @@ namespace OliviaAddInPro.Services
public static void BorraFiles() public static void BorraFiles()
{ {
string[] list = null; string[] list = null;
string capa_principal, capa_principal_nw; string capa_principal, capa_principal_nw, capa_principal_nw_c;
if (!string.IsNullOrEmpty(OliviaGlob.Paths.PathData)) if (!string.IsNullOrEmpty(OliviaGlob.Paths.PathData))
capa_principal = System.IO.Path.GetFileNameWithoutExtension(OliviaGlob.Paths.PathData); capa_principal = System.IO.Path.GetFileNameWithoutExtension(OliviaGlob.Paths.PathData);
else else
@ -171,7 +176,10 @@ namespace OliviaAddInPro.Services
capa_principal_nw = System.IO.Path.GetFileNameWithoutExtension(OliviaGlob.Paths.PathNW); capa_principal_nw = System.IO.Path.GetFileNameWithoutExtension(OliviaGlob.Paths.PathNW);
else else
capa_principal_nw = null; capa_principal_nw = null;
if (!string.IsNullOrEmpty(OliviaGlob.Paths.PathNW_c))
capa_principal_nw_c = System.IO.Path.GetFileNameWithoutExtension(OliviaGlob.Paths.PathNW_c);
else
capa_principal_nw_c = null;
try try
{ {
if (capa_principal != null && HelperGdb.CloseLayer(capa_principal)) if (capa_principal != null && HelperGdb.CloseLayer(capa_principal))
@ -200,6 +208,19 @@ namespace OliviaAddInPro.Services
} }
} }
} }
if (capa_principal_nw_c != null && HelperGdb.CloseLayer(capa_principal_nw_c))
{
list = System.IO.Directory.GetFiles(OliviaGlob.Paths.DirData, capa_principal_nw_c + "*");
if (list.Length > 0)
{
foreach (string f in list)
{
if (System.IO.Path.GetExtension(f) == ".lock")
continue;
System.IO.File.Delete(f);
}
}
}
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -218,7 +239,7 @@ namespace OliviaAddInPro.Services
System.IO.Path.GetFileNameWithoutExtension(OliviaGlob.Paths.PathData) + inst.ServCom.NAME_CSV + ".*"); System.IO.Path.GetFileNameWithoutExtension(OliviaGlob.Paths.PathData) + inst.ServCom.NAME_CSV + ".*");
string Title = "Directorio para guardar Secuencia de la Planificación"; string Title = "Directorio para guardar Secuencia de la Planificación";
string Filter = "Secuencia en formato CSV (*.csv)|*.csv"; //string Filter = "Secuencia en formato CSV (*.csv)|*.csv";
inst.decode_gdb(System.IO.Path.GetFileNameWithoutExtension(OliviaGlob.Paths.PathData), inst.decode_gdb(System.IO.Path.GetFileNameWithoutExtension(OliviaGlob.Paths.PathData),
out auxi, out nombre); out auxi, out nombre);
if (!string.IsNullOrEmpty(pathImport)) if (!string.IsNullOrEmpty(pathImport))

View File

@ -55,7 +55,12 @@ namespace OliviaAddInPro.Services.LanzaSrv
return false; return false;
if (limp.RespCirc) if (limp.RespCirc)
r = 1; //restricción de circulación {
if (ComunDef.configMV.sentidoAmbitos == 1)
r = 2; //restricción de circulación
else
r = 1;
}
if (modo == ModosEjec.Sectoriza) if (modo == ModosEjec.Sectoriza)
modo_str = GeneralDef.SockConf; modo_str = GeneralDef.SockConf;
@ -66,6 +71,7 @@ namespace OliviaAddInPro.Services.LanzaSrv
str = GeneralDef.EjecGeoParamSep + modo_str + " " + str = GeneralDef.EjecGeoParamSep + modo_str + " " +
GeneralDef.EjecGeoParamSep + GeneralDef.GL_tto + GeneralDef.EjecGeoParamIgual + limp.Ttto + " " + GeneralDef.EjecGeoParamSep + GeneralDef.GL_tto + GeneralDef.EjecGeoParamIgual + limp.Ttto + " " +
GeneralDef.EjecGeoParamSep + GeneralDef.GL_res + GeneralDef.EjecGeoParamIgual + r + " " + GeneralDef.EjecGeoParamSep + GeneralDef.GL_res + GeneralDef.EjecGeoParamIgual + r + " " +
GeneralDef.EjecGeoParamSep + GeneralDef.GG_senAmb + GeneralDef.EjecGeoParamIgual + ComunDef.configMV.sentidoAmbitos + " " +
GeneralDef.EjecGeoParamSep + GeneralDef.GL_uto + GeneralDef.EjecGeoParamIgual + (int)limp.UdsTTto + " " + GeneralDef.EjecGeoParamSep + GeneralDef.GL_uto + GeneralDef.EjecGeoParamIgual + (int)limp.UdsTTto + " " +
GeneralDef.EjecGeoParamSep + GeneralDef.GL_vdp + GeneralDef.EjecGeoParamIgual + limp.VDespl + " " + GeneralDef.EjecGeoParamSep + GeneralDef.GL_vdp + GeneralDef.EjecGeoParamIgual + limp.VDespl + " " +
GeneralDef.EjecGeoParamSep + GeneralDef.GG_tco + GeneralDef.EjecGeoParamIgual + limp.TConv + " " + GeneralDef.EjecGeoParamSep + GeneralDef.GG_tco + GeneralDef.EjecGeoParamIgual + limp.TConv + " " +
@ -80,6 +86,10 @@ namespace OliviaAddInPro.Services.LanzaSrv
GeneralDef.EjecGeoParamSep + GeneralDef.GG_coox + GeneralDef.EjecGeoParamIgual + limp.CoordsInstal.X + " " +//coordenadas GeneralDef.EjecGeoParamSep + GeneralDef.GG_coox + GeneralDef.EjecGeoParamIgual + limp.CoordsInstal.X + " " +//coordenadas
GeneralDef.EjecGeoParamSep + GeneralDef.GG_cooy + GeneralDef.EjecGeoParamIgual + limp.CoordsInstal.Y + " " +//coordenadas GeneralDef.EjecGeoParamSep + GeneralDef.GG_cooy + GeneralDef.EjecGeoParamIgual + limp.CoordsInstal.Y + " " +//coordenadas
GeneralDef.EjecGeoParamSep + GeneralDef.GG_ais + GeneralDef.EjecGeoParamIgual + (limp.IgnoAis ? 1 : 0) + " " + GeneralDef.EjecGeoParamSep + GeneralDef.GG_ais + GeneralDef.EjecGeoParamIgual + (limp.IgnoAis ? 1 : 0) + " " +
GeneralDef.EjecGeoParamSep + GeneralDef.GG_elev + GeneralDef.EjecGeoParamIgual + (ComunDef.CamposNW.config.comprueba_elevacion ? 1 : 0) + " " +
GeneralDef.EjecGeoParamSep + GeneralDef.GG_topo + GeneralDef.EjecGeoParamIgual + (ComunDef.CamposNW.config.revisa_topologia ? 1 : 0) + " " +
GeneralDef.EjecGeoParamSep + GeneralDef.GG_conj + GeneralDef.EjecGeoParamIgual + (ComunDef.CamposNW.config.revisa_conjunciones ? 1 : 0) + " " +
GeneralDef.EjecGeoParamSep + GeneralDef.GG_angu + GeneralDef.EjecGeoParamIgual + (ComunDef.CamposNW.config.revisa_angulos ? 1 : 0) + " " +
//campos del dbf de limpieza para leer //campos del dbf de limpieza para leer
GeneralDef.EjecGeoParamSep + GeneralDef.GAA_obser + GeneralDef.EjecGeoParamIgual + LimpiezaDef.Campos.consulta_observ + " " + GeneralDef.EjecGeoParamSep + GeneralDef.GAA_obser + GeneralDef.EjecGeoParamIgual + LimpiezaDef.Campos.consulta_observ + " " +
GeneralDef.EjecGeoParamSep + GeneralDef.GAA_anch_tip + GeneralDef.EjecGeoParamIgual + LimpiezaDef.Campos.consulta_anch_tip + " " + GeneralDef.EjecGeoParamSep + GeneralDef.GAA_anch_tip + GeneralDef.EjecGeoParamIgual + LimpiezaDef.Campos.consulta_anch_tip + " " +

View File

@ -61,6 +61,7 @@ namespace OliviaAddInPro.Services.LanzaSrv
{ {
str_cfg = str_cfg + str_cfg = str_cfg +
//campos de la red navegable //campos de la red navegable
/*
GeneralDef.EjecGeoParamSep + GeneralDef.GTC_onew + GeneralDef.EjecGeoParamIgual + ComunDef.CamposNW.cons_onew + " " + GeneralDef.EjecGeoParamSep + GeneralDef.GTC_onew + GeneralDef.EjecGeoParamIgual + ComunDef.CamposNW.cons_onew + " " +
GeneralDef.EjecGeoParamSep + GeneralDef.GTC_kph + GeneralDef.EjecGeoParamIgual + ComunDef.CamposNW.cons_kph + " " + GeneralDef.EjecGeoParamSep + GeneralDef.GTC_kph + GeneralDef.EjecGeoParamIgual + ComunDef.CamposNW.cons_kph + " " +
GeneralDef.EjecGeoParamSep + GeneralDef.GTC_fow + GeneralDef.EjecGeoParamIgual + ComunDef.CamposNW.cons_fow + " " + GeneralDef.EjecGeoParamSep + GeneralDef.GTC_fow + GeneralDef.EjecGeoParamIgual + ComunDef.CamposNW.cons_fow + " " +
@ -69,11 +70,13 @@ namespace OliviaAddInPro.Services.LanzaSrv
GeneralDef.EjecGeoParamSep + GeneralDef.GTA_FT + GeneralDef.EjecGeoParamIgual + ComunDef.AtributosNW.atr_FT + " " + GeneralDef.EjecGeoParamSep + GeneralDef.GTA_FT + GeneralDef.EjecGeoParamIgual + ComunDef.AtributosNW.atr_FT + " " +
GeneralDef.EjecGeoParamSep + GeneralDef.GTA_N + GeneralDef.EjecGeoParamIgual + ComunDef.AtributosNW.atr_N + " " + GeneralDef.EjecGeoParamSep + GeneralDef.GTA_N + GeneralDef.EjecGeoParamIgual + ComunDef.AtributosNW.atr_N + " " +
GeneralDef.EjecGeoParamSep + GeneralDef.GTA_pedes + GeneralDef.EjecGeoParamIgual + ComunDef.AtributosNW.atr_pedes + " " + GeneralDef.EjecGeoParamSep + GeneralDef.GTA_pedes + GeneralDef.EjecGeoParamIgual + ComunDef.AtributosNW.atr_pedes + " " +
*/
//nombre del tratamiento //nombre del tratamiento
GeneralDef.EjecGeoParamSep + GeneralDef.GG_strtto + GeneralDef.EjecGeoParamIgual + NombreTratamiento + " " + GeneralDef.EjecGeoParamSep + GeneralDef.GG_strtto + GeneralDef.EjecGeoParamIgual + NombreTratamiento + " " +
//paths de archivos //paths de archivos
GeneralDef.EjecGeoParamSep + GeneralDef.GG_pd + GeneralDef.EjecGeoParamIgual + OliviaGlob.Paths.PathData + " " + GeneralDef.EjecGeoParamSep + GeneralDef.GG_pd + GeneralDef.EjecGeoParamIgual + OliviaGlob.Paths.PathData + " " +
GeneralDef.EjecGeoParamSep + GeneralDef.GG_pn + GeneralDef.EjecGeoParamIgual + OliviaGlob.Paths.PathNW + " " + GeneralDef.EjecGeoParamSep + GeneralDef.GG_pn + GeneralDef.EjecGeoParamIgual + OliviaGlob.Paths.PathNW + " " +
GeneralDef.EjecGeoParamSep + GeneralDef.GG_pnj + GeneralDef.EjecGeoParamIgual + OliviaGlob.Paths.PathNW_c + " " +
//nombres de cols de sector y secuencia //nombres de cols de sector y secuencia
GeneralDef.EjecGeoParamSep + GeneralDef.GTO_camp_sector + GeneralDef.EjecGeoParamIgual + ComunDef.CamposCom.consulta_sector + " " + GeneralDef.EjecGeoParamSep + GeneralDef.GTO_camp_sector + GeneralDef.EjecGeoParamIgual + ComunDef.CamposCom.consulta_sector + " " +
GeneralDef.EjecGeoParamSep + GeneralDef.GTO_camp_secuencia + GeneralDef.EjecGeoParamIgual + ComunDef.CamposCom.consulta_secuen + " " + GeneralDef.EjecGeoParamSep + GeneralDef.GTO_camp_secuencia + GeneralDef.EjecGeoParamIgual + ComunDef.CamposCom.consulta_secuen + " " +

View File

@ -67,7 +67,7 @@ namespace OliviaAddInPro.Services.LanzaSrv
GeneralDef.EjecGeoParamSep + GeneralDef.GR_kgM + GeneralDef.EjecGeoParamIgual + reco.KgMaxVehic + " " + GeneralDef.EjecGeoParamSep + GeneralDef.GR_kgM + GeneralDef.EjecGeoParamIgual + reco.KgMaxVehic + " " +
GeneralDef.EjecGeoParamSep + GeneralDef.GR_camp_kgrec + GeneralDef.EjecGeoParamIgual + conf.kgrec + " " + GeneralDef.EjecGeoParamSep + GeneralDef.GR_camp_kgrec + GeneralDef.EjecGeoParamIgual + conf.kgrec + " " +
GeneralDef.EjecGeoParamSep + GeneralDef.GR_camp_uds + GeneralDef.EjecGeoParamIgual + conf.uds + " " + GeneralDef.EjecGeoParamSep + GeneralDef.GR_camp_uds + GeneralDef.EjecGeoParamIgual + conf.uds + " " +
GeneralDef.EjecGeoParamSep + GeneralDef.GR_kgrecog + GeneralDef.EjecGeoParamIgual + conf.kgrec_val + " " + GeneralDef.EjecGeoParamSep + GeneralDef.GR_kgrecog + GeneralDef.EjecGeoParamIgual + (conf.is_campo?"0":(conf.is_lleno?"-1":conf.kgrec_val)) + " " +
GeneralDef.EjecGeoParamSep + GeneralDef.GR_carga_cont + GeneralDef.EjecGeoParamIgual + 0 + " " + GeneralDef.EjecGeoParamSep + GeneralDef.GR_carga_cont + GeneralDef.EjecGeoParamIgual + 0 + " " +
GeneralDef.EjecGeoParamSep + GeneralDef.GR_dens + GeneralDef.EjecGeoParamIgual + reco.DensCont + " " + GeneralDef.EjecGeoParamSep + GeneralDef.GR_dens + GeneralDef.EjecGeoParamIgual + reco.DensCont + " " +
GeneralDef.EjecGeoParamSep + GeneralDef.GG_tco + GeneralDef.EjecGeoParamIgual + reco.TConv + " " + GeneralDef.EjecGeoParamSep + GeneralDef.GG_tco + GeneralDef.EjecGeoParamIgual + reco.TConv + " " +
@ -91,6 +91,10 @@ namespace OliviaAddInPro.Services.LanzaSrv
GeneralDef.EjecGeoParamSep + GeneralDef.GR_sens_fechaf + GeneralDef.EjecGeoParamIgual + "0 " + GeneralDef.EjecGeoParamSep + GeneralDef.GR_sens_fechaf + GeneralDef.EjecGeoParamIgual + "0 " +
GeneralDef.EjecGeoParamSep + GeneralDef.GR_sens_modo + GeneralDef.EjecGeoParamIgual + "0 " + GeneralDef.EjecGeoParamSep + GeneralDef.GR_sens_modo + GeneralDef.EjecGeoParamIgual + "0 " +
GeneralDef.EjecGeoParamSep + GeneralDef.GG_ais + GeneralDef.EjecGeoParamIgual + (reco.IgnoAis?1:0) + " " + GeneralDef.EjecGeoParamSep + GeneralDef.GG_ais + GeneralDef.EjecGeoParamIgual + (reco.IgnoAis?1:0) + " " +
GeneralDef.EjecGeoParamSep + GeneralDef.GG_elev + GeneralDef.EjecGeoParamIgual + (ComunDef.CamposNW.config.comprueba_elevacion ? 1 : 0) + " " +
GeneralDef.EjecGeoParamSep + GeneralDef.GG_topo + GeneralDef.EjecGeoParamIgual + (ComunDef.CamposNW.config.revisa_topologia ? 1 : 0) + " " +
GeneralDef.EjecGeoParamSep + GeneralDef.GG_conj + GeneralDef.EjecGeoParamIgual + (ComunDef.CamposNW.config.revisa_conjunciones ? 1 : 0) + " " +
GeneralDef.EjecGeoParamSep + GeneralDef.GG_angu + GeneralDef.EjecGeoParamIgual + (ComunDef.CamposNW.config.revisa_angulos ? 1 : 0) + " " +
GeneralDef.EjecGeoParamSep + GeneralDef.GR_lateral + GeneralDef.EjecGeoParamIgual + reco.TipoLate + " " + GeneralDef.EjecGeoParamSep + GeneralDef.GR_lateral + GeneralDef.EjecGeoParamIgual + reco.TipoLate + " " +
//mima de la nw //mima de la nw
GeneralDef.EjecGeoParamSep + GeneralDef.GTO_mima_xmin + GeneralDef.EjecGeoParamIgual + reco.MimaNw.XMin + " " + GeneralDef.EjecGeoParamSep + GeneralDef.GTO_mima_xmin + GeneralDef.EjecGeoParamIgual + reco.MimaNw.XMin + " " +

View File

@ -2,10 +2,12 @@
using ArcGIS.Core.Geometry; using ArcGIS.Core.Geometry;
using ArcGIS.Core.Internal.CIM; using ArcGIS.Core.Internal.CIM;
using ArcGIS.Desktop.Framework.Threading.Tasks;*/ using ArcGIS.Desktop.Framework.Threading.Tasks;*/
using ActiproSoftware.Windows.Extensions;
using OliviaAddInPro.Helper; using OliviaAddInPro.Helper;
using OliviaAddInPro.Model; using OliviaAddInPro.Model;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -31,6 +33,15 @@ namespace OliviaAddInPro.Services
*/ */
public Respuesta<bool> Ejecuta(ModosEjec modo) public Respuesta<bool> Ejecuta(ModosEjec modo)
{ {
var modos_viaje = ConfigServ.Serv.Leer().ListaMV;
if (modos_viaje != null && modos_viaje.Count > TipoMv && TipoMv >= 0)
{
ComunDef.configMV = modos_viaje[TipoMv];
}
else
{
ComunDef.configMV = new OliviaConfMV();
}
var res = new Respuesta<bool>() var res = new Respuesta<bool>()
{ {
Value = false Value = false
@ -73,7 +84,7 @@ namespace OliviaAddInPro.Services
{ {
nombFileAmbs = string.Empty; nombFileAmbs = string.Empty;
limp.ConsultaAmbs = DameAmbsConsulta(out nombFileAmbs); limp.ConsultaAmbs = DameAmbsConsulta(out nombFileAmbs);
if (string.IsNullOrEmpty(limp.ConsultaAmbs)) if (null==limp.ConsultaAmbs)
{ {
return false; return false;
} }
@ -105,7 +116,44 @@ namespace OliviaAddInPro.Services
return consulta; return consulta;
} }
public ObservableCollection<string> GetNombreModosViajes()
{
var conf=ConfigServ.Serv.Leer();
var res = new ObservableCollection<string>();
if (conf.ListaMV==null || conf.ListaMV.Count<=0 )
return res;
res.AddRange(conf.ListaMV.Select(c => c.nombre));
return res;
}
public int GetModosViajesDefecto(int vehiculo)
{
var conf = ConfigServ.Serv.Leer();
var res = new ObservableCollection<string>();
if (conf.ListaMV == null || conf.ListaMV.Count <= 0)
return -1;
for(int i=0; i< conf.ListaMV.Count; i++)
{
if (conf.ListaMV[i].vehiculo_def_reco == vehiculo)
return i;
}
return 0;
}
public int GetModosViajesDefecto(bool rcircu)
{
int vehiculo= rcircu? 1: 0;
var conf = ConfigServ.Serv.Leer();
var res = new ObservableCollection<string>();
if (conf.ListaMV == null || conf.ListaMV.Count <= 0)
return -1;
for (int i = 0; i < conf.ListaMV.Count; i++)
{
if (conf.ListaMV[i].vehiculo_def_lim == vehiculo)
return i;
}
return 0;
}
/** /**
* Comprueba lo necesario para ver si hay campos para la planificación * Comprueba lo necesario para ver si hay campos para la planificación
*/ */
@ -152,7 +200,7 @@ namespace OliviaAddInPro.Services
public bool CompruebaCamposLimp(string pathCapa) public bool CompruebaCamposLimp(string pathCapa)
{ {
string[] camps = limp.GetCampos(pathCapa); string[] camps = limp.GetCampos(pathCapa);
int res = 1; //int res = 1;
if ((camps == null) || (HelperGdb.CheckFileds(pathCapa, camps) != 0)) if ((camps == null) || (HelperGdb.CheckFileds(pathCapa, camps) != 0))
{ {
ErrStr = HelperGdb.OutStr; ErrStr = HelperGdb.OutStr;
@ -168,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

@ -14,11 +14,11 @@ namespace OliviaAddInPro.Services
public class ProcesoEjecServ public class ProcesoEjecServ
{ {
Cstr_socket soc = null; Cstr_socket soc = null;
int m_out=0; //int m_out=0;
int m_miliseconds=200; int m_miliseconds=200;
int m_tm_progr=1000; int m_tm_progr=1000;
int modo_fin = 0; int modo_fin = 0;
bool cancela = false; //bool cancela = false;
bool cancela_fin = false; bool cancela_fin = false;
bool conectado = false; bool conectado = false;
bool permu = false; bool permu = false;
@ -509,7 +509,7 @@ namespace OliviaAddInPro.Services
*/ */
private void pon_barstate(TiposActu actu) private void pon_barstate(TiposActu actu)
{ {
int col = 1; //int col = 1;
if ((actu == TiposActu.ActuMal) || (actu == TiposActu.ActuFinNOk)) if ((actu == TiposActu.ActuMal) || (actu == TiposActu.ActuFinNOk))

View File

@ -70,7 +70,15 @@ namespace OliviaAddInPro.Services
{ {
Value = false Value = false
}; };
var modos_viaje = ConfigServ.Serv.Leer().ListaMV;
if (modos_viaje != null && modos_viaje.Count > TipoMv && TipoMv>=0)
{
ComunDef.configMV = modos_viaje[TipoMv];
}
else
{
ComunDef.configMV = new OliviaConfMV();
}
com = (TratamientoComun)reco; com = (TratamientoComun)reco;
string nombFileAmbs = string.Empty; string nombFileAmbs = string.Empty;

View File

@ -0,0 +1,14 @@
<UserControl x:Class="OliviaAddInPro.View.Configuracion.PropertyGridFilePickerPto"
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,65 @@
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 PropertyGridFilePickerPto : ITypeEditor
{
public PropertyGridFilePickerPto()
{
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(PropertyGridFilePickerPto), 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.OpenFileDialog(TiposOpenFileDlg.OpenFtrClassPoint, Value);
if (!string.IsNullOrEmpty(st))
{
Value = st;
}
}
}
}

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

@ -32,8 +32,12 @@
<ComboBox x:Name="comboBox_tto" IsEnabled="{Binding Path=CapaAbierta, Mode = TwoWay}" ItemsSource="{Binding Path=TiposTto, Mode = TwoWay}" HorizontalAlignment="Left" Margin="20,0,0,0" <ComboBox x:Name="comboBox_tto" IsEnabled="{Binding Path=CapaAbierta, Mode = TwoWay}" ItemsSource="{Binding Path=TiposTto, Mode = TwoWay}" HorizontalAlignment="Left" Margin="20,0,0,0"
VerticalAlignment="Top" Width="260" DropDownOpened="ComboBox_DropDownOpened" SelectionChanged="comboBox_tto_SelectionChanged" VerticalAlignment="Top" Width="260" DropDownOpened="ComboBox_DropDownOpened" SelectionChanged="comboBox_tto_SelectionChanged"
SelectedIndex="{Binding Path=TipoTto, Mode = TwoWay}"/> SelectedIndex="{Binding Path=TipoTto, Mode = TwoWay}"/>
<Label Content="Ámbitos de Trabajo" HorizontalAlignment="Left" Margin="15,0,0,0" VerticalAlignment="Top" RenderTransformOrigin="-0.391,-0.203" FontWeight="DemiBold"/> <Label Content="Modos de viaje" HorizontalAlignment="Left" Margin="15,0,0,0" VerticalAlignment="Top" FontWeight="DemiBold"/>
<ComboBox x:Name="comboBox_ambitos" IsEnabled="{Binding Path=CapaAbierta, Mode = TwoWay}" ItemsSource="{Binding Path=OpsAmbs, Mode = TwoWay}" HorizontalAlignment="Left" Margin="20,0,0,0" <ComboBox x:Name="comboBox_mv" IsEnabled="{Binding Path=CapaAbierta, Mode = TwoWay}" ItemsSource="{Binding Path=TiposMv, Mode = TwoWay}" HorizontalAlignment="Left" Margin="20,0,0,0"
VerticalAlignment="Top" Width="260" SelectionChanged="comboBox_mv_SelectionChanged"
SelectedIndex="{Binding Path=TipoMv, Mode = TwoWay}"/>
<Label Content="Ámbitos de Trabajo" HorizontalAlignment="Left" Margin="15,0,0,0" VerticalAlignment="Top" RenderTransformOrigin="-0.391,-0.203" FontWeight="DemiBold"/>
<ComboBox x:Name="comboBox_ambitos" IsEnabled="{Binding Path=CapaAbierta, Mode = TwoWay}" ItemsSource="{Binding Path=OpsAmbs, Mode = TwoWay}" HorizontalAlignment="Left" Margin="20,0,0,0"
VerticalAlignment="Top" Width="260" SelectionChanged="comboBox_ambitos_SelectionChanged" VerticalAlignment="Top" Width="260" SelectionChanged="comboBox_ambitos_SelectionChanged"
SelectedIndex="{Binding Path=SelOpAmb, Mode = TwoWay}"/> SelectedIndex="{Binding Path=SelOpAmb, Mode = TwoWay}"/>
<ListBox x:Name="listBox_ambitos" IsEnabled="{Binding Path=CapaAbierta, Mode = TwoWay}" ItemsSource="{Binding Path=Ambitos, Mode = TwoWay}" HorizontalAlignment="Left" Height="100" <ListBox x:Name="listBox_ambitos" IsEnabled="{Binding Path=CapaAbierta, Mode = TwoWay}" ItemsSource="{Binding Path=Ambitos, Mode = TwoWay}" HorizontalAlignment="Left" Height="100"

View File

@ -80,7 +80,20 @@ namespace OliviaAddInPro
} }
} }
private void comboBox_mv_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
int i = -1;
if (sender is System.Windows.Controls.ComboBox combo)
{
i = combo.SelectedIndex;
if (DataContext is PaneLimpiezaSub1ViewModel mod)
{
mod.ComboMvSel(i);
}
}
}
private void comboBox_ambitos_SelectionChanged(object sender, SelectionChangedEventArgs e) private void comboBox_ambitos_SelectionChanged(object sender, SelectionChangedEventArgs e)
{ {
int i = -1; int i = -1;

View File

@ -5,7 +5,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:extensions="clr-namespace:ArcGIS.Desktop.Extensions;assembly=ArcGIS.Desktop.Extensions" xmlns:extensions="clr-namespace:ArcGIS.Desktop.Extensions;assembly=ArcGIS.Desktop.Extensions"
xmlns:ui="clr-namespace:OliviaAddInPro" xmlns:ui="clr-namespace:OliviaAddInPro"
mc:Ignorable="d" d:DesignWidth="300" Height="390" mc:Ignorable="d" d:DesignWidth="300" Height="422"
d:DataContext="{Binding Path=ui.PaneRecogidaSub1ViewModel}" Loaded="UserControl_Loaded" Unloaded="UserControl_Unloaded" > d:DataContext="{Binding Path=ui.PaneRecogidaSub1ViewModel}" Loaded="UserControl_Loaded" Unloaded="UserControl_Unloaded" >
<UserControl.Resources> <UserControl.Resources>
<ResourceDictionary> <ResourceDictionary>
@ -91,9 +91,13 @@
<ComboBox x:Name="comboBox_tipoCapac" IsEnabled="{Binding EnabComboCapac, Mode=TwoWay}" ItemsSource="{Binding TiposCapac, Mode=TwoWay}" HorizontalAlignment="Left" Margin="0,0,0,0" <ComboBox x:Name="comboBox_tipoCapac" IsEnabled="{Binding EnabComboCapac, Mode=TwoWay}" ItemsSource="{Binding TiposCapac, Mode=TwoWay}" HorizontalAlignment="Left" Margin="0,0,0,0"
VerticalAlignment="Top" Width="75" VerticalAlignment="Top" Width="75"
SelectedIndex="{Binding TipoCapac}" SelectionChanged="comboBox_tipoCapac_SelectionChanged"/> SelectedIndex="{Binding TipoCapac}" SelectionChanged="comboBox_tipoCapac_SelectionChanged"/>
<TextBox x:Name="txtBox_kgCapac" IsEnabled="{Binding Path=CapaAbierta, Mode = TwoWay}" Grid.Column="1" Margin="5,0,0,3" TextWrapping="NoWrap" Text="{Binding Path=TextKgCapac, Mode = TwoWay}" TextAlignment="Right" MaxLength="8" PreviewTextInput="txtBox_kgCapac_PreviewTextInput"/> <TextBox x:Name="txtBox_kgCapac" IsEnabled="{Binding Path=CapaAbierta, Mode = TwoWay}" Grid.Column="1" Margin="5,0,74,3" TextWrapping="NoWrap" Text="{Binding Path=TextKgCapac, Mode = TwoWay}" TextAlignment="Right" MaxLength="8" PreviewTextInput="txtBox_kgCapac_PreviewTextInput" Grid.ColumnSpan="2"/>
<Label x:Name="label_kgmax" Grid.Column="2" Content="kg máx. por viaje" Margin="0,-1,0,0"/> <Label x:Name="label_kgmax" Grid.Column="2" Content="kg máx. por viaje" Margin="26,-1,-26,0"/>
</Grid> </Grid>
<Label Content="Modos de viaje" HorizontalAlignment="Left" Margin="15,0,0,0" VerticalAlignment="Top" FontWeight="DemiBold"/>
<ComboBox x:Name="comboBox_mv" IsEnabled="{Binding Path=CapaAbierta, Mode = TwoWay}" ItemsSource="{Binding Path=TiposMv, Mode = TwoWay}" HorizontalAlignment="Left" Margin="20,0,0,0"
VerticalAlignment="Top" Width="260" SelectionChanged="comboBox_mv_SelectionChanged"
SelectedIndex="{Binding Path=TipoMv, Mode = TwoWay}"/>
<Label Content="Tiempo de vaciado de contenedor" HorizontalAlignment="Left" Margin="15,0,0,0" VerticalAlignment="Top" RenderTransformOrigin="-0.391,-0.203" FontWeight="DemiBold"/> <Label Content="Tiempo de vaciado de contenedor" HorizontalAlignment="Left" Margin="15,0,0,0" VerticalAlignment="Top" RenderTransformOrigin="-0.391,-0.203" FontWeight="DemiBold"/>
<Grid Margin="20,0,0,0"> <Grid Margin="20,0,0,0">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>

View File

@ -61,7 +61,9 @@ namespace OliviaAddInPro
private void txtBox_kgCapac_PreviewTextInput(object sender, TextCompositionEventArgs e) private void txtBox_kgCapac_PreviewTextInput(object sender, TextCompositionEventArgs e)
{ {
e.Handled = !PanelGlobal.IsValid(((TextBox)sender).Text + e.Text, 1, 10000); int ii;
e.Handled = !int.TryParse(((TextBox)sender).Text + e.Text, out ii);//!PanelGlobal.IsValid(((TextBox)sender).Text + e.Text, 1, 10000);
} }
private void comboBox_frac_SelectionChanged(object sender, SelectionChangedEventArgs e) private void comboBox_frac_SelectionChanged(object sender, SelectionChangedEventArgs e)
@ -110,7 +112,20 @@ namespace OliviaAddInPro
} }
} }
} }
private void comboBox_mv_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
int i = -1;
if (sender is System.Windows.Controls.ComboBox combo)
{
i = combo.SelectedIndex;
if (DataContext is PaneRecogidaSub1ViewModel mod)
{
mod.ComboMvSel(i);
}
}
}
private void comboBox_tipoCapac_SelectionChanged(object sender, SelectionChangedEventArgs e) private void comboBox_tipoCapac_SelectionChanged(object sender, SelectionChangedEventArgs e)
{ {
int i = -1; int i = -1;

View File

@ -27,6 +27,7 @@ namespace OliviaAddInPro
{ {
private ObservableCollection<string> tiposTto = new ObservableCollection<string>(LimpiezaDef.tipos_tto_str); private ObservableCollection<string> tiposTto = new ObservableCollection<string>(LimpiezaDef.tipos_tto_str);
private ObservableCollection<string> tiposMv = new ObservableCollection<string>();
private ObservableCollection<string> opsAmbs=new ObservableCollection<string>(); private ObservableCollection<string> opsAmbs=new ObservableCollection<string>();
private int selOpAmb = -1; private int selOpAmb = -1;
private ObservableCollection<CheckedListItem<string>> ambitos = new ObservableCollection<CheckedListItem<string>>(); private ObservableCollection<CheckedListItem<string>> ambitos = new ObservableCollection<CheckedListItem<string>>();
@ -114,7 +115,27 @@ namespace OliviaAddInPro
base.NotifyPropertyChanged("TiposTto"); base.NotifyPropertyChanged("TiposTto");
} }
} }
public ObservableCollection<string> TiposMv
{
get { return tiposMv; }
set
{
tiposMv = value;
base.NotifyPropertyChanged("TiposMv");
}
}
private int tipoMv = -1;
public int TipoMv
{
get { return tipoMv; }
set
{
tipoMv = value;
base.NotifyPropertyChanged("TipoMv");
}
}
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; }
@ -199,6 +220,8 @@ namespace OliviaAddInPro
lblUdsVeloDespl = "km/h"; lblUdsVeloDespl = "km/h";
limpServ = new LimpiezaServ(null); //no hace falta instancia limp limpServ = new LimpiezaServ(null); //no hace falta instancia limp
textAnchoVia = LimpiezaDef.Parametros.ancho_via.ToString(); textAnchoVia = LimpiezaDef.Parametros.ancho_via.ToString();
tiposMv = limpServ.GetNombreModosViajes();
tipoMv = -1;
} }
/** /**
* Realiza las comprobaciones para cuando se ha abierto una capa * Realiza las comprobaciones para cuando se ha abierto una capa
@ -245,23 +268,32 @@ namespace OliviaAddInPro
CapaAbierta = true; CapaAbierta = true;
return true; return true;
} }
/** public void ComboMvSel(int tto)
* Realiza los cambios en los ámbitos cuando se ha seleccionado un tratamiento {
*/ if (tto < 0)
public void ComboTtoSel(int tto) return;
TipoMv = tto;
}
/**
* Realiza los cambios en los ámbitos cuando se ha seleccionado un tratamiento
*/
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)
{ {
RespCirc = LimpiezaDef.rest_circ[TipoTto]; RespCirc = LimpiezaDef.rest_circ[TipoTto];
int tv = limpServ.GetModosViajesDefecto(RespCirc);
if (tv >= 0)
TipoMv = tv;
if (LimpiezaDef.v_desplazamiento[TipoTto] > 0) if (LimpiezaDef.v_desplazamiento[TipoTto] > 0)
{ {
TextVeloDespl = Convert.ToString(LimpiezaDef.v_desplazamiento[TipoTto]); TextVeloDespl = Convert.ToString(LimpiezaDef.v_desplazamiento[TipoTto]);

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)
{ {
@ -92,6 +93,8 @@ namespace OliviaAddInPro
err_str = "No se ha seleccionado ningún Tipo de Tratamiento"; err_str = "No se ha seleccionado ningún Tipo de Tratamiento";
return false; return false;
} }
limp.TipoMV = _subPanel1ViewModel.TipoMv;
limp.TipoTto = _subPanel1ViewModel.TipoTto; limp.TipoTto = _subPanel1ViewModel.TipoTto;
limp.TipoTtoStr = LimpiezaDef.tto_gdb[_subPanel1ViewModel.TipoTto]; limp.TipoTtoStr = LimpiezaDef.tto_gdb[_subPanel1ViewModel.TipoTto];
//lee el/los ámbito seleccionado //lee el/los ámbito seleccionado

View File

@ -32,7 +32,7 @@ namespace OliviaAddInPro
private ObservableCollection<string> tiposVehic = new ObservableCollection<string>(); private ObservableCollection<string> tiposVehic = new ObservableCollection<string>();
private ObservableCollection<string> tiposCapac = new ObservableCollection<string>(); private ObservableCollection<string> tiposCapac = new ObservableCollection<string>();
private RecogidaServ recoServ = new RecogidaServ(null); //no hace falta instancia reco aquí private RecogidaServ recoServ = new RecogidaServ(null); //no hace falta instancia reco aquí
private ObservableCollection<string> tiposMv = new ObservableCollection<string>();
/** /**
* Array de booleanos enumerando si se existen en la capa seleccionada los tipos de fracción * Array de booleanos enumerando si se existen en la capa seleccionada los tipos de fracción
*/ */
@ -47,6 +47,31 @@ namespace OliviaAddInPro
public bool[] tipos_vehic_bool = new bool[(int)RecogidaDef.TiposVehic.N]; public bool[] tipos_vehic_bool = new bool[(int)RecogidaDef.TiposVehic.N];
#region Properties #region Properties
public ObservableCollection<string> TiposMv
{
get { return tiposMv; }
set
{
tiposMv = value;
base.NotifyPropertyChanged("TiposMv");
}
}
private int tipoMv = -1;
public int TipoMv
{
get { return tipoMv; }
set
{
tipoMv = value;
base.NotifyPropertyChanged("TipoMv");
}
}
public void ComboMvSel(int tto)
{
if (tto < 0)
return;
TipoMv = tto;
}
public override string DisplayName public override string DisplayName
{ {
@ -98,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; }
@ -108,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; }
@ -118,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; }
@ -128,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; }
@ -138,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; }
@ -261,6 +291,7 @@ namespace OliviaAddInPro
{ {
KgCont = RecogidaDef.kgrec_cont; KgCont = RecogidaDef.kgrec_cont;
} }
tiposMv = new LimpiezaServ(null).GetNombreModosViajes();
} }
/** /**
* Realiza las comprobaciones para cuando se ha abierto una capa * Realiza las comprobaciones para cuando se ha abierto una capa
@ -409,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])
{ {
@ -420,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
@ -522,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])
{ {
@ -531,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;
@ -571,16 +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)
{ {
if (tipoVehic_old != tto)
{
int tmv = new LimpiezaServ(null).GetModosViajesDefecto(TipoVehic);
if (tmv >= 0)
{
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)
{ {
@ -599,6 +642,7 @@ namespace OliviaAddInPro
try try
{ {
TipoCapac = tto; TipoCapac = tto;
tipoCapac_old = tto;
rellena_kgmax(); rellena_kgmax();
} }
catch (Exception) catch (Exception)
@ -612,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)
@ -112,6 +113,7 @@ namespace OliviaAddInPro
err_str = "No se ha seleccionado ningún Tipo de Fracción"; err_str = "No se ha seleccionado ningún Tipo de Fracción";
return false; return false;
} }
reco.TipoMV = _subPanel1ViewModel.TipoMv;
reco.TipoFracStr = RecogidaDef.tipos_fracc_str[reco.TipoFrac]; reco.TipoFracStr = RecogidaDef.tipos_fracc_str[reco.TipoFrac];
reco.TipoTto = reco.TipoFrac; reco.TipoTto = reco.TipoFrac;
reco.TipoTtoStr = RecogidaDef.tipos_fracc_str[reco.TipoFrac]; reco.TipoTtoStr = RecogidaDef.tipos_fracc_str[reco.TipoFrac];