Compare commits

..

No commits in common. "Gerardo/ModosViaje" and "develop" have entirely different histories.

34 changed files with 2964 additions and 1101 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="4.0" desktopVersion="3.0.3.36057"> <AddInInfo id="{10742570-cf59-42f2-bea2-2a38002a06ee}" version="3.2" 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>12/04/2024 12:00:00, 2024</Date> <Date>18/04/2023 12:00:00, 2023</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,8 +28,6 @@ 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
{ {
@ -468,7 +466,7 @@ namespace OliviaAddInPro.Helper
{ {
ftclss = dtset.OpenDataset<FeatureClass>(ftclassName); ftclss = dtset.OpenDataset<FeatureClass>(ftclassName);
} }
catch/* (Exception ex)*/ catch (Exception ex)
{ {
ftclss = null; ftclss = null;
} }
@ -479,7 +477,7 @@ namespace OliviaAddInPro.Helper
{ {
ftclss = gdb.OpenDataset<FeatureClass>(ftclassName); ftclss = gdb.OpenDataset<FeatureClass>(ftclassName);
} }
catch /*(Exception ex)*/ catch (Exception ex)
{ {
ftclss = null; ftclss = null;
} }
@ -527,7 +525,7 @@ namespace OliviaAddInPro.Helper
{ {
ftclss = dtset.OpenDataset<FeatureClass>(ftclassName); ftclss = dtset.OpenDataset<FeatureClass>(ftclassName);
} }
catch /*(Exception ex)*/ catch (Exception ex)
{ {
ftclss = null; ftclss = null;
} }
@ -538,7 +536,7 @@ namespace OliviaAddInPro.Helper
{ {
ftclss = gdb.OpenDataset<FeatureClass>(ftclassName); ftclss = gdb.OpenDataset<FeatureClass>(ftclassName);
} }
catch /*(Exception ex)*/ catch (Exception ex)
{ {
ftclss = null; ftclss = null;
} }
@ -674,7 +672,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 && !geom.IsEmpty) if (geom != null)
{ {
SpatialQueryFilter filtSpat = new SpatialQueryFilter SpatialQueryFilter filtSpat = new SpatialQueryFilter
{ {
@ -707,7 +705,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, ArcGIS.Core.Data.SelectionType.ObjectID, SelectionOption.Normal); sel = fc.Select(filt, 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();
@ -738,7 +736,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, ArcGIS.Core.Data.SelectionType.ObjectID, SelectionOption.Normal); sel = fc.Select(filt, 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();
@ -1184,16 +1182,6 @@ 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
*/ */
@ -1205,7 +1193,6 @@ 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))
{ {
@ -1214,10 +1201,7 @@ 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);
@ -1358,7 +1342,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 }, ArcGIS.Core.Data.SelectionType.ObjectID, SelectionOption.Normal)) using (Selection sel = fc.Select(new ArcGIS.Core.Data.QueryFilter { WhereClause = consulta }, SelectionType.ObjectID, SelectionOption.Normal))
n = sel.GetCount(); n = sel.GetCount();
} }
} }
@ -1389,7 +1373,7 @@ namespace OliviaAddInPro.Helper
{ {
//realiza consulta //realiza consulta
n = 0; n = 0;
using (Selection sel = fc.Select(new ArcGIS.Core.Data.QueryFilter { WhereClause = consulta }, ArcGIS.Core.Data.SelectionType.ObjectID, SelectionOption.Normal)) using (Selection sel = fc.Select(new ArcGIS.Core.Data.QueryFilter { WhereClause = consulta }, SelectionType.ObjectID, SelectionOption.Normal))
n = sel.GetCount(); n = sel.GetCount();
} }
} }
@ -1460,7 +1444,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 = false; bool debug = true;
///////////////////////////////////////////////////////// /////////////////////////////////////////////////////////
//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
@ -1479,19 +1463,12 @@ namespace OliviaAddInPro.Helper
if (debug) if (debug)
HelperGlobal.ponMsg("fc " + fc.GetName() + " tipo " + fc.GetType().Name); HelperGlobal.ponMsg("fc " + fc.GetName() + " tipo " + fc.GetType().Name);
///////////////////////////////////////////////////////// /////////////////////////////////////////////////////////
/////TODO comprobar que el object id no está indexado en la capa de nw, cómo hacerlo indexado
///https://pro.arcgis.com/en/pro-app/3.0/tool-reference/data-management/add-attribute-index.htm
///
//Añade a la lista los ids que cumplen el filtro espacial //Añade a la lista los ids que cumplen el filtro espacial
try try
{ {
var aux = fc.Select(filter, ArcGIS.Core.Data.SelectionType.ObjectID, SelectionOption.Normal); ids = fc.Select(filter, SelectionType.ObjectID, SelectionOption.Normal).GetObjectIDs().ToList();
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>();
@ -1512,8 +1489,6 @@ 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())
{ {
@ -1523,8 +1498,7 @@ 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 };
@ -1768,49 +1742,11 @@ namespace OliviaAddInPro.Helper
ArcGIS.Core.Geometry.Geometry geomBuff = null; ArcGIS.Core.Geometry.Geometry geomBuff = null;
try try
{ {
//GeometryEngine.Instance.Buffer(geom.) geomBuff = GeometryEngine.Instance.Buffer(geom, buffer);
//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( Exception e) catch
{ {
//resp.HasError = true;
if (resp.Error.IsNullOrEmpty())
resp.Error = new List<string>();
resp.Error.Add(e.Message);
return resp;
} }
resp.Value = geomBuff; resp.Value = geomBuff;
return resp; return resp;
@ -1822,7 +1758,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
{ {
@ -1853,9 +1789,9 @@ namespace OliviaAddInPro.Helper
} }
} }
} }
while (repite);*/ while (repite);*/
buffer = buff; buffer = buff;
geom_pto = HelperGdb.BufferGeom((ArcGIS.Core.Geometry.Geometry)pto.ToMapPoint(geom.SpatialReference),buffer).Value; //GeometryEngine.Instance.Buffer(pto.ToMapPoint(), buffer); geom_pto = GeometryEngine.Instance.Buffer(pto.ToMapPoint(), buffer);
if (geom_pto == null || geom_pto.IsEmpty) if (geom_pto == null || geom_pto.IsEmpty)
{ {
resp.Value = null; resp.Value = null;
@ -2133,7 +2069,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;
} }
@ -2193,7 +2129,7 @@ namespace OliviaAddInPro.Helper
else else
return string.Empty; return string.Empty;
} }
catch/*(Exception ex)*/ catch(Exception ex)
{ {
return string.Empty; return string.Empty;
} }
@ -2281,7 +2217,7 @@ namespace OliviaAddInPro.Helper
return 0; return 0;
return 2; return 2;
} }
catch /*(Exception ex)*/ catch (Exception ex)
{ {
return 1; return 1;
} }
@ -2311,8 +2247,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;
@ -2412,7 +2348,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, ArcGIS.Core.Geometry.SpatialReference spatref=null) public static Respuesta<bool> ImportShp(string nom_shp, string Gdb_dataset, string namefc)
{ {
var res = new Respuesta<bool> { Value = false }; var res = new Respuesta<bool> { Value = false };
string[] args = { nom_shp, Gdb_dataset, namefc }; string[] args = { nom_shp, Gdb_dataset, namefc };
@ -2420,12 +2356,11 @@ namespace OliviaAddInPro.Helper
try try
{ {
if(spatref==null) ArcGIS.Core.Geometry.SpatialReference spatref = GetSpatRef(nom_shp);
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
{ {
@ -2740,7 +2675,7 @@ namespace OliviaAddInPro.Helper
featureLayer.SetRenderer(uniqueValueRenderer); featureLayer.SetRenderer(uniqueValueRenderer);
} }
catch /*(Exception ex)*/ catch (Exception ex)
{ {
} }
@ -2812,7 +2747,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;
@ -2872,69 +2807,6 @@ 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;
} }
} }

2771
Helper/HelperGdb.cs.bak Normal file

File diff suppressed because it is too large Load Diff

View File

@ -10,28 +10,18 @@ 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_onewFT="_sen_ft"; //<Campo que indica el sentido public static string cons_onew; //<Campo que indica el sentido
public static string cons_onewTF="_sen_tf"; //<Campo que indica el sentido public static string cons_kph; //<Campo que indica la velocidad en kph
public static string cons_name; //<Campo que indica el nombre de la calle
public static string cons_kph="_vel"; //<Campo que indica la velocidad en kph public static string cons_fow; //Campo que indica el tipo de vial, si es peatonal o no
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,9 +65,6 @@ 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,12 +11,9 @@ 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;
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)]
@ -47,30 +44,12 @@ 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]*)");
@ -87,20 +66,16 @@ 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
*/ */
@ -199,10 +174,7 @@ 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)]
@ -245,20 +217,7 @@ namespace OliviaAddInPro.Model
[PropertyOrder(1)] [PropertyOrder(1)]
[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)]
@ -630,25 +589,21 @@ 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")]
@ -656,28 +611,24 @@ 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")]
@ -1376,55 +1327,9 @@ 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)));

View File

@ -1,30 +0,0 @@
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;
}
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; }
}
}

View File

@ -1,31 +0,0 @@
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,7 +142,6 @@ 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";
@ -161,10 +160,7 @@ 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";
/** /**
* Define las propiedades de limpieza a enviar a oliviatasks * Define las propiedades de limpieza a enviar a oliviatasks
*/ */
@ -602,17 +598,7 @@ 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,12 +51,10 @@ 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 public static string PathGdbNw; //<Path de la gdb referente a la red de carreteras de TOMTOM
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
@ -86,8 +84,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;
@ -275,16 +273,14 @@ namespace OliviaAddInPro.Model
if (ft == null) if (ft == null)
return false; return false;
HelperGdb.Free(ft); HelperGdb.Free(ft);
/*int NCAMPS = 5; int NCAMPS = 4;
string[] camps; string[] camps;
camps = new string[NCAMPS]; camps = new string[NCAMPS];
camps[0] = ComunDef.CamposNW.cons_onewFT; camps[0] = ComunDef.CamposNW.cons_onew;
camps[1] = ComunDef.CamposNW.cons_onewTF; camps[1] = ComunDef.CamposNW.cons_kph;
camps[2] = ComunDef.CamposNW.cons_kph; camps[2] = ComunDef.CamposNW.cons_name;
camps[3] = ComunDef.CamposNW.cons_name; camps[3] = ComunDef.CamposNW.cons_fow;
camps[4] = ComunDef.CamposNW.cons_fow; return HelperGdb.CheckFileds(OliviaGlob.Paths.PathGdbNw, camps) == 0;
return HelperGdb.CheckFileds(OliviaGlob.Paths.PathGdbNw, camps) == 0;*/
return true;
} }
/** /**
@ -393,7 +389,7 @@ namespace OliviaAddInPro.Model
*/ */
public static void OpenManual() public static void OpenManual()
{ {
//string[] archivos = null; string[] archivos = null;
try try
{ {
@ -433,7 +429,6 @@ 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;
@ -445,7 +440,6 @@ 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;
@ -499,7 +493,6 @@ 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;
@ -627,16 +620,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 = "_vel"; ComunDef.CamposNW.cons_kph = c.cons_kph;
ComunDef.CamposNW.cons_fow = "_peat"; ComunDef.CamposNW.cons_fow = c.cons_fow;
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,7 +91,6 @@ 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,13 +405,9 @@ namespace OliviaAddInPro.Model
int n, i_def, icar, iveh; int n, i_def, icar, iveh;
//Rellena las opciones de carga máxima por vehículo //Rellena las opciones de carga máxima por vehículo
//////////////////////////////////////////////////
//Carga Trasera
////////////////////////////////////////////////
//Trasera-satelite //Trasera-satelite
n = 4; n = 4;
i_def = 2; i_def = 2;
//Rellena volumenes
info[0] = 2; info[0] = 2;
info[1] = 3; info[1] = 3;
info[2] = 5; info[2] = 5;
@ -429,7 +425,6 @@ namespace OliviaAddInPro.Model
//Trasera-2 ejes //Trasera-2 ejes
n = 6; n = 6;
i_def = 2; i_def = 2;
//Rellena volumenes
info[0] = 8; info[0] = 8;
info[1] = 10; info[1] = 10;
info[2] = 12; info[2] = 12;
@ -452,7 +447,6 @@ 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;
@ -460,9 +454,6 @@ namespace OliviaAddInPro.Model
rellena_carg((int)RecogidaDef.TiposCarga.Trasera, rellena_carg((int)RecogidaDef.TiposCarga.Trasera,
(int)RecogidaDef.TiposVehic.Ejes3, n, i_def, info); (int)RecogidaDef.TiposVehic.Ejes3, n, i_def, info);
//////////////////////////////////////////////////
//Carga Lateral
////////////////////////////////////////////////
//Lateral-satelite, no hay //Lateral-satelite, no hay
rellena_carg((int)RecogidaDef.TiposCarga.Lateral, rellena_carg((int)RecogidaDef.TiposCarga.Lateral,
(int)RecogidaDef.TiposVehic.Satelite, 0, 0, null); (int)RecogidaDef.TiposVehic.Satelite, 0, 0, null);
@ -470,7 +461,6 @@ 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,
@ -486,7 +476,6 @@ namespace OliviaAddInPro.Model
//Lateral - 3 ejes //Lateral - 3 ejes
n = 3; n = 3;
i_def = 2; i_def = 2;
//Rellena volumenes
info[0] = 21; info[0] = 21;
info[1] = 23; info[1] = 23;
info[2] = 26; info[2] = 26;
@ -497,13 +486,9 @@ namespace OliviaAddInPro.Model
rellena_carg((int)RecogidaDef.TiposCarga.Superior, rellena_carg((int)RecogidaDef.TiposCarga.Superior,
(int)RecogidaDef.TiposVehic.Satelite, 0, 0, null); (int)RecogidaDef.TiposVehic.Satelite, 0, 0, null);
//////////////////////////////////////////////////
//Carga Superior
////////////////////////////////////////////////
//Superior - 2 ejes //Superior - 2 ejes
n = 2; n = 2;
i_def = 0; i_def = 0;
//Rellena volumenes
info[0] = 16; info[0] = 16;
info[1] = 17; info[1] = 17;
rellena_carg((int)RecogidaDef.TiposCarga.Superior, rellena_carg((int)RecogidaDef.TiposCarga.Superior,
@ -512,7 +497,6 @@ namespace OliviaAddInPro.Model
//Superior - 3 ejes //Superior - 3 ejes
n = 3; n = 3;
i_def = 2; i_def = 2;
//Rellena volumenes
info[0] = 20; info[0] = 20;
info[1] = 23; info[1] = 23;
info[2] = 25; info[2] = 25;
@ -523,9 +507,47 @@ namespace OliviaAddInPro.Model
rellena_carg((int)RecogidaDef.TiposCarga.Bilateral, rellena_carg((int)RecogidaDef.TiposCarga.Bilateral,
(int)RecogidaDef.TiposVehic.Satelite, 0, 0, null); (int)RecogidaDef.TiposVehic.Satelite, 0, 0, null);
////////////////////////////////////////////////// //Bilateral - 2 ejes
//Carga Bilateral n = 3;
//////////////////////////////////////////////// i_def = 1;
info[0] = 14;
info[1] = 16;
info[2] = 18;
rellena_carg((int)RecogidaDef.TiposCarga.Bilateral,
(int)RecogidaDef.TiposVehic.Ejes2, n, i_def, info);
//Bilateral - 3 ejes
n = 3;
i_def = 1;
info[0] = 20;
info[1] = 23;
info[2] = 26;
rellena_carg((int)RecogidaDef.TiposCarga.Bilateral,
(int)RecogidaDef.TiposVehic.Ejes3, n, i_def, info);
//Bolseo - todas, no hay
//Lavado - todas, no hay
//Otra - todas, no hay
for (icar = (int)RecogidaDef.TiposCarga.BolseoPtaPta; icar < (int)RecogidaDef.TiposCarga.N; icar++)
{
for (iveh = (int)RecogidaDef.TiposVehic.Ejes3; iveh < (int)RecogidaDef.TiposVehic.N; iveh++)
{
rellena_carg(icar, iveh, 0, 0, null);
}
}
////////////////////////////////////////////////////////
//Barcelona new
rellena_offsets_bcn();
}
private static void rellena_offsets_bcn()
{
int[] info = new int[10];
int n, i_def;
////////////////////////////////////////////////////////
//Barcelona new
//Bilateral - satelite //Bilateral - satelite
n = 1; n = 1;
i_def = 0; i_def = 0;
@ -555,50 +577,6 @@ namespace OliviaAddInPro.Model
info[0] = -2050; info[0] = -2050;
rellena_carg_offset((int)RecogidaDef.TiposCarga.Bilateral, rellena_carg_offset((int)RecogidaDef.TiposCarga.Bilateral,
(int)RecogidaDef.TiposVehic.Satelite, (int)RecogidaDef.TiposFracción.Vidrio, n, info); (int)RecogidaDef.TiposVehic.Satelite, (int)RecogidaDef.TiposFracción.Vidrio, n, info);
//Bilateral - 2 ejes
n = 3;
i_def = 1;
//Rellena volumenes
info[0] = 14;
info[1] = 16;
info[2] = 18;
rellena_carg((int)RecogidaDef.TiposCarga.Bilateral,
(int)RecogidaDef.TiposVehic.Ejes2, n, i_def, info);
//Bilateral - 3 ejes
n = 3;
i_def = 1;
//Rellena volumenes
info[0] = 20;
info[1] = 23;
info[2] = 26;
rellena_carg((int)RecogidaDef.TiposCarga.Bilateral,
(int)RecogidaDef.TiposVehic.Ejes3, n, i_def, info);
//Bolseo - todas, no hay
//Lavado - todas, no hay
//Otra - todas, no hay
for (icar = (int)RecogidaDef.TiposCarga.BolseoPtaPta; icar < (int)RecogidaDef.TiposCarga.N; icar++)
{
for (iveh = (int)RecogidaDef.TiposVehic.Ejes3; iveh < (int)RecogidaDef.TiposVehic.N; iveh++)
{
rellena_carg(icar, iveh, 0, 0, null);
}
}
////////////////////////////////////////////////////////
//Rellena offsets
rellena_offsets_bcn();
}
private static void rellena_offsets_bcn()
{
int[] info = new int[10];
int n, i_def;
////////////////////////////////////////////////////////
//Barcelona revisado abril 24
//////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////
//Trasera - satélite - organico, resto //Trasera - satélite - organico, resto
@ -836,15 +814,22 @@ namespace OliviaAddInPro.Model
//Bilateral - 2 ejes - vidrio //Bilateral - 2 ejes - vidrio
rellena_carg_offset((int)RecogidaDef.TiposCarga.Superior, rellena_carg_offset((int)RecogidaDef.TiposCarga.Superior,
(int)RecogidaDef.TiposVehic.Ejes3, (int)RecogidaDef.TiposFracción.Vidrio, n, info); (int)RecogidaDef.TiposVehic.Ejes3, (int)RecogidaDef.TiposFracción.Vidrio, n, info);
//Bilateral - 2 ejes - papel //Bilateral - 2 ejes - papel
info[0] = 1540; info[0] = 1820;
info[1] = 1760; info[1] = 2080;
info[2] = 1980; info[2] = 2340;
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,19 +25,10 @@ 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
*/ */
@ -54,7 +45,6 @@ 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 2024")] [assembly: AssemblyCopyright("Copyright © VSM 2023")]
[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("4.0.0.0")] [assembly: AssemblyVersion("3.2.0.0")]
[assembly: AssemblyFileVersion("4.0.0.0")] [assembly: AssemblyFileVersion("3.2.0.0")]

View File

@ -7,7 +7,6 @@ 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
{ {
@ -16,10 +15,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_4_0"; public const string OlvRegKey = "SOFTWARE\\Narvaling\\Olivia_3_1";
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.0";
public static ConfigServ Serv public static ConfigServ Serv
{ {
get { get {
@ -42,12 +41,11 @@ namespace OliviaAddInPro.Services
var ee = e; var ee = e;
res = null; res = null;
} }
if(res==null || res.Version==null || res.Version != VersionConfiguracion) if(res==null)
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;
@ -170,8 +168,8 @@ 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";
@ -309,7 +307,7 @@ namespace OliviaAddInPro.Services
c.v_desp_LS=0; c.v_desp_LS=0;
//Reco //Reco
c.id= "_ID"; c.id= "ID";
c.nomrec= "NOMB_TIP_REC"; c.nomrec= "NOMB_TIP_REC";
c.lateralidad= "LATERALIDAD"; c.lateralidad= "LATERALIDAD";
c.frac= "FRACCION"; c.frac= "FRACCION";
@ -354,13 +352,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=360; c.dens_vehi_pap=250;
c.dens_vehi_vid=350; c.dens_vehi_vid=350;
c.dens_vehi_otr=100; c.dens_vehi_otr=100;
c.dens_cont_org=200; c.dens_cont_org=150;
c.dens_cont_res=100; c.dens_cont_res=100;
c.dens_cont_env=28; c.dens_cont_env=28;
c.dens_cont_pap=75; c.dens_cont_pap=90;
c.dens_cont_vid=250; c.dens_cont_vid=250;
c.dens_cont_otr=100; c.dens_cont_otr=100;
c.anch_vehi_3=2.4000000; c.anch_vehi_3=2.4000000;
@ -398,87 +396,7 @@ 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
}) ;
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
});
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
});
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
});
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
});
return c; return c;
} }
} }

View File

@ -11,7 +11,6 @@ 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
{ {
@ -29,7 +28,6 @@ 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";
@ -44,10 +42,9 @@ 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;
@ -62,7 +59,6 @@ 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;
@ -74,7 +70,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, o bien han cambiado los datos configurados"; ErrStr = "En la capa de ámbitos seleccionada no se encuentran columnas de SECTOR y/o SECUENCIA, necesarias para planificar";
return false; return false;
} }
if (com.ProgrSrc._ProgrSrc.Getcancelled()) if (com.ProgrSrc._ProgrSrc.Getcancelled())
@ -145,18 +141,9 @@ namespace OliviaAddInPro.Services
ErrStr = Resource1.String_cancel_progreso; ErrStr = Resource1.String_cancel_progreso;
return false; return false;
} }
//mira spatialreference de los datos de entrada //mira spatialreference de los datos de entrada
spatref = HelperGdb.GetSpatRefSync(com.CapaElemsRef); spatRefData = geom_export.SpatialReference;
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)
@ -182,7 +169,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, spatref, 50)) if (!HelperGdb.ExportShp2(com.CapaElems, filtroEspacial, com.NombreShpExport, OliviaGlob.Paths.DirData, com.ProgrSrc._ProgrSrc, null, 50))
{ {
ErrStr = "Error al exportar los ámbitos: " + HelperGdb.OutStr; ErrStr = "Error al exportar los ámbitos: " + HelperGdb.OutStr;
return false; return false;
@ -196,7 +183,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, null)) if(!ComprCreaColOid(OliviaGlob.Paths.PathData, com.CapaElems, filtroEspacial))
{ {
ErrStr = "Error al exportar columna " + ComunDef.CamposCom.camp_oid; ErrStr = "Error al exportar columna " + ComunDef.CamposCom.camp_oid;
return false; return false;
@ -263,7 +250,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 || geom_export.IsEmpty) if (geom_export == null)
{ {
ErrStr = "Error al añadir buffer a la geometría"; ErrStr = "Error al añadir buffer a la geometría";
return false; return false;
@ -348,24 +335,20 @@ 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; ///
if (!String.IsNullOrEmpty(ComunDef.configMV.filtro_omitir)) //Hace el filtro con la geometría final
{ 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
@ -373,54 +356,17 @@ 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, spatref,100)) if (!HelperGdb.ExportShp2(OliviaGlob.Paths.PathGdbNw, filtroEspacial, com.NombreShpExportNw, OliviaGlob.Paths.DirData, com.ProgrSrc._ProgrSrc, spatRefData,100))
{ {
ErrStr = "Error al exportar la red navegable: " + HelperGdb.OutStr; 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)
@ -430,101 +376,6 @@ 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
*/ */
@ -665,7 +516,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=null) public bool ComprCreaColOid(string pathCapa, string pathCapaOrig, SpatialQueryFilter filter)
{ {
//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);
@ -684,7 +535,6 @@ 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);
@ -693,32 +543,23 @@ 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;
@ -762,7 +603,7 @@ namespace OliviaAddInPro.Services
{ {
return false; return false;
} }
//return true; return true;
} }
} }
} }
@ -770,48 +611,6 @@ 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;
@ -1205,7 +1004,7 @@ namespace OliviaAddInPro.Services
} }
} }
resp2 = HelperGdb.ImportShp(dir_shp + "\\" + noms_shp[i] + HelperGdb.SHP_EXT, GdbFileName + "\\" + dataset, noms_gdb[i], spatRefData); resp2 = HelperGdb.ImportShp(dir_shp + "\\" + noms_shp[i] + HelperGdb.SHP_EXT, GdbFileName + "\\" + dataset, noms_gdb[i]);
if (!resp2.Value) if (!resp2.Value)
{ {
err_st = "Error al importar la capa " + noms_gdb[i]; err_st = "Error al importar la capa " + noms_gdb[i];
@ -1259,11 +1058,6 @@ 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

@ -162,7 +162,7 @@ namespace OliviaAddInPro.Services
public static void BorraFiles() public static void BorraFiles()
{ {
string[] list = null; string[] list = null;
string capa_principal, capa_principal_nw, capa_principal_nw_c; string capa_principal, capa_principal_nw;
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
@ -170,11 +170,8 @@ namespace OliviaAddInPro.Services
if (!string.IsNullOrEmpty(OliviaGlob.Paths.PathNW)) if (!string.IsNullOrEmpty(OliviaGlob.Paths.PathNW))
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))
@ -203,19 +200,6 @@ 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)
{ {
@ -234,7 +218,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

@ -80,10 +80,6 @@ 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,7 +61,6 @@ 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 + " " +
@ -70,13 +69,11 @@ 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

@ -91,10 +91,6 @@ 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,12 +2,10 @@
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;
@ -33,15 +31,6 @@ 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
@ -84,7 +73,7 @@ namespace OliviaAddInPro.Services
{ {
nombFileAmbs = string.Empty; nombFileAmbs = string.Empty;
limp.ConsultaAmbs = DameAmbsConsulta(out nombFileAmbs); limp.ConsultaAmbs = DameAmbsConsulta(out nombFileAmbs);
if (null==limp.ConsultaAmbs) if (string.IsNullOrEmpty(limp.ConsultaAmbs))
{ {
return false; return false;
} }
@ -116,44 +105,7 @@ 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
*/ */
@ -200,7 +152,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;
@ -216,8 +168,10 @@ 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,15 +70,7 @@ 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

@ -1,14 +0,0 @@
<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

@ -1,65 +0,0 @@
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,30,0,0"> <Grid Margin="0,10,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,0,0" Click="button_planif_Click"/> <Button x:Name="button_planif" Grid.Column="2" Style="{DynamicResource Esri_Button}" Content="Planificar" Margin="10,0,10,0" Click="button_planif_Click"/>
</Grid> </Grid>
</StackPanel> </StackPanel>
</ContentPresenter.Content> </ContentPresenter.Content>
</ContentPresenter> </ContentPresenter>
</StackPanel> </StackPanel>
<StackPanel Grid.Row="3" Margin="0,90,10,0"> <StackPanel Grid.Row="3" Margin="0,70,10,0">
<Button x:Name="button_help" Content="" Margin="274,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Width="16" Height="16" BorderThickness="0" RenderTransformOrigin="16.875,0.375" Click="button_help_Click"> <Button 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,12 +32,8 @@
<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="Modos de viaje" HorizontalAlignment="Left" Margin="15,0,0,0" VerticalAlignment="Top" FontWeight="DemiBold"/> <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_mv" IsEnabled="{Binding Path=CapaAbierta, Mode = TwoWay}" ItemsSource="{Binding Path=TiposMv, Mode = TwoWay}" HorizontalAlignment="Left" Margin="20,0,0,0" <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_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,20 +80,7 @@ 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="422" mc:Ignorable="d" d:DesignWidth="300" Height="390"
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>
@ -94,10 +94,6 @@
<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,0,3" TextWrapping="NoWrap" Text="{Binding Path=TextKgCapac, Mode = TwoWay}" TextAlignment="Right" MaxLength="8" PreviewTextInput="txtBox_kgCapac_PreviewTextInput"/>
<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="0,-1,0,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

@ -110,20 +110,7 @@ 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,7 +27,6 @@ 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>>();
@ -115,27 +114,7 @@ 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; }
@ -220,8 +199,6 @@ 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
@ -268,32 +245,23 @@ 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) */
return; public void ComboTtoSel(int tto)
TipoMv = tto;
}
/**
* Realiza los cambios en los ámbitos cuando se ha seleccionado un tratamiento
*/
public void ComboTtoSel(int tto)
{ {
if (tto < 0 || tto== tipoTto_old) if (tto < 0)
return; 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,7 +80,6 @@ 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)
{ {
@ -93,8 +92,6 @@ 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,31 +47,6 @@ 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
{ {
@ -123,7 +98,6 @@ 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; }
@ -134,7 +108,6 @@ 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; }
@ -145,7 +118,6 @@ 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; }
@ -156,7 +128,6 @@ 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; }
@ -167,7 +138,6 @@ 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; }
@ -291,7 +261,6 @@ 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
@ -440,7 +409,7 @@ namespace OliviaAddInPro
*/ */
public bool ComboFracSel(int tto) public bool ComboFracSel(int tto)
{ {
if (tto < 0 || tto== tipoFrac_old) if (tto < 0)
return false; return false;
if (!tipos_fracc_bool[tto]) if (!tipos_fracc_bool[tto])
{ {
@ -450,8 +419,7 @@ namespace OliviaAddInPro
try try
{ {
//cuando se selecciona un item pintado en gris (que no existe en la GDB) se actúa como si no se hubiera seleccionado item //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
@ -554,7 +522,7 @@ namespace OliviaAddInPro
public bool ComboCargSel(int tto) public bool ComboCargSel(int tto)
{ {
VisCombLate = Visibility.Hidden; VisCombLate = Visibility.Hidden;
if (tto < 0 || tto== tipoCarg_old) if (tto < 0)
return false; return false;
if (!tipos_carg_bool[tto]) if (!tipos_carg_bool[tto])
{ {
@ -563,9 +531,7 @@ 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;
else else
@ -605,25 +571,16 @@ 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)
{ {
@ -642,7 +599,6 @@ namespace OliviaAddInPro
try try
{ {
TipoCapac = tto; TipoCapac = tto;
tipoCapac_old = tto;
rellena_kgmax(); rellena_kgmax();
} }
catch (Exception) catch (Exception)
@ -656,12 +612,11 @@ namespace OliviaAddInPro
*/ */
public void ComboLatSel(int tto) public void ComboLatSel(int tto)
{ {
if (tto < 0 || tto== tipoLate_old) if (tto < 0)
return; return;
try try
{ {
TipoLate = tto; TipoLate = tto;
tipoLate_old = tto;
} }
catch (Exception) catch (Exception)
{ {

View File

@ -104,8 +104,7 @@ namespace OliviaAddInPro
err_str = "No se ha seleccionado ninguna Capa de Limpieza"; err_str = "No se ha seleccionado ninguna Capa de Limpieza";
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)
@ -113,7 +112,6 @@ 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];