五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

歡迎光臨散文網(wǎng) 會(huì)員登陸 & 注冊(cè)

arcpy開(kāi)發(fā)實(shí)例之a(chǎn)dd-in代碼

2022-11-12 21:54 作者:夕林泉石  | 我要投稿

import arcpy

import pythonaddins


class BtnEditFeature(object):

? ? """Implementation for pydemoaddin_addin.button_edit (Button)"""

? ? def __init__(self):

? ? ? ? self.enabled = True

? ? ? ? self.checked = False

? ? def onClick(self):

? ? ? ? with arcpy.da.UpdateCursor("points",["name","OID@"]) as cursor:

? ? ? ? ? ? for row in cursor:

? ? ? ? ? ? ? ? row[0]="point_"+str(row[1]);

? ? ? ? ? ? ? ? cursor.updateRow(row);


class BtnNewFeatureClass(object):

? ? """Implementation for pydemoaddin_addin.button_newfeatureclass (Button)"""

? ? def __init__(self):

? ? ? ? self.enabled = True

? ? ? ? self.checked = False

? ? def onClick(self):

? ? ? ? if arcpy.Exists("d:/temp/points.shp"):

? ? ? ? ? ? arcpy.management.Delete("d:/temp/points.shp");

? ? ? ? arcpy.management.CreateFeatureclass("d:/temp","points.shp","POINT");

? ? ? ? arcpy.management.AddField("d:/temp/points.shp","name","TEXT",20);


? ? ? ? pythonaddins.MessageBox("Create point.shp successfully!","TIP");


class ToolDrawPoint(object):

? ? """Implementation for pydemoaddin_addin.tool_drawpoint (Tool)"""

? ? def __init__(self):

? ? ? ? self.enabled = True

? ? ? ? self.cursor = 3;

? ? ? ? self.shape = "NONE" # Can set to "Line", "Circle" or "Rectangle" for interactive shape drawing and to activate the onLine/Polygon/Circle event sinks.

? ?

? ? def onMouseDownMap(self, x, y, button, shift):

? ? ? ? with arcpy.da.InsertCursor("d:/temp/points.shp",['SHAPE@XY']) as dc:

? ? ? ? ? ? dc.insertRow([(x,y)]);

? ? ? ? ? ? print ("One point at the mouse position({0},{1}) has been added.".format(x,y);

? ? ? ? mxd = arcpy.mapping.MapDocument("current");

? ? ? ? df = mxd.activeDataFrame;

? ? ? ? ext = df.extent;

? ? ? ? extent = ext

? ? ? ? ext.XMin = ext.XMin-0.1

? ? ? ? df.extent = ext;

? ?

class ToolIdentify(object):

? ? """Implementation for pydemoaddin_addin.tool_identify (Tool)"""

? ? def __init__(self):

? ? ? ? self.enabled = True

? ? ? ? self.shape = "NONE" # Can set to "Line", "Circle" or "Rectangle" for interactive shape drawing and to activate the onLine/Polygon/Circle event sinks.

? ?

? ? def onMouseDownMap(self, x, y, button, shift):

? ? ? ?

? ? ? ? mxd = arcpy.mapping.MapDocument("current");

? ? ? ? df = mxd.activeDataFrame;

? ? ? ? lyr = arcpy.mapping.ListLayers(mxd,"points",df)[0];


? ? ? ? pt = arcpy.Point(x,y);

? ? ? ? geom = arcpy.PointGeometry(pt)

? ? ? ?

? ? ? ? arcpy.SelectLayerByLocation_management( "points","WITHIN_A_DISTANCE" ,geom,0.1);

? ? ? ? selectedCount = arcpy.GetCount_management("points");

? ? ? ?

? ? ? ? if selectedCount>0: ? ? ? ? ? ?

? ? ? ? ? ? for f in lyr.getSelectionSet():

? ? ? ? ? ? ? ? print f;

? ?


class ToolRemove(object):

? ? """Implementation for pydemoaddin_addin.tool_remove (Tool)"""

? ? def __init__(self):

? ? ? ? self.enabled = True

? ? ? ? self.shape = "NONE" # Can set to "Line", "Circle" or "Rectangle" for interactive shape drawing and to activate the onLine/Polygon/Circle event sinks.

? ?

? ? def onRectangle(self, rectangle_geometry):

? ? ? ? mxd = arcpy.mapping.MapDocument("current");

? ? ? ? df = mxd.activeDataFrame;

? ? ? ? lyr = arcpy.mapping.ListLayers(mxd,"points",df)[0];


? ? ? ? rect = rectangle_geometry;

? ? ? ? arcpy.SelectLayerByLocation_management( "points","WITHIN" ,rect);

? ? ? ? selectedCount = arcpy.GetCount_management("points");

? ? ? ?

? ? ? ? if selectedCount>0:

? ? ? ? ? ? arcpy.da.UpdateCursor("points",)

? ? ? ? ? ? with arcpy.da.UpdateCursor("points","OID@") as cursor:

? ? ? ? ? ? for f in lyr.getSelectionSet():

? ? ? ? ? ? ? ? for row in cursor:

? ? ? ? ? ? ? ? ? ? if row[0]==f:

? ? ? ? ? ? ? ? ? ? ? ? cursor.deleteRow(); ? ? ? ? ?

? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ?


arcpy開(kāi)發(fā)實(shí)例之a(chǎn)dd-in代碼的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國(guó)家法律
台东市| 珠海市| 牟定县| 子洲县| 鹰潭市| 遵化市| 安泽县| 朔州市| 洪泽县| 延庆县| 德令哈市| 天祝| 枞阳县| 贵港市| 阳西县| 吉安市| 阿拉善盟| 阿坝| 田东县| 祁门县| 清河县| 镇康县| 辉县市| 津南区| 定西市| 枝江市| 芮城县| 皋兰县| 鹿邑县| 长葛市| 棋牌| 荃湾区| 浦县| 东兰县| 柘城县| 南和县| 淮滨县| 宜昌市| 龙岩市| 安岳县| 巍山|