TargetVisualizerDisplay::TargetVisualizerDisplay(): message_recieved_(false) { target_name_property_ = new rviz::StringProperty( "target name", "target", "name of the target", this, SLOT(updateTargetName()) ); radius_property_ = new rviz::FloatProperty( "radius", 1.0, "radius of the target mark", this, SLOT(updateRadius())); radius_property_->setMin(0.0); alpha_property_ = new rviz::FloatProperty( "alpha", 0.8, "0 is fully transparent, 1.0 is fully opaque.", this, SLOT(updateAlpha())); alpha_property_->setMin(0.0); alpha_property_->setMax(1.0); color_property_ = new rviz::ColorProperty( "color", QColor(25, 255, 240), "color of the target", this, SLOT(updateColor())); shape_type_property_ = new rviz::EnumProperty( "type", "Simple Circle", "Shape to display the pose as", this, SLOT(updateShapeType())); shape_type_property_->addOption("Simple Circle", SimpleCircle); shape_type_property_->addOption("Decoreted Circle", GISCircle); }
RobotModelDisplay::RobotModelDisplay() : Display() , has_new_transforms_( false ) , time_since_last_transform_( 0.0f ) { visual_enabled_property_ = new Property( "Visual Enabled", true, "Whether to display the visual representation of the robot.", this, SLOT( updateVisualVisible() )); collision_enabled_property_ = new Property( "Collision Enabled", false, "Whether to display the collision representation of the robot.", this, SLOT( updateCollisionVisible() )); update_rate_property_ = new FloatProperty( "Update Interval", 0, "Interval at which to update the links, in seconds. " " 0 means to update every update cycle.", this ); update_rate_property_->setMin( 0 ); alpha_property_ = new FloatProperty( "Alpha", 1, "Amount of transparency to apply to the links.", this, SLOT( updateAlpha() )); alpha_property_->setMin( 0.0 ); alpha_property_->setMax( 1.0 ); robot_description_property_ = new StringProperty( "Robot Description", "robot_description", "Name of the parameter to search for to load the robot description.", this, SLOT( updateRobotDescription() )); tf_prefix_property_ = new StringProperty( "TF Prefix", "", "Robot Model normally assumes the link name is the same as the tf frame name. " " This option allows you to set a prefix. Mainly useful for multi-robot situations.", this, SLOT( updateTfPrefix() )); }
void TargetVisualizerDisplay::updateShapeType() { if (current_type_ != shape_type_property_->getOptionInt()) { { boost::mutex::scoped_lock lock(mutex_); if (shape_type_property_->getOptionInt() == SimpleCircle) { current_type_ = SimpleCircle; // simple circle visualizer_.reset(new SimpleCircleFacingVisualizer( scene_manager_, scene_node_, context_, radius_)); } else { current_type_ = GISCircle; // GIS GISCircleVisualizer* v = new GISCircleVisualizer( scene_manager_, scene_node_, radius_); v->setAnonymous(false); visualizer_.reset(v); } } updateTargetName(); updateColor(); updateAlpha(); } }
DynamicRobotModel::DynamicRobotModel() : rviz::Display() , time_since_last_transform_( 0.0f ) { visual_enabled_property_ = new rviz::Property( "Visual Enabled", true, "Whether to display the visual representation of the robot.", this, SLOT( updateVisualVisible() )); collision_enabled_property_ = new rviz::Property( "Collision Enabled", false, "Whether to display the collision representation of the robot.", this, SLOT( updateCollisionVisible() )); update_rate_property_ = new rviz::FloatProperty( "Update Interval", 0, "Interval at which to update the links, in seconds. " " 0 means to update every update cycle.", this ); update_rate_property_->setMin( 0 ); alpha_property_ = new rviz::FloatProperty( "Alpha", 1, "Amount of transparency to apply to the links.", this, SLOT( updateAlpha() )); alpha_property_->setMin( 0.0 ); alpha_property_->setMax( 1.0 ); robot_description_topic_property_ = new rviz::RosTopicProperty( "Robot description topic", "dynamic_robot_description", QString::fromStdString( ros::message_traits::datatype<std_msgs::String>() ), "std_msgs::String topic to subscribe to.", this, SLOT( updateTopic() )); tf_prefix_property_ = new rviz::StringProperty( "TF Prefix", "", "Robot Model normally assumes the link name is the same as the tf frame name. " " This option allows you to set a prefix. Mainly useful for multi-robot situations.", this, SLOT( updateTfPrefix() )); }
void Slider::init() { mAllowLogic = false; setFocusable(true); setFrameSize(1); addMouseListener(this); addKeyListener(this); setFrameSize(0); // Load resources if (mInstances == 0) { if (theme) { for (int mode = 0; mode < 2; mode ++) theme->loadRect(buttons[mode], data[mode], "slider.xml", 0, 8); } updateAlpha(); } mInstances++; if (buttons[0].grid[HGRIP]) setMarkerLength(buttons[0].grid[HGRIP]->getWidth()); }
void Button::init() { setFrameSize(0); if (mInstances == 0) { // Load the skin ResourceManager *resman = ResourceManager::getInstance(); Image *btn[BUTTON_COUNT]; int a, x, y, mode; for (mode = 0; mode < BUTTON_COUNT; mode++) { btn[mode] = resman->getImage(data[mode].file); a = 0; for (y = 0; y < 3; y++) { for (x = 0; x < 3; x++) { button[mode].grid[a] = btn[mode]->getSubImage( data[x].gridX, data[y].gridY, data[x + 1].gridX - data[x].gridX + 1, data[y + 1].gridY - data[y].gridY + 1); a++; } } btn[mode]->decRef(); } updateAlpha(); } mInstances++; }
BoundingBoxDisplay::BoundingBoxDisplay() { coloring_property_ = new rviz::EnumProperty( "coloring", "Flat color", "coloring method", this, SLOT(updateColoring())); coloring_property_->addOption("Flat color", 0); coloring_property_->addOption("Label", 1); coloring_property_->addOption("Value", 2); color_property_ = new rviz::ColorProperty( "color", QColor(25, 255, 0), "color to draw the bounding boxes", this, SLOT(updateColor())); alpha_property_ = new rviz::FloatProperty( "alpha", 0.8, "alpha value to draw the bounding boxes", this, SLOT(updateAlpha())); only_edge_property_ = new rviz::BoolProperty( "only edge", false, "show only the edges of the boxes", this, SLOT(updateOnlyEdge())); line_width_property_ = new rviz::FloatProperty( "line width", 0.005, "line width of the edges", this, SLOT(updateLineWidth())); show_coords_property_ = new rviz::BoolProperty( "show coords", false, "show coordinate of bounding box", this, SLOT(updateShowCoords())); }
void QSkinObject::paintEvent(QPaintEvent *event) { if(skinWidget) { updateStyle(); QPainter p(&widgetMask); QObjectList ol = skinWidget->children(); foreach(QObject *o, ol) { if(o->isWidgetType()) { QWidget* child = dynamic_cast<QWidget*>(o); p.drawPixmap(child->geometry(),drawCtrl(child )); } } p.end(); #ifdef WIN32 updateAlpha(); #else p.begin(skinWidget); p.setRenderHint(QPainter::Antialiasing); p.drawPixmap(0,0,widgetMask); p.end(); #endif } }
RadioButton::RadioButton(const Widget2 *const widget, const std::string &caption, const std::string &group, const bool marked): gcn::RadioButton(caption, group, marked), Widget2(widget), mHasMouse(false), mPadding(0), mImagePadding(0), mImageSize(9), mSpacing(2), mForegroundColor2(getThemeColor(Theme::RADIOBUTTON_OUTLINE)) { mForegroundColor = getThemeColor(Theme::RADIOBUTTON); if (instances == 0) { if (Theme::instance()) { mSkin = Theme::instance()->load("radio.xml", ""); updateAlpha(); } } instances++; if (mSkin) { mPadding = mSkin->getPadding(); mImagePadding = mSkin->getOption("imagePadding"); mImageSize = mSkin->getOption("imageSize"); mSpacing = mSkin->getOption("spacing"); } adjustSize(); }
void Tab::init() { addMouseListener(this); setFocusable(false); setFrameSize(0); mFlash = 0; addWidgetListener(this); if (mInstances == 0) { // Load the skin Theme *const theme = Theme::instance(); if (theme) { for (int mode = 0; mode < TAB_COUNT; mode ++) tabImg[mode] = theme->load(data[mode], "tab.xml"); } updateAlpha(); } mInstances++; add(mLabel); const Skin *const skin = tabImg[TAB_STANDARD]; if (!skin) return; const int padding = skin->getPadding(); mLabel->setPosition(padding, padding); }
void Tab::draw(gcn::Graphics *graphics) { int mode = TAB_STANDARD; // check which type of tab to draw if (mTabbedArea) { mLabel->setForegroundColor(*mTabColor); if (mTabbedArea->isTabSelected(this)) { mode = TAB_SELECTED; // if tab is selected, it doesnt need to highlight activity mFlash = false; } else if (mHasMouse) { mode = TAB_HIGHLIGHTED; } if (mFlash) { mLabel->setForegroundColor(Theme::getThemeColor(Theme::TAB_FLASH)); } } updateAlpha(); // draw tab static_cast<Graphics*>(graphics)-> drawImageRect(0, 0, getWidth(), getHeight(), tabImg[mode]); // draw label drawChildren(graphics); }
void NumberAnimation::update() { if (m_bRunning) { if (m_currentParam != "") { if (m_currentParam == "scale") { updateScale(); } if (m_currentParam == "alpha") { updateAlpha(); } if (m_currentParam == "angle") { updateAngle(); } if (m_currentParam == "width") { updateWidth(); } } } }
FootstepDisplay::FootstepDisplay() { alpha_property_ = new rviz::FloatProperty( "Alpha", 0.5, "0 is fully transparent, 1.0 is fully opaque.", this, SLOT( updateAlpha() )); show_name_property_ = new rviz::BoolProperty( "Show Name", true, "Show name of each footstep", this, SLOT(updateShowName())); use_group_coloring_property_ = new rviz::BoolProperty( "Use Group Coloring", false, "Use footstep_group field to colorize footsteps", this, SLOT(updateUseGroupColoring())); width_property_ = new rviz::FloatProperty( "Width", 0.15, "width of the footstep, it's not used if the dimensions is specified in Footstep message.", this, SLOT( updateWidth() )); height_property_ = new rviz::FloatProperty( "height", 0.01, "height of the footstep, it's not used if the dimensions is specified in Footstep message.", this, SLOT( updateHeight() )); depth_property_ = new rviz::FloatProperty( "depth", 0.3, "depth of the footstep, it's not used if the dimensions is specified in Footstep message.", this, SLOT( updateDepth() )); }
bool Image::load(File* file) { initTable(); _width = 0; _height = 0; _bits = NULL; _flags = 0xFFFFFF; if (file) { bool loaded = false; file->seek(0, SEEK_SET); if (!loaded) loaded = loadGIF(file); file->seek(0, SEEK_SET); if (!loaded) loaded = loadPNG(file); file->seek(0, SEEK_SET); if (!loaded) loaded = loadTGA(file); file->seek(0, SEEK_SET); if (!loaded) loaded = loadBIN(file); file->seek(0, SEEK_SET); if (!loaded) loaded = loadBLP(file); file->seek(0, SEEK_SET); if (!loaded) loaded = loadBLP2(file); if (!loaded) { delete[] _bits; _bits = NULL; _width = 0; _height = 0; _flags = 0; } else updateAlpha(); return loaded; } return false; }
void Sbs2SourceReconstrucionLoreta::updateModel() { if(!modelUpdateReady) return; modelUpdateReady = 0; //TODO: signal when new beta and alpha are ready //qDebug() << "****"; //we collect only raw values and weight them right before updating the model w->multiply(currentModelUpdateValues,currentModelUpdateValuesVertices); //Sbs2Timer::tic("updateAlpha()"); updateAlpha(); //Sbs2Timer::toc(); //Sbs2Timer::tic("updateBeta()"); updateBeta(); //Sbs2Timer::toc(); //Sbs2Timer::tic("updateW()"); updateW(); //Sbs2Timer::toc(); modelUpdateReady = 1; tempModelUpdatedReady = 1; }
CameraDisplay::CameraDisplay() : ImageDisplayBase() , caminfo_tf_filter_( 0 ) , new_caminfo_( false ) , texture_() , render_panel_( 0 ) , force_render_( false ) , panel_container_( 0 ) { image_position_property_ = new EnumProperty( "Image Rendering", BOTH, "Render the image behind all other geometry or overlay it on top, or both.", this, SLOT( forceRender() )); image_position_property_->addOption( BACKGROUND ); image_position_property_->addOption( OVERLAY ); image_position_property_->addOption( BOTH ); alpha_property_ = new FloatProperty( "Overlay Alpha", 0.5, "The amount of transparency to apply to the camera image when rendered as overlay.", this, SLOT( updateAlpha() )); alpha_property_->setMin( 0 ); alpha_property_->setMax( 1 ); zoom_property_ = new FloatProperty( "Zoom Factor", 1.0, "Set a zoom factor below 1 to see a larger part of the world, above 1 to magnify the image.", this, SLOT( forceRender() )); zoom_property_->setMin( 0.00001 ); zoom_property_->setMax( 100000 ); }
void SparseOccupancyGridArrayDisplay::onInitialize() { MFDClass::onInitialize(); updateAlpha(); updateMaxColor(); updateMinColor(); }
OverlayImageDisplay::OverlayImageDisplay() : Display(), width_(128), height_(128), left_(128), top_(128), alpha_(0.8), is_msg_available_(false), require_update_(false) { // setup properties update_topic_property_ = new rviz::RosTopicProperty( "Topic", "", ros::message_traits::datatype<sensor_msgs::Image>(), "sensor_msgs::Image topic to subscribe to.", this, SLOT( updateTopic() )); keep_aspect_ratio_property_ = new rviz::BoolProperty("keep aspect ratio", false, "keep aspect ratio of original image", this, SLOT(updateKeepAspectRatio())); width_property_ = new rviz::IntProperty("width", 128, "width of the image window", this, SLOT(updateWidth())); height_property_ = new rviz::IntProperty("height", 128, "height of the image window", this, SLOT(updateHeight())); left_property_ = new rviz::IntProperty("left", 128, "left of the image window", this, SLOT(updateLeft())); top_property_ = new rviz::IntProperty("top", 128, "top of the image window", this, SLOT(updateTop())); alpha_property_ = new rviz::FloatProperty("alpha", 0.8, "alpha belnding value", this, SLOT(updateAlpha())); }
void Window::onKeyChangeRootFocus(bool _focus) { mKeyRootFocus = _focus; updateAlpha(); Base::onKeyChangeRootFocus(_focus); }
void CheckBox::drawBox(gcn::Graphics* graphics) { Image *box; if (isEnabled()) { if (isSelected()) { if (mHasMouse) box = checkBoxCheckedHi; else box = checkBoxChecked; } else { if (mHasMouse) box = checkBoxNormalHi; else box = checkBoxNormal; } } else { if (isSelected()) box = checkBoxDisabledChecked; else box = checkBoxDisabled; } updateAlpha(); static_cast<Graphics*>(graphics)->drawImage(box, 2, 2); }
void Window::onMouseChangeRootFocus(bool _focus) { mMouseRootFocus = _focus; updateAlpha(); Base::onMouseChangeRootFocus(_focus); }
void ScrollArea::draw(gcn::Graphics *graphics) { if (mVBarVisible) { drawUpButton(graphics); drawDownButton(graphics); drawVBar(graphics); drawVMarker(graphics); } if (mHBarVisible) { drawLeftButton(graphics); drawRightButton(graphics); drawHBar(graphics); drawHMarker(graphics); } if (mHBarVisible && mVBarVisible) { graphics->setColor(getBaseColor()); graphics->fillRectangle(gcn::Rectangle(getWidth() - mScrollbarWidth, getHeight() - mScrollbarWidth, mScrollbarWidth, mScrollbarWidth)); } updateAlpha(); drawChildren(graphics); }
void RobotModelDisplay::onInitialize() { robot_ = new Robot( scene_node_, context_, "Robot: " + getName().toStdString(), this ); updateVisualVisible(); updateCollisionVisible(); updateAlpha(); }
AerialMapDisplay::AerialMapDisplay() : Display(), map_id_(0), scene_id_(0), dirty_(false), received_msg_(false), loader_(0) { static unsigned int map_ids = 0; map_id_ = map_ids++; // global counter of map ids topic_property_ = new RosTopicProperty( "Topic", "", QString::fromStdString( ros::message_traits::datatype<sensor_msgs::NavSatFix>()), "nav_msgs::Odometry topic to subscribe to.", this, SLOT(updateTopic())); alpha_property_ = new FloatProperty( "Alpha", 0.7, "Amount of transparency to apply to the map.", this, SLOT(updateAlpha())); alpha_ = alpha_property_->getValue().toFloat(); alpha_property_->setMin(0); alpha_property_->setMax(1); alpha_property_->setShouldBeSaved(true); draw_under_property_ = new Property("Draw Behind", false, "Rendering option, controls whether or not the map is always" " drawn behind everything else.", this, SLOT(updateDrawUnder())); draw_under_property_->setShouldBeSaved(true); draw_under_ = draw_under_property_->getValue().toBool(); // output, resolution of the map in meters/pixel resolution_property_ = new FloatProperty( "Resolution", 0, "Resolution of the map. (Read only)", this); resolution_property_->setReadOnly(true); // properties for map object_uri_property_ = new StringProperty( "Object URI", "http://otile1.mqcdn.com/tiles/1.0.0/sat/{z}/{x}/{y}.jpg", "URL from which to retrieve map tiles.", this, SLOT(updateObjectURI())); object_uri_property_->setShouldBeSaved(true); object_uri_ = object_uri_property_->getStdString(); zoom_property_ = new IntProperty("Zoom", 16, "Zoom level (0 - 19 usually)", this, SLOT(updateZoom())); zoom_property_->setShouldBeSaved(true); zoom_ = zoom_property_->getInt(); blocks_property_ = new IntProperty("Blocks", 3, "Number of adjacent blocks (6 max)", this, SLOT(updateBlocks())); blocks_property_->setShouldBeSaved(true); // updating one triggers reload updateBlocks(); }
void BoundingBoxDisplay::onInitialize() { MFDClass::onInitialize(); scene_node_ = scene_manager_->getRootSceneNode()->createChildSceneNode(); updateColor(); updateAlpha(); updateOnlyEdge(); updateColoring(); updateLineWidth(); updateShowCoords(); }
void FootstepDisplay::onInitialize() { MFDClass::onInitialize(); scene_node_ = scene_manager_->getRootSceneNode()->createChildSceneNode(); line_ = new rviz::BillboardLine(context_->getSceneManager(), scene_node_); updateShowName(); updateWidth(); updateHeight(); updateDepth(); updateAlpha(); updateUseGroupColoring(); }
MapDisplay::MapDisplay() : Display() , manual_object_( NULL ) , loaded_( false ) , resolution_( 0.0f ) , width_( 0 ) , height_( 0 ) { connect(this, SIGNAL( mapUpdated() ), this, SLOT( showMap() )); topic_property_ = new RosTopicProperty( "Topic", "", QString::fromStdString( ros::message_traits::datatype<nav_msgs::OccupancyGrid>() ), "nav_msgs::OccupancyGrid topic to subscribe to.", this, SLOT( updateTopic() )); alpha_property_ = new FloatProperty( "Alpha", 0.7, "Amount of transparency to apply to the map.", this, SLOT( updateAlpha() )); alpha_property_->setMin( 0 ); alpha_property_->setMax( 1 ); color_scheme_property_ = new EnumProperty( "Color Scheme", "map", "How to color the occupancy values.", this, SLOT( updatePalette() )); // Option values here must correspond to indices in palette_textures_ array in onInitialize() below. color_scheme_property_->addOption( "map", 0 ); color_scheme_property_->addOption( "costmap", 1 ); draw_under_property_ = new Property( "Draw Behind", false, "Rendering option, controls whether or not the map is always" " drawn behind everything else.", this, SLOT( updateDrawUnder() )); resolution_property_ = new FloatProperty( "Resolution", 0, "Resolution of the map. (not editable)", this ); resolution_property_->setReadOnly( true ); width_property_ = new IntProperty( "Width", 0, "Width of the map, in meters. (not editable)", this ); width_property_->setReadOnly( true ); height_property_ = new IntProperty( "Height", 0, "Height of the map, in meters. (not editable)", this ); height_property_->setReadOnly( true ); position_property_ = new VectorProperty( "Position", Ogre::Vector3::ZERO, "Position of the bottom left corner of the map, in meters. (not editable)", this ); position_property_->setReadOnly( true ); orientation_property_ = new QuaternionProperty( "Orientation", Ogre::Quaternion::IDENTITY, "Orientation of the map. (not editable)", this ); orientation_property_->setReadOnly( true ); }
void draw(gcn::Graphics *graphics) { if (!mListModel) return; ServersListModel *model = static_cast<ServersListModel*>(mListModel); updateAlpha(); graphics->setColor(Theme::getThemeColor(Theme::HIGHLIGHT, (int) (mAlpha * 255.0f))); graphics->setFont(getFont()); const int height = getRowHeight(); const gcn::Color unsupported = Theme::getThemeColor(Theme::SERVER_VERSION_NOT_SUPPORTED, (int) (mAlpha * 255.0f)); // Draw filled rectangle around the selected list element if (mSelected >= 0) graphics->fillRectangle(gcn::Rectangle(0, height * mSelected, getWidth(), height)); // Draw the list elements for (int i = 0, y = 0; i < model->getNumberOfElements(); ++i, y += height) { ServerInfo info = model->getServer(i); graphics->setColor(Theme::getThemeColor(Theme::TEXT)); if (!info.name.empty()) { graphics->setFont(boldFont); graphics->drawText(info.name, 2, y); } graphics->setFont(getFont()); int top = y + height / 2; graphics->drawText(model->getElementAt(i), 2, top); if (info.version.first > 0) { graphics->setColor(unsupported); graphics->drawText(info.version.second, getWidth() - info.version.first - 2, top); } } }
void ProgressBar::draw(gcn::Graphics *graphics) { updateAlpha(); mColor.a = static_cast<int>(mAlpha * 255); gcn::Rectangle rect = getDimension(); rect.x = 0; rect.y = 0; render(static_cast<Graphics*>(graphics), rect, mColor, mProgress, mText, mVertexes, &mRedraw); }
void MapCloudDisplay::onInitialize() { MFDClass::onInitialize(); transformer_class_loader_ = new pluginlib::ClassLoader<rviz::PointCloudTransformer>( "rviz", "rviz::PointCloudTransformer" ); loadTransformers(); updateStyle(); updateBillboardSize(); updateAlpha(); spinner_.start(); }