SliceCameraInteractionHandler::SliceCameraInteractionHandler(const std::string& id, const std::string& guiName, CameraProperty* cameraProp, bool sharing, bool enabled) : InteractionHandler(id, guiName) , cameraProp_(cameraProp) { tgtAssert(cameraProp, "No camera property"); zoomEvent_ = new EventProperty<SliceCameraInteractionHandler>(id + ".zoom", "Zoom", this, &SliceCameraInteractionHandler::zoomEvent, MouseEvent::MOUSE_BUTTON_RIGHT, MouseEvent::ACTION_ALL, tgt::Event::MODIFIER_NONE, sharing, enabled); addEventProperty(zoomEvent_); shiftEvent_ = new EventProperty<SliceCameraInteractionHandler>(id + ".shift", "Shift", this, &SliceCameraInteractionHandler::shiftEvent, MouseEvent::MOUSE_BUTTON_LEFT, MouseEvent::ACTION_ALL, tgt::Event::SHIFT, sharing, enabled); addEventProperty(shiftEvent_); wheelZoomEvent_ = new EventProperty<SliceCameraInteractionHandler>(id + ".wheelZoom", "Wheel Zoom", this, &SliceCameraInteractionHandler::zoomEvent, MouseEvent::MOUSE_WHEEL, MouseEvent::WHEEL, tgt::Event::SHIFT, sharing, enabled); addEventProperty(wheelZoomEvent_); }
TNMParallelCoordinates::TNMParallelCoordinates() : RenderProcessor() , _inport(Port::INPORT, "in.data") , _outport(Port::OUTPORT, "out.image") , _privatePort(Port::OUTPORT, "private.image", false, Processor::INVALID_RESULT, GL_RGBA32F) , _pickedHandle(-1) , _brushingIndices("brushingIndices", "Brushing Indices") , _linkingIndices("linkingIndices", "Linking Indices") { addPort(_inport); addPort(_outport); addPrivateRenderPort(_privatePort); addProperty(_brushingIndices); addProperty(_linkingIndices); _mouseClickEvent = new EventProperty<TNMParallelCoordinates>( "mouse.click", "Mouse Click", this, &TNMParallelCoordinates::handleMouseClick, tgt::MouseEvent::MOUSE_BUTTON_LEFT, tgt::MouseEvent::CLICK, tgt::Event::MODIFIER_NONE); addEventProperty(_mouseClickEvent); _mouseClickEvent = new EventProperty<TNMParallelCoordinates>( "mouse.rightclick", "Mouse Right Click", this, &TNMParallelCoordinates::handleMouseClick, tgt::MouseEvent::MOUSE_BUTTON_RIGHT, tgt::MouseEvent::CLICK, tgt::Event::MODIFIER_NONE); addEventProperty(_mouseClickEvent); _mouseMoveEvent = new EventProperty<TNMParallelCoordinates>( "mouse.move", "Mouse Move", this, &TNMParallelCoordinates::handleMouseMove, tgt::MouseEvent::MOUSE_BUTTON_LEFT, tgt::MouseEvent::MOTION, tgt::Event::MODIFIER_NONE); addEventProperty(_mouseMoveEvent); _mouseReleaseEvent = new EventProperty<TNMParallelCoordinates>( "mouse.release", "Mouse Release", this, &TNMParallelCoordinates::handleMouseRelease, tgt::MouseEvent::MOUSE_BUTTON_LEFT, tgt::MouseEvent::RELEASED, tgt::Event::MODIFIER_NONE); addEventProperty(_mouseReleaseEvent); // Create AxisHandles here with a unique id _handles.push_back(AxisHandle(AxisHandle::AxisHandlePositionBottom, 0, tgt::vec2(-1.f, -1.0f))); _handles.push_back(AxisHandle(AxisHandle::AxisHandlePositionTop, 1, tgt::vec2(-1.f, 1.0f))); _handles.push_back(AxisHandle(AxisHandle::AxisHandlePositionBottom, 2, tgt::vec2(-1.0/3, -1.0f))); _handles.push_back(AxisHandle(AxisHandle::AxisHandlePositionTop, 3, tgt::vec2(-1.0/3, 1.0f))); _handles.push_back(AxisHandle(AxisHandle::AxisHandlePositionBottom, 4, tgt::vec2(1.0/3, -1.0f))); _handles.push_back(AxisHandle(AxisHandle::AxisHandlePositionTop, 5, tgt::vec2(1.0/3, 1.0f))); _handles.push_back(AxisHandle(AxisHandle::AxisHandlePositionBottom, 6, tgt::vec2(1.f, -1.0f))); _handles.push_back(AxisHandle(AxisHandle::AxisHandlePositionTop, 7, tgt::vec2(1.f, 1.0f))); }
LinePlot::LinePlot() : PlotProcessor(PlotEntitySettings::LINE, false) , lineWidth_("lineWidth", "Line Width", 2.f, 1.f, 5.f) , pointSize_("pointSize", "Point Size", 2.f, 1.f, 9.f) , logXAxis_("logXAxes", "Logarithmic x Axis", false) , logYAxis_("logYAxes", "Logarithmic y Axis", false) , renderLineLabel_("renderLineLabel", "Line Labels", false) , dataList_(0) , pickingList_(0) { plotEntitiesProp_.setGuiName("Line Data"); addProperty(selectionPlaneColor_); addProperty(renderMousePosition_); addProperty(discreteStep_); addProperty(renderXHelperLines_); addProperty(renderYHelperLines_); addProperty(logXAxis_); addProperty(logYAxis_); addProperty(renderLineLabel_); addProperty(lineWidth_); addProperty(pointSize_); addProperty(xScaleStep_); addProperty(yScaleStep_); addProperty(marginLeft_); addProperty(marginRight_); addProperty(marginBottom_); addProperty(marginTop_); // group properties renderLineLabel_.setGroupID("line"); lineWidth_.setGroupID("line"); pointSize_.setGroupID("line"); setPropertyGroupGuiName("line", "Line Settings"); logXAxis_.setGroupID("axis"); logYAxis_.setGroupID("axis"); addEventProperty(eventHighlight_); addEventProperty(eventLabel_); addEventProperty(eventZoom_); addEventProperty(eventHighlightAdditive_); addEventProperty(eventLabelAdditive_); addEventProperty(eventZoomAdditive_); addEventProperty(mousePositionUpdateEvent_); addEventProperty(mouseEventEnterExit_); //if one of the following properties is changed we handle it like plot entities property is changed logXAxis_.onChange (CallMemberAction<LinePlot>(this, &LinePlot::regenDisplayLists)); logYAxis_.onChange (CallMemberAction<LinePlot>(this, &LinePlot::regenDisplayLists)); renderLineLabel_.onChange(CallMemberAction<LinePlot>(this, &LinePlot::regenDisplayLists)); lineWidth_.onChange (CallMemberAction<LinePlot>(this, &LinePlot::regenDisplayLists)); pointSize_.onChange (CallMemberAction<LinePlot>(this, &LinePlot::regenDisplayLists)); }
BarPlot::BarPlot() : PlotProcessor(PlotEntitySettings::BAR, false) , barWidth_("barWidth", "Bar Width", 70, 1, 100) , shear_("shear", "Shear", tgt::vec2(35,70), tgt::vec2(0,0), tgt::vec2(100,100)) , squeezeFactor_("squeezeFactor", "Squeeze Factor", 0.9,0.1,0.95) , barMode_("barMode", "Bar Mode") { plotEntitiesProp_.setGuiName("Bar Data"); barMode_.addOption("groupedBar", "Grouped Bar", PlotLibrary::GROUPED); barMode_.addOption("stackedBar", "Stacked Bar", PlotLibrary::STACKED); barMode_.addOption("mergedBar", "Merged Bar", PlotLibrary::MERGED); addProperty(barMode_); selectionProp_.setEnableZoomToFlags(false); addProperty(barWidth_); addProperty(shear_); addProperty(squeezeFactor_); squeezeFactor_.setVisible(false); addProperty(renderYHelperLines_); addProperty(yScaleStep_); addProperty(marginLeft_); addProperty(marginRight_); addProperty(marginBottom_); addProperty(marginTop_); // group properties barMode_.setGroupID("bar"); barWidth_.setGroupID("bar"); shear_.setGroupID("bar"); squeezeFactor_.setGroupID("bar"); setPropertyGroupGuiName("bar", "Bar Settings"); addEventProperty(eventHighlight_); addEventProperty(eventLabel_); addEventProperty(eventHighlightAdditive_); addEventProperty(eventLabelAdditive_); barMode_.onChange(CallMemberAction<BarPlot>(this, &BarPlot::toggleProperties)); barMode_.onChange(CallMemberAction<BarPlot>(this, &BarPlot::calcDomains)); }
PlotCameraInteractionHandler::PlotCameraInteractionHandler(const std::string& id, const std::string& guiName, CameraProperty* cameraProp, bool sharing, bool enabled) : InteractionHandler(id, guiName) , cameraProp_(cameraProp) { tgtAssert(cameraProp, "No camera property"); cameraProp_ = cameraProp; // event property rotateEvent_ = new EventProperty<PlotCameraInteractionHandler>(id + ".rotate", guiName + " Rotate", this, &PlotCameraInteractionHandler::rotateEvent, tgt::MouseEvent::MOUSE_BUTTON_LEFT, tgt::MouseEvent::ACTION_ALL, tgt::Event::MODIFIER_NONE, sharing, enabled); addEventProperty(rotateEvent_); }
InteractionHandler::InteractionHandler(const std::string& id, const std::string& guiName, tgt::MouseEvent::MouseButtons mouseButtons, tgt::MouseEvent::MouseAction mouseAction, tgt::KeyEvent::KeyCode keycode, tgt::Event::Modifier modifier, bool shareEvents, bool enabled) : tgt::EventListener(), owner_(0), id_(id), guiName_(guiName) { tgtAssert(!id.empty(), "InteractionHandler id must not be empty"); addEventProperty(new EventProperty<InteractionHandler>(id, guiName, this, &InteractionHandler::onEvent, mouseButtons, mouseAction, keycode, modifier, shareEvents, enabled)); }
InteractionHandler::InteractionHandler(const std::string& id, const std::string& guiName, tgt::KeyEvent::KeyCode keycode, tgt::Event::Modifier modifier, bool shareEvents, bool enabled) : tgt::EventListener(), owner_(0), id_(id), guiName_(guiName) { tgtAssert(!id.empty(), "InteractionHandler id must not be empty"); EventPropertyBase* eventProp = new EventProperty<InteractionHandler>(id, guiName, this, &InteractionHandler::onEvent, tgt::MouseEvent::MOUSE_BUTTON_NONE, tgt::MouseEvent::ACTION_NONE, keycode, modifier, shareEvents, enabled); eventProp->setReceivesMouseEvents(false); addEventProperty(eventProp); }
InteractionHandler::InteractionHandler(const std::string& id, const std::string& guiName, tgt::MouseEvent::MouseButtons mouseButtons, tgt::MouseEvent::MouseAction mouseAction, tgt::Event::Modifier modifier, bool shareEvents, bool enabled) : tgt::EventListener() , owner_(0) , id_(id) , guiName_(guiName) { tgtAssert(!id.empty(), "InteractionHandler id must not be empty"); EventPropertyBase* eventProp = new EventProperty<InteractionHandler>(id, guiName, this, &InteractionHandler::onEvent, mouseButtons, mouseAction, tgt::KeyEvent::K_UNKNOWN, modifier, shareEvents, enabled); eventProp->setReceivesKeyEvents(false); addEventProperty(eventProp); }
TouchEventSimulator::TouchEventSimulator() : ImageProcessor("copyimage") , inport_(Port::INPORT, "inport", "Inport") , outport_(Port::OUTPORT, "outport", "Outport") { //register ports addPort(inport_); addPort(outport_); mouseEventProp_ = new EventProperty<TouchEventSimulator>( "toucheventsimulator.event", "Mouse Event", this, &TouchEventSimulator::onMouseEvent, tgt::MouseEvent::MOUSE_BUTTON_LEFT, tgt::MouseEvent::PRESSED | tgt::MouseEvent::RELEASED | tgt::MouseEvent::MOTION, tgt::Event::CTRL); addEventProperty(mouseEventProp_); shaderProp_.setVisible(false); }
TextOverlay::TextOverlay() : ImageProcessor("textoverlay") , inport_(Port::INPORT, "image.input", "Image Input") , outport_(Port::OUTPORT, "image.output", "Image Output") , privatePort_(Port::OUTPORT, "image.tmp") , text0_(Port::INPORT, "text.text0", "Text0 Input", true) , text1_(Port::INPORT, "text.text1", "Text1 Input", true) , text2_(Port::INPORT, "text.text2", "Text2 Input", true) , text3_(Port::INPORT, "text.text3", "Text3 Input", true) , enabled_("enabled", "Enabled", true) , layout0_("layout0", "Text position 1:") , layout1_("layout1", "Text position 2:") , layout2_("layout2", "Text position 3:") , layout3_("layout3", "Text position 4:") #ifdef _MSC_VER #pragma warning(disable:4355) // passing 'this' is safe here #endif , mouseMoveEventProp_("mouseEvent.move", "Move Event", this, &TextOverlay::mouseMove, tgt::MouseEvent::MOUSE_BUTTON_NONE, tgt::MouseEvent::MOTION, tgt::MouseEvent::MODIFIER_NONE) #ifdef _MSC_VER #pragma warning(disable:4355) // passing 'this' is safe here #endif , mouseEnterExitEventProp_("mouseEvent.EnterExit", "Enter/Exit Event", this, &TextOverlay::mouseEnterExit, tgt::MouseEvent::MOUSE_BUTTON_NONE, tgt::MouseEvent::ENTER_EXIT, tgt::MouseEvent::MODIFIER_NONE) , viewportSize_(0,0) , mousePos_(0,0) , fontProp_("voreen.fontprop", "Font:") , blendMode_("blendMode","Color Mode:") , fontColor_("fontColor","Color of Font:",tgt::vec4(1.0f)) , renderFollowMouseText_(false) { addPort(inport_); addPort(outport_); addPrivateRenderPort(&privatePort_); addPort(text0_); addPort(text1_); addPort(text2_); addPort(text3_); std::vector<Option<std::string> > options; options.push_back(Option<std::string>("FOLLOW", "Follow mouse", "")); options.push_back(Option<std::string>("N", "North", "")); options.push_back(Option<std::string>("NE", "North-East", "")); options.push_back(Option<std::string>("E", "East", "")); options.push_back(Option<std::string>("SE", "South-East", "")); options.push_back(Option<std::string>("S", "South", "")); options.push_back(Option<std::string>("SW", "South-West", "")); options.push_back(Option<std::string>("W", "West", "")); options.push_back(Option<std::string>("NW", "North-West", "")); options.push_back(Option<std::string>("CENTER", "Center", "")); layout0_.setOptions(options); layout0_.select("NW"); layout1_.setOptions(options); layout1_.select("NW"); layout2_.setOptions(options); layout2_.select("NW"); layout3_.setOptions(options); layout3_.select("NW"); blendMode_.addOption("auto","Inverse Color of Background",0); blendMode_.addOption("fix","Chosen Color",1); blendMode_.select("auto"); blendMode_.onChange(CallMemberAction<TextOverlay>(this, &TextOverlay::blendModeOnChange)); fontColor_.setViews(Property::COLOR); addProperty(enabled_); addProperty(layout0_); addProperty(layout1_); addProperty(layout2_); addProperty(layout3_); addEventProperty(mouseMoveEventProp_); addEventProperty(mouseEnterExitEventProp_); addProperty(fontProp_); addProperty(blendMode_); addProperty(fontColor_); blendModeOnChange(); }
CameraInteractionHandler::CameraInteractionHandler(const std::string& id, const std::string& guiName, CameraProperty* cameraProp, bool sharing, bool enabled) : InteractionHandler(id, guiName) , cameraProp_(cameraProp) , navigationMetaphor_(id + ".interactionMetaphor", guiName + " Interaction", Processor::VALID) { tgtAssert(cameraProp, "No camera property"); cameraProp_ = cameraProp; navigationMetaphor_.addOption("trackball", "Trackball", TRACKBALL); navigationMetaphor_.addOption("first-person", "First-Person", FIRST_PERSON); navigationMetaphor_.select("trackball"); navigationMetaphor_.onChange(CallMemberAction<CameraInteractionHandler>(this, &CameraInteractionHandler::adjustWidgetStates)); addProperty(navigationMetaphor_); // navigations tbNavi_ = new TrackballNavigation(cameraProp_, TrackballNavigation::ROTATE_MODE); fpNavi_ = new FirstPersonNavigation(cameraProp_); // event properties trackball multiTouchEvent_ = new EventProperty<CameraInteractionHandler>(id + ".multitouch", guiName + "Multitouch", this, &CameraInteractionHandler::handleMultitouch, sharing, enabled); addEventProperty(multiTouchEvent_); rotateEvent_ = new EventProperty<CameraInteractionHandler>(id + ".rotate", guiName + " Rotate", this, &CameraInteractionHandler::rotateEvent, MouseEvent::MOUSE_BUTTON_LEFT, MouseEvent::ACTION_ALL, tgt::Event::MODIFIER_NONE, sharing, enabled); addEventProperty(rotateEvent_); zoomEvent_ = new EventProperty<CameraInteractionHandler>(id + ".zoom", guiName + " Zoom", this, &CameraInteractionHandler::zoomEvent, MouseEvent::MOUSE_BUTTON_RIGHT, MouseEvent::ACTION_ALL, tgt::Event::MODIFIER_NONE, sharing, enabled); addEventProperty(zoomEvent_); shiftEvent_ = new EventProperty<CameraInteractionHandler>(id + ".shift", guiName + " Shift", this, &CameraInteractionHandler::shiftEvent, MouseEvent::MOUSE_BUTTON_LEFT, MouseEvent::ACTION_ALL, tgt::Event::SHIFT, sharing, enabled); addEventProperty(shiftEvent_); wheelZoomEvent_ = new EventProperty<CameraInteractionHandler>(id + ".wheelZoom", guiName + " Wheel Zoom", this, &CameraInteractionHandler::zoomEvent, MouseEvent::MOUSE_WHEEL, MouseEvent::WHEEL, tgt::Event::MODIFIER_NONE, sharing, enabled); addEventProperty(wheelZoomEvent_); // event properties first-person navigation moveForwardEvent_ = new EventProperty<CameraInteractionHandler>(id + ".moveForward", guiName + " Move Forward", this, &CameraInteractionHandler::keyEvent, tgt::KeyEvent::K_W, tgt::Event::MODIFIER_NONE, sharing, enabled); moveForwardEvent_->onChange(&CameraInteractionHandler::updateFpKeySettings); addEventProperty(moveForwardEvent_); moveLeftEvent_ = new EventProperty<CameraInteractionHandler>(id + ".moveLeft", guiName + " Move Left", this, &CameraInteractionHandler::keyEvent, tgt::KeyEvent::K_A, tgt::Event::MODIFIER_NONE, sharing, enabled); moveLeftEvent_->onChange(&CameraInteractionHandler::updateFpKeySettings); addEventProperty(moveLeftEvent_); moveBackwardEvent_ = new EventProperty<CameraInteractionHandler>(id + ".moveBackward", guiName + " Move Backward", this, &CameraInteractionHandler::keyEvent, tgt::KeyEvent::K_S, tgt::Event::MODIFIER_NONE, sharing, enabled); moveBackwardEvent_->onChange(&CameraInteractionHandler::updateFpKeySettings); addEventProperty(moveBackwardEvent_); moveRightEvent_ = new EventProperty<CameraInteractionHandler>(id + ".moveRight", guiName + " Move Right", this, &CameraInteractionHandler::keyEvent, tgt::KeyEvent::K_D, tgt::Event::MODIFIER_NONE, sharing, enabled); moveRightEvent_->onChange(&CameraInteractionHandler::updateFpKeySettings); addEventProperty(moveRightEvent_); moveUpEvent_ = new EventProperty<CameraInteractionHandler>(id + ".moveUp", guiName + " Move Up", this, &CameraInteractionHandler::keyEvent, tgt::KeyEvent::K_R, tgt::Event::MODIFIER_NONE, sharing, enabled); moveUpEvent_->onChange(&CameraInteractionHandler::updateFpKeySettings); addEventProperty(moveUpEvent_); moveDownEvent_ = new EventProperty<CameraInteractionHandler>(id + ".moveDown", guiName + " Move Down", this, &CameraInteractionHandler::keyEvent, tgt::KeyEvent::K_F, tgt::Event::MODIFIER_NONE, sharing, enabled); moveDownEvent_->onChange(&CameraInteractionHandler::updateFpKeySettings); addEventProperty(moveDownEvent_); // timer timerEventHandler_ = new tgt::EventHandler; motionTimer_ = VoreenApplication::app()->createTimer(timerEventHandler_); tgtAssert(timerEventHandler_, "No timerEventHandler"); timerEventHandler_->addListenerToFront(this); adjustWidgetStates(); }
//---------------------------------------------------------------------------------------------------------------------------------------------------------------- TNMParallelCoordinates::TNMParallelCoordinates() : RenderProcessor() , _inport(Port::INPORT, "in.data") , _outport(Port::OUTPORT, "out.image") , _privatePort(Port::OUTPORT, "private.image", false, Processor::INVALID_RESULT, GL_RGBA32F) , _pickedHandle(-1) , _font("font", "Font") , _colorMethod("colorMethod", "Coloring Method") , _brushingIndices("brushingIndices", "Brushing Indices") , _linkingIndices("linkingIndices", "Linking Indices") { //---------------------------------------------------------------------------------------------------------------------------------------------------------------- addPort(_inport); addPort(_outport); addPrivateRenderPort(_privatePort); addProperty(_font); addProperty(_colorMethod); // // Create AxisHandles here with a unique id // _handles.push_back(AxisHandle(AxisHandle::AxisHandlePositionTop, 0, /* fix startposition */)); // ... // addProperty(_brushingIndices); addProperty(_linkingIndices); _mouseClickEvent = new EventProperty<TNMParallelCoordinates>( "mouse.click", "Mouse Click", this, &TNMParallelCoordinates::handleMouseClick, tgt::MouseEvent::MOUSE_BUTTON_LEFT, tgt::MouseEvent::CLICK, tgt::Event::MODIFIER_NONE); addEventProperty(_mouseClickEvent); _mouseClickEventRight = new EventProperty<TNMParallelCoordinates>( "mouseright.click", "Mouse Right Click", this, &TNMParallelCoordinates::handleMouseClickRight, tgt::MouseEvent::MOUSE_BUTTON_RIGHT, tgt::MouseEvent::CLICK, tgt::Event::MODIFIER_NONE); addEventProperty(_mouseClickEventRight); _mouseMoveEvent = new EventProperty<TNMParallelCoordinates>( "mouse.move", "Mouse Move", this, &TNMParallelCoordinates::handleMouseMove, tgt::MouseEvent::MOUSE_BUTTON_LEFT, tgt::MouseEvent::MOTION, tgt::Event::MODIFIER_NONE); addEventProperty(_mouseMoveEvent); _mouseReleaseEvent = new EventProperty<TNMParallelCoordinates>( "mouse.release", "Mouse Release", this, &TNMParallelCoordinates::handleMouseRelease, tgt::MouseEvent::MOUSE_BUTTON_LEFT, tgt::MouseEvent::RELEASED, tgt::Event::MODIFIER_NONE); addEventProperty(_mouseReleaseEvent); // Create AxisHandles here with a unique id float x_width = 1.8f / (NUM_DATA_VALUES - 1); float x_pos = -0.9f; for( int i = 0; i < 6; i++) { _handles.push_back(AxisHandle(AxisHandle::AxisHandlePositionTop, i, tgt::vec2(x_pos, 0.9f))); x_pos += x_width; } x_pos = -0.9f; for( int i = 6; i < 12; i++) { _handles.push_back(AxisHandle(AxisHandle::AxisHandlePositionBottom, i, tgt::vec2(x_pos, -0.9f))); x_pos += x_width; } }
ButtonOverlayProcessor::ButtonOverlayProcessor() : ImageProcessor("image/compositor") , inport_(Port::INPORT, "image.input") , outport_(Port::OUTPORT, "image.output", "image.output", true, Processor::INVALID_PROGRAM, RenderPort::RENDERSIZE_DEFAULT, GL_RGBA) , overlayPort_(Port::OUTPORT, "image.overlay", "image.overlay", true, Processor::INVALID_RESULT, RenderPort::RENDERSIZE_DEFAULT, GL_RGBA) , pickingPort_(Port::OUTPORT, "image.picking", "image.picking", true, Processor::INVALID_RESULT, RenderPort::RENDERSIZE_DEFAULT, GL_RGBA) , buttonRadiusX_("buttonRadiusX", "Button Size X", 20, 1, 100) , buttonRadiusY_("buttonRadiusY", "Button Size Y", 20, 1, 100) , groupBorder_("groupBorder", "Border between Buttons", 5, 0, 30) , horzBorder_("horzBorder", "Distance from left/right Border", 30, 0, 1000) , vertBorder_("vertBorder", "Distance from top/bottom Border", 100, 0, 1000) , fontSize_("fontSize", "Font size", 12, 1, 48) , opacity_("opacity", "Opacity", 1.0f) , pushButtonMode_("pushButtonMode", "Use pushbutton mode", false) #ifdef _MSC_VER #pragma warning(disable:4355) // passing 'this' is safe here #endif , buttonChecker_("mouseEvent.clickButton", "Clicking Button", this, &ButtonOverlayProcessor::onMouseClick, tgt::MouseEvent::MOUSE_BUTTON_LEFT, tgt::MouseEvent::PRESSED | tgt::MouseEvent::MOTION | tgt::MouseEvent::RELEASED, tgt::Event::MODIFIER_NONE) , buttonTexturePressed_(0) , buttonTextureReleased_(0) , buttonProps_() , pushButtonProps_() , isVisibleProps_() , nameProps_() , regenerateOverlay_(false) , oldSize_(tgt::ivec2(0)) { addEventProperty(buttonChecker_); addPort(inport_); addPort(outport_); addPrivateRenderPort(&overlayPort_); addPrivateRenderPort(&pickingPort_); addProperty(horzBorder_); addProperty(vertBorder_); addProperty(buttonRadiusX_); addProperty(buttonRadiusY_); addProperty(groupBorder_); addProperty(opacity_); addProperty(fontSize_); addProperty(pushButtonMode_); buttonRadiusX_.onChange(CallMemberAction<ButtonOverlayProcessor>(this, &ButtonOverlayProcessor::onOverlayChange)); buttonRadiusY_.onChange(CallMemberAction<ButtonOverlayProcessor>(this, &ButtonOverlayProcessor::onOverlayChange)); opacity_.onChange(CallMemberAction<ButtonOverlayProcessor>(this, &ButtonOverlayProcessor::onOverlayChange)); groupBorder_.onChange(CallMemberAction<ButtonOverlayProcessor>(this, &ButtonOverlayProcessor::onOverlayChange)); horzBorder_.onChange(CallMemberAction<ButtonOverlayProcessor>(this, &ButtonOverlayProcessor::onOverlayChange)); vertBorder_.onChange(CallMemberAction<ButtonOverlayProcessor>(this, &ButtonOverlayProcessor::onOverlayChange)); fontSize_.onChange(CallMemberAction<ButtonOverlayProcessor>(this, &ButtonOverlayProcessor::onOverlayChange)); for(size_t i = 0; i < 5; i++) { std::ostringstream os1, os2, os3, os4, os5, os6, os7, os8, os9; os1 << "showProp" << i; os2 << "Show Button No. " << i + 1; isVisibleProps_.push_back(new BoolProperty(os1.str(), os2.str(), false)); isVisibleProps_.back()->onChange(CallMemberAction<ButtonOverlayProcessor>(this, &ButtonOverlayProcessor::onOverlayChange)); addProperty(isVisibleProps_.back()); os3 << "buttonProp" << i; os4 << "Button Property " << i + 1; buttonProps_.push_back(new BoolProperty(os3.str(), os4.str(), false)); buttonProps_.back()->onChange(CallMemberAction<ButtonOverlayProcessor>(this, &ButtonOverlayProcessor::onOverlayChange)); addProperty(buttonProps_.back()); os5 << "nameProp" << i; os6 << "Button Name Property " << i + 1; os7 << "Button " << i + 1; nameProps_.push_back(new StringProperty(os5.str(), os6.str(), os7.str())); nameProps_.back()->onChange(CallMemberAction<ButtonOverlayProcessor>(this, &ButtonOverlayProcessor::onOverlayChange)); addProperty(nameProps_.back()); os8 << "pushButtonProp" << i; os9 << "Pushbutton Property " << i + 1; pushButtonProps_.push_back(new ButtonProperty(os8.str(), os9.str())); addProperty(pushButtonProps_.back()); } font_ = new tgt::Font(VoreenApplication::app()->getFontPath("Vera.ttf"), 12, tgt::Font::BitmapFont); //font_ = new tgt::Font(VoreenApplication::app()->getFontPath("VeraMono.ttf"), 12, tgt::BitmapFont); }
void Processor::addEventProperty(EventPropertyBase& prop) { addEventProperty(&prop); }