Ejemplo n.º 1
0
def xsetgen(dicti, strn):
    (ftype, subtype) = decide(strn)
    lj = []
    cj = []
    pj = []
    xsetl = []
    xset = {}
    if (ftype == 'line'):
        slope = 0
        (ptA, ptB, lent, lst, slope) = make_line(strn, dicti)
        (lj, dicti) = ljob(lj, slope, lent, ptA, ptB, lst, dicti)
        lj = lj[0]
        xset['ptA'] = []
        xset['ptA'].append(round(lj[0][0] + shift['xshift']))
        xset['ptA'].append(round(lj[0][1] + shift['yshift']))
        xset['ptB'] = []
        xset['ptB'].append(round(lj[1][0] + shift['xshift']))
        xset['ptB'].append(round(lj[1][1] + shift['yshift']))
        if (xset['ptA'][0] > xset['ptB'][0]):
            t = xset['ptA']
            xset['ptA'] = xset['ptB']
            xset['ptB'] = t
        elif (xset['ptA'][0] == xset['ptB'][0]):
            if (xset['ptA'][1] > xset['ptB'][1]):
                t = xset['ptA']
                xset['ptA'] = xset['ptB']
                xset['ptB'] = t
        xset['type'] = 'line'
        xset['length'] = ''
        xset['thresh'] = 4
        xsetl.append(xset)
    elif (ftype == 'circle'):
        (cen, rad, lst) = make_circle(strn, dicti)
        (cj, dicti) = cjob(cj, rad, cen, lst, dicti)
        cj = cj[0]
        xset['type'] = 'circle'
        xset['thresh'] = 4
        xset['radius'] = round(cj[1])
        xset['center'] = []
        xset['center'].append(round(cj[0][0] + shift['xshift']))
        xset['center'].append(round(cj[0][1] + shift['yshift']))
        xsetl.append(xset)
    elif (ftype == 'poly'):
        if (subtype != '' and subtype != 'sq' and subtype != 'rect'):
            ptlst = make_poly_gen(strn, dicti)
        if (subtype[len(subtype) - 1] == 'r'):
            (ptlst, dicti) = make_poly_reg(strn, dicti,
                                           subtype[:len(subtype) - 1])
        if (subtype == 'sq' or subtype == 'sq4' or subtype == 'rect'
                or subtype == 'rect4'):
            (ptlst, dicti) = make_quads(strn, subtype, dicti)
        (pj, dicti) = poljob(strn, subtype, pj, dicti, ptlst)
        pj = pj[0]
        n = getLineXsetsPolCoords(pj)
        xsetl = xsetl + n
    return xsetl
Ejemplo n.º 2
0
        lists.close()
        dic.write('\n')
        dic.close()
        linejobs.write(str(lj))
        linejobs.close()
        circlejobs.write(str(cj))
        circlejobs.close()
        for x in pj:
            polyjobs.write(str(x) + '\n')
        polyjobs.close()
        status.write("Go")
        status.close()
        break

    dicti = gt(strn, dicti)
    (ftype, subtype) = decide(strn)
    if (ftype == 'line'):
        slope = 0
        (ptA, ptB, lent, lst, slope) = make_line(strn, dicti)
        (lj, dicti) = ljob(lj, slope, lent, ptA, ptB, lst, dicti)
        print('line job update')
        # print((lj, dicti))
        lists.write(str(lj) + '\n')
        mkd.write('line job update\n')
        dic.write(json.dumps(dicti) + '\n')
    elif (ftype == 'circle'):
        (cen, rad, lst) = make_circle(strn, dicti)
        (cj, dicti) = cjob(cj, rad, cen, lst, dicti)
        print('circle job update')
        # print((cj, dicti))
        lists.write(str(cj) + '\n')
Ejemplo n.º 3
0
            for i, strang in enumerate(twitterstraenge):
                if i != len(twitterstraenge) - 1:
                    for t in twitterstraenge[i].tweets:
                        if t.tweetId == __twt_transformed.tweetId:
                            foundUnique = False

            nowLoop += 1

        print("\nIn Twitterstrang [",
              len(twitterstraenge) - 1, "] wird der Recent-Tweet[",
              nowLoop - 1, "] nun analysiert:")
        time.sleep(5)
        print(__twt_transformed.text, "\n\n")
        twitterstraenge[-1].tweets.append(__twt_transformed)

        _str = decide(twitterstraenge[-1])
        time.sleep(5)
        # Strategem-Poster
        # gibt unter info folgende Infos als Liste zurück: letzter TweetText, letzter Bot, letzte Strategem-Nummer

        _twt = strategem_poster(twitterstraenge[-1].tweets[-1].tweetId, _str,
                                Hashtag)

        twitterstraenge[-1].tweets.append(Tweet((_twt[0])))

        bot_name = _twt[1]

        twitterstraenge[-1].usedStrategems.append(str(_str))
        twitterstraenge[-1].involvedCharacters.append(bot_name)

        print(