void swissArmyLocatorManip::draw(M3dView & view, const MDagPath &path, M3dView::DisplayStyle style, M3dView::DisplayStatus status) { MPxManipContainer::draw(view, path, style, status); view.beginGL(); MPoint textPos = nodeTranslation(); char str[100]; sprintf(str, "Swiss Army Manipulator"); MString distanceText(str); view.drawText(distanceText, textPos, M3dView::kLeft); view.endGL(); }
void Display::draw() { for (CityLocation city : this->cities) { sf::CircleShape city_image(CITY_SIZE); city_image.setFillColor(sf::Color::Transparent); city_image.setOutlineThickness(CITY_OUTLINE_THICKNESS); city_image.setOutlineColor(sf::Color::Black); sf::Vector2f cityPos = this->transformCoordinateSystem(city.second); city_image.setPosition(cityPos.x - CITY_SIZE/2, cityPos.y - CITY_SIZE/2); this->window->draw(city_image); } this->accessTour.lock(); path tour = *(this->currentTour); this->accessTour.unlock(); for (Graph::Edge e : tour) { if (e.startVertex == NULL || e.endVertex == NULL || e.startVertex->name.empty() || e.endVertex->name.empty()) continue; sf::Vector2f edge[] = { this->transformCoordinateSystem(this->cityMap[e.startVertex->name].second), this->transformCoordinateSystem(this->cityMap[e.endVertex->name].second) }; sfLine line(edge[0], edge[1], sf::Color::Black, EDGE_THICKNESS); this->window->draw(line); } sf::Text temp("Temperature " + std::to_string(this->temperature), *(this->font)); temp.setColor(sf::Color::Black); temp.setPosition(10, 10); sf::Text distanceText("Distance " + std::to_string(this->distance), *(this->font)); distanceText.setColor(sf::Color::Black); distanceText.setPosition(10, HEIGHT - 35); if (temperature != -1.0) this->window->draw(temp); if (distance != -1.0) this->window->draw(distanceText); }