Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
y1 = 90
if is_infinit(x0):
x0 = 0
if is_infinit(x1):
x1 = 0
if is_infinit(y0):
y0 = 0
if is_infinit(y1):
y1 = 0
[kx,ky]=make_ks(quantization,x0,x1,y0,y1)
if not quantization:
quantization = 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.ring_area)
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.ring_area)
class find_coincidences(Types):
def line(self,line):
for point in line:
lines = ln.arcs.coincidence_lines(point)
if not line in lines:
lines.append(line)
fcInst = find_coincidences(objects)
polygon = lambda poly:list(map(ln.line_closed,poly))
#Convert features to geometries, and stitch together arcs.
class make_topo(Types):
def Feature (self,feature):
geometry = feature["geometry"]
if feature['geometry'] == None:
geometry = {}
if 'id' in feature:
geometry['id'] = feature['id']
if 'properties' in feature:
def stitch (objects, options=False):
verbose = False;
if type(options)==type({}) and 'verbose' in options:
verbose = not not options['verbose']
class Stitch(Types):
def polygon(self,polygon):
for line in polygon:
n = len(line)
a = False
b = False
c = False
i0 = -1
i=0
while i
self.emax = ee
point[0] = int(x)
point[1] = int(y)
finde=findEmax(objects)
emax = finde.emax
# Clock(objects,system.ring_area)
class find_coincidences(Types):
def line(self,line):
for point in line:
lines = ln.arcs.coincidence_lines(point)
if not line in lines:
lines.append(line)
fcInst = find_coincidences(objects)
polygon = lambda poly:list(map(ln.line_closed,poly))
#Convert features to geometries, and stitch together arcs.
class make_topo(Types):
def Feature (self,feature):
geometry = feature["geometry"]
if feature['geometry'] == None:
geometry = {}
if 'id' in feature:
geometry['id'] = feature['id']
if 'properties' in feature:
geometry['properties'] = feature['properties']
return self.geometry(geometry)
def FeatureCollection(self,collection):
collection['type'] = "GeometryCollection"
collection['geometries'] = list(map(self.Feature,collection['features']))
del collection['features']
return collection
def GeometryCollection(self,collection):
collection['geometries'] = list(map(self.geometry,collection['geometries']))
def simplify_object(obj,tolerance):
class Simplify(Types):
def line(self,points):
return simplify(points,tolerance)
def polygon(self,coordinates):
return list(map(self.line,coordinates))
def GeometryCollection(self,collection):
if collection.has_key('geometries'):
collection['geometries'] = list(map(self,geometry,collection['geometries']))
def LineString(self,lineString):
lineString['coordinates'] = self.line(lineString['coordinates'])
def MultiLineString(self,multiLineString):
multiLineString['coordinates'] = list(map(self.line,multiLineString['coordinates']))
def MultiPolygon(self,multiPolygon):
multiPolygon['coordinates'] = list(map(self.polygon,multiPolygon['coordinates']))
def Polygon(self,polygon):
polygon['coordinates']=self.polygon(polygon['coordinates'])
Simplify(obj)
def bound(objects):
class Bounds(Types):
def __init__(self):
self.x0=self.y0=float('inf')
self.x1=self.y1=-float('inf')
def point (self,point):
x = point[0]
y = point[1]
if x < self.x0:
self.x0 = x
if x > self.x1:
self.x1 = x
if y < self.y0:
self.y0 = y
if y > self.y1:
self.y1 = y
b=Bounds()
b.obj(objects)