Primer intento revisar elevación. Id de conjunción truncado, no sirve. Configurado para arrancar Olivia sin Addin

Gerardo/estandarizacion
Elena 2023-02-06 23:19:22 +01:00
parent 334a060db6
commit 01f143205e
7 changed files with 296 additions and 11 deletions

View File

@ -391,7 +391,7 @@ void COlivia::prueba()
/////////////////// ///////////////////
//solo para debug elena olivia //solo para debug elena olivia
i=3; i=1;
if(fin) if(fin)
{ {
@ -411,12 +411,17 @@ void COlivia::prueba()
switch(i) switch(i)
{ {
case 1: case 1:
sprintf_s(config, max_char_cap,"/CONFIG /t_tto:2900 /restr_cir:0 /u_tto:3 /v_despl:5 /t_conv:480 /t_descan:30 /t_despl:25 /t_carg:40 "\ sprintf_s(config, max_char_cap,"/CONFIG_PLANIF /t_tto:2900 /restr_cir:0 /u_tto:3 /v_despl:5 /t_conv:480 /t_descan:30 /t_despl:25 /t_carg:40 "\
"/h_inicio:450 /trafico:80 /n_ptsctrl:3 /n_secdef:3 /anch_med:2 /coor_inst_x:0 /coor_inst_y:0 /aislados:1 /cons_obser:OBSERVACIONES "\ "/h_inicio:450 /trafico:80 /n_ptsctrl:3 /n_secdef:3 /anch_med:2 /coor_inst_x:0 /coor_inst_y:0 /aislados:1 /cons_obser:OBSERVACIONES "\
"/cons_anch_tip:ANCHO_TIPO /cons_tipolo:TIPOLOGIA /cons_tip_ent:NOM_TIPO_ENTIDAD /atr_aparc:Banda Aparcamiento /atr_bord:Bordillo Libre "\ "/cons_anch_tip:ANCHO_TIPO /cons_tipolo:TIPOLOGIA /cons_tip_ent:NOM_TIPO_ENTIDAD /atr_aparc:Banda Aparcamiento /atr_bord:Bordillo Libre "\
"/atr_acera:Aceras /atr_peat:Peatonales /atr_ap_lin:Linea /atr_ap_bat:Bateria /cons_onew:ONEWAY /cons_kph:KPH /cons_fow:FOW /cons_name:NAME "\ "/atr_acera:Aceras /atr_peat:Peatonales /atr_ap_lin:Linea /atr_ap_bat:Bateria /cons_onew:ONEWAY /cons_kph:KPH /cons_fow:FOW /cons_name:NAME "\
"/atr_TF:TF /atr_FT:FT /atr_N:N /atr_pedes:14 /str_tto:Barrido_man "\ "/atr_TF:TF /atr_FT:FT /atr_N:N /atr_pedes:14 /str_tto:Barrido_man "\
"/path_data:D:\\Proyectos\\Olivia\\Instal2.0\\data\\data_T00_A04050607_NNivel7_20220327_155737.shp /path_nw:D:\\Proyectos\\Olivia\\Instal2.0\\data\\nw_20220327_155737.shp "); "/Camp_sector:SECTOR /Camp_secuencia:SECUENCIA /Camp_objectid:FID "\
"/Giro_max_vehiculo:175 /Desv_max_rel:0.15 /Desv_max_abs:1000 "\
"/Ancho_peat_def:6 /Ancho_acera_def:1.5 /Ancho_ap_lin_def:2 "\
"/Ancho_ap_bat_def:4 /Ancho_bord_lib_def:1.5 "\
"/path_data:D:\\Proyectos\\Olivia\\Instal3.0\\data_prueba_2\\data_T00_A0405_20230111_233224.shp "\
"/path_nw:D:\\Proyectos\\Olivia\\Instal3.0\\data_prueba_2\\nw_20230111_233224.shp ");
break; break;
case 3://nw de arcmap case 3://nw de arcmap
sprintf_s(config, max_char_cap, "/CONFIG /t_tto:2900 /restr_cir:0 /u_tto:3 /v_despl:5 /t_conv:480 /t_descan:30 /t_despl:25 /t_carg:40 "\ sprintf_s(config, max_char_cap, "/CONFIG /t_tto:2900 /restr_cir:0 /u_tto:3 /v_despl:5 /t_conv:480 /t_descan:30 /t_despl:25 /t_carg:40 "\

View File

@ -61,6 +61,7 @@ Colv_limp::Colv_limp(COlivia *olv)
nomb_tto[0]=0; nomb_tto[0]=0;
barr_mix=FALSE; barr_mix=FALSE;
usa_secuen = FALSE; usa_secuen = FALSE;
revisa_elev = TRUE;
} }
//******************************************************************************************************************************************* //*******************************************************************************************************************************************
Colv_limp::~Colv_limp(void) Colv_limp::~Colv_limp(void)
@ -691,6 +692,10 @@ BOOL Colv_limp::guarda_campos_ini(char *path)
} }
//************************************************************************************* //*************************************************************************************
#define NOMB_CAMP_CONJ_TO "T_JNCTID"
#define NOMB_CAMP_CONJ_FROM "F_JNCTID"
#define NOMB_CAMP_ELEV_TO "T_ELEV"
#define NOMB_CAMP_ELEV_FROM "F_ELEV"
/** /**
* Rellena los nombres de los campos de la dbf * Rellena los nombres de los campos de la dbf
*/ */
@ -701,6 +706,11 @@ void Colv_limp::rellena_campos()
sprintf_s(camps.campo_velo,OLV_LIMP_MAX_CAMP,"KPH"); sprintf_s(camps.campo_velo,OLV_LIMP_MAX_CAMP,"KPH");
sprintf_s(camps.campo_fow,OLV_LIMP_MAX_CAMP,"FOW"); sprintf_s(camps.campo_fow,OLV_LIMP_MAX_CAMP,"FOW");
sprintf_s(camps.campo_name,OLV_LIMP_MAX_CAMP,"NAME"); sprintf_s(camps.campo_name,OLV_LIMP_MAX_CAMP,"NAME");
//TOM TOM ELEV
sprintf_s(camps.campo_conj_to, OLV_LIMP_MAX_CAMP, NOMB_CAMP_CONJ_TO);
sprintf_s(camps.campo_conj_from, OLV_LIMP_MAX_CAMP, NOMB_CAMP_CONJ_FROM);
sprintf_s(camps.campo_elev_to, OLV_LIMP_MAX_CAMP, NOMB_CAMP_ELEV_TO);
sprintf_s(camps.campo_elev_from, OLV_LIMP_MAX_CAMP, NOMB_CAMP_ELEV_FROM);
//VSM //VSM
sprintf_s(camps.campo_obs,OLV_LIMP_MAX_CAMP,"OBSERVACIO"); sprintf_s(camps.campo_obs,OLV_LIMP_MAX_CAMP,"OBSERVACIO");

View File

@ -50,6 +50,7 @@ public:
BOOL igno_ais; ///<Indica si ignorar aislados BOOL igno_ais; ///<Indica si ignorar aislados
BOOL barr_mix; ///<Indica si es barrido mixto BOOL barr_mix; ///<Indica si es barrido mixto
BOOL usa_secuen; BOOL usa_secuen;
BOOL revisa_elev;
double f_trafic; ///<Factor de reducción de la velocidad en calles por el tráfico en tanto por 1 double f_trafic; ///<Factor de reducción de la velocidad en calles por el tráfico en tanto por 1
double calc_nsec; ///<Indica si el número de sectores es calculado (almacena el coste del sector) o impuesto (0) double calc_nsec; ///<Indica si el número de sectores es calculado (almacena el coste del sector) o impuesto (0)
double margen_sect; ///<Margen de diferencia entre sectores, en tanto por uno double margen_sect; ///<Margen de diferencia entre sectores, en tanto por uno
@ -88,6 +89,8 @@ public:
std::map<int,Info_aso2> iaso; ///<Map con mismos elementos que entidades la carto, con la información asociada std::map<int,Info_aso2> iaso; ///<Map con mismos elementos que entidades la carto, con la información asociada
std::vector<Info_tramos> *tramos; std::vector<Info_tramos> *tramos;
std::map<int, Info_aso_nw_elev> iaso_elev; ///<Map con mismos elementos que la nw, con la info de elevación de los nodos
//************************************************************************************* //*************************************************************************************
//Funciones //Funciones
Colv_limp(COlivia *olv); Colv_limp(COlivia *olv);

View File

@ -1,5 +1,6 @@
#pragma once #pragma once
#include <float.h> #include <float.h>
#include <vector>
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////// //////////////////////////////////////////////////
@ -232,8 +233,7 @@ enum TiposPlan{
typedef struct Info_aso_nw typedef struct Info_aso_nw
{ {
double velo; //velocidad de la vía, en km/h double velo; //velocidad de la vía, en km/h
char *nomb; //nombre de la vía char *nomb; //nombre de la vía
//int refe2; //en replicas, la calle orig
}Info_aso_nw; }Info_aso_nw;
/** /**
* Nueva Estructura que contiene la información asociada de las entidades de limpieza (aceras, bordillos, peatonales...) * Nueva Estructura que contiene la información asociada de las entidades de limpieza (aceras, bordillos, peatonales...)
@ -433,10 +433,17 @@ typedef struct Info_planif
*/ */
typedef struct Campos_dbf typedef struct Campos_dbf
{ {
/////////////////////////////////////////////
char campo_circ[OLV_LIMP_MAX_CAMP]; char campo_circ[OLV_LIMP_MAX_CAMP];
char campo_velo[OLV_LIMP_MAX_CAMP]; char campo_velo[OLV_LIMP_MAX_CAMP];
char campo_name[OLV_LIMP_MAX_CAMP]; char campo_name[OLV_LIMP_MAX_CAMP];
char campo_fow[OLV_LIMP_MAX_CAMP]; char campo_fow[OLV_LIMP_MAX_CAMP];
//ELEV TOM TOM
char campo_conj_to[OLV_LIMP_MAX_CAMP];
char campo_conj_from[OLV_LIMP_MAX_CAMP];
char campo_elev_to[OLV_LIMP_MAX_CAMP];
char campo_elev_from[OLV_LIMP_MAX_CAMP];
/////////////////////////////////////////////
char campo_obs[OLV_LIMP_MAX_CAMP]; char campo_obs[OLV_LIMP_MAX_CAMP];
char campo_anch[OLV_LIMP_MAX_CAMP]; char campo_anch[OLV_LIMP_MAX_CAMP];
char campo_tipo_ap[OLV_LIMP_MAX_CAMP]; char campo_tipo_ap[OLV_LIMP_MAX_CAMP];
@ -523,4 +530,52 @@ typedef struct th_param_planif
} }
return j; return j;
}; };
}th_param_planif; }th_param_planif;
/*
* Para revisar la elevación de las carreteras y borrar uniones que no debería haber por estar a distinta elevación
*/
#define INFO_ASO_NW_NO_ELEV 0
enum INFO_ASO_NW_NODOS
{
FROM = 0,
TO = 1,
N_NODOS = 2
};
/*
* Estructura para almacenar los id de los nodos de cada ent de la nw TO y FROM, y la elevación
*/
typedef struct Info_aso_nw_elev
{
short elev[N_NODOS]; //indica elevación
//elev[FROM] = 0 o 1
//elev[TO]=0 o 1
double inod[N_NODOS]; //almacena aquí el id de las conjunciones de la carto FROM y TO
bool inod_check[N_NODOS]; //almacena aquí si se ha comprobado ya ese nodo
int i_nw; //la ref de la nw
}Info_aso_nw_elev;
enum INFO_ASO_NW_ELEV
{
NO_ELEV = 0,
ELEV = 1,
N_ELEV = 2
};
/*
* Estructura para almacenar nodos que están a distinta elevación
*/
typedef struct Info_aso_conj_elev_aux
{
short tofrom;
int i_nw;
void set(int _i_nw, short _tofrom)
{
i_nw = _i_nw;
tofrom = _tofrom;
}
}Info_aso_conj_elev_aux;
/*
* Estructura para almacenar los id de los nodos a los que llegan ent de la nw con distinta elevación
*/
typedef struct Info_aso_conj_elev
{
std::vector<Info_aso_conj_elev_aux> conj_nw; //dos maps con las entidades de la nw que están a nivel 0 y a nivel 1 en la misma conjunción
}Info_aso_conj_elev;

View File

@ -591,7 +591,16 @@ BOOL Colv_limp_thr::abre_datos()
pon_mi_msg("Error al leer info asociada a red navegable: %s", err_str); pon_mi_msg("Error al leer info asociada a red navegable: %s", err_str);
return FALSE; return FALSE;
} }
//////////////////////////////////////////////////////////////////////////
//revisa info de elevación
if (olv_limp->revisa_elev)
{
rellena_elev_nw();
if (!revisa_elev_nw())
{
pon_mi_msg("Error al revisar información de elevación");
}
}
//////////////////// ////////////////////
olvlog(LOG_TODO,"olv_limp_t","Finaliza Abrir datos con éxito"); olvlog(LOG_TODO,"olv_limp_t","Finaliza Abrir datos con éxito");
@ -1191,6 +1200,205 @@ fin:
return ret; return ret;
} }
//************************************************************************************* //*************************************************************************************
/**
* Lee la info de elevación y la almacena
*/
void Colv_limp_thr::rellena_elev_nw()
{
char nfile[MAX_PATH];
Cb_file file;
Fdbf dbf;
int ic_conj_to, ic_conj_from, ic_elev_to, ic_elev_from;
int idd, n, num;
olvlog(LOG_TODO, "olv_limp_t", "Rellenando matriz de info de elevación de carreteras.");
//lee dbf del shp
strcpy_s(nfile, MAX_PATH, olv->paths.path_nw);
char bufAux[256];
strcpy(nfile, Cdir_manager::cambia_extension_archivo(nfile, bufAux, ".dbf"));
if (!file.abre(nfile, 1) || !dbf.lee(&file))
{
olvlog(LOG_TODO, "olv_limp_t", "Error al abrir %s en rellena_elev", nfile);
return;
}
//busca el campo del sentido "ONEWAY" y el de "KPH"
ic_conj_to = ic_conj_from = ic_elev_to = ic_elev_from = -1;
ic_conj_to = dbf.findCol(olv_limp->camps.campo_conj_to);
ic_conj_from = dbf.findCol(olv_limp->camps.campo_conj_from);
ic_elev_to = dbf.findCol(olv_limp->camps.campo_elev_to);
ic_elev_from = dbf.findCol(olv_limp->camps.campo_elev_from);
if (ic_conj_to == -1 || ic_conj_from == -1 || ic_elev_to == -1 || ic_elev_from == -1)
{
olvlog(LOG_TODO, "olv_limp_t","No encontrado campos para rellenar elevación");
return;
}
idd = dbf.leeNexRow();
n = 0;
while (idd == 1)
{
//inicia
olv_limp->iaso_elev[n].inod_check[FROM] = olv_limp->iaso_elev[n].inod_check[TO] = false;
olv_limp->iaso_elev[n].i_nw = n;
//conj
olv_limp->iaso_elev[n].inod[TO]= dbf.getD(ic_conj_to);
olv_limp->iaso_elev[n].inod[FROM] = dbf.getD(ic_conj_from);
//elev
olv_limp->iaso_elev[n].elev[TO] = dbf.getI(ic_elev_to);
olv_limp->iaso_elev[n].elev[FROM] = dbf.getI(ic_elev_from);
n++;
idd = dbf.leeNexRow();
}
if (n < olv_limp->n_nw)
{
sprintf_s(err_str, OLV_MAX_ERR, "Error al leer elemento de la nw %ld en\n%s", n, nfile);
}
else
err_str[0] = 0;
olvlog(LOG_TODO, "olv_limp_t", "Finaliza matriz de info de elevación de carreteras. %s",err_str);
}
//*************************************************************************************
/**
* Revisa que no haya elementos de la nw que comparten nodo pero están a distinta elevación
* si encuentra, mueve el nodo de las que están a distinta elevación
*/
BOOL Colv_limp_thr::revisa_elev_nw()
{
std::map<int, Info_aso_conj_elev> conj_elev = busca_elev_nw();
olvlog(LOG_TODO, "olv_limp_t", "Encontrados %ld nodos con elevaciones distintas", conj_elev.size());
if (conj_elev.size() == 0)
return TRUE;
//ha encontrado nodos con distinta elevación, mueve las coordenadas
BOOL resul_mueve = mueve_distint_elev_nw(conj_elev);
return resul_mueve;
}
//*************************************************************************************
/**
* Busca y almacena los elementos que tienen nodo compartido pero a distinta elevación
*/
std::map<int, Info_aso_conj_elev> Colv_limp_thr::busca_elev_nw()
{
std::map<int, Info_aso_conj_elev> conj_elev;
Info_aso_conj_elev conj_elev_i1;
Info_aso_conj_elev_aux conj_elev_nw_i1, conj_elev_nw_i2;
std::map<int, Info_aso_nw_elev>::iterator it1;
std::map<int, Info_aso_nw_elev>::iterator it2;
int i1, i2,elev1,elev2;
Info_aso_nw_elev* info1, * info2;
BOOL encontrado_distinta_elev = false;
it1 = olv_limp->iaso_elev.begin();
while (it1 != olv_limp->iaso_elev.end())
{
info1 = &it1->second;
for (i1 = 0; i1 < N_NODOS; i1++)
{
if (info1->inod_check[i1]) //si ya se ha comprobado, pasa
continue;
it2 = olv_limp->iaso_elev.begin();
while (it2 != olv_limp->iaso_elev.end())
{
info2 = &it2->second;
if (info2->i_nw == info1->i_nw)
{
it2++;
continue;//mismo elemento
}
encontrado_distinta_elev = false;
for (i2 = 0; i2 < N_NODOS && !encontrado_distinta_elev; i2++)
{
if (info2->inod_check[i2])//si ya se ha comprobado, pasa
continue;
if (info1->inod[i1] == info2->inod[i2])
{
//comparten nodo, revisa elevación
if (info1->elev[i1] != info2->elev[i2])
{
//distinta elevación
encontrado_distinta_elev = true;
}
}
//info2->inod_check[i2] = true;
}
if (encontrado_distinta_elev)
{
//añade i2
conj_elev_nw_i2.set(info2->i_nw, i2);
conj_elev[info1->inod[i1]].conj_nw.push_back(conj_elev_nw_i2);
}
///////////////////////////////////////
it2++;
}
info1->inod_check[i1] = true;
}
it1++;
}
return conj_elev;
}
//*************************************************************************************
#define MUEVE_COOR_METROS 5
/**
* Mueve las coordenadas de una conjunción de las que tienen distinta elevación
*/
BOOL Colv_limp_thr::mueve_distint_elev_nw(std::map<int, Info_aso_conj_elev> conj_elev)
{
int ELEV_MUEVE = ELEV; //mueve los que están a elev, y deja igual los que están a no_elev
std::map<int, Info_aso_conj_elev>::iterator it_conj = conj_elev.begin();
CartoBaseInfoEntity ient;
std::vector<Info_aso_conj_elev_aux>::iterator it_nw;
int ipt, nptos;
double pto_aux[3];
try
{
while (it_conj != conj_elev.end())
{
//coge las nw que están a elev distinta de 0 y les mueve su coordenada en común
it_nw = it_conj->second.conj_nw.begin();
while (it_nw != it_conj->second.conj_nw.end())
{
ient = olv_limp->carto.getEntity(it_nw->i_nw + olv_limp->n_amb); //+n_amb porque el nw empieza a continuación de los ámbitos
if (it_nw->tofrom == FROM)
{
ipt = 0;
}
else
{
nptos = ient.getNumberPtos();
ipt = nptos - 1;
}
//////////////////////////////////////////////////////
//coge el pto original
memcpy(&pto_aux, ient.getPto(ipt), 3 * sizeof(double));
//lo mueve
pto_aux[0] += MUEVE_COOR_METROS;
pto_aux[1] += MUEVE_COOR_METROS;
//lo sobreescribe
memcpy(ient.getPto(ipt), &pto_aux, 3 * sizeof(double));
//////////////////////////////////////////////////////
it_nw++;
}
it_conj++;
}
}
catch (...)
{
return FALSE;
}
return TRUE;
}
//*************************************************************************************
/** /**
* Replica los ámbitos cuando son tipo peatonal, añadiendo otro lineal igual que tendrá solo coste * Replica los ámbitos cuando son tipo peatonal, añadiendo otro lineal igual que tendrá solo coste
* de desplazamiento, no de tratamiento, más los segmentos que los unen, de coste 0 * de desplazamiento, no de tratamiento, más los segmentos que los unen, de coste 0

View File

@ -33,6 +33,7 @@ struct th_param_planif;
struct Djkt_ang_ady; struct Djkt_ang_ady;
struct HeadCostConj; struct HeadCostConj;
struct HeadCostAng; struct HeadCostAng;
struct Info_aso_conj_elev;
/** /**
* Estructura de parámetros de comunicación con el thread de cálculo de limpieza * Estructura de parámetros de comunicación con el thread de cálculo de limpieza
*/ */
@ -143,6 +144,10 @@ public:
virtual BOOL rellena_datos(); virtual BOOL rellena_datos();
BOOL rellena_info_nw(); BOOL rellena_info_nw();
BOOL rellena_info_amb(); BOOL rellena_info_amb();
void rellena_elev_nw();
BOOL revisa_elev_nw();
std::map<int, Info_aso_conj_elev> busca_elev_nw();
BOOL mueve_distint_elev_nw(std::map<int, Info_aso_conj_elev> conj_elev);
BOOL replica_peat(); BOOL replica_peat();
void mejora_barr_mix(); void mejora_barr_mix();
void mejora_barr_mix_sub(int ithr); void mejora_barr_mix_sub(int ithr);

View File

@ -13,14 +13,13 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LocalDebuggerWorkingDirectory>..\bin\$(IntDir)</LocalDebuggerWorkingDirectory> <LocalDebuggerWorkingDirectory>..\bin\$(IntDir)</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor> <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
<LocalDebuggerCommand>$(TargetPath)</LocalDebuggerCommand> <LocalDebuggerCommand>C:\Desa\v2017\Olivia\bin\$(IntDir)$(TargetFileName)</LocalDebuggerCommand>
<LocalDebuggerCommandArguments>/tipo:0 /ip:192.168.2.61 /port:19995 /tout:20 /path_temp:D:\Proyectos\Olivia\Instal2.0\temp\ /path_cfgeo:D:\Proyectos\Olivia\Instal2.0\cfg.ini /debug</LocalDebuggerCommandArguments> <LocalDebuggerCommandArguments>/tipo:0 /ip:192.168.2.61 /port:19995 /tout:20 /path_temp:D:\Proyectos\Olivia\Instal3.0\temp\ /path_cfgeo: /debug</LocalDebuggerCommandArguments>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LocalDebuggerWorkingDirectory>..\bin\$(IntDir)</LocalDebuggerWorkingDirectory> <LocalDebuggerWorkingDirectory>..\bin\$(IntDir)</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor> <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
<LocalDebuggerCommand>$(TargetPath)</LocalDebuggerCommand> <LocalDebuggerCommand>$(TargetPath)</LocalDebuggerCommand>
<LocalDebuggerCommandArguments> <LocalDebuggerCommandArguments>/tipo:0 /ip:192.168.2.61 /port:19995 /tout:20 /path_temp:D:\Proyectos\Olivia\Instal3.0\temp\ /path_cfgeo: /debug</LocalDebuggerCommandArguments>
</LocalDebuggerCommandArguments>
</PropertyGroup> </PropertyGroup>
</Project> </Project>