Modificaciones para exportar OID y otras de nombres de campos
parent
a056f6d78b
commit
407d06bf00
|
|
@ -263,6 +263,12 @@ namespace OliviaAddInPro.Model
|
|||
[DisplayName("Ignorar aislados")]
|
||||
[Description("Indica si por defecto se van a ignorar elementos aislados")]
|
||||
public bool Igno_ais { get; set; }
|
||||
|
||||
[Category("General")]
|
||||
[PropertyOrder(9)]
|
||||
[DisplayName("Campo para exportar ID")]
|
||||
[Description("Nombre del campo que indica el ID del ámbito")]
|
||||
public string id { get; set; }
|
||||
#endregion
|
||||
|
||||
#region 02CamposLimp
|
||||
|
|
@ -378,11 +384,6 @@ namespace OliviaAddInPro.Model
|
|||
#endregion
|
||||
|
||||
#region 04CamposRecogida
|
||||
[Category("Campos Recogida")]
|
||||
[DisplayName("ID")]
|
||||
[Description("Nombre del campo que indica el ID del contenedor")]
|
||||
public string id { get; set; }
|
||||
|
||||
[Category("Campos Recogida")]
|
||||
[DisplayName("Tipo de carga")]
|
||||
[Description("Nombre del campo que indica el tipo de carga")]
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@ namespace OliviaAddInPro.Model
|
|||
public override string[] GetCampos(string capa=null)
|
||||
{
|
||||
string[] camps = {
|
||||
RecogidaDef.campos_def.cons_id,
|
||||
//RecogidaDef.campos_def.cons_id,
|
||||
RecogidaDef.campos_def.cons_nomrec,
|
||||
RecogidaDef.campos_def.cons_lateral ,
|
||||
RecogidaDef.campos_def.cons_fracc,
|
||||
|
|
|
|||
|
|
@ -137,6 +137,8 @@ namespace OliviaAddInPro.Model
|
|||
set { err_str = value; }
|
||||
}
|
||||
|
||||
private ObservableCollection<string> nombCamposOrig = new ObservableCollection<string>();
|
||||
|
||||
/**
|
||||
* Para la ventana de progreso
|
||||
*/
|
||||
|
|
@ -202,6 +204,26 @@ namespace OliviaAddInPro.Model
|
|||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Restaura el nombre original del campo si se ha truncado a 10 car al exportar a shp
|
||||
*/
|
||||
public virtual string[] GetCamposOrig()
|
||||
{
|
||||
string[] camps = null;
|
||||
|
||||
if (nombCamposOrig.Count > 0)
|
||||
{
|
||||
camps = new string[nombCamposOrig.Count];
|
||||
for (int i=0;i<nombCamposOrig.Count;i++)
|
||||
{
|
||||
camps[i] = nombCamposOrig[i];
|
||||
}
|
||||
}
|
||||
|
||||
return camps;
|
||||
}
|
||||
|
||||
/**
|
||||
* Restaura el nombre original del campo si se ha truncado a 10 car al exportar a shp
|
||||
*/
|
||||
|
|
@ -213,7 +235,9 @@ namespace OliviaAddInPro.Model
|
|||
if (fc == null)
|
||||
return resp;
|
||||
////////////////////////////////////////////////////////
|
||||
string[] camps = GetCampos();
|
||||
string[] camps = GetCamposOrig();
|
||||
if (camps == null)
|
||||
return resp;
|
||||
|
||||
ObservableCollection<string> fields = HelperGdb.GetFieldsSync(fc);
|
||||
HelperGdb.Free(fc);
|
||||
|
|
@ -228,6 +252,8 @@ namespace OliviaAddInPro.Model
|
|||
{
|
||||
if (camps[i].Length <= LENGTHCAMPSHP)
|
||||
continue;
|
||||
if (EstaRepeNomb(fields, camps[i]))
|
||||
continue;
|
||||
campTrunc = camps[i].Substring(0, LENGTHCAMPSHP);
|
||||
//si tiene más de 10 caracteres, lo ha truncado al exportar
|
||||
//busca el nombre actual del campo en la fc
|
||||
|
|
@ -251,5 +277,30 @@ namespace OliviaAddInPro.Model
|
|||
|
||||
return resp;
|
||||
}
|
||||
|
||||
private bool EstaRepeNomb(ObservableCollection<string> fields, string nomb)
|
||||
{
|
||||
foreach( string fnomb in fields)
|
||||
{
|
||||
if (string.Compare(fnomb, nomb, true)==0)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Guarda el nombre de los campos originales para luego restaurarlos
|
||||
*/
|
||||
public void GuardaNombCamposOrig(string pathFtClass)
|
||||
{
|
||||
FeatureClass fc = HelperGdb.GetFtClassSync(pathFtClass);
|
||||
if (fc != null)
|
||||
{
|
||||
nombCamposOrig = HelperGdb.GetFieldsSync(fc);
|
||||
}
|
||||
else
|
||||
nombCamposOrig = new ObservableCollection<string>();
|
||||
HelperGdb.Free(fc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,6 +78,12 @@ namespace OliviaAddInPro.Services
|
|||
ErrStr = Resource1.String_cancel_progreso;
|
||||
return false;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////
|
||||
///Se guarda el nombre de los campos originales
|
||||
///
|
||||
com.GuardaNombCamposOrig(com.CapaElems);
|
||||
|
||||
//Cuenta las filas que cumplen la consulta
|
||||
int nelems = HelperGdb.GetNumElemsSync(com.CapaElems, com.ConsultaAmbs);
|
||||
if (nelems <= 0)
|
||||
|
|
@ -535,7 +541,8 @@ namespace OliviaAddInPro.Services
|
|||
|
||||
/////////////////////////////////////////////////////
|
||||
//Coge los ids de la capa de la que ha exportado
|
||||
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>();
|
||||
|
|
@ -549,7 +556,8 @@ namespace OliviaAddInPro.Services
|
|||
ids = new List<long>();
|
||||
}
|
||||
//Comprueba que hay tantos ids como elementos en el shp
|
||||
FeatureClass fc_shp = HelperGdb.GetFtClassSync(pathCapa);
|
||||
using (FeatureClass fc_shp = HelperGdb.GetFtClassSync(pathCapa))
|
||||
{
|
||||
if (fc_shp == null)
|
||||
return false;
|
||||
int nelem_shp = HelperGdb.GetNumElemsSync(fc_shp);
|
||||
|
|
@ -597,6 +605,8 @@ namespace OliviaAddInPro.Services
|
|||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepara la geometría para exportar los ámbitos
|
||||
|
|
|
|||
|
|
@ -28,15 +28,16 @@ namespace OliviaAddInPro.Services
|
|||
*/
|
||||
public int CompruebaCamposReco(string pathCapa)
|
||||
{
|
||||
int NCAMPS = 6;
|
||||
int NCAMPS = 5;
|
||||
string[] camps;
|
||||
camps = new string[NCAMPS];
|
||||
camps[0] = RecogidaDef.campos_def.cons_id;
|
||||
camps[1] = RecogidaDef.campos_def.cons_fracc;
|
||||
camps[2] = RecogidaDef.campos_def.cons_nomrec;
|
||||
camps[3] = RecogidaDef.campos_def.cons_lateral;
|
||||
camps[4] = RecogidaDef.campos_def.cons_uds;
|
||||
camps[5] = RecogidaDef.campos_def.cons_kgrec;
|
||||
|
||||
camps[0] = RecogidaDef.campos_def.cons_fracc;
|
||||
camps[1] = RecogidaDef.campos_def.cons_nomrec;
|
||||
camps[2] = RecogidaDef.campos_def.cons_lateral;
|
||||
camps[3] = RecogidaDef.campos_def.cons_uds;
|
||||
camps[4] = RecogidaDef.campos_def.cons_kgrec;
|
||||
//camps[5] = RecogidaDef.campos_def.cons_id;
|
||||
int compCamp = HelperGdb.CheckFileds(pathCapa, camps);
|
||||
ErrStr = HelperGdb.OutStr;
|
||||
if (compCamp == 0)
|
||||
|
|
|
|||
Loading…
Reference in New Issue