本文整理汇总了Python中line.Line.getArcs方法的典型用法代码示例。如果您正苦于以下问题:Python Line.getArcs方法的具体用法?Python Line.getArcs怎么用?Python Line.getArcs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类line.Line
的用法示例。
在下文中一共展示了Line.getArcs方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: topology
# 需要导入模块: from line import Line [as 别名]
# 或者: from line.Line import getArcs [as 别名]
#.........这里部分代码省略.........
logging.debug("{}".format([x0, y0, x1, y1]))
kx, ky = make_ks(quantization_factor, x0, x1, y0, y1)
if not quantization_factor:
quantization_factor = x1 + 1
x0 = y0 = 0
class FindEmax(types):
def __init__(self, obj):
self.emax = 0
self.obj = obj
def point(self, point):
x1 = point[0]
y1 = point[1]
x = ((x1 - x0) * kx)
y = ((y1 - y0) * ky)
ee = system['distance'](x1, y1, x / kx + x0, y / ky + y0)
if ee > self.emax:
self.emax = ee
point[0] = int(x)
point[1] = int(y)
finde = FindEmax(objects)
e_max = finde.emax
clock(objects, system.ring_area)
class findCoincidences(types):
def line(self, line):
for point in line:
lines = ln.arcs.coincidenceLines(point)
if not line in lines:
lines.append(line)
fcInst = findCoincidences(objects)
polygon = lambda poly: map(ln.lineClosed, poly)
#Convert features to geometries, and stitch together arcs.
class makeTopo(types):
def Feature(self, feature):
geometry = feature["geometry"]
if feature['geometry'] == None:
geometry = {}
if feature.has_key('id'):
geometry['id'] = feature['id']
if feature.has_key('properties'):
geometry['properties'] = feature['properties']
return self.geometry(geometry)
def FeatureCollection(self, collection):
collection['type'] = "GeometryCollection"
collection['geometries'] = map(self.Feature, collection['features'])
del collection['features']
return collection
def GeometryCollection(self, collection):
collection['geometries'] = map(self.geometry, collection['geometries'])
def MultiPolygon(self, multiPolygon):
multiPolygon['arcs'] = map(polygon, multiPolygon['coordinates'])
def Polygon(self, polygon):
polygon['arcs'] = map(ln.lineClosed, polygon['coordinates'])
def MultiLineString(self, multiLineString):
multiLineString['arcs'] = map(ln.lineOpen, multiLineString['coordinates'])
def LineString(self, lineString):
lineString['arcs'] = ln.lineOpen(lineString['coordinates'])
def geometry(self, geometry):
if geometry is None:
geometry = {}
else:
types.geometry(self, geometry)
geometry['id'] = id_(geometry)
if geometry['id'] is None:
del geometry['id']
properties0 = geometry['properties']
if properties0:
properties1 = {}
del geometry['properties']
for key0 in properties0:
if property_transform(properties1, key0, properties0[key0]):
geometry['properties'] = properties1
if 'arcs' in geometry:
del geometry['coordinates']
return geometry
makeTopoInst = makeTopo(objects)
return {
'type': "Topology",
'transform': {
'scale': [1.0 / kx, 1.0 / ky],
'translate': [x0, y0]
},
'objects': makeTopoInst.outObj,
'arcs': ln.getArcs()
}
示例2: topology
# 需要导入模块: from line import Line [as 别名]
# 或者: from line.Line import getArcs [as 别名]
#.........这里部分代码省略.........
x0 = -180
if x1 > 180 - e:
x1 = 180
if y0 < -90 + e:
y0 = -90
if y1 > 90 - e:
y1 = 90;
if isInfinit(x0):
x0 = 0
if isInfinit(x1):
x1 = 0;
if isInfinit(y0):
y0 = 0;
if isInfinit(y1):
y1 = 0;
[kx,ky]=makeKs(Q,x0,x1,y0,y1)
if not Q:
Q = x1 + 1
x0 = y0 = 0
class findEmax(types):
def __init__(self,obj):
self.emax=0
self.obj(obj)
def point(self,point):
x1 = point[0]
y1 = point[1]
x = ((x1 - x0) * kx)
y =((y1 - y0) * ky)
ee = system['distance'](x1, y1, x / kx + x0, y / ky + y0)
if ee > self.emax:
self.emax = ee
point[0] = int(x)
point[1] = int(y)
finde=findEmax(objects)
emax = finde.emax
clock(objects,system['ringArea'])
class findCoincidences(types):
def line(self,line):
for point in line:
lines = ln.coincidences.get(point)
if not line in lines:
lines.append(line)
fcInst = findCoincidences(objects)
polygon = lambda poly:map(ln.lineClosed,poly)
#Convert features to geometries, and stitch together arcs.
class makeTopo(types):
def Feature (self,feature):
geometry = feature["geometry"]
if feature['geometry'] == None:
geometry = {};
if feature.has_key('id'):
geometry['id'] = feature['id']
if feature.has_key('properties'):
geometry['properties'] = feature['properties']
return self.geometry(geometry);
def FeatureCollection(self,collection):
collection['type'] = "GeometryCollection";
collection['geometries'] = map(self.Feature,collection['features'])
del collection['features']
return collection
def GeometryCollection(self,collection):
collection['geometries'] = map(self.geometry,collection['geometries'])
def MultiPolygon(self,multiPolygon):
multiPolygon['arcs'] = map(polygon,multiPolygon['coordinates'])
def Polygon(self,polygon):
polygon['arcs'] = map(ln.lineClosed,polygon['coordinates'])
def MultiLineString(self,multiLineString):
multiLineString['arcs'] = map(ln.lineOpen,multiLineString['coordinates'])
def LineString(self,lineString):
lineString['arcs'] = ln.lineOpen(lineString['coordinates'])
def geometry(self,geometry):
if geometry == None:
geometry = {};
else:
types.geometry(self,geometry)
geometry['id'] = id(geometry)
if geometry['id'] == None:
del geometry['id']
properties0 = geometry['properties']
if properties0:
properties1 = {}
del geometry['properties']
for key0 in properties0:
if propertyTransform(properties1, key0, properties0[key0]):
geometry['properties'] = properties1
if geometry.has_key('arcs'):
del geometry['coordinates']
return geometry;
makeTopoInst = makeTopo(objects)
return {
'type': "Topology",
'bbox': [x0, y0, x1, y1],
'transform': {
'scale': [1.0 / kx, 1.0 / ky],
'translate': [x0, y0]
},
'objects': makeTopoInst.outObj,
'arcs': ln.getArcs()
}