Correccion de errores
parent
3f57544e9d
commit
a225a6b8af
|
|
@ -30,13 +30,13 @@ namespace OliviaAddInPro
|
|||
if (OliviaGlob.TipoView == TiposEjecucion.Ninguno)
|
||||
{
|
||||
///Comprueba que existe la red navegable configurada
|
||||
/*if (!OliviaGlob.CompruebaNwYCampos())
|
||||
if (!OliviaGlob.CompruebaNwYCampos())
|
||||
{
|
||||
HelperGlobal.ponMsg("No se encuentra red navegable, cambie Configuración: " + HelperGdb.OutStr,
|
||||
System.Windows.MessageBoxImage.Warning);
|
||||
}
|
||||
else
|
||||
{*/
|
||||
{
|
||||
OliviaGlob.SetFlagTipEjec(TiposEjecucion.Limp);
|
||||
OliviaGlob.ViewSetFlagTipEjec(TiposEjecucion.Limp);
|
||||
|
||||
|
|
@ -44,7 +44,7 @@ namespace OliviaAddInPro
|
|||
OliviaGlob.Limp = new Limpieza();
|
||||
DockpaneLimpiezaViewModel.Reset();
|
||||
DockpaneLimpiezaViewModel.Show();
|
||||
//}
|
||||
}
|
||||
}
|
||||
else if(OliviaGlob.ViewIsProps())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -28,13 +28,13 @@ namespace OliviaAddInPro
|
|||
if (OliviaGlob.TipoView == TiposEjecucion.Ninguno)
|
||||
{
|
||||
///Comprueba que existe la red navegable configurada
|
||||
/*if (!OliviaGlob.CompruebaNwYCampos())
|
||||
if (!OliviaGlob.CompruebaNwYCampos())
|
||||
{
|
||||
HelperGlobal.ponMsg("No se encuentra red navegable, cambie Configuración: " + HelperGdb.OutStr,
|
||||
System.Windows.MessageBoxImage.Warning);
|
||||
}
|
||||
else
|
||||
{*/
|
||||
{
|
||||
OliviaGlob.SetFlagTipEjec(TiposEjecucion.Reco);
|
||||
OliviaGlob.ViewSetFlagTipEjec(TiposEjecucion.Reco);
|
||||
|
||||
|
|
@ -42,7 +42,7 @@ namespace OliviaAddInPro
|
|||
OliviaGlob.Reco = new Recogida();
|
||||
DockpaneRecogidaViewModel.Reset();
|
||||
DockpaneRecogidaViewModel.Show();
|
||||
//}
|
||||
}
|
||||
}
|
||||
else if (OliviaGlob.ViewIsProps())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ArcGIS defaultAssembly="OliviaAddInPro.dll" defaultNamespace="OliviaAddInPro" xmlns="http://schemas.esri.com/DADF/Registry" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schemas.esri.com/DADF/Registry file:///C:/Program%20Files/ArcGIS/Pro/bin/ArcGIS.Desktop.Framework.xsd">
|
||||
<AddInInfo id="{10742570-cf59-42f2-bea2-2a38002a06ee}" version="3.4" desktopVersion="3.0.3.36057">
|
||||
<AddInInfo id="{10742570-cf59-42f2-bea2-2a38002a06ee}" version="4.0" desktopVersion="3.0.3.36057">
|
||||
<Name>OliviaAddInPro</Name>
|
||||
<Description>AddIn de Optimización de la Limpieza Viaria para ArcGIs Pro</Description>
|
||||
<Image>Images\AddinDesktop32.png</Image>
|
||||
<Author>VSM</Author>
|
||||
<Company>VSM - Narvaling</Company>
|
||||
<Date>27/11/2023 12:00:00, 2023</Date>
|
||||
<Date>10/04/2024 12:00:00, 2024</Date>
|
||||
<Subject>Framework</Subject>
|
||||
<!-- Note subject can be one or more of these topics:
|
||||
Content, Framework, Editing, Geodatabase, Geometry, Geoprocessing, Layouts, Map Authoring, Map Exploration -->
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ using ArcGIS.Core.Data.Exceptions;
|
|||
using Microsoft.Win32;
|
||||
using Microsoft.WindowsAPICodePack.Dialogs;
|
||||
using System.Security.Cryptography;
|
||||
using ArcGIS.Desktop.Internal.Mapping;
|
||||
|
||||
namespace OliviaAddInPro.Helper
|
||||
{
|
||||
|
|
@ -706,7 +707,7 @@ namespace OliviaAddInPro.Helper
|
|||
{
|
||||
if (filt == null)
|
||||
filt = new ArcGIS.Core.Data.QueryFilter();
|
||||
sel = fc.Select(filt, SelectionType.ObjectID, SelectionOption.Normal);
|
||||
sel = fc.Select(filt, ArcGIS.Core.Data.SelectionType.ObjectID, SelectionOption.Normal);
|
||||
long nsel = sel.GetCount();
|
||||
IReadOnlyList<long> ids_ = sel.GetObjectIDs();
|
||||
ids = ids_.ToList();
|
||||
|
|
@ -737,7 +738,7 @@ namespace OliviaAddInPro.Helper
|
|||
{
|
||||
if (filt == null)
|
||||
filt = new ArcGIS.Core.Data.QueryFilter();
|
||||
sel = fc.Select(filt, SelectionType.ObjectID, SelectionOption.Normal);
|
||||
sel = fc.Select(filt, ArcGIS.Core.Data.SelectionType.ObjectID, SelectionOption.Normal);
|
||||
var nsel = sel.GetCount();
|
||||
IReadOnlyList<long> ids_ = sel.GetObjectIDs();
|
||||
ids = ids_.ToList();
|
||||
|
|
@ -1183,6 +1184,16 @@ namespace OliviaAddInPro.Helper
|
|||
geomIni = GeometryEngine.Instance.ConvexHull(geomIni);
|
||||
return geomIni;
|
||||
}
|
||||
public static ArcGIS.Core.Geometry.Geometry GetGeomUnique(String path, ArcGIS.Core.Data.QueryFilter filtro)
|
||||
{
|
||||
FeatureClass fc = GetFtClassSync(path);
|
||||
if (fc == null)
|
||||
{
|
||||
OutStr = "Error al abrir Feature Class:" + path;
|
||||
return null; ;
|
||||
}
|
||||
return GetGeomUnique(fc, filtro);
|
||||
}
|
||||
/*
|
||||
* A partir de una capa recorre todos los elementos que cumplen el filtro y los une en una única geometría
|
||||
*/
|
||||
|
|
@ -1194,6 +1205,7 @@ namespace OliviaAddInPro.Helper
|
|||
try
|
||||
{
|
||||
var geom = new List<ArcGIS.Core.Geometry.Geometry>();
|
||||
|
||||
using (RowCursor rowCursor = fclss.Search(filtro))
|
||||
{
|
||||
|
||||
|
|
@ -1202,7 +1214,10 @@ namespace OliviaAddInPro.Helper
|
|||
using (Row row = rowCursor.Current)
|
||||
{
|
||||
if (row is Feature ft)
|
||||
geom.Add(ft.GetShape());
|
||||
{
|
||||
geom.Add(ft.GetShape());
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
geomsal = GeometryEngine.Instance.Union(geom);
|
||||
|
|
@ -1343,7 +1358,7 @@ namespace OliviaAddInPro.Helper
|
|||
//realiza consulta
|
||||
n = 0;
|
||||
//fc.GetDefinition().GetFields().First().Name kfadpskfpasp
|
||||
using (Selection sel = fc.Select(new ArcGIS.Core.Data.QueryFilter { WhereClause = consulta }, SelectionType.ObjectID, SelectionOption.Normal))
|
||||
using (Selection sel = fc.Select(new ArcGIS.Core.Data.QueryFilter { WhereClause = consulta }, ArcGIS.Core.Data.SelectionType.ObjectID, SelectionOption.Normal))
|
||||
n = sel.GetCount();
|
||||
}
|
||||
}
|
||||
|
|
@ -1374,7 +1389,7 @@ namespace OliviaAddInPro.Helper
|
|||
{
|
||||
//realiza consulta
|
||||
n = 0;
|
||||
using (Selection sel = fc.Select(new ArcGIS.Core.Data.QueryFilter { WhereClause = consulta }, SelectionType.ObjectID, SelectionOption.Normal))
|
||||
using (Selection sel = fc.Select(new ArcGIS.Core.Data.QueryFilter { WhereClause = consulta }, ArcGIS.Core.Data.SelectionType.ObjectID, SelectionOption.Normal))
|
||||
n = sel.GetCount();
|
||||
}
|
||||
}
|
||||
|
|
@ -1464,10 +1479,13 @@ namespace OliviaAddInPro.Helper
|
|||
if (debug)
|
||||
HelperGlobal.ponMsg("fc " + fc.GetName() + " tipo " + fc.GetType().Name);
|
||||
/////////////////////////////////////////////////////////
|
||||
/////TODO comprobar que el object id no está indexado en la capa de nw, cómo hacerlo indexado
|
||||
///https://pro.arcgis.com/en/pro-app/3.0/tool-reference/data-management/add-attribute-index.htm
|
||||
///
|
||||
//Añade a la lista los ids que cumplen el filtro espacial
|
||||
try
|
||||
{
|
||||
var aux = fc.Select(filter, SelectionType.ObjectID, SelectionOption.Normal);
|
||||
var aux = fc.Select(filter, ArcGIS.Core.Data.SelectionType.ObjectID, SelectionOption.Normal);
|
||||
var aux2 = aux.GetObjectIDs();
|
||||
//ids = fc.Select(filter, SelectionType.ObjectID, SelectionOption.Normal).GetObjectIDs().ToList();
|
||||
ids = aux2.ToList();
|
||||
|
|
@ -1750,11 +1768,49 @@ namespace OliviaAddInPro.Helper
|
|||
ArcGIS.Core.Geometry.Geometry geomBuff = null;
|
||||
try
|
||||
{
|
||||
geomBuff = GeometryEngine.Instance.Buffer(geom, buffer);
|
||||
//GeometryEngine.Instance.Buffer(geom.)
|
||||
//geomBuff= GeometryEngine.Instance.ConvexHull(geom);
|
||||
//convierte las unidades del buffer a las unidades de la geometría
|
||||
double buff_aux = buffer;
|
||||
//comprueba que la geometría tenga unidades de metros para aplicar el buffer
|
||||
if (geom.SpatialReference.Unit.FactoryCode != (int)ArcGIS.Core.Geometry.UnitTypeCode.Meters)
|
||||
{
|
||||
switch (geom.SpatialReference.Unit.FactoryCode)
|
||||
{
|
||||
case (int)ArcGIS.Core.Geometry.UnitTypeCode.Degrees://9102
|
||||
//360º = 40.075 km
|
||||
buff_aux = 360 * buffer / 40075000;
|
||||
break;
|
||||
case (int)ArcGIS.Core.Geometry.UnitTypeCode.Radians:
|
||||
//2pi
|
||||
buff_aux = 2 * Math.PI * buffer / 40075000;
|
||||
break;
|
||||
default:
|
||||
if (geom.SpatialReference.Unit.UnitType == ArcGIS.Core.Geometry.UnitType.Linear)
|
||||
{
|
||||
//es de tipo lineal pero otras unidades que no son metros
|
||||
buff_aux = ArcGIS.Core.Geometry.LinearUnit.Meters.ConvertTo(buffer, (ArcGIS.Core.Geometry.LinearUnit)geom.SpatialReference.Unit);
|
||||
}
|
||||
else
|
||||
{
|
||||
resp.Error = new List<string>();
|
||||
resp.Error.Add("Error al aplicar buffer, la geometría del polígono de entrada es de tipo " + geom.SpatialReference.Unit.Name);
|
||||
geomBuff = null;
|
||||
buff_aux = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(resp.Error.IsNullOrEmpty())
|
||||
geomBuff = GeometryEngine.Instance.Buffer(geom, buff_aux);
|
||||
}
|
||||
catch
|
||||
catch( Exception e)
|
||||
{
|
||||
|
||||
//resp.HasError = true;
|
||||
if (resp.Error.IsNullOrEmpty())
|
||||
resp.Error = new List<string>();
|
||||
resp.Error.Add(e.Message);
|
||||
return resp;
|
||||
}
|
||||
resp.Value = geomBuff;
|
||||
return resp;
|
||||
|
|
@ -1799,7 +1855,7 @@ namespace OliviaAddInPro.Helper
|
|||
}
|
||||
while (repite);*/
|
||||
buffer = buff;
|
||||
geom_pto = GeometryEngine.Instance.Buffer(pto.ToMapPoint(), buffer);
|
||||
geom_pto = HelperGdb.BufferGeom((ArcGIS.Core.Geometry.Geometry)pto.ToMapPoint(geom.SpatialReference),buffer).Value; //GeometryEngine.Instance.Buffer(pto.ToMapPoint(), buffer);
|
||||
if (geom_pto == null || geom_pto.IsEmpty)
|
||||
{
|
||||
resp.Value = null;
|
||||
|
|
|
|||
|
|
@ -51,9 +51,9 @@ namespace OliviaAddInPro.Model
|
|||
public enum OpsNW
|
||||
{
|
||||
|
||||
nw_0,
|
||||
nw_1,
|
||||
nw_2,
|
||||
nw_0, //TomTom
|
||||
nw_1, //Streetmap
|
||||
nw_2, //
|
||||
nw_3,
|
||||
nw_4,
|
||||
|
||||
|
|
|
|||
|
|
@ -275,7 +275,7 @@ namespace OliviaAddInPro.Model
|
|||
if (ft == null)
|
||||
return false;
|
||||
HelperGdb.Free(ft);
|
||||
int NCAMPS = 5;
|
||||
/*int NCAMPS = 5;
|
||||
string[] camps;
|
||||
camps = new string[NCAMPS];
|
||||
camps[0] = ComunDef.CamposNW.cons_onewFT;
|
||||
|
|
@ -283,7 +283,8 @@ namespace OliviaAddInPro.Model
|
|||
camps[2] = ComunDef.CamposNW.cons_kph;
|
||||
camps[3] = ComunDef.CamposNW.cons_name;
|
||||
camps[4] = ComunDef.CamposNW.cons_fow;
|
||||
return HelperGdb.CheckFileds(OliviaGlob.Paths.PathGdbNw, camps) == 0;
|
||||
return HelperGdb.CheckFileds(OliviaGlob.Paths.PathGdbNw, camps) == 0;*/
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -28,11 +28,16 @@ namespace OliviaAddInPro.Model
|
|||
/**
|
||||
* Tipo modo de viaje
|
||||
*/
|
||||
public int TipoMV { get; set; } = 1;
|
||||
public int TipoMV { get; set; } = -1;
|
||||
/**
|
||||
* Capa de ámbitos
|
||||
*/
|
||||
public string CapaElems { get; set; } = string.Empty;
|
||||
/**
|
||||
* Capa de ámbitos de referencia.
|
||||
* Cuando se hace tratamiento con ejes de calle, se guarda la capa de referencia
|
||||
*/
|
||||
public string CapaElemsRef { get; set; } = string.Empty;
|
||||
/**
|
||||
* Capa de ámbitos después de haber planificado
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
|
|||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("VSM - Narvaling")]
|
||||
[assembly: AssemblyProduct("OliviaAddInPro")]
|
||||
[assembly: AssemblyCopyright("Copyright © VSM 2023")]
|
||||
[assembly: AssemblyCopyright("Copyright © VSM 2024")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
|
|
@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
|||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("3.2.0.0")]
|
||||
[assembly: AssemblyFileVersion("3.2.0.0")]
|
||||
[assembly: AssemblyVersion("4.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("4.0.0.0")]
|
||||
|
|
|
|||
|
|
@ -309,7 +309,7 @@ namespace OliviaAddInPro.Services
|
|||
c.v_desp_LS=0;
|
||||
|
||||
//Reco
|
||||
c.id= "ID";
|
||||
c.id= "_ID";
|
||||
c.nomrec= "NOMB_TIP_REC";
|
||||
c.lateralidad= "LATERALIDAD";
|
||||
c.frac= "FRACCION";
|
||||
|
|
@ -398,16 +398,16 @@ namespace OliviaAddInPro.Services
|
|||
c.Giro_max_vehiculo = 175.0000000;
|
||||
c.Desv_max = 0.1500000;
|
||||
c.Desv_max_abs = 1800.0000000;
|
||||
c.Tipo_eje_via = OpsNW.nw_1;
|
||||
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.ONEWAY == 'N', 1, 0)",
|
||||
campo_sentidoFT = "IIF($feature.ONEWAY== 'FT' || $feature.ONEWAY == '', 1 , 0)",
|
||||
campo_sentidoTf = "IIF($feature.ONEWAY == 'TF' || $feature.ONEWAY == '', 1, 0)",
|
||||
campo_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,
|
||||
|
|
@ -416,6 +416,7 @@ namespace OliviaAddInPro.Services
|
|||
revisa_angulos = false,
|
||||
campo_angulos = "0"
|
||||
}); ;
|
||||
/*
|
||||
c.ListaNw.Add(new OliviaConfNW()
|
||||
{
|
||||
nombre = "StreetMapPremiun",
|
||||
|
|
@ -432,40 +433,50 @@ namespace OliviaAddInPro.Services
|
|||
revisa_angulos = true,
|
||||
campo_angulos = "IIF($feature.ROAD_CLASS== '3 - Highway Ramp' || $feature.ROAD_CLASS== '6 - Major Road' || $feature.ROAD_CLASS == '1 - Surface Street', 90 , 0)"
|
||||
});
|
||||
*/
|
||||
c.ListaMV = new List<OliviaConfMV>();
|
||||
c.ListaMV.Add(new OliviaConfMV()
|
||||
{
|
||||
nombre = "Default",
|
||||
filtro_omitir = "",
|
||||
campo_prioridad = "0"
|
||||
|
||||
});
|
||||
campo_prioridad = "0",
|
||||
vehiculo_def_reco = -1,
|
||||
vehiculo_def_lim = -1
|
||||
}) ;
|
||||
c.ListaMV.Add(new OliviaConfMV()
|
||||
{
|
||||
nombre = "Peaton",
|
||||
filtro_omitir = "",
|
||||
campo_prioridad = "0"
|
||||
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 = "",
|
||||
campo_prioridad = "0"
|
||||
filtro_omitir = "(FREEWAY <> 1 AND SLIPRD = 0)",
|
||||
campo_prioridad = "IIF($feature.PRIVATERD==2 || $feature.RDCOND==2 || ($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 = "",
|
||||
campo_prioridad = "0"
|
||||
filtro_omitir = "(RDCOND <> 2 AND ONEWAY = 'N' AND FOW NOT IN (14, 15, 19))",
|
||||
campo_prioridad = "IIF($feature.PRIVATERD==2 || $feature.RDCOND==3 , -2 , 0)",
|
||||
vehiculo_def_reco = 1,
|
||||
vehiculo_def_lim = -1
|
||||
|
||||
});
|
||||
c.ListaMV.Add(new OliviaConfMV()
|
||||
{
|
||||
nombre = "Vehiculo grande",
|
||||
filtro_omitir = "",
|
||||
campo_prioridad = "0"
|
||||
filtro_omitir = "(RDCOND NOT IN (2, 3) AND ONEWAY = 'N' AND FOW NOT IN (14, 15, 19))",
|
||||
campo_prioridad = "IIF($feature.PRIVATERD==2 , -2 , 0)",
|
||||
vehiculo_def_reco =0,
|
||||
vehiculo_def_lim = -1
|
||||
|
||||
});
|
||||
return c;
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ using ArcGIS.Core.Internal.Data;
|
|||
using ArcGIS.Desktop.Framework.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.IO;
|
||||
using ArcGIS.Core.Data.UtilityNetwork.Trace;
|
||||
|
||||
namespace OliviaAddInPro.Services
|
||||
{
|
||||
|
|
@ -73,7 +74,7 @@ namespace OliviaAddInPro.Services
|
|||
//Comprueba que tiene las columnas necesarias para planificar
|
||||
if ((modo == ModosEjec.Planifica) && !CompruebaPlanif())
|
||||
{
|
||||
ErrStr = "En la capa de ámbitos seleccionada no se encuentran columnas de SECTOR y/o SECUENCIA, necesarias para planificar";
|
||||
ErrStr = "En la capa de ámbitos seleccionada no se encuentran columnas de SECTOR y/o SECUENCIA, necesarias para planificar, o bien han cambiado los datos configurados";
|
||||
return false;
|
||||
}
|
||||
if (com.ProgrSrc._ProgrSrc.Getcancelled())
|
||||
|
|
@ -146,7 +147,16 @@ namespace OliviaAddInPro.Services
|
|||
}
|
||||
//mira spatialreference de los datos de entrada
|
||||
spatRefData = geom_export.SpatialReference;
|
||||
|
||||
spatref = HelperGdb.GetSpatRefSync(com.CapaElemsRef);
|
||||
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
|
||||
filtroEspacial = HelperGdb.CreateFiler(com.ConsultaAmbs, geom_export);
|
||||
if (filtroEspacial == null)
|
||||
|
|
@ -172,7 +182,7 @@ namespace OliviaAddInPro.Services
|
|||
//Guarda el nombre
|
||||
OliviaGlob.Paths.PathData = OliviaGlob.Paths.DirData + com.NombreShpExport;
|
||||
//exporta los datos de entrada
|
||||
if (!HelperGdb.ExportShp2(com.CapaElems, filtroEspacial, com.NombreShpExport, OliviaGlob.Paths.DirData, com.ProgrSrc._ProgrSrc, null, 50))
|
||||
if (!HelperGdb.ExportShp2(com.CapaElems, filtroEspacial, com.NombreShpExport, OliviaGlob.Paths.DirData, com.ProgrSrc._ProgrSrc, spatref, 50))
|
||||
{
|
||||
ErrStr = "Error al exportar los ámbitos: " + HelperGdb.OutStr;
|
||||
return false;
|
||||
|
|
@ -186,7 +196,7 @@ namespace OliviaAddInPro.Services
|
|||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
///Comprueba si está la columna de ObjectId y si no, la crea
|
||||
if(!ComprCreaColOid(OliviaGlob.Paths.PathData, com.CapaElems, filtroEspacial))
|
||||
if(!ComprCreaColOid(OliviaGlob.Paths.PathData, com.CapaElems, null))
|
||||
{
|
||||
ErrStr = "Error al exportar columna " + ComunDef.CamposCom.camp_oid;
|
||||
return false;
|
||||
|
|
@ -338,14 +348,17 @@ namespace OliviaAddInPro.Services
|
|||
//guarda la mima de la geometría de la red navegable a exportar
|
||||
com.MimaNw = geom_export.Extent;
|
||||
//////////////////////////////////////
|
||||
///
|
||||
//Hace el filtro con la geometría final
|
||||
//ComunDef.configMV
|
||||
var where = String.Empty;
|
||||
if (!String.IsNullOrEmpty(ComunDef.configMV.filtro_omitir))
|
||||
{
|
||||
where = ComunDef.configMV.filtro_omitir;
|
||||
}
|
||||
|
||||
if (com.ProgrSrc._ProgrSrc.Getcancelled())
|
||||
{
|
||||
ErrStr = Resource1.String_cancel_progreso;
|
||||
return false;
|
||||
}
|
||||
filtroEspacial = HelperGdb.CreateFiler(where, geom_export);
|
||||
if (filtroEspacial == null)
|
||||
{
|
||||
|
|
@ -353,11 +366,6 @@ namespace OliviaAddInPro.Services
|
|||
return false;
|
||||
|
||||
}
|
||||
if (com.ProgrSrc._ProgrSrc.Getcancelled())
|
||||
{
|
||||
ErrStr = Resource1.String_cancel_progreso;
|
||||
return false;
|
||||
}
|
||||
com.ProgrSrc.IncMessage(10, "Exportando red navegable");//60%
|
||||
|
||||
//Prepara nombre de exportación
|
||||
|
|
@ -365,11 +373,12 @@ namespace OliviaAddInPro.Services
|
|||
//guarda los nombres del shape
|
||||
OliviaGlob.Paths.PathNW = OliviaGlob.Paths.DirData + com.NombreShpExportNw;
|
||||
//exporta los datos de entrada
|
||||
if (!HelperGdb.ExportShp2(OliviaGlob.Paths.PathGdbNw, filtroEspacial, com.NombreShpExportNw, OliviaGlob.Paths.DirData, com.ProgrSrc._ProgrSrc, spatRefData,100))
|
||||
if (!HelperGdb.ExportShp2(OliviaGlob.Paths.PathGdbNw, filtroEspacial, com.NombreShpExportNw, OliviaGlob.Paths.DirData, com.ProgrSrc._ProgrSrc, spatref,100))
|
||||
{
|
||||
ErrStr = "Error al exportar la red navegable: " + HelperGdb.OutStr;
|
||||
return false;
|
||||
}
|
||||
//OliviaGlob.Paths.PathGdbNw.Replace("1.", ".");
|
||||
if (com.ProgrSrc._ProgrSrc.Getcancelled())
|
||||
{
|
||||
ErrStr = Resource1.String_cancel_progreso;
|
||||
|
|
@ -395,9 +404,19 @@ namespace OliviaAddInPro.Services
|
|||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
///Comprueba si está la columna de ObjectId y si no, la crea
|
||||
/*if (!ComprCreaColOid(OliviaGlob.Paths.PathNW, OliviaGlob.Paths.PathGdbNw, null))
|
||||
{
|
||||
ErrStr = "Error al exportar columna " + ComunDef.CamposCom.camp_oid;
|
||||
return false;
|
||||
}
|
||||
//lo añade la siguiente función
|
||||
*/
|
||||
|
||||
//prepara campos estandar
|
||||
com.ProgrSrc.IncMessage(10, "Estandarizando campos de la red");//60%
|
||||
if (!EstandarizaCamposNW(OliviaGlob.Paths.DirData+com.NombreShpExportNw))
|
||||
if (!EstandarizaCamposNW(OliviaGlob.Paths.PathNW))
|
||||
{
|
||||
ErrStr = "Error al estandarizar campos red navegable: " + HelperGdb.OutStr;
|
||||
return false;
|
||||
|
|
@ -413,7 +432,7 @@ namespace OliviaAddInPro.Services
|
|||
}
|
||||
bool EstandarizaCamposNW(string pathNW)
|
||||
{
|
||||
HelperGdb.FieldToAdd[] fields = new HelperGdb.FieldToAdd[9];
|
||||
HelperGdb.FieldToAdd[] fields = new HelperGdb.FieldToAdd[10];
|
||||
//campo SECTOR
|
||||
int i = 0;
|
||||
fields[i].Name = ComunDef.CamposNW.cons_kph;
|
||||
|
|
@ -468,7 +487,12 @@ namespace OliviaAddInPro.Services
|
|||
fields[i].Alias = ComunDef.CamposNW.cons_angulo;
|
||||
fields[i].Tipo = "FLOAT";
|
||||
fields[i].Length = 128;
|
||||
i++;
|
||||
|
||||
fields[i].Name = ComunDef.CamposCom.camp_oid;
|
||||
fields[i].Alias = ComunDef.CamposCom.camp_oid;
|
||||
fields[i].Tipo = "LONG";
|
||||
fields[i].Length = 0;
|
||||
|
||||
if (!HelperGdb.AddFieldsSync(pathNW, fields))
|
||||
return false;
|
||||
|
|
@ -494,6 +518,11 @@ namespace OliviaAddInPro.Services
|
|||
|
||||
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;
|
||||
}
|
||||
/**
|
||||
|
|
@ -636,7 +665,7 @@ namespace OliviaAddInPro.Services
|
|||
/**
|
||||
* Comrpueba si existe la columna de oid y si no, la crea y la rellena
|
||||
*/
|
||||
public bool ComprCreaColOid(string pathCapa, string pathCapaOrig, SpatialQueryFilter filter)
|
||||
public bool ComprCreaColOid(string pathCapa, string pathCapaOrig, SpatialQueryFilter filter=null)
|
||||
{
|
||||
//comprueba si está el campo
|
||||
bool compCamp = HelperGdb.CheckField(pathCapa, ComunDef.CamposCom.camp_oid);
|
||||
|
|
@ -655,6 +684,7 @@ namespace OliviaAddInPro.Services
|
|||
|
||||
if (!HelperGdb.AddFieldsSync(pathCapa, fields))
|
||||
return false;
|
||||
|
||||
//vuelve a cerrar la capa
|
||||
string capa_principal = System.IO.Path.GetFileNameWithoutExtension(pathCapa);
|
||||
HelperGdb.CloseLayer(capa_principal);
|
||||
|
|
@ -663,23 +693,32 @@ namespace OliviaAddInPro.Services
|
|||
//Coge los ids de la capa de la que ha exportado
|
||||
using (FeatureClass fc_orig = HelperGdb.GetFtClassSync(pathCapaOrig))
|
||||
{
|
||||
if (fc_orig == null)
|
||||
return false;
|
||||
List<long> ids = new List<long>();
|
||||
//Añade a la lista los ids que cumplen el filtro espacial
|
||||
try
|
||||
{
|
||||
ids = fc_orig.Select(filter, SelectionType.ObjectID, SelectionOption.Normal).GetObjectIDs().ToList();
|
||||
}
|
||||
catch
|
||||
{
|
||||
ids = new List<long>();
|
||||
}
|
||||
//Comprueba que hay tantos ids como elementos en el shp
|
||||
using (FeatureClass fc_shp = HelperGdb.GetFtClassSync(pathCapa))
|
||||
{
|
||||
if (fc_orig == null)
|
||||
return false;
|
||||
if (fc_shp == null)
|
||||
return false;
|
||||
|
||||
if (filter == null)
|
||||
{
|
||||
filter = HelperGdb.CreateFiler("", null);
|
||||
//coge la geom de todos los ámbitos del shp
|
||||
var geomExport = HelperGdb.GetGeomUnique(fc_shp, filter);
|
||||
filter = HelperGdb.CreateFiler("", geomExport);
|
||||
}
|
||||
|
||||
List<long> ids = new List<long>();
|
||||
//Añade a la lista los ids que cumplen el filtro espacial
|
||||
try
|
||||
{
|
||||
ids = fc_orig.Select(filter, SelectionType.ObjectID, SelectionOption.Normal).GetObjectIDs().ToList();
|
||||
}
|
||||
catch
|
||||
{
|
||||
ids = new List<long>();
|
||||
}
|
||||
//Comprueba que hay tantos ids como elementos en el shp
|
||||
long nelem_shp = HelperGdb.GetNumElemsSync(fc_shp);
|
||||
if (nelem_shp != ids.Count)
|
||||
return false;
|
||||
|
|
@ -731,6 +770,48 @@ namespace OliviaAddInPro.Services
|
|||
/**
|
||||
* Prepara la geometría para exportar los ámbitos
|
||||
*/
|
||||
public Geometry GetZonasBuffer()
|
||||
{
|
||||
Geometry geomAux = null;
|
||||
|
||||
ErrStr = string.Empty;
|
||||
//Hace la intersección de zonas y niveles
|
||||
geomAux = null;
|
||||
/*
|
||||
if (com.GeomNiv != null || com.GeomZon != null)
|
||||
{
|
||||
geomAux = HelperGdb.IntersectGeom(com.GeomNiv, com.GeomZon);
|
||||
if (geomAux == null)
|
||||
{
|
||||
ErrStr = "Error al intersecar zonas y/o niveles.";
|
||||
return null;
|
||||
}
|
||||
if (geomAux.IsEmpty)
|
||||
{
|
||||
ErrStr = "No existen ámbitos en la intersección entre zonas y/o niveles.";
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}*/
|
||||
FeatureClass fc = HelperGdb.GetFtClassSync(OliviaGlob.Paths.PathData);
|
||||
if (fc == null)
|
||||
{
|
||||
ErrStr = "No se ha podido abrir la clase " + OliviaGlob.Paths.PathData;
|
||||
return null;
|
||||
}
|
||||
SpatialQueryFilter filtro = HelperGdb.CreateFiler("",null);
|
||||
var geomAmbits = HelperGdb.GetGeomUnique(fc, filtro);
|
||||
if (geomAmbits == null || geomAmbits.IsEmpty)
|
||||
{
|
||||
ErrStr = "No se ha podido generar geometría de los ámbitos" + com.ConsultaAmbs + HelperGdb.OutStr;
|
||||
HelperGdb.Free(fc);
|
||||
return null;
|
||||
}
|
||||
return geomAmbits;
|
||||
}
|
||||
public Geometry GetGeomAmbitsExport()
|
||||
{
|
||||
Geometry geomAux = null;
|
||||
|
|
|
|||
|
|
@ -216,10 +216,8 @@ namespace OliviaAddInPro.Services
|
|||
string consulta;
|
||||
long numero_lin;
|
||||
bool[] amb_gdb = new bool[(int)LimpiezaDef.AmbitsTra.AmbN];//se inician a false
|
||||
string ftclass;
|
||||
|
||||
//mira a ver si hay ejes de calle
|
||||
ftclass = LimpiezaDef.ftclass[(int)LimpiezaDef.AmbitsTra.AmbEjeCalle];
|
||||
consulta = LimpiezaDef.filtro_str[(int)LimpiezaDef.AmbitsTra.AmbEjeCalle];
|
||||
numero_lin = HelperGdb.GetNumElems(OliviaGlob.Paths.PathGdbNw, consulta);
|
||||
if (numero_lin > 0)
|
||||
|
|
|
|||
|
|
@ -64,20 +64,20 @@
|
|||
<ContentPresenter Name="PaneEjecutar">
|
||||
<ContentPresenter.Content>
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Grid Margin="0,10,0,0">
|
||||
<Grid Margin="0,30,0,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="100"/>
|
||||
<ColumnDefinition Width="100"/>
|
||||
<ColumnDefinition Width="100"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button x:Name="button_secto" Grid.Column="1" Style="{DynamicResource Esri_Button}" Content="Sectorizar" Margin="10,0,10,0" Click="button_secto_Click"/>
|
||||
<Button x:Name="button_planif" Grid.Column="2" Style="{DynamicResource Esri_Button}" Content="Planificar" Margin="10,0,10,0" Click="button_planif_Click"/>
|
||||
<Button x:Name="button_planif" Grid.Column="2" Style="{DynamicResource Esri_Button}" Content="Planificar" Margin="10,0,0,0" Click="button_planif_Click"/>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</ContentPresenter.Content>
|
||||
</ContentPresenter>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="3" Margin="0,70,10,0">
|
||||
<StackPanel Grid.Row="3" Margin="0,90,10,0">
|
||||
<Button x:Name="button_help" Content="" Margin="274,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Width="16" Height="16" BorderThickness="0" RenderTransformOrigin="16.875,0.375" Click="button_help_Click">
|
||||
<Button.Background>
|
||||
<ImageBrush ImageSource="../../Images/help16Pro.png"/>
|
||||
|
|
|
|||
|
|
@ -269,7 +269,9 @@ namespace OliviaAddInPro
|
|||
}
|
||||
public void ComboMvSel(int tto)
|
||||
{
|
||||
tipoMv = tto;
|
||||
if (tto < 0)
|
||||
return;
|
||||
TipoMv = tto;
|
||||
}
|
||||
/**
|
||||
* Realiza los cambios en los ámbitos cuando se ha seleccionado un tratamiento
|
||||
|
|
|
|||
|
|
@ -80,6 +80,7 @@ namespace OliviaAddInPro
|
|||
return false;
|
||||
}
|
||||
limp.CapaElems = _subPanel1ViewModel.CapaElems;
|
||||
limp.CapaElemsRef = limp.CapaElems;
|
||||
//pone que la capa de elementos es la red navegable, que es la que va a exportar
|
||||
if (_subPanel1ViewModel.SelOpAmb == 1)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -68,7 +68,9 @@ namespace OliviaAddInPro
|
|||
}
|
||||
public void ComboMvSel(int tto)
|
||||
{
|
||||
tipoMv = tto;
|
||||
if (tto < 0)
|
||||
return;
|
||||
TipoMv = tto;
|
||||
}
|
||||
|
||||
public override string DisplayName
|
||||
|
|
|
|||
|
|
@ -105,6 +105,7 @@ namespace OliviaAddInPro
|
|||
return false;
|
||||
}
|
||||
reco.CapaElems = _subPanel1ViewModel.CapaElems;
|
||||
reco.CapaElemsRef = reco.CapaElems;
|
||||
//lee la fracción
|
||||
reco.TipoFrac = _subPanel1ViewModel.TipoFrac;
|
||||
if (reco.TipoFrac == -1)
|
||||
|
|
|
|||
Loading…
Reference in New Issue