Hi,
I am having an issue to figure out how erase some Line Segs. the code below draw a lot of Line Segs in a graphic while it iterate the list, but when i try to remove the node eixo_bot_np it only removes one Line Segs and not all the Line Segs. If anyone could help me how to resolve this i would be greatful.
PT(GraphicsMenu) graphics_menu = (PT(GraphicsMenu)) (GraphicsMenu*) data;
PT(TimeControl) time_control = TimeControl::get_instance();
int diaPassado = time_control->get_dia_passado();
stateHistory::SHList listEvent;
listEvent = *graphics_menu->get_stateHistory()->get_list(stateHistory::SH_changed_shadow);
std::list<stateHistory::state>::iterator iterator;
stateHistory::state test;
//CLIQUEI COM O INTUITO DE LIGAR O BOTAO
if(flag_btn_sombra == 0 && flag_btn_comeu == 0 && flag_btn_correndo == 0){
graphics_menu->get_led_on_sombra().unstash();
graphics_menu->get_led_off_sombra().stash();
flag_btn_sombra = 1;
for(iterator = listEvent.begin(); iterator != listEvent.end() ; ++iterator){
test = *iterator;
float posicaoX = ((test.hour_event*0.54)/24)+0.03;
if(test.event_day == (diaPassado - contador)){
if(graphics_menu->get_chart1() != NULL){
eixo_bot = new LineSegs("eixo-bot");
eixo_bot->set_color(0, 1.0, 0.0);
eixo_bot->draw_to(0.0, 0.0, 0.0);
eixo_bot->draw_to(0.0, 0.0, 0.54);
eixo_bot_np = graphics_menu->get_chart1()->get_graphic_np().get_parent().attach_new_node(eixo_bot->create(true));
eixo_bot_np.set_pos(window->get_render_2d(), posicaoX, 0.0, 0.13);
}
if(graphics_menu->get_chart2() != NULL){
eixo2_bot = new LineSegs("eixo2-bot");
eixo2_bot->set_color(0, 1.0, 0.0);
eixo2_bot->draw_to(0.0, 0.0, 0.0);
eixo2_bot->draw_to(0.0, 0.0, 0.54);
eixo2_bot_np = graphics_menu->get_chart2()->get_graphic_np().get_parent().attach_new_node(eixo2_bot->create(true));
eixo2_bot_np.set_pos(window->get_render_2d(), posicaoX, 0.0, -0.77);
}
}
}
}
else if(flag_btn_sombra == 1 && flag_btn_comeu == 0 && flag_btn_correndo == 0){
//CLIQUEI COM O INTUITO DE DESLIGAR
graphics_menu->get_led_on_sombra().stash();
graphics_menu->get_led_off_sombra().unstash();
flag_btn_sombra = 0;
}