本文整理汇总了C++中Arrow类的典型用法代码示例。如果您正苦于以下问题:C++ Arrow类的具体用法?C++ Arrow怎么用?C++ Arrow使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Arrow类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setLineColor
//! [1]
void DiagramScene::setLineColor(const QColor &color)
{
myLineColor = color;
if (isItemChange(Arrow::Type)) {
Arrow *item =
qgraphicsitem_cast<Arrow *>(selectedItems().first());
item->setColor(myLineColor);
update();
}
}
示例2: scale
void OdometryDisplay::updateLength()
{
float length = length_property_->getFloat();
D_Arrow::iterator it = arrows_.begin();
D_Arrow::iterator end = arrows_.end();
Ogre::Vector3 scale( length, length, length );
for ( ; it != end; ++it )
{
Arrow* arrow = *it;
arrow->setScale( scale );
}
context_->queueRender();
}
示例3: CCLOG
void BattleLayer::addArrowToBattleMap(const cocos2d::Vec2 &fromPoint, const cocos2d::Vec2 &toPoint, const std::function<void ()> &callback){
CCLOG("%s, ", __func__);
Arrow *arrow = Arrow::createArrow(fromPoint, toPoint, this);
arrow->setPosition(fromPoint);
_battleMap->addChild(arrow, 10000);
float duration = getDistanceWithTowVec2(fromPoint, toPoint) / GameData::getInstance()->getBattleWeaponSpeed(BattleWeapon::Arrow);
arrow->runAction(Sequence::create(MoveTo::create(duration, toPoint), CallFunc::create([=](){
callback();
arrow->removeFromParent();
}), NULL));
}
示例4: new
Arrow *Arrow::createArrowByLevel(const std::string &level){
Arrow *newArrow = new (std::nothrow) Arrow(level);
if (newArrow && newArrow->initArrow()){
newArrow->autorelease();
return newArrow;
}
delete newArrow;
newArrow = nullptr;
return nullptr;
}
示例5: items
void DiagramScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *mouseEvent)
{
if (line != 0 && myMode == InsertLine)
{
QList<QGraphicsItem *> startItems = items(line->line().p1());
if (startItems.count() && startItems.first() == line)
startItems.removeFirst();
QList<QGraphicsItem *> endItems = items(line->line().p2());
if (endItems.count() && endItems.first() == line)
endItems.removeFirst();
removeItem(line);
delete line;
if (startItems.count() > 0 && endItems.count() > 0 &&
startItems.first()->type() == Connector::Type &&
endItems.first()->type() == Connector::Type &&
startItems.first() != endItems.first())
{
Connector *startItem =
qgraphicsitem_cast<Connector *>(startItems.first());
Connector *endItem =
qgraphicsitem_cast<Connector *>(endItems.first());
QDomNode arrowXml = createArrowXml(startItem,endItem);
Arrow *arrow = new Arrow(startItem, endItem,arrowXml);
arrowList.append(arrow);
arrow->setColor(myLineColor);
startItem->addArrow(arrow);
endItem->addArrow(arrow);
arrow->setZValue(-1000.0);
addItem(arrow);
arrow->updatePosition();
}
}
line = 0;
QGraphicsScene::mouseReleaseEvent(mouseEvent);
if(myMode == MoveItem)
{
DiagramItem* item =(DiagramItem*)itemAt(mouseEvent->scenePos());
if(item == 0)
return;
if(item->type() == DiagramItem::Type)
{
item->updatePoz();
((DiagramWindow*)parent())->updateXml();
}
}
}
示例6: createNormals
void GridPlot::createNormals(const Plotlet& pl)
{
if (!normals())
return;
Arrow arrow;
arrow.setQuality(normalQuality());
Triple /*basev, topv, */ norm;
int step = resolution();
const GridData& data = dynamic_cast<const GridData&>(*pl.data);
const Color& color = *pl.appearance->dataColor();
double diag = (data.hull().maxVertex-data.hull().minVertex).length() * normalLength();
arrow.assign(*this);
arrow.drawBegin();
for (int i = 0; i <= data.columns() - step; i += step)
{
for (int j = 0; j <= data.rows() - step; j += step)
{
norm = data.normals[i][j];//topv-basev;
norm.normalize();
norm *= diag;
const Triple &vert = data.vertices[i][j];
arrow.setTop(vert+norm);
arrow.setColor(color.rgba(vert.x, vert.y, vert.z));
arrow.draw(vert);
}
}
arrow.drawEnd();
}
示例7: createNormalsC
void SurfacePlot::createNormalsC()
{
if (!normals() || actualData_p->empty())
return;
if (actualDataC_->nodes.size() != actualDataC_->normals.size())
return;
Arrow arrow;
arrow.setQuality(normalQuality());
Triple basev, topv, norm;
double diag = (actualData_p->hull().maxVertex-actualData_p->hull().minVertex).length() * normalLength();
RGBA col;
arrow.assign(*this);
arrow.drawBegin();
for (unsigned i = 0; i != actualDataC_->normals.size(); ++i)
{
basev = actualDataC_->nodes[i];
topv = basev + actualDataC_->normals[i];
norm = topv-basev;
norm.normalize();
norm *= diag;
arrow.setTop(basev+norm);
arrow.setColor((*datacolor_p)(basev.x,basev.y,basev.z));
arrow.draw(basev);
}
arrow.drawEnd();
}
示例8: createNormalsG
void Curve::createNormalsG()
{
if (!normals() || actualDataG_->empty())
return;
Arrow arrow;
arrow.setQuality(normalQuality());
Triple basev, topv, norm;
int step = resolution();
double diag = (actualDataG_->hull().maxVertex-actualDataG_->hull().minVertex).length() * normalLength();
arrow.assign(*this);
arrow.drawBegin();
for (int i = 0; i <= actualDataG_->columns() - step; i += step){
for (int j = 0; j <= actualDataG_->rows() - step; j += step){
basev = Triple(actualDataG_->vertices[i][j][0],actualDataG_->vertices[i][j][1],actualDataG_->vertices[i][j][2]);
topv = Triple(actualDataG_->vertices[i][j][0]+actualDataG_->normals[i][j][0],
actualDataG_->vertices[i][j][1]+actualDataG_->normals[i][j][1],
actualDataG_->vertices[i][j][2]+actualDataG_->normals[i][j][2]);
norm = topv-basev;
norm.normalize();
norm *= diag;
arrow.setTop(basev+norm);
arrow.setColor((*datacolor_p)(basev.x,basev.y,basev.z));
arrow.draw(basev);
}
}
arrow.drawEnd();
}
示例9: updateColor
void OdometryDisplay::updateColor()
{
QColor color = color_property_->getColor();
float red = color.redF();
float green = color.greenF();
float blue = color.blueF();
D_Arrow::iterator it = arrows_.begin();
D_Arrow::iterator end = arrows_.end();
for( ; it != end; ++it )
{
Arrow* arrow = *it;
arrow->setColor( red, green, blue, 1.0f );
}
context_->queueRender();
}
示例10: newLine
void DiagramScene::mouseMoveEvent(QGraphicsSceneMouseEvent *mouseEvent)
{
if (myMode == InsertLine && line != 0) {
QLineF newLine(line->line().p1(), mouseEvent->scenePos());
line->setLine(newLine);
} else if (myMode == MoveItem) {
if(selectedItems().count())
if(selectedItems().first()->type()==Arrow::Type) {
Arrow *item =
qgraphicsitem_cast<Arrow *>(selectedItems().first());
item->setBendPoint(mouseEvent->scenePos().x(), mouseEvent->scenePos().y());
item->updatePosition();
}
QGraphicsScene::mouseMoveEvent(mouseEvent);
}
}
示例11: QObject
Marker::Marker(QObject *parent) :
QObject(parent)
{
m_models.push_back(new Pixmap(QPixmap("")));
m_models.push_back(new QGraphicsWidget(m_models[0]));
m_models.push_back(new Arrow(QPixmap(":/arrowN.png"), QPixmap(":/arrowNhover.png"), 0, m_models[1]));
m_models.push_back(new Arrow(QPixmap(":/arrowE.png"), QPixmap(":/arrowEhover.png"), 1, m_models[1]));
m_models.push_back(new Arrow(QPixmap(":/arrowS.png"), QPixmap(":/arrowShover.png"), 2, m_models[1]));
m_models.push_back(new Arrow(QPixmap(":/arrowW.png"), QPixmap(":/arrowWhover.png"), 3, m_models[1]));
for (int i = N; i <= W; ++i)
{
Arrow *arrow = static_cast<Arrow *>(m_models[i]);
arrow->setPos(g_arrowsPos[i - N]);
connect(arrow, SIGNAL(pressed(int)), this, SIGNAL(moveRequest(int)));
}
}
示例12: Arrow
Arrow* Arrow::create(b2World* pWorld)
{
// 'layer' is an autorelease object
Arrow *pRet = new Arrow();
if (pRet && pRet->init(pWorld))
{
pRet->autorelease();
return pRet;
}
else
{
delete pRet;
pRet = NULL;
return NULL;
}
// return the scene
return pRet;
}
示例13: assert
void GLWidget::visualizeLayer(int index) {
// out << "void GLWidget::visualizeLayer(int index)" << eom;
assert(m_data);
assert(index < m_data->getDimension(2));
m_activeLayer = index;
m_arrows.clear();
m_viewMutex.lock();
for(int i = 0; i < m_data->getDimension(0); i++) {
for(int j = 0; j < m_data->getDimension(1); j++) {
Arrow arrow;
arrow.setPosition(i,j,0.0);
arrow.setDirectionAndLength(m_data->get4(i,j,m_activeLayer,0),m_data->get4(i,j,m_activeLayer,1),m_data->get4(i,j,m_activeLayer,2));
m_arrows.push_back(arrow);
}
}
m_viewMutex.unlock();
// out << m_arrows.size() << " arrows created." << eom;
}
示例14: setStatus
void OdometryDisplay::incomingMessage( const nav_msgs::Odometry::ConstPtr& message )
{
++messages_received_;
if( !validateFloats( *message ))
{
setStatus( StatusProperty::Error, "Topic", "Message contained invalid floating point values (nans or infs)" );
return;
}
setStatus( StatusProperty::Ok, "Topic", QString::number( messages_received_ ) + " messages received" );
if( last_used_message_ )
{
Ogre::Vector3 last_position(last_used_message_->pose.pose.position.x, last_used_message_->pose.pose.position.y, last_used_message_->pose.pose.position.z);
Ogre::Vector3 current_position(message->pose.pose.position.x, message->pose.pose.position.y, message->pose.pose.position.z);
Ogre::Quaternion last_orientation(last_used_message_->pose.pose.orientation.w, last_used_message_->pose.pose.orientation.x, last_used_message_->pose.pose.orientation.y, last_used_message_->pose.pose.orientation.z);
Ogre::Quaternion current_orientation(message->pose.pose.orientation.w, message->pose.pose.orientation.x, message->pose.pose.orientation.y, message->pose.pose.orientation.z);
if( (last_position - current_position).length() < position_tolerance_property_->getFloat() &&
(last_orientation - current_orientation).normalise() < angle_tolerance_property_->getFloat() )
{
return;
}
}
Arrow* arrow = new Arrow( scene_manager_, scene_node_, 0.8f, 0.05f, 0.2f, 0.2f );
transformArrow( message, arrow );
QColor color = color_property_->getColor();
arrow->setColor( color.redF(), color.greenF(), color.blueF(), 1.0f );
float length = length_property_->getFloat();
Ogre::Vector3 scale( length, length, length );
arrow->setScale( scale );
arrows_.push_back( arrow );
last_used_message_ = message;
context_->queueRender();
}
示例15: items
void DiagramScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *mouseEvent)
{
if (line != 0 && myMode == InsertLine) {
QList<QGraphicsItem *> startItems = items(line->line().p1());
while(startItems.count() && startItems.first()->type() != DiagramItem::Type) {
startItems.removeFirst();
}
QList<QGraphicsItem *> endItems = items(line->line().p2());
while(endItems.count() && endItems.first()->type() != DiagramItem::Type) {
endItems.removeFirst();
}
removeItem(line);
delete line;
if (startItems.count() > 0 && endItems.count() > 0)
if(startItems.first()->type() == DiagramItem::Type &&
endItems.first()->type() == DiagramItem::Type &&
startItems.first() != endItems.first()) {
DiagramItem *startItem =
qgraphicsitem_cast<DiagramItem *>(startItems.first());
DiagramItem *endItem =
qgraphicsitem_cast<DiagramItem *>(endItems.first());
if(startItem->diagramType()!=endItem->diagramType()) {
Arrow *arrow = new Arrow(startItem, endItem, myItemMenu);
if(!startItem->haveSuchArrow(arrow)) {
arrow->setColor(myLineColor);
startItem->addArrow(arrow);
endItem->addArrow(arrow);
arrow->setZValue(-1000);
addItem(arrow);
arrow->updatePosition();
}
}
}
}
line = 0;
QGraphicsScene::mouseReleaseEvent(mouseEvent);
}