码迷,mamicode.com
首页 > 编程语言 > 详细

JS小工具_字符串转16进制数组_01

时间:2018-08-28 10:31:36      阅读:159      评论:0      收藏:0      [点我收藏+]

标签:exe   使用   box   form   insert   数组   ret   scree   graph   

1、主要用于将 Qt5.3.2中使用到的js字符串 转换成 const的16进制数组

  QWebElement::evaluateJavaScript(...)

2、

3、

4、

5、intfVC.cpp中

  5.1、TintfVC::PointTransformed(...)中

    QString str = "var eleThis = this;";
           str += "function PointTransformed()";
           str += "{";
           str += "     var svg = document.rootElement;";
           str += "     var ctmSVG = svg.getScreenCTM();";
           str += "     var ctmEle = eleThis.getScreenCTM();";
           str += "     var pt = svg.createSVGPoint();";
           str += "     pt.x = "+QString::number(_dptIn->dX)+";";
           str += "     pt.y = "+QString::number(_dptIn->dY)+";";
           str += "     pt = pt.matrixTransform(ctmSVG.inverse().multiply(ctmEle));";
           str += "     return pt;";
           str += "} PointTransformed();";

    ZC:修改一下:

            var str = "var eleThis = this;";
            str += "function PointTransformed(_dX, _dY)";
            str += "{";
            str += "     var svg = document.rootElement;";
            str += "     var ctmSVG = svg.getScreenCTM();";
            str += "     var ctmEle = eleThis.getScreenCTM();";
            str += "     var pt = svg.createSVGPoint();";
            str += "     pt.x = _dX;";
            str += "     pt.y = _dY;";
            str += "     pt = pt.matrixTransform(ctmSVG.inverse().multiply(ctmEle));";
            str += "     return pt;";
            str += "}";
            str += "PointTransformed("+QString::number(_dptIn->dX)+", "+QString::number(_dptIn->dY)+");";

 

  5.2、TintfVC::WebElement_PointTransformed(...)中

    QString str = "var eleThis = this;";
           str += "function PointTransformed()";
           str += "{";
           str += "     var svg = document.rootElement;";
           str += "     var ctmSVG = svg.getScreenCTM();";
           str += "     var ctmEle = eleThis.getScreenCTM();";
           str += "     var pt = svg.createSVGPoint();";
           str += "     pt.x = "+QString::number(_dptIn->dX)+";";
           str += "     pt.y = "+QString::number(_dptIn->dY)+";";
           str += "     pt = pt.matrixTransform(ctmSVG.inverse().multiply(ctmEle));";
           str += "     return pt;";
           str += "} PointTransformed();";

  5.3、TintfVC::WebElement_Move(...)

    QString str = "var eleThis = this;";
           str += "var svg = document.rootElement;";
           str += "var tfm = svg.createSVGTransform();";
           str += "tfm.setTranslate("+QString::number(_x)+", "+QString::number(_y)+");";

           str += "var baseTfm = eleThis.transform.baseVal;";
           str += "baseTfm.consolidate();";
           str += "baseTfm.insertItemBefore(tfm, 0);";

    ZC:修改一下:

            str0503  = "var eleThis = this;";
            str0503 += "function PointMove(_dX, _dY)"
            str0503 += "{";
            str0503 += "    var svg = document.rootElement;";
            str0503 += "    var tfm = svg.createSVGTransform();";
            str0503 += "    tfm.setTranslate(_dX, _dY);";
            str0503 += "    var baseTfm = eleThis.transform.baseVal;";
            str0503 += "    baseTfm.consolidate();";
            str0503 += "    baseTfm.insertItemBefore(tfm, 0);";
            str0503 += "}";
            //str0503 += "PointMove("+QString::number(_x)+", "+QString::number(_y)+");";

 

  5.4、TintfVC::WebElement_Add(...)

        QString strJS = "";
        strJS += "function Add_FindById()";
        strJS += "{";
        strJS += "    var doceleFind = document.getElementById(‘"+strId+"‘);";
        strJS += "    if (doceleFind)";
        strJS += "        return true;";
        strJS += "    return false;";
        strJS += "}";
        strJS += "Add_FindById();";

    ZC:修改一下:

            str0504  = "function Add_FindById(_strId)";
            str0504 += "{";
            str0504 += "    var doceleFind = document.getElementById(_strId);";
            str0504 += "    if (doceleFind)";
            str0504 += "        return true;";
            str0504 += "    return false;";
            str0504 += "}";
            //str0504 += "Add_FindById(‘"+strId+"‘);";

    (1)、DrSvgExe 的情况下 也使用到了

  5.5、TintfVC::Draw_UpdatePt(...)

QString str = "g_intfQt532.Draw_UpdatePt(‘"+strId+"‘, "+QString::number(_iIdx)+", "+QString::number(_dX)+", "+QString::number(_dY)+");";

    ZC:貌似 这个现在不在使用??

  5.6、TintfVC::Draw_PointAdd(...)

QString str = "g_intfQt532.Draw_PointAdd(‘"+strId+"‘, "+QString::number(_dX)+", "+QString::number(_dY)+");";

    ZC:貌似 这个现在不在使用??

  5.7、TintfVC::Draw_PointDel(...)

QString str = "g_intfQt532.Draw_PointDel(‘"+strId+"‘, "+QString::number(_iDelIdx)+", 1);";

    ZC:貌似 这个现在不在使用??

  5.8、TintfVC::Translate(...)

QString str = "g_intfQt532.Translate_byDocEle(this, "+QString::number(_dX)+", "+QString::number(_dY)+");";

    ZC:貌似 这个现在不在使用??

  5.9、TintfVC::Scale(...)

QString str = "g_intfQt532.Scale_byDocEle(this, "+QString::number(_dX)+", "+QString::number(_dY)+");";

    ZC:貌似 这个现在不在使用??

  5.10、TintfVC::Rotate(...)

QString str = "g_intfQt532.Rotate_byDocEle(this, "+QString::number(_dAngle)+", "+QString::number(_dCenterX)+", "+QString::number(_dCenterY)+");";

    ZC:貌似 这个现在不在使用??

6、classSvgDraw.cpp

  6.1、TdrawSvg::PointTransformed(...)

    QString str = "var eleThis = this;";
           str += "function PointTransformed()";
           str += "{";
           str += "     var svg = document.rootElement;";
           str += "     var ctmSVG = svg.getScreenCTM();";
           str += "     var ctmEle = eleThis.getScreenCTM();";
           str += "     var pt = svg.createSVGPoint();";
           str += "     pt.x = "+QString::number(_dptIn->dX)+";";
           str += "     pt.y = "+QString::number(_dptIn->dY)+";";
           str += "     pt = pt.matrixTransform(ctmSVG.inverse().multiply(ctmEle));";
           str += "     return pt;";
           str += "} PointTransformed();";

  6.2、TdrawSvg::Transform_Forward(...)

    QString str = "";
    str += "function Forward(_SVGElement, _dX, _dY)";
    str += "{";
    str += "    var svgPoint = g_svg.createSVGPoint();";
    str += "    svgPoint.x = _dX;";
    str += "    svgPoint.y = _dY;";

    str += "    var svgMatrix_Root = g_svg.getScreenCTM();";

    str += "    var svgMatrix = _SVGElement.getScreenCTM();";
    str += "    svgPoint = svgPoint.matrixTransform(svgMatrix_Root.inverse().multiply(svgMatrix));";
    str += "    return svgPoint;";
    str += "}";
    str += "Forward(this, "+QString::number(_dXin)+", "+QString::number(_dYin)+");";

  6.3、TdrawSvg::Transform_Backward(...)

    QString str = "";
    str += "function Inverse(_SVGElement, _dX, _dY)";
    str += "{";
    str += "    var svgPoint = g_svg.createSVGPoint();";
    str += "    svgPoint.x = _dX;";
    str += "    svgPoint.y = _dY;";
    str += "    var svgMatrix_Root = g_svg.getScreenCTM();";
    str += "    var svgMatrix = _SVGElement.getScreenCTM();";
    str += "    svgPoint = svgPoint.matrixTransform(svgMatrix.inverse().multiply(svgMatrix_Root));";
    str += "    return svgPoint;";
    str += "}";
    str += "Inverse(this, "+QString::number(_dXin)+", "+QString::number(_dYin)+");";

  6.4、TdrGraphAttr_Q::TransformSet_Q_single(...)

    (1)、

        QString strTransform( "" );
        strTransform += "function RotateQt(_svgElement, _angle)";
        strTransform += "{";

        strTransform += "    var rt = _svgElement.getBBox();";
        strTransform += "    var fXcenter = rt.x + rt.width / 2;";
        strTransform += "    var fYcenter = rt.y + rt.height / 2;";

        strTransform += "    if (_svgElement.tagName.toLowerCase() == ‘use‘)";
        strTransform += "    {";
        strTransform += "        var strX = _svgElement.getAttribute(‘x‘);";
        strTransform += "        var strY = _svgElement.getAttribute(‘y‘);";
        strTransform += "        var fX = parseFloat(strX);";
        strTransform += "        var fY = parseFloat(strY);";
        strTransform += "        fXcenter += fX;";
        strTransform += "        fYcenter += fY;";
        strTransform += "    }";

            strTransform += "var svgPoint = g_svg.createSVGPoint();";
            strTransform += "svgPoint.x = fXcenter;";
            strTransform += "svgPoint.y = fYcenter;";
            strTransform += "var svgMatrix_Root = g_svg.getScreenCTM();";
            strTransform += "var svgMatrix = _svgElement.getScreenCTM();";
            strTransform += "svgPoint = svgPoint.matrixTransform(svgMatrix_Root.inverse().multiply(svgMatrix));";

        strTransform += "    var new01 = g_svg.createSVGTransform();";
        strTransform += "    new01.setRotate(_angle, svgPoint.x, svgPoint.y);";

        strTransform += "    var list01 = _svgElement.transform;";
        strTransform += "    var list02 = list01.baseVal;";
        strTransform += "    list02.insertItemBefore(new01, 0);";
        strTransform += "    list02.consolidate();";

        strTransform += "}";
        strTransform += "RotateQt(this, "+QString::number(_d0)+");";

    (2)、

        QString strTransform( "" );
        strTransform += "function TranslateQt(_svgElement, _x, _y)";
        strTransform += "{";
        strTransform += "    var new01 = g_svg.createSVGTransform();";
        strTransform += "    new01.setTranslate(_x, _y);";
        strTransform += "    var list01 = _svgElement.transform;";
        strTransform += "    var list02 = list01.baseVal;";
        strTransform += "    list02.insertItemBefore(new01, 0);";
        strTransform += "    list02.consolidate();";
        strTransform += "}";
        strTransform += "TranslateQt(this, "+QString::number(_d0)+", "+QString::number(_d1)+");";

    (3)、

        QString strTransform( "" );
        strTransform += "function ScaleQt(_svgElement, _x, _y)";
        strTransform += "{";
        strTransform += "    var new01 = g_svg.createSVGTransform();";
        strTransform += "    new01.setScale(_x, _y);";
        strTransform += "    var list01 = _svgElement.transform;";
        strTransform += "    var list02 = list01.baseVal;";
        strTransform += "    list02.insertItemBefore(new01, 0);";
        strTransform += "    list02.consolidate();";
        strTransform += "}";
        strTransform += "ScaleQt(this, "+QString::number(_d0)+", "+QString::number(_d1)+");";

 

7、

8、

9、

 

JS小工具_字符串转16进制数组_01

标签:exe   使用   box   form   insert   数组   ret   scree   graph   

原文地址:https://www.cnblogs.com/h5skill/p/9545958.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!