當前位置: 首頁>>代碼示例>>Python>>正文


Python Polygon.shift方法代碼示例

本文整理匯總了Python中Polygon.shift方法的典型用法代碼示例。如果您正苦於以下問題:Python Polygon.shift方法的具體用法?Python Polygon.shift怎麽用?Python Polygon.shift使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Polygon的用法示例。


在下文中一共展示了Polygon.shift方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: reduceExample

# 需要導入模塊: import Polygon [as 別名]
# 或者: from Polygon import shift [as 別名]
def reduceExample():
    # read Polygon from file
    p = Polygon('testpoly.gpf')
    # use ireland only, I know it's contour 0
    pnew = Polygon(p[0])
    # number of points
    l = len(pnew[0])
    # get shift value to show many polygons in drawing
    bb = pnew.boundingBox()
    xs = 1.1 * (bb[1]-bb[0])
    # list with polygons to plot
    plist = [pnew]
    while l > 30:
        # reduce points to the half
        l /= 2
        print "Reducing contour to %d points" % l
        pnew = Polygon(reducePoints(pnew[0], l))
        pnew.shift(xs, 0)
        plist.append(pnew)
    # draw the results
    print "Plotting ReduceExample.svg"
    drawSVG(plist, height=400, ofile="ReduceTest.svg")
開發者ID:Germanc,項目名稱:supreme,代碼行數:24,代碼來源:PolygonExamples.py

示例2: reduceExample

# 需要導入模塊: import Polygon [as 別名]
# 或者: from Polygon import shift [as 別名]
def reduceExample():
    # read Polygon from file
    p = Polygon('testpoly.gpf')
    # use ireland only, I know it's contour 0
    pnew = Polygon(p[0])
    # number of points
    l = len(pnew[0])
    # get shift value to show many polygons in drawing
    bb = pnew.boundingBox()
    xs = 1.1 * (bb[1]-bb[0])
    # list with polygons to plot
    plist = [pnew]
    while l > 30:
        # reduce points to the half
        l /= 2
        print 'Reducing contour to %d points' % l
        pnew = Polygon(reducePoints(pnew[0], l))
        pnew.shift(xs, 0)
        plist.append(pnew)
    # draw the results
    writeSVG('ReducePoints.svg', plist, height=400)
    if hasPDFExport:
        writePDF('ReducePoints.pdf', plist)
開發者ID:EUPSForge,項目名稱:polygon,代碼行數:25,代碼來源:Examples.py


注:本文中的Polygon.shift方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。