QPointF SymbolDataEditor::getEndPoint()
{
    QPointF result = getTranslatePoint();
    QStringList pathList = getPathList();

    if (pathList.isEmpty() || pathList.last().isEmpty())
        return result;

    QString path = pathList.last();

    bool absolutely = path.at(0).isUpper();

    if (absolutely)
        result = getMovePoint(path);
    else
        result += getMovePoint(path);

    int indexOfC = path.indexOf('c', 0, Qt::CaseInsensitive);

    if (indexOfC > 0)
        absolutely = path.at(indexOfC).isUpper();

    if (absolutely)
        result = getLastCurvePoint(path);
    else
        result += getLastCurvePoint(path);

    QPointF linePoint = getLinePoint(path);

    if (!linePoint.isNull())
    {
        if (path.at(path.indexOf('l')).isUpper())
            result = linePoint;
        else
            result += linePoint;
    }

    result = fromViewBox(result);

    return fromStored(result);
}
QPointF SymbolDataEditor::getBeginPoint()
{
    QPointF result = getTranslatePoint();
    QStringList pathList = getPathList();

    if (pathList.isEmpty() || pathList.first().isEmpty())
        return result;

    QString path = pathList.first();

    bool absolutely = path.at(0).isUpper();

    if (absolutely)
        result = getMovePoint(path);
    else
        result += getMovePoint(path);

    result = fromViewBox(result);

    return fromStored(result);
}
void AllianceAreaPopupView::refreshShowNode(bool isDrag/* = true*/){
    CCPoint pt = getMovePoint();
    if(!pt.equals(ccp(0, 0))){
        m_picNode->setPosition(m_picNode->getPosition() + pt);
        if(isDrag){
            float maxMove = 15;
            auto moveDis = sqrt(pow(pt.x, 2) + pow(pt.y, 2));
            if(moveDis > maxMove){
                pt = pt * (maxMove * 1.0f / moveDis);
            }
            
            getMapNode()->setPosition(getMapNode()->getPosition() + pt);
            reDraw(NULL);
        }else{
            auto seque = CCSequence::create(CCMoveTo::create(0.2, getMapNode()->getPosition() + pt)
                                            , CCCallFuncN::create(this, callfuncN_selector(AllianceAreaPopupView::reDraw))
                                            , NULL
                                            );
            getMapNode()->runAction(seque);
        }
    }else{
        reDraw(NULL);
    }
}
Exemple #4
0
void  BulletsSprite::mymove(){
	CCPoint cp=getMovePoint();
	float x=cp.x+this->getPositionX();
	float y=cp.y+this->getPositionY();	
	this->setPosition(ccp(x,y));
}