本文整理汇总了C++中Point2D::Fill方法的典型用法代码示例。如果您正苦于以下问题:C++ Point2D::Fill方法的具体用法?C++ Point2D::Fill怎么用?C++ Point2D::Fill使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Point2D
的用法示例。
在下文中一共展示了Point2D::Fill方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
mitk::InteractionEvent::Pointer mitk::EventFactory::CreateEvent(PropertyList::Pointer list)
{
//
std::string eventClass, eventVariant;
list->GetStringProperty(InteractionEventConst::xmlParameterEventClass().c_str(), eventClass);
list->GetStringProperty(InteractionEventConst::xmlParameterEventVariant().c_str(), eventVariant);
// Query all possible attributes, if they are not present, set their default values.
// Position Events & Key Events
std::string strModifiers;
InteractionEvent::ModifierKeys modifiers = InteractionEvent::NoKey;
std::string strEventButton;
InteractionEvent::MouseButtons eventButton = InteractionEvent::NoButton;
std::string strButtonState;
InteractionEvent::MouseButtons buttonState = InteractionEvent::NoButton;
std::string strKey;
std::string key;
std::string strWheelDelta;
int wheelDelta;
std::string strSignalName = "";
Point2D pos;
pos.Fill(0);
// Parse modifier information
if (list->GetStringProperty(InteractionEventConst::xmlEventPropertyModifier().c_str(), strModifiers))
{
std::vector<std::string> mods = split(strModifiers, ',');
for (std::vector<std::string>::iterator it = mods.begin(); it != mods.end(); ++it)
{
std::transform((*it).begin(), (*it).end(), (*it).begin(), ::toupper);
if (*it == "CTRL")
{
modifiers = modifiers | InteractionEvent::ControlKey;
}
else if (*it == "ALT")
{
modifiers = modifiers | InteractionEvent::AltKey;
}
else if (*it == "SHIFT")
{
modifiers = modifiers | InteractionEvent::ShiftKey;
}
else
{
MITK_WARN<< "mitkEventFactory: Invalid event modifier in config file :" << (*it);
}
}
}
// Set EventButton
if (list->GetStringProperty(InteractionEventConst::xmlEventPropertyEventButton().c_str(), strEventButton))
{
std::transform(strEventButton.begin(), strEventButton.end(), strEventButton.begin(), ::toupper);
if (strEventButton == "MIDDLEMOUSEBUTTON")
{
eventButton = InteractionEvent::MiddleMouseButton;
}
else if (strEventButton == "LEFTMOUSEBUTTON")
{
eventButton = InteractionEvent::LeftMouseButton;
}
else if (strEventButton == "RIGHTMOUSEBUTTON")
{
eventButton = InteractionEvent::RightMouseButton;
}
else
{
MITK_WARN<< "mitkEventFactory: Invalid event button in config file: " << strEventButton;
}
}
// Parse ButtonStates
if (list->GetStringProperty(InteractionEventConst::xmlEventPropertyButtonState().c_str(), strButtonState))
{
std::vector<std::string> mods = split(strButtonState, ',');
for (std::vector<std::string>::iterator it = mods.begin(); it != mods.end(); ++it)
{
std::transform((*it).begin(), (*it).end(), (*it).begin(), ::toupper);
if (*it == "MIDDLEMOUSEBUTTON")
{
buttonState = buttonState | InteractionEvent::MiddleMouseButton;
}
else if (*it == "LEFTMOUSEBUTTON")
{
buttonState = buttonState | InteractionEvent::LeftMouseButton;
}
else if (*it == "RIGHTMOUSEBUTTON")
{
buttonState = buttonState | InteractionEvent::RightMouseButton;
}
else
{
MITK_WARN<< "mitkEventFactory: Invalid event buttonstate in config file:" << (*it);
}
}
}
// Key
if (!list->GetStringProperty(InteractionEventConst::xmlEventPropertyKey().c_str(), strKey))
//.........这里部分代码省略.........
示例2: if
mitk::InteractionEvent::Pointer mitk::EventFactory::CreateEvent(PropertyList::Pointer list)
{
//
std::string eventClass, eventVariant;
list->GetStringProperty(InteractionEventConst::xmlParameterEventClass().c_str(), eventClass);
list->GetStringProperty(InteractionEventConst::xmlParameterEventVariant().c_str(), eventVariant);
// Query all possible attributes, if they are not present, set their default values.
// Position Events & Key Events
std::string strModifiers;
InteractionEvent::ModifierKeys modifiers = InteractionEvent::NoKey;
std::string strEventButton;
InteractionEvent::MouseButtons eventButton = InteractionEvent::NoButton;
std::string strButtonState;
InteractionEvent::MouseButtons buttonState = InteractionEvent::NoButton;
std::string strKey;
std::string key;
std::string strWheelDelta;
int wheelDelta;
std::string strSignalName = "";
Point2D pos;
pos.Fill(0);
std::string strPos;
// Position on screen
if( list->GetStringProperty(InteractionEventConst::xmlEventPropertyPositionOnScreen().c_str(), strPos))
{
//split comma separated string
int commaPos;
commaPos = strPos.find_first_of(',');
pos[0] = static_cast<mitk::ScalarType>(std::atof(strPos.substr(0, commaPos).c_str()));
pos[1] = static_cast<mitk::ScalarType>(std::atof(strPos.substr(commaPos+1, strPos.length()).c_str()));
}
std::string strWorld;
Point3D worldPos;
worldPos.Fill(0);
//Position in world coordinates
if(list->GetStringProperty(InteractionEventConst::xmlEventPropertyPositionInWorld().c_str(), strWorld))
{
const std::vector<std::string> coords = split(strWorld, ',');
int i = 0;
for ( std::vector<std::string>::const_iterator it = coords.cbegin(); it != coords.cend(); ++it, ++i)
{
worldPos[i] = atof((*it).c_str());
}
}
// Parse modifier information
if (list->GetStringProperty(InteractionEventConst::xmlEventPropertyModifier().c_str(), strModifiers))
{
std::vector<std::string> mods = split(strModifiers, ',');
for (std::vector<std::string>::iterator it = mods.begin(); it != mods.end(); ++it)
{
std::transform((*it).cbegin(), (*it).cend(), (*it).begin(), ::toupper);
if (*it == "CTRL")
{
modifiers = modifiers | InteractionEvent::ControlKey;
}
else if (*it == "ALT")
{
modifiers = modifiers | InteractionEvent::AltKey;
}
else if (*it == "SHIFT")
{
modifiers = modifiers | InteractionEvent::ShiftKey;
}
else
{
MITK_WARN<< "mitkEventFactory: Invalid event modifier in config file :" << (*it);
}
}
}
// Set EventButton
if (list->GetStringProperty(InteractionEventConst::xmlEventPropertyEventButton().c_str(), strEventButton))
{
std::transform(strEventButton.cbegin(), strEventButton.cend(), strEventButton.begin(), ::toupper);
if (strEventButton == "MIDDLEMOUSEBUTTON")
{
eventButton = InteractionEvent::MiddleMouseButton;
}
else if (strEventButton == "LEFTMOUSEBUTTON")
{
eventButton = InteractionEvent::LeftMouseButton;
}
else if (strEventButton == "RIGHTMOUSEBUTTON")
{
eventButton = InteractionEvent::RightMouseButton;
}
else
{
MITK_WARN<< "mitkEventFactory: Invalid event button in config file: " << strEventButton;
}
}
// Parse ButtonStates
if (list->GetStringProperty(InteractionEventConst::xmlEventPropertyButtonState().c_str(), strButtonState))
//.........这里部分代码省略.........