void FLIRTDemo::mousePressedGL(int button, int x, int y){ if(button & Qt::LeftButton){ GLdouble worldX, worldY, worldZ; m_rendererWidget->unprojectCoordinates(x, y, &worldX, &worldY, &worldZ); if(!m_points.size()) return; double minDistance = 10e16; unsigned int minIndex = 0; Point2D clickedPoint(worldX, worldY); for(unsigned int i = 0; i < m_points.size(); i ++){ Point2D difference = clickedPoint - m_points[i]->getPosition(); double distance = hypot(difference.x, difference.y); if(distance < minDistance){ minDistance = distance; minIndex = i; } } if(minDistance < 0.2){ m_currentPoint = m_points[minIndex]; m_supportRenderer->setLaserPoints(&m_currentPoint->getSupport()); m_supportRenderer->setColor(m_colors[minIndex]); m_polarRenderer->setColor(m_colors[minIndex]); } else { m_currentPoint = NULL; } } drawDescriptor(); }
/** * {@inheritDoc} */ void showList(DATA_STRUCTURE *param, int n_args, va_list opt_par, int str) { int k = 0; bControl = 0; first = param; DATA_STRUCTURE* vetor_node[n_args]; for(k = 0; k < n_args; k++) vetor_node[k] = va_arg(opt_par, DATA_STRUCTURE*); va_end(opt_par); setTitle($LIST_NAME); x_list = 0; y_list = getScreenHeight() / 2- $NODE_LIST_HEIGHT * 2; first_box = $NODE_LIST_WIDTH/2; aux_red_list = getNodeRedColor() == -1 ? $NODE_LIST_RED : getNodeRedColor(); aux_green_list = getNodeGreenColor() == -1 ? $NODE_LIST_GREEN : getNodeGreenColor(); aux_blue_list = getNodeBlueColor() == -1 ? $NODE_LIST_BLUE : getNodeBlueColor(); setAllegroColorList(-1,-1,-1); structure = (str ==$LISTA_DESCRITOR); if (structure == 1) drawDescriptor(param, box_list, n_args, vetor_node); else doProcessList(param, box_list, n_args, vetor_node); waitToContinue(); }
void FLIRTDemo::updateDescriptor(){ for(unsigned int i = 0; i < m_points.size(); i++){ m_points[i]->setDescriptor(m_chooserD->getCurrentDescriptor()->describe(*m_points[i], *m_reading)); } drawDescriptor(); }