資源簡介
在ARCMAP里面檢查多邊形的銳角工具,只做檢查,不做修改。

代碼片段和文件信息
#??在使用過程中如有疑問請發郵件至ryx_32@126.com聲明:該軟件僅限中測新圖內部使用,請勿用于商業用途,否則后果自負!!!
#?---------------------------------------------------------------------------
class?Feature_No():
????
????pass
import?sys?string?osmath?arcgisscripting
gp?=?arcgisscripting.create(9.3)
gp.SetProduct(“ArcInfo“)
input_poly?=?gp.GetParameterAsText(0)
angle_min?=?long(gp.GetParameterAsText(1))
try:
????gp.Addmessage(“***********************************************“)
????
????gp.AddMessage(“本工具由中測新圖(北京)遙感技術有限責任公司?任延旭編制“)
????gp.AddMessage(“使用前請做好數據備份,工具產生的不良后果請自行承擔!“)
????gp.Addmessage(“***********************************************“)
????result?=?gp.GetCount_management(input_poly?)
??
????count_n?=?int(result.GetOutput(0))
????if?count_n?<=?0:
????????raise?Feature_No
????str_Err?=?““
????if?len(gp.ListFields(input_poly“Angle_chk“))?<=0:
????????gp.AddField_management(input_poly?“Angle_chk“?“TEXT“?““?““?255)
????str_Err?=?““
????cur?=?gp.UpdateCursor(input_poly““““““““)
????
????row?=?cur.next()
????gp.SetProgressor(“step“?“正在檢查圖形銳角...“?0count_n?1)
????
????angle_rj?=?0
????angle_cf?=?0
????num?=?0
????
????while?row:
????????
????????num?+=?1
????????gp.SetProgressorLabel(“共有“?+str(count_n)+“個圖形正在檢查第“?+?str(num)?+?“個圖形的夾角還剩余“+str(count_n-num+1)+“個請稍候...“)?
????????
????????shapeName?=?gp.Describe(input_poly).shapeFieldName
????
????????geom?=?row.getValue(shapeName)
????????part_count?=?geom.partCount
????????count?=?0
?????
????????while?count?
????????????p?=?geom.getPart(count)
????????????p_b?=?p.next()
????????????
????????????p_S?=?p_b
????????????
????????????p1?=?p_b
????????????
????????????p2?=?p.next()
????????????
????????????p3?=?p.next()
????????????
????????????p_2?=?p2
????????????while?p3:
????????????????x1?=?round(p1.X3)
????????????????y1?=?round(p1.Y3)
????????????????x2?=?round(p2.X3)
????????????????y2?=?round(p2.Y3)
????????????????x3?=?round(p3.X3)
????????????????y3?=?round(p3.Y3)
????????????????if?(math.fabs(x1-x2)<0.5?and?math.fabs(x2-x3)<0.5)?or?(math.fabs(y1-y2)<0.5?and?math.fabs(y2-y3)<0.5):
????????????????????jiao?=?-1
????????????????else:
????????????????
????????????????????l1?=?math.sqrt((x2-x3)*(x2-x3)+(y2-y3)*(y2-y3))
????????????????????l2?=?math.sqrt((x1-x3)*(x1-x3)+(y1-y3)*(y1-y3))
????????????????????l3?=?math.sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1))
????????????????????if?l1==0?or?l2==0?or?l3==0:
????????????????????????angle_cf?+=?1
????????????????????else:
????????????????????????
????????????????????????cj?=?(l1*l1+l3*l3-l2*l2)/(2*l1*l3)
????????????????????????jiao?=?math.cos(angle_min*3.1415926/180)
????????????????????????
????????????????????????if?cj?>=?jiao:
????????????????????????????
????????????????????????????angle_rj?+=?1
????????????????p1?=?p2
????????????????
????????????????p2?=?p3
????????????????
???????????
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件?????536604??2012-11-06?15:19??使用說明.pdf
?????文件???????5596??2012-11-06?16:50??jianjiao_check.py
?????文件???????6656??2012-11-05?10:27??銳角檢查工具.tbx
-----------?---------??----------?-----??----
???????????????548856????????????????????3
- 上一篇:51單片機上的PWM產生各種波形程序,分別由匯編和C編寫
- 下一篇:電子煙小煙源代碼
評論
共有 條評論