diff --git a/app/__init__.py b/app/__init__.py old mode 100644 new mode 100755 diff --git a/app/controller/Geometria/Figure.py b/app/controller/Geometria/Figure.py old mode 100644 new mode 100755 index 157c662..5f64651 --- a/app/controller/Geometria/Figure.py +++ b/app/controller/Geometria/Figure.py @@ -1,1293 +1,1293 @@ -from typing import * -import os -import pickle -import sys - -import numpy as np -import copy - -from ...model.utils import msgLog - - -def Infinity(): - return float("inf") - -class figure(): - def __init__(self): - self.index=0 - self.position=point(0,0,0) - self.precision=4 - self.referencePoit=point(0,0,0) - self.update() - - def setPrecision(self, p): - self.precision=p - - def setIndex(self, i): - self.index=i - self.update() - - def setPos(self, pt): - self.position=pt - self.update() - - def getPos(self): - return self.position - - def move(self, pt): - self.setPos(pt) - self.update() - - def save(self, filename): - pickle.dump(self, open(filename, "wb")) - - def copy(self): - return copy.copy(self) - - def restore(self, filename): - try: - value=pickle.load(open(filename, "rb")) - except FileNotFoundError: - return False - self.copyFrom(value) - return True - - def update(self): - self._x=self.position[0] - self._y=self.position[1] - self._z=self.position[2] - - - def x(self): - return self.position.x() - - def y(self): - return self.position.y() - - def z(self): - return self.position.z() - - - def __add__(self, other): - return point(self._x + other.x(), self._y + other.y(), self._z + other.z()) - - def __sub__(self, other): - return point(self._x - other.x(), self._y - other.y(), self._z - other.z()) - - def __eq__(self, other): - return self._x == other.x() and self._y == other.y() and self._z == other.z() - - def __gt__(self, other): - return self.position.distanceTo(self.position.reference) > other.distanceTo(self.position.reference) - - def __ge__(self, other): - return self.position.distanceTo(self.position.reference) >= other.distanceTo(self.position.reference) - - def __lt__(self, other): - return self.position.distanceTo(self.position.reference) < other.distanceTo(self.position.reference) - - def __le__(self, other): - return self.position.distanceTo(self.position.reference) <= other.distanceTo(self.position.reference) - - def __str__(self): - return str("x: " + str(self._x) + ", y: " + str(self._y) + ", z: " + str(self._z)) - - def __ne__(self, other): - return self._x != other.x() or self._y != other.y() or self._z != other.z() - - def __getitem__(self, item): - return self.position.toList()[item] - - def __contains__(self, point): - pass - - def copyFrom(self, value): - if isinstance(value, figure): - self.__dict__ = copy.deepcopy(value.__dict__) - else: - self.data = value - - - - -class point(): - def __init__(self, x, y, z=0): - self._x=float(x) - self._y=float(y) - self._z=float(z) - self.index=0 - self.precision=5 - - if self._x==0 and self._y==0 and self._z==0: - self.reference=self - - else: - self.reference=point(0,0,0) - - def setIndex(self, i): - self.index=i - - def setX(self, z): - self._x=z - - def x(self): - return self._x - - def setY(self, z): - self._y=z - - def y(self): - return self._y - - def setZ(self, z): - self._z=z - - def z(self): - return self._z - - def toList(self): - return [self._x, self._y, self._z] - - def setFromList(self, l): - self._z=l[2] - self._y=l[1] - self._x=l[0] - - def deltaX(self, p): - if type(p)==point: - return self.x() - p.x() - elif type(p)==float or type(p) == int: - return self.x() - p - return 0 - - def deltaY(self, p): - if type(p) == point: - return self.y() - p.y() - elif type(p) == float or type(p)==int: - return self.y() - p - return 0 - - def deltaZ(self, p): - if type(p)==point: - return self.z() - p.z() - elif type(p)==float or type(p)==int: - return self.z() - p - return 0 - - def distanceTo(self, point2): - return np.sqrt(self.deltaX(point2)**2+self.deltaY(point2)**2+self.deltaZ(point2)**2) - - def __add__(self, other): - return point(self._x + other.x(), self._y + other.y(), self._z + other.z()) - - def __sub__(self, other): - return point(self._x - other.x(), self._y - other.y(), self._z - other.z()) - - def __mul__(self, other): - tp=type(other) - if type(other)==int or type(other)==float or tp==np.float or tp==np.float16 or tp==np.float32 or tp==np.float64 or tp==np.float80: - return point(self._x*other, self._y*other, self._z*other) - return False - - def __divmod__(self, other): - if type(other)==int: - return point(self._x*1/other, self._y*1/other, self._z*1/other) - return False - - def __eq__(self, other): - return round(self._x - other.x(), self.precision) == 0 and round(self._y - other.y(), self.precision)==0 and round(self._z - other.z(), self.precision)==0 - - def __gt__(self, other): - return self.distanceTo(self.reference) > other.distanceTo(self.reference) - - def __ge__(self, other): - return self.distanceTo(self.reference) >= other.distanceTo(self.reference) - - def __lt__(self, other): - return self.distanceTo(self.reference) < other.distanceTo(self.reference) - - def __le__(self, other): - return self.distanceTo(self.reference) <= other.distanceTo(self.reference) - - def __str__(self): - return str("x: " + str(self._x) + ", y: " + str(self._y) + ", z: " + str(self._z)) - - def __ne__(self, other): - return round(self._x - other.x(), self.precision)!=0 or round(self._y - other.y(), self.precision)!=0 or round(self._z - other.z(), self.precision)!=0 - - def __getitem__(self, item): - return self.toList()[item] - - def __contains__(self, lineOrCurve): - if type(lineOrCurve)==line: - - return line in self - - elif type(lineOrCurve)==curve: - for l in lineOrCurve.lines: - if self in l: - return True - - else: - raise ValueError - - - - def add(self, x, y, z=0): - self._x += x - self._y += y - self._z += z - return self - - def subtract(self, x, y, z=0): - self.add(-x,-y,-z) - - - def displaceXY(self, tan, lenghX): - if not Infinity()==tan: - self.add(lenghX, tan*lenghX) - - def displace(self, tanXY, tanZY, lengh): - pass - - def tan(self, point1): - try: - return (self.y() - point1.y()) / (self.x() - point1.x()) - except ZeroDivisionError: - return Infinity() - - def interpolXY(self, point1, x): - tan=self.tan(point1) - pt=copy.copy(self) - pt.displaceXY(tan, x - self.x()) - return pt.y() - - def invertXY(self): - x=self._x - self._x=self._y - self._y=x - - def move(self, pt): - self.setPos(pt) - - def setPos(self, pt): - self._x=pt.x() - self._y=pt.y() - self._z=pt.z() - - def copy(self): - return point(self._x, self._y) - - def copyFrom(self, value): - if isinstance(value, point): - self.__dict__ = copy.deepcopy(value.__dict__) - else: - self.data = value - -class pt(point): - - def __init__(self, x, y, z=0): - super(pt,self).__init__(x, y, z) - - -class line(figure): #ax+b - def __init__(self, p1, p2, index=0): - super(line,self).__init__() - self.point1=point(p1.x(), p1.y(), p1.z()) - self.point2=point(p2.x(), p2.y(), p2.z()) - self.position=self.point1 - self.point1.index=0 - self.point2.index=1 - - def getB(self): - return (self.point1.y()-self.point1.x()*self.getTan()) - - def getTan(self): - return self.point1.tan(self.point2) - - def getY(self, x): - return self.point1.interpolXY(self.point2, x) - - def getX(self, y): - self.point1.invertXY() - r=self.getY(y) - self.point1.invertXY() - return r - - def getFirstPoint(self): - return self.point1 - - def getLastPoint(self): - return self.point2 - - def __eq__(self, other): - return self.point1 == other.point1 and self.point2 == other.point2 - - def __contains__(self, item): - - if type(item) == curve: - for l in item.lines: - if self == l: - return True - return False - - elif type(item) == point: - - y1=self.getY(item.x()) - y2=item.y() - - if round(y1 - y2, self.precision) == 0: - x1=self.point1.x() - x2=self.point2.x() - return (min(x1,x2) <= item.x() and item.x() <= max(x1,x2)) - else: - return False - else: - raise ValueError - - def __str__(self): - return "("+str(self.point1.x())+","+str(self.point1.y())+"), " + "("+str(self.point2.x())+","+str(self.point2.y())+") ; " - - def isPositiveX(self): - return self.point1.x() <= self.point2.x() - - def trim(self, pt): - newLine=self.copy() - if type(pt)==line: - pt=self.intersect(pt) - if type(pt)==point: - if pt in newLine: - newLine = line(newLine.point1, pt) - return newLine - else: - return newLine - else: - return False - - def intersect(self, line2): - if self.isIntersecting(line2): - if line2.point1 in self and line2.point2 in self: - return copy.copy(line2) - elif line2.point1 in self: - return copy.copy(line2.point1) - elif line2.point2 in self: - return copy.copy(line2.point2) - elif self.point1 in line2 and self.point2 in line2: - return copy.copy(self) - elif self.point1 in line2: - return copy.copy(self.point1) - elif self.point2 in line2: - return copy.copy(self.point2) - elif self.point2.x() == self.point1.x(): - self.point2+=point(0.00000001, 0) - return self.intersect(line2) - elif line2.point2.x() == line2.point1.x(): - line2.point2+=point(0.00000001, 0) - return self.intersect(line2) - elif self.getTan() - line2.getTan() != 0: - x = (line2.getB()-self.getB())/(self.getTan()-line2.getTan()) - pt=point(x, (self.getY(x)+line2.getY(x))/2) - if (pt in line2) and (pt in self): - return pt - else: - return True - else: - return False - - - - def infiniteLineIntersec(self, line2): - if self.getTan() - line2.getTan() != 0: - x = (line2.getB()-self.getB())/(self.getTan()-line2.getTan()) - pt=point(x, (self.getY(x)+line2.getY(x))/2) - return pt - elif self.point2.x() == self.point1.x(): - self.point2+=point(0.00000001, 0) - return self.infiniteLineIntersec(line2) - elif line2.point2.x() == line2.point1.x(): - line2.point2+=point(0.00000001, 0) - return self.infiniteLineIntersec(line2) - else: - return False - - def getInversed(self): - r = self.copy() - r.point2 = self.point1 - r.point1 = self.point2 - return r - - def getLengh(self): - return self.point1.distanceTo(self.point2) - - def getHeight(self): - return (self.point2-self.point1).y() - - def getWidth(self): - return (self.point2-self.point1).x() - - def getMiddlePoint(self): - return (self.point2+self.point1)*0.5 - - def setPos(self, pt): - d=pt-self.position - self.point1+=d - self.point2+=d - self.position=pt - self.update() - - def rotate(self, angle, axes:point): - - if axes == self.point1: - pos=self.position.copy() - self.setPos(self.referencePoit) - angle = angle*np.pi/180 - pt = self.point2 - x = pt.x()*np.cos(angle)-pt.y()*np.sin(angle) - y = pt.x()*np.sin(angle)+pt.y()*np.cos(angle) - self.point2=point(x,y) - self.setPos(pos) - return - - elif axes == self.point2: - pos=self.position.copy() - self.setPos(self.referencePoit) - angle = angle*np.pi/180 - pt = self.point1 - x = pt.x()+pt.x()*np.cos(angle)-pt.y()*np.sin(angle) - y = pt.y()+pt.x()*np.sin(angle)+pt.y()*np.cos(angle) - self.point1=point(x,y) - self.setPos(pos) - return - - else: - l1=line(axes,self.point1) - l1.rotate(angle,axes) - - l2=line(axes,self.point2) - l2.rotate(angle,axes) - - self.point1=l1.point2 - self.point2=l2.point2 - self.update() - - def copy(self): - return line(self.point1.copy(), self.point2.copy()) - - def scale(self, s, reference = None): - if reference is None: - reference=self.getMiddlePoint() - - if reference == self.point1: - self.point2*=s - - elif reference == self.point2: - self.point1*=s - - else: - self.point1*=s - self.point2*=s - - self.update() - - - def isIntersecting(self, l): - p1=self.point1 - p2=self.point2 - q1=l.point1 - q2=l.point2 - return True or (((q1.x()-p1.x())*(p2.y()-p1.y()) - (q1.y()-p1.y())*(p2.x()-p1.x())) * ((q2.x()-p1.x())*(p2.y()-p1.y()) - (q2.y()-p1.y())*(p2.x()-p1.x())) < 0) and (((p1.x()-q1.x())*(q2.y()-q1.y()) - (p1.y()-q1.y())*(q2.x()-q1.x())) * ((p2.x()-q1.x())*(q2.y()-q1.y()) - (p2.y()-q1.y())*(q2.x()-q1.x())) < 0) - - - - - - -class curve(figure): - def __init__(self): - self.lines=[] - self.index=0 - self.wasInitialized=False - super(curve,self).__init__() - - - def clear(self): - self.lines=[] - self.wasInitialized=False - - def setPoints(self, points): - self.clear() - self.position=(points[0]) - - for i in range(0, len(points)-1): - self.lines.append(line(points[i], points[1+i], i)) - - self.wasInitialized=True - self.update() - return self - - def setLines(self, lines): - self.clear() - self.position = (lines[0].position) - i=0 - for l in lines: - L=copy.copy(l) - L.index=i - self.lines.append(L) - i+=1 - self.wasInitialized=True - self.update() - return self - - def setEq(self, string): - self.update() - - def prependCurve(self, c): - tmpc=c.copy() - lines=tmpc.lines - lines.reverse() - - if lines[-1].point2!=self.getFirstPoint(): - self.prependPoint(lines[0].point2) - for l in lines: - self.prependPoint(l.point1) - - def appendCurve(self,c): - lines=c.copy() - lines=lines.lines - - if lines[-1].point1!=self.getLastPoint(): - self.appendPoint(lines[0].point1) - for l in lines: - self.appendPoint(l.point2) - - def getY(self, x): - if not self.isClosed(): - for l in self.lines: - if (l.point2.x() >= x and l.point1.x() <= x and l.point2.x() > l.point1.x()) or (l.point2.x() <= x and l.point1.x() >= x and l.point2.x() < l.point1.x()): - return l.point1.interpolXY(l.point2, x) - return False - - def getX(self, y): - pass - - def getNumberOfLines(self): - return len(self.lines) - - def getFirstLine(self): - return self.lines[0] - - def getLastLine(self): - return self.lines[self.getNumberOfLines()-1] - - def getFirstPoint(self): - return self.lines[0].getFirstPoint() - - def getLastPoint(self): - return self.getLastLine().getLastPoint() - - def appendPoint(self, pt): - l=line(self.getLastPoint(), pt) - self.lines.append(l) - self.update() - - def intersect(self, curve2): - - r=[] - for l in self.lines: - for c in curve2.lines: - ax=[l.point1.x(), l.point2.x()] - bx=[c.point1.x(), c.point2.x()] - cy=[l.point1.y(), l.point2.y()] - dy=[c.point1.y(), c.point2.y()] - - if min(max(ax,bx))<=max(min(ax,bx)) and min(max(cy,dy))<=max(min(cy,dy)): - if l==c: - r.append(l.point2) - else: - pt=l.intersect(c) - if type(pt)==point: - r.append(pt) - R=[] - - for pt in r: - if not pt in R: - R.append(pt) - - return R - - - def removeLine(self, l): - if l in self: - self.lines.remove(l) - self.update() - - def __contains__(self, item): - - if type(item) == point: - for l in self.lines: - if item in l: - return True - return False - - elif type(item) == line: - for l in self.lines: - if l == item: - return True - return False - else: - return False - - def __str__(self): - s="" - for l in self.lines: - s+=str(l) - return s - - - def trim(self, c, n=-1): - lines=[] - - r=self.intersect(c) - - if type(r)==point: - s=False - for l in self.lines: - if r in l: - s=True - if n==-1: - lines.append(line(l.point1,r)) - else: - lines.append(line(r,l.point2)) - continue - if s: - lines.append(l) - - elif len(r)==1 or n==1: - r=r[0] - s=False - for l in self.lines: - if r in l: - s=True - if n==1: - lines.append(line(l.point1,r)) - s=False - else: - lines.append(line(r,l.point2)) - continue - if s: - lines.append(l) - - elif type(r) == list and len(r) >= 2: - if n==-1: - r=[r[0],r[-1]] - elif n>1: - r=r[:n] - - s = False - for l in self.lines: - if r[0] in l: - s = True - if r[1] in l: - lines.append(line(r[0],r[1])) - break - lines.append(line(r[0],l.point2)) - continue - - if r[1] in l: - lines.append(line(l.point1,r[1])) - break - - if s: - lines.append(l) - else: - return self.copy() - - return curve().setLines(lines) - - - def indexOfLine(self, l): - for L in self.lines: - if L==l: - return self.lines.index(L) - raise ValueError - - def update(self): - i=0 - for l in self.lines: - l.setIndex(i) - i+=1 - if self.wasInitialized: - self.position=self.lines[0].point1 - super(curve, self).update() - - def getInversed(self): - lines=[] - for l in self.lines: - lines.append(l.getInversed()) - r=curve() - lines.reverse() - r.setLines(lines) - return r - - def isContinuous(self): - for i, _ in enumerate(self.lines[:-1]): - if self.lines[i].point2 != self.lines[i+1].point1: - return False - return True - - def isClosed(self): - return self.isContinuous() and self.getLastPoint() == self.lines[0].point1 - - def getPoints(self): - r = [] - l2 = 0 - - for i, _ in enumerate(self.lines[:-1]): - l1 = self.lines[i] - l2 = self.lines[i+1] - - r.append(l1.point1.copy()) - - if l1.point2 != l2.point1: - r.append(l1.point2.copy()) - - if type(l2) == line: - r.append(l2.point1.copy()) - r.append(l2.point2.copy()) - - if len(self.lines)==1: - r.append(self.lines[0].point1) - r.append(self.lines[0].point2) - - return r - - - def prependPoint(self, pt): - lines=[] - lines.append(line(pt, self.lines[0].point1)) - for l in self.lines: - lines.append(l) - self.setLines(lines) - - def setPos(self, pt): - d=pt-self.position - for i,_ in enumerate(self.lines): - self.lines[i].setPos(d+self.lines[i].position) - - self.position=pt - self.update() - - def rotate(self, angle, axes): - - if axes==self.position: - points=[] - for pt in self.getPoints(): - l=line(axes,pt) - l.rotate(angle,axes) - points.append(l.point2) - - self.setPoints(points) - self.position=self.lines[0].point1 - self.update() - - else: - self.prependPoint(axes) - self.rotate(angle,axes) - self.removeLine(self.getFirstLine()) - - def getGeoCenter(self): - y=0 - x=0 - for pt in self.getPoints(): - y+=pt.y() - x+=pt.x() - x=x/(self.getNumberOfLines()+1) - y=y/(self.getNumberOfLines()+1) - - return point(x, y) - - def scale(self, s, reference=None): - if reference is None: - reference=self.getGeoCenter() - - points=[] - for pt in self.getPoints(): - l=line(reference,pt) - l.scale(s,l.point1) - points.append(l.point2) - - self.setPoints(points) - self.position=self.lines[0].point1 - self.update() - - - - def mirror(self, l:line): - if l.getTan() == 0 or l.point2.x()==l.point1.x(): - l.point2+=point(0.00001,0.00001) - - points=[] - perp=l.copy() - perp.rotate(90,perp.point1) - - for pt in self.getPoints(): - p=perp.copy() - p.setPos(pt) - r=p.infiniteLineIntersec(l) - - if type(r)==point: - - points.append(pt+(r-pt)*2) - - self.setPoints(points) - self.update() - return perp - - - - def copy(self): - c=curve() - c.setPoints(self.getPoints()) - return c - - def getHeight(self): - h=0 - H=[] - for l in self.lines: - h+=l.getHeight() - H.append(abs(h)) - return max(H) - - def getWidth(self): - h=0 - H=[] - for l in self.lines: - h+=l.getWidth() - H.append(abs(h)) - return max(H) - - def cut(self, xn): - newCurve1=curve() - newCurve2=curve() - lines1=[] - lines2=[] - cutted=False - for l in self.lines: - if not cutted: - if xn in l: - lines1.append(line(l.point1, xn)) - lines2.append(line(xn, l.point2)) - cutted=True - else: - lines1.append(l) - else: - lines2.append(l) - - if len(lines1)>0: - newCurve1.setLines(lines1) - if len(lines2)>0: - newCurve2.setLines(lines2) - return newCurve1, newCurve2 - - - -class face(figure): - - def __init__(self): - self.position=pt(0,0) - self.superior = curve() - self.inferior = curve() - self.area = 0 - self.index = 0 - self.curve = curve() - - - def from2Curves(self, superior, inferior): - - self.superior = superior.trim(inferior) - self.inferior = inferior.trim(superior) - - self.position = superior.position - lines=[] - for l in self.superior.getInversed().lines: - lines.append(l) - for l in self.inferior.lines: - lines.append(l) - self.curve.setLines(lines) - self.update() - - return self - - def fromClosedCurve(self, c:curve): - - if not c.isClosed(): - c.appendPoint(c.getFirstPoint()) - - self.curve = c - self.update() - return self - - - def update(self): - - super(face, self).update() - - if not self.curve.wasInitialized: - self.curve=curve() - self.setPos(self.superior.getFirstPoint()) - lines=[] - for l in self.inferior.lines: - lines.append(l) - for l in self.superior.getInversed().lines: - lines.append(l) - self.setPos(lines[0].point1) - - self.curve.setLines(lines) - - - - - - - def getArea(self): - s=0 - if self.curve.isClosed(): - points=self.curve.getPoints() - act=0 - aat=0 - - for i,_ in enumerate(points[:-1]): - s+=points[i].x()*points[i+1].y() - s+=points[-1].x()*points[0].y() - - for i,_ in enumerate(points[:-1]): - s-=points[i].y()*points[i+1].x() - s-=points[-1].y()*points[0].x() - - s=(s)/2 - - self.area=s - return s - - def getAreas(self): - sup=self.superior - inf=self.inferior - areaCt=0 - areaAt=0 - x=sup.intersect(inf) - - - for i in range(0, len(x)-1): - mf=face() - xp=x[i].x() - xn=x[i+1].x() - m=(xp+xn)/2 - pista, sup=sup.cut(x[i+1]) - terreno, inf=inf.cut(x[i+1]) - mf.from2Curves(pista,terreno) - # test(plotCurve(mf.curve)) - - if self.inferior.getY(m) curve: - return self.faces[i].curve - - def fromFaces(self, faces, s=None): - if s is None: - self.faces=faces - else: - z=0 - for fc in faces: - fc.setPos(point(fc.position.x(), fc.position.y(), z)) - self.faces.append(fc) - - z+=s - self.wasInitialized=True - self.update() - return self - - def addFace(self,f:face,offset=20): - if self.lastIndex==-1: - z=0 - else: - z=self.getLastFace().position.z()+offset - f=f.copy() - f.setPos(point(f.position.x(),f.position.y(),z)) - self.faces.append(f) - self.update() - - def appendFace(self,f): - f.setPos(point(f.position.x(),f.position.y(),f.position.z())) - self.faces.append(f) - self.update() - - - def getFace(self, i:int) -> face: - return self.faces[i] - - def replaceFaceKeepZ(self,f:face,i): - tmpf=self.getFace(i) - self.faces[i]=f - self.faces[i].setPos(point(f.position.x(),f.position.y(),tmpf.z())) - - def replaceFace(self,f:face,i): - self.faces[i]=f - self.faces[i].setPos(point(f.position.x(),f.position.y(),f.position.z())) - - - def getLastFace(self) -> face: - return self.faces[-1] - - def getFirstFace(self) -> face: - return self.faces[0] - - - def update(self): - super(prismoide, self).update() - self.lastIndex=len(self.faces)-1 - - - def getVolume(self, i1=0, i2=None): - if i2 is None: - i2=len(self.faces)-1 - self.volume=0 - for i, face in enumerate(self.faces[i1:i2]): - #semisoma - nextFace=self.faces[i+1] - self.volume+=(face.getArea()+nextFace.getArea())*abs(face.position.z()-nextFace.position.z())/2 - - return self.volume - - def getVolumes(self, i1=0, i2=None): - try: - if i2 is None: - i2 = len(self.faces)-1 - vat = vct = 0 - for i, face in enumerate(self.faces[i1:i2]): - #semisoma - nextFace = self.faces[i+1] - nct, nat = nextFace.getAreas() - ct, at = face.getAreas() - vct += (ct + nct) * abs(face.position.z() - nextFace.position.z()) / 2 - vat += (at + nat) * abs(face.position.z() - nextFace.position.z()) / 2 - except: - msgLog("Erro na estaca de número "+str(i)) - - return vct, vat - - def getBruckVols(self, i1=0, i2=None, fh=1): - data=[] - try: - if i2 is None: - i2 = len(self.faces) - 1 - vat = vct = 0 - for i, face in enumerate(self.faces[i1:i2]): - # semisoma - nextFace = self.faces[i + 1] - nct, nat = nextFace.getAreas() - ct, at = face.getAreas() - dist = abs(face.position.z() - nextFace.position.z()) - vct += (ct + nct) * dist / 2 - vat += (at + nat) * dist / 2*fh - data.append({"corte": abs(ct), "aterro": abs(at), "at.cor.": abs(at*fh), "soma":at+ct, "semi-distancia": dist, - "vol.corte":vct, "vol.aterro":vat, "volume":-(vat+vct)}) - except: - msgLog("Erro na estaca de número " + str(i)) - dist=0 - ct=at=vct=vat=0 - data.append( - {"corte": abs(ct), "aterro": abs(at), "at.cor.": abs(at * fh), "soma": at + ct, "semi-distancia": dist, - "vol.corte": vct, "vol.aterro": vat, "volume": -(vat + vct)}) - - return data - - -class square(curve): - - def __init__(self,side=1): - super(square, self).__init__() - self.setPoints([pt(-0.5,0.5),pt(.5,.5),pt(.5,-.5),pt(-.5,-.5)]) - self.scale(side) - - -def plotLine(l:line, color="w"): - - x=[] - y=[] - - x.append(l.point1.x()) - x.append(l.point2.x()) - y.append(l.point1.y()) - y.append(l.point2.y()) - return x, y - -def plotCurve(c:curve, color="w"): - - x=[] - y=[] - - for pt in c.getPoints(): - x.append(pt.x()) - y.append(pt.y()) - return x, y - -def plotPrismoid(pris:prismoide): - pass - -#TESTS: -def test(a, title="Test"): - from .... import PyQtGraph as pg - plotWidget=pg.plot(title=title) - X,Y=a - cu=pg.PlotCurveItem() - cu.setData(X,Y) - plotWidget.addItem(cu) - - pg.mkQApp() - pg.QAPP.exec_() - - - -def test1(): - p1 = point(-10, -2) - p2 = point(-5, 3) - p3 = point(0, 10) - p4 = point(5, 5) - p5 = point(10, -10) - p6 = point(15, 10) - p7 = point(20, 7) - p8 = point(25, 1) - - ptList=[p1,p2,p3,p4,p5,p6,p7,p8] - ptList2=[p1+point(2,-5)] - - for pt in ptList: - if pt.x()==10: - ptList2.append(pt.copy().add(0,10)) - else: - ptList2.append(pt.copy().add(0,5)) - - ptList2.append(p8+point(-2,-5)) - - l=line(p1,p2) - l2=line(p2,p3) - - c=curve() - c.setPoints(ptList) - - c2=curve() - c2.setPoints(ptList2) - - s=line(point(-5,-5),point(5,5)) - s2=line(point(-5,5),point(6,-5)) - - x=curve() - x.setPoints([point(-1,-1),point(1,-1),point(1,1),point(-1,1),point(-1,-1)]) - - f=face() - f.from2Curves(c,c2) - - w1=c.getLastLine() - w2=c2.getLastLine() - - c4=f.curve.copy() - c4.rotate(90, point(0,0)) - - ref=line(point(-10,0),point(10,0)) - - c3=f.curve.copy() - c3.mirror(ref) - c3.setPos(c3.position+point(0,-1)) - - plotCurve(f.curve) - plotCurve(c3) - - l3=line(point(-10,0),point(10,0)) - - plotLine(l3) - - l4=l3.copy() - l4.rotate(90,l3.getMiddlePoint()) - l4=l4.trim(l3) - plotLine(l4) - print("A= " + str(f.area)) - - - -def test2(): - terreno=[pt(-6,-5),pt(-4,-4),pt(-4,-2),pt(-3,0),pt(-2,2),pt(-1,1),pt(0,3),pt(1,3),pt(2,6),pt(3,8),pt(4,9),pt(5,10),pt(6,15)] - tc=curve() - tc.setPoints(terreno) - - l=line(tc.getFirstPoint(), pt(tc.getFirstPoint().x(),tc.getHeight())) - l2=l.copy() - l2.setPos(tc.getLastPoint()) - - tc.prependPoint(l.point2) - tc.appendPoint(l2.point2) - - pista=curve() - pista.setPoints([pt(-7,-20),pt(-3,5),pt(3,5),pt(7,20)]) - - f=face() - f.from2Curves(pista, tc) - print("A: " + str(f.area)) - - #plotCurve(tc) - #plotCurve(pista) - - - - prism=prismoide() - prism.fromFaces([f,f.copy(), f.copy()], 20) - print("Volume 20m: " + str(prism.getVolume())) - - prism.save("test") - - prism2=prismoide() - prism2.restore("test") - - print("Volume 20m: " + str(prism2.getVolume())) - - import pyqtgraph as pg - plotWidget=pg.plot(title="test") - - tc2=tc.copy() - tc2.position=tc2.getLastPoint() - tc2.setPos(tc.getFirstPoint()) - tc.prependCurve(tc2) - - X,Y = plotCurve(tc) - cu=pg.PlotCurveItem() - cu.setData(X,Y) - plotWidget.addItem(cu) - - pg.mkQApp() - pg.QAPP.exec_() - - - - - +from typing import * +import os +import pickle +import sys + +import numpy as np +import copy + +from ...model.utils import msgLog + + +def Infinity(): + return float("inf") + +class figure(): + def __init__(self): + self.index=0 + self.position=point(0,0,0) + self.precision=4 + self.referencePoit=point(0,0,0) + self.update() + + def setPrecision(self, p): + self.precision=p + + def setIndex(self, i): + self.index=i + self.update() + + def setPos(self, pt): + self.position=pt + self.update() + + def getPos(self): + return self.position + + def move(self, pt): + self.setPos(pt) + self.update() + + def save(self, filename): + pickle.dump(self, open(filename, "wb")) + + def copy(self): + return copy.copy(self) + + def restore(self, filename): + try: + value=pickle.load(open(filename, "rb")) + except FileNotFoundError: + return False + self.copyFrom(value) + return True + + def update(self): + self._x=self.position[0] + self._y=self.position[1] + self._z=self.position[2] + + + def x(self): + return self.position.x() + + def y(self): + return self.position.y() + + def z(self): + return self.position.z() + + + def __add__(self, other): + return point(self._x + other.x(), self._y + other.y(), self._z + other.z()) + + def __sub__(self, other): + return point(self._x - other.x(), self._y - other.y(), self._z - other.z()) + + def __eq__(self, other): + return self._x == other.x() and self._y == other.y() and self._z == other.z() + + def __gt__(self, other): + return self.position.distanceTo(self.position.reference) > other.distanceTo(self.position.reference) + + def __ge__(self, other): + return self.position.distanceTo(self.position.reference) >= other.distanceTo(self.position.reference) + + def __lt__(self, other): + return self.position.distanceTo(self.position.reference) < other.distanceTo(self.position.reference) + + def __le__(self, other): + return self.position.distanceTo(self.position.reference) <= other.distanceTo(self.position.reference) + + def __str__(self): + return str("x: " + str(self._x) + ", y: " + str(self._y) + ", z: " + str(self._z)) + + def __ne__(self, other): + return self._x != other.x() or self._y != other.y() or self._z != other.z() + + def __getitem__(self, item): + return self.position.toList()[item] + + def __contains__(self, point): + pass + + def copyFrom(self, value): + if isinstance(value, figure): + self.__dict__ = copy.deepcopy(value.__dict__) + else: + self.data = value + + + + +class point(): + def __init__(self, x, y, z=0): + self._x=float(x) + self._y=float(y) + self._z=float(z) + self.index=0 + self.precision=5 + + if self._x==0 and self._y==0 and self._z==0: + self.reference=self + + else: + self.reference=point(0,0,0) + + def setIndex(self, i): + self.index=i + + def setX(self, z): + self._x=z + + def x(self): + return self._x + + def setY(self, z): + self._y=z + + def y(self): + return self._y + + def setZ(self, z): + self._z=z + + def z(self): + return self._z + + def toList(self): + return [self._x, self._y, self._z] + + def setFromList(self, l): + self._z=l[2] + self._y=l[1] + self._x=l[0] + + def deltaX(self, p): + if type(p)==point: + return self.x() - p.x() + elif type(p)==float or type(p) == int: + return self.x() - p + return 0 + + def deltaY(self, p): + if type(p) == point: + return self.y() - p.y() + elif type(p) == float or type(p)==int: + return self.y() - p + return 0 + + def deltaZ(self, p): + if type(p)==point: + return self.z() - p.z() + elif type(p)==float or type(p)==int: + return self.z() - p + return 0 + + def distanceTo(self, point2): + return np.sqrt(self.deltaX(point2)**2+self.deltaY(point2)**2+self.deltaZ(point2)**2) + + def __add__(self, other): + return point(self._x + other.x(), self._y + other.y(), self._z + other.z()) + + def __sub__(self, other): + return point(self._x - other.x(), self._y - other.y(), self._z - other.z()) + + def __mul__(self, other): + tp=type(other) + if type(other)==int or type(other)==float or tp==np.float or tp==np.float16 or tp==np.float32 or tp==np.float64 or tp==np.float80: + return point(self._x*other, self._y*other, self._z*other) + return False + + def __divmod__(self, other): + if type(other)==int: + return point(self._x*1/other, self._y*1/other, self._z*1/other) + return False + + def __eq__(self, other): + return round(self._x - other.x(), self.precision) == 0 and round(self._y - other.y(), self.precision)==0 and round(self._z - other.z(), self.precision)==0 + + def __gt__(self, other): + return self.distanceTo(self.reference) > other.distanceTo(self.reference) + + def __ge__(self, other): + return self.distanceTo(self.reference) >= other.distanceTo(self.reference) + + def __lt__(self, other): + return self.distanceTo(self.reference) < other.distanceTo(self.reference) + + def __le__(self, other): + return self.distanceTo(self.reference) <= other.distanceTo(self.reference) + + def __str__(self): + return str("x: " + str(self._x) + ", y: " + str(self._y) + ", z: " + str(self._z)) + + def __ne__(self, other): + return round(self._x - other.x(), self.precision)!=0 or round(self._y - other.y(), self.precision)!=0 or round(self._z - other.z(), self.precision)!=0 + + def __getitem__(self, item): + return self.toList()[item] + + def __contains__(self, lineOrCurve): + if type(lineOrCurve)==line: + + return line in self + + elif type(lineOrCurve)==curve: + for l in lineOrCurve.lines: + if self in l: + return True + + else: + raise ValueError + + + + def add(self, x, y, z=0): + self._x += x + self._y += y + self._z += z + return self + + def subtract(self, x, y, z=0): + self.add(-x,-y,-z) + + + def displaceXY(self, tan, lenghX): + if not Infinity()==tan: + self.add(lenghX, tan*lenghX) + + def displace(self, tanXY, tanZY, lengh): + pass + + def tan(self, point1): + try: + return (self.y() - point1.y()) / (self.x() - point1.x()) + except ZeroDivisionError: + return Infinity() + + def interpolXY(self, point1, x): + tan=self.tan(point1) + pt=copy.copy(self) + pt.displaceXY(tan, x - self.x()) + return pt.y() + + def invertXY(self): + x=self._x + self._x=self._y + self._y=x + + def move(self, pt): + self.setPos(pt) + + def setPos(self, pt): + self._x=pt.x() + self._y=pt.y() + self._z=pt.z() + + def copy(self): + return point(self._x, self._y) + + def copyFrom(self, value): + if isinstance(value, point): + self.__dict__ = copy.deepcopy(value.__dict__) + else: + self.data = value + +class pt(point): + + def __init__(self, x, y, z=0): + super(pt,self).__init__(x, y, z) + + +class line(figure): #ax+b + def __init__(self, p1, p2, index=0): + super(line,self).__init__() + self.point1=point(p1.x(), p1.y(), p1.z()) + self.point2=point(p2.x(), p2.y(), p2.z()) + self.position=self.point1 + self.point1.index=0 + self.point2.index=1 + + def getB(self): + return (self.point1.y()-self.point1.x()*self.getTan()) + + def getTan(self): + return self.point1.tan(self.point2) + + def getY(self, x): + return self.point1.interpolXY(self.point2, x) + + def getX(self, y): + self.point1.invertXY() + r=self.getY(y) + self.point1.invertXY() + return r + + def getFirstPoint(self): + return self.point1 + + def getLastPoint(self): + return self.point2 + + def __eq__(self, other): + return self.point1 == other.point1 and self.point2 == other.point2 + + def __contains__(self, item): + + if type(item) == curve: + for l in item.lines: + if self == l: + return True + return False + + elif type(item) == point: + + y1=self.getY(item.x()) + y2=item.y() + + if round(y1 - y2, self.precision) == 0: + x1=self.point1.x() + x2=self.point2.x() + return (min(x1,x2) <= item.x() and item.x() <= max(x1,x2)) + else: + return False + else: + raise ValueError + + def __str__(self): + return "("+str(self.point1.x())+","+str(self.point1.y())+"), " + "("+str(self.point2.x())+","+str(self.point2.y())+") ; " + + def isPositiveX(self): + return self.point1.x() <= self.point2.x() + + def trim(self, pt): + newLine=self.copy() + if type(pt)==line: + pt=self.intersect(pt) + if type(pt)==point: + if pt in newLine: + newLine = line(newLine.point1, pt) + return newLine + else: + return newLine + else: + return False + + def intersect(self, line2): + if self.isIntersecting(line2): + if line2.point1 in self and line2.point2 in self: + return copy.copy(line2) + elif line2.point1 in self: + return copy.copy(line2.point1) + elif line2.point2 in self: + return copy.copy(line2.point2) + elif self.point1 in line2 and self.point2 in line2: + return copy.copy(self) + elif self.point1 in line2: + return copy.copy(self.point1) + elif self.point2 in line2: + return copy.copy(self.point2) + elif self.point2.x() == self.point1.x(): + self.point2+=point(0.00000001, 0) + return self.intersect(line2) + elif line2.point2.x() == line2.point1.x(): + line2.point2+=point(0.00000001, 0) + return self.intersect(line2) + elif self.getTan() - line2.getTan() != 0: + x = (line2.getB()-self.getB())/(self.getTan()-line2.getTan()) + pt=point(x, (self.getY(x)+line2.getY(x))/2) + if (pt in line2) and (pt in self): + return pt + else: + return True + else: + return False + + + + def infiniteLineIntersec(self, line2): + if self.getTan() - line2.getTan() != 0: + x = (line2.getB()-self.getB())/(self.getTan()-line2.getTan()) + pt=point(x, (self.getY(x)+line2.getY(x))/2) + return pt + elif self.point2.x() == self.point1.x(): + self.point2+=point(0.00000001, 0) + return self.infiniteLineIntersec(line2) + elif line2.point2.x() == line2.point1.x(): + line2.point2+=point(0.00000001, 0) + return self.infiniteLineIntersec(line2) + else: + return False + + def getInversed(self): + r = self.copy() + r.point2 = self.point1 + r.point1 = self.point2 + return r + + def getLengh(self): + return self.point1.distanceTo(self.point2) + + def getHeight(self): + return (self.point2-self.point1).y() + + def getWidth(self): + return (self.point2-self.point1).x() + + def getMiddlePoint(self): + return (self.point2+self.point1)*0.5 + + def setPos(self, pt): + d=pt-self.position + self.point1+=d + self.point2+=d + self.position=pt + self.update() + + def rotate(self, angle, axes:point): + + if axes == self.point1: + pos=self.position.copy() + self.setPos(self.referencePoit) + angle = angle*np.pi/180 + pt = self.point2 + x = pt.x()*np.cos(angle)-pt.y()*np.sin(angle) + y = pt.x()*np.sin(angle)+pt.y()*np.cos(angle) + self.point2=point(x,y) + self.setPos(pos) + return + + elif axes == self.point2: + pos=self.position.copy() + self.setPos(self.referencePoit) + angle = angle*np.pi/180 + pt = self.point1 + x = pt.x()+pt.x()*np.cos(angle)-pt.y()*np.sin(angle) + y = pt.y()+pt.x()*np.sin(angle)+pt.y()*np.cos(angle) + self.point1=point(x,y) + self.setPos(pos) + return + + else: + l1=line(axes,self.point1) + l1.rotate(angle,axes) + + l2=line(axes,self.point2) + l2.rotate(angle,axes) + + self.point1=l1.point2 + self.point2=l2.point2 + self.update() + + def copy(self): + return line(self.point1.copy(), self.point2.copy()) + + def scale(self, s, reference = None): + if reference is None: + reference=self.getMiddlePoint() + + if reference == self.point1: + self.point2*=s + + elif reference == self.point2: + self.point1*=s + + else: + self.point1*=s + self.point2*=s + + self.update() + + + def isIntersecting(self, l): + p1=self.point1 + p2=self.point2 + q1=l.point1 + q2=l.point2 + return True or (((q1.x()-p1.x())*(p2.y()-p1.y()) - (q1.y()-p1.y())*(p2.x()-p1.x())) * ((q2.x()-p1.x())*(p2.y()-p1.y()) - (q2.y()-p1.y())*(p2.x()-p1.x())) < 0) and (((p1.x()-q1.x())*(q2.y()-q1.y()) - (p1.y()-q1.y())*(q2.x()-q1.x())) * ((p2.x()-q1.x())*(q2.y()-q1.y()) - (p2.y()-q1.y())*(q2.x()-q1.x())) < 0) + + + + + + +class curve(figure): + def __init__(self): + self.lines=[] + self.index=0 + self.wasInitialized=False + super(curve,self).__init__() + + + def clear(self): + self.lines=[] + self.wasInitialized=False + + def setPoints(self, points): + self.clear() + self.position=(points[0]) + + for i in range(0, len(points)-1): + self.lines.append(line(points[i], points[1+i], i)) + + self.wasInitialized=True + self.update() + return self + + def setLines(self, lines): + self.clear() + self.position = (lines[0].position) + i=0 + for l in lines: + L=copy.copy(l) + L.index=i + self.lines.append(L) + i+=1 + self.wasInitialized=True + self.update() + return self + + def setEq(self, string): + self.update() + + def prependCurve(self, c): + tmpc=c.copy() + lines=tmpc.lines + lines.reverse() + + if lines[-1].point2!=self.getFirstPoint(): + self.prependPoint(lines[0].point2) + for l in lines: + self.prependPoint(l.point1) + + def appendCurve(self,c): + lines=c.copy() + lines=lines.lines + + if lines[-1].point1!=self.getLastPoint(): + self.appendPoint(lines[0].point1) + for l in lines: + self.appendPoint(l.point2) + + def getY(self, x): + if not self.isClosed(): + for l in self.lines: + if (l.point2.x() >= x and l.point1.x() <= x and l.point2.x() > l.point1.x()) or (l.point2.x() <= x and l.point1.x() >= x and l.point2.x() < l.point1.x()): + return l.point1.interpolXY(l.point2, x) + return False + + def getX(self, y): + pass + + def getNumberOfLines(self): + return len(self.lines) + + def getFirstLine(self): + return self.lines[0] + + def getLastLine(self): + return self.lines[self.getNumberOfLines()-1] + + def getFirstPoint(self): + return self.lines[0].getFirstPoint() + + def getLastPoint(self): + return self.getLastLine().getLastPoint() + + def appendPoint(self, pt): + l=line(self.getLastPoint(), pt) + self.lines.append(l) + self.update() + + def intersect(self, curve2): + + r=[] + for l in self.lines: + for c in curve2.lines: + ax=[l.point1.x(), l.point2.x()] + bx=[c.point1.x(), c.point2.x()] + cy=[l.point1.y(), l.point2.y()] + dy=[c.point1.y(), c.point2.y()] + + if min(max(ax,bx))<=max(min(ax,bx)) and min(max(cy,dy))<=max(min(cy,dy)): + if l==c: + r.append(l.point2) + else: + pt=l.intersect(c) + if type(pt)==point: + r.append(pt) + R=[] + + for pt in r: + if not pt in R: + R.append(pt) + + return R + + + def removeLine(self, l): + if l in self: + self.lines.remove(l) + self.update() + + def __contains__(self, item): + + if type(item) == point: + for l in self.lines: + if item in l: + return True + return False + + elif type(item) == line: + for l in self.lines: + if l == item: + return True + return False + else: + return False + + def __str__(self): + s="" + for l in self.lines: + s+=str(l) + return s + + + def trim(self, c, n=-1): + lines=[] + + r=self.intersect(c) + + if type(r)==point: + s=False + for l in self.lines: + if r in l: + s=True + if n==-1: + lines.append(line(l.point1,r)) + else: + lines.append(line(r,l.point2)) + continue + if s: + lines.append(l) + + elif len(r)==1 or n==1: + r=r[0] + s=False + for l in self.lines: + if r in l: + s=True + if n==1: + lines.append(line(l.point1,r)) + s=False + else: + lines.append(line(r,l.point2)) + continue + if s: + lines.append(l) + + elif type(r) == list and len(r) >= 2: + if n==-1: + r=[r[0],r[-1]] + elif n>1: + r=r[:n] + + s = False + for l in self.lines: + if r[0] in l: + s = True + if r[1] in l: + lines.append(line(r[0],r[1])) + break + lines.append(line(r[0],l.point2)) + continue + + if r[1] in l: + lines.append(line(l.point1,r[1])) + break + + if s: + lines.append(l) + else: + return self.copy() + + return curve().setLines(lines) + + + def indexOfLine(self, l): + for L in self.lines: + if L==l: + return self.lines.index(L) + raise ValueError + + def update(self): + i=0 + for l in self.lines: + l.setIndex(i) + i+=1 + if self.wasInitialized: + self.position=self.lines[0].point1 + super(curve, self).update() + + def getInversed(self): + lines=[] + for l in self.lines: + lines.append(l.getInversed()) + r=curve() + lines.reverse() + r.setLines(lines) + return r + + def isContinuous(self): + for i, _ in enumerate(self.lines[:-1]): + if self.lines[i].point2 != self.lines[i+1].point1: + return False + return True + + def isClosed(self): + return self.isContinuous() and self.getLastPoint() == self.lines[0].point1 + + def getPoints(self): + r = [] + l2 = 0 + + for i, _ in enumerate(self.lines[:-1]): + l1 = self.lines[i] + l2 = self.lines[i+1] + + r.append(l1.point1.copy()) + + if l1.point2 != l2.point1: + r.append(l1.point2.copy()) + + if type(l2) == line: + r.append(l2.point1.copy()) + r.append(l2.point2.copy()) + + if len(self.lines)==1: + r.append(self.lines[0].point1) + r.append(self.lines[0].point2) + + return r + + + def prependPoint(self, pt): + lines=[] + lines.append(line(pt, self.lines[0].point1)) + for l in self.lines: + lines.append(l) + self.setLines(lines) + + def setPos(self, pt): + d=pt-self.position + for i,_ in enumerate(self.lines): + self.lines[i].setPos(d+self.lines[i].position) + + self.position=pt + self.update() + + def rotate(self, angle, axes): + + if axes==self.position: + points=[] + for pt in self.getPoints(): + l=line(axes,pt) + l.rotate(angle,axes) + points.append(l.point2) + + self.setPoints(points) + self.position=self.lines[0].point1 + self.update() + + else: + self.prependPoint(axes) + self.rotate(angle,axes) + self.removeLine(self.getFirstLine()) + + def getGeoCenter(self): + y=0 + x=0 + for pt in self.getPoints(): + y+=pt.y() + x+=pt.x() + x=x/(self.getNumberOfLines()+1) + y=y/(self.getNumberOfLines()+1) + + return point(x, y) + + def scale(self, s, reference=None): + if reference is None: + reference=self.getGeoCenter() + + points=[] + for pt in self.getPoints(): + l=line(reference,pt) + l.scale(s,l.point1) + points.append(l.point2) + + self.setPoints(points) + self.position=self.lines[0].point1 + self.update() + + + + def mirror(self, l:line): + if l.getTan() == 0 or l.point2.x()==l.point1.x(): + l.point2+=point(0.00001,0.00001) + + points=[] + perp=l.copy() + perp.rotate(90,perp.point1) + + for pt in self.getPoints(): + p=perp.copy() + p.setPos(pt) + r=p.infiniteLineIntersec(l) + + if type(r)==point: + + points.append(pt+(r-pt)*2) + + self.setPoints(points) + self.update() + return perp + + + + def copy(self): + c=curve() + c.setPoints(self.getPoints()) + return c + + def getHeight(self): + h=0 + H=[] + for l in self.lines: + h+=l.getHeight() + H.append(abs(h)) + return max(H) + + def getWidth(self): + h=0 + H=[] + for l in self.lines: + h+=l.getWidth() + H.append(abs(h)) + return max(H) + + def cut(self, xn): + newCurve1=curve() + newCurve2=curve() + lines1=[] + lines2=[] + cutted=False + for l in self.lines: + if not cutted: + if xn in l: + lines1.append(line(l.point1, xn)) + lines2.append(line(xn, l.point2)) + cutted=True + else: + lines1.append(l) + else: + lines2.append(l) + + if len(lines1)>0: + newCurve1.setLines(lines1) + if len(lines2)>0: + newCurve2.setLines(lines2) + return newCurve1, newCurve2 + + + +class face(figure): + + def __init__(self): + self.position=pt(0,0) + self.superior = curve() + self.inferior = curve() + self.area = 0 + self.index = 0 + self.curve = curve() + + + def from2Curves(self, superior, inferior): + + self.superior = superior.trim(inferior) + self.inferior = inferior.trim(superior) + + self.position = superior.position + lines=[] + for l in self.superior.getInversed().lines: + lines.append(l) + for l in self.inferior.lines: + lines.append(l) + self.curve.setLines(lines) + self.update() + + return self + + def fromClosedCurve(self, c:curve): + + if not c.isClosed(): + c.appendPoint(c.getFirstPoint()) + + self.curve = c + self.update() + return self + + + def update(self): + + super(face, self).update() + + if not self.curve.wasInitialized: + self.curve=curve() + self.setPos(self.superior.getFirstPoint()) + lines=[] + for l in self.inferior.lines: + lines.append(l) + for l in self.superior.getInversed().lines: + lines.append(l) + self.setPos(lines[0].point1) + + self.curve.setLines(lines) + + + + + + + def getArea(self): + s=0 + if self.curve.isClosed(): + points=self.curve.getPoints() + act=0 + aat=0 + + for i,_ in enumerate(points[:-1]): + s+=points[i].x()*points[i+1].y() + s+=points[-1].x()*points[0].y() + + for i,_ in enumerate(points[:-1]): + s-=points[i].y()*points[i+1].x() + s-=points[-1].y()*points[0].x() + + s=(s)/2 + + self.area=s + return s + + def getAreas(self): + sup=self.superior + inf=self.inferior + areaCt=0 + areaAt=0 + x=sup.intersect(inf) + + + for i in range(0, len(x)-1): + mf=face() + xp=x[i].x() + xn=x[i+1].x() + m=(xp+xn)/2 + pista, sup=sup.cut(x[i+1]) + terreno, inf=inf.cut(x[i+1]) + mf.from2Curves(pista,terreno) + # test(plotCurve(mf.curve)) + + if self.inferior.getY(m) curve: + return self.faces[i].curve + + def fromFaces(self, faces, s=None): + if s is None: + self.faces=faces + else: + z=0 + for fc in faces: + fc.setPos(point(fc.position.x(), fc.position.y(), z)) + self.faces.append(fc) + + z+=s + self.wasInitialized=True + self.update() + return self + + def addFace(self,f:face,offset=20): + if self.lastIndex==-1: + z=0 + else: + z=self.getLastFace().position.z()+offset + f=f.copy() + f.setPos(point(f.position.x(),f.position.y(),z)) + self.faces.append(f) + self.update() + + def appendFace(self,f): + f.setPos(point(f.position.x(),f.position.y(),f.position.z())) + self.faces.append(f) + self.update() + + + def getFace(self, i:int) -> face: + return self.faces[i] + + def replaceFaceKeepZ(self,f:face,i): + tmpf=self.getFace(i) + self.faces[i]=f + self.faces[i].setPos(point(f.position.x(),f.position.y(),tmpf.z())) + + def replaceFace(self,f:face,i): + self.faces[i]=f + self.faces[i].setPos(point(f.position.x(),f.position.y(),f.position.z())) + + + def getLastFace(self) -> face: + return self.faces[-1] + + def getFirstFace(self) -> face: + return self.faces[0] + + + def update(self): + super(prismoide, self).update() + self.lastIndex=len(self.faces)-1 + + + def getVolume(self, i1=0, i2=None): + if i2 is None: + i2=len(self.faces)-1 + self.volume=0 + for i, face in enumerate(self.faces[i1:i2]): + #semisoma + nextFace=self.faces[i+1] + self.volume+=(face.getArea()+nextFace.getArea())*abs(face.position.z()-nextFace.position.z())/2 + + return self.volume + + def getVolumes(self, i1=0, i2=None): + try: + if i2 is None: + i2 = len(self.faces)-1 + vat = vct = 0 + for i, face in enumerate(self.faces[i1:i2]): + #semisoma + nextFace = self.faces[i+1] + nct, nat = nextFace.getAreas() + ct, at = face.getAreas() + vct += (ct + nct) * abs(face.position.z() - nextFace.position.z()) / 2 + vat += (at + nat) * abs(face.position.z() - nextFace.position.z()) / 2 + except: + msgLog("Erro na estaca de número "+str(i)) + + return vct, vat + + def getBruckVols(self, i1=0, i2=None, fh=1): + data=[] + try: + if i2 is None: + i2 = len(self.faces) - 1 + vat = vct = 0 + for i, face in enumerate(self.faces[i1:i2]): + # semisoma + nextFace = self.faces[i + 1+i1] + nct, nat = nextFace.getAreas() + ct, at = face.getAreas() + dist = abs(face.position.z() - nextFace.position.z()) + vct += (ct + nct) * dist / 2 + vat += (at + nat) * dist / 2*fh + data.append({"corte": abs(ct), "aterro": abs(at), "at.cor.": abs(at*fh), "soma":at+ct, "semi-distancia": dist, + "vol.corte":vct, "vol.aterro":vat, "volume":-(vat+vct)}) + except: + msgLog("Erro na estaca de número " + str(i)) + dist=0 + ct=at=vct=vat=0 + data.append( + {"corte": abs(ct), "aterro": abs(at), "at.cor.": abs(at * fh), "soma": at + ct, "semi-distancia": dist, + "vol.corte": vct, "vol.aterro": vat, "volume": -(vat + vct)}) + + return data + + +class square(curve): + + def __init__(self,side=1): + super(square, self).__init__() + self.setPoints([pt(-0.5,0.5),pt(.5,.5),pt(.5,-.5),pt(-.5,-.5)]) + self.scale(side) + + +def plotLine(l:line, color="w"): + + x=[] + y=[] + + x.append(l.point1.x()) + x.append(l.point2.x()) + y.append(l.point1.y()) + y.append(l.point2.y()) + return x, y + +def plotCurve(c:curve, color="w"): + + x=[] + y=[] + + for pt in c.getPoints(): + x.append(pt.x()) + y.append(pt.y()) + return x, y + +def plotPrismoid(pris:prismoide): + pass + +#TESTS: +def test(a, title="Test"): + from .... import PyQtGraph as pg + plotWidget=pg.plot(title=title) + X,Y=a + cu=pg.PlotCurveItem() + cu.setData(X,Y) + plotWidget.addItem(cu) + + pg.mkQApp() + pg.QAPP.exec_() + + + +def test1(): + p1 = point(-10, -2) + p2 = point(-5, 3) + p3 = point(0, 10) + p4 = point(5, 5) + p5 = point(10, -10) + p6 = point(15, 10) + p7 = point(20, 7) + p8 = point(25, 1) + + ptList=[p1,p2,p3,p4,p5,p6,p7,p8] + ptList2=[p1+point(2,-5)] + + for pt in ptList: + if pt.x()==10: + ptList2.append(pt.copy().add(0,10)) + else: + ptList2.append(pt.copy().add(0,5)) + + ptList2.append(p8+point(-2,-5)) + + l=line(p1,p2) + l2=line(p2,p3) + + c=curve() + c.setPoints(ptList) + + c2=curve() + c2.setPoints(ptList2) + + s=line(point(-5,-5),point(5,5)) + s2=line(point(-5,5),point(6,-5)) + + x=curve() + x.setPoints([point(-1,-1),point(1,-1),point(1,1),point(-1,1),point(-1,-1)]) + + f=face() + f.from2Curves(c,c2) + + w1=c.getLastLine() + w2=c2.getLastLine() + + c4=f.curve.copy() + c4.rotate(90, point(0,0)) + + ref=line(point(-10,0),point(10,0)) + + c3=f.curve.copy() + c3.mirror(ref) + c3.setPos(c3.position+point(0,-1)) + + plotCurve(f.curve) + plotCurve(c3) + + l3=line(point(-10,0),point(10,0)) + + plotLine(l3) + + l4=l3.copy() + l4.rotate(90,l3.getMiddlePoint()) + l4=l4.trim(l3) + plotLine(l4) + print("A= " + str(f.area)) + + + +def test2(): + terreno=[pt(-6,-5),pt(-4,-4),pt(-4,-2),pt(-3,0),pt(-2,2),pt(-1,1),pt(0,3),pt(1,3),pt(2,6),pt(3,8),pt(4,9),pt(5,10),pt(6,15)] + tc=curve() + tc.setPoints(terreno) + + l=line(tc.getFirstPoint(), pt(tc.getFirstPoint().x(),tc.getHeight())) + l2=l.copy() + l2.setPos(tc.getLastPoint()) + + tc.prependPoint(l.point2) + tc.appendPoint(l2.point2) + + pista=curve() + pista.setPoints([pt(-7,-20),pt(-3,5),pt(3,5),pt(7,20)]) + + f=face() + f.from2Curves(pista, tc) + print("A: " + str(f.area)) + + #plotCurve(tc) + #plotCurve(pista) + + + + prism=prismoide() + prism.fromFaces([f,f.copy(), f.copy()], 20) + print("Volume 20m: " + str(prism.getVolume())) + + prism.save("test") + + prism2=prismoide() + prism2.restore("test") + + print("Volume 20m: " + str(prism2.getVolume())) + + import pyqtgraph as pg + plotWidget=pg.plot(title="test") + + tc2=tc.copy() + tc2.position=tc2.getLastPoint() + tc2.setPos(tc.getFirstPoint()) + tc.prependCurve(tc2) + + X,Y = plotCurve(tc) + cu=pg.PlotCurveItem() + cu.setData(X,Y) + plotWidget.addItem(cu) + + pg.mkQApp() + pg.QAPP.exec_() + + + + + diff --git a/app/controller/Geometria/Prismoide.py b/app/controller/Geometria/Prismoide.py old mode 100644 new mode 100755 index 03b6c6a..a16cc62 --- a/app/controller/Geometria/Prismoide.py +++ b/app/controller/Geometria/Prismoide.py @@ -1,215 +1,215 @@ -from ...model.utils import msgLog -from .Figure import * -from qgis.PyQt import QtWidgets -from qgis.PyQt.QtCore import QThread, pyqtSignal - -class QPrismoid(prismoide, QThread): - volumeFinished=pyqtSignal() - def __init__(self, terreno=None, st=None, progressiva=None, prism=None, ati=3, cti=3): - prismoide.__init__(self) - QThread.__init__(self) - - if prism is None: - self.terreno=terreno - self.st=st - self.progressiva=progressiva - - self.cti=cti - self.ati=ati - - self.lastGeneratedIndex=0 - - sq=square() - - for i in range(0,len(self.terreno)): - c=sq.copy() - f=face() - f.fromClosedCurve(c) - f.setPos(point(c.position.x(),c.position.y(),self.progressiva[i])) - self.appendFace(f) - self.start() - - elif type(prism) is prismoide: - self.fromFaces(prism.faces) - self.lastGeneratedIndex=len(prism.faces)-1 - self.progressiva=prism.progressiva - self.terreno=prism.terreno - self.st=prism.st - self.ati=prism.ati - self.cti=prism.ati - - - def run(self): - k=self.lastGeneratedIndex - j=len(self.terreno) - - for i in range(k, j): - self.generate(i) - self.lastGeneratedIndex+=1 - - self.volumeFinished.emit() - - - def generate(self, i): - cti=self.cti - ati=self.ati - c = self.terreno[i] - p = self.st[i] - - terreno=curve() - pista=curve() - ct=curve() - at=curve() - - ptst=[] - ptsp=[] - - corte=p[-cti:] - atterro=p[:ati] - ctt=[] - att=[] - - for pt in c: - ptst.append(point(pt[0],pt[1])) - for pt in p[ati-1:-(cti-1)]: - ptsp.append(point(pt[0],pt[1])) - for pt in corte: - ctt.append(point(pt[0],pt[1])) - for pt in atterro: - att.append(point(pt[0],pt[1])) - - terreno.setPoints(ptst) - pista.setPoints(ptsp) - ct.setPoints(ctt) - at.setPoints(att) - - left=curve() - right=curve() - - #left - tmp=curve() - a=terreno.getY(float(pista.getFirstPoint().x())) - b=pista.getFirstPoint().y() - - if terreno.getY(float(pista.getFirstPoint().x())) < pista.getFirstPoint().y(): - tmp=at.copy() - else: - tmp=ct.copy() - tmp.mirror(line(point(0,0),point(0,10))) - tmp=tmp.getInversed() - - r=len(tmp.getInversed().intersect(terreno)) - while r == 0 and tmp.getWidth()<60: - tmp2=tmp.copy() - tmp2.position=tmp2.getLastPoint() - tmp2.setPos(tmp.getFirstPoint()) - tmp.prependCurve(tmp2) - r=len(tmp.getInversed().intersect(terreno)) - - if r>1: - left=tmp.getInversed().trim(terreno,1) - else: - left=tmp.trim(terreno) - - #right - tmp=curve() - if terreno.getY(pista.getLastPoint().x())inter.x(): - rightpts.append(inter) - break - rightpts.append(pt) - - right.setPoints(rightpts) - - f=face() - pista.prependCurve(left) - pista.appendCurve(right) - f.from2Curves(pista, terreno) - - self.replaceFaceKeepZ(f, i) - return None - - def getFaces(self): - """Generator: Iterate through primoid's faces -> face""" - for face in self.faces: - yield face - - - def getPrismoide(self): - prismoid=prismoide() - prismoid.fromFaces(self.faces) - prismoid.volume=self.volume - prismoid.lastIndex=self.lastIndex - prismoid.wasInitialized=True - prismoid.st=self.st - prismoid.terreno=self.terreno - prismoid.progressiva=self.progressiva - prismoid.ati=self.ati - prismoide.cti=self.cti - return prismoid - - def getAreasCtAt(self,i): - f=self.getFace(i) - sup=f.superior - inf=f.inferior - areaCt=0 - areaAt=0 - - x=sup.intersect(inf) - for i in range(0,len(x)-1): - f=face() - xp=x[i].x() - xn=x[i+1].x() - m=(xp+xn)/2 - ys=sup.getY(m) - yi=inf.getY(m) - lp=line(point(xp,0),point(xp,max(ys,yi)+100)) - ln=line(point(xn,0),point(xn,max(ys,yi)+100)) - ls=line(lp.point2,ln.point2) - trimmer=curve() - trimmer.setLines([lp,ls,ln]) - - pista=sup.trim(trimmer) - terreno=inf.trim(trimmer) - - f.from2Curves(pista,terreno) - #test(plotCurve(f.curve)) - - if inf.getY(m)1: + left=tmp.getInversed().trim(terreno,1) + else: + left=tmp.trim(terreno) + + #right + tmp=curve() + if terreno.getY(pista.getLastPoint().x())inter.x(): + rightpts.append(inter) + break + rightpts.append(pt) + + right.setPoints(rightpts) + + f=face() + pista.prependCurve(left) + pista.appendCurve(right) + f.from2Curves(pista, terreno) + + self.replaceFaceKeepZ(f, i) + return None + + def getFaces(self): + """Generator: Iterate through primoid's faces -> face""" + for face in self.faces: + yield face + + + def getPrismoide(self): + prismoid=prismoide() + prismoid.fromFaces(self.faces) + prismoid.volume=self.volume + prismoid.lastIndex=self.lastIndex + prismoid.wasInitialized=True + prismoid.st=self.st + prismoid.terreno=self.terreno + prismoid.progressiva=self.progressiva + prismoid.ati=self.ati + prismoide.cti=self.cti + return prismoid + + def getAreasCtAt(self,i): + f=self.getFace(i) + sup=f.superior + inf=f.inferior + areaCt=0 + areaAt=0 + + x=sup.intersect(inf) + for i in range(0,len(x)-1): + f=face() + xp=x[i].x() + xn=x[i+1].x() + m=(xp+xn)/2 + ys=sup.getY(m) + yi=inf.getY(m) + lp=line(point(xp,0),point(xp,max(ys,yi)+100)) + ln=line(point(xn,0),point(xn,max(ys,yi)+100)) + ls=line(lp.point2,ln.point2) + trimmer=curve() + trimmer.setLines([lp,ls,ln]) + + pista=sup.trim(trimmer) + terreno=inf.trim(trimmer) + + f.from2Curves(pista,terreno) + #test(plotCurve(f.curve)) + + if inf.getY(m) 1: - campo = float(self.view.tableWidget.item(item.row(), item.column()).text().replace(',','.')) - self.view.tableWidget.setItem(item.row(), item.column(),QtWidgets.QTableWidgetItem('%s'%campo)) - - def linkGoogle(self, item): - if item.column() == 0: - este = float(self.view.tableWidget.item(item.row(), 4).text()) - north = float(self.view.tableWidget.item(item.row(), 3).text()) - crs = int(self.model.getCRS()) - point = QgsPointXY(este, north) - epsg4326 = QgsCoordinateReferenceSystem(4326, QgsCoordinateReferenceSystem.EpsgCrsId) - mycrs = QgsCoordinateReferenceSystem(int(crs), 0) - reprojectgeographic = QgsCoordinateTransform(mycrs, epsg4326, QgsProject.instance()) - pt = reprojectgeographic.transform(point) - - webbrowser.open('https://www.google.com.br/maps/@%f,%f,15z?hl=pt-BR' % (pt.y(), pt.x())) - - def events(self): - self.preview.tableEstacas:QtWidgets.QTableWidget - self.preview.btnNovo.clicked.connect(self.new) - self.preview.btnOpen.clicked.connect(lambda: self.openEstaca(True)) - self.preview.tableEstacas.doubleClicked.connect(lambda: self.openEstaca(True)) - self.preview.btnOpenCSV.clicked.connect(self.openEstacaCSV) - self.preview.btnApagar.clicked.connect(self.deleteEstaca) - self.preview.btnGerarTracado.clicked.connect(self.geraTracado) - self.preview.tableEstacas.itemClicked.connect(self.itemClickTableEstacas) - self.preview.tableEstacas.itemActivated.connect(self.itemClickTableEstacas) - self.preview.tableEstacas.itemSelectionChanged.connect(self.itemClickTableEstacas) - self.preview.btnOpenCv.clicked.connect(self.openCv) - self.preview.deleted.connect(self.deleteEstaca) - self.preview.btnDuplicar.clicked.connect(lambda: self.duplicarEstaca(True)) - self.preview.btnGerarCurvas.clicked.connect(self.geraCurvas) - - ''' - ------------------------------------------------ - ''' - - self.view.btns=[self.view.btnSave, self.view.btnSaveCSV, self.view.btnLayer, self.view.btnEstacas, - self.view.btnPerfil, self.view.btnCurva,self.view.btnCotaTIFF, self.view.btnCotaPC, self.view.btnCota] - - for btn in self.view.btns: - btn.clicked.connect(self.view.clearLayers) - - self.view.btnSave.clicked.connect(self.saveEstacas) - self.view.btnSaveCSV.clicked.connect(self.saveEstacasCSV) - self.view.btnLayer.clicked.connect(self.plotar) - self.view.btnEstacas.clicked.connect(self.recalcular) - self.view.btnCurva.clicked.connect(self.curva) - self.view.btnCotaTIFF.clicked.connect(self.obterCotasTIFF) - self.view.btnCotaPC.clicked.connect(self.obterCotasPC) - self.view.btnCota.clicked.connect(self.obterCotas) - self.view.btnCota.hide() #TODO Add google Elevation API ? - self.view.tableWidget.itemDoubleClicked.connect(self.linkGoogle) - self.view.tableWidget.itemDoubleClicked.connect(self.mudancaCelula) - self.view.btnDuplicar.clicked.connect(self.duplicarEstacaHorizontal) -# self.view.layerUpdated.connect(self.joinFeatures) - self.view.btnPerfil.clicked.connect(self.perfilView) - - ''' - ------------------------------------------------ - ''' - - self.viewCv.btnGen.clicked.connect(self.generateIntersec) - self.viewCv.btnTrans.clicked.connect(self.generateTrans) - self.viewCv.btnBruck.clicked.connect(self.bruckner) - self.viewCv.btnCrossSectionExport.clicked.connect(self.exportCS) - self.viewCv.btnCsv.clicked.connect(self.exportCSV) - #self.viewCv.btnClean.clicked.connect(self.cleanTrans) - self.viewCv.btnRecalcular.clicked.connect(self.recalcularVerticais) - self.viewCv.btn3D.clicked.connect(lambda: self.export3D()) - self.viewCv.btnCorte.clicked.connect(lambda: self.exportCorte()) - self.viewCv.btn3DView.clicked.connect(lambda: self.view3DView()) - - def view3DView(self): - msgLog("Iniciando visão 3D") - intersect, vertices, faces = self.export3D(pointsOnly=True) - msgLog("Pontos da malha carregados") - view3d=view3D_Ui(intersect, vertices, faces) - view3d.showMaximized() - view3d.exec_() - - def createMesh(self, tipo="H"): - import tempfile - from pathlib import Path - if hasattr(self, "ctExpDiag"): - tipo=self.ctExpDiag.getType() - file = str(Path(tempfile.gettempdir()) / "GeoRoadTempMesh.stl") - table=self.export3D(filename=file, tipo=tipo) - self.tableCorte=table - self.fileCorte=file - return table, file - - def exportCorte(self): - if self.viewCv.mode=="CV": - self.exportDXF() - else: - table, file = self.createMesh() - if not table: return - self.generateCorte() - self.ctExpDiag=diag = CorteExport(None, float(table[-1][2])) - diag.btnPreview.clicked.connect(lambda: self.corteExport(True)) - diag.btnSave.clicked.connect(lambda: self.corteExport(False)) - diag.comboBox.currentIndexChanged.connect(lambda: self.createMesh()) - diag.label_4.hide() - diag.inicialSb.hide() - diag.finalSb.hide() - diag.label_3.hide() - diag.buttonBox.hide() - diag.line.hide() - diag.comboBox.hide() - diag.label_8.hide() - diag.btnSave.clicked.connect(diag.accept) - diag.exec_() - - - def corteExport(self, preview=False): - self.generateCorte() - if not hasattr(self.combined, "show"): - messageDialog(message="Seção vazia! Nada foi encontrado, tente aumentar a profundidade!") - else: - if preview: - self.combined.show() - else: - self.saveDxfCorte() - - - def generateCorte(self, step=1, depth=20, tipo="H"): - import numpy as np - file=self.fileCorte - if hasattr(self, "ctExpDiag"): - tipo=self.ctExpDiag.getType() - step=self.ctExpDiag.intSp.value() - depth=self.ctExpDiag.espSb.value() - e1=self.ctExpDiag.inicialSb.value() - e2=self.ctExpDiag.finalSb.value() - offset=self.ctExpDiag.offsetSb.value() - else: - e2=float(self.tableCorte[-1][2]) - e1=0 - offset=0 - - if tipo=="T": - plane_normal=[1, 0, 0] - self.progressDialog.show() - self.progressDialog.setLoop(100, (e1 - e2) / Config.instance().DIST, 0) - for e in self.tableCorte: - if estaca2progFloat(e[0]) > e2: - break - if estaca2progFloat(e[0])>=e1: - self.progressDialog.increment() - offset=estaca2progFloat(e[0])-e1 - sections = self.sliceCorte(file, tipo, step, depth, plane_normal, offset) - self.progressDialog.close() - elif tipo=="H": - plane_normal=[0, 0, 1] - sections = self.sliceCorte(file, tipo, step, depth, plane_normal, offset, float(self.tableCorte[0][5])) - else: #V - plane_normal=[0, 1, 0] - sections=self.sliceCorte(file, tipo, step, depth, plane_normal, offset) - self.combined = np.sum(sections) - - if hasattr(self, "ctExpDiag") and self.ctExpDiag.isEstaca(): #printar estacas - from ... import trimesh - textHeight=5 - if tipo=="T": - self.progressDialog.show() - self.progressDialog.setLoop(100,(e1-e2)/Config.instance().DIST) - for e in self.tableCorte: - if estaca2progFloat(e[1]) > e2: - break - if estaca2progFloat(e[1]) >= e1: - self.progressDialog.increment() - text = trimesh.path.entities.Text(origin=len(self.combined.vertices),text=str(e[0]) + " " + str(e[1]), height=textHeight) - self.combined.vertices=np.vstack((self.combined.vertices, self.combined.bounds.mean(axis=0))) - self.combined.entities=np.append(self.combined.entities, text) - - self.progressDialog.close() - - elif tipo=="H": - for e in self.tableCorte: - azi=np.deg2rad(float(e[7])+90) - l=50 - text = trimesh.path.entities.Text(origin=len(self.combined.vertices), text=str(e[0])+" "+str(e[1]), height=textHeight) - self.combined.vertices=np.vstack((self.combined.vertices, np.array([float(e[4]), float(e[3])]))) - self.combined.entities=np.append(self.combined.entities, text) - line=trimesh.path.entities.Line(np.array([len(self.combined.vertices), len(self.combined.vertices)+1])) - self.combined.vertices=np.vstack((self.combined.vertices, np.array([float(e[4])+l*np.sin(azi), float(e[3])+l*np.cos(azi)]))) - self.combined.vertices=np.vstack((self.combined.vertices, np.array([float(e[4])-l*np.sin(azi), float(e[3])-l*np.cos(azi)]))) - self.combined.entities = np.append(self.combined.entities, line) - else: #V - for e in self.tableCorte: - text = trimesh.path.entities.Text(origin=len(self.combined.vertices), text=str(e[0])+" "+str(e[1]), height=textHeight) - self.combined.vertices = np.vstack((self.combined.vertices, np.array([float(e[2]), float(e[5])]))) - self.combined.entities = np.append(self.combined.entities, text) - line=trimesh.path.entities.Line(np.array([len(self.combined.vertices), len(self.combined.vertices)+1])) - self.combined.vertices = np.vstack((self.combined.vertices, np.array([float(e[2]), float(e[5])-5]))) - self.combined.vertices = np.vstack((self.combined.vertices, np.array([float(e[2]), float(e[5])+5]))) - self.combined.entities = np.append(self.combined.entities, line) - - - msgLog("Foram adicionados "+str(len(self.combined.entities))+" elementos para o tipo "+tipo) - - def sliceCorte(self, file, tipo, step, depth, plane_normal, offset=0, cota=0.0): - from ... import trimesh - import numpy as np - mesh = trimesh.load_mesh(file) - if tipo=="T": - n=0 - plane_origin=[0,0,mesh.bounds[0][2]] - elif tipo=="V": - n=1 - plane_origin=[0,0,-2*mesh.bounds[0][1]] - else: - n=2 - plane_origin=[0,0,mesh.bounds[0][2]] - z_extents = mesh.bounds[:, n] - depth=min(z_extents[1]-z_extents[0],depth) - #z_levels = np.arange(*z_extents, step=step)[int(offset/step):int(depth/step)] - z_levels = np.linspace(offset, depth, num=int(depth/step))#[int(offset/step):]#int(depth/step)] - sections = mesh.section_multiplane(plane_origin=plane_origin, - plane_normal=plane_normal, - heights=z_levels) - #sections=[s for s in sections if not s is None] - labeled_sections=[] - textHeight=2 - for s in sections: - if s is None: - cota += step - continue - for vi, v in enumerate(s.vertices): - if vi%30==0: - text = trimesh.path.entities.Text(origin=vi, text=cota, height=textHeight) - s.entities = np.append(s.entities, text) - labeled_sections.append(s) - cota+=step - - return labeled_sections - - - def saveDxfCorte(self): - filter=".dxf" - filename = QtWidgets.QFileDialog.getSaveFileName(filter="Arquivo dxf(*" + filter + " *" + filter.upper() + ")")[0] - if filename in ['', None]: - return - filename = str(filename) if str(filename).endswith(filter) else str(filename) + filter - self.combined.export(filename) - - - def export3D(self, filename=None, terrain=True, tipo="3D", pointsOnly=False): # H, V, T - self.progressDialog.show() - self.progressDialog.setValue(0) - - Z=0 if tipo in "HT" else None - reto=True if tipo in "VT" else None - - filter=".stl" - X, table, prismoide = self.model.getTrans(self.model.id_filename) - self.progressDialog.setValue(5) - intersect=self.model.load_intersect() - self.progressDialog.setValue(10) - prismoide: QPrismoid - if not X or not prismoide: - messageDialog(message="Seção Transversal não definida!") - self.progressDialog.close() - return - - import numpy as np - from ...stl import mesh - from scipy import spatial - - self.progressDialog.setValue(25) - - # Define the terrain vertices - verticesg = [] - vertices = [] - errors=[] - - for i, est in enumerate(X): - self.progressDialog.setValue(25+70*i/len(X)) - norte=float(intersect[i][3]) - este=float(intersect[i][4]) - greide=float(intersect[i][5]) - az=float(intersect[i][7]) - st=prismoide.faces[i].superior - stpts=st.getPoints() - points=[] - try: - if terrain: - for pt in table[1][i]: - if pt[0]>stpts[0][0]: - break - else: - points.append(pt) - - points+=[[pt.x(), pt.y()] for pt in stpts] - - if terrain: - for pt in table[1][i]: - if pt[0] > stpts[-1][0]: - points.append(pt) - - except Exception as e: - import traceback - msgLog(str(traceback.format_exception(None, e, e.__traceback__))[1:-1]) - errors.append(est) - continue - - perp = az + 90 - if perp > 360: - perp = perp - 360 - nsign = 1 - esign = 1 - if perp < 90: - nsign = 1 - esign = 1 - elif perp < 180: - nsign = -1 - esign = 1 - elif perp < 270: - nsign = -1 - esign = -1 - elif perp < 360: - nsign = 1 - esign = -1 - - for j, pt in enumerate(points): - x,y,z=est,pt[0],pt[1] - z = z if Z is None else z - greide + Z - if reto is None: - yangleE = esign * y * abs(math.sin(perp * math.pi / 180)) - yangleN = nsign * y * abs(math.cos(perp * math.pi / 180)) - xPoint = float(este + yangleE) - yPoint = float(norte + yangleN) - verticesg.append([xPoint, yPoint, z]) - else: - verticesg.append([x, y, z]) - vertices.append([x, y, z]) - - if errors: - messageDialog(title="Erro", message="Erro nas estacas: "+"; ".join([prog2estacaStr(p) for p in errors])) - - verticesg = np.array(verticesg) - vertices = np.array(vertices) - tri = spatial.Delaunay(vertices[:, :2]) - facesg=tri.simplices - - if pointsOnly: - self.progressDialog.close() - return intersect, verticesg, facesg - - # Create the meshes - greide = mesh.Mesh(np.zeros(facesg.shape[0], dtype=mesh.Mesh.dtype)) - for i, f in enumerate(facesg): - for j in range(3): - greide.vectors[i][j] = verticesg[f[j], :] - self.progressDialog.setValue(98) - - #combined = mesh.Mesh(np.concatenate([terrain.data, greide.data])) - combined=greide - self.progressDialog.close() - - if filename is None: - filename = QtWidgets.QFileDialog.getSaveFileName(filter="Arquivo stl(*" + filter + " *" + filter.upper() + ")")[0] - if filename in ['', None]: - return - filename = str(filename) if str(filename).endswith(filter) else str(filename) + filter - combined.save(filename) - - if tipo == "3D": - import shutil - exe = shutil.which("blender") #maybe this works on windows someday? - - from pathlib import Path - p = Path("C:\Program Files\Blender Foundation\\").rglob("*/*.exe") #blender's default path on windows - for file in p: - if file.name == "blender.exe": - exe=str(file) - if exe: - def resolve(name, basepath=None): - if not basepath: - basepath = str(Path(__file__).parents[2]) - return os.path.join(basepath, name) - - if yesNoDialog(message="O blender foi detectado no sistem. Deseja abrir o modelo?"): - #move template blend to tmp - from tempfile import gettempdir - blend=str(Path(gettempdir()) / "georoadBlender.blend") - shutil.copy(resolve("layout.blend"), blend) - - #start=?, create dxf starting from 0,0,10 - import json - table=intersect - jsonfile=str(Path(gettempdir()) / "georoadBlender.json") - init=table[0] - data={} #x,y,z --> 0,0,0 - init=data["start"]=[float(init[4]), float(init[3]), float(init[5])] - data["points"]=[[float(e[4])-init[0],float(e[3])-init[1],float(e[5])-init[2]] for e in table] - data['estacas']=[e[0] for e in table] - data['azi']=[e[7] for e in table] - data["frames"]=float(table[-1][2])/200*24 - with open(jsonfile, "w") as outfile: - json.dump(data, outfile) - - #launch exe -P with the script and arguments - import subprocess - script=resolve("blender.py") - cmd=[exe, blend, "--python", script, "--", filename] - msgLog("Running Command: "+" ".join(cmd)) - subprocess.Popen(cmd) - else: - # self.showModelo3D(filename) - pass - else: - msgLog("Blender não foi encontrado!") - # self.showModelo3D(filename) - else: - return intersect - - def showModelo3D(self, filename): - if yesNoDialog(message="Deseja visualizar o modelo gerado?"): - try: - import trimesh - mesh=trimesh.load(filename) - mesh.show() - except Exception as e: - import traceback - msgLog("Erro: " + str(traceback.format_exception(None, e, e.__traceback__))[1:-1]) - - def exportTrans(self): - filename = QtWidgets.QFileDialog.getSaveFileName(caption="Save dxf", filter="Arquivo DXF (*.dxf)") - if filename[0] in ["", None]: return - v=self.trans.verticais.getY(self.trans.progressiva[self.trans.current]) - self.saveDXF(filename[0], [[p2QgsPoint(float(x),float(y)-float(v)) for x, y in self.trans.st[self.trans.current]]]) - - def importTrans(self): - filename = QtWidgets.QFileDialog.getOpenFileName(caption="Open dxf", filter="Arquivo DXF (*.dxf)") - if filename[0] in ["", None]: return - uri = filename[0]+"|layername=entities|geometrytype=Line" - vlayer = QgsVectorLayer(uri, "Seção tipo", "ogr") - features = [f for f in vlayer.getFeatures()] - v = self.trans.verticais.getY(self.trans.progressiva[self.trans.current]) - pl=featureToPolyline(features[0]) - from collections import OrderedDict - pl=list(OrderedDict.fromkeys(pl)) - msgLog("Seção :"+str([[p.x(),p.y()] for p in pl])) - self.trans.st[self.trans.current]=[[pt.x(), pt.y()+v] for pt in pl] - self.trans.prismoide.st = self.trans.st - try: - self.trans.prismoide.generate(self.trans.current) - except: - msgLog("Falha ao achar interseção com o terreno!") - self.trans.reset() - - def bruckner(self): - self.progressDialog.show() - self.progressDialog.setValue(0) - table = self.model.load_bruckner() - bruck=self.model.load_bruck() - if not table or not ("table" in bruck and bruck['table']): # if non existent, compute - X, est, prismoide=self.loadTrans() - msgLog(str(len(X))+" Estacas na transversal") - if not X: - messageDialog(message="Seção Transversal não definida!") - self.progressDialog.close() - return - fh,ok=QtWidgets.QInputDialog.getDouble(None, "Fator de Homogeneização", "Defina o Fh:", value=1.05, min=0, max=10, decimals=4) - if not ok: - return - self.progressDialog.setValue(10) - X, V = self.brucknerThread(X, est, prismoide, 0, len(X), fh) - else: - X, V = zip(*table) - X = [float(x) for x in X] - V = [float(v) for v in V] - self.progressDialog.setValue(90) - Xests=X - Vests=V - dialog=EstacaRangeSelect(None, Xests, bruck=bruck) - self.progressDialog.close() - while dialog.exec_(): - self.bruck=dialog.bruck - ei=dialog.inicial.currentIndex() - ef=dialog.final_2.currentIndex() - key=str(dialog.inicial.itemText(ei))+"-"+str(dialog.final_2.itemText(ef)) - X=Xests[ei:ef+1] - V=Vests[ei:ef+1] - dist=Config.instance().DIST - X=[x*dist for x in X] - - if key in self.bruck: - bruckD = Ui_Bruckner(X, V, key=key, bruck=self.bruck, bruckData=self.bruck[key], interval=[ei,ef]) - else: - size=min(len(X), len(V)) - bruckD = Ui_Bruckner(X[:size], V[:size], key=key, bruck=self.bruck, interval=[ei,ef]) - - msgLog("Abrindo intervalo: " + key) - bruckD.showMaximized() - #bruckD.save.connect(lambda: self.bruckner2DXF(bruckD.X, bruckD.V)) - bruckD.reset.connect(self.brucknerReset) - self.brucknerView=bruckD - bruckD.exec_() - bruckD.setBruckData() - if hasattr(self,"bruckReseted") and self.bruckReseted: #loop do reset - self.bruckReseted=False - elif (hasattr(self,"bruckReseted") and not self.bruckReseted) or (hasattr(bruckD, "reseted") and bruckD.reseted): #primeiro loop - self.bruckReseted=False - del self.bruckReseted - return - self.bruck[key]=bruckD.bruckData - self.model.save_bruck(self.bruck) - dialog=EstacaRangeSelect(None, Xests, bruck=self.bruck) - - self.model.save_bruck(dialog.bruck) - msgLog("Edição bruckner finalizada") - - - def brucknerReset(self): - self.brucknerView.close() - self.bruckReseted=True - self.model.cleanBruckner(keepLines=yesNoDialog(message="Deseja manter as linhas de terra?")) - self.bruck=self.model.load_bruck() - self.bruckner() - - def matplot(self, X, V, title="Diagrama de Bruckner", xlabel=u'Estacas', ylabel=u'Volume m³'): - import matplotlib.pyplot as plt - line, = plt.plot(X, V, lw=2) - plt.title(title) - plt.xlabel(xlabel) - plt.ylabel(ylabel) - plt.grid(True) - plt.show() - - - @nongui - def brucknerThread(self, X, est, prismoide, ei, ef, fh): - self.progressDialog.setText("Calculando Volumes acumulados") - msgLog("Calculando tabela de volumes acumulados") - X=[float(x) for x in X] - x1=X[ei] - X=X[ei:ef+1] - V=[] - vAcumulado=0 - face=prismoide.faces[ei] - ct, at = face.getAreas() - self.progressDialog.setLoop(30, len(X)) - bruck=[{"estaca":prog2estacaStr(x1), "corte": abs(ct), "aterro": abs(at), "at.cor.": abs(at*fh), "soma": "", "semi-distancia": "", - "vol.corte":"", "vol.aterro":"", "volume":"", "vol.acum":""}] - for x in range(1,len(X)): - data=prismoide.getBruckVols(ei+x-1, ei+x, fh=fh)[0] - data['estaca']=prog2estacaStr(X[x]) - if data["volume"]==0 and data['semi-distancia']==0: - msgLog("Erro na estaca "+data['estaca']) - vAcumulado+=data["volume"] - data["vol.acum"]=vAcumulado - V.append(vAcumulado) - bruck.append(data) - self.progressDialog.increment() - self.model.save_bruck({'table':bruck}) - V=[v + abs(min(V))+1000 for v in V] - X=[x/Config.instance().DIST for x in X] - self.progressDialog.setValue(80) - self.model.saveBruckner(list(zip(X, V))) - return X, V - - def bruckner2DXF(self, X, Y): - filename = QtWidgets.QFileDialog.getSaveFileName(caption="Save dxf",filter="Arquivo DXF (*.dxf)") - if filename[0] in ["", None]: return - dist=Config.instance().DIST - self.saveDXF(filename[0], [[p2QgsPoint(x*dist, y/1000000) for x, y in (zip(X, Y))]]) - - def exportDXF(self): - filename = QtWidgets.QFileDialog.getSaveFileName(caption="Save dxf",filter="Arquivo DXF (*.dxf)") - if filename[0] in ["", None]: return - estacas=self.viewCv.get_estacas() - terreno=self.model.load_terreno_long() - Lpoints=[] - if self.viewCv.mode=="CV": - points=[] - for e in estacas: - points.append(p2QgsPoint(float(e[-2]), float(e[-1]))) - Lpoints.append(points) - prog=float(e[-2]) - points=[p2QgsPoint(float(e[-2])-prog, float(e[-1])) for e in terreno] - Lpoints.append(points) - elif self.viewCv.mode=="T": - points=[] - for e in estacas: - points.append(p2QgsPoint([float(e[4]), float(e[3]), float(e[-3])])) - Lpoints.append(points) - - self.saveDXF(filename[0], Lpoints) - - if self.viewCv.mode=="CV": - self.addVerticalEstacas(filename[0], estacas) - - def exportCS(self): -# if yesNoDialog(title="Plotar Transversais?", message="Deseja exportar os perfis transversais? (Se ainda não foram definidos não serão salvos)"): - self.progressDialog.show() - - X,table,prismoide=self.loadTrans() - - filename = QtWidgets.QFileDialog.getSaveFileName(caption="Save dxf", filter="Arquivo DXF (*.dxf)") - if filename[0] in ["", None]: return - LPoints=[] - for i,face in enumerate(prismoide.getFaces()): - st = face.superior - stpts = st.getPoints() - points=[] - for pt in table[1][i]: - if pt[0] > stpts[0][0]: - break - else: - points.append(p2QgsPoint([float(pt[0]),float(pt[1])])) - points += [p2QgsPoint([pt.x(), pt.y()]) for pt in stpts] - for pt in table[1][i]: - if pt[0] > stpts[-1][0]: - points.append(p2QgsPoint([float(pt[0]),float(pt[1])])) -# for line in face.superior.lines: -# points.append(p2QgsPoint(line.point1.x(), line.point1.y())) -# for line in face.inferior.lines: -# points.append(p2QgsPoint(line.point1.x(), line.point1.y())) - LPoints.append(points) - - self.addTransEstacas(filename[0], self.model.load_intersect(), self.saveDXF(filename[0], LPoints)) - self.progressDialog.close() - - def addVerticalEstacas(self, filename, estacas): - from ... import trimesh - import numpy as np - combined=trimesh.load(filename) - textHeight=5 - l=20 - for e in estacas: - p=np.array([float(e[-2]), float(e[-1])]) - text = trimesh.path.entities.Text(origin=len(combined.vertices), text=str(e[0]) + " " + str(e[1]), - height=textHeight) - combined.vertices = np.vstack((combined.vertices, p)) - combined.entities = np.append(combined.entities, text) - line = trimesh.path.entities.Line(np.array([len(combined.vertices), len(combined.vertices) + 1])) - combined.vertices = np.vstack( - (combined.vertices, np.array([p[0], p[1]+l]))) - combined.vertices = np.vstack( - (combined.vertices, np.array([p[0], p[1]-l]))) - combined.entities = np.append(combined.entities, line) - - combined.export(filename) - - def addTransEstacas(self, filename, estacas, coords): - from ... import trimesh - import numpy as np - combined = trimesh.load(filename) - textHeight = 5 - for e, c in zip(estacas, coords): - text = trimesh.path.entities.Text(origin=len(combined.vertices), text=str(e[0]) + " " + str(e[1]), - height=textHeight) - combined.vertices = np.vstack((combined.vertices, c)) - combined.entities = np.append(combined.entities, text) - combined.export(filename) - - def saveDXF(self, filename, listOfListOfPoints): #[ [ p2QgsPoint[ x,y], [x,y] ...] , [ [ x,y] , [x,y] ...] ....] Each list is a feature - import numpy as np - coords=[] - layer=QgsVectorLayer("LineStringZ?crs=%s"%(QgsProject.instance().crs().authid()), "Perfil: " if self.viewCv.mode=="CV" else "Traçado Horizontal: " - + self.model.getNameFromId(self.model.id_filename), "memory") - layer.setCrs(QgsCoordinateReferenceSystem(QgsProject.instance().crs())) - features=[] - DX=0 - DY=0 - MAX_COLUMNS=10 - ncolumns=1 - for points in listOfListOfPoints: - feat=QgsFeature() - g=QgsGeometry.fromPolyline(points) - g.translate(DX,DY) - feat.setGeometry(g) - features.append(QgsFeature(feat)) - feat=QgsFeature() - rect=g.boundingBox() - feat.setGeometry(QgsGeometry.fromRect(rect)) - features.append(QgsFeature(feat)) - coords.append(np.array([np.average(rect.center().x()), rect.center().y()+5])) - - if ncolumns1: - self.preview.error(u"Selecione um único arquivo!") - elif l<1: #criar traçado, iniciar edição - name=self.fileName("Traçado "+str(len(self.model.listTables())+1)) - if not name: return - self.new(dados=(name, self.newEstacasLayer(name=name), Config.instance().DIST, [])) - else: - self.openEstaca() - self.view.btnCurva.click() - - def joinFeatures(self): - layer=self.view.curvaLayers[0] - layer.layerModified.disconnect() - layer.commitChanges() - id=[f for f in layer.getFeatures()][-1].id() - if id>1: - moveLine(layer,id,getLastPoint(layer, id)) - self.iface.mapCanvas().refresh() - layer.startEditing() - layer.layerModified.connect(lambda: self.view.add_row(layer)) - -# self.updateTables() - - def fillView(self, table): - self.estacasHorizontalList=[] - empty=True - self.view.clear() - for item in table: - self.view.fill_table(tuple(item)) - self.estacasHorizontalList.append(tuple(item)) - empty=False - self.view.empty=empty - self.model.save(self.model.id_filename) - - def fileName(self, suggestion=False): - filename = "" - names = [self.preview.tableEstacas.item(i, 1).text() for i in range(self.preview.tableEstacas.rowCount())] - first = True - while filename == "" or filename in names: - if not first: - from ..model.utils import messageDialog - messageDialog(None, title="Erro", message="Já existe um arquivo com esse nome") - - filename, ok = QtWidgets.QInputDialog.getText(None, "Nome do arquivo", u"Nome do arquivo:", - text=suggestion if suggestion else "Traçado " + - str(len(self.model.listTables()+1))) - if not ok: - return False - first = False - return filename - - def finishEdit(self): - l = self.view.curvaLayers[0] - l.commitChanges() - l.endEditCommand() - QgsProject.instance().removeMapLayer(l.id()) - - def duplicarEstacaHorizontal(self): - self.duplicarEstaca(False) - - def duplicarEstaca(self, trans=True): - msgLog("---------Iniciando cópia--------") - import traceback - if self.model.id_filename == -1: return - filename=self.fileName(suggestion="Cópia de " + self.model.getNameFromId(self.model.id_filename)) - if not filename: - return None - self.progressDialog.show() - self.openEstaca() - self.progressDialog.setValue(10) - estacas = self.view.get_estacas() - bruck = self.model.load_bruck() - id_filename=deepcopy(self.model.id_filename) - self.model = self.model.saveEstacas(filename, estacas) - if trans: - try: - msgLog("Carregando Transversais: ") - prog, est, prism = self.model.getTrans(id_filename) - if prog: - self.trans=Ui_sessaoTipo(self.iface, est[1], self.model.load_intersect(id_filename), - prog, est[0], prism=prism, greide=self.model.getGreide(id_filename), - title="Transversal: " + str(self.model.getNameFromId(id_filename))) - self.model.id_filename = self.model.ultimo - self.saveTrans() - msgLog("Tranversais Salvas!") - except Exception as e: - msgLog("Falha ao duplicar Transversais: ") - msgLog(str(traceback.format_exception(None, e, e.__traceback__))[1:-1]) - - self.model.id_filename=self.model.ultimo - self.progressDialog.setValue(40) - if bruck: - self.model.save_bruck(bruck) - try: - self.view.openLayers() - l = self.view.curvaLayers[0] - source = self.view.curvaLayers[0].source() - curvaModel = Curvas(id_filename) - l.commitChanges() - l.endEditCommand() - QgsProject.instance().removeMapLayer(l.id()) - curvaModel.duplicate(filename, self.model.ultimo, source) - except Exception as e: - msgLog("---------------------------------\n\nFalha ao duplicar curvas: ") - msgLog(str(traceback.format_exception(None, e, e.__traceback__))[1:-1]) - self.progressDialog.setValue(60) - try: - tipo, class_project = self.model.tipo() - estacas = self.model.load_terreno_long() - self.perfil = Ui_Perfil(estacas, tipo, class_project, self.model.getGreide(id_filename), - self.model.getCv(id_filename), iface=self) - table = deepcopy(self.perfil.getVertices()) - cvData=deepcopy(self.perfil.getCurvas()) - self.model.table = table - self.model.cvData=cvData - self.model.saveGreide(self.model.ultimo) - except Exception as e: - msgLog("Falha ao duplicar Greide: ") - msgLog(str(traceback.format_exception(None, e, e.__traceback__))[1:-1]) - self.progressDialog.setValue(80) - #self.geraCurvas(self.model.id_filename) - - self.update() - self.view.clear() - estacas = self.model.loadFilename() - self.estacasHorizontalList = [] - for e in estacas: - self.view.fill_table(tuple(e), True) - self.estacasHorizontalList.append(tuple(e)) - self.progressDialog.setValue(99) - self.nextView = self.view - self.view.setCopy() - self.updateTables() - try: - self.view.closeLayers() - self.viewCv.closeLayers() - except: - msgLog("Failed to close layers!") - self.progressDialog.close() - - def cleanTrans(self): - if yesNoDialog(None, message="Tem certeza que quer excluir os dados transversais?"): - self.trans.close() - self.model.cleanTrans(idEstacaTable=self.model.id_filename) - self.generateTrans() - - - def recalcularVerticais(self): - if self.viewCv.mode=="CV": - self.openCv(True) - elif self.viewCv.mode=="T": - self.generateIntersec(True) - - - - def generateIntersec(self, recalcular=False): - table = self.model.load_intersect() - - if recalcular or not table: - self.progressDialog.show() - table=self.generateintersecThread() - self.progressDialog.close() - if not table: - return - - self.viewCv.clear() - self.viewCv.setIntersect() - s=0 - for e, e2 in zip(table[:-1], table[1:]): - self.viewCv.fill_table(tuple(e), True) - e1=[float(e[2]), float(e[-3])] - e2=[float(e2[2]), float(e2[-3])] - s+=((e2[0]-e1[0])**2+(e2[1]-e1[1])**2)**.5 - self.viewCv.fill_table(tuple(table[-1]), True) - - self.viewCv.setWindowTitle(self.model.getNameFromId(self.model.id_filename) + ": Estacas") - try: - self.viewCv.btnGen.clicked.disconnect() - except: - pass - self.viewCv.btnGen.clicked.connect(self.openCv) - self.viewCv.comprimento.setText(roundFloat2str(s) + " " + Config.instance().UNITS) - self.nextView=self.viewCv - - - @nongui - def generateintersecThread(self): - self.progressDialog.setValue(0) - self.progressDialog.setText("Montando matrix de conflito...") - import time - self.openEstaca(False) - horizontais = self.view.get_estacas() #x = 4, y =3 - startTime = time.time() - points=[] - progs=[] - LH=len(horizontais) - self.progressDialog.setLoop(100,LH) - for i,h in enumerate(horizontais): - points.append(p2QgsPoint(float(h[4]), float(h[3]))) - progs.append(float(h[2])) - self.progressDialog.increment() - - road=QgsGeometry.fromPolyline(points) - - QgsMessageLog.logMessage("Iniciando comparação", "GeoRoad", level=0) - msgLog("Organizando: " + str(time.time() - startTime) + " seconds") - - verticais=[] - lastH=deepcopy(h) - self.openCv() - vprogs=[] - estacas=self.viewCv.getEstacas() - - LH=500 - self.progressDialog.setLoop(60, LH) - try: - for i, v in enumerate(estacas): # prog=2 em ambos - prog=float(v[2]) - if prog in progs: - h = horizontais[progs.index(float(v[2]))] - if h[1]: - desc="" if h[1]=="" and v[1]=="" else h[1]+" + "+v[1] - else: - desc=v[1] - verticais.append([v[0], desc, v[2], h[3], h[4], v[3], h[5], h[6]]) - else: - pt=road.interpolate(prog-.1).asPoint() - pt2=road.interpolate(prog).asPoint() - verticais.append([v[0], v[1], v[2], pt.y(), pt.x(), v[3], None, azimuth(pt, pt2)]) #Não sei a cota 6 - self.progressDialog.increment() - vprogs.append(prog) - except Exception as e: - import traceback - msgLog("Erro ao gerar pontos!!!!!! ") - msgLog(str(traceback.format_exception(None, e, e.__traceback__))) - msgLog("Road: ") - msgLog(str(road)) - msgLog("Na Progressiva: ") - msgLog(str(prog)) - messageDialog(message="As estacas finais do perfil vertical e horizontal não estão alinhadas", info="Tente criar seu perfil vertical novamente e recalcular a tabela vertical!") - return False - - if v[2]!=lastH[2]: - messageDialog(message="As estacas finais do perfil vertical e horizontal não estão alinhadas", info="Tente criar seu perfil vertical novamente e recalcular a tabela vertical!") - return False - - table=verticais - msgLog("Horizontais: " + str(time.time() - startTime) + " seconds") - - for h in horizontais: - if float(h[2]) not in vprogs: - table.append([h[0],h[1],h[2],h[3],h[4],None,h[5],h[6]]) #Não sei o greide 5 - - table = sorted(table, key=lambda x: float(x[2])) #Organizar em ordem da progressiva - msgLog("Organizar: "+ str(time.time()-startTime)+" seconds") - self.progressDialog.setValue(90) - - progAnt=float(table[0][2]) - anterior=[table[0][-2],table[0][-3]] #cota, greide - cfg=Config.instance() - DIST=cfg.DIST - PREC=cfg.PREC - for i,t in enumerate(table): #Interpolar greides e cotas desconhecidos - atual=[t[-2],t[-3]] #cota, greide - if None in atual: - if i==0: - distAnt=1000000 - else: - distAnt=float(t[2])-progAnt - j=1 - while i+j < len(table)-1: # Próxima estaca inteira - if float(table[i+j][2])%DIST==0: - proxima=[table[i+j][-2],table[i+j][-3]] #cota, greide - distProx=float(table[i+j][2])-float(t[2]) - break - j+=1 - else: - proxima=anterior - distProx=1000000 - - try: - from numpy import interp # Interpola os valores de greide e cota desconhecidos em pontos críticos - table[i][-2]=interp(0, [-distAnt, distProx], [float(anterior[0]), float(proxima[0])]) - table[i][-3]=interp(0, [-distAnt, distProx], [float(anterior[1]), float(proxima[1])]) - except Exception as e: - msgLog(str(e)) - table[i][-2]=0 - table[i][-3]=0 - - if float(t[2])%DIST==0: #se é uma estaca inteira se torna a anterior - anterior=atual - progAnt=float(t[2]) - - # unir estacas muito próximas - intersec=[] - e=table[0] - for e1, e2 in zip(table[:-1], table[1:]): - dist=float(e2[2])-float(e1[2]) - if dist<=PREC: - e1[1]=e[1]+" + "+e2[1] - e=e1 - else: - intersec.append(e) - e=e2 - intersec.append(e2) - - self.model.saveIntersect(intersec) - - msgLog("Verticais: "+ str(time.time()-startTime)+" seconds") - QgsMessageLog.logMessage("Fim comparação", "GeoRoad", level=0) - return intersec - - - - def new(self, layer=None, dados=None): - self.view.clear() - - isGeopckg=True if dados else False - dados = dados if dados else self.preview.new(lastIndex=len(self.model.listTables())+1) - self.model.iface=self.iface - if not dados is None: - filename, lyr, dist, estaca = dados - id_estaca, table = self.model.new(dist, estaca, lyr, filename) if not isGeopckg else self.model.newEmpty(Config.instance().DIST,filename) - self.elemento = id_estaca - self.model.id_filename = id_estaca - self.estacasHorizontalList=[] - - empty=True - for item in table: - self.view.fill_table(tuple(item)) - self.estacasHorizontalList.append(tuple(item)) - empty=False - - self.view.empty=empty - self.model.save(id_estaca) - self.updateTables() - Config.instance().store("DIST",dados[-2]) - - return self.model.getNewId() - - return False - - def perfilView(self): - tipo, class_project = self.model.tipo() - estacas=self.model.load_terreno_long() - self.perfil = Ui_Perfil(estacas, tipo, class_project, self.model.getGreide(self.model.id_filename), self.model.getCv(self.model.id_filename), iface=self) - self.perfil.save.connect(self.saveGreide) - self.perfil.reset.connect(self.cleanGreide) - self.perfil.showMaximized() - self.perfil.exec_() - - def saveGreide(self, noreset=False): - if self.model.id_filename == -1: return - self.model.table = self.perfil.getVertices() - self.model.cvData=self.perfil.getCurvas() - self.model.saveGreide(self.model.id_filename) - if not noreset: - self.perfil.justClose() - self.perfilView() - - def cleanGreide(self): - if self.model.id_filename == -1: return - self.model.cleanGreide(self.model.id_filename) - self.perfil.justClose() - self.perfilView() - - @nongui - def generateTransThread(self): - self.progressDialog.setText("Carregando dados.") - self.progressDialog.setValue(0) - prog, est, prism = self.model.getTrans(self.model.id_filename) - if prog: - #Database Trans - self.progressDialog.setValue(1) - self.trans=Ui_sessaoTipo(self.iface, est[1], self.model.load_intersect(), prog, est[0], prism=prism, greide=self.model.getGreide(self.model.id_filename), title="Transversal: "+str(self.model.getNameFromId(self.model.id_filename))) - else: - #New trans - self.progressDialog.setValue(1) - self.openEstaca(False) - terreno = self.obterTerrenoTIFF() - if not terreno: - return False, False, False - else: - prog=True - self.progressDialog.setValue(91) - intersect=self.model.load_intersect() - self.progressDialog.setValue(92) - if len(intersect)<=1: - self.generateIntersec(True) - self.progressDialog.setValue(93) - intersect = self.model.load_intersect() - self.progressDialog.setValue(95) - self.trans=Ui_sessaoTipo(self.iface, terreno, intersect, self.estacasVerticalList, greide=self.model.getGreide(self.model.id_filename), title="Transversal: "+str(self.model.getNameFromId(self.model.id_filename))) - - return prog, est, prism - - def generateTrans(self): - self.progressDialog.show() - prog, est, prism = self.generateTransThread() - if not prog: - self.progressDialog.close() - return - self.trans.save.connect(self.saveTrans) - self.trans.btnClean.clicked.connect(self.cleanTrans) - self.trans.plotar.connect(self.plotTransLayer) - self.progressDialog.close() - self.trans.btnExportDxf.clicked.connect(self.exportTrans) - self.trans.btnImportDxf.clicked.connect(self.importTrans) - self.trans.showMaximized() - self.trans.exec_() - self.raiseWindow(self.viewCv) - - def saveTrans(self): - if self.model.id_filename == -1: return - self.model.table = self.trans.getMatrixVertices() - self.model.xList = self.trans.getxList() - self.model.saveTrans(self.model.id_filename, self.trans.prismoide.getPrismoide()) - - def recalcular(self, curva=False): - msgLog("Recalculando") - self.view.comboBox.clear() - id=self.model.id_filename - if not curva: - dados = self.preview.new(True) - else: - dados = self.preview.new(True, layerName=self.view.curvaLayers[0].name(), ask=False) - - if dados is None: return - _, layer, dist, estaca = dados - layer = layer if not curva else self.view.curvaLayers[0] - msgLog("Usando Layer "+layer.name()) - table = self.model.recalcular(dist, estaca, layer, ask=not curva) - self.view.clear() - for item in table: - self.view.fill_table(tuple(item)) - self.model.id_filename=id - self.model.save(id) - if not curva: - self.geraCurvas(self.model.id_filename, recalcular=True) - msgLog("Calculando traçado para o Desenho") - - if not curva and len(self.view.curvaLayers)>0 and yesNoDialog(message="Foram detectadas curvas horizontais no traçado, deseja sobreescrever?"): - msgLog("Removendo layer e curvas") - curvas=Curvas(id_filename=self.model.id_filename) - curvas.erase() - self.model.removeGeoPackage(self.model.getNameFromId(self.model.id_filename)) - - def saveEstacas(self): - if self.model.id_filename == -1: return - estacas = self.view.get_estacas() - self.model.table = estacas - self.model.save(self.model.id_filename) - - def saveEstacasCSV(self): - filename = self.view.saveEstacasCSV() - if filename[0] in ["", None]: return - self.saveEstacas() - estacas = self.view.get_estacas() - self.model.table = estacas - self.model.saveCSV(filename) - - def deleteEstaca(self): - table=self.preview.tableEstacas - table : QtWidgets.QTableWidget - if len(table.selectionModel().selectedRows(0))==0: return - if not yesNoDialog(self.preview, title="Atenção", message="Tem certeza que deseja remover o arquivo?"): - return - indexes=[i.row() for i in table.selectionModel().selectedRows(0)] - if len(indexes)>1: - for i in indexes: - id=table.item(i,0).text() - self.model.deleteEstaca(id) - else: - self.model.deleteEstaca(self.model.id_filename) - curvaModel=Curvas(id_filename=self.model.id_filename) - curvaModel.erase() - self.update() - self.model.id_filename = -1 - self.click = False - - def curva(self): - curvas = self.model.getCurvas(self.model.id_filename) - vertices = [[v[1], p2QgsPoint(float(v[4]), float(v[3]))] for v in self.model.loadFilename() if v[1]!=""] - if len(self.view.curvaLayers)==0: - self.geraCurvas(self.model.id_filename) - if len(vertices)==0: - messageDialog("Erro!", msg="Você deve calcular uma tabela de tangentes primeiro!") - return - else: - curvaView = CurvasView(self.view, self.iface, self.model.id_filename,curvas, vertices,self.model.tipo()) - curvaView.setWindowFlags(QtCore.Qt.Dialog | QtCore.Qt.WindowSystemMenuHint | QtCore.Qt.WindowMinimizeButtonHint | QtCore.Qt.WindowCloseButtonHint) - curvaView.accepted.connect(self.raiseView) - curvaView.rejected.connect(self.raiseView) - curvaView.btnRecalcular.clicked.connect(self.recalcularCurvas) - curvaView.btnTable.clicked.connect(self.viewCurvaZoom) - self.curvaView=curvaView - self.view.showMinimized() - self.view.chview=curvaView - self.curvaView.show() - self.raiseWindow(self.curvaView) - - def recalcularCurvas(self): - self.recalcular(True) - self.curvaView.layer=self.view.curvaLayers[0] - - def viewCurvaZoom(self): - desc = "TS" if self.curvaView.comboElemento.currentIndex()>0 else "TC" - items=[self.view.comboBox.itemText(i) for i in range(self.view.comboBox.count())] - desc += "".join([str(c) for c in self.curvaView.comboCurva.currentText() if c.isdigit()]) - self.raiseView() - if desc in items: - row=0 - self.view.tableWidget.setRangeSelected(QTableWidgetSelectionRange(row, 1, row, 1), True) - self.view.tableWidget.setCurrentCell(row, 1) - self.view.comboBox.setCurrentIndex(items.index(desc)) - - def raiseView(self): - self.raiseWindow(self.view) - if hasattr(self.curvaView, "c"): - self.curvaView.c.rejected.emit() - - def raiseWindow(self, view): - view.setWindowState(view.windowState() & ~QtCore.Qt.WindowMinimized | QtCore.Qt.WindowActive) - view.activateWindow() - - def plotTransLayer(self, index): - self.progressDialog.show() - self.obterTerrenoTIFF(True, index) - self.progressDialog.close() - - - def obterTerrenoTIFF(self, plotTrans=False, index=-1): - if not plotTrans: - filename = self.view.openTIFF() - if filename in ['', None]: return - terreno=[] - - #progressBar=ProgressDialog(None) - #progressBar.show() - - try: - layer=None - if not plotTrans: - for l in self.iface.mapCanvas().layers(): - if l.source() == filename: - layer=l - if layer is None: - msgLog("Layer não encontrada") - return [] - msgLog("Interpolando Layer: "+str(layer.name())) - - estacas = self.estacas = self.model.load_intersect() - if not estacas: - if yesNoDialog(message="Você ainda não calculou a interseção das estacas! Quer que a seção transversal contenha somente estacas do perfil Horizontal?"): - estacas = self.estacas = self.view.get_estacas() - else: - return - # fazer multithreading ? - self.progressDialog.setValue(0) - self.progressDialog.setLoop(90, len(estacas)) - ri=RasterInterpolator() - for i, _ in enumerate(estacas): - if plotTrans and index !=-1: - i=index - - v=[] - az=float(estacas[i][7]) - perp=az+90 - - - if perp>360: - perp=perp-360 - - nsign=1 - esign=1 - if perp<90: - nsign=1 - esign=1 - elif perp<180: - nsign=-1 - esign=1 - elif perp<270: - nsign=-1 - esign=-1 - elif perp<360: - nsign=1 - esign=-1 - - pointsList=[] - - - NPONTOS=Config.instance().T_OFFSET - T_SPACING=Config.instance().T_SPACING - SPACING=T_SPACING/(NPONTOS-1) - interpol=Config.instance().interpol - for yi in range(int(-NPONTOS+1), int(NPONTOS)): - y=yi*SPACING - - yangleE=esign*y*abs(math.sin(perp*math.pi/180)) - yangleN=nsign*y*abs(math.cos(perp*math.pi/180)) - msgLog("Computando azimute transversal: "+str(perp)) - try: - xPoint=float(float(estacas[i][4])+yangleE) - yPoint=float(float(estacas[i][3])+yangleN) - - if not plotTrans: - cota = ri.cotaFromTiff(layer, QgsPointXY(xPoint, yPoint), interpol) - else: - cota=0 - v.append([y,float(cota)]) - pointsList.append([xPoint, yPoint]) - - except ValueError as e: - self.preview.error(u"GeoTIFF não compativel com a coordenada!!!") - msgLog(str(e)) - return False - except IndexError as e: - continue - - - self.progressDialog.increment() - terreno.append(v) - - - if plotTrans: - if index==-1: - self.drawPoints(pointsList, str(i+1)) - # for ind in range(len(pointsList)): - # self.drawPoint(pointsList[ind], str(i+1)) - if index==i: - self.drawPoints(pointsList, str(i+1)) - for ind in range(len(pointsList)): - self.drawPoint(pointsList[ind], str(i+1)) - return - - except e: - msgLog("Interpolação Falhou: "+str(e)) - terreno=[] - - - return terreno - - - def drawPoint(self, point, name): - layer = QgsVectorLayer("Point", name, "memory") - pr = layer.dataProvider() - ft = QgsFeature() - ft.setAttributes([1]) - ft.setGeometry(QgsGeometry.fromPointXY(QgsPointXY(point[0], point[1]))) - pr.addFeatures([ft]) - layer.setCrs(QgsProject.instance().crs()) - QgsProject.instance().addMapLayer(layer) - - def drawPoints(self, pointsList, name): - layer = QgsVectorLayer('LineString', name, "memory") - pr = layer.dataProvider() - poly = QgsFeature() - - points=[] - - for i, _ in enumerate(pointsList): - - point = QgsPointXY(float(pointsList[i][0]), float(pointsList[i][1])) - points.append(point) - - poly.setGeometry(QgsGeometry.fromPolylineXY(points)) - pr.addFeatures([poly]) - layer.updateExtents() - layer.setCrs(QgsProject.instance().crs()) - QgsProject.instance().addMapLayers([layer]) - - - - def newEstacasLayer(self, name): - fields=layerFields() - self.model.saveGeoPackage(name, [], fields, QgsWkbTypes.MultiCurveZ, 'GPKG') - - def saveEstacasLayer(self, estacas, name=None): - name =str(self.model.getNameFromId(self.model.id_filename)) if name==None else name - #path = QtWidgets.QFileDialog.getSaveFileName(self.iface.mainWindow(), "Caminho para salvar o traçado com as curvas", filter="Geopackage (*.gpkg)")[0] - #if not path: return None - - fields=layerFields() - points=[] - features=[] - j=0 - desc="T" - for i,_ in enumerate(estacas): - point = QgsPointXY(float(estacas[i][4]), float(estacas[i][3])) - ed=estacas[i][1] - if ed.startswith("P") or ed.startswith("CT") or ed.startswith("ST"): - desc="T" - elif ed.startswith("TS") or ed.startswith("CS"): - desc="S" - elif ed.startswith("SC") or ed.startswith("TC"): - desc="C" - if i==0: - points.append(point) - else: - if float(estacas[i][6]) != lastAz or i == len(estacas)-1: - points.append(point) - feat=QgsFeature(fields) - feat.setAttributes([desc, "Recalculado"]) - feat.setGeometry(QgsGeometry.fromPolylineXY(points)) - features.append(feat) - j+=1 - points=[point] - lastAz = float(estacas[i][6]) - - path=self.model.saveGeoPackage(name, features, fields, QgsWkbTypes.MultiCurveZ, 'GPKG') - self.view.openLayers() - refreshCanvas(self.iface) - - #CARREGAR NOVA LAYER: - # layer=self.iface.addVectorLayer(path,name,"ogr") - # self.iface.digitizeToolBar().show() - # self.iface.shapeDigitizeToolBar().show() - - # addLineAction = self.iface.digitizeToolBar().actions()[8] - # toggleEditAction = self.iface.digitizeToolBar().actions()[1] - # if not addLineAction.isChecked(): - # toggleEditAction.trigger() - # addLineAction.setChecked(True) - # addLineAction.trigger() - - # return layer - - - def drawEstacas(self, estacas): - layer = QgsVectorLayer('LineString?crs=%s'%(QgsProject.instance().crs().authid()), str(self.model.getNameFromId(self.model.id_filename)), "memory") - layer.setCrs(QgsCoordinateReferenceSystem(QgsProject.instance().crs())) - pr = layer.dataProvider() - poly = QgsFeature() - - points=[] - for i, _ in enumerate(estacas): - - point = QgsPointXY(float(estacas[i][4]), float(estacas[i][3])) - points.append(point) - - poly.setGeometry(QgsGeometry.fromPolylineXY(points)) - pr.addFeatures([poly]) - layer.updateExtents() - QgsProject.instance().addMapLayers([layer], False) - QgsProject.instance().layerTreeRoot().insertLayer(0, layer) - return layer - - - - def obterCotasTIFF(self): - - filename = self.view.openTIFF() - if filename in ['', None]: return - self.progressDialog.setText("Carregando cotas") - self.progressDialog.show() - - try: - l=False - for l in self.iface.mapCanvas().layers(): - if l.source() == filename: - layer=l - break - if not l: - self.preview.error(u"Salve a layer antes de usa-lá!") - return - from ..model.utils import RasterInterpolator - ri=RasterInterpolator() - self.estacas = self.view.get_estacas() - estacas = self.estacas - self.progressDialog.setLoop(100, len(estacas)) - - for i, _ in enumerate(estacas): - cota = ri.cotaFromTiff(layer, QgsPointXY(float(estacas[i][4]),float(estacas[i][3])), interpolate=Config.instance().interpol) - if cota>=0: - estacas[i][5] = roundFloat2str(cota) - else: - self.preview.error(u"Pontos do traçado estão fora do raster selecionado!!!") - break - self.progressDialog.increment() - - except Exception as e: - msgLog("TasterInterpolator failed with "+str(e)) - from osgeo import gdal - dataset = gdal.Open(filename, gdal.GA_ReadOnly) - for x in range(1, dataset.RasterCount + 1): - band = dataset.GetRasterBand(x) - img = band.ReadAsArray() - self.img_origem = dataset.GetGeoTransform()[0],dataset.GetGeoTransform()[3] - self.tamanho_pixel = abs(dataset.GetGeoTransform()[1]),abs(dataset.GetGeoTransform()[5]) - self.estacas = self.view.get_estacas() - estacas = self.estacas - - self.progressDialog.setValue(0) - self.progressDialog.setLoop(100, len(estacas)) - - for i, _ in enumerate(estacas): - self.progressDialog.increment() - try: - pixel = (int(abs(float(estacas[i][4]) - self.img_origem[0]) / self.tamanho_pixel[0]), - int(abs(float(estacas[i][3]) - self.img_origem[1]) / self.tamanho_pixel[1])) - estacas[i][5] = "%f" % img[pixel] - except Exception as e: - #self.drawEstacas(estacas) - self.preview.error(u"GeoTIFF não compativel com a coordenada!!!") - msgLog("Erro: "+str(e)) - break - - self.progressDialog.close() - self.model.table = estacas - self.model.save(self.model.id_filename) - self.openEstaca(False) - self.progressDialog.close() - - - - def obterCotasPC3(self): - - filename = self.view.openTIFF() - if filename in ['', None] or not filename.endswith('dxf'): return - self.estacas = self.view.get_estacas() - estacas = self.estacas - points = [] - # fazer multithreading - for i, _ in enumerate(estacas): - points.append((int("%d" % float(estacas[i][4])), int("%d" % float(estacas[i][3])))) - - dwg = dxfgrabber.readfile(filename, options={"assure_3d_coords": True}) - dxfversion = dwg.header['$ACADVER'] - all_points = [] - for entity in dwg.entities: - if entity.dxftype == 'POINT': - pe = "%d" % entity.point[0] - pn = "%d" % entity.point[1] - p = (int(pe), int(pn)) - if p in points: - all_points.append(p) - - for p in all_points: - ponto = points.index((int(p[0]), int(p[1]))) - estacas[ponto][5] = p[2] - # fix_print_with_import - print(estacas[ponto]) - # fix_print_with_import - print("terminou") - self.model.table = estacas - self.model.save(self.model.id_filename) - self.openEstaca() - - def elevate(self): - import ctypes, win32com.shell.shell, win32event, win32process - outpath = r'%s\%s.out' % (os.environ["TEMP"], os.path.basename(__file__)) - if ctypes.windll.shell32.IsUserAnAdmin(): - if os.path.isfile(outpath): - sys.stderr = sys.stdout = open(outpath, 'w', 0) - return - with open(outpath, 'w+', 0) as outfile: - hProc = \ - win32com.shell.shell.ShellExecuteEx(lpFile=sys.executable, lpVerb='runas', lpParameters=' '.join(sys.argv), - fMask=64, nShow=0)['hProcess'] - while True: - hr = win32event.WaitForSingleObject(hProc, 40) - while True: - line = outfile.readline() - if not line: break - sys.stdout.write(line) - if hr != 0x102: break - os.remove(outpath) - sys.stderr = '' - sys.exit(win32process.GetExitCodeProcess(hProc)) - - def obterCotasPC(self): - try: - import dxfgrabber - from sklearn.svm import SVR - from sklearn.neighbors import KNeighborsRegressor - from sklearn import linear_model - except: - import os - import re - if not re.match("win{1}.*", os.sys.platform) is None: - saida = os.system( - "C:\\Users\\%%USERNAME%%\\.qgis2\\python\\plugins\\TopoGrafia\\app\\controller\\install.bat") - else: - saida = os.system("sudo apt install python-pip&&pip install scikit-learn&&pip install dxfgrabber") - if saida != 0: - self.preview.error( - u"Para usar este recurso você deve instalar os pacotes abaixo:\nSKLearn e dxfgrabber: (Linux) 'sudo pip install scikit-learn&&pip install dxfgrabber' (Windows) Deve seguir o tutorial https://github.com/lennepkade/dzetsaka#installation-of-scikit-learn") - return - filename,_ = self.view.openDXF() - if filename in ['', None] or not (filename.endswith('dxf') or filename.endswith('DXF')): return - estacas = self.view.get_estacas() - dwg = dxfgrabber.readfile(filename, options={"assure_3d_coords": True}) - all_points = [] - all_points_Y = [] - inicial = (float(estacas[0][4]), float(estacas[0][3])) - az_inicial = float(estacas[0][6]) - for entity in dwg.entities: - if entity.dxftype == 'POINT': - dist = math.sqrt((inicial[0] - entity.point[0]) ** 2 + (inicial[1] - entity.point[1]) ** 2) - az = float(azimuth(p2QgsPoint(inicial[0], inicial[1]), p2QgsPoint(entity.point[0], entity.point[1]))) - all_points.append([entity.point[0], entity.point[1]]) - all_points_Y.append([entity.point[2]]) - - points = [] - for i, _ in enumerate(estacas): - points.append([float(estacas[i][4]), float(estacas[i][3])]) - X = all_points - y = all_points_Y - # clf = SVR(C=1.0, epsilon=0.2) - #clf = KNeighborsRegressor(n_neighbors=3) - itens = [u'KNN Regressão (Classico)',u'KNN Regressão (K Inteligente)',u'SVM',u'Regressão Linear'] - itens_func = [KNeighborsRegressor,KNN,SVR,linear_model.ARDRegression] - item, ok = QtWidgets.QInputDialog.getItem(None, "Selecione:", u"Selecione o método de predição:", - itens, - 0, False) - if not(ok) or not(item): - return None - - clf = itens_func[item.index(item)](5) - if itens.index(item) < 2: - k, ok = QtWidgets.QInputDialog.getInteger(None, "Escolha o valor de K", u"Valor de K:", 3, 2, 10000, 2) - if k<1 or not(ok): - return None - clf = itens_func[itens.index(item)](k) - #clf = KNN(5) - # clf = linear_model.LinearRegression() - # clf = linear_model.ARDRegression() - modelo = clf.fit(X, y) - pred = modelo.predict(points) - for i, predito in enumerate(pred): - estacas[i][5] = "%f" % predito - self.model.table = estacas - self.model.save(self.model.id_filename) - self.openEstaca() - - def obterCotas(self): - self.model.table = self.view.get_estacas() - crs = int(self.model.getCRS()) - for i, _ in enumerate(self.model.table): - try: - self.model.table[i][5] = u"%d" % getElevation(crs, p2QgsPoint(float(self.model.table[i][4]), - float(self.model.table[i][3]))) - if self.model.table[i][5] == 0: - return - except Exception as e: - # fix_print_with_import - print(e.message) - break - self.model.save(self.model.id_filename) - self.openEstaca() - - ''' - Metodos responsaveis por gerar o traçado de acordo com cliques na tela. - ''' - - def geraTracado(self,parte=0,pontos=None): - crs = self.model.getCRS() - self.preview.drawShapeFileAndLoad(crs) - - def get_click(self, point, mouse): - - if not self.edit: return - self.edit = False - # if mouse == 2: return - if mouse == 1: - self.preview.create_point(p2QgsPoint(point), 'vertice') - self.points.append(p2QgsPoint(point)) - - self.edit = True - - def get_click_coordenate(self, point, mouse): - - if not self.edit: return - self.edit = False - # if mouse == 2: return - if mouse == 1: - self.preview.create_point(p2QgsPoint(point), 'vertice') - self.points.append(p2QgsPoint(point)) - - self.edit = True - - def exit_dialog(self): - self.points.append(p2QgsPoint(self.points_end)) - self.iface.mapCanvas().setMapTool(QgsMapToolEmitPoint(self.iface.mapCanvas())) - self.edit = False - self.preview.exit_dialog(self.points, self.crs) - self.new() - self.view.show() - self.view.exec_() - - def gera_tracado_vertices(self, p1, p2, crs): - self.crs = crs - self.points = [p1] - self.edit = True - self.points_end = p2 - self.pointerEmitter = QgsMapToolEmitPoint(self.iface.mapCanvas()) - - self.pointerEmitter.canvasClicked.connect(self.get_click) - name_tracado = self.preview.gera_tracado_vertices(self.pointerEmitter) - self.preview.dialog.btnClose.clicked.connect(self.exit_dialog) - return name_tracado - - ''' - -------------------------------------------------- - ''' - - def openEstaca(self, display=True): - if self.model.id_filename == -1: return - self.view.clear() - estacas = self.model.loadFilename() - self.estacasHorizontalList=[] - for e in estacas: - self.view.fill_table(tuple(e), True) - self.estacasHorizontalList.append(tuple(e)) - if display: - self.nextView=self.view - self.view.setCopy() - self.updateTables() - - def openCv(self, recalcular = False): - estacas=self.model.load_verticais() - if recalcular or not estacas: - self.progressDialog.show() - estacas=self.generateVerticaisThread() - self.progressDialog.close() - - if not estacas: - return - self.estacasVerticalList = estacas - self.viewCv.clear() - self.viewCv.setCv() - - for e in estacas: - self.viewCv.fill_table(tuple(e), True) - try: - self.viewCv.btnGen.clicked.disconnect() - except: - pass - self.viewCv.btnGen.clicked.connect(self.generateIntersec) - self.nextView = self.viewCv - - @nongui - def generateVerticaisThread(self): - self.progressDialog.setText("Calculando estacas do greide no perfil vertical") - self.openEstaca() - self.viewCv.clear() - self.viewCv.setWindowTitle(str(self.model.getNameFromId(self.model.id_filename))+": Verticais") - try: - tipo, class_project = self.model.tipo() - estacas = self.model.load_terreno_long() - self.perfil = Ui_Perfil(estacas, tipo, class_project, self.model.getGreide(self.model.id_filename), self.model.getCv(self.model.id_filename), iface=self) - except Exception as e: - import traceback - messageDialog(None, title="Erro!", message="Perfil Vertical ainda não foi definido!") - msgLog("Falha ao identificar Greide") - msgLog(str(traceback.format_exception(None, e, e.__traceback__))[1:-1]) - return - # self.perfilView() - # self.perfil = Ui_Perfil(self.view, tipo, class_project, self.model.getGreide(self.model.id_filename), self.model.getCv(self.model.id_filename)) - - estacas=[] - (estaca,descricao,progressiva,cota) = (0, "V0", 0, self.perfil.getVertices()[0][1]) - estacas.append((estaca,descricao,progressiva,cota)) - missingCurveDialog=[] - y=float(cota) - points=[] - - LH=len(self.perfil.roi.handles)-1 - self.progressDialog.setLoop(30, LH) - for i in range(1, LH): - self.progressDialog.increment() - i1=self.perfil.roi.getSegIncl(i-1,i) - i2=self.perfil.roi.getSegIncl(i,i+1) - L=0 - if self.perfil.cvList[i][1] != "None": - L=float(self.perfil.cvList[i][1]) - - pontosCv=CV(i1, i2, L, self.perfil.roi.getHandlePos(i), self.perfil.roi.getHandlePos(i-1)) - points.append({"cv": pontosCv, "i1": i1/100, "i2": i2/100, "L": L, "i": i}) - - if len(points)==0: - self.progressDialog.close() - messageDialog(None, title="Erro!", message="Perfil Vertical ainda não foi definido!") - msgLog("len(points)==0") - return None - - x=0 - i=points[0]["i1"] - s=0 - c=1 - fpcv=0 - fptv=0 - est=1 - dist=Config.instance().DIST - LH=int(self.perfil.roi.getHandlePos(self.perfil.roi.countHandles() - 1).x() / dist) - skip=False - self.progressDialog.setLoop(80,LH) - while est <= LH: - self.progressDialog.increment() - if fptv: - dx=dist-dx - dy=point["i2"]*dx - fptv=0 - - elif fpcv: - dx=dist-dx - dy=point["i1"]*dx - fpcv=0 - else: - dx=dist - dy=i*dx - - desc="" - - if len(points)>0: - point=points[0] - - try: - pt=x+dx>=point["cv"].xptv - pv=x+dx>=point["cv"].xpcv and not pt and not s - - except AttributeError: - point["cv"].xptv=point["cv"].handlePos.x() - point["cv"].xpcv=point["cv"].handlePos.x() - point["cv"].ypcv=point["cv"].handlePos.y() - point["cv"].yptv=point["cv"].handlePos.y() - - missingCurveDialog.append(c) - - pt=x+dx>=point["cv"].xptv - pv=x+dx>=point["cv"].xpcv and not pt and not s - - i=points[0]["i1"] - else: - pt=False - pv=False - i=point["cv"].i2/100 - - if(pv): - #estacas.append(("debug",point["i"],point["i1"],point["cv"].ypcv)) - dx=point["cv"].xpcv-x - desc="PCV"+str(c) - s=1 - dy=point["cv"].ypcv-y - est-=1 - fpcv=1 - - elif(pt): - dx=point["cv"].xptv-x - - if point["cv"].xptv == point["cv"].handlePos.x(): - desc="PV"+str(c) - else: - desc="PTV"+str(c) - - s=0 - dy=point["cv"].yptv-y - est-=1 - points.pop(0) - fptv=1 - c+=1 - - x+=dx - if s and not (pv or pt): - dy=point["cv"].getCota(x)-y - y+=dy - - if skip: - skip = False - est+=1 - continue - - if dx==dist and (pv or pt): - (estaca,descricao,progressiva,cota) = ( - str(est+1), - desc, - x, - y - ) - skip=True - else: - (estaca, descricao, progressiva, cota) = ( - est if not (pv or pt) else str(est) + ' + ' + roundFloat2str(dx), - desc, - x, - y - ) - - estacas.append((estaca,descricao,progressiva,cota)) - est+=1 - - if len(missingCurveDialog) > 0: - messageDialog(self.viewCv, "Atenção!", message="Nenhum comprimento de curva foi definido no perfil vertical para os vértices: " + str(missingCurveDialog)[1:-1]) - dx=float(self.perfil.getVertices()[-1:][0][0])-x - x+=dx - dy=float(self.perfil.getVertices()[-1:][0][1])-y - y+=dy - - (estaca,descricao,progressiva,cota) = (str(est-1)+' + ' + str(dx),"V"+str(c+1),x,y) - estacas.append((estaca,descricao,progressiva,cota)) - - self.model.saveVerticais(estacas) - return estacas - - - - def itemClickTableEstacas(self, item=None): - self.click = True - if item is None: - self.preview.tableEstacas: QtWidgets.QTableWidget - item=self.preview.tableEstacas.currentItem() - try: - ident = int(self.preview.tableEstacas.item(item.row(), 0).text()) - self.model.id_filename = ident - except: - pass - - def openEstacaCSV(self): - self.view.clear() - res = self.preview.openCSV() - if not res: - return - file=res[0] - if file[0] in ['', None] or res[1] in ['', None] or not (file[0].endswith('csv')): return - filename, fileDB = file[0], res[1] - estacas = self.model.openCSV(filename, fileDB) - self.model.table = estacas - self.elemento = self.model.ultimo - for estaca in estacas: - self.view.fill_table(tuple(estaca), True) - self.view.setCopy() - self.model.save(self.elemento) - - def plotar(self): - self.drawEstacas(self.view.get_estacas()) - #self.view.plotar() - - def update(self): - files = self.model.listTables() - self.preview.fill_table_index(files) - self.preview.checkButtons() - self.view.clear() - self.view.clearLayers() - refreshCanvas(self.iface) - - def updateTables(self): - try: - self.view.setWindowTitle(self.model.getNameFromId(self.model.id_filename)+": Horizontal") - except: - pass - - def run(self): - # from ..view.estacas import SelectFeatureDialog - # s=SelectFeatureDialog(self.iface,self.iface.mapCanvas().layer(0).getFeatures()) - # s.exec_() - self.update() - self.click = False - self.preview.setWindowTitle(Config.instance().FILE_PATH) - self.preview.show() - - finalResult=False - result = True - - lastFinalResult=True - lastResult=False - - - while finalResult>0 or result>0: - self.update() - result = self.preview.exec_() - self.nextView.resize(self.nextView.width(), self.nextView.height()+1) - if result: - self.preview.close() - self.nextView.show() - finalResult = self.nextView.exec_() - - if lastResult == result: - lastResult = not result - - elif lastFinalResult == finalResult: - lastFinalResult = not finalResult - - else: - lastFinalResult=finalResult - lastResult=result - - for d in DIALOGS_TO_CLOSE_ON_LOOP: - if hasattr(self, d): - getattr(self, d).close() +from __future__ import print_function + +# -*- coding: utf-8 -*- +import webbrowser +from copy import deepcopy + +from PyQt5.QtCore import QVariant, QFile +from PyQt5.QtWidgets import QTableWidgetSelectionRange + +from ..controller.threading import nongui + +DEBUG=True +from ..controller.Geometria.Prismoide import QPrismoid + +from qgis.core import QgsDxfExport +try: + import dxfgrabber +except: + pass + +from ..controller.perfil import Ui_Perfil, cv as CV, Ui_sessaoTipo, Ui_Bruckner +from ..model.estacas import Estacas as EstacasModel +from ..model.knn import KNN +from ..model.utils import * +from ..model.curvas import Curvas +from ..view.estacas import Estacas as EstacasView, EstacasUI, EstacasCv, ProgressDialog, \ + EstacaRangeSelect, CorteExport +from ..view.curvas import Curvas as CurvasView, refreshCanvas +from ..view.glmesh import view3D_Ui + + +DIALOGS_TO_CLOSE_ON_LOOP=["curvaView"] + +class Estacas(object): + def __init__(self, iface): + + self.iface = iface + + self.estacasVerticalList=[] + self.estacasHorizontalList=[] + + self.model = EstacasModel() + self.model.iface=iface + self.preview = EstacasUI(iface) + self.view = EstacasView(iface, self) + self.viewCv = EstacasCv(iface, self) + self.progressDialog=ProgressDialog(iface) + + self.events() + self.elemento = -1 + self.click = False + self.edit = False + self.points = [] + + self.nextView=self.view + msgLog("RELOADED") + + + def mudancaCelula(self,item): + if item.column() > 1: + campo = float(self.view.tableWidget.item(item.row(), item.column()).text().replace(',','.')) + self.view.tableWidget.setItem(item.row(), item.column(),QtWidgets.QTableWidgetItem('%s'%campo)) + + def linkGoogle(self, item): + if item.column() == 0: + este = float(self.view.tableWidget.item(item.row(), 4).text()) + north = float(self.view.tableWidget.item(item.row(), 3).text()) + crs = int(self.model.getCRS()) + point = QgsPointXY(este, north) + epsg4326 = QgsCoordinateReferenceSystem(4326, QgsCoordinateReferenceSystem.EpsgCrsId) + mycrs = QgsCoordinateReferenceSystem(int(crs), 0) + reprojectgeographic = QgsCoordinateTransform(mycrs, epsg4326, QgsProject.instance()) + pt = reprojectgeographic.transform(point) + + webbrowser.open('https://www.google.com.br/maps/@%f,%f,15z?hl=pt-BR' % (pt.y(), pt.x())) + + def events(self): + self.preview.tableEstacas:QtWidgets.QTableWidget + self.preview.btnNovo.clicked.connect(self.new) + self.preview.btnOpen.clicked.connect(lambda: self.openEstaca(True)) + self.preview.tableEstacas.doubleClicked.connect(lambda: self.openEstaca(True)) + self.preview.btnOpenCSV.clicked.connect(self.openEstacaCSV) + self.preview.btnApagar.clicked.connect(self.deleteEstaca) + self.preview.btnGerarTracado.clicked.connect(self.geraTracado) + self.preview.tableEstacas.itemClicked.connect(self.itemClickTableEstacas) + self.preview.tableEstacas.itemActivated.connect(self.itemClickTableEstacas) + self.preview.tableEstacas.itemSelectionChanged.connect(self.itemClickTableEstacas) + self.preview.btnOpenCv.clicked.connect(self.openCv) + self.preview.deleted.connect(self.deleteEstaca) + self.preview.btnDuplicar.clicked.connect(lambda: self.duplicarEstaca(True)) + self.preview.btnGerarCurvas.clicked.connect(self.geraCurvas) + + ''' + ------------------------------------------------ + ''' + + self.view.btns=[self.view.btnSave, self.view.btnSaveCSV, self.view.btnLayer, self.view.btnEstacas, + self.view.btnPerfil, self.view.btnCurva,self.view.btnCotaTIFF, self.view.btnCotaPC, self.view.btnCota] + + for btn in self.view.btns: + btn.clicked.connect(self.view.clearLayers) + + self.view.btnSave.clicked.connect(self.saveEstacas) + self.view.btnSaveCSV.clicked.connect(self.saveEstacasCSV) + self.view.btnLayer.clicked.connect(self.plotar) + self.view.btnEstacas.clicked.connect(self.recalcular) + self.view.btnCurva.clicked.connect(self.curva) + self.view.btnCotaTIFF.clicked.connect(self.obterCotasTIFF) + self.view.btnCotaPC.clicked.connect(self.obterCotasPC) + self.view.btnCota.clicked.connect(self.obterCotas) + self.view.btnCota.hide() #TODO Add google Elevation API ? + self.view.tableWidget.itemDoubleClicked.connect(self.linkGoogle) + self.view.tableWidget.itemDoubleClicked.connect(self.mudancaCelula) + self.view.btnDuplicar.clicked.connect(self.duplicarEstacaHorizontal) +# self.view.layerUpdated.connect(self.joinFeatures) + self.view.btnPerfil.clicked.connect(self.perfilView) + + ''' + ------------------------------------------------ + ''' + + self.viewCv.btnGen.clicked.connect(self.generateIntersec) + self.viewCv.btnTrans.clicked.connect(self.generateTrans) + self.viewCv.btnBruck.clicked.connect(self.bruckner) + self.viewCv.btnCrossSectionExport.clicked.connect(self.exportCS) + self.viewCv.btnCsv.clicked.connect(self.exportCSV) + #self.viewCv.btnClean.clicked.connect(self.cleanTrans) + self.viewCv.btnRecalcular.clicked.connect(self.recalcularVerticais) + self.viewCv.btn3D.clicked.connect(lambda: self.export3D()) + self.viewCv.btnCorte.clicked.connect(lambda: self.exportCorte()) + self.viewCv.btn3DView.clicked.connect(lambda: self.view3DView()) + + def view3DView(self): + msgLog("Iniciando visão 3D") + intersect, vertices, faces = self.export3D(pointsOnly=True) + msgLog("Pontos da malha carregados") + view3d=view3D_Ui(intersect, vertices, faces) + view3d.showMaximized() + view3d.exec_() + + def createMesh(self, tipo="H"): + import tempfile + from pathlib import Path + if hasattr(self, "ctExpDiag"): + tipo=self.ctExpDiag.getType() + file = str(Path(tempfile.gettempdir()) / "GeoRoadTempMesh.stl") + table=self.export3D(filename=file, tipo=tipo) + self.tableCorte=table + self.fileCorte=file + return table, file + + def exportCorte(self): + if self.viewCv.mode=="CV": + self.exportDXF() + else: + table, file = self.createMesh() + if not table: return + self.generateCorte() + self.ctExpDiag=diag = CorteExport(None, float(table[-1][2])) + diag.btnPreview.clicked.connect(lambda: self.corteExport(True)) + diag.btnSave.clicked.connect(lambda: self.corteExport(False)) + diag.comboBox.currentIndexChanged.connect(lambda: self.createMesh()) + diag.label_4.hide() + diag.inicialSb.hide() + diag.finalSb.hide() + diag.label_3.hide() + diag.buttonBox.hide() + diag.line.hide() + diag.comboBox.hide() + diag.label_8.hide() + diag.btnSave.clicked.connect(diag.accept) + diag.exec_() + + + def corteExport(self, preview=False): + self.generateCorte() + if not hasattr(self.combined, "show"): + messageDialog(message="Seção vazia! Nada foi encontrado, tente aumentar a profundidade!") + else: + if preview: + self.combined.show() + else: + self.saveDxfCorte() + + + def generateCorte(self, step=1, depth=20, tipo="H"): + import numpy as np + file=self.fileCorte + if hasattr(self, "ctExpDiag"): + tipo=self.ctExpDiag.getType() + step=self.ctExpDiag.intSp.value() + depth=self.ctExpDiag.espSb.value() + e1=self.ctExpDiag.inicialSb.value() + e2=self.ctExpDiag.finalSb.value() + offset=self.ctExpDiag.offsetSb.value() + else: + e2=float(self.tableCorte[-1][2]) + e1=0 + offset=0 + + if tipo=="T": + plane_normal=[1, 0, 0] + self.progressDialog.show() + self.progressDialog.setLoop(100, (e1 - e2) / Config.instance().DIST, 0) + for e in self.tableCorte: + if estaca2progFloat(e[0]) > e2: + break + if estaca2progFloat(e[0])>=e1: + self.progressDialog.increment() + offset=estaca2progFloat(e[0])-e1 + sections = self.sliceCorte(file, tipo, step, depth, plane_normal, offset) + self.progressDialog.close() + elif tipo=="H": + plane_normal=[0, 0, 1] + sections = self.sliceCorte(file, tipo, step, depth, plane_normal, offset, float(self.tableCorte[0][5])) + else: #V + plane_normal=[0, 1, 0] + sections=self.sliceCorte(file, tipo, step, depth, plane_normal, offset) + self.combined = np.sum(sections) + + if hasattr(self, "ctExpDiag") and self.ctExpDiag.isEstaca(): #printar estacas + from ... import trimesh + textHeight=5 + if tipo=="T": + self.progressDialog.show() + self.progressDialog.setLoop(100,(e1-e2)/Config.instance().DIST) + for e in self.tableCorte: + if estaca2progFloat(e[1]) > e2: + break + if estaca2progFloat(e[1]) >= e1: + self.progressDialog.increment() + text = trimesh.path.entities.Text(origin=len(self.combined.vertices),text=str(e[0]) + " " + str(e[1]), height=textHeight) + self.combined.vertices=np.vstack((self.combined.vertices, self.combined.bounds.mean(axis=0))) + self.combined.entities=np.append(self.combined.entities, text) + + self.progressDialog.close() + + elif tipo=="H": + for e in self.tableCorte: + azi=np.deg2rad(float(e[7])+90) + l=50 + text = trimesh.path.entities.Text(origin=len(self.combined.vertices), text=str(e[0])+" "+str(e[1]), height=textHeight) + self.combined.vertices=np.vstack((self.combined.vertices, np.array([float(e[4]), float(e[3])]))) + self.combined.entities=np.append(self.combined.entities, text) + line=trimesh.path.entities.Line(np.array([len(self.combined.vertices), len(self.combined.vertices)+1])) + self.combined.vertices=np.vstack((self.combined.vertices, np.array([float(e[4])+l*np.sin(azi), float(e[3])+l*np.cos(azi)]))) + self.combined.vertices=np.vstack((self.combined.vertices, np.array([float(e[4])-l*np.sin(azi), float(e[3])-l*np.cos(azi)]))) + self.combined.entities = np.append(self.combined.entities, line) + else: #V + for e in self.tableCorte: + text = trimesh.path.entities.Text(origin=len(self.combined.vertices), text=str(e[0])+" "+str(e[1]), height=textHeight) + self.combined.vertices = np.vstack((self.combined.vertices, np.array([float(e[2]), float(e[5])]))) + self.combined.entities = np.append(self.combined.entities, text) + line=trimesh.path.entities.Line(np.array([len(self.combined.vertices), len(self.combined.vertices)+1])) + self.combined.vertices = np.vstack((self.combined.vertices, np.array([float(e[2]), float(e[5])-5]))) + self.combined.vertices = np.vstack((self.combined.vertices, np.array([float(e[2]), float(e[5])+5]))) + self.combined.entities = np.append(self.combined.entities, line) + + + msgLog("Foram adicionados "+str(len(self.combined.entities))+" elementos para o tipo "+tipo) + + def sliceCorte(self, file, tipo, step, depth, plane_normal, offset=0, cota=0.0): + from ... import trimesh + import numpy as np + mesh = trimesh.load_mesh(file) + if tipo=="T": + n=0 + plane_origin=[0,0,mesh.bounds[0][2]] + elif tipo=="V": + n=1 + plane_origin=[0,0,-2*mesh.bounds[0][1]] + else: + n=2 + plane_origin=[0,0,mesh.bounds[0][2]] + z_extents = mesh.bounds[:, n] + depth=min(z_extents[1]-z_extents[0],depth) + #z_levels = np.arange(*z_extents, step=step)[int(offset/step):int(depth/step)] + z_levels = np.linspace(offset, depth, num=int(depth/step))#[int(offset/step):]#int(depth/step)] + sections = mesh.section_multiplane(plane_origin=plane_origin, + plane_normal=plane_normal, + heights=z_levels) + #sections=[s for s in sections if not s is None] + labeled_sections=[] + textHeight=2 + for s in sections: + if s is None: + cota += step + continue + for vi, v in enumerate(s.vertices): + if vi%30==0: + text = trimesh.path.entities.Text(origin=vi, text=cota, height=textHeight) + s.entities = np.append(s.entities, text) + labeled_sections.append(s) + cota+=step + + return labeled_sections + + + def saveDxfCorte(self): + filter=".dxf" + filename = QtWidgets.QFileDialog.getSaveFileName(filter="Arquivo dxf(*" + filter + " *" + filter.upper() + ")")[0] + if filename in ['', None]: + return + filename = str(filename) if str(filename).endswith(filter) else str(filename) + filter + self.combined.export(filename) + + + def export3D(self, filename=None, terrain=True, tipo="3D", pointsOnly=False): # H, V, T + self.progressDialog.show() + self.progressDialog.setValue(0) + + Z=0 if tipo in "HT" else None + reto=True if tipo in "VT" else None + + filter=".stl" + X, table, prismoide = self.model.getTrans(self.model.id_filename) + self.progressDialog.setValue(5) + intersect=self.model.load_intersect() + self.progressDialog.setValue(10) + prismoide: QPrismoid + if not X or not prismoide: + messageDialog(message="Seção Transversal não definida!") + self.progressDialog.close() + return + + import numpy as np + from ...stl import mesh + from scipy import spatial + + self.progressDialog.setValue(25) + + # Define the terrain vertices + verticesg = [] + vertices = [] + errors=[] + + for i, est in enumerate(X): + self.progressDialog.setValue(25+70*i/len(X)) + norte=float(intersect[i][3]) + este=float(intersect[i][4]) + greide=float(intersect[i][5]) + az=float(intersect[i][7]) + st=prismoide.faces[i].superior + stpts=st.getPoints() + points=[] + try: + if terrain: + for pt in table[1][i]: + if pt[0]>stpts[0][0]: + break + else: + points.append(pt) + + points+=[[pt.x(), pt.y()] for pt in stpts] + + if terrain: + for pt in table[1][i]: + if pt[0] > stpts[-1][0]: + points.append(pt) + + except Exception as e: + import traceback + msgLog(str(traceback.format_exception(None, e, e.__traceback__))[1:-1]) + errors.append(est) + continue + + perp = az + 90 + if perp > 360: + perp = perp - 360 + nsign = 1 + esign = 1 + if perp < 90: + nsign = 1 + esign = 1 + elif perp < 180: + nsign = -1 + esign = 1 + elif perp < 270: + nsign = -1 + esign = -1 + elif perp < 360: + nsign = 1 + esign = -1 + + for j, pt in enumerate(points): + x,y,z=est,pt[0],pt[1] + z = z if Z is None else z - greide + Z + if reto is None: + yangleE = esign * y * abs(math.sin(perp * math.pi / 180)) + yangleN = nsign * y * abs(math.cos(perp * math.pi / 180)) + xPoint = float(este + yangleE) + yPoint = float(norte + yangleN) + verticesg.append([xPoint, yPoint, z]) + else: + verticesg.append([x, y, z]) + vertices.append([x, y, z]) + + if errors: + messageDialog(title="Erro", message="Erro nas estacas: "+"; ".join([prog2estacaStr(p) for p in errors])) + + verticesg = np.array(verticesg) + vertices = np.array(vertices) + tri = spatial.Delaunay(vertices[:, :2]) + facesg=tri.simplices + + if pointsOnly: + self.progressDialog.close() + return intersect, verticesg, facesg + + # Create the meshes + greide = mesh.Mesh(np.zeros(facesg.shape[0], dtype=mesh.Mesh.dtype)) + for i, f in enumerate(facesg): + for j in range(3): + greide.vectors[i][j] = verticesg[f[j], :] + self.progressDialog.setValue(98) + + #combined = mesh.Mesh(np.concatenate([terrain.data, greide.data])) + combined=greide + self.progressDialog.close() + + if filename is None: + filename = QtWidgets.QFileDialog.getSaveFileName(filter="Arquivo stl(*" + filter + " *" + filter.upper() + ")")[0] + if filename in ['', None]: + return + filename = str(filename) if str(filename).endswith(filter) else str(filename) + filter + combined.save(filename) + + if tipo == "3D": + import shutil + exe = shutil.which("blender") #maybe this works on windows someday? + + from pathlib import Path + p = Path("C:\Program Files\Blender Foundation\\").rglob("*/*.exe") #blender's default path on windows + for file in p: + if file.name == "blender.exe": + exe=str(file) + if exe: + def resolve(name, basepath=None): + if not basepath: + basepath = str(Path(__file__).parents[2]) + return os.path.join(basepath, name) + + if yesNoDialog(message="O blender foi detectado no sistem. Deseja abrir o modelo?"): + #move template blend to tmp + from tempfile import gettempdir + blend=str(Path(gettempdir()) / "georoadBlender.blend") + shutil.copy(resolve("layout.blend"), blend) + + #start=?, create dxf starting from 0,0,10 + import json + table=intersect + jsonfile=str(Path(gettempdir()) / "georoadBlender.json") + init=table[0] + data={} #x,y,z --> 0,0,0 + init=data["start"]=[float(init[4]), float(init[3]), float(init[5])] + data["points"]=[[float(e[4])-init[0],float(e[3])-init[1],float(e[5])-init[2]] for e in table] + data['estacas']=[e[0] for e in table] + data['azi']=[e[7] for e in table] + data["frames"]=float(table[-1][2])/200*24 + with open(jsonfile, "w") as outfile: + json.dump(data, outfile) + + #launch exe -P with the script and arguments + import subprocess + script=resolve("blender.py") + cmd=[exe, blend, "--python", script, "--", filename] + msgLog("Running Command: "+" ".join(cmd)) + subprocess.Popen(cmd) + else: + # self.showModelo3D(filename) + pass + else: + msgLog("Blender não foi encontrado!") + # self.showModelo3D(filename) + else: + return intersect + + def showModelo3D(self, filename): + if yesNoDialog(message="Deseja visualizar o modelo gerado?"): + try: + import trimesh + mesh=trimesh.load(filename) + mesh.show() + except Exception as e: + import traceback + msgLog("Erro: " + str(traceback.format_exception(None, e, e.__traceback__))[1:-1]) + + def exportTrans(self): + filename = QtWidgets.QFileDialog.getSaveFileName(caption="Save dxf", filter="Arquivo DXF (*.dxf)") + if filename[0] in ["", None]: return + v=self.trans.verticais.getY(self.trans.progressiva[self.trans.current]) + self.saveDXF(filename[0], [[p2QgsPoint(float(x),float(y)-float(v)) for x, y in self.trans.st[self.trans.current]]]) + + def importTrans(self): + filename = QtWidgets.QFileDialog.getOpenFileName(caption="Open dxf", filter="Arquivo DXF (*.dxf)") + if filename[0] in ["", None]: return + uri = filename[0]+"|layername=entities|geometrytype=Line" + vlayer = QgsVectorLayer(uri, "Seção tipo", "ogr") + features = [f for f in vlayer.getFeatures()] + v = self.trans.verticais.getY(self.trans.progressiva[self.trans.current]) + pl=featureToPolyline(features[0]) + from collections import OrderedDict + pl=list(OrderedDict.fromkeys(pl)) + msgLog("Seção :"+str([[p.x(),p.y()] for p in pl])) + self.trans.st[self.trans.current]=[[pt.x(), pt.y()+v] for pt in pl] + self.trans.prismoide.st = self.trans.st + try: + self.trans.prismoide.generate(self.trans.current) + except: + msgLog("Falha ao achar interseção com o terreno!") + self.trans.reset() + + def bruckner(self): + self.progressDialog.show() + self.progressDialog.setValue(0) + table = self.model.load_bruckner() + bruck=self.model.load_bruck() + if not table or not ("table" in bruck and bruck['table']): # if non existent, compute + X, est, prismoide=self.loadTrans() + msgLog(str(len(X))+" Estacas na transversal") + if not X: + messageDialog(message="Seção Transversal não definida!") + self.progressDialog.close() + return + fh,ok=QtWidgets.QInputDialog.getDouble(None, "Fator de Homogeneização", "Defina o Fh:", value=1.05, min=0, max=10, decimals=4) + if not ok: + return + self.progressDialog.setValue(10) + X, V = self.brucknerThread(X, est, prismoide, 0, len(X), fh) + else: + X, V = zip(*table) + X = [float(x) for x in X] + V = [float(v) for v in V] + self.progressDialog.setValue(90) + Xests=X + Vests=V + dialog=EstacaRangeSelect(None, Xests, bruck=bruck) + self.progressDialog.close() + while dialog.exec_(): + self.bruck=dialog.bruck + ei=dialog.inicial.currentIndex() + ef=dialog.final_2.currentIndex() + key=str(dialog.inicial.itemText(ei))+"-"+str(dialog.final_2.itemText(ef)) + X=Xests[ei:ef+1] + V=Vests[ei:ef+1] + dist=Config.instance().DIST + X=[x*dist for x in X] + + if key in self.bruck: + bruckD = Ui_Bruckner(X, V, key=key, bruck=self.bruck, bruckData=self.bruck[key], interval=[ei,ef]) + else: + size=min(len(X), len(V)) + bruckD = Ui_Bruckner(X[:size], V[:size], key=key, bruck=self.bruck, interval=[ei,ef]) + + msgLog("Abrindo intervalo: " + key) + bruckD.showMaximized() + #bruckD.save.connect(lambda: self.bruckner2DXF(bruckD.X, bruckD.V)) + bruckD.reset.connect(self.brucknerReset) + self.brucknerView=bruckD + bruckD.exec_() + bruckD.setBruckData() + if hasattr(self,"bruckReseted") and self.bruckReseted: #loop do reset + self.bruckReseted=False + elif (hasattr(self,"bruckReseted") and not self.bruckReseted) or (hasattr(bruckD, "reseted") and bruckD.reseted): #primeiro loop + self.bruckReseted=False + del self.bruckReseted + return + self.bruck[key]=bruckD.bruckData + self.model.save_bruck(self.bruck) + dialog=EstacaRangeSelect(None, Xests, bruck=self.bruck) + + self.model.save_bruck(dialog.bruck) + msgLog("Edição bruckner finalizada") + + + def brucknerReset(self): + self.brucknerView.close() + self.bruckReseted=True + self.model.cleanBruckner(keepLines=yesNoDialog(message="Deseja manter as linhas de terra?")) + self.bruck=self.model.load_bruck() + self.bruckner() + + def matplot(self, X, V, title="Diagrama de Bruckner", xlabel=u'Estacas', ylabel=u'Volume m³'): + import matplotlib.pyplot as plt + line, = plt.plot(X, V, lw=2) + plt.title(title) + plt.xlabel(xlabel) + plt.ylabel(ylabel) + plt.grid(True) + plt.show() + + + @nongui + def brucknerThread(self, X, est, prismoide, ei, ef, fh): + self.progressDialog.setText("Calculando Volumes acumulados") + msgLog("Calculando tabela de volumes acumulados") + X=[float(x) for x in X] + x1=X[ei] + X=X[ei:ef+1] + V=[] + vAcumulado=0 + face=prismoide.faces[ei] + ct, at = face.getAreas() + self.progressDialog.setLoop(30, len(X)) + bruck=[{"estaca":prog2estacaStr(x1), "corte": abs(ct), "aterro": abs(at), "at.cor.": abs(at*fh), "soma": "", "semi-distancia": "", + "vol.corte":"", "vol.aterro":"", "volume":"", "vol.acum":""}] + for x in range(1,len(X)): + data=prismoide.getBruckVols(ei+x-1, ei+x, fh=fh)[0] + data['estaca']=prog2estacaStr(X[x]) + if data["volume"]==0 and data['semi-distancia']==0: + msgLog("Erro na estaca "+data['estaca']) + vAcumulado+=data["volume"] + data["vol.acum"]=vAcumulado + V.append(vAcumulado) + bruck.append(data) + self.progressDialog.increment() + self.model.save_bruck({'table':bruck}) + V=[v + abs(min(V))+1000 for v in V] + X=[x/Config.instance().DIST for x in X] + self.progressDialog.setValue(80) + self.model.saveBruckner(list(zip(X, V))) + return X, V + + def bruckner2DXF(self, X, Y): + filename = QtWidgets.QFileDialog.getSaveFileName(caption="Save dxf",filter="Arquivo DXF (*.dxf)") + if filename[0] in ["", None]: return + dist=Config.instance().DIST + self.saveDXF(filename[0], [[p2QgsPoint(x*dist, y/1000000) for x, y in (zip(X, Y))]]) + + def exportDXF(self): + filename = QtWidgets.QFileDialog.getSaveFileName(caption="Save dxf",filter="Arquivo DXF (*.dxf)") + if filename[0] in ["", None]: return + estacas=self.viewCv.get_estacas() + terreno=self.model.load_terreno_long() + Lpoints=[] + if self.viewCv.mode=="CV": + points=[] + for e in estacas: + points.append(p2QgsPoint(float(e[-2]), float(e[-1]))) + Lpoints.append(points) + prog=float(e[-2]) + points=[p2QgsPoint(float(e[-2])-prog, float(e[-1])) for e in terreno] + Lpoints.append(points) + elif self.viewCv.mode=="T": + points=[] + for e in estacas: + points.append(p2QgsPoint([float(e[4]), float(e[3]), float(e[-3])])) + Lpoints.append(points) + + self.saveDXF(filename[0], Lpoints) + + if self.viewCv.mode=="CV": + self.addVerticalEstacas(filename[0], estacas) + + def exportCS(self): +# if yesNoDialog(title="Plotar Transversais?", message="Deseja exportar os perfis transversais? (Se ainda não foram definidos não serão salvos)"): + self.progressDialog.show() + + X,table,prismoide=self.loadTrans() + + filename = QtWidgets.QFileDialog.getSaveFileName(caption="Save dxf", filter="Arquivo DXF (*.dxf)") + if filename[0] in ["", None]: return + LPoints=[] + for i,face in enumerate(prismoide.getFaces()): + st = face.superior + stpts = st.getPoints() + points=[] + for pt in table[1][i]: + if pt[0] > stpts[0][0]: + break + else: + points.append(p2QgsPoint([float(pt[0]),float(pt[1])])) + points += [p2QgsPoint([pt.x(), pt.y()]) for pt in stpts] + for pt in table[1][i]: + if pt[0] > stpts[-1][0]: + points.append(p2QgsPoint([float(pt[0]),float(pt[1])])) +# for line in face.superior.lines: +# points.append(p2QgsPoint(line.point1.x(), line.point1.y())) +# for line in face.inferior.lines: +# points.append(p2QgsPoint(line.point1.x(), line.point1.y())) + LPoints.append(points) + + self.addTransEstacas(filename[0], self.model.load_intersect(), self.saveDXF(filename[0], LPoints)) + self.progressDialog.close() + + def addVerticalEstacas(self, filename, estacas): + from ... import trimesh + import numpy as np + combined=trimesh.load(filename) + textHeight=5 + l=20 + for e in estacas: + p=np.array([float(e[-2]), float(e[-1])]) + text = trimesh.path.entities.Text(origin=len(combined.vertices), text=str(e[0]) + " " + str(e[1]), + height=textHeight) + combined.vertices = np.vstack((combined.vertices, p)) + combined.entities = np.append(combined.entities, text) + line = trimesh.path.entities.Line(np.array([len(combined.vertices), len(combined.vertices) + 1])) + combined.vertices = np.vstack( + (combined.vertices, np.array([p[0], p[1]+l]))) + combined.vertices = np.vstack( + (combined.vertices, np.array([p[0], p[1]-l]))) + combined.entities = np.append(combined.entities, line) + + combined.export(filename) + + def addTransEstacas(self, filename, estacas, coords): + from ... import trimesh + import numpy as np + combined = trimesh.load(filename) + textHeight = 5 + for e, c in zip(estacas, coords): + text = trimesh.path.entities.Text(origin=len(combined.vertices), text=str(e[0]) + " " + str(e[1]), + height=textHeight) + combined.vertices = np.vstack((combined.vertices, c)) + combined.entities = np.append(combined.entities, text) + combined.export(filename) + + def saveDXF(self, filename, listOfListOfPoints): #[ [ p2QgsPoint[ x,y], [x,y] ...] , [ [ x,y] , [x,y] ...] ....] Each list is a feature + import numpy as np + coords=[] + layer=QgsVectorLayer("LineStringZ?crs=%s"%(QgsProject.instance().crs().authid()), "Perfil: " if self.viewCv.mode=="CV" else "Traçado Horizontal: " + + self.model.getNameFromId(self.model.id_filename), "memory") + layer.setCrs(QgsCoordinateReferenceSystem(QgsProject.instance().crs())) + features=[] + DX=0 + DY=0 + MAX_COLUMNS=10 + ncolumns=1 + for points in listOfListOfPoints: + feat=QgsFeature() + g=QgsGeometry.fromPolyline(points) + g.translate(DX,DY) + feat.setGeometry(g) + features.append(QgsFeature(feat)) + feat=QgsFeature() + rect=g.boundingBox() + feat.setGeometry(QgsGeometry.fromRect(rect)) + features.append(QgsFeature(feat)) + coords.append(np.array([np.average(rect.center().x()), rect.center().y()+5])) + + if ncolumns1: + self.preview.error(u"Selecione um único arquivo!") + elif l<1: #criar traçado, iniciar edição + name=self.fileName("Traçado "+str(len(self.model.listTables())+1)) + if not name: return + self.new(dados=(name, self.newEstacasLayer(name=name), Config.instance().DIST, [])) + else: + self.openEstaca() + self.view.btnCurva.click() + + def joinFeatures(self): + layer=self.view.curvaLayers[0] + layer.layerModified.disconnect() + layer.commitChanges() + id=[f for f in layer.getFeatures()][-1].id() + if id>1: + moveLine(layer,id,getLastPoint(layer, id)) + self.iface.mapCanvas().refresh() + layer.startEditing() + layer.layerModified.connect(lambda: self.view.add_row(layer)) + +# self.updateTables() + + def fillView(self, table): + self.estacasHorizontalList=[] + empty=True + self.view.clear() + for item in table: + self.view.fill_table(tuple(item)) + self.estacasHorizontalList.append(tuple(item)) + empty=False + self.view.empty=empty + self.model.save(self.model.id_filename) + + def fileName(self, suggestion=False): + filename = "" + names = [self.preview.tableEstacas.item(i, 1).text() for i in range(self.preview.tableEstacas.rowCount())] + first = True + while filename == "" or filename in names: + if not first: + from ..model.utils import messageDialog + messageDialog(None, title="Erro", message="Já existe um arquivo com esse nome") + + filename, ok = QtWidgets.QInputDialog.getText(None, "Nome do arquivo", u"Nome do arquivo:", + text=suggestion if suggestion else "Traçado " + + str(len(self.model.listTables()+1))) + if not ok: + return False + first = False + return filename + + def finishEdit(self): + l = self.view.curvaLayers[0] + l.commitChanges() + l.endEditCommand() + QgsProject.instance().removeMapLayer(l.id()) + + def duplicarEstacaHorizontal(self): + self.duplicarEstaca(False) + + def duplicarEstaca(self, trans=True): + msgLog("---------Iniciando cópia--------") + import traceback + if self.model.id_filename == -1: return + filename=self.fileName(suggestion="Cópia de " + self.model.getNameFromId(self.model.id_filename)) + if not filename: + return None + self.progressDialog.show() + self.openEstaca() + self.progressDialog.setValue(10) + estacas = self.view.get_estacas() + bruck = self.model.load_bruck() + id_filename=deepcopy(self.model.id_filename) + self.model = self.model.saveEstacas(filename, estacas) + if trans: + try: + msgLog("Carregando Transversais: ") + prog, est, prism = self.model.getTrans(id_filename) + if prog: + self.trans=Ui_sessaoTipo(self.iface, est[1], self.model.load_intersect(id_filename), + prog, est[0], prism=prism, greide=self.model.getGreide(id_filename), + title="Transversal: " + str(self.model.getNameFromId(id_filename))) + self.model.id_filename = self.model.ultimo + self.saveTrans() + msgLog("Tranversais Salvas!") + except Exception as e: + msgLog("Falha ao duplicar Transversais: ") + msgLog(str(traceback.format_exception(None, e, e.__traceback__))[1:-1]) + + self.model.id_filename=self.model.ultimo + self.progressDialog.setValue(40) + if bruck: + self.model.save_bruck(bruck) + try: + self.view.openLayers() + l = self.view.curvaLayers[0] + source = self.view.curvaLayers[0].source() + curvaModel = Curvas(id_filename) + l.commitChanges() + l.endEditCommand() + QgsProject.instance().removeMapLayer(l.id()) + curvaModel.duplicate(filename, self.model.ultimo, source) + except Exception as e: + msgLog("---------------------------------\n\nFalha ao duplicar curvas: ") + msgLog(str(traceback.format_exception(None, e, e.__traceback__))[1:-1]) + self.progressDialog.setValue(60) + try: + tipo, class_project = self.model.tipo() + estacas = self.model.load_terreno_long() + self.perfil = Ui_Perfil(estacas, tipo, class_project, self.model.getGreide(id_filename), + self.model.getCv(id_filename), iface=self) + table = deepcopy(self.perfil.getVertices()) + cvData=deepcopy(self.perfil.getCurvas()) + self.model.table = table + self.model.cvData=cvData + self.model.saveGreide(self.model.ultimo) + except Exception as e: + msgLog("Falha ao duplicar Greide: ") + msgLog(str(traceback.format_exception(None, e, e.__traceback__))[1:-1]) + self.progressDialog.setValue(80) + #self.geraCurvas(self.model.id_filename) + + self.update() + self.view.clear() + estacas = self.model.loadFilename() + self.estacasHorizontalList = [] + for e in estacas: + self.view.fill_table(tuple(e), True) + self.estacasHorizontalList.append(tuple(e)) + self.progressDialog.setValue(99) + self.nextView = self.view + self.view.setCopy() + self.updateTables() + try: + self.view.closeLayers() + self.viewCv.closeLayers() + except: + msgLog("Failed to close layers!") + self.progressDialog.close() + + def cleanTrans(self): + if yesNoDialog(None, message="Tem certeza que quer excluir os dados transversais?"): + self.trans.close() + self.model.cleanTrans(idEstacaTable=self.model.id_filename) + self.generateTrans() + + + def recalcularVerticais(self): + if self.viewCv.mode=="CV": + self.openCv(True) + elif self.viewCv.mode=="T": + self.generateIntersec(True) + + + + def generateIntersec(self, recalcular=False): + table = self.model.load_intersect() + + if recalcular or not table: + self.progressDialog.show() + table=self.generateintersecThread() + self.progressDialog.close() + if not table: + return + + self.viewCv.clear() + self.viewCv.setIntersect() + s=0 + for e, e2 in zip(table[:-1], table[1:]): + self.viewCv.fill_table(tuple(e), True) + e1=[float(e[2]), float(e[-3])] + e2=[float(e2[2]), float(e2[-3])] + s+=((e2[0]-e1[0])**2+(e2[1]-e1[1])**2)**.5 + self.viewCv.fill_table(tuple(table[-1]), True) + + self.viewCv.setWindowTitle(self.model.getNameFromId(self.model.id_filename) + ": Estacas") + try: + self.viewCv.btnGen.clicked.disconnect() + except: + pass + self.viewCv.btnGen.clicked.connect(self.openCv) + self.viewCv.comprimento.setText(roundFloat2str(s) + " " + Config.instance().UNITS) + self.nextView=self.viewCv + + + @nongui + def generateintersecThread(self): + self.progressDialog.setValue(0) + self.progressDialog.setText("Montando matrix de conflito...") + import time + self.openEstaca(False) + horizontais = self.view.get_estacas() #x = 4, y =3 + startTime = time.time() + points=[] + progs=[] + LH=len(horizontais) + self.progressDialog.setLoop(100,LH) + for i,h in enumerate(horizontais): + points.append(p2QgsPoint(float(h[4]), float(h[3]))) + progs.append(float(h[2])) + self.progressDialog.increment() + + road=QgsGeometry.fromPolyline(points) + + QgsMessageLog.logMessage("Iniciando comparação", "GeoRoad", level=0) + msgLog("Organizando: " + str(time.time() - startTime) + " seconds") + + verticais=[] + lastH=deepcopy(h) + self.openCv() + vprogs=[] + estacas=self.viewCv.getEstacas() + + LH=500 + self.progressDialog.setLoop(60, LH) + try: + for i, v in enumerate(estacas): # prog=2 em ambos + prog=float(v[2]) + if prog in progs: + h = horizontais[progs.index(float(v[2]))] + if h[1]: + desc="" if h[1]=="" and v[1]=="" else h[1]+" + "+v[1] + else: + desc=v[1] + verticais.append([v[0], desc, v[2], h[3], h[4], v[3], h[5], h[6]]) + else: + pt=road.interpolate(prog-.1).asPoint() + pt2=road.interpolate(prog).asPoint() + verticais.append([v[0], v[1], v[2], pt.y(), pt.x(), v[3], None, azimuth(pt, pt2)]) #Não sei a cota 6 + self.progressDialog.increment() + vprogs.append(prog) + except Exception as e: + import traceback + msgLog("Erro ao gerar pontos!!!!!! ") + msgLog(str(traceback.format_exception(None, e, e.__traceback__))) + msgLog("Road: ") + msgLog(str(road)) + msgLog("Na Progressiva: ") + msgLog(str(prog)) + messageDialog(message="As estacas finais do perfil vertical e horizontal não estão alinhadas", info="Tente criar seu perfil vertical novamente e recalcular a tabela vertical!") + return False + + if v[2]!=lastH[2]: + messageDialog(message="As estacas finais do perfil vertical e horizontal não estão alinhadas", info="Tente criar seu perfil vertical novamente e recalcular a tabela vertical!") + return False + + table=verticais + msgLog("Horizontais: " + str(time.time() - startTime) + " seconds") + + for h in horizontais: + if float(h[2]) not in vprogs: + table.append([h[0],h[1],h[2],h[3],h[4],None,h[5],h[6]]) #Não sei o greide 5 + + table = sorted(table, key=lambda x: float(x[2])) #Organizar em ordem da progressiva + msgLog("Organizar: "+ str(time.time()-startTime)+" seconds") + self.progressDialog.setValue(90) + + progAnt=float(table[0][2]) + anterior=[table[0][-2],table[0][-3]] #cota, greide + cfg=Config.instance() + DIST=cfg.DIST + PREC=cfg.PREC + for i,t in enumerate(table): #Interpolar greides e cotas desconhecidos + atual=[t[-2],t[-3]] #cota, greide + if None in atual: + if i==0: + distAnt=1000000 + else: + distAnt=float(t[2])-progAnt + j=1 + while i+j < len(table)-1: # Próxima estaca inteira + if float(table[i+j][2])%DIST==0: + proxima=[table[i+j][-2],table[i+j][-3]] #cota, greide + distProx=float(table[i+j][2])-float(t[2]) + break + j+=1 + else: + proxima=anterior + distProx=1000000 + + try: + from numpy import interp # Interpola os valores de greide e cota desconhecidos em pontos críticos + table[i][-2]=interp(0, [-distAnt, distProx], [float(anterior[0]), float(proxima[0])]) + table[i][-3]=interp(0, [-distAnt, distProx], [float(anterior[1]), float(proxima[1])]) + except Exception as e: + msgLog(str(e)) + table[i][-2]=0 + table[i][-3]=0 + + if float(t[2])%DIST==0: #se é uma estaca inteira se torna a anterior + anterior=atual + progAnt=float(t[2]) + + # unir estacas muito próximas + intersec=[] + e=table[0] + for e1, e2 in zip(table[:-1], table[1:]): + dist=float(e2[2])-float(e1[2]) + if dist<=PREC: + e1[1]=e[1]+" + "+e2[1] + e=e1 + else: + intersec.append(e) + e=e2 + intersec.append(e2) + + self.model.saveIntersect(intersec) + + msgLog("Verticais: "+ str(time.time()-startTime)+" seconds") + QgsMessageLog.logMessage("Fim comparação", "GeoRoad", level=0) + return intersec + + + + def new(self, layer=None, dados=None): + self.view.clear() + + isGeopckg=True if dados else False + dados = dados if dados else self.preview.new(lastIndex=len(self.model.listTables())+1) + self.model.iface=self.iface + if not dados is None: + filename, lyr, dist, estaca = dados + id_estaca, table = self.model.new(dist, estaca, lyr, filename) if not isGeopckg else self.model.newEmpty(Config.instance().DIST,filename) + self.elemento = id_estaca + self.model.id_filename = id_estaca + self.estacasHorizontalList=[] + + empty=True + for item in table: + self.view.fill_table(tuple(item)) + self.estacasHorizontalList.append(tuple(item)) + empty=False + + self.view.empty=empty + self.model.save(id_estaca) + self.updateTables() + Config.instance().store("DIST",dados[-2]) + + return self.model.getNewId() + + return False + + def perfilView(self): + tipo, class_project = self.model.tipo() + estacas=self.model.load_terreno_long() + self.perfil = Ui_Perfil(estacas, tipo, class_project, self.model.getGreide(self.model.id_filename), self.model.getCv(self.model.id_filename), iface=self) + self.perfil.save.connect(self.saveGreide) + self.perfil.reset.connect(self.cleanGreide) + self.perfil.showMaximized() + self.perfil.exec_() + + def saveGreide(self, noreset=False): + if self.model.id_filename == -1: return + self.model.table = self.perfil.getVertices() + self.model.cvData=self.perfil.getCurvas() + self.model.saveGreide(self.model.id_filename) + if not noreset: + self.perfil.justClose() + self.perfilView() + + def cleanGreide(self): + if self.model.id_filename == -1: return + self.model.cleanGreide(self.model.id_filename) + self.perfil.justClose() + self.perfilView() + + @nongui + def generateTransThread(self): + self.progressDialog.setText("Carregando dados.") + self.progressDialog.setValue(0) + prog, est, prism = self.model.getTrans(self.model.id_filename) + if prog: + #Database Trans + self.progressDialog.setValue(1) + self.trans=Ui_sessaoTipo(self.iface, est[1], self.model.load_intersect(), prog, est[0], prism=prism, greide=self.model.getGreide(self.model.id_filename), title="Transversal: "+str(self.model.getNameFromId(self.model.id_filename))) + else: + #New trans + self.progressDialog.setValue(1) + self.openEstaca(False) + terreno = self.obterTerrenoTIFF() + if not terreno: + return False, False, False + else: + prog=True + self.progressDialog.setValue(91) + intersect=self.model.load_intersect() + self.progressDialog.setValue(92) + if len(intersect)<=1: + self.generateIntersec(True) + self.progressDialog.setValue(93) + intersect = self.model.load_intersect() + self.progressDialog.setValue(95) + self.trans=Ui_sessaoTipo(self.iface, terreno, intersect, self.estacasVerticalList, greide=self.model.getGreide(self.model.id_filename), title="Transversal: "+str(self.model.getNameFromId(self.model.id_filename))) + + return prog, est, prism + + def generateTrans(self): + self.progressDialog.show() + prog, est, prism = self.generateTransThread() + if not prog: + self.progressDialog.close() + return + self.trans.save.connect(self.saveTrans) + self.trans.btnClean.clicked.connect(self.cleanTrans) + self.trans.plotar.connect(self.plotTransLayer) + self.progressDialog.close() + self.trans.btnExportDxf.clicked.connect(self.exportTrans) + self.trans.btnImportDxf.clicked.connect(self.importTrans) + self.trans.showMaximized() + self.trans.exec_() + self.raiseWindow(self.viewCv) + + def saveTrans(self): + if self.model.id_filename == -1: return + self.model.table = self.trans.getMatrixVertices() + self.model.xList = self.trans.getxList() + self.model.saveTrans(self.model.id_filename, self.trans.prismoide.getPrismoide()) + + def recalcular(self, curva=False): + msgLog("Recalculando") + self.view.comboBox.clear() + id=self.model.id_filename + if not curva: + dados = self.preview.new(True) + else: + dados = self.preview.new(True, layerName=self.view.curvaLayers[0].name(), ask=False) + + if dados is None: return + _, layer, dist, estaca = dados + layer = layer if not curva else self.view.curvaLayers[0] + msgLog("Usando Layer "+layer.name()) + table = self.model.recalcular(dist, estaca, layer, ask=not curva) + self.view.clear() + for item in table: + self.view.fill_table(tuple(item)) + self.model.id_filename=id + self.model.save(id) + if not curva: + self.geraCurvas(self.model.id_filename, recalcular=True) + msgLog("Calculando traçado para o Desenho") + + if not curva and len(self.view.curvaLayers)>0 and yesNoDialog(message="Foram detectadas curvas horizontais no traçado, deseja sobreescrever?"): + msgLog("Removendo layer e curvas") + curvas=Curvas(id_filename=self.model.id_filename) + curvas.erase() + self.model.removeGeoPackage(self.model.getNameFromId(self.model.id_filename)) + + def saveEstacas(self): + if self.model.id_filename == -1: return + estacas = self.view.get_estacas() + self.model.table = estacas + self.model.save(self.model.id_filename) + + def saveEstacasCSV(self): + filename = self.view.saveEstacasCSV() + if filename[0] in ["", None]: return + self.saveEstacas() + estacas = self.view.get_estacas() + self.model.table = estacas + self.model.saveCSV(filename) + + def deleteEstaca(self): + table=self.preview.tableEstacas + table : QtWidgets.QTableWidget + if len(table.selectionModel().selectedRows(0))==0: return + if not yesNoDialog(self.preview, title="Atenção", message="Tem certeza que deseja remover o arquivo?"): + return + indexes=[i.row() for i in table.selectionModel().selectedRows(0)] + if len(indexes)>1: + for i in indexes: + id=table.item(i,0).text() + self.model.deleteEstaca(id) + else: + self.model.deleteEstaca(self.model.id_filename) + curvaModel=Curvas(id_filename=self.model.id_filename) + curvaModel.erase() + self.update() + self.model.id_filename = -1 + self.click = False + + def curva(self): + curvas = self.model.getCurvas(self.model.id_filename) + vertices = [[v[1], p2QgsPoint(float(v[4]), float(v[3]))] for v in self.model.loadFilename() if v[1]!=""] + if len(self.view.curvaLayers)==0: + self.geraCurvas(self.model.id_filename) + if len(vertices)==0: + messageDialog("Erro!", msg="Você deve calcular uma tabela de tangentes primeiro!") + return + else: + curvaView = CurvasView(self.view, self.iface, self.model.id_filename,curvas, vertices,self.model.tipo()) + curvaView.setWindowFlags(QtCore.Qt.Dialog | QtCore.Qt.WindowSystemMenuHint | QtCore.Qt.WindowMinimizeButtonHint | QtCore.Qt.WindowCloseButtonHint) + curvaView.accepted.connect(self.raiseView) + curvaView.rejected.connect(self.raiseView) + curvaView.btnRecalcular.clicked.connect(self.recalcularCurvas) + curvaView.btnTable.clicked.connect(self.viewCurvaZoom) + self.curvaView=curvaView + self.view.showMinimized() + self.view.chview=curvaView + self.curvaView.show() + self.raiseWindow(self.curvaView) + + def recalcularCurvas(self): + self.recalcular(True) + self.curvaView.layer=self.view.curvaLayers[0] + + def viewCurvaZoom(self): + desc = "TS" if self.curvaView.comboElemento.currentIndex()>0 else "TC" + items=[self.view.comboBox.itemText(i) for i in range(self.view.comboBox.count())] + desc += "".join([str(c) for c in self.curvaView.comboCurva.currentText() if c.isdigit()]) + self.raiseView() + if desc in items: + row=0 + self.view.tableWidget.setRangeSelected(QTableWidgetSelectionRange(row, 1, row, 1), True) + self.view.tableWidget.setCurrentCell(row, 1) + self.view.comboBox.setCurrentIndex(items.index(desc)) + + def raiseView(self): + self.raiseWindow(self.view) + if hasattr(self.curvaView, "c"): + self.curvaView.c.rejected.emit() + + def raiseWindow(self, view): + view.setWindowState(view.windowState() & ~QtCore.Qt.WindowMinimized | QtCore.Qt.WindowActive) + view.activateWindow() + + def plotTransLayer(self, index): + self.progressDialog.show() + self.obterTerrenoTIFF(True, index) + self.progressDialog.close() + + + def obterTerrenoTIFF(self, plotTrans=False, index=-1): + if not plotTrans: + filename = self.view.openTIFF() + if filename in ['', None]: return + terreno=[] + + #progressBar=ProgressDialog(None) + #progressBar.show() + + try: + layer=None + if not plotTrans: + for l in self.iface.mapCanvas().layers(): + if l.source() == filename: + layer=l + if layer is None: + msgLog("Layer não encontrada") + return [] + msgLog("Interpolando Layer: "+str(layer.name())) + + estacas = self.estacas = self.model.load_intersect() + if not estacas: + if yesNoDialog(message="Você ainda não calculou a interseção das estacas! Quer que a seção transversal contenha somente estacas do perfil Horizontal?"): + estacas = self.estacas = self.view.get_estacas() + else: + return + # fazer multithreading ? + self.progressDialog.setValue(0) + self.progressDialog.setLoop(90, len(estacas)) + ri=RasterInterpolator() + for i, _ in enumerate(estacas): + if plotTrans and index !=-1: + i=index + + v=[] + az=float(estacas[i][7]) + perp=az+90 + + + if perp>360: + perp=perp-360 + + nsign=1 + esign=1 + if perp<90: + nsign=1 + esign=1 + elif perp<180: + nsign=-1 + esign=1 + elif perp<270: + nsign=-1 + esign=-1 + elif perp<360: + nsign=1 + esign=-1 + + pointsList=[] + + + NPONTOS=Config.instance().T_OFFSET + T_SPACING=Config.instance().T_SPACING + SPACING=T_SPACING/(NPONTOS-1) + interpol=Config.instance().interpol + for yi in range(int(-NPONTOS+1), int(NPONTOS)): + y=yi*SPACING + + yangleE=esign*y*abs(math.sin(perp*math.pi/180)) + yangleN=nsign*y*abs(math.cos(perp*math.pi/180)) + msgLog("Computando azimute transversal: "+str(perp)) + try: + xPoint=float(float(estacas[i][4])+yangleE) + yPoint=float(float(estacas[i][3])+yangleN) + + if not plotTrans: + cota = ri.cotaFromTiff(layer, QgsPointXY(xPoint, yPoint), interpol) + else: + cota=0 + v.append([y,float(cota)]) + pointsList.append([xPoint, yPoint]) + + except ValueError as e: + self.preview.error(u"GeoTIFF não compativel com a coordenada!!!") + msgLog(str(e)) + return False + except IndexError as e: + continue + + + self.progressDialog.increment() + terreno.append(v) + + + if plotTrans: + if index==-1: + self.drawPoints(pointsList, str(i+1)) + # for ind in range(len(pointsList)): + # self.drawPoint(pointsList[ind], str(i+1)) + if index==i: + self.drawPoints(pointsList, str(i+1)) + for ind in range(len(pointsList)): + self.drawPoint(pointsList[ind], str(i+1)) + return + + except e: + msgLog("Interpolação Falhou: "+str(e)) + terreno=[] + + + return terreno + + + def drawPoint(self, point, name): + layer = QgsVectorLayer("Point", name, "memory") + pr = layer.dataProvider() + ft = QgsFeature() + ft.setAttributes([1]) + ft.setGeometry(QgsGeometry.fromPointXY(QgsPointXY(point[0], point[1]))) + pr.addFeatures([ft]) + layer.setCrs(QgsProject.instance().crs()) + QgsProject.instance().addMapLayer(layer) + + def drawPoints(self, pointsList, name): + layer = QgsVectorLayer('LineString', name, "memory") + pr = layer.dataProvider() + poly = QgsFeature() + + points=[] + + for i, _ in enumerate(pointsList): + + point = QgsPointXY(float(pointsList[i][0]), float(pointsList[i][1])) + points.append(point) + + poly.setGeometry(QgsGeometry.fromPolylineXY(points)) + pr.addFeatures([poly]) + layer.updateExtents() + layer.setCrs(QgsProject.instance().crs()) + QgsProject.instance().addMapLayers([layer]) + + + + def newEstacasLayer(self, name): + fields=layerFields() + self.model.saveGeoPackage(name, [], fields, QgsWkbTypes.MultiCurveZ, 'GPKG') + + def saveEstacasLayer(self, estacas, name=None): + name =str(self.model.getNameFromId(self.model.id_filename)) if name==None else name + #path = QtWidgets.QFileDialog.getSaveFileName(self.iface.mainWindow(), "Caminho para salvar o traçado com as curvas", filter="Geopackage (*.gpkg)")[0] + #if not path: return None + + fields=layerFields() + points=[] + features=[] + j=0 + desc="T" + for i,_ in enumerate(estacas): + point = QgsPointXY(float(estacas[i][4]), float(estacas[i][3])) + ed=estacas[i][1] + if ed.startswith("P") or ed.startswith("CT") or ed.startswith("ST"): + desc="T" + elif ed.startswith("TS") or ed.startswith("CS"): + desc="S" + elif ed.startswith("SC") or ed.startswith("TC"): + desc="C" + if i==0: + points.append(point) + else: + if float(estacas[i][6]) != lastAz or i == len(estacas)-1: + points.append(point) + feat=QgsFeature(fields) + feat.setAttributes([desc, "Recalculado"]) + feat.setGeometry(QgsGeometry.fromPolylineXY(points)) + features.append(feat) + j+=1 + points=[point] + lastAz = float(estacas[i][6]) + + path=self.model.saveGeoPackage(name, features, fields, QgsWkbTypes.MultiCurveZ, 'GPKG') + self.view.openLayers() + refreshCanvas(self.iface) + + #CARREGAR NOVA LAYER: + # layer=self.iface.addVectorLayer(path,name,"ogr") + # self.iface.digitizeToolBar().show() + # self.iface.shapeDigitizeToolBar().show() + + # addLineAction = self.iface.digitizeToolBar().actions()[8] + # toggleEditAction = self.iface.digitizeToolBar().actions()[1] + # if not addLineAction.isChecked(): + # toggleEditAction.trigger() + # addLineAction.setChecked(True) + # addLineAction.trigger() + + # return layer + + + def drawEstacas(self, estacas): + layer = QgsVectorLayer('LineString?crs=%s'%(QgsProject.instance().crs().authid()), str(self.model.getNameFromId(self.model.id_filename)), "memory") + layer.setCrs(QgsCoordinateReferenceSystem(QgsProject.instance().crs())) + pr = layer.dataProvider() + poly = QgsFeature() + + points=[] + for i, _ in enumerate(estacas): + + point = QgsPointXY(float(estacas[i][4]), float(estacas[i][3])) + points.append(point) + + poly.setGeometry(QgsGeometry.fromPolylineXY(points)) + pr.addFeatures([poly]) + layer.updateExtents() + QgsProject.instance().addMapLayers([layer], False) + QgsProject.instance().layerTreeRoot().insertLayer(0, layer) + return layer + + + + def obterCotasTIFF(self): + + filename = self.view.openTIFF() + if filename in ['', None]: return + self.progressDialog.setText("Carregando cotas") + self.progressDialog.show() + + try: + l=False + for l in self.iface.mapCanvas().layers(): + if l.source() == filename: + layer=l + break + if not l: + self.preview.error(u"Salve a layer antes de usa-lá!") + return + from ..model.utils import RasterInterpolator + ri=RasterInterpolator() + self.estacas = self.view.get_estacas() + estacas = self.estacas + self.progressDialog.setLoop(100, len(estacas)) + + for i, _ in enumerate(estacas): + cota = ri.cotaFromTiff(layer, QgsPointXY(float(estacas[i][4]),float(estacas[i][3])), interpolate=Config.instance().interpol) + if cota>=0: + estacas[i][5] = roundFloat2str(cota) + else: + self.preview.error(u"Pontos do traçado estão fora do raster selecionado!!!") + break + self.progressDialog.increment() + + except Exception as e: + msgLog("TasterInterpolator failed with "+str(e)) + from osgeo import gdal + dataset = gdal.Open(filename, gdal.GA_ReadOnly) + for x in range(1, dataset.RasterCount + 1): + band = dataset.GetRasterBand(x) + img = band.ReadAsArray() + self.img_origem = dataset.GetGeoTransform()[0],dataset.GetGeoTransform()[3] + self.tamanho_pixel = abs(dataset.GetGeoTransform()[1]),abs(dataset.GetGeoTransform()[5]) + self.estacas = self.view.get_estacas() + estacas = self.estacas + + self.progressDialog.setValue(0) + self.progressDialog.setLoop(100, len(estacas)) + + for i, _ in enumerate(estacas): + self.progressDialog.increment() + try: + pixel = (int(abs(float(estacas[i][4]) - self.img_origem[0]) / self.tamanho_pixel[0]), + int(abs(float(estacas[i][3]) - self.img_origem[1]) / self.tamanho_pixel[1])) + estacas[i][5] = "%f" % img[pixel] + except Exception as e: + #self.drawEstacas(estacas) + self.preview.error(u"GeoTIFF não compativel com a coordenada!!!") + msgLog("Erro: "+str(e)) + break + + self.progressDialog.close() + self.model.table = estacas + self.model.save(self.model.id_filename) + self.openEstaca(False) + self.progressDialog.close() + + + + def obterCotasPC3(self): + + filename = self.view.openTIFF() + if filename in ['', None] or not filename.endswith('dxf'): return + self.estacas = self.view.get_estacas() + estacas = self.estacas + points = [] + # fazer multithreading + for i, _ in enumerate(estacas): + points.append((int("%d" % float(estacas[i][4])), int("%d" % float(estacas[i][3])))) + + dwg = dxfgrabber.readfile(filename, options={"assure_3d_coords": True}) + dxfversion = dwg.header['$ACADVER'] + all_points = [] + for entity in dwg.entities: + if entity.dxftype == 'POINT': + pe = "%d" % entity.point[0] + pn = "%d" % entity.point[1] + p = (int(pe), int(pn)) + if p in points: + all_points.append(p) + + for p in all_points: + ponto = points.index((int(p[0]), int(p[1]))) + estacas[ponto][5] = p[2] + # fix_print_with_import + print(estacas[ponto]) + # fix_print_with_import + print("terminou") + self.model.table = estacas + self.model.save(self.model.id_filename) + self.openEstaca() + + def elevate(self): + import ctypes, win32com.shell.shell, win32event, win32process + outpath = r'%s\%s.out' % (os.environ["TEMP"], os.path.basename(__file__)) + if ctypes.windll.shell32.IsUserAnAdmin(): + if os.path.isfile(outpath): + sys.stderr = sys.stdout = open(outpath, 'w', 0) + return + with open(outpath, 'w+', 0) as outfile: + hProc = \ + win32com.shell.shell.ShellExecuteEx(lpFile=sys.executable, lpVerb='runas', lpParameters=' '.join(sys.argv), + fMask=64, nShow=0)['hProcess'] + while True: + hr = win32event.WaitForSingleObject(hProc, 40) + while True: + line = outfile.readline() + if not line: break + sys.stdout.write(line) + if hr != 0x102: break + os.remove(outpath) + sys.stderr = '' + sys.exit(win32process.GetExitCodeProcess(hProc)) + + def obterCotasPC(self): + try: + import dxfgrabber + from sklearn.svm import SVR + from sklearn.neighbors import KNeighborsRegressor + from sklearn import linear_model + except: + import os + import re + if not re.match("win{1}.*", os.sys.platform) is None: + saida = os.system( + "C:\\Users\\%%USERNAME%%\\.qgis2\\python\\plugins\\TopoGrafia\\app\\controller\\install.bat") + else: + saida = os.system("sudo apt install python-pip&&pip install scikit-learn&&pip install dxfgrabber") + if saida != 0: + self.preview.error( + u"Para usar este recurso você deve instalar os pacotes abaixo:\nSKLearn e dxfgrabber: (Linux) 'sudo pip install scikit-learn&&pip install dxfgrabber' (Windows) Deve seguir o tutorial https://github.com/lennepkade/dzetsaka#installation-of-scikit-learn") + return + filename,_ = self.view.openDXF() + if filename in ['', None] or not (filename.endswith('dxf') or filename.endswith('DXF')): return + estacas = self.view.get_estacas() + dwg = dxfgrabber.readfile(filename, options={"assure_3d_coords": True}) + all_points = [] + all_points_Y = [] + inicial = (float(estacas[0][4]), float(estacas[0][3])) + az_inicial = float(estacas[0][6]) + for entity in dwg.entities: + if entity.dxftype == 'POINT': + dist = math.sqrt((inicial[0] - entity.point[0]) ** 2 + (inicial[1] - entity.point[1]) ** 2) + az = float(azimuth(p2QgsPoint(inicial[0], inicial[1]), p2QgsPoint(entity.point[0], entity.point[1]))) + all_points.append([entity.point[0], entity.point[1]]) + all_points_Y.append([entity.point[2]]) + + points = [] + for i, _ in enumerate(estacas): + points.append([float(estacas[i][4]), float(estacas[i][3])]) + X = all_points + y = all_points_Y + # clf = SVR(C=1.0, epsilon=0.2) + #clf = KNeighborsRegressor(n_neighbors=3) + itens = [u'KNN Regressão (Classico)',u'KNN Regressão (K Inteligente)',u'SVM',u'Regressão Linear'] + itens_func = [KNeighborsRegressor,KNN,SVR,linear_model.ARDRegression] + item, ok = QtWidgets.QInputDialog.getItem(None, "Selecione:", u"Selecione o método de predição:", + itens, + 0, False) + if not(ok) or not(item): + return None + + clf = itens_func[item.index(item)](5) + if itens.index(item) < 2: + k, ok = QtWidgets.QInputDialog.getInteger(None, "Escolha o valor de K", u"Valor de K:", 3, 2, 10000, 2) + if k<1 or not(ok): + return None + clf = itens_func[itens.index(item)](k) + #clf = KNN(5) + # clf = linear_model.LinearRegression() + # clf = linear_model.ARDRegression() + modelo = clf.fit(X, y) + pred = modelo.predict(points) + for i, predito in enumerate(pred): + estacas[i][5] = "%f" % predito + self.model.table = estacas + self.model.save(self.model.id_filename) + self.openEstaca() + + def obterCotas(self): + self.model.table = self.view.get_estacas() + crs = int(self.model.getCRS()) + for i, _ in enumerate(self.model.table): + try: + self.model.table[i][5] = u"%d" % getElevation(crs, p2QgsPoint(float(self.model.table[i][4]), + float(self.model.table[i][3]))) + if self.model.table[i][5] == 0: + return + except Exception as e: + # fix_print_with_import + print(e.message) + break + self.model.save(self.model.id_filename) + self.openEstaca() + + ''' + Metodos responsaveis por gerar o traçado de acordo com cliques na tela. + ''' + + def geraTracado(self,parte=0,pontos=None): + crs = self.model.getCRS() + self.preview.drawShapeFileAndLoad(crs) + + def get_click(self, point, mouse): + + if not self.edit: return + self.edit = False + # if mouse == 2: return + if mouse == 1: + self.preview.create_point(p2QgsPoint(point), 'vertice') + self.points.append(p2QgsPoint(point)) + + self.edit = True + + def get_click_coordenate(self, point, mouse): + + if not self.edit: return + self.edit = False + # if mouse == 2: return + if mouse == 1: + self.preview.create_point(p2QgsPoint(point), 'vertice') + self.points.append(p2QgsPoint(point)) + + self.edit = True + + def exit_dialog(self): + self.points.append(p2QgsPoint(self.points_end)) + self.iface.mapCanvas().setMapTool(QgsMapToolEmitPoint(self.iface.mapCanvas())) + self.edit = False + self.preview.exit_dialog(self.points, self.crs) + self.new() + self.view.show() + self.view.exec_() + + def gera_tracado_vertices(self, p1, p2, crs): + self.crs = crs + self.points = [p1] + self.edit = True + self.points_end = p2 + self.pointerEmitter = QgsMapToolEmitPoint(self.iface.mapCanvas()) + + self.pointerEmitter.canvasClicked.connect(self.get_click) + name_tracado = self.preview.gera_tracado_vertices(self.pointerEmitter) + self.preview.dialog.btnClose.clicked.connect(self.exit_dialog) + return name_tracado + + ''' + -------------------------------------------------- + ''' + + def openEstaca(self, display=True): + if self.model.id_filename == -1: return + self.view.clear() + estacas = self.model.loadFilename() + self.estacasHorizontalList=[] + for e in estacas: + self.view.fill_table(tuple(e), True) + self.estacasHorizontalList.append(tuple(e)) + if display: + self.nextView=self.view + self.view.setCopy() + self.updateTables() + + def openCv(self, recalcular = False): + estacas=self.model.load_verticais() + if recalcular or not estacas: + self.progressDialog.show() + estacas=self.generateVerticaisThread() + self.progressDialog.close() + + if not estacas: + return + self.estacasVerticalList = estacas + self.viewCv.clear() + self.viewCv.setCv() + + for e in estacas: + self.viewCv.fill_table(tuple(e), True) + try: + self.viewCv.btnGen.clicked.disconnect() + except: + pass + self.viewCv.btnGen.clicked.connect(self.generateIntersec) + self.nextView = self.viewCv + + @nongui + def generateVerticaisThread(self): + self.progressDialog.setText("Calculando estacas do greide no perfil vertical") + self.openEstaca() + self.viewCv.clear() + self.viewCv.setWindowTitle(str(self.model.getNameFromId(self.model.id_filename))+": Verticais") + try: + tipo, class_project = self.model.tipo() + estacas = self.model.load_terreno_long() + self.perfil = Ui_Perfil(estacas, tipo, class_project, self.model.getGreide(self.model.id_filename), self.model.getCv(self.model.id_filename), iface=self) + except Exception as e: + import traceback + messageDialog(None, title="Erro!", message="Perfil Vertical ainda não foi definido!") + msgLog("Falha ao identificar Greide") + msgLog(str(traceback.format_exception(None, e, e.__traceback__))[1:-1]) + return + # self.perfilView() + # self.perfil = Ui_Perfil(self.view, tipo, class_project, self.model.getGreide(self.model.id_filename), self.model.getCv(self.model.id_filename)) + + estacas=[] + (estaca,descricao,progressiva,cota) = (0, "V0", 0, self.perfil.getVertices()[0][1]) + estacas.append((estaca,descricao,progressiva,cota)) + missingCurveDialog=[] + y=float(cota) + points=[] + + LH=len(self.perfil.roi.handles)-1 + self.progressDialog.setLoop(30, LH) + for i in range(1, LH): + self.progressDialog.increment() + i1=self.perfil.roi.getSegIncl(i-1,i) + i2=self.perfil.roi.getSegIncl(i,i+1) + L=0 + if self.perfil.cvList[i][1] != "None": + L=float(self.perfil.cvList[i][1]) + + pontosCv=CV(i1, i2, L, self.perfil.roi.getHandlePos(i), self.perfil.roi.getHandlePos(i-1)) + points.append({"cv": pontosCv, "i1": i1/100, "i2": i2/100, "L": L, "i": i}) + + if len(points)==0: + self.progressDialog.close() + messageDialog(None, title="Erro!", message="Perfil Vertical ainda não foi definido!") + msgLog("len(points)==0") + return None + + x=0 + i=points[0]["i1"] + s=0 + c=1 + fpcv=0 + fptv=0 + est=1 + dist=Config.instance().DIST + LH=int(self.perfil.roi.getHandlePos(self.perfil.roi.countHandles() - 1).x() / dist) + skip=False + self.progressDialog.setLoop(80,LH) + while est <= LH: + self.progressDialog.increment() + if fptv: + dx=dist-dx + dy=point["i2"]*dx + fptv=0 + + elif fpcv: + dx=dist-dx + dy=point["i1"]*dx + fpcv=0 + else: + dx=dist + dy=i*dx + + desc="" + + if len(points)>0: + point=points[0] + + try: + pt=x+dx>=point["cv"].xptv + pv=x+dx>=point["cv"].xpcv and not pt and not s + + except AttributeError: + point["cv"].xptv=point["cv"].handlePos.x() + point["cv"].xpcv=point["cv"].handlePos.x() + point["cv"].ypcv=point["cv"].handlePos.y() + point["cv"].yptv=point["cv"].handlePos.y() + + missingCurveDialog.append(c) + + pt=x+dx>=point["cv"].xptv + pv=x+dx>=point["cv"].xpcv and not pt and not s + + i=points[0]["i1"] + else: + pt=False + pv=False + i=point["cv"].i2/100 + + if(pv): + #estacas.append(("debug",point["i"],point["i1"],point["cv"].ypcv)) + dx=point["cv"].xpcv-x + desc="PCV"+str(c) + s=1 + dy=point["cv"].ypcv-y + est-=1 + fpcv=1 + + elif(pt): + dx=point["cv"].xptv-x + + if point["cv"].xptv == point["cv"].handlePos.x(): + desc="PV"+str(c) + else: + desc="PTV"+str(c) + + s=0 + dy=point["cv"].yptv-y + est-=1 + points.pop(0) + fptv=1 + c+=1 + + x+=dx + if s and not (pv or pt): + dy=point["cv"].getCota(x)-y + y+=dy + + if skip: + skip = False + est+=1 + continue + + if dx==dist and (pv or pt): + (estaca,descricao,progressiva,cota) = ( + str(est+1), + desc, + x, + y + ) + skip=True + else: + (estaca, descricao, progressiva, cota) = ( + est if not (pv or pt) else str(est) + ' + ' + roundFloat2str(dx), + desc, + x, + y + ) + + estacas.append((estaca,descricao,progressiva,cota)) + est+=1 + + if len(missingCurveDialog) > 0: + messageDialog(self.viewCv, "Atenção!", message="Nenhum comprimento de curva foi definido no perfil vertical para os vértices: " + str(missingCurveDialog)[1:-1]) + dx=float(self.perfil.getVertices()[-1:][0][0])-x + x+=dx + dy=float(self.perfil.getVertices()[-1:][0][1])-y + y+=dy + + (estaca,descricao,progressiva,cota) = (str(est-1)+' + ' + str(dx),"V"+str(c+1),x,y) + estacas.append((estaca,descricao,progressiva,cota)) + + self.model.saveVerticais(estacas) + return estacas + + + + def itemClickTableEstacas(self, item=None): + self.click = True + if item is None: + self.preview.tableEstacas: QtWidgets.QTableWidget + item=self.preview.tableEstacas.currentItem() + try: + ident = int(self.preview.tableEstacas.item(item.row(), 0).text()) + self.model.id_filename = ident + except: + pass + + def openEstacaCSV(self): + self.view.clear() + res = self.preview.openCSV() + if not res: + return + file=res[0] + if file[0] in ['', None] or res[1] in ['', None] or not (file[0].endswith('csv')): return + filename, fileDB = file[0], res[1] + estacas = self.model.openCSV(filename, fileDB) + self.model.table = estacas + self.elemento = self.model.ultimo + for estaca in estacas: + self.view.fill_table(tuple(estaca), True) + self.view.setCopy() + self.model.save(self.elemento) + + def plotar(self): + self.drawEstacas(self.view.get_estacas()) + #self.view.plotar() + + def update(self): + files = self.model.listTables() + self.preview.fill_table_index(files) + self.preview.checkButtons() + self.view.clear() + self.view.clearLayers() + refreshCanvas(self.iface) + + def updateTables(self): + try: + self.view.setWindowTitle(self.model.getNameFromId(self.model.id_filename)+": Horizontal") + except: + pass + + def run(self): + # from ..view.estacas import SelectFeatureDialog + # s=SelectFeatureDialog(self.iface,self.iface.mapCanvas().layer(0).getFeatures()) + # s.exec_() + self.update() + self.click = False + self.preview.setWindowTitle(Config.instance().FILE_PATH) + self.preview.show() + + finalResult=False + result = True + + lastFinalResult=True + lastResult=False + + + while finalResult>0 or result>0: + self.update() + result = self.preview.exec_() + self.nextView.resize(self.nextView.width(), self.nextView.height()+1) + if result: + self.preview.close() + self.nextView.show() + finalResult = self.nextView.exec_() + + if lastResult == result: + lastResult = not result + + elif lastFinalResult == finalResult: + lastFinalResult = not finalResult + + else: + lastFinalResult=finalResult + lastResult=result + + for d in DIALOGS_TO_CLOSE_ON_LOOP: + if hasattr(self, d): + getattr(self, d).close() diff --git a/app/controller/install.bat b/app/controller/install.bat old mode 100644 new mode 100755 index 9da7b03..dada9a6 --- a/app/controller/install.bat +++ b/app/controller/install.bat @@ -1,7 +1,7 @@ -cd c:\PROGRA~1\QGIS2~1.18\apps\Python27\Scripts\ -set PYTHONPATH=c:\PROGRA~1\QGIS2~1.18\apps\Python27\Lib -set PYTHONHOME=c:\PROGRA~1\QGIS2~1.18\apps\Python27 -c:\PROGRA~1\QGIS2~1.18\bin\python.exe pip.exe install dxfgrabber -c:\PROGRA~1\QGIS2~1.18\bin\python.exe pip.exe install scikit-learn - -pause +cd c:\PROGRA~1\QGIS2~1.18\apps\Python27\Scripts\ +set PYTHONPATH=c:\PROGRA~1\QGIS2~1.18\apps\Python27\Lib +set PYTHONHOME=c:\PROGRA~1\QGIS2~1.18\apps\Python27 +c:\PROGRA~1\QGIS2~1.18\bin\python.exe pip.exe install dxfgrabber +c:\PROGRA~1\QGIS2~1.18\bin\python.exe pip.exe install scikit-learn + +pause diff --git a/app/controller/perfil.py b/app/controller/perfil.py old mode 100644 new mode 100755 index 5f3d9d5..232ec6f --- a/app/controller/perfil.py +++ b/app/controller/perfil.py @@ -1,2085 +1,2085 @@ -from __future__ import absolute_import - -import functools -from builtins import zip - -import numpy as np -from PyQt5.QtCore import QPointF, QThread -from qgis.PyQt import QtGui -from copy import deepcopy - -from ..model.helper.calculos import vmedia, fmax -from ..model import constants -from ..model.utils import * -from ..view.estacas import cvEdit, closeDialog, rampaDialog, QgsMessageLog, ApplyTransDialog, SetCtAtiDialog, \ - setEscalaDialog, brucknerRampaDialog, ssRampaDialog, VolumeDialog -from ... import PyQtGraph as pg - -# -*- coding: utf-8 -*- - - -############################################################################################################## -#TODO: - -#Features to ADD -#ctrl+Z utility -#add menu interface and grid and printing scale export - -############################################################################################################## - - - -try: - _fromUtf8 = QtCore.QString.fromUtf8 -except AttributeError: - def _fromUtf8(s): - return s - -try: - _encoding = QtWidgets.QApplication.UnicodeUTF8 - def _translate(context, text, disambig): - return QtWidgets.QApplication.translate(context, text, disambig, _encoding) -except AttributeError: - def _translate(context, text, disambig): - return QtWidgets.QApplication.translate(context, text, disambig) - -class CustomViewBox(pg.ViewBox): - def __init__(self, *args, **kwds): - pg.ViewBox.__init__(self, *args, **kwds) - self.setMouseMode(self.PanMode) - - ## reimplement mid-click to zoom out - def mouseClickEvent(self, ev): - if ev.button() == QtCore.Qt.MidButton: - self.autoRange() - - def mouseDragEvent(self, ev): - if ev.button() == QtCore.Qt.LeftButton: - ev.ignore() - else: - pg.ViewBox.mouseDragEvent(self, ev) - -PREC = 5 #draw precision in meters - -class cv(): - - def __init__(self, i1, i2, L,handlePos, lastHandlePos): - - self.i1=i1 - self.i2=i2 - self.G=(i1-i2)/100 - self.L=L - self.lastHandlePos=lastHandlePos - self.handlePos=handlePos - self.curve=pg.PlotCurveItem() - self.update(i1,i2,L,handlePos, lastHandlePos) - - - def update(self, i1, i2, L,handlePos, lastHandlePos): - if L!=0: - self.i1=i1 - self.i2=i2 - self.G=(i1-i2)/100 - self.L=L - - G=self.G - i1=self.i1/100 - L=self.L - xpcv=handlePos.x()-L/2 - ypcv=lastHandlePos.y()+i1*(xpcv-lastHandlePos.x()) - - x=[] - - for n in range(0,int(L/PREC)+1): - x.append(n*PREC) - - x=np.array(x) - y=(-G/(2*L))*x*x+i1*x+ypcv - - - x=[] - for n in range(0,int(L/PREC)+1): - x.append(n*PREC+xpcv) - - - self.xpcv=xpcv - self.ypcv=ypcv - self.xptv=xpcv+L - self.yptv=self.getCota(self.xptv) - self.x=x - self.y=y - - self.curve.clear() - - - self.curve.setData(x,y,pen=pg.mkPen('r', width=3, style=QtCore.Qt.DashLine)) - - - else: - self.L=0 - - - def getCota(self, x): - return False if x < self.xpcv or x > self.xptv else (-self.G/(2*self.L))*(x-self.xpcv)**2+self.i1*(x-self.xpcv)/100+self.ypcv - - - -class cvEditDialog(cvEdit): - - def __init__(self,roi, i): - super(cvEditDialog, self).__init__(None) -# self.addCurveBtn.clicked.connect(self.raiseCurveGroupeBox) - # self.setupUi(self) - self.isBeingModified=False - self.i=i - self.initialHandlesPos = [] - self.i1=0 - self.i2=0 - self.G=0 - self.Lutilizado=0 - - self.roi=roi - estacas=self.roi.perfil.iface.view.get_estacas() - est=[] - for linha in estacas: - est.append(linha[0]) - self.estacas=est - - self.cota=self.getHandlePos(i).y() - self.horizontal=self.getHandlePos(i).x() - - self.updateCota() - self.uicota.returnPressed.connect(self.updateCota) - self.uihorizontal1.returnPressed.connect(self.updateAbscissa1) - self.uihorizontal1.returnPressed.connect(self.updateAbscissa2) - - self.okBtn.clicked.connect(self.save) - self.cancelBtn.clicked.connect(self.reset) - - #set readonly textEdits - - for j in range(0,roi.countHandles()): - self.initialHandlesPos.append(self.getHandlePos(j)) - - self.handle=self.roi.handles[i]['item'] - - #checking curve existence - - try: - self.Lutilizado=self.handle.curve.L - self.groupBox_2.setEnabled(True) - except AttributeError: - self.handle.curve = cv(self.i1, self.i2, 0, self.handle.pos(), self.getHandlePos(i-1)) - - self.initialCurve = cv(self.handle.curve.i1, self.handle.curve.i2, self.handle.curve.L, self.handle.curve.handlePos, self.handle.curve.lastHandlePos) - self.uiLutilizado.valueChanged.connect(self.updateL) - self.addCurveBtn.clicked.connect(self.updateL) - - self.uicota1.setText(shortFloat2String(self.getHandlePos(i-1).y())) - self.uicota2.setText(shortFloat2String(self.getHandlePos(i+1).y())) - - self.setupValidators() - self.redefineUI(-10) - self.updateVerticesCb() - -# self.helpBtn.clicked.connect(self.displayHelp) - self.viewCurveBtn.clicked.connect(self.viewCurva) - - self.shortcut1 = QtWidgets.QShortcut(QtGui.QKeySequence.MoveToNextChar, self) - self.shortcut2 = QtWidgets.QShortcut(QtGui.QKeySequence.MoveToPreviousChar, self) - self.shortcut1.activated.connect(self.nextVertex) - self.shortcut2.activated.connect(self.previousVertex) - self.velproj.valueChanged.connect(lambda: self.redefineUI(self.elm)) - self.generateAll.clicked.connect(self.generateAllC) - - self.generateAll.hide() - - def generateAllC(self): - self.verticeCb.setCurrentIndex(1) - while self.nextBtn.isEnabled(): - self.updateL() - self.nextVertex() - self.updateL() - - - def nextVertex(self): - if self.nextBtn.isEnabled(): - self.next() - - def previousVertex(self): - if self.previousBtn.isEnabled(): - self.previous() - - def viewCurva(self): - center=self.getHandlePos(self.i) - self.roi.perfil.vb.scaleBy((.5,.5),center) - - def displayHelp(self): - dialog=imgDialog(imagepath="../view/ui/helpCV.png", title="Ajuda: Curvas Verticais") - dialog.show() - dialog.exec_() - - - def setupValidators(self): - self.uicota.setValidator(QtGui.QDoubleValidator()) - self.uihorizontal1.setValidator(QtGui.QDoubleValidator()) - self.uihorizontal2.setValidator(QtGui.QDoubleValidator()) - - self.uiL.setValidator(QtGui.QDoubleValidator()) - - - def raiseCurveGroupeBox(self): - self.groupBox_2.setEnabled(True) - - def save(self): - self.redefineUI(-1) - self.close() - - def reset(self): - j=0 - for pos in self.initialHandlesPos: - self.roi.handles[j]["item"].setPos(pos) - j+=1 - self.handle.curve.curve.clear() - self.handle.curve=self.initialCurve - self.uiL.setText(str(self.handle.curve.L)) - - self.roi.plotWidget.addItem(self.handle.curve.curve) - self.close() - - - def getHandlePos(self, i): - return self.roi.handles[i]['item'].pos() - - - def getSegIncl(self, i, j): - try: - return round(100*(self.getHandlePos(j).y()-self.getHandlePos(i).y())/(self.getHandlePos(j).x()-self.getHandlePos(i).x()), 4) - except IndexError: - return None - - - def updateCota(self): - try: - if not self.isBeingModified: - self.cota=float(self.uicota.text()) - self.update() - self.redefineUI(3) - - except ValueError: - pass - - - def updateAbscissa1(self): - try: - if not self.isBeingModified: - self.horizontal=float(self.uihorizontal1.text())+self.getHandlePos(self.i-1).x() - self.update() - self.redefineUI(4) - self.updateVerticesCb() - - - except ValueError: - pass - - - def updateAbscissa2(self): - try: - if not self.isBeingModified: - self.horizontal=-float(self.uihorizontal2.text())+self.getHandlePos(self.i+1).x() - self.update() - self.redefineUI(4) - - except ValueError: - pass - - - def updateL(self): - try: - if not self.isBeingModified: - self.Lutilizado=float(self.uiLutilizado.value()) - self.uif.setText(('{:0.6e}'.format(self.G / (100*2 * float(self.Lutilizado))))) - self.handle.curve.update(self.i1, self.i2, self.Lutilizado,self.getHandlePos(self.i), self.getHandlePos(self.i-1)) - self.roi.plotWidget.addItem(self.handle.curve.curve) - self.updateAlert() - except ValueError: - pass - - - def update(self): - self.roi.handles[self.i]["item"].setPos(self.horizontal, self.cota) - self.updateAlert() - - def redefineUI(self, elm): - self.elm=elm - self.isBeingModified=True - i=self.i - roi=self.roi - self.groupBox_2.setTitle("Curva Vertical: "+str(i)) - - if i>=roi.countHandles()-1 or i==0: - self.removeCv() - else: - self.i1=self.getSegIncl(i-1,i) - self.i2=self.getSegIncl(i,i+1) - self.G=self.i1-self.i2 - - self.horizontal1=self.horizontal-self.getHandlePos(i-1).x() - self.horizontal2=self.getHandlePos(i+1).x()-self.horizontal - self.uihorizontal1.setText(shortFloat2String(self.horizontal1)) - self.uihorizontal2.setText(shortFloat2String(self.horizontal2)) - self.uii1.setText(shortFloat2String(self.i1)) - self.uii2.setText(shortFloat2String(self.i2)) - self.uiG.setText(shortFloat2String(self.G)) - self.uicota.setText(shortFloat2String(self.cota)) - - concave=False - if self.G < 0: - self.uiCurveType.setText("Côncava") - concave=True - else: - self.uiCurveType.setText("Convexa") - - g=self.G - - if self.velproj.value()==0: - v=velproj = Config.instance().velproj - else: - v=velproj=self.velproj.value() - - self.roi.perfil.calcularGreide() - vv = self.roi.perfil.velProj - - self.velproj.setValue(v) - Kmin = velproj**2/(1296*9.8*1.5/100) #constants.Kmin[min(max(30,(round(velproj/10)*10)),120)][self.G>0] - Kdes=constants.Kdes[min(max(30,(round(velproj/10)*10)),120)][self.G>0] - fmax = constants.f[min(max(30,(round(velproj/10)*10)),120)] - #dp=0.7*vmedia(v)+vmedia(v)**2/(255*(fmax)) - dp=0.7*v+v**2/(255*(fmax)) - self.uiDp.setText(shortFloat2String(dp)) - - self.uiLutilizado : QtWidgets.QDoubleSpinBox - self.uiLutilizado.setSingleStep(Config.instance().DIST) - l1=0 - l2=0 - msgLog("Curva: "+str(self.i)) - msgLog("v: " + str(velproj)) - msgLog("kmin: " + str(Kmin)) - if not concave: - l1=max(0,abs(self.G)*dp**2/412) - msgLog("G: "+str(self.G)) - msgLog("dp: " + str(dp)) - l2=max(0,2*dp-412/abs(self.G)) - else: - l1=max(0,abs(self.G)*dp**2/(122+3.5*dp)) - l2=max(0,2*dp-(122+3.5*dp)/abs(self.G)) - - self.lmin1 : QtWidgets.QLabel - self.lmin2 : QtWidgets.QLabel - - self.lmin1.setText(shortFloat2String(l1)) - self.lmin2.setText(shortFloat2String(l2)) - lsmin= l1 if l1>=dp else l2 - - if self.Lutilizado==0: - dist=Config.instance().DIST - self.Lutilizado=max(.6*v, Kmin*abs(g), lsmin) - self.Lutilizado=self.Lutilizado+dist-self.Lutilizado % dist - - self.uif.setText(('{:0.6e}'.format(self.G/(100*2*float(self.Lutilizado))))) - self.uiLmin.setText(shortFloat2String(Kmin*abs(g))) - - self.uiLutilizado.setValue(self.Lutilizado) - self.uiL.setText(shortFloat2String(velproj*.6)) - self.uiff.setText(shortFloat2String(fmax)) - - self.isBeingModified = False - - self.roi.update() - - txt="Cota" - self.cotaLabel_6.setText(txt+" V"+str(i-1)+ ":") - self.cotaLabel.setText(txt+" V"+str(i)+":") - self.cotaLabel_8.setText(txt+" V"+str(i+1)+":") - - txt="Horizontal" - self.label_9.setText(txt + " V"+str(i-1) + "-" + "V"+str(i)+":") - self.label_12.setText(txt + " V"+str(i) + "-" + "V"+str(i+1)+":") - - self.updateAlert() - - - def updateAlert(self): - vv = self.roi.perfil.velProj - if self.velproj.value()==0: - v=Config.instance().velproj - else: - v=self.velproj.value() - try: - self.uiAlertaLb: QtWidgets.QLabel - if v > vv: - self.uiAlertaLb2.setText("Alerta: "+roundFloat2str(v) + ">" + roundFloat2str(vv) + "!") - self.uiAlertaLb2.setToolTip( - "A velocidade de projeto configurada é maior que a recomendada para esse perfil") - else: - self.uiAlertaLb2.setText("") - self.uiAlertaLb2.setToolTip("") - - if self.getHandlePos(self.i).x() + self.Lutilizado / 2 > self.getHandlePos(self.i + 1).x() - self.roi.handles[self.i + 1]['item'].curve.L / 2 or self.getHandlePos( - self.i).x() - self.Lutilizado / 2 < self.getHandlePos(self.i - 1).x() + self.roi.handles[self.i - 1][ - 'item'].curve.L / 2: - self.uiAlertaLb.setText("Alerta: Sobreposição de curvas!") - self.uiAlertaLb.setToolTip("") - else: - self.uiAlertaLb.setText("") - self.uiAlertaLb.setToolTip("") - - except: - msgLog("Falha ao mostrar alertas") - - - def updateVerticesCb(self): - - self.verticeCb: QtWidgets.QComboBox - self.verticeCb.clear() - for i in range(1, len(self.roi.handles)): - self.verticeCb.addItem(str(i-1)) - - try: - self.verticeCb.currentIndexChanged.disconnect() - self.nextBtn.clicked.disconnect() - self.previousBtn.clicked.disconnect() - except: - pass - - self.verticeCb.setCurrentIndex(self.i) - self.verticeCb.currentIndexChanged.connect(self.changeVertice) - self.nextBtn.clicked.connect(self.next) - self.previousBtn.clicked.connect(self.previous) - - if self.i==1: - self.previousBtn.setEnabled(False) - else: - self.previousBtn.setEnabled(True) - - if self.i==i-1: - self.nextBtn.setEnabled(False) - else: - self.nextBtn.setEnabled(True) - - def changeVertice(self, i): - if i<=0: - i=self.i - elif i>=len(self.roi.handles)-1: - i=self.i - - self.save() - c=cvEditDialog(self.roi, i) - c.move(self.x(),self.y()) - c.show() - c.exec_() - - - def next(self): - self.verticeCb.setCurrentIndex(self.i+1) - - def previous(self): - self.verticeCb.setCurrentIndex(self.i-1) - - - - - -class CustomPolyLineROI(pg.PolyLineROI): - wasModified=QtCore.pyqtSignal() - modified=QtCore.pyqtSignal(object) - - def __init__(self, *args, **kwds): - self.wasInitialized=False - self.labels=[] - self.setPlotWidget(kwds.get('plot', False)) - pg.PolyLineROI.__init__(self,*args,**kwds) - self.ismodifying=False - - def setPlotWidget(self, plotWidget): - if plotWidget: - self.plotWidget = plotWidget - - def HandleEditDialog(self, i): - dialog=cvEditDialog(self, i) - dialog.show() - dialog.exec_() - self.sigRegionChangeFinished.emit(self) - self.modified.emit(self) - - - def mouseClickEvent(self, ev): - - if ev.button() == QtCore.Qt.RightButton and self.isMoving: - self.modified.emit(self) - ev.accept() - self.cancelMove() - - self.wasModified.emit() - ev.accept() - self.modified.emit(self) - self.sigClicked.emit(self, ev) - - - def setPoints(self, points, closed=None): - self.wasInitialized=False - QgsMessageLog.logMessage("Iniciando pontos do perfil", "GeoRoad", level=0) - if closed is not None: - self.closed = closed - self.clearPoints() - - for i,p in enumerate(points): - self.addRotateFreeHandle(p, p) - - start = -1 if self.closed else 0 - - self.handles[0]['item'].sigEditRequest.connect(lambda: self.HandleEditDialog(0)) - self.handles[0]['item'].fixedOnX=True - self.handles[0]['item'].edge=True - - for i in range(start, len(self.handles)-1): - self.addSegment(self.handles[i]['item'], self.handles[i+1]['item']) - j=i+1 - self.handles[j]['item'].sigEditRequest.connect(functools.partial(self.HandleEditDialog, j)) - - self.handles[j]['item'].fixedOnX=True - self.handles[j]['item'].edge=True - - self.wasInitialized=True - self.updateHandles() - - def removeLabel(self, i): - for text in self.labels[i+1:]: - try: - self.plotWidget.removeItem(text) - except: - pass - - - def updateLabel(self, handle, i): - msg="V" + str(i-1) - i=i-1 - text: pg.TextItem - if i>=len(self.labels): - text = pg.TextItem(msg) - else: - text=self.labels[i] - text.setText(msg) - text.setPos(handle.pos().x(), handle.pos().y()) - text.setAnchor((0.5, 1)) - if i>=len(self.labels): - self.plotWidget.addItem(text) - self.labels.append(text) - - - - def updateHandles(self): - if self.wasInitialized: - for i in range(0, len(self.handles)-1): - - try: - self.handles[i]['item'].sigEditRequest.disconnect() - except: - pass - - handle=self.handles[0]['item'] - handle.sigEditRequest.connect(lambda: self.HandleEditDialog(0)) - start = -1 if self.closed else 0 - self.updateLabel(handle, 1) - - for i in range(start, len(self.handles)-1): - j=i+1 - handle=self.handles[j]['item'] - handle.sigEditRequest.connect(functools.partial(self.HandleEditDialog, j)) - self.updateLabel(handle, j+1) - - try: - diag=cvEditDialog(self, j) - diag.reset() - except: - pass - self.removeLabel(len(self.handles)-1) - pg.QtGui.QGuiApplication.processEvents() - self.wasInitialized=True - - def removeCurva(self, handle): - if hasattr(handle, "curve"): - self.plotWidget.removeItem(handle.curve.curve) - handle.curve.curve.clear() - - self.removeHandle(handle) - self.update() - - - def addHandle(self, info, index=None): - h = pg.ROI.addHandle(self, info, index=index) - h.sigRemoveRequested.connect(self.removeHandle) - self.stateChanged(finish=True) - self.wasInitialized=True - self.updateHandles() - return h - - - def countHandles(self): - return len(self.handles) - - - def segmentClicked(self, segment, ev=None, pos=None): ## pos should be in this item's coordinate system - if ev != None: - pos = segment.mapToParent(ev.pos()) - elif pos != None: - pos = pos - else: - raise Exception("Either an event or a position must be given.") - if ev.button() == QtCore.Qt.RightButton: - i = self.segments.index(segment) - d = rampaDialog(self, segment, pos, i+2) - self.ismodifying=True - d.exec_() - self.ismodifying=False - self.wasModified.emit() - self.sigRegionChangeFinished.emit(self) - - elif ev.button() == QtCore.Qt.LeftButton: - h1 = segment.handles[0]['item'] - h2 = segment.handles[1]['item'] - i = self.segments.index(segment) - h3 = self.addFreeHandle(pos, index=self.indexOfHandle(h2)) - self.addSegment(h3, h2, index=i+1) - segment.replaceHandle(h2, h3) - self.wasModified.emit() - self.sigRegionChangeFinished.emit(self) - - - def getHandlePos(self, i): - return self.handles[i]['item'].pos() - - - def getVerticesList(self): - l=[] - for i in range(0,len(self.handles)): - p=self.getHandlePos(i) - l.append([p.x(),p.y()]) - - return l - - - def getYfromX(self,x): - for i in range(0,self.countHandles()-2): - h=self.handles[i]["item"].pos() - nh=self.handles[1+i]["item"].pos() - if h.x() <= x and nh.x() >= x: - return (nh.y()-h.y())/(nh.x()-h.x())*(x-h.x())+h.y() - raise ValueError - - - - def getSegIncl(self, i, j): - try: - return round(100*(self.getHandlePos(j).y()-self.getHandlePos(i).y())/(self.getHandlePos(j).x()-self.getHandlePos(i).x()), 4) - except IndexError: - return None - - def addCvs(self, cvList): - - if (cvList == False or len(cvList) <= 2): - - for i in range(0, len(self.handles) - 1): - i1 = self.getSegIncl(i - 1, i) - i2 = self.getSegIncl(i, i + 1) - L = 0 - self.handles[i]['item'].curve = cv(i1, i2, L, self.getHandlePos(i), self.getHandlePos(i - 1)) - self.handles[i]['item'].sigRemoveRequested.disconnect() - self.handles[i]['item'].sigRemoveRequested.connect(self.removeCurva) - self.plotWidget.addItem(self.handles[i]['item'].curve.curve) - - return - - for i in range(0, len(self.handles) - 1): - if cvList[i][1] != "None": - i1 = self.getSegIncl(i - 1, i) - i2 = self.getSegIncl(i, i + 1) - L = float(cvList[i][1]) - self.handles[i]['item'].curve = cv(i1, i2, L, self.getHandlePos(i), self.getHandlePos(i - 1)) - self.handles[i]['item'].sigRemoveRequested.disconnect() - self.handles[i]['item'].sigRemoveRequested.connect(self.removeCurva) - self.plotWidget.addItem(self.handles[i]['item'].curve.curve) - else: - - i1 = self.getSegIncl(i - 1, i) - i2 = self.getSegIncl(i, i + 1) - L = 0 - self.handles[i]['item'].curve = cv(i1, i2, L, self.getHandlePos(i), self.getHandlePos(i - 1)) - self.handles[i]['item'].sigRemoveRequested.disconnect() - self.handles[i]['item'].sigRemoveRequested.connect(self.removeCurva) - self.plotWidget.addItem(self.handles[i]['item'].curve.curve) - - - def update(self): - try: - for i in range(0, len(self.handles)-1): - i1=self.getSegIncl(i-1,i) - i2=self.getSegIncl(i,i+1) - L=self.handles[i]['item'].curve.L - #self.handles[i]['item'].curve.curve.clear() - #self.handles[i]['item'].curve=cv(i1, i2, L,self.getHandlePos(i), self.getHandlePos(i-1)) - self.handles[i]['item'].curve.update(i1, i2, L,self.getHandlePos(i), self.getHandlePos(i-1)) - #self.plotWidget.addItem(self.handles[i]['item'].curve.curve) - except: - pass - - - def removeRect(self, handle): - try: - self.plotWidget.removeItem(handle.leg1) - self.plotWidget.removeItem(handle.leg2) - self.plotWidget.removeItem(handle.rect1) - self.plotWidget.removeItem(handle.rect2) - except: - pass - pg.QtGui.QGuiApplication.processEvents() - - -class ssRoi(CustomPolyLineROI): - wasModified=QtCore.pyqtSignal() - modified=QtCore.pyqtSignal(object) - - def __init__(self, *args, **kwds): - super(ssRoi, self).__init__(*args, **kwds) - self.cota=kwds["cota"] - - def segmentClicked(self, segment, ev=None, pos=None): ## pos should be in this item's coordinate system - if ev != None: - pos = segment.mapToParent(ev.pos()) - elif pos != None: - pos = pos - else: - raise Exception("Either an event or a position must be given.") - if ev.button() == QtCore.Qt.RightButton: - d = ssRampaDialog(self, segment, pos, self.cota) - d.exec_() - self.wasModified.emit() - self.sigRegionChangeFinished.emit(self) - - elif ev.button() == QtCore.Qt.LeftButton: - h1 = segment.handles[0]['item'] - h2 = segment.handles[1]['item'] - i = self.segments.index(segment) - h3 = self.addFreeHandle(pos, index=self.indexOfHandle(h2)) - self.addSegment(h3, h2, index=i+1) - segment.replaceHandle(h2, h3) - self.wasModified.emit() - self.sigRegionChangeFinished.emit(self) - - def setPoints(self, points, closed=None): - self.wasInitialized = False - QgsMessageLog.logMessage("Iniciando pontos do perfil transversal", "GeoRoad", level=0) - if closed is not None: - self.closed = closed - self.clearPoints() - - for p in points: - self.addRotateHandle(p, p) - #self.addTranslateHandle(p) - - start = -1 if self.closed else 0 - - self.handles[0]['item'].sigEditRequest.connect(lambda: self.HandleEditDialog(0)) - - for i in range(start, len(self.handles) - 1): - self.addSegment(self.handles[i]['item'], self.handles[i + 1]['item']) - j = i + 1 - self.handles[j]['item'].sigEditRequest.connect(functools.partial(self.HandleEditDialog, j)) - - self.wasInitialized = True - self.updateHandles() - - def updateHandles(self): - - if self.wasInitialized: - for i in range(0, len(self.handles) - 1): - - try: - self.handles[i]['item'].sigEditRequest.disconnect() - except: - pass - - self.handles[0]['item'].sigEditRequest.connect(lambda: self.HandleEditDialog(0)) - start = -1 if self.closed else 0 - - for i in range(start, len(self.handles) - 1): - j = i + 1 - self.handles[j]['item'].sigEditRequest.connect(functools.partial(self.HandleEditDialog, j)) - try: - diag = cvEditDialog(self, j) - diag.reset() - except: - pass - - self.wasInitialized = True - self.wasModified.emit() - -class brucknerRoi(CustomPolyLineROI): - wasModified=QtCore.pyqtSignal() - modified=QtCore.pyqtSignal(object) - - def __init__(self, *args, **kwds): - super(brucknerRoi, self).__init__(*args, **kwds) - self.ismodifying=False - self.ypos=self.pos().y() - def removeRect(self, handle): - try: - self.plotWidget.removeItem(handle.leg) - self.plotWidget.removeItem(handle.rect1) - self.plotWidget.removeItem(handle.rect2) - except: - pass - pg.QtGui.QGuiApplication.processEvents() - - def moveCota(self, y): - self.setPos(QPointF(self.pos().x(), y-self.ymed)) - self.ypos=y-self.ymed - for handle in self.getHandles()[1:-1]: - handle.sigRemoveRequested.emit(handle) - self.removeRect(self.getHandles()[0]) - self.removeRect(self.getHandles()[-1]) - - def segmentClicked(self, segment, ev=None, pos=None): ## pos should be in this item's coordinate system - if ev != None: - pos = segment.mapToParent(ev.pos()) - elif pos != None: - pos = pos - else: - raise Exception("Either an event or a position must be given.") - if ev.button() == QtCore.Qt.RightButton: - d = brucknerRampaDialog(self, segment, pos) - d.cotasb.setValue((self.pos().y()+self.ymed)/1000000) - d.cotasb.valueChanged.connect(lambda: self.moveCota(d.cotasb.value()*1000000)) - self.ismodifying=True - d.exec_() - self.ismodifying=False - self.wasModified.emit() - self.sigRegionChangeFinished.emit(self) - - elif ev.button() == QtCore.Qt.LeftButton: - h1 = segment.handles[0]['item'] - h2 = segment.handles[1]['item'] - i = self.segments.index(segment) - h3 = self.addFreeHandle(pos, index=self.indexOfHandle(h2)) - self.addSegment(h3, h2, index=i+1) - segment.replaceHandle(h2, h3) - y0=self.getHandles()[0].pos().y() - h1.setPos(QPointF(h1.pos().x(), y0)) - h2.setPos(QPointF(h2.pos().x(), y0)) - h3.setPos(QPointF(h3.pos().x(), y0)) - self.wasModified.emit() - self.sigRegionChangeFinished.emit(self) - - def setPoints(self, points, closed=None): - self.wasInitialized = False - QgsMessageLog.logMessage("Iniciando pontos do diagrama de bruckner", "GeoRoad", level=0) - if closed is not None: - self.closed = closed - self.clearPoints() - - first=True - for p in points: - self.addRotateHandle(p, p) - # self.addTranslateHandle(p) - - start = -1 if self.closed else 0 - - self.handles[0]['item'].sigEditRequest.connect(lambda: self.HandleEditDialog(0)) - self.handles[0]['item'].fixedOnX=True - self.handles[0]['item'].fixedOnY = True - self.handles[0]['item'].edge=True - - for i in range(start, len(self.handles) - 1): - self.addSegment(self.handles[i]['item'], self.handles[i + 1]['item']) - j = i + 1 - self.handles[j]['item'].fixedOnY = True - - self.handles[j]['item'].fixedOnX=True - self.handles[j]['item'].fixedOnY = True - self.handles[j]['item'].edge=True - - self.wasInitialized = True - self.updateHandles() - - def updateHandles(self): - - if self.wasInitialized: - for i in range(0, len(self.handles) - 1): - try: - self.handles[i]['item'].sigEditRequest.disconnect() - except: - pass - - start = -1 if self.closed else 0 - for i in range(start, len(self.handles) - 1): - j = i + 1 - self.handles[j]['item'].fixedOnY = True - try: - diag = cvEditDialog(self, j) - diag.reset() - except: - pass - self.wasInitialized = True - - - -class Ui_Perfil(QtWidgets.QDialog): - - save = QtCore.pyqtSignal(bool) - reset = QtCore.pyqtSignal() - - def __init__(self, ref_estaca, tipo, classeProjeto, greide, cvList, wintitle="Perfil Longitudinal", iface=None): - super(Ui_Perfil, self).__init__(None) - self.iface=iface - self.initVars(ref_estaca, tipo, classeProjeto, greide, cvList, wintitle) - self.setupUi(self) - - def initVars(self, ref_estaca, tipo, classeProjeto, greide, cvList, wintitle): - self.everPloted=False - self.showDistances=False - self.ref_estaca = ref_estaca - self.tipo = tipo - self.classeProjeto = classeProjeto - self.estaca1txt = -1 - self.estaca2txt = -1 - self.greide=greide - self.cvList=cvList - self.vb=CustomViewBox() - self.perfilPlot = pg.PlotWidget(viewBox=self.vb, enableMenu=False, title=wintitle) - self.perfilPlot.curves=[] - self.saved=True - self.isValid=False - - def showMaximized(self): - if self.isValid: - return super().showMaximized() - else: - return False - - def exec_(self): - if self.isValid: - return super().exec_() - else: - return messageDialog(message="Defina as cotas na tabela de horizontais primeiro!") - - def __setAsNotSaved(self): - self.lblTipo.setText("Modificado") - self.saved=False - - - def perfil_grafico(self): - pontos = [] - k = 0 - while True: - try: - ponto = [] - # e = self.ref_estaca[k][0] - # if e in [None,""]: - # break - - ponto.append(float(self.ref_estaca[k][1])) - ponto.append(float(self.ref_estaca[k][2])) - pontos.append(ponto) - if ponto[1]!=0: - self.isValid=True - #self.comboEstaca1.addItem(_fromUtf8(e)) - except: - break - k += 1 - - x,y=list(zip(*pontos)) - x=list(x) - y=list(y) - self.V=y - self.X=x - self.ymed = np.average(y) - self.perfilPlot.plot(x=x, y=y, symbol='o') - self.perfilPlot.setWindowTitle('Perfil Vertical') - #A = np.array([x,np.ones(len(x))]) - #w = np.linalg.lstsq(A.T,y)[0] - if self.greide: - # i=0 - lastHandleIndex=len(self.greide)-1 - L=[] - for pt in self.greide: - xh=pt[0] - cota=pt[1] - pos=(xh,cota) - L.append(pos) - if xh!=x[-1]: - final=(x[-1], cota) - self.greide[-1]=final - messageDialog(message="O último vértice foi ajustado ao novo traçado!") - L[-1]=final - self.roi = CustomPolyLineROI(L, plot=self.perfilPlot) - else: - #self.roi = CustomPolyLineROI([(x[0], w[0]*x[0]+w[1]), (x[len(x)-1],w[0]*x[len(x)-1]+w[1])], plot=self.perfilPlot) - self.roi = CustomPolyLineROI([(x[0],y[0]), (x[-1],y[-1])], plot=self.perfilPlot) - self.roi.perfil=self - self.roi.wasModified.connect(self.__setAsNotSaved) - self.roi.setAcceptedMouseButtons(QtCore.Qt.RightButton) - self.perfilPlot.addItem(self.roi) - - self.lastGreide=self.getVertices() - self.lastCurvas=self.getCurvas() - self.roi.setPlotWidget(self.perfilPlot) - self.roi.addCvs(self.cvList) - self.roi.sigRegionChangeFinished.connect(self.modifiedRoi) - self.roi.sigRegionChangeFinished.connect(self.updater) - - # self.perfilPlot.plot(y,x) - def updater(self): - self.computingLabel.setText("Processando....") - if not self.showDistances: - for h in self.roi.getHandles(): - self.roi.removeRect(h) - pg.QtGui.QGuiApplication.processEvents() - self.computingLabel.clear() - return - if not self.roi.ismodifying: - handles = [self.roi.getHandlePos(i) for i in range(self.roi.countHandles())] - for j, handlePos in enumerate(handles[1:]): # para cada segmento - I = (handles[j+1].y()-handles[j].y())/(handles[j+1].x()-handles[j].x()) - greideStart=[handles[j].x(), handles[j].y()] - distsY=[] - Xs=[] - terreno=[] - greides=[] - endX=handlePos.x() - lx = greideStart[0] - i1=max([i for i, ix in enumerate(self.X) if ix <= lx]) - i2=min([i for i, ix in enumerate(self.X) if ix >= endX]) - for i, pt in enumerate(zip(self.X[i1:i2], self.V[i1:i2])): # para cada estaca - x=pt[0] - y=pt[1] - greideY=greideStart[1]+I*(x-greideStart[0]) - distsY.append(y-greideY) - Xs.append(x) - terreno.append([x,y]) - greides.append([x,greideY]) - ymax=max(distsY) - ymin=min(distsY) - if ymax>0 and ymin>0: - ymin=0 - else: - indexMin = distsY.index(ymin) - xmin = Xs[indexMin] - tmin = terreno[indexMin][1] - gmin = greides[indexMin][1] - if ymin<0 and ymax<0: - ymax=0 - else: - indexMax = distsY.index(ymax) - xmax=Xs[indexMax] - tmax=terreno[indexMax][1] - gmax=greides[indexMax][1] - - # Plotar cota - handle = self.roi.handles[j + 1]['item'] - self.roi.removeRect(handle) - if ymin!=0: - handle.rect1 = pg.PlotCurveItem() - handle.rect1.setData([xmin, xmin], - [gmin, tmin], - pen=pg.mkPen('b', width=2, style=QtCore.Qt.SolidLine)) - handle.leg1 = pg.TextItem(color=(200, 200, 200)) - handle.leg1.setHtml("%s m" % (str(roundFloatShort(ymin)))) - handle.leg1.setAnchor((0, 0)) - handle.leg1.setPos(xmin, gmin+(ymin)/2) - self.roi.plotWidget.addItem(handle.rect1) - self.roi.plotWidget.addItem(handle.leg1) - - if ymax!=0: - handle.rect2 = pg.PlotCurveItem() - handle.rect2.setData([xmax, xmax], - [gmax, tmax], - pen=pg.mkPen('b', width=2, style=QtCore.Qt.SolidLine)) - handle.leg2 = pg.TextItem(color=(200, 200, 200)) - handle.leg2.setHtml("%s m" % (str(roundFloatShort(ymax)))) - handle.leg2.setAnchor((0, 0)) - handle.leg2.setPos(xmax, gmax+(ymax)/2) - self.roi.plotWidget.addItem(handle.rect2) - self.roi.plotWidget.addItem(handle.leg2) - - handle.sigRemoveRequested.connect(self.roi.removeRect) - - pg.QtGui.QGuiApplication.processEvents() - self.computingLabel.clear() - - def calcularGreide(self): - self.roi.getMenu() - I=[] - handles=self.roi.getHandles() - for i in range(0, len(self.roi.getHandles())-1): - g1=[] - g2=[] - handle=handles[i] - nextHandle=handles[i+1] - g1.append(handle.pos().x()) - g1.append(handle.pos().y()) - g2.append(nextHandle.pos().x()) - g2.append(nextHandle.pos().y()) - p1 =abs((g1[1] - g2[1]) / (g1[0] - g2[0])) * 100 - I.append(p1) - A=[] - for x in I: - A.append(x) - A.sort() - p1=A[len(I)-1] - maxIndex=I.index(p1)+1 - classeProjeto = Config.instance().CLASSE_INDEX-1 - cfg=Config.instance() - - if p1>=cfg.planoMin and p1=cfg.onduladoMin and p1= len(self.progressiva)-1) - self.btnPrevious.setDisabled(self.current == 0) - QtCore.QMetaObject.connectSlotsByName(PerfilTrecho) - - self.layAllOut() - - PerfilTrecho.setWindowTitle(_translate("PerfilTrecho", "Perfil do trecho", None)) - self.calcularGreide() - - self.changingEstaca=False - - def resetSS(self): - self.perfilPlot.removeItem(self.roi) - self.perfil_grafico(reseting=True) -# self.reset() - - - def volumeCalc(self): - try: - diag=VolumeDialog(self) - ct, at=self.prismoide.getVolumes(0) - diag.set(ct, at) - diag.exec_() - except Exception as e: - import traceback - msgLog(str(traceback.format_exception(None, e, e.__traceback__))) - messageDialog(message="Erro! Os taludes definidos não encontram o terreno!") - - def layAllOut(self): - - layout=self.layout() - - if layout is not None: - index = layout.count()-1 - while (index >= 0): - element = layout.itemAt(index).widget() - if element is None: - element = layout.itemAt(index).layout() - if element is not None: - element.setParent(None) - - index -= 1 - - Hlayout=QtWidgets.QHBoxLayout() - Hlayout2=QtWidgets.QHBoxLayout() - Hlayout3=QtWidgets.QHBoxLayout() - Vlayout=QtWidgets.QVBoxLayout() - - Hlayout.addWidget(self.btnCalcular) - Hlayout.addWidget(self.btnExportDxf) - Hlayout.addWidget(self.btnImportDxf) - Hlayout.addWidget(self.applyBtn) - Hlayout.addWidget(self.btnAutoRange) - Hlayout.addWidget(self.btnReset) - Hlayout.addWidget(self.btnClean) - Hlayout.addWidget(self.btnSave) - Hlayout.addWidget(self.btnVolume) - - Hlayout3.addWidget(self.areaLb) - Hlayout3.addWidget(self.areaCtLb) - Hlayout3.addWidget(self.areaAtLb) - - Hlayout3.addWidget(self.progressivaLb) - - Hlayout2.addWidget(self.btnEditToggle) - Hlayout2.addWidget(self.ctatiBtn) - Hlayout2.addWidget(self.selectEstacaComboBox) - Hlayout2.addWidget(self.btnPrevious) - Hlayout2.addWidget(self.btnNext) - - - Vlayout.addLayout(Hlayout) - Vlayout.addLayout(Hlayout3) - Vlayout.addWidget(self.lblTipo) - Vlayout.addWidget(self.perfilPlot) - Vlayout.addLayout(Hlayout2) - - self.setLayout(Vlayout) - self.Vlayout=Vlayout - - def disableArrowButtons(self, bool): - self.btnEditToggle.setDisabled(bool) - self.btnPrevious.setDisabled(bool) - self.btnNext.setDisabled(bool) - self.selectEstacaComboBox.setDisabled(bool) - - - def nextEstaca(self): - if self.current0 and not self.changingEstaca: - self.current-=1 - self.changingEstaca=True - self.reset() - - - def editToggle(self): - if self.editMode: - self.btnEditToggle.setText(u"Esconder") - self.plotTransCurve() - - else: - self.btnEditToggle.setText("Visualizar") - self.curve.clear() - self.perfilPlot.removeItem(self.curve) - - self.editMode = not self.editMode - - def changeEstaca(self): - - if not self.changingEstaca: - self.current = int(self.progressiva.index(estaca2progFloat(self.selectEstacaComboBox.currentText()))) - self.reset() - - - def reset(self): - perfilPlot=self.perfilPlot - self.disableArrowButtons(True) - - self.initVars(self.iface, 0, 0, self.st[self.current], [], "Perfil Transversal") - self.perfil_grafico() - self.roi.sigRegionChangeFinished.connect(self.updateData) - - self.btnNext.setDisabled(self.current == len(self.progressiva)) - self.btnPrevious.setDisabled(self.current == 0) - self.selectEstacaComboBox.setCurrentIndex(self.current) - self.Vlayout.replaceWidget(perfilPlot, self.perfilPlot) - self.disableArrowButtons(False) - - if not self.editMode: - self.plotTransCurve() - - if self.prismoide.lastGeneratedIndex= len(self.progressiva)-1) - self.btnPrevious.setDisabled(self.current == 0) - self.updateAreaLabels() - pg.QtGui.QGuiApplication.processEvents() - self.changingEstaca = False - - - def updateAreaLabels(self): - try: - act, aat = self.prismoide.getFace(self.current).getAreas() - area=self.prismoide.getFace(self.current).getArea() - except Exception as e: - import traceback - msgLog(str(traceback.format_exception(None, e, e.__traceback__))) - messageDialog(message="Erro! Os taludes definidos não encontram o terreno!") - area=act=aat=0 - self.areaLb.setText("Area: " + str(round(area,3))+"m²") - dist=Config.instance().DIST - self.progressivaLb.setText("E: " + str(int(self.progressiva[self.current]/dist))+" + "+str(round((self.progressiva[self.current]/dist-int(self.progressiva[self.current]/dist))*dist,4)) + " " + str(self.intersecTable[self.current][1])) - # act,aat = self.prismoide.getAreasCtAt(self.current) - self.areaCtLb.setText("Corte: " + str(round(act,3))+"m²") - self.areaAtLb.setText("Aterro: " + str(round(aat,3))+"m²") - - - def plotTransCurve(self): - - if self.everPloted: - self.curve.clear() - self.perfilPlot.removeItem(self.curve) - - self.everPloted = True - - self.curve = pg.PlotCurveItem() - - X, Y = Figure.plotCurve(self.prismoide.getCurve(self.current)) - - self.curve.clear() - self.curve.setData(X, Y, pen=pg.mkPen('b', width=4, style=QtCore.Qt.SolidLine)) - self.perfilPlot.addItem(self.curve) - - - def applyTrans(self): - diag=ApplyTransDialog(self.iface, self.progressiva) - diag.show() - if diag.exec_()==QtWidgets.QDialog.Accepted: - st=deepcopy(self.st[self.current]) - greide=self.verticais - for estaca in range(diag.progressivas[0],diag.progressivas[1]+1): - progressiva=self.progressiva[estaca] - newST = [] - for pt in st: - newST.append([float(pt[0]), float(pt[1]) + float(greide.getY(progressiva))-float(greide.getY(self.progressiva[self.current]))]) - self.st[estaca]=newST - - self.prismoide.st = self.st - erros=[] - for estaca in range(diag.progressivas[0],diag.progressivas[1]+1): - try: - if not self.prismoide.generate(estaca) is None: - erros.append(estaca) - except Exception as e: - import traceback - msgLog(str(traceback.format_exception(None, e, e.__traceback__))) - erros.append(estaca) - if erros: - messageDialog(message="Faha ao encontrar a interseção com o terreno nas estacas: \n"+"; ".join([str(e) for e in erros])) - - def setAtCti(self): - diag=SetCtAtiDialog(self.iface, self.roi.getVerticesList()) - diag.show() - if diag.exec_()==QtWidgets.QDialog.Accepted: - self.prismoide.ati=diag.ati - self.prismoide.cti=diag.cti - - -class Ui_Bruckner(Ui_Perfil): - - save = QtCore.pyqtSignal() - plotar = QtCore.pyqtSignal(int) - - def __init__(self, X, V, key="", bruck=[], bruckData=[], interval=[]): - self.editMode=True - self.X=X - # self.V=[v/1000000 for v in V] - self.V=V - self.bruck=bruck - self.key=key - self.interval=interval - self.bruckData=bruckData - super(Ui_Bruckner, self).__init__(0, 0, 0, [], [], wintitle="Diagrama de Bruckner") -# self.btnCalcular.setDisabled(True) - self.btnDistances.hide() - self.btnReset.clicked.disconnect() - self.btnReset.clicked.connect(self.resetGeometry) - self.btnReset.setText("Recalcular") - self.btnReset.setToolTip("Recalcular o diagrama de bruckner redefinindo o Fh com os novos dados de seção transversal") - self.setWindowTitle("Diagrama de Bruckner") - self.btnSave.setText("Exportar") - self.btnSave.setToolTip("Exportar planilha em formato csv") - self.btnSave.clicked.connect(self.csvExport) - self.btnCalcular.disconnect() - self.btnCalcular.setText("Limpar Alterações") - self.btnCalcular.setToolTip("Apaga os dados relacionados à linha de terra para esse intervalo") - self.btnCalcular.clicked.connect(self.resetView) - if not bruckData: - self.setBruckData() - else: - self.roi.setPos(QPointF(self.roi.pos().x(), float(bruckData[0][1])))#+self.roi.ymed)) - self.updater() - - - def setBruckData(self): - r = [] - for handle in self.roi.getHandles(): - x = [] - x.append(str(handle.pos().x())) - x.append(str(self.roi.ypos)) - r.append(x) - self.bruckData=r - # self.bruckData = [[self.roi.getHandlePos(i).x(), self.roi.getHandlePos(i).y()] for i in range(self.roi.countHandles())] - - - def resetView(self): - for h in self.roi.getHandles()[1:-1]: - h.sigRemoveRequested.emit(h) - self.roi.removeRect(self.roi.getHandles()[-1]) - self.roi.removeRect(self.roi.getHandles()[0]) - self.setBruckData() - - def salvarPerfil(self): - self.save.emit() - - def setAsNotSaved(self): - pass - - def calcularGreide(self): - pass - - def perfil_grafico(self): - self.perfilPlot.setWindowTitle('Diagrama de Bruckner (m³)') -# self.createLabels() - ymed=np.average(self.V) - if self.bruckData: - self.roi=brucknerRoi([[p[0], ymed] for p in self.bruckData]) - else: - self.roi = brucknerRoi([[self.X[0], ymed], [self.X[-1], ymed]]) - self.roi.ymed=ymed - self.roi.wasModified.connect(self.setAsNotSaved) - self.roi.setAcceptedMouseButtons(QtCore.Qt.RightButton) - self.roi.sigRegionChangeFinished.connect(self.updater) - self.perfilPlot.addItem(self.roi) - self.roi.setPlotWidget(self.perfilPlot) - self.perfilPlot.plot(self.X, self.V) -# self.updateLabels() - self.isValid=True - - def updater(self): - if not self.roi.ismodifying: - handles=[self.roi.getHandlePos(i).x() for i in range(self.roi.countHandles())] - self.setBruckData() - v0=self.roi.pos().y()+self.roi.ymed - dist=Config.instance().DIST - for j, x in enumerate(handles[1:]): #para cada segmento - lx = handles[j] - A=0 - vmax=0 - xmax=(lx+x)/2 - i1=max([i for i, ix in enumerate(self.X) if ix <= lx]) - i2=min([i for i, ix in enumerate(self.X) if ix >= x]) - - for i, v in enumerate(self.V[i1:i2]): #para cada Volume - dx=self.X[i+1+i1] - self.X[i+i1] - A+=dx*((self.V[i+1+i1] + self.V[i+i1])/2-v0) - if abs(vmax) <= abs(v-v0): - vmax = v-v0 - xmax = (self.X[i+1+i1] + self.X[i+i1])/2 - - lx=x - dm=abs(A/vmax) # Distância média de transporte vmax--> altura - - # Plotar retangulo, associar com handle - handle = self.roi.handles[j + 1]['item'] - self.roi.removeRect(handle) - handle.rect1=pg.PlotCurveItem() - handle.rect2=pg.PlotCurveItem() - handle.rect1.setData([xmax-dm/2, xmax-dm/2, xmax+dm/2, xmax+dm/2], - [v0, v0+vmax, v0+vmax, v0], - pen=pg.mkPen('b', width=4, style=QtCore.Qt.SolidLine)) - handle.rect2.setData([xmax, xmax], - [v0, v0+vmax], - pen=pg.mkPen('r', width=3, style=QtCore.Qt.SolidLine)) - - handle.leg=pg.TextItem(color=(200,200,200)) - handle.leg.setHtml("A = %s m⁴
Vmax = %s m³
Dm = %s m" % (str(roundFloatShort(A*dist)), - str(roundFloatShort(vmax)), - str(roundFloatShort(dm*dist)))) - handle.leg.setAnchor((.5, abs(vmax)/vmax)) - handle.leg.setPos(xmax, v0+vmax) - handle.sigRemoveRequested.connect(self.roi.removeRect) - self.roi.plotWidget.addItem(handle.rect1) - self.roi.plotWidget.addItem(handle.rect2) - self.roi.plotWidget.addItem(handle.leg) - - pg.QtGui.QGuiApplication.processEvents() - - def closeEvent(self, event): - pass - - def wasSaved(self): - pass - - def reject(self): - pass - - def resetGeometry(self): - reset=yesNoDialog(self, message="Realmente recalcular todo o Diagrama?") - self.reseted=reset - if reset: - self.reset.emit() - - def csvExport(self): - import csv - filter = ".csv" - filename = QtWidgets.QFileDialog.getSaveFileName(filter="Arquivo csv(*" + filter + " *" + filter.upper() + ")")[0] - if filename in ['', None]: - return - filename = str(filename) if str(filename).endswith(filter) else str(filename) + filter - delimiter = str(Config.CSV_DELIMITER.strip()[0]) - table=self.bruck["table"] - - ei, ef=self.key.split("-") - if not ei or not ef or not self.interval: - msgLog("Algo de errado com o intervalo de estacas: "+ei+"-"+ef+" !!!") - return - ei,ef=self.interval - table=table[ei:ef+1] - header=["estaca", "corte", "aterro", "at.cor.", "soma", "semi-distancia", "vol.corte", "vol.aterro", - "volume", "vol.acum"] - with open(filename, "w") as fo: - writer = csv.writer(fo, delimiter=delimiter, dialect='excel') - if type(header)==list: - writer.writerow(header) - for d in table: - r=[d[k] for k in header] - for i,c in enumerate(r): - try: - c=round(float(c),4) - r[i]=str(c).replace(".",",") - except: - r[i] = str(c) - writer.writerow(r) - +from __future__ import absolute_import + +import functools +from builtins import zip + +import numpy as np +from PyQt5.QtCore import QPointF, QThread +from qgis.PyQt import QtGui +from copy import deepcopy + +from ..model.helper.calculos import vmedia, fmax +from ..model import constants +from ..model.utils import * +from ..view.estacas import cvEdit, closeDialog, rampaDialog, QgsMessageLog, ApplyTransDialog, SetCtAtiDialog, \ + setEscalaDialog, brucknerRampaDialog, ssRampaDialog, VolumeDialog +from ... import PyQtGraph as pg + +# -*- coding: utf-8 -*- + + +############################################################################################################## +#TODO: + +#Features to ADD +#ctrl+Z utility +#add menu interface and grid and printing scale export + +############################################################################################################## + + + +try: + _fromUtf8 = QtCore.QString.fromUtf8 +except AttributeError: + def _fromUtf8(s): + return s + +try: + _encoding = QtWidgets.QApplication.UnicodeUTF8 + def _translate(context, text, disambig): + return QtWidgets.QApplication.translate(context, text, disambig, _encoding) +except AttributeError: + def _translate(context, text, disambig): + return QtWidgets.QApplication.translate(context, text, disambig) + +class CustomViewBox(pg.ViewBox): + def __init__(self, *args, **kwds): + pg.ViewBox.__init__(self, *args, **kwds) + self.setMouseMode(self.PanMode) + + ## reimplement mid-click to zoom out + def mouseClickEvent(self, ev): + if ev.button() == QtCore.Qt.MidButton: + self.autoRange() + + def mouseDragEvent(self, ev): + if ev.button() == QtCore.Qt.LeftButton: + ev.ignore() + else: + pg.ViewBox.mouseDragEvent(self, ev) + +PREC = 5 #draw precision in meters + +class cv(): + + def __init__(self, i1, i2, L,handlePos, lastHandlePos): + + self.i1=i1 + self.i2=i2 + self.G=(i1-i2)/100 + self.L=L + self.lastHandlePos=lastHandlePos + self.handlePos=handlePos + self.curve=pg.PlotCurveItem() + self.update(i1,i2,L,handlePos, lastHandlePos) + + + def update(self, i1, i2, L,handlePos, lastHandlePos): + if L!=0: + self.i1=i1 + self.i2=i2 + self.G=(i1-i2)/100 + self.L=L + + G=self.G + i1=self.i1/100 + L=self.L + xpcv=handlePos.x()-L/2 + ypcv=lastHandlePos.y()+i1*(xpcv-lastHandlePos.x()) + + x=[] + + for n in range(0,int(L/PREC)+1): + x.append(n*PREC) + + x=np.array(x) + y=(-G/(2*L))*x*x+i1*x+ypcv + + + x=[] + for n in range(0,int(L/PREC)+1): + x.append(n*PREC+xpcv) + + + self.xpcv=xpcv + self.ypcv=ypcv + self.xptv=xpcv+L + self.yptv=self.getCota(self.xptv) + self.x=x + self.y=y + + self.curve.clear() + + + self.curve.setData(x,y,pen=pg.mkPen('r', width=3, style=QtCore.Qt.DashLine)) + + + else: + self.L=0 + + + def getCota(self, x): + return False if x < self.xpcv or x > self.xptv else (-self.G/(2*self.L))*(x-self.xpcv)**2+self.i1*(x-self.xpcv)/100+self.ypcv + + + +class cvEditDialog(cvEdit): + + def __init__(self,roi, i): + super(cvEditDialog, self).__init__(None) +# self.addCurveBtn.clicked.connect(self.raiseCurveGroupeBox) + # self.setupUi(self) + self.isBeingModified=False + self.i=i + self.initialHandlesPos = [] + self.i1=0 + self.i2=0 + self.G=0 + self.Lutilizado=0 + + self.roi=roi + estacas=self.roi.perfil.iface.view.get_estacas() + est=[] + for linha in estacas: + est.append(linha[0]) + self.estacas=est + + self.cota=self.getHandlePos(i).y() + self.horizontal=self.getHandlePos(i).x() + + self.updateCota() + self.uicota.returnPressed.connect(self.updateCota) + self.uihorizontal1.returnPressed.connect(self.updateAbscissa1) + self.uihorizontal1.returnPressed.connect(self.updateAbscissa2) + + self.okBtn.clicked.connect(self.save) + self.cancelBtn.clicked.connect(self.reset) + + #set readonly textEdits + + for j in range(0,roi.countHandles()): + self.initialHandlesPos.append(self.getHandlePos(j)) + + self.handle=self.roi.handles[i]['item'] + + #checking curve existence + + try: + self.Lutilizado=self.handle.curve.L + self.groupBox_2.setEnabled(True) + except AttributeError: + self.handle.curve = cv(self.i1, self.i2, 0, self.handle.pos(), self.getHandlePos(i-1)) + + self.initialCurve = cv(self.handle.curve.i1, self.handle.curve.i2, self.handle.curve.L, self.handle.curve.handlePos, self.handle.curve.lastHandlePos) + self.uiLutilizado.valueChanged.connect(self.updateL) + self.addCurveBtn.clicked.connect(self.updateL) + + self.uicota1.setText(shortFloat2String(self.getHandlePos(i-1).y())) + self.uicota2.setText(shortFloat2String(self.getHandlePos(i+1).y())) + + self.setupValidators() + self.redefineUI(-10) + self.updateVerticesCb() + +# self.helpBtn.clicked.connect(self.displayHelp) + self.viewCurveBtn.clicked.connect(self.viewCurva) + + self.shortcut1 = QtWidgets.QShortcut(QtGui.QKeySequence.MoveToNextChar, self) + self.shortcut2 = QtWidgets.QShortcut(QtGui.QKeySequence.MoveToPreviousChar, self) + self.shortcut1.activated.connect(self.nextVertex) + self.shortcut2.activated.connect(self.previousVertex) + self.velproj.valueChanged.connect(lambda: self.redefineUI(self.elm)) + self.generateAll.clicked.connect(self.generateAllC) + + self.generateAll.hide() + + def generateAllC(self): + self.verticeCb.setCurrentIndex(1) + while self.nextBtn.isEnabled(): + self.updateL() + self.nextVertex() + self.updateL() + + + def nextVertex(self): + if self.nextBtn.isEnabled(): + self.next() + + def previousVertex(self): + if self.previousBtn.isEnabled(): + self.previous() + + def viewCurva(self): + center=self.getHandlePos(self.i) + self.roi.perfil.vb.scaleBy((.5,.5),center) + + def displayHelp(self): + dialog=imgDialog(imagepath="../view/ui/helpCV.png", title="Ajuda: Curvas Verticais") + dialog.show() + dialog.exec_() + + + def setupValidators(self): + self.uicota.setValidator(QtGui.QDoubleValidator()) + self.uihorizontal1.setValidator(QtGui.QDoubleValidator()) + self.uihorizontal2.setValidator(QtGui.QDoubleValidator()) + + self.uiL.setValidator(QtGui.QDoubleValidator()) + + + def raiseCurveGroupeBox(self): + self.groupBox_2.setEnabled(True) + + def save(self): + self.redefineUI(-1) + self.close() + + def reset(self): + j=0 + for pos in self.initialHandlesPos: + self.roi.handles[j]["item"].setPos(pos) + j+=1 + self.handle.curve.curve.clear() + self.handle.curve=self.initialCurve + self.uiL.setText(str(self.handle.curve.L)) + + self.roi.plotWidget.addItem(self.handle.curve.curve) + self.close() + + + def getHandlePos(self, i): + return self.roi.handles[i]['item'].pos() + + + def getSegIncl(self, i, j): + try: + return round(100*(self.getHandlePos(j).y()-self.getHandlePos(i).y())/(self.getHandlePos(j).x()-self.getHandlePos(i).x()), 4) + except IndexError: + return None + + + def updateCota(self): + try: + if not self.isBeingModified: + self.cota=float(self.uicota.text()) + self.update() + self.redefineUI(3) + + except ValueError: + pass + + + def updateAbscissa1(self): + try: + if not self.isBeingModified: + self.horizontal=float(self.uihorizontal1.text())+self.getHandlePos(self.i-1).x() + self.update() + self.redefineUI(4) + self.updateVerticesCb() + + + except ValueError: + pass + + + def updateAbscissa2(self): + try: + if not self.isBeingModified: + self.horizontal=-float(self.uihorizontal2.text())+self.getHandlePos(self.i+1).x() + self.update() + self.redefineUI(4) + + except ValueError: + pass + + + def updateL(self): + try: + if not self.isBeingModified: + self.Lutilizado=float(self.uiLutilizado.value()) + self.uif.setText(('{:0.6e}'.format(self.G / (100*2 * float(self.Lutilizado))))) + self.handle.curve.update(self.i1, self.i2, self.Lutilizado,self.getHandlePos(self.i), self.getHandlePos(self.i-1)) + self.roi.plotWidget.addItem(self.handle.curve.curve) + self.updateAlert() + except ValueError: + pass + + + def update(self): + self.roi.handles[self.i]["item"].setPos(self.horizontal, self.cota) + self.updateAlert() + + def redefineUI(self, elm): + self.elm=elm + self.isBeingModified=True + i=self.i + roi=self.roi + self.groupBox_2.setTitle("Curva Vertical: "+str(i)) + + if i>=roi.countHandles()-1 or i==0: + self.removeCv() + else: + self.i1=self.getSegIncl(i-1,i) + self.i2=self.getSegIncl(i,i+1) + self.G=self.i1-self.i2 + + self.horizontal1=self.horizontal-self.getHandlePos(i-1).x() + self.horizontal2=self.getHandlePos(i+1).x()-self.horizontal + self.uihorizontal1.setText(shortFloat2String(self.horizontal1)) + self.uihorizontal2.setText(shortFloat2String(self.horizontal2)) + self.uii1.setText(shortFloat2String(self.i1)) + self.uii2.setText(shortFloat2String(self.i2)) + self.uiG.setText(shortFloat2String(self.G)) + self.uicota.setText(shortFloat2String(self.cota)) + + concave=False + if self.G < 0: + self.uiCurveType.setText("Côncava") + concave=True + else: + self.uiCurveType.setText("Convexa") + + g=self.G + + if self.velproj.value()==0: + v=velproj = Config.instance().velproj + else: + v=velproj=self.velproj.value() + + self.roi.perfil.calcularGreide() + vv = self.roi.perfil.velProj + + self.velproj.setValue(v) + Kmin = velproj**2/(1296*9.8*1.5/100) #constants.Kmin[min(max(30,(round(velproj/10)*10)),120)][self.G>0] + Kdes=constants.Kdes[min(max(30,(round(velproj/10)*10)),120)][self.G>0] + fmax = constants.f[min(max(30,(round(velproj/10)*10)),120)] + #dp=0.7*vmedia(v)+vmedia(v)**2/(255*(fmax)) + dp=0.7*v+v**2/(255*(fmax)) + self.uiDp.setText(shortFloat2String(dp)) + + self.uiLutilizado : QtWidgets.QDoubleSpinBox + self.uiLutilizado.setSingleStep(Config.instance().DIST) + l1=0 + l2=0 + msgLog("Curva: "+str(self.i)) + msgLog("v: " + str(velproj)) + msgLog("kmin: " + str(Kmin)) + if not concave: + l1=max(0,abs(self.G)*dp**2/412) + msgLog("G: "+str(self.G)) + msgLog("dp: " + str(dp)) + l2=max(0,2*dp-412/abs(self.G)) + else: + l1=max(0,abs(self.G)*dp**2/(122+3.5*dp)) + l2=max(0,2*dp-(122+3.5*dp)/abs(self.G)) + + self.lmin1 : QtWidgets.QLabel + self.lmin2 : QtWidgets.QLabel + + self.lmin1.setText(shortFloat2String(l1)) + self.lmin2.setText(shortFloat2String(l2)) + lsmin= l1 if l1>=dp else l2 + + if self.Lutilizado==0: + dist=Config.instance().DIST + self.Lutilizado=max(.6*v, Kmin*abs(g), lsmin) + self.Lutilizado=self.Lutilizado+dist-self.Lutilizado % dist + + self.uif.setText(('{:0.6e}'.format(self.G/(100*2*float(self.Lutilizado))))) + self.uiLmin.setText(shortFloat2String(Kmin*abs(g))) + + self.uiLutilizado.setValue(self.Lutilizado) + self.uiL.setText(shortFloat2String(velproj*.6)) + self.uiff.setText(shortFloat2String(fmax)) + + self.isBeingModified = False + + self.roi.update() + + txt="Cota" + self.cotaLabel_6.setText(txt+" V"+str(i-1)+ ":") + self.cotaLabel.setText(txt+" V"+str(i)+":") + self.cotaLabel_8.setText(txt+" V"+str(i+1)+":") + + txt="Horizontal" + self.label_9.setText(txt + " V"+str(i-1) + "-" + "V"+str(i)+":") + self.label_12.setText(txt + " V"+str(i) + "-" + "V"+str(i+1)+":") + + self.updateAlert() + + + def updateAlert(self): + vv = self.roi.perfil.velProj + if self.velproj.value()==0: + v=Config.instance().velproj + else: + v=self.velproj.value() + try: + self.uiAlertaLb: QtWidgets.QLabel + if v > vv: + self.uiAlertaLb2.setText("Alerta: "+roundFloat2str(v) + ">" + roundFloat2str(vv) + "!") + self.uiAlertaLb2.setToolTip( + "A velocidade de projeto configurada é maior que a recomendada para esse perfil") + else: + self.uiAlertaLb2.setText("") + self.uiAlertaLb2.setToolTip("") + + if self.getHandlePos(self.i).x() + self.Lutilizado / 2 > self.getHandlePos(self.i + 1).x() - self.roi.handles[self.i + 1]['item'].curve.L / 2 or self.getHandlePos( + self.i).x() - self.Lutilizado / 2 < self.getHandlePos(self.i - 1).x() + self.roi.handles[self.i - 1][ + 'item'].curve.L / 2: + self.uiAlertaLb.setText("Alerta: Sobreposição de curvas!") + self.uiAlertaLb.setToolTip("") + else: + self.uiAlertaLb.setText("") + self.uiAlertaLb.setToolTip("") + + except: + msgLog("Falha ao mostrar alertas") + + + def updateVerticesCb(self): + + self.verticeCb: QtWidgets.QComboBox + self.verticeCb.clear() + for i in range(1, len(self.roi.handles)): + self.verticeCb.addItem(str(i-1)) + + try: + self.verticeCb.currentIndexChanged.disconnect() + self.nextBtn.clicked.disconnect() + self.previousBtn.clicked.disconnect() + except: + pass + + self.verticeCb.setCurrentIndex(self.i) + self.verticeCb.currentIndexChanged.connect(self.changeVertice) + self.nextBtn.clicked.connect(self.next) + self.previousBtn.clicked.connect(self.previous) + + if self.i==1: + self.previousBtn.setEnabled(False) + else: + self.previousBtn.setEnabled(True) + + if self.i==i-1: + self.nextBtn.setEnabled(False) + else: + self.nextBtn.setEnabled(True) + + def changeVertice(self, i): + if i<=0: + i=self.i + elif i>=len(self.roi.handles)-1: + i=self.i + + self.save() + c=cvEditDialog(self.roi, i) + c.move(self.x(),self.y()) + c.show() + c.exec_() + + + def next(self): + self.verticeCb.setCurrentIndex(self.i+1) + + def previous(self): + self.verticeCb.setCurrentIndex(self.i-1) + + + + + +class CustomPolyLineROI(pg.PolyLineROI): + wasModified=QtCore.pyqtSignal() + modified=QtCore.pyqtSignal(object) + + def __init__(self, *args, **kwds): + self.wasInitialized=False + self.labels=[] + self.setPlotWidget(kwds.get('plot', False)) + pg.PolyLineROI.__init__(self,*args,**kwds) + self.ismodifying=False + + def setPlotWidget(self, plotWidget): + if plotWidget: + self.plotWidget = plotWidget + + def HandleEditDialog(self, i): + dialog=cvEditDialog(self, i) + dialog.show() + dialog.exec_() + self.sigRegionChangeFinished.emit(self) + self.modified.emit(self) + + + def mouseClickEvent(self, ev): + + if ev.button() == QtCore.Qt.RightButton and self.isMoving: + self.modified.emit(self) + ev.accept() + self.cancelMove() + + self.wasModified.emit() + ev.accept() + self.modified.emit(self) + self.sigClicked.emit(self, ev) + + + def setPoints(self, points, closed=None): + self.wasInitialized=False + QgsMessageLog.logMessage("Iniciando pontos do perfil", "GeoRoad", level=0) + if closed is not None: + self.closed = closed + self.clearPoints() + + for i,p in enumerate(points): + self.addRotateFreeHandle(p, p) + + start = -1 if self.closed else 0 + + self.handles[0]['item'].sigEditRequest.connect(lambda: self.HandleEditDialog(0)) + self.handles[0]['item'].fixedOnX=True + self.handles[0]['item'].edge=True + + for i in range(start, len(self.handles)-1): + self.addSegment(self.handles[i]['item'], self.handles[i+1]['item']) + j=i+1 + self.handles[j]['item'].sigEditRequest.connect(functools.partial(self.HandleEditDialog, j)) + + self.handles[j]['item'].fixedOnX=True + self.handles[j]['item'].edge=True + + self.wasInitialized=True + self.updateHandles() + + def removeLabel(self, i): + for text in self.labels[i+1:]: + try: + self.plotWidget.removeItem(text) + except: + pass + + + def updateLabel(self, handle, i): + msg="V" + str(i-1) + i=i-1 + text: pg.TextItem + if i>=len(self.labels): + text = pg.TextItem(msg) + else: + text=self.labels[i] + text.setText(msg) + text.setPos(handle.pos().x(), handle.pos().y()) + text.setAnchor((0.5, 1)) + if i>=len(self.labels): + self.plotWidget.addItem(text) + self.labels.append(text) + + + + def updateHandles(self): + if self.wasInitialized: + for i in range(0, len(self.handles)-1): + + try: + self.handles[i]['item'].sigEditRequest.disconnect() + except: + pass + + handle=self.handles[0]['item'] + handle.sigEditRequest.connect(lambda: self.HandleEditDialog(0)) + start = -1 if self.closed else 0 + self.updateLabel(handle, 1) + + for i in range(start, len(self.handles)-1): + j=i+1 + handle=self.handles[j]['item'] + handle.sigEditRequest.connect(functools.partial(self.HandleEditDialog, j)) + self.updateLabel(handle, j+1) + + try: + diag=cvEditDialog(self, j) + diag.reset() + except: + pass + self.removeLabel(len(self.handles)-1) + pg.QtGui.QGuiApplication.processEvents() + self.wasInitialized=True + + def removeCurva(self, handle): + if hasattr(handle, "curve"): + self.plotWidget.removeItem(handle.curve.curve) + handle.curve.curve.clear() + + self.removeHandle(handle) + self.update() + + + def addHandle(self, info, index=None): + h = pg.ROI.addHandle(self, info, index=index) + h.sigRemoveRequested.connect(self.removeHandle) + self.stateChanged(finish=True) + self.wasInitialized=True + self.updateHandles() + return h + + + def countHandles(self): + return len(self.handles) + + + def segmentClicked(self, segment, ev=None, pos=None): ## pos should be in this item's coordinate system + if ev != None: + pos = segment.mapToParent(ev.pos()) + elif pos != None: + pos = pos + else: + raise Exception("Either an event or a position must be given.") + if ev.button() == QtCore.Qt.RightButton: + i = self.segments.index(segment) + d = rampaDialog(self, segment, pos, i+2) + self.ismodifying=True + d.exec_() + self.ismodifying=False + self.wasModified.emit() + self.sigRegionChangeFinished.emit(self) + + elif ev.button() == QtCore.Qt.LeftButton: + h1 = segment.handles[0]['item'] + h2 = segment.handles[1]['item'] + i = self.segments.index(segment) + h3 = self.addFreeHandle(pos, index=self.indexOfHandle(h2)) + self.addSegment(h3, h2, index=i+1) + segment.replaceHandle(h2, h3) + self.wasModified.emit() + self.sigRegionChangeFinished.emit(self) + + + def getHandlePos(self, i): + return self.handles[i]['item'].pos() + + + def getVerticesList(self): + l=[] + for i in range(0,len(self.handles)): + p=self.getHandlePos(i) + l.append([p.x(),p.y()]) + + return l + + + def getYfromX(self,x): + for i in range(0,self.countHandles()-2): + h=self.handles[i]["item"].pos() + nh=self.handles[1+i]["item"].pos() + if h.x() <= x and nh.x() >= x: + return (nh.y()-h.y())/(nh.x()-h.x())*(x-h.x())+h.y() + raise ValueError + + + + def getSegIncl(self, i, j): + try: + return round(100*(self.getHandlePos(j).y()-self.getHandlePos(i).y())/(self.getHandlePos(j).x()-self.getHandlePos(i).x()), 4) + except IndexError: + return None + + def addCvs(self, cvList): + + if (cvList == False or len(cvList) <= 2): + + for i in range(0, len(self.handles) - 1): + i1 = self.getSegIncl(i - 1, i) + i2 = self.getSegIncl(i, i + 1) + L = 0 + self.handles[i]['item'].curve = cv(i1, i2, L, self.getHandlePos(i), self.getHandlePos(i - 1)) + self.handles[i]['item'].sigRemoveRequested.disconnect() + self.handles[i]['item'].sigRemoveRequested.connect(self.removeCurva) + self.plotWidget.addItem(self.handles[i]['item'].curve.curve) + + return + + for i in range(0, len(self.handles) - 1): + if cvList[i][1] != "None": + i1 = self.getSegIncl(i - 1, i) + i2 = self.getSegIncl(i, i + 1) + L = float(cvList[i][1]) + self.handles[i]['item'].curve = cv(i1, i2, L, self.getHandlePos(i), self.getHandlePos(i - 1)) + self.handles[i]['item'].sigRemoveRequested.disconnect() + self.handles[i]['item'].sigRemoveRequested.connect(self.removeCurva) + self.plotWidget.addItem(self.handles[i]['item'].curve.curve) + else: + + i1 = self.getSegIncl(i - 1, i) + i2 = self.getSegIncl(i, i + 1) + L = 0 + self.handles[i]['item'].curve = cv(i1, i2, L, self.getHandlePos(i), self.getHandlePos(i - 1)) + self.handles[i]['item'].sigRemoveRequested.disconnect() + self.handles[i]['item'].sigRemoveRequested.connect(self.removeCurva) + self.plotWidget.addItem(self.handles[i]['item'].curve.curve) + + + def update(self): + try: + for i in range(0, len(self.handles)-1): + i1=self.getSegIncl(i-1,i) + i2=self.getSegIncl(i,i+1) + L=self.handles[i]['item'].curve.L + #self.handles[i]['item'].curve.curve.clear() + #self.handles[i]['item'].curve=cv(i1, i2, L,self.getHandlePos(i), self.getHandlePos(i-1)) + self.handles[i]['item'].curve.update(i1, i2, L,self.getHandlePos(i), self.getHandlePos(i-1)) + #self.plotWidget.addItem(self.handles[i]['item'].curve.curve) + except: + pass + + + def removeRect(self, handle): + try: + self.plotWidget.removeItem(handle.leg1) + self.plotWidget.removeItem(handle.leg2) + self.plotWidget.removeItem(handle.rect1) + self.plotWidget.removeItem(handle.rect2) + except: + pass + pg.QtGui.QGuiApplication.processEvents() + + +class ssRoi(CustomPolyLineROI): + wasModified=QtCore.pyqtSignal() + modified=QtCore.pyqtSignal(object) + + def __init__(self, *args, **kwds): + super(ssRoi, self).__init__(*args, **kwds) + self.cota=kwds["cota"] + + def segmentClicked(self, segment, ev=None, pos=None): ## pos should be in this item's coordinate system + if ev != None: + pos = segment.mapToParent(ev.pos()) + elif pos != None: + pos = pos + else: + raise Exception("Either an event or a position must be given.") + if ev.button() == QtCore.Qt.RightButton: + d = ssRampaDialog(self, segment, pos, self.cota) + d.exec_() + self.wasModified.emit() + self.sigRegionChangeFinished.emit(self) + + elif ev.button() == QtCore.Qt.LeftButton: + h1 = segment.handles[0]['item'] + h2 = segment.handles[1]['item'] + i = self.segments.index(segment) + h3 = self.addFreeHandle(pos, index=self.indexOfHandle(h2)) + self.addSegment(h3, h2, index=i+1) + segment.replaceHandle(h2, h3) + self.wasModified.emit() + self.sigRegionChangeFinished.emit(self) + + def setPoints(self, points, closed=None): + self.wasInitialized = False + QgsMessageLog.logMessage("Iniciando pontos do perfil transversal", "GeoRoad", level=0) + if closed is not None: + self.closed = closed + self.clearPoints() + + for p in points: + self.addRotateHandle(p, p) + #self.addTranslateHandle(p) + + start = -1 if self.closed else 0 + + self.handles[0]['item'].sigEditRequest.connect(lambda: self.HandleEditDialog(0)) + + for i in range(start, len(self.handles) - 1): + self.addSegment(self.handles[i]['item'], self.handles[i + 1]['item']) + j = i + 1 + self.handles[j]['item'].sigEditRequest.connect(functools.partial(self.HandleEditDialog, j)) + + self.wasInitialized = True + self.updateHandles() + + def updateHandles(self): + + if self.wasInitialized: + for i in range(0, len(self.handles) - 1): + + try: + self.handles[i]['item'].sigEditRequest.disconnect() + except: + pass + + self.handles[0]['item'].sigEditRequest.connect(lambda: self.HandleEditDialog(0)) + start = -1 if self.closed else 0 + + for i in range(start, len(self.handles) - 1): + j = i + 1 + self.handles[j]['item'].sigEditRequest.connect(functools.partial(self.HandleEditDialog, j)) + try: + diag = cvEditDialog(self, j) + diag.reset() + except: + pass + + self.wasInitialized = True + self.wasModified.emit() + +class brucknerRoi(CustomPolyLineROI): + wasModified=QtCore.pyqtSignal() + modified=QtCore.pyqtSignal(object) + + def __init__(self, *args, **kwds): + super(brucknerRoi, self).__init__(*args, **kwds) + self.ismodifying=False + self.ypos=self.pos().y() + def removeRect(self, handle): + try: + self.plotWidget.removeItem(handle.leg) + self.plotWidget.removeItem(handle.rect1) + self.plotWidget.removeItem(handle.rect2) + except: + pass + pg.QtGui.QGuiApplication.processEvents() + + def moveCota(self, y): + self.setPos(QPointF(self.pos().x(), y-self.ymed)) + self.ypos=y-self.ymed + for handle in self.getHandles()[1:-1]: + handle.sigRemoveRequested.emit(handle) + self.removeRect(self.getHandles()[0]) + self.removeRect(self.getHandles()[-1]) + + def segmentClicked(self, segment, ev=None, pos=None): ## pos should be in this item's coordinate system + if ev != None: + pos = segment.mapToParent(ev.pos()) + elif pos != None: + pos = pos + else: + raise Exception("Either an event or a position must be given.") + if ev.button() == QtCore.Qt.RightButton: + d = brucknerRampaDialog(self, segment, pos) + d.cotasb.setValue((self.pos().y()+self.ymed)/1000000) + d.cotasb.valueChanged.connect(lambda: self.moveCota(d.cotasb.value()*1000000)) + self.ismodifying=True + d.exec_() + self.ismodifying=False + self.wasModified.emit() + self.sigRegionChangeFinished.emit(self) + + elif ev.button() == QtCore.Qt.LeftButton: + h1 = segment.handles[0]['item'] + h2 = segment.handles[1]['item'] + i = self.segments.index(segment) + h3 = self.addFreeHandle(pos, index=self.indexOfHandle(h2)) + self.addSegment(h3, h2, index=i+1) + segment.replaceHandle(h2, h3) + y0=self.getHandles()[0].pos().y() + h1.setPos(QPointF(h1.pos().x(), y0)) + h2.setPos(QPointF(h2.pos().x(), y0)) + h3.setPos(QPointF(h3.pos().x(), y0)) + self.wasModified.emit() + self.sigRegionChangeFinished.emit(self) + + def setPoints(self, points, closed=None): + self.wasInitialized = False + QgsMessageLog.logMessage("Iniciando pontos do diagrama de bruckner", "GeoRoad", level=0) + if closed is not None: + self.closed = closed + self.clearPoints() + + first=True + for p in points: + self.addRotateHandle(p, p) + # self.addTranslateHandle(p) + + start = -1 if self.closed else 0 + + self.handles[0]['item'].sigEditRequest.connect(lambda: self.HandleEditDialog(0)) + self.handles[0]['item'].fixedOnX=True + self.handles[0]['item'].fixedOnY = True + self.handles[0]['item'].edge=True + + for i in range(start, len(self.handles) - 1): + self.addSegment(self.handles[i]['item'], self.handles[i + 1]['item']) + j = i + 1 + self.handles[j]['item'].fixedOnY = True + + self.handles[j]['item'].fixedOnX=True + self.handles[j]['item'].fixedOnY = True + self.handles[j]['item'].edge=True + + self.wasInitialized = True + self.updateHandles() + + def updateHandles(self): + + if self.wasInitialized: + for i in range(0, len(self.handles) - 1): + try: + self.handles[i]['item'].sigEditRequest.disconnect() + except: + pass + + start = -1 if self.closed else 0 + for i in range(start, len(self.handles) - 1): + j = i + 1 + self.handles[j]['item'].fixedOnY = True + try: + diag = cvEditDialog(self, j) + diag.reset() + except: + pass + self.wasInitialized = True + + + +class Ui_Perfil(QtWidgets.QDialog): + + save = QtCore.pyqtSignal(bool) + reset = QtCore.pyqtSignal() + + def __init__(self, ref_estaca, tipo, classeProjeto, greide, cvList, wintitle="Perfil Longitudinal", iface=None): + super(Ui_Perfil, self).__init__(None) + self.iface=iface + self.initVars(ref_estaca, tipo, classeProjeto, greide, cvList, wintitle) + self.setupUi(self) + + def initVars(self, ref_estaca, tipo, classeProjeto, greide, cvList, wintitle): + self.everPloted=False + self.showDistances=False + self.ref_estaca = ref_estaca + self.tipo = tipo + self.classeProjeto = classeProjeto + self.estaca1txt = -1 + self.estaca2txt = -1 + self.greide=greide + self.cvList=cvList + self.vb=CustomViewBox() + self.perfilPlot = pg.PlotWidget(viewBox=self.vb, enableMenu=False, title=wintitle) + self.perfilPlot.curves=[] + self.saved=True + self.isValid=False + + def showMaximized(self): + if self.isValid: + return super().showMaximized() + else: + return False + + def exec_(self): + if self.isValid: + return super().exec_() + else: + return messageDialog(message="Defina as cotas na tabela de horizontais primeiro!") + + def __setAsNotSaved(self): + self.lblTipo.setText("Modificado") + self.saved=False + + + def perfil_grafico(self): + pontos = [] + k = 0 + while True: + try: + ponto = [] + # e = self.ref_estaca[k][0] + # if e in [None,""]: + # break + + ponto.append(float(self.ref_estaca[k][1])) + ponto.append(float(self.ref_estaca[k][2])) + pontos.append(ponto) + if ponto[1]!=0: + self.isValid=True + #self.comboEstaca1.addItem(_fromUtf8(e)) + except: + break + k += 1 + + x,y=list(zip(*pontos)) + x=list(x) + y=list(y) + self.V=y + self.X=x + self.ymed = np.average(y) + self.perfilPlot.plot(x=x, y=y, symbol='o') + self.perfilPlot.setWindowTitle('Perfil Vertical') + #A = np.array([x,np.ones(len(x))]) + #w = np.linalg.lstsq(A.T,y)[0] + if self.greide: + # i=0 + lastHandleIndex=len(self.greide)-1 + L=[] + for pt in self.greide: + xh=pt[0] + cota=pt[1] + pos=(xh,cota) + L.append(pos) + if xh!=x[-1]: + final=(x[-1], cota) + self.greide[-1]=final + messageDialog(message="O último vértice foi ajustado ao novo traçado!") + L[-1]=final + self.roi = CustomPolyLineROI(L, plot=self.perfilPlot) + else: + #self.roi = CustomPolyLineROI([(x[0], w[0]*x[0]+w[1]), (x[len(x)-1],w[0]*x[len(x)-1]+w[1])], plot=self.perfilPlot) + self.roi = CustomPolyLineROI([(x[0],y[0]), (x[-1],y[-1])], plot=self.perfilPlot) + self.roi.perfil=self + self.roi.wasModified.connect(self.__setAsNotSaved) + self.roi.setAcceptedMouseButtons(QtCore.Qt.RightButton) + self.perfilPlot.addItem(self.roi) + + self.lastGreide=self.getVertices() + self.lastCurvas=self.getCurvas() + self.roi.setPlotWidget(self.perfilPlot) + self.roi.addCvs(self.cvList) + self.roi.sigRegionChangeFinished.connect(self.modifiedRoi) + self.roi.sigRegionChangeFinished.connect(self.updater) + + # self.perfilPlot.plot(y,x) + def updater(self): + self.computingLabel.setText("Processando....") + if not self.showDistances: + for h in self.roi.getHandles(): + self.roi.removeRect(h) + pg.QtGui.QGuiApplication.processEvents() + self.computingLabel.clear() + return + if not self.roi.ismodifying: + handles = [self.roi.getHandlePos(i) for i in range(self.roi.countHandles())] + for j, handlePos in enumerate(handles[1:]): # para cada segmento + I = (handles[j+1].y()-handles[j].y())/(handles[j+1].x()-handles[j].x()) + greideStart=[handles[j].x(), handles[j].y()] + distsY=[] + Xs=[] + terreno=[] + greides=[] + endX=handlePos.x() + lx = greideStart[0] + i1=max([i for i, ix in enumerate(self.X) if ix <= lx]) + i2=min([i for i, ix in enumerate(self.X) if ix >= endX]) + for i, pt in enumerate(zip(self.X[i1:i2], self.V[i1:i2])): # para cada estaca + x=pt[0] + y=pt[1] + greideY=greideStart[1]+I*(x-greideStart[0]) + distsY.append(y-greideY) + Xs.append(x) + terreno.append([x,y]) + greides.append([x,greideY]) + ymax=max(distsY) + ymin=min(distsY) + if ymax>0 and ymin>0: + ymin=0 + else: + indexMin = distsY.index(ymin) + xmin = Xs[indexMin] + tmin = terreno[indexMin][1] + gmin = greides[indexMin][1] + if ymin<0 and ymax<0: + ymax=0 + else: + indexMax = distsY.index(ymax) + xmax=Xs[indexMax] + tmax=terreno[indexMax][1] + gmax=greides[indexMax][1] + + # Plotar cota + handle = self.roi.handles[j + 1]['item'] + self.roi.removeRect(handle) + if ymin!=0: + handle.rect1 = pg.PlotCurveItem() + handle.rect1.setData([xmin, xmin], + [gmin, tmin], + pen=pg.mkPen('b', width=2, style=QtCore.Qt.SolidLine)) + handle.leg1 = pg.TextItem(color=(200, 200, 200)) + handle.leg1.setHtml("%s m" % (str(roundFloatShort(ymin)))) + handle.leg1.setAnchor((0, 0)) + handle.leg1.setPos(xmin, gmin+(ymin)/2) + self.roi.plotWidget.addItem(handle.rect1) + self.roi.plotWidget.addItem(handle.leg1) + + if ymax!=0: + handle.rect2 = pg.PlotCurveItem() + handle.rect2.setData([xmax, xmax], + [gmax, tmax], + pen=pg.mkPen('b', width=2, style=QtCore.Qt.SolidLine)) + handle.leg2 = pg.TextItem(color=(200, 200, 200)) + handle.leg2.setHtml("%s m" % (str(roundFloatShort(ymax)))) + handle.leg2.setAnchor((0, 0)) + handle.leg2.setPos(xmax, gmax+(ymax)/2) + self.roi.plotWidget.addItem(handle.rect2) + self.roi.plotWidget.addItem(handle.leg2) + + handle.sigRemoveRequested.connect(self.roi.removeRect) + + pg.QtGui.QGuiApplication.processEvents() + self.computingLabel.clear() + + def calcularGreide(self): + self.roi.getMenu() + I=[] + handles=self.roi.getHandles() + for i in range(0, len(self.roi.getHandles())-1): + g1=[] + g2=[] + handle=handles[i] + nextHandle=handles[i+1] + g1.append(handle.pos().x()) + g1.append(handle.pos().y()) + g2.append(nextHandle.pos().x()) + g2.append(nextHandle.pos().y()) + p1 =abs((g1[1] - g2[1]) / (g1[0] - g2[0])) * 100 + I.append(p1) + A=[] + for x in I: + A.append(x) + A.sort() + p1=A[len(I)-1] + maxIndex=I.index(p1)+1 + classeProjeto = Config.instance().CLASSE_INDEX-1 + cfg=Config.instance() + + if p1>=cfg.planoMin and p1=cfg.onduladoMin and p1= len(self.progressiva)-1) + self.btnPrevious.setDisabled(self.current == 0) + QtCore.QMetaObject.connectSlotsByName(PerfilTrecho) + + self.layAllOut() + + PerfilTrecho.setWindowTitle(_translate("PerfilTrecho", "Perfil do trecho", None)) + self.calcularGreide() + + self.changingEstaca=False + + def resetSS(self): + self.perfilPlot.removeItem(self.roi) + self.perfil_grafico(reseting=True) +# self.reset() + + + def volumeCalc(self): + try: + diag=VolumeDialog(self) + ct, at=self.prismoide.getVolumes(0) + diag.set(ct, at) + diag.exec_() + except Exception as e: + import traceback + msgLog(str(traceback.format_exception(None, e, e.__traceback__))) + messageDialog(message="Erro! Os taludes definidos não encontram o terreno!") + + def layAllOut(self): + + layout=self.layout() + + if layout is not None: + index = layout.count()-1 + while (index >= 0): + element = layout.itemAt(index).widget() + if element is None: + element = layout.itemAt(index).layout() + if element is not None: + element.setParent(None) + + index -= 1 + + Hlayout=QtWidgets.QHBoxLayout() + Hlayout2=QtWidgets.QHBoxLayout() + Hlayout3=QtWidgets.QHBoxLayout() + Vlayout=QtWidgets.QVBoxLayout() + + Hlayout.addWidget(self.btnCalcular) + Hlayout.addWidget(self.btnExportDxf) + Hlayout.addWidget(self.btnImportDxf) + Hlayout.addWidget(self.applyBtn) + Hlayout.addWidget(self.btnAutoRange) + Hlayout.addWidget(self.btnReset) + Hlayout.addWidget(self.btnClean) + Hlayout.addWidget(self.btnSave) + Hlayout.addWidget(self.btnVolume) + + Hlayout3.addWidget(self.areaLb) + Hlayout3.addWidget(self.areaCtLb) + Hlayout3.addWidget(self.areaAtLb) + + Hlayout3.addWidget(self.progressivaLb) + + Hlayout2.addWidget(self.btnEditToggle) + Hlayout2.addWidget(self.ctatiBtn) + Hlayout2.addWidget(self.selectEstacaComboBox) + Hlayout2.addWidget(self.btnPrevious) + Hlayout2.addWidget(self.btnNext) + + + Vlayout.addLayout(Hlayout) + Vlayout.addLayout(Hlayout3) + Vlayout.addWidget(self.lblTipo) + Vlayout.addWidget(self.perfilPlot) + Vlayout.addLayout(Hlayout2) + + self.setLayout(Vlayout) + self.Vlayout=Vlayout + + def disableArrowButtons(self, bool): + self.btnEditToggle.setDisabled(bool) + self.btnPrevious.setDisabled(bool) + self.btnNext.setDisabled(bool) + self.selectEstacaComboBox.setDisabled(bool) + + + def nextEstaca(self): + if self.current0 and not self.changingEstaca: + self.current-=1 + self.changingEstaca=True + self.reset() + + + def editToggle(self): + if self.editMode: + self.btnEditToggle.setText(u"Esconder") + self.plotTransCurve() + + else: + self.btnEditToggle.setText("Visualizar") + self.curve.clear() + self.perfilPlot.removeItem(self.curve) + + self.editMode = not self.editMode + + def changeEstaca(self): + + if not self.changingEstaca: + self.current = int(self.progressiva.index(estaca2progFloat(self.selectEstacaComboBox.currentText()))) + self.reset() + + + def reset(self): + perfilPlot=self.perfilPlot + self.disableArrowButtons(True) + + self.initVars(self.iface, 0, 0, self.st[self.current], [], "Perfil Transversal") + self.perfil_grafico() + self.roi.sigRegionChangeFinished.connect(self.updateData) + + self.btnNext.setDisabled(self.current == len(self.progressiva)) + self.btnPrevious.setDisabled(self.current == 0) + self.selectEstacaComboBox.setCurrentIndex(self.current) + self.Vlayout.replaceWidget(perfilPlot, self.perfilPlot) + self.disableArrowButtons(False) + + if not self.editMode: + self.plotTransCurve() + + if self.prismoide.lastGeneratedIndex= len(self.progressiva)-1) + self.btnPrevious.setDisabled(self.current == 0) + self.updateAreaLabels() + pg.QtGui.QGuiApplication.processEvents() + self.changingEstaca = False + + + def updateAreaLabels(self): + try: + act, aat = self.prismoide.getFace(self.current).getAreas() + area=self.prismoide.getFace(self.current).getArea() + except Exception as e: + import traceback + msgLog(str(traceback.format_exception(None, e, e.__traceback__))) + messageDialog(message="Erro! Os taludes definidos não encontram o terreno!") + area=act=aat=0 + self.areaLb.setText("Area: " + str(round(area,3))+"m²") + dist=Config.instance().DIST + self.progressivaLb.setText("E: " + str(int(self.progressiva[self.current]/dist))+" + "+str(round((self.progressiva[self.current]/dist-int(self.progressiva[self.current]/dist))*dist,4)) + " " + str(self.intersecTable[self.current][1])) + # act,aat = self.prismoide.getAreasCtAt(self.current) + self.areaCtLb.setText("Corte: " + str(round(act,3))+"m²") + self.areaAtLb.setText("Aterro: " + str(round(aat,3))+"m²") + + + def plotTransCurve(self): + + if self.everPloted: + self.curve.clear() + self.perfilPlot.removeItem(self.curve) + + self.everPloted = True + + self.curve = pg.PlotCurveItem() + + X, Y = Figure.plotCurve(self.prismoide.getCurve(self.current)) + + self.curve.clear() + self.curve.setData(X, Y, pen=pg.mkPen('b', width=4, style=QtCore.Qt.SolidLine)) + self.perfilPlot.addItem(self.curve) + + + def applyTrans(self): + diag=ApplyTransDialog(self.iface, self.progressiva) + diag.show() + if diag.exec_()==QtWidgets.QDialog.Accepted: + st=deepcopy(self.st[self.current]) + greide=self.verticais + for estaca in range(diag.progressivas[0],diag.progressivas[1]+1): + progressiva=self.progressiva[estaca] + newST = [] + for pt in st: + newST.append([float(pt[0]), float(pt[1]) + float(greide.getY(progressiva))-float(greide.getY(self.progressiva[self.current]))]) + self.st[estaca]=newST + + self.prismoide.st = self.st + erros=[] + for estaca in range(diag.progressivas[0],diag.progressivas[1]+1): + try: + if not self.prismoide.generate(estaca) is None: + erros.append(estaca) + except Exception as e: + import traceback + msgLog(str(traceback.format_exception(None, e, e.__traceback__))) + erros.append(estaca) + if erros: + messageDialog(message="Faha ao encontrar a interseção com o terreno nas estacas: \n"+"; ".join([str(e) for e in erros])) + + def setAtCti(self): + diag=SetCtAtiDialog(self.iface, self.roi.getVerticesList()) + diag.show() + if diag.exec_()==QtWidgets.QDialog.Accepted: + self.prismoide.ati=diag.ati + self.prismoide.cti=diag.cti + + +class Ui_Bruckner(Ui_Perfil): + + save = QtCore.pyqtSignal() + plotar = QtCore.pyqtSignal(int) + + def __init__(self, X, V, key="", bruck=[], bruckData=[], interval=[]): + self.editMode=True + self.X=X + # self.V=[v/1000000 for v in V] + self.V=V + self.bruck=bruck + self.key=key + self.interval=interval + self.bruckData=bruckData + super(Ui_Bruckner, self).__init__(0, 0, 0, [], [], wintitle="Diagrama de Bruckner") +# self.btnCalcular.setDisabled(True) + self.btnDistances.hide() + self.btnReset.clicked.disconnect() + self.btnReset.clicked.connect(self.resetGeometry) + self.btnReset.setText("Recalcular") + self.btnReset.setToolTip("Recalcular o diagrama de bruckner redefinindo o Fh com os novos dados de seção transversal") + self.setWindowTitle("Diagrama de Bruckner") + self.btnSave.setText("Exportar") + self.btnSave.setToolTip("Exportar planilha em formato csv") + self.btnSave.clicked.connect(self.csvExport) + self.btnCalcular.disconnect() + self.btnCalcular.setText("Limpar Alterações") + self.btnCalcular.setToolTip("Apaga os dados relacionados à linha de terra para esse intervalo") + self.btnCalcular.clicked.connect(self.resetView) + if not bruckData: + self.setBruckData() + else: + self.roi.setPos(QPointF(self.roi.pos().x(), float(bruckData[0][1])))#+self.roi.ymed)) + self.updater() + + + def setBruckData(self): + r = [] + for handle in self.roi.getHandles(): + x = [] + x.append(str(handle.pos().x())) + x.append(str(self.roi.ypos)) + r.append(x) + self.bruckData=r + # self.bruckData = [[self.roi.getHandlePos(i).x(), self.roi.getHandlePos(i).y()] for i in range(self.roi.countHandles())] + + + def resetView(self): + for h in self.roi.getHandles()[1:-1]: + h.sigRemoveRequested.emit(h) + self.roi.removeRect(self.roi.getHandles()[-1]) + self.roi.removeRect(self.roi.getHandles()[0]) + self.setBruckData() + + def salvarPerfil(self): + self.save.emit() + + def setAsNotSaved(self): + pass + + def calcularGreide(self): + pass + + def perfil_grafico(self): + self.perfilPlot.setWindowTitle('Diagrama de Bruckner (m³)') +# self.createLabels() + ymed=np.average(self.V) + if self.bruckData: + self.roi=brucknerRoi([[p[0], ymed] for p in self.bruckData]) + else: + self.roi = brucknerRoi([[self.X[0], ymed], [self.X[-1], ymed]]) + self.roi.ymed=ymed + self.roi.wasModified.connect(self.setAsNotSaved) + self.roi.setAcceptedMouseButtons(QtCore.Qt.RightButton) + self.roi.sigRegionChangeFinished.connect(self.updater) + self.perfilPlot.addItem(self.roi) + self.roi.setPlotWidget(self.perfilPlot) + self.perfilPlot.plot(self.X, self.V) +# self.updateLabels() + self.isValid=True + + def updater(self): + if not self.roi.ismodifying: + handles=[self.roi.getHandlePos(i).x() for i in range(self.roi.countHandles())] + self.setBruckData() + v0=self.roi.pos().y()+self.roi.ymed + dist=Config.instance().DIST + for j, x in enumerate(handles[1:]): #para cada segmento + lx = handles[j] + A=0 + vmax=0 + xmax=(lx+x)/2 + i1=max([i for i, ix in enumerate(self.X) if ix <= lx]) + i2=min([i for i, ix in enumerate(self.X) if ix >= x]) + + for i, v in enumerate(self.V[i1:i2]): #para cada Volume + dx=self.X[i+1+i1] - self.X[i+i1] + A+=dx*((self.V[i+1+i1] + self.V[i+i1])/2-v0) + if abs(vmax) <= abs(v-v0): + vmax = v-v0 + xmax = (self.X[i+1+i1] + self.X[i+i1])/2 + + lx=x + dm=abs(A/vmax) # Distância média de transporte vmax--> altura + + # Plotar retangulo, associar com handle + handle = self.roi.handles[j + 1]['item'] + self.roi.removeRect(handle) + handle.rect1=pg.PlotCurveItem() + handle.rect2=pg.PlotCurveItem() + handle.rect1.setData([xmax-dm/2, xmax-dm/2, xmax+dm/2, xmax+dm/2], + [v0, v0+vmax, v0+vmax, v0], + pen=pg.mkPen('b', width=4, style=QtCore.Qt.SolidLine)) + handle.rect2.setData([xmax, xmax], + [v0, v0+vmax], + pen=pg.mkPen('r', width=3, style=QtCore.Qt.SolidLine)) + + handle.leg=pg.TextItem(color=(200,200,200)) + handle.leg.setHtml("A = %s \u33A1
Vmax = %s m³
Dm = %s m" % (str(roundFloatShort(A*dist)), + str(roundFloatShort(vmax)), + str(roundFloatShort(dm*dist)))) + handle.leg.setAnchor((.5, abs(vmax)/vmax)) + handle.leg.setPos(xmax, v0+vmax) + handle.sigRemoveRequested.connect(self.roi.removeRect) + self.roi.plotWidget.addItem(handle.rect1) + self.roi.plotWidget.addItem(handle.rect2) + self.roi.plotWidget.addItem(handle.leg) + + pg.QtGui.QGuiApplication.processEvents() + + def closeEvent(self, event): + pass + + def wasSaved(self): + pass + + def reject(self): + pass + + def resetGeometry(self): + reset=yesNoDialog(self, message="Realmente recalcular todo o Diagrama?") + self.reseted=reset + if reset: + self.reset.emit() + + def csvExport(self): + import csv + filter = ".csv" + filename = QtWidgets.QFileDialog.getSaveFileName(filter="Arquivo csv(*" + filter + " *" + filter.upper() + ")")[0] + if filename in ['', None]: + return + filename = str(filename) if str(filename).endswith(filter) else str(filename) + filter + delimiter = str(Config.CSV_DELIMITER.strip()[0]) + table=self.bruck["table"] + + ei, ef=self.key.split("-") + if not ei or not ef or not self.interval: + msgLog("Algo de errado com o intervalo de estacas: "+ei+"-"+ef+" !!!") + return + ei,ef=self.interval + table=table[ei:ef+1] + header=["estaca", "corte", "aterro", "at.cor.", "soma", "semi-distancia", "vol.corte", "vol.aterro", + "volume", "vol.acum"] + with open(filename, "w") as fo: + writer = csv.writer(fo, delimiter=delimiter, dialect='excel') + if type(header)==list: + writer.writerow(header) + for d in table: + r=[d[k] for k in header] + for i,c in enumerate(r): + try: + c=round(float(c),4) + r[i]=str(c).replace(".",",") + except: + r[i] = str(c) + writer.writerow(r) + diff --git a/app/controller/threading.py b/app/controller/threading.py old mode 100644 new mode 100755 index 8a07021..a07fc82 --- a/app/controller/threading.py +++ b/app/controller/threading.py @@ -1,127 +1,127 @@ -#####TODO make threading work -from qgis._core import QgsApplication -from qgis._core import QgsTask - - -def nongui(fun): -# """Decorator running the function in non-gui thread while -# processing the gui events.""" -# from multiprocessing.pool import ThreadPool -# from PyQt5.QtWidgets import QApplication -# -# def wrap(*args, **kwargs): -# pool = ThreadPool(processes=1) -# asynchronous = pool.apply_async(fun, args, kwargs) -# while not asynchronous.ready(): -# asynchronous.wait(0.01) -# QApplication.processEvents() -# return asynchronous.get() -# - return fun#wrap - - - -#def nongui(func): -# """Decorator running the function in non-gui thread while -# processing the gui events.""" -# from qgis._core import QgsTask, QgsApplication, QgsMessageLog, Qgis -# MESSAGE_CATEGORY = 'GeoRoad' -# -# def workdone(exception, result=None): -# if exception is None: -# if result is None: -# QgsMessageLog.logMessage('Completed with no exception and no result '\ -# '(probably manually canceled by the user)', -# MESSAGE_CATEGORY, Qgis.Warning) -# return result -# -# else: -# QgsMessageLog.logMessage("Exception: {}".format(exception), -# MESSAGE_CATEGORY, Qgis.Critical) -# raise exception -# -# def wrap(*args, **kwargs): -# task=QgsTask.fromFunction(u'GeoRoad Task', wrap, -# onfinished=workdone) -# QgsApplication.taskManager().addTask(task) -# -# return wrap -# -from PyQt5.QtWidgets import * -import time - -class TestTask(QgsTask): - """Here we subclass QgsTask""" - def __init__(self, desc,iface): - QgsTask.__init__(self, desc) - self.iface=iface - - def run(self): - """This function is where you do the 'heavy lifting' or implement - the task which you want to run in a background thread. This function - must return True or False and should only interact with the main thread - via signals""" - for i in range (21): - time.sleep(0.5) - val = i * 5 - #report progress which can be received by the main thread - self.setProgress(val) - #check to see if the task has been cancelled - if self.isCanceled(): - return False - return True - - def finished(self, result): - """This function is called automatically when the task is completed and is - called from the main thread so it is safe to interact with the GUI etc here""" - if result is False: - self.iface.messageBar().pushMessage('Task was cancelled') - else: - self.iface.messageBar().pushMessage('Task Complete') - -class My_Dialog(QDialog): - def __init__(self, parent=None): - QDialog.__init__(self, parent) - self.resize(500, 350) - self.lbl_info = QLabel('Info:', self) - self.lbl_info.move(100, 50) - self.edit_info = QLineEdit(self) - self.edit_info.move(200, 50) - lbl_prog = QLabel('Task Progress: ', self) - lbl_prog.move(100, 210) - self.prog = QProgressBar(self) - self.prog.resize(200, 30) - self.prog.move(200, 200) - btn_OK = QPushButton('OK', self) - btn_OK.move(300, 300) - btn_OK.clicked.connect(self.newTask) - btn_close = QPushButton('Close',self) - btn_close.move(400, 300) - btn_close.clicked.connect(self.close_win) - btn_cancel = QPushButton('Cancel Task', self) - btn_cancel.move(50, 300) - btn_cancel.clicked.connect(self.cancelTask) - - - def newTask(self): - """Create a task and add it to the Task Manager""" - self.task = TestTask('Custom Task') - #connect to signals from the background threads to perform gui operations - #such as updating the progress bar - self.task.begun.connect(lambda: self.edit_info.setText('Working...')) - self.task.progressChanged.connect(lambda: self.prog.setValue(self.task.progress())) - self.task.taskCompleted.connect(lambda: self.edit_info.setText('Task Complete')) - self.task.taskTerminated.connect(self.TaskCancelled) - QgsApplication.taskManager().addTask(self.task) - - def cancelTask(self): - self.task.cancel() - - def TaskCancelled(self): - self.prog.setValue(0) - self.edit_info.setText('Task Cancelled') - - def close_win(self): - My_Dialog.close(self) - - +#####TODO make threading work +from qgis._core import QgsApplication +from qgis._core import QgsTask + + +def nongui(fun): +# """Decorator running the function in non-gui thread while +# processing the gui events.""" +# from multiprocessing.pool import ThreadPool +# from PyQt5.QtWidgets import QApplication +# +# def wrap(*args, **kwargs): +# pool = ThreadPool(processes=1) +# asynchronous = pool.apply_async(fun, args, kwargs) +# while not asynchronous.ready(): +# asynchronous.wait(0.01) +# QApplication.processEvents() +# return asynchronous.get() +# + return fun#wrap + + + +#def nongui(func): +# """Decorator running the function in non-gui thread while +# processing the gui events.""" +# from qgis._core import QgsTask, QgsApplication, QgsMessageLog, Qgis +# MESSAGE_CATEGORY = 'GeoRoad' +# +# def workdone(exception, result=None): +# if exception is None: +# if result is None: +# QgsMessageLog.logMessage('Completed with no exception and no result '\ +# '(probably manually canceled by the user)', +# MESSAGE_CATEGORY, Qgis.Warning) +# return result +# +# else: +# QgsMessageLog.logMessage("Exception: {}".format(exception), +# MESSAGE_CATEGORY, Qgis.Critical) +# raise exception +# +# def wrap(*args, **kwargs): +# task=QgsTask.fromFunction(u'GeoRoad Task', wrap, +# onfinished=workdone) +# QgsApplication.taskManager().addTask(task) +# +# return wrap +# +from PyQt5.QtWidgets import * +import time + +class TestTask(QgsTask): + """Here we subclass QgsTask""" + def __init__(self, desc,iface): + QgsTask.__init__(self, desc) + self.iface=iface + + def run(self): + """This function is where you do the 'heavy lifting' or implement + the task which you want to run in a background thread. This function + must return True or False and should only interact with the main thread + via signals""" + for i in range (21): + time.sleep(0.5) + val = i * 5 + #report progress which can be received by the main thread + self.setProgress(val) + #check to see if the task has been cancelled + if self.isCanceled(): + return False + return True + + def finished(self, result): + """This function is called automatically when the task is completed and is + called from the main thread so it is safe to interact with the GUI etc here""" + if result is False: + self.iface.messageBar().pushMessage('Task was cancelled') + else: + self.iface.messageBar().pushMessage('Task Complete') + +class My_Dialog(QDialog): + def __init__(self, parent=None): + QDialog.__init__(self, parent) + self.resize(500, 350) + self.lbl_info = QLabel('Info:', self) + self.lbl_info.move(100, 50) + self.edit_info = QLineEdit(self) + self.edit_info.move(200, 50) + lbl_prog = QLabel('Task Progress: ', self) + lbl_prog.move(100, 210) + self.prog = QProgressBar(self) + self.prog.resize(200, 30) + self.prog.move(200, 200) + btn_OK = QPushButton('OK', self) + btn_OK.move(300, 300) + btn_OK.clicked.connect(self.newTask) + btn_close = QPushButton('Close',self) + btn_close.move(400, 300) + btn_close.clicked.connect(self.close_win) + btn_cancel = QPushButton('Cancel Task', self) + btn_cancel.move(50, 300) + btn_cancel.clicked.connect(self.cancelTask) + + + def newTask(self): + """Create a task and add it to the Task Manager""" + self.task = TestTask('Custom Task') + #connect to signals from the background threads to perform gui operations + #such as updating the progress bar + self.task.begun.connect(lambda: self.edit_info.setText('Working...')) + self.task.progressChanged.connect(lambda: self.prog.setValue(self.task.progress())) + self.task.taskCompleted.connect(lambda: self.edit_info.setText('Task Complete')) + self.task.taskTerminated.connect(self.TaskCancelled) + QgsApplication.taskManager().addTask(self.task) + + def cancelTask(self): + self.task.cancel() + + def TaskCancelled(self): + self.prog.setValue(0) + self.edit_info.setText('Task Cancelled') + + def close_win(self): + My_Dialog.close(self) + + diff --git a/app/model/__init__.py b/app/model/__init__.py old mode 100644 new mode 100755 diff --git a/app/model/config.py b/app/model/config.py old mode 100644 new mode 100755 index 40624f0..a4f07d8 --- a/app/model/config.py +++ b/app/model/config.py @@ -1,434 +1,434 @@ -# -*- coding: utf-8 -*- -import json -import os -import shutil -import sqlite3 -import zipfile -from builtins import object -from builtins import str -from pathlib import Path - -from qgis._core import QgsApplication, QgsProject - - -def extractZIP(filename): - z = zipfile.ZipFile(filename, "r") - os.chdir(os.path.dirname(filename)) - if not os.path.exists(Config.instance().TMP_DIR_PATH+'tmp'): - os.makedirs(Config.instance().TMP_DIR_PATH+'tmp') - z.extractall(Config.instance().TMP_DIR_PATH+"tmp") - z.close() - return Path(Config.instance().TMP_DIR_PATH+'tmp/data/').rglob("*.gpkg*") - - -def compactZIP(filename): - z = zipfile.ZipFile(filename, "w") - os.chdir(os.path.dirname(filename)) - z.write(Config.instance().TMP_DIR_PATH+'tmp/data/data.db','data/data.db',zipfile.ZIP_DEFLATED) - z.write(Config.instance().TMP_DIR_PATH+'tmp/data/config.json','data/config.json',zipfile.ZIP_DEFLATED) - tracs=Path(Config.instance().TMP_DIR_PATH+'tmp/data/').rglob("*.gpkg*") - for trac in tracs: - z.write(str(trac),'data/'+trac.name,zipfile.ZIP_DEFLATED) - tracs = Path(Config.instance().TMP_DIR_PATH+'tmp/data/').rglob("*.prism") - for trac in tracs: - z.write(str(trac), 'data/' + trac.name, zipfile.ZIP_DEFLATED) - tracs = Path(Config.instance().TMP_DIR_PATH+'tmp/data/').rglob("*.bruck") - for trac in tracs: - z.write(str(trac), 'data/' + trac.name, zipfile.ZIP_DEFLATED) - - z.close() - shutil.rmtree(Config.instance().TMP_DIR_PATH+'tmp') - - -class Config(object): - # Valore padrão - - FILE_PATH="" - PLUGIN_NAME="GeoRoad" - fileName = '' - UNITS = 'm' - CSV_DELIMITER = ';' - DIST=20 - RANDOM="__ix35-_-xxx901381asdioADJ398(__" - TMP_FOLDER="GeoRoadPluginTemporaryLayers/" - T_SPACING=50 - CLASSE_INDEX=4 - crs = 2676 - planoMin = 0.0 - planoMax = 8.0 - onduladoMin = 8.0 - onduladoMax = 20.0 - montanhosoMin = 20.0 - montanhosoMax = 100.0 - TMP_DIR_PATH = RANDOM - T_OFFSET = 6 - interpol="True" - velproj=100.0 - emax=0.08 - PREC=0.1 # 10cm default precisão - - # DADOS para serem armazenados no projeto do qgis. - # Cada string nessa lista é criada como um atributo de Config.instance() que pode ser lida por - #Config.instance().nome e armazenada com Config.instance().store(nome, valor) - # Chamadas de Config.instance() em loop são pouco eficientes! Não utilizar - - data=["UNITS", - "CSV_DELIMITER", - "DIST", - "T_SPACING", - "CLASSE_INDEX", - "crs", - "planoMin", - "planoMax", - "onduladoMin", - "onduladoMax", - "montanhosoMin", - "montanhosoMax", - "T_OFFSET", - "FILE_PATH", - "interpol", - "velproj", - 'emax', - "TMP_FOLDER", - "TMP_DIR_PATH", - "PREC" - ] - - def __init__(self): - self.crs = 2676 - self.class_project = -1 - self.dataTopo = [ - 0.0, - 8.0, - 8.0, - 20.0, - 20.0, - 100.0 - ] - self.rowCRS = self.listCRS() - #self.tableCRS = self.tableCRS - #self.comboClasse = self.comboClasse - self.filename = "" - self.tipo_mapa = 3 - self.ordem_mapa = [3, 1, 10, 9] - self.ordem_units = ['m','km', 'mm'] - Config.fileName = self.filename - self.UNITS = 'm' - self.CSV_DELIMITER = ';' - Config.UNITS = self.UNITS - Config.CSV_DELIMITER = self.CSV_DELIMITER - - - def create_datatable(self,dbPath='data/data.db'): - con = sqlite3.connect(dbPath) - con.execute("CREATE TABLE if not exists PROJECT" - "(id INTEGER primary key AUTOINCREMENT, crs varchar(255), " - "classeprojeto int," - " maxplano double," - " minplano double," - "maxondulado double," - " minondulado double," - " maxmontanhoso double," - " minmontanhoso double," - " tipomapa int )") - - con.execute("CREATE TABLE if not exists TABLEESTACA" - "(id INTEGER primary key AUTOINCREMENT,name varchar(255)," - "data DATETIME DEFAULT CURRENT_TIMESTAMP)") - - con.execute("CREATE TABLE if not exists ESTACA" - "(id INTEGER primary key AUTOINCREMENT,estaca varchar(255)," - "descricao text," - "progressiva text," - "norte text," - "este text," - "cota text," - "azimute text," - "TABLEESTACA_id INTEGER," - "FOREIGN KEY(TABLEESTACA_id) REFERENCES TABLEESTACA(id)" - ")") - - con.execute("CREATE TABLE if not exists TABLECURVA" - "(id INTEGER primary key AUTOINCREMENT," - "TABLEESTACA_id INTEGER," - "data DATETIME DEFAULT CURRENT_TIMESTAMP," - "FOREIGN KEY(TABLEESTACA_id) REFERENCES TABLEESTACA(id)" - - ")") - con.execute("CREATE TABLE if not exists CURVA" - "(id INTEGER primary key AUTOINCREMENT," - "tipo INTEGER," - "estaca_inicial_id INTEGER," - "estaca_final_id INTEGER," - "velocidade INTEGER," - "raio_utilizado DOUBLE," - "emax DOUBLE," - "TABLECURVA_id INTEGER," - "data DATETIME DEFAULT CURRENT_TIMESTAMP," - "FOREIGN KEY(estaca_inicial_id) REFERENCES ESTACA(id)" - "FOREIGN KEY(estaca_final_id) REFERENCES ESTACA(id)" - "FOREIGN KEY(TABLECURVA_id) REFERENCES TABLECURVA(id)" - ")") - con.execute("CREATE TABLE if not exists CURVA_SIMPLES" - "(id INTEGER primary key AUTOINCREMENT," - "g20 DOUBLE," - "t DOUBLE," - "d DOUBLE," - "epi DOUBLE," - "epc DOUBLE," - "ept DOUBLE," - "CURVA_id INTEGER," - "data DATETIME DEFAULT CURRENT_TIMESTAMP," - "FOREIGN KEY(CURVA_id) REFERENCES CURVA(id)" - ")") - con.execute("CREATE TABLE if not exists GREIDE" - "(id INTEGER primary key AUTOINCREMENT," - "x DOUBLE," - "cota DOUBLE," - "TABLEESTACA_id INTEGER," - "FOREIGN KEY(TABLEESTACA_id) REFERENCES TABLEESTACA(id)" - - ")") - - con.execute("CREATE TABLE if not exists CURVA_VERTICAL_DADOS" - "(id INTEGER primary key AUTOINCREMENT," - "CURVA_id INTEGER," - "L DOUBLE," - "TABLEESTACA_id INTEGER," - "FOREIGN KEY(TABLEESTACA_id) REFERENCES TABLEESTACA(id)" - ")") - - con.execute("CREATE TABLE if not exists TRANSVERSAL" - "(id INTEGER primary key AUTOINCREMENT," - "x DOUBLE," - "TABLEESTACA_id INTEGER," - "FOREIGN KEY(TABLEESTACA_id) REFERENCES TABLEESTACA(id)" - ")") - - con.execute("CREATE TABLE if not exists SESSAO_TIPO" - "(id INTEGER primary key AUTOINCREMENT," - "y DOUBLE," - "cota DOUBLE," - "TRANSVERSAL_id INTEGER," - "TABLEESTACA_id INTEGER," - "FOREIGN KEY(TRANSVERSAL_id) REFERENCES TRANSVERSAL(id)," - "FOREIGN KEY(TABLEESTACA_id) REFERENCES TABLEESTACA(id)" - ")") - - con.execute("CREATE TABLE if not exists RELEVO_SESSAO" - "(id INTEGER primary key AUTOINCREMENT," - "y DOUBLE," - "cota DOUBLE," - "TRANSVERSAL_id INTEGER," - "TABLEESTACA_id INTEGER," - "FOREIGN KEY(TRANSVERSAL_id) REFERENCES TRANSVERSAL(id)," - "FOREIGN KEY(TABLEESTACA_id) REFERENCES TABLEESTACA(id)" - ")") - - con.execute("CREATE TABLE if not exists VERTICAIS_TABLE" - "(id INTEGER primary key AUTOINCREMENT," - "estaca text," - "descricao text," - "progressiva text," - "greide text," - "TABLEESTACA_id INTEGER," - "FOREIGN KEY(TABLEESTACA_id) REFERENCES TABLEESTACA(id)" - ")") - - con.execute("CREATE TABLE if not exists INTERSECT_TABLE" - "(id INTEGER primary key AUTOINCREMENT," - "estaca text," - "descricao text," - "progressiva text," - "norte text," - "este text," - "greide text," - "cota text," - "azimute text," - "TABLEESTACA_id INTEGER," - "FOREIGN KEY(TABLEESTACA_id) REFERENCES TABLEESTACA(id)" - ")") - - con.execute("CREATE TABLE if not exists BRUCKNER_TABLE" - "(id INTEGER primary key AUTOINCREMENT," - "estaca text," - "volume text," - "TABLEESTACA_id INTEGER," - "FOREIGN KEY(TABLEESTACA_id) REFERENCES TABLEESTACA(id)" - ")") - - con.commit() - return con - - - def newfile(self, filename): - self.filename = filename - if self.filename.endswith('zip'): - zip_arch_path = u"%s" % filename - else: - zip_arch_path = u"%s.zip" % filename - self.filename = zip_arch_path - Config.fileName = self.filename - f = open(zip_arch_path, 'w') - f.write('') - f.close() - os.chdir(os.path.dirname(zip_arch_path)) - if os.path.exists(Config.instance().TMP_DIR_PATH+'tmp'): - shutil.rmtree(Config.instance().TMP_DIR_PATH+'tmp') - z = zipfile.ZipFile(zip_arch_path, "w") - if not os.path.exists(Config.instance().TMP_DIR_PATH+'tmp/data'): - os.makedirs(Config.instance().TMP_DIR_PATH+'tmp/data') - os.chdir(Config.instance().TMP_DIR_PATH+'tmp') - - con = self.create_datatable() - res = con.execute("SELECT id FROM PROJECT").fetchall() - if res is None or len(res)==0: - con.execute("INSERT INTO PROJECT" - "(id,crs,classeprojeto,maxplano,minplano," - "maxondulado,minondulado,maxmontanhoso," - "minmontanhoso,tipomapa)" - "values (1,31983,0,8.0,0.0,20.0,8.0,100.0,20.0,3)") - con.commit() - - con.close() - - with open('data/config.json', 'w') as outfile: - j = json.dumps({ - 'csv_delimiter': ';', - 'units': 'm' - }) - outfile.write(j) - - z.write('data/data.db', "data/data.db", zipfile.ZIP_DEFLATED) - z.write('data/config.json', "data/config.json", zipfile.ZIP_DEFLATED) - os.chdir('..') - z.close() - shutil.rmtree(Config.instance().TMP_DIR_PATH+'tmp') - - def openfile(self, filename): - self.filename = filename - Config.fileName = self.filename - extractZIP(filename) - self.create_datatable(Config.instance().TMP_DIR_PATH+"tmp/data/data.db") - con = sqlite3.connect(Config.instance().TMP_DIR_PATH+"tmp/data/data.db") - cur = con.execute("SELECT crs, classeprojeto, maxplano,maxondulado,maxmontanhoso,tipomapa FROM PROJECT") - proj = cur.fetchone() - self.crs = proj[0] - self.class_project = proj[1] - self.dataTopo = [ - 0.0, - proj[2], - proj[2], - proj[3], - proj[3], - proj[4] - ] - con.close() - self.tipo_mapa = proj[5] - with open(Config.instance().TMP_DIR_PATH+'tmp/data/config.json', 'r') as outfile: - dados = json.load(outfile) - self.CSV_DELIMITER = dados['csv_delimiter'] - self.UNITS = dados['units'] - Config.UNITS = self.UNITS - Config.CSV_DELIMITER = self.CSV_DELIMITER - shutil.rmtree(Config.instance().TMP_DIR_PATH+'tmp') - - def savefile(self, fromf=None): - if fromf==None: - if self.filename in [None,'']: - raise Exception(u'Não é possivel salvar pois não foi aberto ou criado um novo arquivo') - extractZIP(self.filename) - else: - extractZIP(fromf) - con = sqlite3.connect(Config.instance().TMP_DIR_PATH+"tmp/data/data.db") - con.execute("UPDATE PROJECT SET crs=?,classeprojeto=?,maxplano=?,maxondulado=?,maxmontanhoso=?,tipomapa=? WHERE id=1",(self.crs,self.class_project,self.dataTopo[1],self.dataTopo[3],self.dataTopo[5],self.tipo_mapa)) - con.commit() - con.close() - Config.UNITS = self.UNITS - Config.CSV_DELIMITER = self.CSV_DELIMITER - dados = {} - dados['csv_delimiter']= self.CSV_DELIMITER - dados['units'] = self.UNITS - with open(Config.instance().TMP_DIR_PATH+'tmp/data/config.json', 'w') as outfile: - json_formatado = json.dumps(dados) - outfile.write(json_formatado) - - z = zipfile.ZipFile(u"%s" % self.filename, "w") - z.write(Config.instance().TMP_DIR_PATH+'tmp/data/data.db','data/data.db',zipfile.ZIP_DEFLATED) - z.write(Config.instance().TMP_DIR_PATH+'tmp/data/config.json','data/config.json',zipfile.ZIP_DEFLATED) - tracs = Path(Config.instance().TMP_DIR_PATH + 'tmp/data/').rglob("*.gpkg*") - for trac in tracs: - z.write(str(trac), 'data/' + trac.name, zipfile.ZIP_DEFLATED) - tracs = Path(Config.instance().TMP_DIR_PATH + 'tmp/data/').rglob("*.prism") - for trac in tracs: - z.write(str(trac), 'data/' + trac.name, zipfile.ZIP_DEFLATED) - tracs = Path(Config.instance().TMP_DIR_PATH + 'tmp/data/').rglob("*.bruck") - for trac in tracs: - z.write(str(trac), 'data/' + trac.name, zipfile.ZIP_DEFLATED) - z.close() - shutil.rmtree(Config.instance().TMP_DIR_PATH+'tmp') - - def listCRS(self, txt=''): - con = sqlite3.connect(QgsApplication.srsDatabaseFilePath()) - cur = con.cursor() - cur.execute( - "select description, srs_id from vw_srs where description like '%" + txt + "%' ORDER BY srs_id limit 0,30") - crs = self.rowCRS = cur.fetchall() - - return crs - - def listCRSID(self): - txt = 'select description from vw_srs where srs_id=' + str(self.crs) - con = sqlite3.connect(QgsApplication.srsDatabaseFilePath()) - cur = con.cursor() - cur.execute(txt) - f = cur.fetchone() - con.close() - return '' if f is None else f[0] - - def itemClick(self, crs): - self.crs = crs - - def mudancaClasseProjeto(self, pos): - self.class_project = pos - 1 - - def store(self, key, value): - assert len(key) > 0 and type(key) == str and key in self.data, "Invalid key!" - if key=="interpol": - proj = QgsProject.instance() - proj.writeEntry(Config.PLUGIN_NAME, key, str(int(value))) - else: - proj = QgsProject.instance() - proj.writeEntry(Config.PLUGIN_NAME, key, str(value)) - - def read(self, key): - assert len(key) > 0 and type(key) == str and key in self.data, "Invalid key!" - proj = QgsProject.instance() - value : str - value = proj.readEntry(Config.PLUGIN_NAME, key, str(getattr(Config, key)))[0] - if value.isdigit(): - value=int(value) - else: - try: - value=float(value) - except: - pass - setattr(self, key, value) - return value - - @classmethod - def instance(cls): - cfg=cls() - for d in cfg.data: - cfg.read(d) - setattr(Config, d, getattr(cfg, d)) - Config.fileName = cfg.FILE_PATH - try: - cfg.interpol = bool(int(cfg.interpol)) - except ValueError: - if cfg.interpol=='False': - cfg.interpol = False - if cfg.interpol=='True': - cfg.interpol = True - return cfg - +# -*- coding: utf-8 -*- +import json +import os +import shutil +import sqlite3 +import zipfile +from builtins import object +from builtins import str +from pathlib import Path + +from qgis._core import QgsApplication, QgsProject + + +def extractZIP(filename): + z = zipfile.ZipFile(filename, "r") + os.chdir(os.path.dirname(filename)) + if not os.path.exists(Config.instance().TMP_DIR_PATH+'tmp'): + os.makedirs(Config.instance().TMP_DIR_PATH+'tmp') + z.extractall(Config.instance().TMP_DIR_PATH+"tmp") + z.close() + return Path(Config.instance().TMP_DIR_PATH+'tmp/data/').rglob("*.gpkg*") + + +def compactZIP(filename): + z = zipfile.ZipFile(filename, "w") + os.chdir(os.path.dirname(filename)) + z.write(Config.instance().TMP_DIR_PATH+'tmp/data/data.db','data/data.db',zipfile.ZIP_DEFLATED) + z.write(Config.instance().TMP_DIR_PATH+'tmp/data/config.json','data/config.json',zipfile.ZIP_DEFLATED) + tracs=Path(Config.instance().TMP_DIR_PATH+'tmp/data/').rglob("*.gpkg*") + for trac in tracs: + z.write(str(trac),'data/'+trac.name,zipfile.ZIP_DEFLATED) + tracs = Path(Config.instance().TMP_DIR_PATH+'tmp/data/').rglob("*.prism") + for trac in tracs: + z.write(str(trac), 'data/' + trac.name, zipfile.ZIP_DEFLATED) + tracs = Path(Config.instance().TMP_DIR_PATH+'tmp/data/').rglob("*.bruck") + for trac in tracs: + z.write(str(trac), 'data/' + trac.name, zipfile.ZIP_DEFLATED) + + z.close() + shutil.rmtree(Config.instance().TMP_DIR_PATH+'tmp') + + +class Config(object): + # Valore padrão + + FILE_PATH="" + PLUGIN_NAME="GeoRoad" + fileName = '' + UNITS = 'm' + CSV_DELIMITER = ';' + DIST=20 + RANDOM="__ix35-_-xxx901381asdioADJ398(__" + TMP_FOLDER="GeoRoadPluginTemporaryLayers/" + T_SPACING=50 + CLASSE_INDEX=4 + crs = 2676 + planoMin = 0.0 + planoMax = 8.0 + onduladoMin = 8.0 + onduladoMax = 20.0 + montanhosoMin = 20.0 + montanhosoMax = 100.0 + TMP_DIR_PATH = RANDOM + T_OFFSET = 6 + interpol="True" + velproj=100.0 + emax=0.08 + PREC=0.1 # 10cm default precisão + + # DADOS para serem armazenados no projeto do qgis. + # Cada string nessa lista é criada como um atributo de Config.instance() que pode ser lida por + #Config.instance().nome e armazenada com Config.instance().store(nome, valor) + # Chamadas de Config.instance() em loop são pouco eficientes! Não utilizar + + data=["UNITS", + "CSV_DELIMITER", + "DIST", + "T_SPACING", + "CLASSE_INDEX", + "crs", + "planoMin", + "planoMax", + "onduladoMin", + "onduladoMax", + "montanhosoMin", + "montanhosoMax", + "T_OFFSET", + "FILE_PATH", + "interpol", + "velproj", + 'emax', + "TMP_FOLDER", + "TMP_DIR_PATH", + "PREC" + ] + + def __init__(self): + self.crs = 2676 + self.class_project = -1 + self.dataTopo = [ + 0.0, + 8.0, + 8.0, + 20.0, + 20.0, + 100.0 + ] + self.rowCRS = self.listCRS() + #self.tableCRS = self.tableCRS + #self.comboClasse = self.comboClasse + self.filename = "" + self.tipo_mapa = 3 + self.ordem_mapa = [3, 1, 10, 9] + self.ordem_units = ['m','km', 'mm'] + Config.fileName = self.filename + self.UNITS = 'm' + self.CSV_DELIMITER = ';' + Config.UNITS = self.UNITS + Config.CSV_DELIMITER = self.CSV_DELIMITER + + + def create_datatable(self,dbPath='data/data.db'): + con = sqlite3.connect(dbPath) + con.execute("CREATE TABLE if not exists PROJECT" + "(id INTEGER primary key AUTOINCREMENT, crs varchar(255), " + "classeprojeto int," + " maxplano double," + " minplano double," + "maxondulado double," + " minondulado double," + " maxmontanhoso double," + " minmontanhoso double," + " tipomapa int )") + + con.execute("CREATE TABLE if not exists TABLEESTACA" + "(id INTEGER primary key AUTOINCREMENT,name varchar(255)," + "data DATETIME DEFAULT CURRENT_TIMESTAMP)") + + con.execute("CREATE TABLE if not exists ESTACA" + "(id INTEGER primary key AUTOINCREMENT,estaca varchar(255)," + "descricao text," + "progressiva text," + "norte text," + "este text," + "cota text," + "azimute text," + "TABLEESTACA_id INTEGER," + "FOREIGN KEY(TABLEESTACA_id) REFERENCES TABLEESTACA(id)" + ")") + + con.execute("CREATE TABLE if not exists TABLECURVA" + "(id INTEGER primary key AUTOINCREMENT," + "TABLEESTACA_id INTEGER," + "data DATETIME DEFAULT CURRENT_TIMESTAMP," + "FOREIGN KEY(TABLEESTACA_id) REFERENCES TABLEESTACA(id)" + + ")") + con.execute("CREATE TABLE if not exists CURVA" + "(id INTEGER primary key AUTOINCREMENT," + "tipo INTEGER," + "estaca_inicial_id INTEGER," + "estaca_final_id INTEGER," + "velocidade INTEGER," + "raio_utilizado DOUBLE," + "emax DOUBLE," + "TABLECURVA_id INTEGER," + "data DATETIME DEFAULT CURRENT_TIMESTAMP," + "FOREIGN KEY(estaca_inicial_id) REFERENCES ESTACA(id)" + "FOREIGN KEY(estaca_final_id) REFERENCES ESTACA(id)" + "FOREIGN KEY(TABLECURVA_id) REFERENCES TABLECURVA(id)" + ")") + con.execute("CREATE TABLE if not exists CURVA_SIMPLES" + "(id INTEGER primary key AUTOINCREMENT," + "g20 DOUBLE," + "t DOUBLE," + "d DOUBLE," + "epi DOUBLE," + "epc DOUBLE," + "ept DOUBLE," + "CURVA_id INTEGER," + "data DATETIME DEFAULT CURRENT_TIMESTAMP," + "FOREIGN KEY(CURVA_id) REFERENCES CURVA(id)" + ")") + con.execute("CREATE TABLE if not exists GREIDE" + "(id INTEGER primary key AUTOINCREMENT," + "x DOUBLE," + "cota DOUBLE," + "TABLEESTACA_id INTEGER," + "FOREIGN KEY(TABLEESTACA_id) REFERENCES TABLEESTACA(id)" + + ")") + + con.execute("CREATE TABLE if not exists CURVA_VERTICAL_DADOS" + "(id INTEGER primary key AUTOINCREMENT," + "CURVA_id INTEGER," + "L DOUBLE," + "TABLEESTACA_id INTEGER," + "FOREIGN KEY(TABLEESTACA_id) REFERENCES TABLEESTACA(id)" + ")") + + con.execute("CREATE TABLE if not exists TRANSVERSAL" + "(id INTEGER primary key AUTOINCREMENT," + "x DOUBLE," + "TABLEESTACA_id INTEGER," + "FOREIGN KEY(TABLEESTACA_id) REFERENCES TABLEESTACA(id)" + ")") + + con.execute("CREATE TABLE if not exists SESSAO_TIPO" + "(id INTEGER primary key AUTOINCREMENT," + "y DOUBLE," + "cota DOUBLE," + "TRANSVERSAL_id INTEGER," + "TABLEESTACA_id INTEGER," + "FOREIGN KEY(TRANSVERSAL_id) REFERENCES TRANSVERSAL(id)," + "FOREIGN KEY(TABLEESTACA_id) REFERENCES TABLEESTACA(id)" + ")") + + con.execute("CREATE TABLE if not exists RELEVO_SESSAO" + "(id INTEGER primary key AUTOINCREMENT," + "y DOUBLE," + "cota DOUBLE," + "TRANSVERSAL_id INTEGER," + "TABLEESTACA_id INTEGER," + "FOREIGN KEY(TRANSVERSAL_id) REFERENCES TRANSVERSAL(id)," + "FOREIGN KEY(TABLEESTACA_id) REFERENCES TABLEESTACA(id)" + ")") + + con.execute("CREATE TABLE if not exists VERTICAIS_TABLE" + "(id INTEGER primary key AUTOINCREMENT," + "estaca text," + "descricao text," + "progressiva text," + "greide text," + "TABLEESTACA_id INTEGER," + "FOREIGN KEY(TABLEESTACA_id) REFERENCES TABLEESTACA(id)" + ")") + + con.execute("CREATE TABLE if not exists INTERSECT_TABLE" + "(id INTEGER primary key AUTOINCREMENT," + "estaca text," + "descricao text," + "progressiva text," + "norte text," + "este text," + "greide text," + "cota text," + "azimute text," + "TABLEESTACA_id INTEGER," + "FOREIGN KEY(TABLEESTACA_id) REFERENCES TABLEESTACA(id)" + ")") + + con.execute("CREATE TABLE if not exists BRUCKNER_TABLE" + "(id INTEGER primary key AUTOINCREMENT," + "estaca text," + "volume text," + "TABLEESTACA_id INTEGER," + "FOREIGN KEY(TABLEESTACA_id) REFERENCES TABLEESTACA(id)" + ")") + + con.commit() + return con + + + def newfile(self, filename): + self.filename = filename + if self.filename.endswith('zip'): + zip_arch_path = u"%s" % filename + else: + zip_arch_path = u"%s.zip" % filename + self.filename = zip_arch_path + Config.fileName = self.filename + f = open(zip_arch_path, 'w') + f.write('') + f.close() + os.chdir(os.path.dirname(zip_arch_path)) + if os.path.exists(Config.instance().TMP_DIR_PATH+'tmp'): + shutil.rmtree(Config.instance().TMP_DIR_PATH+'tmp') + z = zipfile.ZipFile(zip_arch_path, "w") + if not os.path.exists(Config.instance().TMP_DIR_PATH+'tmp/data'): + os.makedirs(Config.instance().TMP_DIR_PATH+'tmp/data') + os.chdir(Config.instance().TMP_DIR_PATH+'tmp') + + con = self.create_datatable() + res = con.execute("SELECT id FROM PROJECT").fetchall() + if res is None or len(res)==0: + con.execute("INSERT INTO PROJECT" + "(id,crs,classeprojeto,maxplano,minplano," + "maxondulado,minondulado,maxmontanhoso," + "minmontanhoso,tipomapa)" + "values (1,31983,0,8.0,0.0,20.0,8.0,100.0,20.0,3)") + con.commit() + + con.close() + + with open('data/config.json', 'w') as outfile: + j = json.dumps({ + 'csv_delimiter': ';', + 'units': 'm' + }) + outfile.write(j) + + z.write('data/data.db', "data/data.db", zipfile.ZIP_DEFLATED) + z.write('data/config.json', "data/config.json", zipfile.ZIP_DEFLATED) + os.chdir('..') + z.close() + shutil.rmtree(Config.instance().TMP_DIR_PATH+'tmp') + + def openfile(self, filename): + self.filename = filename + Config.fileName = self.filename + extractZIP(filename) + self.create_datatable(Config.instance().TMP_DIR_PATH+"tmp/data/data.db") + con = sqlite3.connect(Config.instance().TMP_DIR_PATH+"tmp/data/data.db") + cur = con.execute("SELECT crs, classeprojeto, maxplano,maxondulado,maxmontanhoso,tipomapa FROM PROJECT") + proj = cur.fetchone() + self.crs = proj[0] + self.class_project = proj[1] + self.dataTopo = [ + 0.0, + proj[2], + proj[2], + proj[3], + proj[3], + proj[4] + ] + con.close() + self.tipo_mapa = proj[5] + with open(Config.instance().TMP_DIR_PATH+'tmp/data/config.json', 'r') as outfile: + dados = json.load(outfile) + self.CSV_DELIMITER = dados['csv_delimiter'] + self.UNITS = dados['units'] + Config.UNITS = self.UNITS + Config.CSV_DELIMITER = self.CSV_DELIMITER + shutil.rmtree(Config.instance().TMP_DIR_PATH+'tmp') + + def savefile(self, fromf=None): + if fromf==None: + if self.filename in [None,'']: + raise Exception(u'Não é possivel salvar pois não foi aberto ou criado um novo arquivo') + extractZIP(self.filename) + else: + extractZIP(fromf) + con = sqlite3.connect(Config.instance().TMP_DIR_PATH+"tmp/data/data.db") + con.execute("UPDATE PROJECT SET crs=?,classeprojeto=?,maxplano=?,maxondulado=?,maxmontanhoso=?,tipomapa=? WHERE id=1",(self.crs,self.class_project,self.dataTopo[1],self.dataTopo[3],self.dataTopo[5],self.tipo_mapa)) + con.commit() + con.close() + Config.UNITS = self.UNITS + Config.CSV_DELIMITER = self.CSV_DELIMITER + dados = {} + dados['csv_delimiter']= self.CSV_DELIMITER + dados['units'] = self.UNITS + with open(Config.instance().TMP_DIR_PATH+'tmp/data/config.json', 'w') as outfile: + json_formatado = json.dumps(dados) + outfile.write(json_formatado) + + z = zipfile.ZipFile(u"%s" % self.filename, "w") + z.write(Config.instance().TMP_DIR_PATH+'tmp/data/data.db','data/data.db',zipfile.ZIP_DEFLATED) + z.write(Config.instance().TMP_DIR_PATH+'tmp/data/config.json','data/config.json',zipfile.ZIP_DEFLATED) + tracs = Path(Config.instance().TMP_DIR_PATH + 'tmp/data/').rglob("*.gpkg*") + for trac in tracs: + z.write(str(trac), 'data/' + trac.name, zipfile.ZIP_DEFLATED) + tracs = Path(Config.instance().TMP_DIR_PATH + 'tmp/data/').rglob("*.prism") + for trac in tracs: + z.write(str(trac), 'data/' + trac.name, zipfile.ZIP_DEFLATED) + tracs = Path(Config.instance().TMP_DIR_PATH + 'tmp/data/').rglob("*.bruck") + for trac in tracs: + z.write(str(trac), 'data/' + trac.name, zipfile.ZIP_DEFLATED) + z.close() + shutil.rmtree(Config.instance().TMP_DIR_PATH+'tmp') + + def listCRS(self, txt=''): + con = sqlite3.connect(QgsApplication.srsDatabaseFilePath()) + cur = con.cursor() + cur.execute( + "select description, srs_id from vw_srs where description like '%" + txt + "%' ORDER BY srs_id limit 0,30") + crs = self.rowCRS = cur.fetchall() + + return crs + + def listCRSID(self): + txt = 'select description from vw_srs where srs_id=' + str(self.crs) + con = sqlite3.connect(QgsApplication.srsDatabaseFilePath()) + cur = con.cursor() + cur.execute(txt) + f = cur.fetchone() + con.close() + return '' if f is None else f[0] + + def itemClick(self, crs): + self.crs = crs + + def mudancaClasseProjeto(self, pos): + self.class_project = pos - 1 + + def store(self, key, value): + assert len(key) > 0 and type(key) == str and key in self.data, "Invalid key!" + if key=="interpol": + proj = QgsProject.instance() + proj.writeEntry(Config.PLUGIN_NAME, key, str(int(value))) + else: + proj = QgsProject.instance() + proj.writeEntry(Config.PLUGIN_NAME, key, str(value)) + + def read(self, key): + assert len(key) > 0 and type(key) == str and key in self.data, "Invalid key!" + proj = QgsProject.instance() + value : str + value = proj.readEntry(Config.PLUGIN_NAME, key, str(getattr(Config, key)))[0] + if value.isdigit(): + value=int(value) + else: + try: + value=float(value) + except: + pass + setattr(self, key, value) + return value + + @classmethod + def instance(cls): + cfg=cls() + for d in cfg.data: + cfg.read(d) + setattr(Config, d, getattr(cfg, d)) + Config.fileName = cfg.FILE_PATH + try: + cfg.interpol = bool(int(cfg.interpol)) + except ValueError: + if cfg.interpol=='False': + cfg.interpol = False + if cfg.interpol=='True': + cfg.interpol = True + return cfg + diff --git a/app/model/constants.py b/app/model/constants.py old mode 100644 new mode 100755 index b62c5d6..0ca578f --- a/app/model/constants.py +++ b/app/model/constants.py @@ -1,93 +1,93 @@ -from collections import defaultdict - -Kmin = defaultdict(dict) -Kdes = defaultdict(dict) -f = defaultdict(dict) -amax = defaultdict(dict) - -listedVels=[30,40,50,60,70,80,90,100,120] - -amax[30]=1.4 -amax[40]=2.5 -amax[50]=3.9 -amax[60]=5.7 -amax[70]=7.7 -amax[80]=10.1 -amax[90]=12.8 -amax[100]=15.7 -amax[110]=19.1 -amax[120]=22.7 - - - -f[30]=0.4 -f[40]=0.37 -f[50]=0.35 -f[60]=.33 -f[70]=.31 -f[80]=.3 -f[90]=.29 -f[100]=.28 -f[110]=.25 -f[120]=.25 - -Kmin[30][False]=2 -Kmin[30][True]=4 -Kdes[30][False]=2 -Kdes[30][True]=4 - -Kmin[40][False]=5 -Kmin[40][True]=7 -Kdes[40][False]=5 -Kdes[40][True]=7 - -Kmin[50][False]=9 -Kmin[50][True]=11 -Kdes[50][False]=10 -Kdes[50][True]=12 - -Kmin[60][False]=14 -Kmin[60][True]=15 -Kdes[60][False]=18 -Kdes[60][True]=17 - -Kmin[70][False]=20 -Kmin[70][True]=19 -Kdes[70][False]=29 -Kdes[70][True]=24 - -Kmin[80][False]=29 -Kmin[80][True]=24 -Kdes[80][False]=48 -Kdes[80][True]=32 - -Kmin[90][False]=41 -Kmin[90][True]=29 -Kdes[90][False]=74 -Kdes[90][True]=42 - -Kmin[100][False]=58 -Kmin[100][True]=36 -Kdes[100][False]=107 -Kdes[100][True]=52 - -Kmin[110][False]=79 -Kmin[110][True]=43 -Kdes[110][False]=164 -Kdes[110][True]=66 - -Kmin[120][False]=102 -Kmin[120][True]=50 -Kdes[120][False]=233 -Kdes[120][True]=80 - - - - - - - - - - - +from collections import defaultdict + +Kmin = defaultdict(dict) +Kdes = defaultdict(dict) +f = defaultdict(dict) +amax = defaultdict(dict) + +listedVels=[30,40,50,60,70,80,90,100,120] + +amax[30]=1.4 +amax[40]=2.5 +amax[50]=3.9 +amax[60]=5.7 +amax[70]=7.7 +amax[80]=10.1 +amax[90]=12.8 +amax[100]=15.7 +amax[110]=19.1 +amax[120]=22.7 + + + +f[30]=0.4 +f[40]=0.37 +f[50]=0.35 +f[60]=.33 +f[70]=.31 +f[80]=.3 +f[90]=.29 +f[100]=.28 +f[110]=.25 +f[120]=.25 + +Kmin[30][False]=2 +Kmin[30][True]=4 +Kdes[30][False]=2 +Kdes[30][True]=4 + +Kmin[40][False]=5 +Kmin[40][True]=7 +Kdes[40][False]=5 +Kdes[40][True]=7 + +Kmin[50][False]=9 +Kmin[50][True]=11 +Kdes[50][False]=10 +Kdes[50][True]=12 + +Kmin[60][False]=14 +Kmin[60][True]=15 +Kdes[60][False]=18 +Kdes[60][True]=17 + +Kmin[70][False]=20 +Kmin[70][True]=19 +Kdes[70][False]=29 +Kdes[70][True]=24 + +Kmin[80][False]=29 +Kmin[80][True]=24 +Kdes[80][False]=48 +Kdes[80][True]=32 + +Kmin[90][False]=41 +Kmin[90][True]=29 +Kdes[90][False]=74 +Kdes[90][True]=42 + +Kmin[100][False]=58 +Kmin[100][True]=36 +Kdes[100][False]=107 +Kdes[100][True]=52 + +Kmin[110][False]=79 +Kmin[110][True]=43 +Kdes[110][False]=164 +Kdes[110][True]=66 + +Kmin[120][False]=102 +Kmin[120][True]=50 +Kdes[120][False]=233 +Kdes[120][True]=80 + + + + + + + + + + + diff --git a/app/model/curvas.py b/app/model/curvas.py old mode 100644 new mode 100755 index 3b239a5..fbce977 --- a/app/model/curvas.py +++ b/app/model/curvas.py @@ -1,238 +1,238 @@ -import csv -import math -# -*- coding: utf-8 -*- -import sqlite3 -from builtins import object -from builtins import range -from builtins import str - -from ..model.config import extractZIP, Config, compactZIP -from ..model.sqlitedb import DB - -class Curvas(object): - def __init__(self, id_filename): - self.id_filename = id_filename - - def list_curvas(self): - extractZIP(Config.fileName) - con = sqlite3.connect(Config.instance().TMP_DIR_PATH+"tmp/data/data.db") - curvas = con.execute( - "SELECT CURVA.id,CURVA.tipo,CURVA.velocidade,CURVA.raio_utilizado,CURVA.emax,CURVA.estaca_inicial_id,CURVA.estaca_final_id FROM CURVA INNER JOIN TABLECURVA ON CURVA.TABLECURVA_id=TABLECURVA.id WHERE TABLECURVA.TABLEESTACA_id=%d" % self.id_filename).fetchall() - con.close() - compactZIP(Config.fileName) - return curvas - - def get_curva_details(self,id_estaca=-1,id_curva=-1): - extractZIP(Config.fileName) - con = sqlite3.connect(Config.instance().TMP_DIR_PATH+"tmp/data/data.db") - if id_curva == -1: - curva = con.execute("SELECT CURVA_id,g20,t,d,epi,epc,ept FROM CURVA_SIMPLES INNER JOIN CURVA ON CURVA_SIMPLES.CURVA_id=CURVA.id WHERE estaca_final_id=%d"%(id_estaca,)).fetchall() - else: - curva = con.execute("SELECT CURVA_id,g20,t,d,epi,epc,ept FROM CURVA_SIMPLES INNER JOIN CURVA ON CURVA_SIMPLES.CURVA_id=CURVA.id WHERE CURVA.id=%d"%(id_curva,)).fetchall() - con.close() - compactZIP(Config.fileName) - if len(curva)>0: - return curva[0] - else: - return None - - def get_curva(self, id_curva): - extractZIP(Config.fileName) - con = sqlite3.connect(Config.instance().TMP_DIR_PATH+"tmp/data/data.db") - curva = con.execute( - "SELECT CURVA.id,CURVA.tipo,CURVA.velocidade,CURVA.raio_utilizado,CURVA.emax,CURVA.estaca_inicial_id,CURVA.estaca_final_id FROM CURVA WHERE CURVA.id = ?", - (id_curva,)).fetchall() - con.close() - compactZIP(Config.fileName) - if len(curva) > 0: - return curva[0] - else: - return None - - #LISTA OS VERTICES - def list_estacas(self): - extractZIP(Config.fileName) - con = sqlite3.connect(Config.instance().TMP_DIR_PATH+"tmp/data/data.db") - est = con.execute( - "SELECT id,estaca,descricao,progressiva,norte,este,cota,azimute FROM ESTACA WHERE TABLEESTACA_id = ? AND (estaca LIKE '%%+%%' OR estaca LIKE '0')", - (int(self.id_filename),)).fetchall() - con.close() - compactZIP(Config.fileName) - return est - - def get_estaca_by_id(self,ident): - extractZIP(Config.fileName) - con = sqlite3.connect(Config.instance().TMP_DIR_PATH+"tmp/data/data.db") - estacas = con.execute( - "SELECT id,estaca,descricao,progressiva,norte,este,cota,azimute FROM ESTACA WHERE id = ?", - (int(ident),)).fetchall() - con.close() - compactZIP(Config.fileName) - return [] if len(estacas)==0 else estacas[0] - - def get_estacas_interval(self,de,ate): - extractZIP(Config.fileName) - con = sqlite3.connect(Config.instance().TMP_DIR_PATH+"tmp/data/data.db") - - estacas = con.execute( - "SELECT estaca,descricao,progressiva,norte,este,cota,azimute FROM ESTACA WHERE TABLEESTACA_id = ? AND (cast(progressiva as REAL)>=? OR cast(progressiva as REAL)<=?)", - (int(self.id_filename),float(de),float(ate))).fetchall() - - con.close() - compactZIP(Config.fileName) - return estacas - - def gera_estacas_intermediarias(self,dist,epc,ept,g20): - estacas = [] - estaca_start_vert = epc//dist - estaca_end_vert = ept//dist - estaca_start_sobra = float((epc/dist)-estaca_start_vert)*dist - estaca_end_sobra = float((ept/dist)-estaca_end_vert)*dist - extractZIP(Config.fileName) - con = sqlite3.connect(Config.instance().TMP_DIR_PATH+"tmp/data/data.db") - estaca_start = con.execute( - "SELECT id,estaca,descricao,progressiva,norte,este,cota,azimute FROM ESTACA WHERE TABLEESTACA_id = ? AND estaca LIKE ?", - (int(self.id_filename),'%d%%'%estaca_start_vert)).fetchall() - estaca_end = con.execute( - "SELECT id,estaca,descricao,progressiva,norte,este,cota,azimute FROM ESTACA WHERE TABLEESTACA_id = ? AND estaca LIKE ?", - (int(self.id_filename),'%d%%'%estaca_end_vert)).fetchall() - con.close() - compactZIP(Config.fileName) - estaca_inicial_north = float(estaca_start[0][4])+(epc-float(estaca_start[0][3]))*math.cos(float(estaca_start[0][7])*math.pi/180) - estaca_inicial_este = float(estaca_start[0][5])+(epc-float(estaca_start[0][3]))*math.sin(float(estaca_start[0][7])*math.pi/180) - estaca_inicial = [ - '%d+%f'%(estaca_start_vert,estaca_start_sobra), - 'epc', - '%f'%epc, - '%f'%estaca_inicial_north, - '%f'%estaca_inicial_este, - '%f'%float(estaca_start[0][6]), - '%f'%float(estaca_start[0][7]) - ] - estacas.append(estaca_inicial) - deflexao_acumulada = 0.0 - progressiva = float(estaca_start[0][3]) - est = estaca_start_vert - for i in range(abs(int(estaca_end_vert-estaca_start_vert))): - progressiva+=dist - est += 1 - deflexao = (float(dist)-estaca_start_sobra)*(g20/40) if deflexao_acumulada == 0.0 else (g20/2) - deflexao_acumulada += deflexao - - azimute = float(estaca_start[0][7])-deflexao_acumulada - north = float(estaca_start[0][4])+(progressiva-float(estaca_start[0][3]))*math.cos(float(azimute)*math.pi/180) - este = float(estaca_start[0][5])+(progressiva-float(estaca_start[0][3]))*math.sin(float(azimute)*math.pi/180) - estaca = [ - '%d'%est, - '', - '%f'%progressiva, - '%f'%north, - '%f'%este, - '%f'%float(estaca_start[0][6]), - '%f'%azimute - ] - estacas.append(estaca) - - deflexao = estaca_end_sobra*(g20/40.) - deflexao_acumulada += deflexao - azimute = float(estaca_start[0][7])-deflexao_acumulada - estaca_end_north = float(estaca_start[0][4])+(epc-float(estaca_start[0][3]))*math.cos(float(azimute)*math.pi/180) - estaca_end_este = float(estaca_start[0][5])+(epc-float(estaca_start[0][3]))*math.sin(float(azimute)*math.pi/180) - - estaca = [ - '%d+%f'%(estaca_end_vert,estaca_end_sobra), - 'ept', - '%f'%ept, - '%f'%estaca_end_north, - '%f'%estaca_end_este, - '%f'%float(estaca_start[0][6]), - '%f'%azimute - ] - estacas.append(estaca) - return estacas - - def gera_estacas(self,dist): - curvas = self.list_curvas() - estacas = [] - indice = 0 - for curva in curvas: - curva_detalhes = self.get_curva_details(id_curva=int(curva[0])) - if curva_detalhes is None: - continue - estaca_inicial = self.get_estaca_by_id(int(curva[5])) - estaca_final = self.get_estaca_by_id(int(curva[6])) - estacas_ant = self.get_estacas_interval(float(estaca_inicial[3]),float(estaca_final[3])) - estacas.extend(estacas_ant) - - g20 = float(curva_detalhes[1]) - epc = float(curva_detalhes[5]) - ept = float(curva_detalhes[6]) - - estacas.extend(self.gera_estacas_intermediarias(dist,epc,ept,g20)) - return estacas - - def save_CSV(self, filename, estacas): - delimiter = str(Config.CSV_DELIMITER.strip()[0]) - with open(filename, "wb") as fo: - writer = csv.writer(fo, delimiter=delimiter, dialect='excel') - for r in estacas: - writer.writerow(r) - - def delete_curva(self, id, dados): - extractZIP(Config.fileName) - db=DB(Config.instance().TMP_DIR_PATH+"tmp/data/data.db", "CURVAS_DADOS", list(dados.keys())) - db.apagarDado(id) - compactZIP(Config.fileName) - return True - - def new(self, dados): - '''Verifico se há curva para o traçado''' - extractZIP(Config.fileName) - db=DB(Config.instance().TMP_DIR_PATH+"tmp/data/data.db", "CURVAS_DADOS", list(dados.keys())) - id=db.salvarDado(dados) - compactZIP(Config.fileName) - return id - - def edit(self, dados): - '''Verifico se há curva para o traçado''' - extractZIP(Config.fileName) - db=DB(Config.instance().TMP_DIR_PATH+"tmp/data/data.db", "CURVAS_DADOS", list(dados.keys())) - ids=db.acharDadoExato('file', self.id_filename) - id=[db.getDadoComId(i)['id'] for i in ids if db.getDadoComId(i)['curva']==dados["curva"]][-1] - db.update(id,dados) - compactZIP(Config.fileName) - - def getId(self, name, dados): - extractZIP(Config.fileName) - from ..model.sqlitedb import DB - db = DB(Config.instance().TMP_DIR_PATH + "tmp/data/data.db", "CURVAS_DADOS", list(dados.keys())) - ids = db.acharDadoExato("file", self.id_filename) - id = [db.getDadoComId(i)['id'] for i in ids if db.getDado(i)['curva']==name] - dados = db.getDado(id[-1]) if id else dados - compactZIP(Config.fileName) - return id[-1] if id else False, dados - - def duplicate(self, newName, new_id, path): - dados = ['file', 'tipo', 'curva', 'vel', 'emax', 'ls', 'R', 'fmax', 'D'] - extractZIP(Config.fileName) - db=DB(Config.instance().TMP_DIR_PATH+"tmp/data/data.db", "CURVAS_DADOS", dados) - ids=db.acharDadoExato('file', self.id_filename) - dados=[db.getDado(i) for i in ids] - for i,_ in enumerate(dados): - dados[i]['file']=new_id - [db.salvarDado(dado)for dado in dados] - - from pathlib import Path - import shutil - path = Path(path.split('|layername=')[0]) - for p in Path(path.parent).rglob("*"): - shutil.copy(str(p), Config.instance().TMP_DIR_PATH + "tmp/data/"+newName+"".join(p.suffixes)) - compactZIP(Config.fileName) - - def erase(self): - dados = ['file', 'tipo', 'curva', 'vel', 'emax', 'ls', 'R', 'fmax', 'D'] - extractZIP(Config.fileName) - db=DB(Config.instance().TMP_DIR_PATH+"tmp/data/data.db", "CURVAS_DADOS", dados) - ids=db.acharDadoExato('file', self.id_filename) - [db.apagarDado(id) for id in ids] - compactZIP(Config.fileName) +import csv +import math +# -*- coding: utf-8 -*- +import sqlite3 +from builtins import object +from builtins import range +from builtins import str + +from ..model.config import extractZIP, Config, compactZIP +from ..model.sqlitedb import DB + +class Curvas(object): + def __init__(self, id_filename): + self.id_filename = id_filename + + def list_curvas(self): + extractZIP(Config.fileName) + con = sqlite3.connect(Config.instance().TMP_DIR_PATH+"tmp/data/data.db") + curvas = con.execute( + "SELECT CURVA.id,CURVA.tipo,CURVA.velocidade,CURVA.raio_utilizado,CURVA.emax,CURVA.estaca_inicial_id,CURVA.estaca_final_id FROM CURVA INNER JOIN TABLECURVA ON CURVA.TABLECURVA_id=TABLECURVA.id WHERE TABLECURVA.TABLEESTACA_id=%d" % self.id_filename).fetchall() + con.close() + compactZIP(Config.fileName) + return curvas + + def get_curva_details(self,id_estaca=-1,id_curva=-1): + extractZIP(Config.fileName) + con = sqlite3.connect(Config.instance().TMP_DIR_PATH+"tmp/data/data.db") + if id_curva == -1: + curva = con.execute("SELECT CURVA_id,g20,t,d,epi,epc,ept FROM CURVA_SIMPLES INNER JOIN CURVA ON CURVA_SIMPLES.CURVA_id=CURVA.id WHERE estaca_final_id=%d"%(id_estaca,)).fetchall() + else: + curva = con.execute("SELECT CURVA_id,g20,t,d,epi,epc,ept FROM CURVA_SIMPLES INNER JOIN CURVA ON CURVA_SIMPLES.CURVA_id=CURVA.id WHERE CURVA.id=%d"%(id_curva,)).fetchall() + con.close() + compactZIP(Config.fileName) + if len(curva)>0: + return curva[0] + else: + return None + + def get_curva(self, id_curva): + extractZIP(Config.fileName) + con = sqlite3.connect(Config.instance().TMP_DIR_PATH+"tmp/data/data.db") + curva = con.execute( + "SELECT CURVA.id,CURVA.tipo,CURVA.velocidade,CURVA.raio_utilizado,CURVA.emax,CURVA.estaca_inicial_id,CURVA.estaca_final_id FROM CURVA WHERE CURVA.id = ?", + (id_curva,)).fetchall() + con.close() + compactZIP(Config.fileName) + if len(curva) > 0: + return curva[0] + else: + return None + + #LISTA OS VERTICES + def list_estacas(self): + extractZIP(Config.fileName) + con = sqlite3.connect(Config.instance().TMP_DIR_PATH+"tmp/data/data.db") + est = con.execute( + "SELECT id,estaca,descricao,progressiva,norte,este,cota,azimute FROM ESTACA WHERE TABLEESTACA_id = ? AND (estaca LIKE '%%+%%' OR estaca LIKE '0')", + (int(self.id_filename),)).fetchall() + con.close() + compactZIP(Config.fileName) + return est + + def get_estaca_by_id(self,ident): + extractZIP(Config.fileName) + con = sqlite3.connect(Config.instance().TMP_DIR_PATH+"tmp/data/data.db") + estacas = con.execute( + "SELECT id,estaca,descricao,progressiva,norte,este,cota,azimute FROM ESTACA WHERE id = ?", + (int(ident),)).fetchall() + con.close() + compactZIP(Config.fileName) + return [] if len(estacas)==0 else estacas[0] + + def get_estacas_interval(self,de,ate): + extractZIP(Config.fileName) + con = sqlite3.connect(Config.instance().TMP_DIR_PATH+"tmp/data/data.db") + + estacas = con.execute( + "SELECT estaca,descricao,progressiva,norte,este,cota,azimute FROM ESTACA WHERE TABLEESTACA_id = ? AND (cast(progressiva as REAL)>=? OR cast(progressiva as REAL)<=?)", + (int(self.id_filename),float(de),float(ate))).fetchall() + + con.close() + compactZIP(Config.fileName) + return estacas + + def gera_estacas_intermediarias(self,dist,epc,ept,g20): + estacas = [] + estaca_start_vert = epc//dist + estaca_end_vert = ept//dist + estaca_start_sobra = float((epc/dist)-estaca_start_vert)*dist + estaca_end_sobra = float((ept/dist)-estaca_end_vert)*dist + extractZIP(Config.fileName) + con = sqlite3.connect(Config.instance().TMP_DIR_PATH+"tmp/data/data.db") + estaca_start = con.execute( + "SELECT id,estaca,descricao,progressiva,norte,este,cota,azimute FROM ESTACA WHERE TABLEESTACA_id = ? AND estaca LIKE ?", + (int(self.id_filename),'%d%%'%estaca_start_vert)).fetchall() + estaca_end = con.execute( + "SELECT id,estaca,descricao,progressiva,norte,este,cota,azimute FROM ESTACA WHERE TABLEESTACA_id = ? AND estaca LIKE ?", + (int(self.id_filename),'%d%%'%estaca_end_vert)).fetchall() + con.close() + compactZIP(Config.fileName) + estaca_inicial_north = float(estaca_start[0][4])+(epc-float(estaca_start[0][3]))*math.cos(float(estaca_start[0][7])*math.pi/180) + estaca_inicial_este = float(estaca_start[0][5])+(epc-float(estaca_start[0][3]))*math.sin(float(estaca_start[0][7])*math.pi/180) + estaca_inicial = [ + '%d+%f'%(estaca_start_vert,estaca_start_sobra), + 'epc', + '%f'%epc, + '%f'%estaca_inicial_north, + '%f'%estaca_inicial_este, + '%f'%float(estaca_start[0][6]), + '%f'%float(estaca_start[0][7]) + ] + estacas.append(estaca_inicial) + deflexao_acumulada = 0.0 + progressiva = float(estaca_start[0][3]) + est = estaca_start_vert + for i in range(abs(int(estaca_end_vert-estaca_start_vert))): + progressiva+=dist + est += 1 + deflexao = (float(dist)-estaca_start_sobra)*(g20/40) if deflexao_acumulada == 0.0 else (g20/2) + deflexao_acumulada += deflexao + + azimute = float(estaca_start[0][7])-deflexao_acumulada + north = float(estaca_start[0][4])+(progressiva-float(estaca_start[0][3]))*math.cos(float(azimute)*math.pi/180) + este = float(estaca_start[0][5])+(progressiva-float(estaca_start[0][3]))*math.sin(float(azimute)*math.pi/180) + estaca = [ + '%d'%est, + '', + '%f'%progressiva, + '%f'%north, + '%f'%este, + '%f'%float(estaca_start[0][6]), + '%f'%azimute + ] + estacas.append(estaca) + + deflexao = estaca_end_sobra*(g20/40.) + deflexao_acumulada += deflexao + azimute = float(estaca_start[0][7])-deflexao_acumulada + estaca_end_north = float(estaca_start[0][4])+(epc-float(estaca_start[0][3]))*math.cos(float(azimute)*math.pi/180) + estaca_end_este = float(estaca_start[0][5])+(epc-float(estaca_start[0][3]))*math.sin(float(azimute)*math.pi/180) + + estaca = [ + '%d+%f'%(estaca_end_vert,estaca_end_sobra), + 'ept', + '%f'%ept, + '%f'%estaca_end_north, + '%f'%estaca_end_este, + '%f'%float(estaca_start[0][6]), + '%f'%azimute + ] + estacas.append(estaca) + return estacas + + def gera_estacas(self,dist): + curvas = self.list_curvas() + estacas = [] + indice = 0 + for curva in curvas: + curva_detalhes = self.get_curva_details(id_curva=int(curva[0])) + if curva_detalhes is None: + continue + estaca_inicial = self.get_estaca_by_id(int(curva[5])) + estaca_final = self.get_estaca_by_id(int(curva[6])) + estacas_ant = self.get_estacas_interval(float(estaca_inicial[3]),float(estaca_final[3])) + estacas.extend(estacas_ant) + + g20 = float(curva_detalhes[1]) + epc = float(curva_detalhes[5]) + ept = float(curva_detalhes[6]) + + estacas.extend(self.gera_estacas_intermediarias(dist,epc,ept,g20)) + return estacas + + def save_CSV(self, filename, estacas): + delimiter = str(Config.CSV_DELIMITER.strip()[0]) + with open(filename, "wb") as fo: + writer = csv.writer(fo, delimiter=delimiter, dialect='excel') + for r in estacas: + writer.writerow(r) + + def delete_curva(self, id, dados): + extractZIP(Config.fileName) + db=DB(Config.instance().TMP_DIR_PATH+"tmp/data/data.db", "CURVAS_DADOS", list(dados.keys())) + db.apagarDado(id) + compactZIP(Config.fileName) + return True + + def new(self, dados): + '''Verifico se há curva para o traçado''' + extractZIP(Config.fileName) + db=DB(Config.instance().TMP_DIR_PATH+"tmp/data/data.db", "CURVAS_DADOS", list(dados.keys())) + id=db.salvarDado(dados) + compactZIP(Config.fileName) + return id + + def edit(self, dados): + '''Verifico se há curva para o traçado''' + extractZIP(Config.fileName) + db=DB(Config.instance().TMP_DIR_PATH+"tmp/data/data.db", "CURVAS_DADOS", list(dados.keys())) + ids=db.acharDadoExato('file', self.id_filename) + id=[db.getDadoComId(i)['id'] for i in ids if db.getDadoComId(i)['curva']==dados["curva"]][-1] + db.update(id,dados) + compactZIP(Config.fileName) + + def getId(self, name, dados): + extractZIP(Config.fileName) + from ..model.sqlitedb import DB + db = DB(Config.instance().TMP_DIR_PATH + "tmp/data/data.db", "CURVAS_DADOS", list(dados.keys())) + ids = db.acharDadoExato("file", self.id_filename) + id = [db.getDadoComId(i)['id'] for i in ids if db.getDado(i)['curva']==name] + dados = db.getDado(id[-1]) if id else dados + compactZIP(Config.fileName) + return id[-1] if id else False, dados + + def duplicate(self, newName, new_id, path): + dados = ['file', 'tipo', 'curva', 'vel', 'emax', 'ls', 'R', 'fmax', 'D'] + extractZIP(Config.fileName) + db=DB(Config.instance().TMP_DIR_PATH+"tmp/data/data.db", "CURVAS_DADOS", dados) + ids=db.acharDadoExato('file', self.id_filename) + dados=[db.getDado(i) for i in ids] + for i,_ in enumerate(dados): + dados[i]['file']=new_id + [db.salvarDado(dado)for dado in dados] + + from pathlib import Path + import shutil + path = Path(path.split('|layername=')[0]) + for p in Path(path.parent).rglob("*"): + shutil.copy(str(p), Config.instance().TMP_DIR_PATH + "tmp/data/"+newName+"".join(p.suffixes)) + compactZIP(Config.fileName) + + def erase(self): + dados = ['file', 'tipo', 'curva', 'vel', 'emax', 'ls', 'R', 'fmax', 'D'] + extractZIP(Config.fileName) + db=DB(Config.instance().TMP_DIR_PATH+"tmp/data/data.db", "CURVAS_DADOS", dados) + ids=db.acharDadoExato('file', self.id_filename) + [db.apagarDado(id) for id in ids] + compactZIP(Config.fileName) diff --git a/app/model/estacas.py b/app/model/estacas.py old mode 100644 new mode 100755 index 13935b0..4835716 --- a/app/model/estacas.py +++ b/app/model/estacas.py @@ -1,888 +1,888 @@ -# -*- coding: utf-8 -*- -import csv -import math -import sqlite3 -import json -from builtins import object -from builtins import range -from builtins import str -from copy import deepcopy -from pathlib import Path - -from qgis._core import QgsPoint, QgsProject, QgsVectorFileWriter, QgsPointXY - -from ..controller.Geometria.Figure import prismoide -from ..model.config import extractZIP, Config, compactZIP -from ..model.curvas import Curvas -from ..model.utils import pairs, length, dircos, diff, azimuth, getElevation, pointToWGS84, roundFloat2str, msgLog, p2QgsPoint -from ..view.estacas import SelectFeatureDialog - - -class Estacas(object): - def __init__(self, distancia=20, estaca=0, layer=None, filename='', table=list(), cvData=list(),ultimo=-1, id_filename=-1, iface=None): - self.iface=iface - self.distancia = distancia - self.filename = filename - self.estaca = estaca - self.layer = layer - self.table = table - self.xList = [] - self.ultimo = ultimo - self.id_filename = id_filename - self.ask=True - - def get_features(self): - linhas = [] - for feature in self.layer.getFeatures(): - geom = feature.geometry().asPolyline() - for i in geom: - linhas.append(i) - return linhas - - def new(self, distancia, estaca, layer, filename, iface=None): - self.__init__(distancia, estaca, layer, filename, list(), self.ultimo, self.id_filename, iface=iface) - extractZIP(Config.fileName) - con = sqlite3.connect(Config.instance().TMP_DIR_PATH+"tmp/data/data.db") - con.execute("INSERT INTO TABLEESTACA (name) values ('" + filename + "')") - con.commit() - id_estaca = con.execute("SELECT last_insert_rowid()").fetchone() - con.close() - compactZIP(Config.fileName) - self.ultimo = id_estaca[0] - self.table = self.create_estacas() - return self.ultimo, self.table - - def calcular(self, task=None, layer=None): - self.layer=layer - self.table = self.create_estacas(isCalc=True, task=task) - return self.table - - def newEmpty(self, distancia, filename): - self.__init__(distancia=distancia, filename=filename, ultimo=self.ultimo) - extractZIP(Config.fileName) - con = sqlite3.connect(Config.instance().TMP_DIR_PATH+"tmp/data/data.db") - con.execute("INSERT INTO TABLEESTACA (name) values ('" + filename + "')") - con.commit() - id_estaca = con.execute("SELECT last_insert_rowid()").fetchone()[0] - con.close() - compactZIP(Config.fileName) - return id_estaca, [] - - def getNewId(self): - extractZIP(Config.fileName) - con = sqlite3.connect(Config.instance().TMP_DIR_PATH+"tmp/data/data.db") - id_estaca = con.execute("SELECT last_insert_rowid()").fetchone() - con.close() - compactZIP(Config.fileName) - return id_estaca[0] - - def saveEstacas(self,filename,estacas): - extractZIP(Config.fileName) - con = sqlite3.connect(Config.instance().TMP_DIR_PATH+"tmp/data/data.db") - con.execute("INSERT INTO TABLEESTACA (name) values ('" + filename + "')") - con.commit() - id_estaca = con.execute("SELECT last_insert_rowid()").fetchone() - con.close() - compactZIP(Config.fileName) - model=Estacas(filename=filename, id_filename=id_estaca[0]) - model.ultimo = id_estaca[0] - model.table = estacas - model.save(id_estaca[0]) - - return model - - def saveVerticais(self, table): - try: - extractZIP(Config.fileName) - con = sqlite3.connect(Config.instance().TMP_DIR_PATH+"tmp/data/data.db") - con.execute("DELETE FROM VERTICAIS_TABLE WHERE TABLEESTACA_id=?", (self.id_filename,)) - - for linha in table: - linha=list(linha) - linha.append(int(self.id_filename)) - lt = tuple(linha) - con.execute( - "INSERT INTO VERTICAIS_TABLE (estaca,descricao,progressiva,greide,TABLEESTACA_id)" - "values(?,?,?,?,?)", - lt) - con.isolation_level = None - con.execute("VACUUM") - con.isolation_level = '' - con.commit() - - con.close() - compactZIP(Config.fileName) - - return True - except sqlite3.OperationalError: - return False - - def saveIntersect(self, table): - try: - extractZIP(Config.fileName) - con = sqlite3.connect(Config.instance().TMP_DIR_PATH+"tmp/data/data.db") - con.execute("DELETE FROM INTERSECT_TABLE WHERE TABLEESTACA_id=?", (self.id_filename,)) - - for linha in table: - linha=list(linha) - linha.append(int(self.id_filename)) - lt = tuple(linha) - con.execute( - "INSERT INTO INTERSECT_TABLE (estaca,descricao,progressiva,norte,este,greide,cota," - "azimute,TABLEESTACA_id)values(?,?,?,?,?,?,?,?,?)", - lt) - con.isolation_level = None - con.execute("VACUUM") - con.isolation_level = '' - con.commit() - - con.close() - compactZIP(Config.fileName) - return True - - except sqlite3.OperationalError: - return False - - - def saveBruckner(self, table): - try: - extractZIP(Config.fileName) - con = sqlite3.connect(Config.instance().TMP_DIR_PATH+"tmp/data/data.db") - con.execute("DELETE FROM BRUCKNER_TABLE WHERE TABLEESTACA_id=?", (self.id_filename,)) - - for linha in table: - linha=list(linha) - linha.append(int(self.id_filename)) - lt = tuple(linha) - con.execute( - "INSERT INTO BRUCKNER_TABLE (estaca, volume,TABLEESTACA_id)values(?,?,?)", - lt) - con.isolation_level = None - con.execute("VACUUM") - con.isolation_level = '' - con.commit() - - con.close() - compactZIP(Config.fileName) - return True - - except sqlite3.OperationalError: - return False - - def cleanBruckner(self, keepLines=False): - from pathlib import Path - extractZIP(Config.fileName) - con = sqlite3.connect(Config.instance().TMP_DIR_PATH + "tmp/data/data.db") - con.execute("DELETE FROM BRUCKNER_TABLE WHERE TABLEESTACA_id=?", (self.id_filename,)) - con.isolation_level = None - con.execute("VACUUM") - con.isolation_level = '' - con.commit() - con.close() - compactZIP(Config.fileName) - if keepLines: - bruck=self.load_bruck() - extractZIP(Config.fileName) - Path(Config.instance().TMP_DIR_PATH+"tmp/data/"+str(self.id_filename)+".bruck").unlink() - compactZIP(Config.fileName) - del bruck['table'] - self.save_bruck(bruck) - else: - extractZIP(Config.fileName) - Path(Config.instance().TMP_DIR_PATH+"tmp/data/"+str(self.id_filename)+".bruck").unlink() - compactZIP(Config.fileName) - return True - - def getCurvas(self, id_filename): - # instancia da model de curvas. - curva_model = Curvas(id_filename) - return curva_model.list_curvas() - - def getCRS(self): - extractZIP(Config.fileName) - con = sqlite3.connect(Config.instance().TMP_DIR_PATH+"tmp/data/data.db") - proj = con.execute("SELECT crs FROM PROJECT where id = 1").fetchone() - crs = proj[0] - con.close() - compactZIP(Config.fileName) - return crs - - def tipo(self): - extractZIP(Config.fileName) - con = sqlite3.connect(Config.instance().TMP_DIR_PATH+"tmp/data/data.db") - proj = con.execute( - "SELECT crs, classeprojeto, maxplano,maxondulado,maxmontanhoso,tipomapa FROM PROJECT where id = 1").fetchone() - - class_project = proj[1] - dataTopo = [ - 0.0, - proj[2], - proj[2], - proj[3], - proj[3], - proj[4] - ] - con.close() - compactZIP(Config.fileName) - return dataTopo, class_project - - def recalcular(self, distancia, estaca, layer, ask=True): - self.__init__(distancia, estaca, layer, self.filename, list(), self.ultimo, self.id_filename) - self.ask=ask - self.table = self.create_estacas() - self.ask=False - return self.table - - def loadFilename(self): - if self.id_filename == -1: return None - extractZIP(Config.fileName) - con = sqlite3.connect(Config.instance().TMP_DIR_PATH+"tmp/data/data.db") - est = con.execute( - "SELECT estaca,descricao,progressiva,norte,este,cota,azimute FROM ESTACA WHERE TABLEESTACA_id = ?", - (int(self.id_filename),)).fetchall() - con.close() - compactZIP(Config.fileName) - return est - - def listTables(self): - extractZIP(Config.fileName) - con = sqlite3.connect(Config.instance().TMP_DIR_PATH+"tmp/data/data.db") - est = con.execute("SELECT id,name,data FROM TABLEESTACA").fetchall() - con.close() - compactZIP(Config.fileName) - return est - - def load_verticais(self): - if self.id_filename == -1: return None - extractZIP(Config.fileName) - con = sqlite3.connect(Config.instance().TMP_DIR_PATH+"tmp/data/data.db") - est = con.execute( - "select estaca,descricao,progressiva,greide from verticais_table where tableestaca_id = ?", - (int(self.id_filename),)).fetchall() - con.close() - compactZIP(Config.fileName) - return est - - def load_terreno_long(self): - if self.id_filename == -1: return None - extractZIP(Config.fileName) - con = sqlite3.connect(Config.instance().TMP_DIR_PATH + "tmp/data/data.db") - est = con.execute( - "select descricao,progressiva,cota from ESTACA where tableestaca_id = ?", - (int(self.id_filename),)).fetchall() - con.close() - compactZIP(Config.fileName) - return est - - def load_intersect(self, id_filename=None): - if id_filename is None: - id_filename=self.id_filename - if id_filename == -1: return None - extractZIP(Config.fileName) - con = sqlite3.connect(Config.instance().TMP_DIR_PATH+"tmp/data/data.db") - est = con.execute( - "SELECT estaca,descricao,progressiva,norte,este,greide,cota,azimute FROM INTERSECT_TABLE WHERE TABLEESTACA_id = ?", - (int(id_filename),)).fetchall() - con.close() - compactZIP(Config.fileName) - return est - - def load_bruckner(self): - if self.id_filename == -1: return None - extractZIP(Config.fileName) - con = sqlite3.connect(Config.instance().TMP_DIR_PATH+"tmp/data/data.db") - est = con.execute( - "SELECT estaca, volume FROM BRUCKNER_TABLE WHERE TABLEESTACA_id = ?", - (int(self.id_filename),)).fetchall() - con.close() - compactZIP(Config.fileName) - return est - - def getNameFromId(self,id): - extractZIP(Config.fileName) - con = sqlite3.connect(Config.instance().TMP_DIR_PATH+"tmp/data/data.db") - name = con.execute("SELECT name FROM TABLEESTACA WHERE id=?", (str(id),)).fetchall() - con.close() - compactZIP(Config.fileName) - if name[0][0]: - return str(name[0][0]) - else: - return "" - - def deleteEstaca(self, idEstacaTable): - self.removeGeoPackage(self.getNameFromId(idEstacaTable)) - extractZIP(Config.fileName) - con = sqlite3.connect(Config.instance().TMP_DIR_PATH+"tmp/data/data.db") - con.execute("DELETE FROM ESTACA WHERE TABLEESTACA_id=?", (idEstacaTable,)) - con.execute("DELETE FROM TABLEESTACA WHERE id=?", (idEstacaTable,)) - con.execute("DELETE FROM VERTICAIS_TABLE WHERE TABLEESTACA_id=?", (idEstacaTable,)) - con.execute("DELETE FROM INTERSECT_TABLE WHERE TABLEESTACA_id=?", (idEstacaTable,)) - con.execute("DELETE FROM RELEVO_SESSAO WHERE TABLEESTACA_id=?", (idEstacaTable,)) - con.execute("DELETE FROM SESSAO_TIPO WHERE TABLEESTACA_id=?", (idEstacaTable,)) - con.execute("DELETE FROM TRANSVERSAL WHERE TABLEESTACA_id=?", (idEstacaTable,)) - con.execute("DELETE FROM CURVA_VERTICAL_DADOS WHERE TABLEESTACA_id=?", (idEstacaTable,)) - con.execute("DELETE FROM GREIDE WHERE TABLEESTACA_id=?", (idEstacaTable,)) - con.execute("DELETE FROM BRUCKNER_TABLE WHERE TABLEESTACA_id=?", (idEstacaTable,)) - con.commit() - con.close() - from pathlib import Path - p=Path(Config.instance().TMP_DIR_PATH + "tmp/data/"+str(idEstacaTable)+".prism") - if p.is_file(): - p.unlink() - p=Path(Config.instance().TMP_DIR_PATH + "tmp/data/"+str(idEstacaTable)+".bruck") - if p.is_file(): - p.unlink() - compactZIP(Config.fileName) - - - def save(self, idEstacaTable): - extractZIP(Config.fileName) - con = sqlite3.connect(Config.instance().TMP_DIR_PATH+"tmp/data/data.db") - con.execute("DELETE FROM ESTACA WHERE TABLEESTACA_id=?", (idEstacaTable,)) - con.commit() - for linha in self.table: - linha=list(linha) - linha.append(int(idEstacaTable)) - lt = tuple(linha) - con.execute( - "INSERT INTO ESTACA (estaca,descricao,progressiva,norte,este,cota,azimute,TABLEESTACA_id)values(?,?,REPLACE(?,',','.'),REPLACE(?,',','.'),REPLACE(?,',','.'),REPLACE(?,',','.'),REPLACE(?,',','.'),?)", - lt) - con.isolation_level = None - con.execute("VACUUM") - con.isolation_level = '' - con.commit() - con.close() - - compactZIP(Config.fileName) - - def saveGreide(self, idEstacaTable): - extractZIP(Config.fileName) - con = sqlite3.connect(Config.instance().TMP_DIR_PATH+"tmp/data/data.db") - con.execute("DELETE FROM GREIDE WHERE TABLEESTACA_id = ?", (idEstacaTable,)) - con.commit() - for linha in self.table: - linha=list(linha) - linha.append(int(idEstacaTable)) - - lt = tuple(linha) - - con.execute( - "INSERT INTO GREIDE (x,cota,TABLEESTACA_id)values(?,?,?)", - lt) - con.isolation_level = None - con.execute("VACUUM") - con.isolation_level = '' - con.commit() - con.execute("DELETE FROM CURVA_VERTICAL_DADOS WHERE TABLEESTACA_id = ?", (idEstacaTable,)) - con.commit() - for linha in self.cvData: - linha.append(int(idEstacaTable)) - lt = tuple(linha) - con.execute( - "INSERT INTO CURVA_VERTICAL_DADOS (CURVA_id, L,TABLEESTACA_id)values(?,?,?)", - lt) - con.isolation_level = None - con.execute("VACUUM") - con.isolation_level = '' - con.commit() - con.close() - compactZIP(Config.fileName) - - def cleanGreide(self,id_filename): - extractZIP(Config.fileName) - con = sqlite3.connect(Config.instance().TMP_DIR_PATH+"tmp/data/data.db") - con.execute("DELETE FROM GREIDE WHERE TABLEESTACA_id = ?", (id_filename,)) - con.commit() - con.close() - compactZIP(Config.fileName) - - def saveTrans(self, id_filename, prismoid:prismoide): - extractZIP(Config.fileName) - con = sqlite3.connect(Config.instance().TMP_DIR_PATH+"tmp/data/data.db") - - con.execute("DELETE FROM TRANSVERSAL WHERE TABLEESTACA_id = ?", (id_filename,)) - con.commit() - - con.execute("DELETE FROM SESSAO_TIPO WHERE TABLEESTACA_id = ?", (id_filename,)) - con.commit() - - con.execute("DELETE FROM RELEVO_SESSAO WHERE TABLEESTACA_id = ?", (id_filename,)) - con.commit() - - cursor=con.cursor() - - c=0 - for linha in self.xList: - linha=[linha] - linha.append(int(id_filename)) - - lt = tuple(linha) - - cursor.execute( - "INSERT INTO TRANSVERSAL (x,TABLEESTACA_id)values(?,?)", - lt) - - transId=int(cursor.lastrowid) - - for rev in list(self.table[1][c]): - rev=list(rev) - rev.append(transId) - rev.append(int(id_filename)) - lt=tuple(rev) - cursor.execute( - "INSERT INTO RELEVO_SESSAO (y, cota,TRANSVERSAL_id,TABLEESTACA_id)values(?,?,?,?)", - lt) - - for rev in list(self.table[0][c]): - rev=list(rev) - rev.append(transId) - rev.append(int(id_filename)) - lt=tuple(rev) - cursor.execute( - "INSERT INTO SESSAO_TIPO (y, cota,TRANSVERSAL_id,TABLEESTACA_id)values(?,?,?,?)", - lt) - c+=1 - - con.isolation_level = None - con.execute("VACUUM") - con.isolation_level = '' - - con.commit() - con.close() - prismoid.save(Config.instance().TMP_DIR_PATH+"tmp/data/"+str(id_filename)+".prism") - compactZIP(Config.fileName) - - - - def cleanTrans(self, idEstacaTable): - extractZIP(Config.fileName) - con = sqlite3.connect(Config.instance().TMP_DIR_PATH+"tmp/data/data.db") - - con.execute("DELETE FROM TRANSVERSAL WHERE TABLEESTACA_id = ?", (idEstacaTable,)) - con.commit() - - con.execute("DELETE FROM SESSAO_TIPO WHERE TABLEESTACA_id = ?", (idEstacaTable,)) - con.commit() - - con.execute("DELETE FROM RELEVO_SESSAO WHERE TABLEESTACA_id = ?", (idEstacaTable,)) - con.commit() - con.isolation_level = None - con.execute("VACUUM") - con.isolation_level = '' - con.commit() - con.close() - from pathlib import Path - p = Path(Config.instance().TMP_DIR_PATH + "tmp/data/" + str(idEstacaTable) + ".prism") - if p.is_file(): - p.unlink() - p = Path(Config.instance().TMP_DIR_PATH + "tmp/data/" + str(idEstacaTable) + ".bruck") - if p.is_file(): - p.unlink() - compactZIP(Config.fileName) - - - def getTrans(self, idEstacaTable): - try: - extractZIP(Config.fileName) - con = sqlite3.connect(Config.instance().TMP_DIR_PATH+"tmp/data/data.db") - - est = con.execute("SELECT id, x FROM TRANSVERSAL WHERE TABLEESTACA_id = ?",(idEstacaTable,)).fetchall() - - table=[] - table.append([]) - table.append([]) - c=0 - xList=[] - - for e in est: - table[0].append(con.execute("SELECT y, cota FROM SESSAO_TIPO WHERE TRANSVERSAL_id = ?", (e[0],)).fetchall()) - table[1].append(con.execute("SELECT y, cota FROM RELEVO_SESSAO WHERE TRANSVERSAL_id = ?", (e[0],)).fetchall()) - xList.append(e[1]) - c+=1 - - con.close() - prismoid=prismoide() - if prismoid.restore(Config.instance().TMP_DIR_PATH+"tmp/data/"+str(idEstacaTable)+".prism"): - return xList, table, prismoid - else: - return xList, table, None - compactZIP(Config.fileName) - - except: - return False, False, False -# - - def getGreide(self, idEstacaTable): - try: - extractZIP(Config.fileName) - con = sqlite3.connect(Config.instance().TMP_DIR_PATH+"tmp/data/data.db") - est = con.execute("SELECT x,cota FROM GREIDE WHERE TABLEESTACA_id = ?",(idEstacaTable,)).fetchall() - con.close() - compactZIP(Config.fileName) - return est - - except sqlite3.OperationalError: - return False - - - def getCv(self, idEstacaTable): - try: - extractZIP(Config.fileName) - con = sqlite3.connect(Config.instance().TMP_DIR_PATH+"tmp/data/data.db") - - cv = con.execute("SELECT CURVA_id,L FROM CURVA_VERTICAL_DADOS WHERE TABLEESTACA_id = ?",(idEstacaTable,)).fetchall() - - con.close() - compactZIP(Config.fileName) - return cv - - except sqlite3.OperationalError: - return False - - - - def openCSV(self, filename, fileDB): - extractZIP(Config.fileName) - con = sqlite3.connect(Config.instance().TMP_DIR_PATH+"tmp/data/data.db") - con.execute("INSERT INTO TABLEESTACA (name) values ('" + fileDB + "')") - con.commit() - id_estaca = con.execute("SELECT last_insert_rowid()").fetchone() - con.close() - compactZIP(Config.fileName) - self.ultimo = id_estaca[0] - estacas = [] - delimiter = str(Config.CSV_DELIMITER.strip()[0]) - with open(filename, 'r') as fi: - for r in csv.reader(fi, delimiter=delimiter, dialect='excel'): - estaca = [] - for field in r: - s=str(field).replace(",", ".") - estaca.append(u"%s" % s) - estacas.append(estaca) - self.table = estacas - return estacas - - def saveCSV(self, filename, noWGS=False, header=None): - delimiter = str(Config.CSV_DELIMITER.strip()[0]) - table=deepcopy(self.table) - with open(filename[0], "w") as fo: - writer = csv.writer(fo, delimiter=delimiter, dialect='excel') - if type(header)==list: - writer.writerow(header) - for r in table: - for i,c in enumerate(r): - r[i]=c.replace(".",",") - writer.writerow(r) - - if not noWGS: - table=deepcopy(self.table) - with open(filename[0].split(".")[0]+"_WGS84.csv", "w") as fo: - writer = csv.writer(fo, delimiter=delimiter, dialect='excel') - if type(header) == list: - writer.writerow(header) - for r in table: - pt=pointToWGS84(QgsPointXY(float(str(r[4]).replace(",",'.')),float(str(r[3]).replace(",",".")))) - r[4],r[3]=str(pt.x()),str(pt.y()) - for i,c in enumerate(r): - r[i]=c.replace(".",",") - writer.writerow(r) - - - def gera_vertice(self, isCalc): - prog = 0.0 - sobra = 0.0 - resto = 0.0 - estaca = 0 - cosa = 0.0 - cosb = 0.0 - crs = int(self.getCRS()) - sem_internet = True# not internet_on() - - if not self.distancia or self.distancia<=0: - self.distancia=Config.instance().DIST - - if hasattr(self, "iface") and sum(1 for f in self.layer.getFeatures())>1 and not isCalc and self.ask: - selectFeatureDialog=SelectFeatureDialog(self.iface, self.layer) - ok = selectFeatureDialog.exec_() - result=selectFeatureDialog.result - else: - result=-1 - ok=True - - if ok: - f=0 - i=0 - for elemento in self.layer.getFeatures(): - if f!=result and result>-1: - f+=1 - continue - f+=1 - for seg_start, seg_end, tipo in pairs(elemento, self.estaca): - ponto_inicial = p2QgsPoint(seg_start.x(), seg_start.y()) - ponto_final = p2QgsPoint(seg_end.x(), seg_end.y()) - tamanho_da_linha = length(ponto_final, ponto_inicial) - ponto = diff(ponto_final, ponto_inicial) - - cosa, cosb = dircos(ponto) - az = azimuth(ponto_inicial, p2QgsPoint(ponto_inicial.x() + ((self.distancia) * cosa), - ponto_inicial.y() + ((self.distancia) * cosb))) - - if tamanho_da_linha == 0: - continue - - estacas_inteiras = int(math.floor((tamanho_da_linha - sobra) / self.distancia)) - estacas_inteiras_sobra = estacas_inteiras + 1 if sobra > 0 else estacas_inteiras - if not sem_internet: - cota = getElevation(crs, p2QgsPoint(float(ponto_inicial.x()), float(ponto_inicial.y()))) - if cota == 0: - sem_internet = True - else: - cota = 0.0 - estaca=int(estaca) - yield ['%d+%f' % (estaca, resto) if resto != 0 else '%d' % (estaca), 'PI%d' % i, prog, ponto_inicial.y(), - ponto_inicial.x(), cota, - az], ponto_inicial, estacas_inteiras, prog, az, sobra, tamanho_da_linha, cosa, cosb, tipo, elemento, resto - - prog += tamanho_da_linha - resto = (tamanho_da_linha - sobra) - (self.distancia * estacas_inteiras) - sobra = self.distancia - resto - estaca += estacas_inteiras_sobra - i+=1 - - if result!=-1: - break - estaca=int(estaca) - i=int(int(i)+1) - cota = getElevation(crs, p2QgsPoint(float(ponto_final.x()), float(ponto_final.y()))) - yield ['%d+%f' % (estaca, resto), 'PI%d' % i, prog, ponto_final.y(), ponto_final.x(), cota, - az], ponto_final, 0, tamanho_da_linha, az, sobra, tamanho_da_linha, cosa, cosb, tipo, elemento, resto - - - def gera_estaca_intermediaria(self, estaca, anterior, prog, az, cosa, cosb, sobra=0.0): - dist = sobra if sobra > 0 else self.distancia - p = p2QgsPoint(anterior.x() + (dist * cosa), anterior.y() + (dist * cosb)) - prog += dist - return [str(int(estaca)), '', prog, p.y(), p.x(), 0.0, az], prog, p - - def gera_estaca_intermediaria_curva(self, geom, estaca, prog, sobra): - dist=sobra if sobra > 0 else self.distancia - initalProg=prog - pg = geom.interpolate(dist) - prog += dist - while pg: - p = pg.asPoint() - az = azimuth(p, geom.interpolate(prog-initalProg + 0.001).asPoint()) - yield [str(int(estaca)), '', prog, p.y(), p.x(), 0.0, az], prog, p - prog += self.distancia - pg = geom.interpolate(prog-initalProg) - estaca += 1 - - - def create_estacas(self, isCalc=False, task=None): - estacas = [] - estaca = 0 - curvaComputadaCount=0 - curvaCount=0 - vertexCount=0 - progressiva=0 - lastDesc="T" - - for vertice, ponto_anterior, qtd_estacas, progressiva, az, sobra, tamanho_da_linha, cosa, cosb, tipo, feature, resto in self.gera_vertice(isCalc): - if task and task.isCanceled(): - return estacas - - emCurva=tipo in ["C", "S"] - desc=lastDesc+tipo - resto=roundFloat2str(resto) - - if desc in ["TS","TC"]: #Entrou em curva - vertice[0],vertice[1]=str(estaca)+"+"+str(resto) if estaca else vertice[0],desc+str(vertexCount) - estacas.append(vertice) - - elif desc in ["ST", "CT"]: #Saiu da curva - vertice[0],vertice[1]=str(estaca)+"+"+str(resto) if estaca else vertice[0],desc+str(vertexCount) - estacas.append(vertice) - vertexCount+=1 - curvaCount+=1 - - elif desc in ["SC", "CS"]: #Transição - vertice[0],vertice[1]=str(estaca)+"+"+str(resto) if estaca else vertice[0],desc+str(vertexCount) - estacas.append(vertice) - curvaComputadaCount-=1 - - elif not emCurva: #Vértice - vertice[0],vertice[1]=str(estaca)+"+"+str(resto) if estaca else vertice[0],"PI"+str(vertexCount) - estacas.append(vertice) - vertexCount+=1 - - if emCurva and curvaComputadaCount==curvaCount: #Estacas intermediárias internas em curvas - e=0 - for tmp_line, progressiva, ponto_anterior in self.gera_estaca_intermediaria_curva(feature.geometry(), estaca + 1, - progressiva, sobra): - estacas.append(tmp_line) - e+=1 - estaca+=e - curvaComputadaCount+=1 - - if not emCurva: #Estacas intermediárias em tangentes - if sobra > 0 and sobra < self.distancia and qtd_estacas > 0: - tmp_line, progressiva, ponto_anterior = self.gera_estaca_intermediaria(estaca + 1, ponto_anterior, - progressiva, az, cosa, cosb, sobra) - estacas.append(tmp_line) - estaca += 1 - - for e in range(qtd_estacas): - tmp_line, progressiva, ponto_anterior = self.gera_estaca_intermediaria(estaca + e + 1, ponto_anterior, - progressiva, az, cosa, cosb) - estacas.append(tmp_line) - estaca += qtd_estacas - - lastDesc=tipo - - - return estacas - - def tmpFolder(self): - import tempfile - from pathlib import Path - return str(Path(tempfile.gettempdir()+"/"+Config.TMP_FOLDER)) - - def saveGeoPackage(self,name:str, poly, fields, type, driver): - import shutil - from pathlib import Path - extractZIP(Config.fileName) - tmp=str(Path(self.tmpFolder()+"/"+name+".gpkg")) - path=str(Path(Config.instance().TMP_DIR_PATH+"tmp/data/"+name+".gpkg")) - shutil.rmtree(str(path), ignore_errors=True) - shutil.rmtree(str(tmp), ignore_errors=True) - writer = QgsVectorFileWriter(path, 'UTF-8', fields, type, QgsProject.instance().crs(), driver) - for p in poly: - writer.addFeature(p) - del writer - shutil.copy(path, tmp) - shutil.copy(tmp, Config.instance().TMP_DIR_PATH+'tmp/data/'+name+".gpkg") - compactZIP(Config.fileName) - return tmp - - def saveLayerToPath(self, path): - import shutil - return shutil.copy(path, self.tmpFolder()) - - def removeGeoPackage(self, name): - extractZIP(Config.fileName) - from pathlib import Path - for path in Path(Config.instance().TMP_DIR_PATH+"tmp/data/").rglob("*"+Config.RANDOM+name+".gpkg*"): - path.unlink() - for path in Path(Config.instance().TMP_DIR_PATH+"tmp/data/").rglob(name+".gpkg*"): - path.unlink() - compactZIP(Config.fileName) - - def getSavedLayers(self, name): - from pathlib import Path - import shutil - - try: - shutil.rmtree(Config.instance().TMP_DIR_PATH) - except Exception as e: - msgLog("Erro ao remover diretório temporário: "+Config.instance().TMP_DIR_PATH+" "+str(e)) - Path(Config.instance().TMP_DIR_PATH).mkdir(parents=True, exist_ok=True) - - R = [Path(self.saveLayerToPath(str(path.absolute()))) for path in extractZIP(Config.fileName) - if (str(path).endswith(".gpkg") or str(path).endswith(".gpkg-shm") or str(path).endswith(".gpkg-wal")) - and Path(path).stem==name] - - res=[r for r in R if str(r).endswith(".gpkg")] - - if len(res)>1: - path=res[0] - for p in res: - if p.stat().st_mtime>path.stat().st_mtime: - path=p - layer=self.iface.addVectorLayer((str(path.absolute())),"","ogr") - elif len(res)==1: - path=res[0] - layer=self.iface.addVectorLayer((str(path.absolute())),"","ogr") - else: - layer=None - - compactZIP(Config.fileName) - return layer - - def saveLayer(self, path): - from pathlib import Path - import shutil - for name in dir(): - if not name.startswith('_'): - try: - del globals()[name] - except: - pass -# from qgis.core import * - path=Path(path.split('|layername=')[0]) - msgLog("Armazenando layer em " + str(path)) - extractZIP(Config.fileName) - for p in Path(Config.instance().TMP_DIR_PATH+"tmp/data/").rglob("*"): - if p.stem==path.stem: - try: - p.unlink() - except: - msgLog("Failed to erase " + str(p) + " at model/estacas.py saveLayer") - for p in Path(path.parent).rglob("*"): - shutil.copy(str(p), Config.instance().TMP_DIR_PATH+"tmp/data/") - try: - p.unlink() - except: - msgLog("Failed to erase "+str(p)+" at model/estacas.py saveLayer") - compactZIP(Config.fileName) - - def bruckfilename(self): - name=str(self.id_filename) - return Config.instance().TMP_DIR_PATH+'tmp/data/'+name+".bruck" - - ''' - bruck file format reference - cat 1.bruck (json file) - - {"table":[{"estaca":prog2estacaStr(X[0]), "corte": abs(ct), "aterro": abs(at), "at.cor.": abs(at*fh), "soma": "", "semi-distancia": "", - "vol.corte":"", "vol.aterro":"", "volume":"", "vol.acum":""}, ......,....], - "5-30+1.2345": [], #--> pontos da linha de terra (roi) - "30+1.2345-50+1": [], - "Estaca_interval_string_separated_by_"-"": [], - .....,...., - } == bruck - - ''' - - - def save_bruck(self, bruck): - msgLog("Salvando arquivo bruckner") - data=self.load_bruck(True) - extractZIP(Config.fileName) - #data.update(bruck) - if "table" in data: - bruck['table'] = data["table"] - with open(self.bruckfilename(), 'w') as outfile: - json.dump(bruck, outfile) - compactZIP(Config.fileName) - - def load_bruck(self, retry=False): - from pathlib import Path - msgLog("Carregando arquivo bruckner") - extractZIP(Config.fileName) - data={} - if Path(self.bruckfilename()).is_file(): - with open(self.bruckfilename()) as json_file: - data = json.load(json_file) - compactZIP(Config.fileName) - return data - else: - with open(self.bruckfilename(), 'w') as outfile: - json.dump(data, outfile) - compactZIP(Config.fileName) - if retry: - msgLog("Falha ao carregar arquivo!") - return {} - else: - return self.load_bruck(retry=True) - - +# -*- coding: utf-8 -*- +import csv +import math +import sqlite3 +import json +from builtins import object +from builtins import range +from builtins import str +from copy import deepcopy +from pathlib import Path + +from qgis._core import QgsPoint, QgsProject, QgsVectorFileWriter, QgsPointXY + +from ..controller.Geometria.Figure import prismoide +from ..model.config import extractZIP, Config, compactZIP +from ..model.curvas import Curvas +from ..model.utils import pairs, length, dircos, diff, azimuth, getElevation, pointToWGS84, roundFloat2str, msgLog, p2QgsPoint +from ..view.estacas import SelectFeatureDialog + + +class Estacas(object): + def __init__(self, distancia=20, estaca=0, layer=None, filename='', table=list(), cvData=list(),ultimo=-1, id_filename=-1, iface=None): + self.iface=iface + self.distancia = distancia + self.filename = filename + self.estaca = estaca + self.layer = layer + self.table = table + self.xList = [] + self.ultimo = ultimo + self.id_filename = id_filename + self.ask=True + + def get_features(self): + linhas = [] + for feature in self.layer.getFeatures(): + geom = feature.geometry().asPolyline() + for i in geom: + linhas.append(i) + return linhas + + def new(self, distancia, estaca, layer, filename, iface=None): + self.__init__(distancia, estaca, layer, filename, list(), self.ultimo, self.id_filename, iface=iface) + extractZIP(Config.fileName) + con = sqlite3.connect(Config.instance().TMP_DIR_PATH+"tmp/data/data.db") + con.execute("INSERT INTO TABLEESTACA (name) values ('" + filename + "')") + con.commit() + id_estaca = con.execute("SELECT last_insert_rowid()").fetchone() + con.close() + compactZIP(Config.fileName) + self.ultimo = id_estaca[0] + self.table = self.create_estacas() + return self.ultimo, self.table + + def calcular(self, task=None, layer=None): + self.layer=layer + self.table = self.create_estacas(isCalc=True, task=task) + return self.table + + def newEmpty(self, distancia, filename): + self.__init__(distancia=distancia, filename=filename, ultimo=self.ultimo) + extractZIP(Config.fileName) + con = sqlite3.connect(Config.instance().TMP_DIR_PATH+"tmp/data/data.db") + con.execute("INSERT INTO TABLEESTACA (name) values ('" + filename + "')") + con.commit() + id_estaca = con.execute("SELECT last_insert_rowid()").fetchone()[0] + con.close() + compactZIP(Config.fileName) + return id_estaca, [] + + def getNewId(self): + extractZIP(Config.fileName) + con = sqlite3.connect(Config.instance().TMP_DIR_PATH+"tmp/data/data.db") + id_estaca = con.execute("SELECT last_insert_rowid()").fetchone() + con.close() + compactZIP(Config.fileName) + return id_estaca[0] + + def saveEstacas(self,filename,estacas): + extractZIP(Config.fileName) + con = sqlite3.connect(Config.instance().TMP_DIR_PATH+"tmp/data/data.db") + con.execute("INSERT INTO TABLEESTACA (name) values ('" + filename + "')") + con.commit() + id_estaca = con.execute("SELECT last_insert_rowid()").fetchone() + con.close() + compactZIP(Config.fileName) + model=Estacas(filename=filename, id_filename=id_estaca[0]) + model.ultimo = id_estaca[0] + model.table = estacas + model.save(id_estaca[0]) + + return model + + def saveVerticais(self, table): + try: + extractZIP(Config.fileName) + con = sqlite3.connect(Config.instance().TMP_DIR_PATH+"tmp/data/data.db") + con.execute("DELETE FROM VERTICAIS_TABLE WHERE TABLEESTACA_id=?", (self.id_filename,)) + + for linha in table: + linha=list(linha) + linha.append(int(self.id_filename)) + lt = tuple(linha) + con.execute( + "INSERT INTO VERTICAIS_TABLE (estaca,descricao,progressiva,greide,TABLEESTACA_id)" + "values(?,?,?,?,?)", + lt) + con.isolation_level = None + con.execute("VACUUM") + con.isolation_level = '' + con.commit() + + con.close() + compactZIP(Config.fileName) + + return True + except sqlite3.OperationalError: + return False + + def saveIntersect(self, table): + try: + extractZIP(Config.fileName) + con = sqlite3.connect(Config.instance().TMP_DIR_PATH+"tmp/data/data.db") + con.execute("DELETE FROM INTERSECT_TABLE WHERE TABLEESTACA_id=?", (self.id_filename,)) + + for linha in table: + linha=list(linha) + linha.append(int(self.id_filename)) + lt = tuple(linha) + con.execute( + "INSERT INTO INTERSECT_TABLE (estaca,descricao,progressiva,norte,este,greide,cota," + "azimute,TABLEESTACA_id)values(?,?,?,?,?,?,?,?,?)", + lt) + con.isolation_level = None + con.execute("VACUUM") + con.isolation_level = '' + con.commit() + + con.close() + compactZIP(Config.fileName) + return True + + except sqlite3.OperationalError: + return False + + + def saveBruckner(self, table): + try: + extractZIP(Config.fileName) + con = sqlite3.connect(Config.instance().TMP_DIR_PATH+"tmp/data/data.db") + con.execute("DELETE FROM BRUCKNER_TABLE WHERE TABLEESTACA_id=?", (self.id_filename,)) + + for linha in table: + linha=list(linha) + linha.append(int(self.id_filename)) + lt = tuple(linha) + con.execute( + "INSERT INTO BRUCKNER_TABLE (estaca, volume,TABLEESTACA_id)values(?,?,?)", + lt) + con.isolation_level = None + con.execute("VACUUM") + con.isolation_level = '' + con.commit() + + con.close() + compactZIP(Config.fileName) + return True + + except sqlite3.OperationalError: + return False + + def cleanBruckner(self, keepLines=False): + from pathlib import Path + extractZIP(Config.fileName) + con = sqlite3.connect(Config.instance().TMP_DIR_PATH + "tmp/data/data.db") + con.execute("DELETE FROM BRUCKNER_TABLE WHERE TABLEESTACA_id=?", (self.id_filename,)) + con.isolation_level = None + con.execute("VACUUM") + con.isolation_level = '' + con.commit() + con.close() + compactZIP(Config.fileName) + if keepLines: + bruck=self.load_bruck() + extractZIP(Config.fileName) + Path(Config.instance().TMP_DIR_PATH+"tmp/data/"+str(self.id_filename)+".bruck").unlink() + compactZIP(Config.fileName) + del bruck['table'] + self.save_bruck(bruck) + else: + extractZIP(Config.fileName) + Path(Config.instance().TMP_DIR_PATH+"tmp/data/"+str(self.id_filename)+".bruck").unlink() + compactZIP(Config.fileName) + return True + + def getCurvas(self, id_filename): + # instancia da model de curvas. + curva_model = Curvas(id_filename) + return curva_model.list_curvas() + + def getCRS(self): + extractZIP(Config.fileName) + con = sqlite3.connect(Config.instance().TMP_DIR_PATH+"tmp/data/data.db") + proj = con.execute("SELECT crs FROM PROJECT where id = 1").fetchone() + crs = proj[0] + con.close() + compactZIP(Config.fileName) + return crs + + def tipo(self): + extractZIP(Config.fileName) + con = sqlite3.connect(Config.instance().TMP_DIR_PATH+"tmp/data/data.db") + proj = con.execute( + "SELECT crs, classeprojeto, maxplano,maxondulado,maxmontanhoso,tipomapa FROM PROJECT where id = 1").fetchone() + + class_project = proj[1] + dataTopo = [ + 0.0, + proj[2], + proj[2], + proj[3], + proj[3], + proj[4] + ] + con.close() + compactZIP(Config.fileName) + return dataTopo, class_project + + def recalcular(self, distancia, estaca, layer, ask=True): + self.__init__(distancia, estaca, layer, self.filename, list(), self.ultimo, self.id_filename) + self.ask=ask + self.table = self.create_estacas() + self.ask=False + return self.table + + def loadFilename(self): + if self.id_filename == -1: return None + extractZIP(Config.fileName) + con = sqlite3.connect(Config.instance().TMP_DIR_PATH+"tmp/data/data.db") + est = con.execute( + "SELECT estaca,descricao,progressiva,norte,este,cota,azimute FROM ESTACA WHERE TABLEESTACA_id = ?", + (int(self.id_filename),)).fetchall() + con.close() + compactZIP(Config.fileName) + return est + + def listTables(self): + extractZIP(Config.fileName) + con = sqlite3.connect(Config.instance().TMP_DIR_PATH+"tmp/data/data.db") + est = con.execute("SELECT id,name,data FROM TABLEESTACA").fetchall() + con.close() + compactZIP(Config.fileName) + return est + + def load_verticais(self): + if self.id_filename == -1: return None + extractZIP(Config.fileName) + con = sqlite3.connect(Config.instance().TMP_DIR_PATH+"tmp/data/data.db") + est = con.execute( + "select estaca,descricao,progressiva,greide from verticais_table where tableestaca_id = ?", + (int(self.id_filename),)).fetchall() + con.close() + compactZIP(Config.fileName) + return est + + def load_terreno_long(self): + if self.id_filename == -1: return None + extractZIP(Config.fileName) + con = sqlite3.connect(Config.instance().TMP_DIR_PATH + "tmp/data/data.db") + est = con.execute( + "select descricao,progressiva,cota from ESTACA where tableestaca_id = ?", + (int(self.id_filename),)).fetchall() + con.close() + compactZIP(Config.fileName) + return est + + def load_intersect(self, id_filename=None): + if id_filename is None: + id_filename=self.id_filename + if id_filename == -1: return None + extractZIP(Config.fileName) + con = sqlite3.connect(Config.instance().TMP_DIR_PATH+"tmp/data/data.db") + est = con.execute( + "SELECT estaca,descricao,progressiva,norte,este,greide,cota,azimute FROM INTERSECT_TABLE WHERE TABLEESTACA_id = ?", + (int(id_filename),)).fetchall() + con.close() + compactZIP(Config.fileName) + return est + + def load_bruckner(self): + if self.id_filename == -1: return None + extractZIP(Config.fileName) + con = sqlite3.connect(Config.instance().TMP_DIR_PATH+"tmp/data/data.db") + est = con.execute( + "SELECT estaca, volume FROM BRUCKNER_TABLE WHERE TABLEESTACA_id = ?", + (int(self.id_filename),)).fetchall() + con.close() + compactZIP(Config.fileName) + return est + + def getNameFromId(self,id): + extractZIP(Config.fileName) + con = sqlite3.connect(Config.instance().TMP_DIR_PATH+"tmp/data/data.db") + name = con.execute("SELECT name FROM TABLEESTACA WHERE id=?", (str(id),)).fetchall() + con.close() + compactZIP(Config.fileName) + if name[0][0]: + return str(name[0][0]) + else: + return "" + + def deleteEstaca(self, idEstacaTable): + self.removeGeoPackage(self.getNameFromId(idEstacaTable)) + extractZIP(Config.fileName) + con = sqlite3.connect(Config.instance().TMP_DIR_PATH+"tmp/data/data.db") + con.execute("DELETE FROM ESTACA WHERE TABLEESTACA_id=?", (idEstacaTable,)) + con.execute("DELETE FROM TABLEESTACA WHERE id=?", (idEstacaTable,)) + con.execute("DELETE FROM VERTICAIS_TABLE WHERE TABLEESTACA_id=?", (idEstacaTable,)) + con.execute("DELETE FROM INTERSECT_TABLE WHERE TABLEESTACA_id=?", (idEstacaTable,)) + con.execute("DELETE FROM RELEVO_SESSAO WHERE TABLEESTACA_id=?", (idEstacaTable,)) + con.execute("DELETE FROM SESSAO_TIPO WHERE TABLEESTACA_id=?", (idEstacaTable,)) + con.execute("DELETE FROM TRANSVERSAL WHERE TABLEESTACA_id=?", (idEstacaTable,)) + con.execute("DELETE FROM CURVA_VERTICAL_DADOS WHERE TABLEESTACA_id=?", (idEstacaTable,)) + con.execute("DELETE FROM GREIDE WHERE TABLEESTACA_id=?", (idEstacaTable,)) + con.execute("DELETE FROM BRUCKNER_TABLE WHERE TABLEESTACA_id=?", (idEstacaTable,)) + con.commit() + con.close() + from pathlib import Path + p=Path(Config.instance().TMP_DIR_PATH + "tmp/data/"+str(idEstacaTable)+".prism") + if p.is_file(): + p.unlink() + p=Path(Config.instance().TMP_DIR_PATH + "tmp/data/"+str(idEstacaTable)+".bruck") + if p.is_file(): + p.unlink() + compactZIP(Config.fileName) + + + def save(self, idEstacaTable): + extractZIP(Config.fileName) + con = sqlite3.connect(Config.instance().TMP_DIR_PATH+"tmp/data/data.db") + con.execute("DELETE FROM ESTACA WHERE TABLEESTACA_id=?", (idEstacaTable,)) + con.commit() + for linha in self.table: + linha=list(linha) + linha.append(int(idEstacaTable)) + lt = tuple(linha) + con.execute( + "INSERT INTO ESTACA (estaca,descricao,progressiva,norte,este,cota,azimute,TABLEESTACA_id)values(?,?,REPLACE(?,',','.'),REPLACE(?,',','.'),REPLACE(?,',','.'),REPLACE(?,',','.'),REPLACE(?,',','.'),?)", + lt) + con.isolation_level = None + con.execute("VACUUM") + con.isolation_level = '' + con.commit() + con.close() + + compactZIP(Config.fileName) + + def saveGreide(self, idEstacaTable): + extractZIP(Config.fileName) + con = sqlite3.connect(Config.instance().TMP_DIR_PATH+"tmp/data/data.db") + con.execute("DELETE FROM GREIDE WHERE TABLEESTACA_id = ?", (idEstacaTable,)) + con.commit() + for linha in self.table: + linha=list(linha) + linha.append(int(idEstacaTable)) + + lt = tuple(linha) + + con.execute( + "INSERT INTO GREIDE (x,cota,TABLEESTACA_id)values(?,?,?)", + lt) + con.isolation_level = None + con.execute("VACUUM") + con.isolation_level = '' + con.commit() + con.execute("DELETE FROM CURVA_VERTICAL_DADOS WHERE TABLEESTACA_id = ?", (idEstacaTable,)) + con.commit() + for linha in self.cvData: + linha.append(int(idEstacaTable)) + lt = tuple(linha) + con.execute( + "INSERT INTO CURVA_VERTICAL_DADOS (CURVA_id, L,TABLEESTACA_id)values(?,?,?)", + lt) + con.isolation_level = None + con.execute("VACUUM") + con.isolation_level = '' + con.commit() + con.close() + compactZIP(Config.fileName) + + def cleanGreide(self,id_filename): + extractZIP(Config.fileName) + con = sqlite3.connect(Config.instance().TMP_DIR_PATH+"tmp/data/data.db") + con.execute("DELETE FROM GREIDE WHERE TABLEESTACA_id = ?", (id_filename,)) + con.commit() + con.close() + compactZIP(Config.fileName) + + def saveTrans(self, id_filename, prismoid:prismoide): + extractZIP(Config.fileName) + con = sqlite3.connect(Config.instance().TMP_DIR_PATH+"tmp/data/data.db") + + con.execute("DELETE FROM TRANSVERSAL WHERE TABLEESTACA_id = ?", (id_filename,)) + con.commit() + + con.execute("DELETE FROM SESSAO_TIPO WHERE TABLEESTACA_id = ?", (id_filename,)) + con.commit() + + con.execute("DELETE FROM RELEVO_SESSAO WHERE TABLEESTACA_id = ?", (id_filename,)) + con.commit() + + cursor=con.cursor() + + c=0 + for linha in self.xList: + linha=[linha] + linha.append(int(id_filename)) + + lt = tuple(linha) + + cursor.execute( + "INSERT INTO TRANSVERSAL (x,TABLEESTACA_id)values(?,?)", + lt) + + transId=int(cursor.lastrowid) + + for rev in list(self.table[1][c]): + rev=list(rev) + rev.append(transId) + rev.append(int(id_filename)) + lt=tuple(rev) + cursor.execute( + "INSERT INTO RELEVO_SESSAO (y, cota,TRANSVERSAL_id,TABLEESTACA_id)values(?,?,?,?)", + lt) + + for rev in list(self.table[0][c]): + rev=list(rev) + rev.append(transId) + rev.append(int(id_filename)) + lt=tuple(rev) + cursor.execute( + "INSERT INTO SESSAO_TIPO (y, cota,TRANSVERSAL_id,TABLEESTACA_id)values(?,?,?,?)", + lt) + c+=1 + + con.isolation_level = None + con.execute("VACUUM") + con.isolation_level = '' + + con.commit() + con.close() + prismoid.save(Config.instance().TMP_DIR_PATH+"tmp/data/"+str(id_filename)+".prism") + compactZIP(Config.fileName) + + + + def cleanTrans(self, idEstacaTable): + extractZIP(Config.fileName) + con = sqlite3.connect(Config.instance().TMP_DIR_PATH+"tmp/data/data.db") + + con.execute("DELETE FROM TRANSVERSAL WHERE TABLEESTACA_id = ?", (idEstacaTable,)) + con.commit() + + con.execute("DELETE FROM SESSAO_TIPO WHERE TABLEESTACA_id = ?", (idEstacaTable,)) + con.commit() + + con.execute("DELETE FROM RELEVO_SESSAO WHERE TABLEESTACA_id = ?", (idEstacaTable,)) + con.commit() + con.isolation_level = None + con.execute("VACUUM") + con.isolation_level = '' + con.commit() + con.close() + from pathlib import Path + p = Path(Config.instance().TMP_DIR_PATH + "tmp/data/" + str(idEstacaTable) + ".prism") + if p.is_file(): + p.unlink() + p = Path(Config.instance().TMP_DIR_PATH + "tmp/data/" + str(idEstacaTable) + ".bruck") + if p.is_file(): + p.unlink() + compactZIP(Config.fileName) + + + def getTrans(self, idEstacaTable): + try: + extractZIP(Config.fileName) + con = sqlite3.connect(Config.instance().TMP_DIR_PATH+"tmp/data/data.db") + + est = con.execute("SELECT id, x FROM TRANSVERSAL WHERE TABLEESTACA_id = ?",(idEstacaTable,)).fetchall() + + table=[] + table.append([]) + table.append([]) + c=0 + xList=[] + + for e in est: + table[0].append(con.execute("SELECT y, cota FROM SESSAO_TIPO WHERE TRANSVERSAL_id = ?", (e[0],)).fetchall()) + table[1].append(con.execute("SELECT y, cota FROM RELEVO_SESSAO WHERE TRANSVERSAL_id = ?", (e[0],)).fetchall()) + xList.append(e[1]) + c+=1 + + con.close() + prismoid=prismoide() + if prismoid.restore(Config.instance().TMP_DIR_PATH+"tmp/data/"+str(idEstacaTable)+".prism"): + return xList, table, prismoid + else: + return xList, table, None + compactZIP(Config.fileName) + + except: + return False, False, False +# + + def getGreide(self, idEstacaTable): + try: + extractZIP(Config.fileName) + con = sqlite3.connect(Config.instance().TMP_DIR_PATH+"tmp/data/data.db") + est = con.execute("SELECT x,cota FROM GREIDE WHERE TABLEESTACA_id = ?",(idEstacaTable,)).fetchall() + con.close() + compactZIP(Config.fileName) + return est + + except sqlite3.OperationalError: + return False + + + def getCv(self, idEstacaTable): + try: + extractZIP(Config.fileName) + con = sqlite3.connect(Config.instance().TMP_DIR_PATH+"tmp/data/data.db") + + cv = con.execute("SELECT CURVA_id,L FROM CURVA_VERTICAL_DADOS WHERE TABLEESTACA_id = ?",(idEstacaTable,)).fetchall() + + con.close() + compactZIP(Config.fileName) + return cv + + except sqlite3.OperationalError: + return False + + + + def openCSV(self, filename, fileDB): + extractZIP(Config.fileName) + con = sqlite3.connect(Config.instance().TMP_DIR_PATH+"tmp/data/data.db") + con.execute("INSERT INTO TABLEESTACA (name) values ('" + fileDB + "')") + con.commit() + id_estaca = con.execute("SELECT last_insert_rowid()").fetchone() + con.close() + compactZIP(Config.fileName) + self.ultimo = id_estaca[0] + estacas = [] + delimiter = str(Config.CSV_DELIMITER.strip()[0]) + with open(filename, 'r') as fi: + for r in csv.reader(fi, delimiter=delimiter, dialect='excel'): + estaca = [] + for field in r: + s=str(field).replace(",", ".") + estaca.append(u"%s" % s) + estacas.append(estaca) + self.table = estacas + return estacas + + def saveCSV(self, filename, noWGS=False, header=None): + delimiter = str(Config.CSV_DELIMITER.strip()[0]) + table=deepcopy(self.table) + with open(filename[0], "w") as fo: + writer = csv.writer(fo, delimiter=delimiter, dialect='excel') + if type(header)==list: + writer.writerow(header) + for r in table: + for i,c in enumerate(r): + r[i]=c.replace(".",",") + writer.writerow(r) + + if not noWGS: + table=deepcopy(self.table) + with open(filename[0].split(".")[0]+"_WGS84.csv", "w") as fo: + writer = csv.writer(fo, delimiter=delimiter, dialect='excel') + if type(header) == list: + writer.writerow(header) + for r in table: + pt=pointToWGS84(QgsPointXY(float(str(r[4]).replace(",",'.')),float(str(r[3]).replace(",",".")))) + r[4],r[3]=str(pt.x()),str(pt.y()) + for i,c in enumerate(r): + r[i]=c.replace(".",",") + writer.writerow(r) + + + def gera_vertice(self, isCalc): + prog = 0.0 + sobra = 0.0 + resto = 0.0 + estaca = 0 + cosa = 0.0 + cosb = 0.0 + crs = int(self.getCRS()) + sem_internet = True# not internet_on() + + if not self.distancia or self.distancia<=0: + self.distancia=Config.instance().DIST + + if hasattr(self, "iface") and sum(1 for f in self.layer.getFeatures())>1 and not isCalc and self.ask: + selectFeatureDialog=SelectFeatureDialog(self.iface, self.layer) + ok = selectFeatureDialog.exec_() + result=selectFeatureDialog.result + else: + result=-1 + ok=True + + if ok: + f=0 + i=0 + for elemento in self.layer.getFeatures(): + if f!=result and result>-1: + f+=1 + continue + f+=1 + for seg_start, seg_end, tipo in pairs(elemento, self.estaca): + ponto_inicial = p2QgsPoint(seg_start.x(), seg_start.y()) + ponto_final = p2QgsPoint(seg_end.x(), seg_end.y()) + tamanho_da_linha = length(ponto_final, ponto_inicial) + ponto = diff(ponto_final, ponto_inicial) + + cosa, cosb = dircos(ponto) + az = azimuth(ponto_inicial, p2QgsPoint(ponto_inicial.x() + ((self.distancia) * cosa), + ponto_inicial.y() + ((self.distancia) * cosb))) + + if tamanho_da_linha == 0: + continue + + estacas_inteiras = int(math.floor((tamanho_da_linha - sobra) / self.distancia)) + estacas_inteiras_sobra = estacas_inteiras + 1 if sobra > 0 else estacas_inteiras + if not sem_internet: + cota = getElevation(crs, p2QgsPoint(float(ponto_inicial.x()), float(ponto_inicial.y()))) + if cota == 0: + sem_internet = True + else: + cota = 0.0 + estaca=int(estaca) + yield ['%d+%f' % (estaca, resto) if resto != 0 else '%d' % (estaca), 'PI%d' % i, prog, ponto_inicial.y(), + ponto_inicial.x(), cota, + az], ponto_inicial, estacas_inteiras, prog, az, sobra, tamanho_da_linha, cosa, cosb, tipo, elemento, resto + + prog += tamanho_da_linha + resto = (tamanho_da_linha - sobra) - (self.distancia * estacas_inteiras) + sobra = self.distancia - resto + estaca += estacas_inteiras_sobra + i+=1 + + if result!=-1: + break + estaca=int(estaca) + i=int(int(i)+1) + cota = getElevation(crs, p2QgsPoint(float(ponto_final.x()), float(ponto_final.y()))) + yield ['%d+%f' % (estaca, resto), 'PI%d' % i, prog, ponto_final.y(), ponto_final.x(), cota, + az], ponto_final, 0, tamanho_da_linha, az, sobra, tamanho_da_linha, cosa, cosb, tipo, elemento, resto + + + def gera_estaca_intermediaria(self, estaca, anterior, prog, az, cosa, cosb, sobra=0.0): + dist = sobra if sobra > 0 else self.distancia + p = p2QgsPoint(anterior.x() + (dist * cosa), anterior.y() + (dist * cosb)) + prog += dist + return [str(int(estaca)), '', prog, p.y(), p.x(), 0.0, az], prog, p + + def gera_estaca_intermediaria_curva(self, geom, estaca, prog, sobra): + dist=sobra if sobra > 0 else self.distancia + initalProg=prog + pg = geom.interpolate(dist) + prog += dist + while pg: + p = pg.asPoint() + az = azimuth(p, geom.interpolate(prog-initalProg + 0.001).asPoint()) + yield [str(int(estaca)), '', prog, p.y(), p.x(), 0.0, az], prog, p + prog += self.distancia + pg = geom.interpolate(prog-initalProg) + estaca += 1 + + + def create_estacas(self, isCalc=False, task=None): + estacas = [] + estaca = 0 + curvaComputadaCount=0 + curvaCount=0 + vertexCount=0 + progressiva=0 + lastDesc="T" + + for vertice, ponto_anterior, qtd_estacas, progressiva, az, sobra, tamanho_da_linha, cosa, cosb, tipo, feature, resto in self.gera_vertice(isCalc): + if task and task.isCanceled(): + return estacas + + emCurva=tipo in ["C", "S"] + desc=lastDesc+tipo + resto=roundFloat2str(resto) + + if desc in ["TS","TC"]: #Entrou em curva + vertice[0],vertice[1]=str(estaca)+"+"+str(resto) if estaca else vertice[0],desc+str(vertexCount) + estacas.append(vertice) + + elif desc in ["ST", "CT"]: #Saiu da curva + vertice[0],vertice[1]=str(estaca)+"+"+str(resto) if estaca else vertice[0],desc+str(vertexCount) + estacas.append(vertice) + vertexCount+=1 + curvaCount+=1 + + elif desc in ["SC", "CS"]: #Transição + vertice[0],vertice[1]=str(estaca)+"+"+str(resto) if estaca else vertice[0],desc+str(vertexCount) + estacas.append(vertice) + curvaComputadaCount-=1 + + elif not emCurva: #Vértice + vertice[0],vertice[1]=str(estaca)+"+"+str(resto) if estaca else vertice[0],"PI"+str(vertexCount) + estacas.append(vertice) + vertexCount+=1 + + if emCurva and curvaComputadaCount==curvaCount: #Estacas intermediárias internas em curvas + e=0 + for tmp_line, progressiva, ponto_anterior in self.gera_estaca_intermediaria_curva(feature.geometry(), estaca + 1, + progressiva, sobra): + estacas.append(tmp_line) + e+=1 + estaca+=e + curvaComputadaCount+=1 + + if not emCurva: #Estacas intermediárias em tangentes + if sobra > 0 and sobra < self.distancia and qtd_estacas > 0: + tmp_line, progressiva, ponto_anterior = self.gera_estaca_intermediaria(estaca + 1, ponto_anterior, + progressiva, az, cosa, cosb, sobra) + estacas.append(tmp_line) + estaca += 1 + + for e in range(qtd_estacas): + tmp_line, progressiva, ponto_anterior = self.gera_estaca_intermediaria(estaca + e + 1, ponto_anterior, + progressiva, az, cosa, cosb) + estacas.append(tmp_line) + estaca += qtd_estacas + + lastDesc=tipo + + + return estacas + + def tmpFolder(self): + import tempfile + from pathlib import Path + return str(Path(tempfile.gettempdir()+"/"+Config.TMP_FOLDER)) + + def saveGeoPackage(self,name:str, poly, fields, type, driver): + import shutil + from pathlib import Path + extractZIP(Config.fileName) + tmp=str(Path(self.tmpFolder()+"/"+name+".gpkg")) + path=str(Path(Config.instance().TMP_DIR_PATH+"tmp/data/"+name+".gpkg")) + shutil.rmtree(str(path), ignore_errors=True) + shutil.rmtree(str(tmp), ignore_errors=True) + writer = QgsVectorFileWriter(path, 'UTF-8', fields, type, QgsProject.instance().crs(), driver) + for p in poly: + writer.addFeature(p) + del writer + shutil.copy(path, tmp) + shutil.copy(tmp, Config.instance().TMP_DIR_PATH+'tmp/data/'+name+".gpkg") + compactZIP(Config.fileName) + return tmp + + def saveLayerToPath(self, path): + import shutil + return shutil.copy(path, self.tmpFolder()) + + def removeGeoPackage(self, name): + extractZIP(Config.fileName) + from pathlib import Path + for path in Path(Config.instance().TMP_DIR_PATH+"tmp/data/").rglob("*"+Config.RANDOM+name+".gpkg*"): + path.unlink() + for path in Path(Config.instance().TMP_DIR_PATH+"tmp/data/").rglob(name+".gpkg*"): + path.unlink() + compactZIP(Config.fileName) + + def getSavedLayers(self, name): + from pathlib import Path + import shutil + + try: + shutil.rmtree(Config.instance().TMP_DIR_PATH) + except Exception as e: + msgLog("Erro ao remover diretório temporário: "+Config.instance().TMP_DIR_PATH+" "+str(e)) + Path(Config.instance().TMP_DIR_PATH).mkdir(parents=True, exist_ok=True) + + R = [Path(self.saveLayerToPath(str(path.absolute()))) for path in extractZIP(Config.fileName) + if (str(path).endswith(".gpkg") or str(path).endswith(".gpkg-shm") or str(path).endswith(".gpkg-wal")) + and Path(path).stem==name] + + res=[r for r in R if str(r).endswith(".gpkg")] + + if len(res)>1: + path=res[0] + for p in res: + if p.stat().st_mtime>path.stat().st_mtime: + path=p + layer=self.iface.addVectorLayer((str(path.absolute())),"","ogr") + elif len(res)==1: + path=res[0] + layer=self.iface.addVectorLayer((str(path.absolute())),"","ogr") + else: + layer=None + + compactZIP(Config.fileName) + return layer + + def saveLayer(self, path): + from pathlib import Path + import shutil + for name in dir(): + if not name.startswith('_'): + try: + del globals()[name] + except: + pass +# from qgis.core import * + path=Path(path.split('|layername=')[0]) + msgLog("Armazenando layer em " + str(path)) + extractZIP(Config.fileName) + for p in Path(Config.instance().TMP_DIR_PATH+"tmp/data/").rglob("*"): + if p.stem==path.stem: + try: + p.unlink() + except: + msgLog("Failed to erase " + str(p) + " at model/estacas.py saveLayer") + for p in Path(path.parent).rglob("*"): + shutil.copy(str(p), Config.instance().TMP_DIR_PATH+"tmp/data/") + try: + p.unlink() + except: + msgLog("Failed to erase "+str(p)+" at model/estacas.py saveLayer") + compactZIP(Config.fileName) + + def bruckfilename(self): + name=str(self.id_filename) + return Config.instance().TMP_DIR_PATH+'tmp/data/'+name+".bruck" + + ''' + bruck file format reference + cat 1.bruck (json file) + + {"table":[{"estaca":prog2estacaStr(X[0]), "corte": abs(ct), "aterro": abs(at), "at.cor.": abs(at*fh), "soma": "", "semi-distancia": "", + "vol.corte":"", "vol.aterro":"", "volume":"", "vol.acum":""}, ......,....], + "5-30+1.2345": [], #--> pontos da linha de terra (roi) + "30+1.2345-50+1": [], + "Estaca_interval_string_separated_by_"-"": [], + .....,...., + } == bruck + + ''' + + + def save_bruck(self, bruck): + msgLog("Salvando arquivo bruckner") + data=self.load_bruck(True) + extractZIP(Config.fileName) + #data.update(bruck) + if "table" in data: + bruck['table'] = data["table"] + with open(self.bruckfilename(), 'w') as outfile: + json.dump(bruck, outfile) + compactZIP(Config.fileName) + + def load_bruck(self, retry=False): + from pathlib import Path + msgLog("Carregando arquivo bruckner") + extractZIP(Config.fileName) + data={} + if Path(self.bruckfilename()).is_file(): + with open(self.bruckfilename()) as json_file: + data = json.load(json_file) + compactZIP(Config.fileName) + return data + else: + with open(self.bruckfilename(), 'w') as outfile: + json.dump(data, outfile) + compactZIP(Config.fileName) + if retry: + msgLog("Falha ao carregar arquivo!") + return {} + else: + return self.load_bruck(retry=True) + + diff --git a/app/model/geany_run_script.bat b/app/model/geany_run_script.bat old mode 100644 new mode 100755 index e85801f..be0cb52 --- a/app/model/geany_run_script.bat +++ b/app/model/geany_run_script.bat @@ -1,6 +1,6 @@ -c:\Python34\python "estacas.py" - -pause -del "%0" - -pause +c:\Python34\python "estacas.py" + +pause +del "%0" + +pause diff --git a/app/model/helper/__init__.py b/app/model/helper/__init__.py old mode 100644 new mode 100755 diff --git a/app/model/helper/calculos.py b/app/model/helper/calculos.py old mode 100644 new mode 100755 index 546f222..be776cd --- a/app/model/helper/calculos.py +++ b/app/model/helper/calculos.py @@ -1,184 +1,184 @@ -import math - - -def calculeI(progPrev, currentProg, cotaPrev, currentCota): - return ((currentCota - cotaPrev) / (currentProg - progPrev)) * 100 - - -def delta(azimutePrev, azimuteCurrent): - res = abs(azimuteCurrent - azimutePrev) - if (res > 180): - res = 360 - res - return res - -def vmedia(x): - terms = [ - 1.7995760048853219e+002, - -1.9589809033622782e+001, - 9.7608162682466526e-001, - -2.4742990072266831e-002, - 3.5898025026505798e-004, - -2.9860942431386416e-006, - 1.3228446165447730e-008, - -2.4183434420566437e-011 - ] - - t = 1 - r = 0 - for c in terms: - r += c * t - t *= x - return r - - -def velocidade(i, classeProjeto, tipo): - if i >= float(tipo[0]) and i < float(tipo[1]): - if classeProjeto <= 0: - s = "120" - elif classeProjeto < 4: - s = "100" - elif classeProjeto < 6: - s = "80" - else: - s = "60" - retorno = (s, "Plano") - elif i >= float(tipo[2]) and i < float(tipo[3]): - if classeProjeto <= 0: - s = "100" - elif classeProjeto < 3: - s = "80" - elif classeProjeto < 4: - s = "70" - elif classeProjeto < 6: - s = "60" - else: - s = "40" - retorno = (s, "Ondulado") - else: - if classeProjeto <= 0: - s = "80" - elif classeProjeto < 3: - s = "60" - elif classeProjeto < 4: - s = "50" - elif classeProjeto < 6: - s = "40" - else: - s = "30" - retorno = (s, "Montanhoso") - return retorno - - -def fmax(velocidade): - # velocidades = {30: 0.2, 40: 0.18, 50: 0.16, 60: 0.15, 70: 0.15, 80: 0.14, 90: 0.14, 100: 0.13, 110: 0.12, 120: 0.11} -# return velocidades[velocidade] - return .19-velocidade/1600 - - -def rmin(velocidade, emax, fmax): - return (velocidade ** 2) / (127 * (emax + fmax)) - - -def lsmin(velocidade, rutilizado=-1): - if (rutilizado < 0): - return 0.556 * velocidade - return 0.036 * ((velocidade ** 3) / rutilizado) - - -def lsmax(rutilizado, delta): - return (rutilizado * delta * math.pi) / 180 - - -def lsmedio(lsmin, lsmax): - return (lsmin + lsmax) / 2 - - -def thetaS(lsutilizado, rutilizado): - return lsutilizado / (2 * rutilizado) - - -def xs(lsutilizado, theta): - # =(lsutilizado*(1-(theta**2)/10+(theta**4)/216)) - return (lsutilizado * (1 - (theta ** 2) / 10 + (theta ** 4) / 216)) - - -def ys(lsutilizado, theta): - # =(lsutilizado*(theta/3-(theta**3)/42)) - return (lsutilizado * (theta / 3 - (theta ** 3) / 42)) - - -def fi(delta, theta): - # =((PI()*H3)/180)-(2*T3) - return ((math.pi * delta) / 180) - (2 * theta) - - -def d(rutilizado, fi): - return rutilizado * fi - -def d_curva_simples(rutilizado, delta): - return (math.pi * rutilizado * delta) / 180 - -def r_curva_simples(d, delta): - return 180 * d /(math.pi * delta) - -def l_utilizado(rutilizado, v, delta_val): - return (max(0.036*v**3/rutilizado, 0.556*v)+rutilizado*delta_val*math.pi/180)/2 - -def k(xs, rutilizado, theta): - return xs - rutilizado * math.sin(theta) - - -def p(ys, rutilizado, theta): - return ys - rutilizado * (1 - math.cos(theta)) - - -def tt(d, rutilizado, p, delta): - return d + (rutilizado + p) * math.tan((delta / 2) * math.pi / 180) - - -def ets(epi, tt): - return epi - tt - - -def esc(ets, lsutilizado): - return ets + lsutilizado - - -def ecs(esc, d): - return esc + d - - -def est(ecs, lsutilizado): - return ecs + lsutilizado - - -def epi(eptAnt=-1, progAtual=-1, progAnt=-1, ttAnt=-1): - if (eptAnt == -1): - return progAtual - return eptAnt + (progAtual - progAnt) - ttAnt - - -def t(rutilizado, delta): - return rutilizado * math.tan((delta / 2) * (math.pi / 180)) - - -def g20(rutilizado): - return 1145.92 / rutilizado - - -def epc(epiAtual, tAtual): - return epiAtual - tAtual - - -def ept(epcAtual, dAtual): - return epcAtual + dAtual - - -def deflexao_intermediaria(g20): - return g20 / 2 - -def clotX(theta): - return 1-theta**2/10+theta**4/216 - -def clotY(theta): - return theta/3-theta**3/42 +import math + + +def calculeI(progPrev, currentProg, cotaPrev, currentCota): + return ((currentCota - cotaPrev) / (currentProg - progPrev)) * 100 + + +def delta(azimutePrev, azimuteCurrent): + res = abs(azimuteCurrent - azimutePrev) + if (res > 180): + res = 360 - res + return res + +def vmedia(x): + terms = [ + 1.7995760048853219e+002, + -1.9589809033622782e+001, + 9.7608162682466526e-001, + -2.4742990072266831e-002, + 3.5898025026505798e-004, + -2.9860942431386416e-006, + 1.3228446165447730e-008, + -2.4183434420566437e-011 + ] + + t = 1 + r = 0 + for c in terms: + r += c * t + t *= x + return r + + +def velocidade(i, classeProjeto, tipo): + if i >= float(tipo[0]) and i < float(tipo[1]): + if classeProjeto <= 0: + s = "120" + elif classeProjeto < 4: + s = "100" + elif classeProjeto < 6: + s = "80" + else: + s = "60" + retorno = (s, "Plano") + elif i >= float(tipo[2]) and i < float(tipo[3]): + if classeProjeto <= 0: + s = "100" + elif classeProjeto < 3: + s = "80" + elif classeProjeto < 4: + s = "70" + elif classeProjeto < 6: + s = "60" + else: + s = "40" + retorno = (s, "Ondulado") + else: + if classeProjeto <= 0: + s = "80" + elif classeProjeto < 3: + s = "60" + elif classeProjeto < 4: + s = "50" + elif classeProjeto < 6: + s = "40" + else: + s = "30" + retorno = (s, "Montanhoso") + return retorno + + +def fmax(velocidade): + # velocidades = {30: 0.2, 40: 0.18, 50: 0.16, 60: 0.15, 70: 0.15, 80: 0.14, 90: 0.14, 100: 0.13, 110: 0.12, 120: 0.11} +# return velocidades[velocidade] + return .19-velocidade/1600 + + +def rmin(velocidade, emax, fmax): + return (velocidade ** 2) / (127 * (emax + fmax)) + + +def lsmin(velocidade, rutilizado=-1): + if (rutilizado < 0): + return 0.556 * velocidade + return 0.036 * ((velocidade ** 3) / rutilizado) + + +def lsmax(rutilizado, delta): + return (rutilizado * delta * math.pi) / 180 + + +def lsmedio(lsmin, lsmax): + return (lsmin + lsmax) / 2 + + +def thetaS(lsutilizado, rutilizado): + return lsutilizado / (2 * rutilizado) + + +def xs(lsutilizado, theta): + # =(lsutilizado*(1-(theta**2)/10+(theta**4)/216)) + return (lsutilizado * (1 - (theta ** 2) / 10 + (theta ** 4) / 216)) + + +def ys(lsutilizado, theta): + # =(lsutilizado*(theta/3-(theta**3)/42)) + return (lsutilizado * (theta / 3 - (theta ** 3) / 42)) + + +def fi(delta, theta): + # =((PI()*H3)/180)-(2*T3) + return ((math.pi * delta) / 180) - (2 * theta) + + +def d(rutilizado, fi): + return rutilizado * fi + +def d_curva_simples(rutilizado, delta): + return (math.pi * rutilizado * delta) / 180 + +def r_curva_simples(d, delta): + return 180 * d /(math.pi * delta) + +def l_utilizado(rutilizado, v, delta_val): + return (max(0.036*v**3/rutilizado, 0.556*v)+rutilizado*delta_val*math.pi/180)/2 + +def k(xs, rutilizado, theta): + return xs - rutilizado * math.sin(theta) + + +def p(ys, rutilizado, theta): + return ys - rutilizado * (1 - math.cos(theta)) + + +def tt(d, rutilizado, p, delta): + return d + (rutilizado + p) * math.tan((delta / 2) * math.pi / 180) + + +def ets(epi, tt): + return epi - tt + + +def esc(ets, lsutilizado): + return ets + lsutilizado + + +def ecs(esc, d): + return esc + d + + +def est(ecs, lsutilizado): + return ecs + lsutilizado + + +def epi(eptAnt=-1, progAtual=-1, progAnt=-1, ttAnt=-1): + if (eptAnt == -1): + return progAtual + return eptAnt + (progAtual - progAnt) - ttAnt + + +def t(rutilizado, delta): + return rutilizado * math.tan((delta / 2) * (math.pi / 180)) + + +def g20(rutilizado): + return 1145.92 / rutilizado + + +def epc(epiAtual, tAtual): + return epiAtual - tAtual + + +def ept(epcAtual, dAtual): + return epcAtual + dAtual + + +def deflexao_intermediaria(g20): + return g20 / 2 + +def clotX(theta): + return 1-theta**2/10+theta**4/216 + +def clotY(theta): + return theta/3-theta**3/42 diff --git a/app/model/helper/knn.py b/app/model/helper/knn.py old mode 100644 new mode 100755 index 5120910..d7d5afa --- a/app/model/helper/knn.py +++ b/app/model/helper/knn.py @@ -1,12 +1,12 @@ -class KNN(object): - """docstring for ClassName""" - def __init__(self,k): - self.k = k - def fit(self,dadosX,dadosY): - self.dadosX = dadosX - self.dadosY = dadosY - def predict(self,dadosX): - for i in self.dadosX: - for j in self.dados - +class KNN(object): + """docstring for ClassName""" + def __init__(self,k): + self.k = k + def fit(self,dadosX,dadosY): + self.dadosX = dadosX + self.dadosY = dadosY + def predict(self,dadosX): + for i in self.dadosX: + for j in self.dados + \ No newline at end of file diff --git a/app/model/helper/qgsgeometry.py b/app/model/helper/qgsgeometry.py old mode 100644 new mode 100755 index d944860..da23dac --- a/app/model/helper/qgsgeometry.py +++ b/app/model/helper/qgsgeometry.py @@ -1,969 +1,969 @@ -from copy import deepcopy - -from ..utils import * -import numpy as np -from osgeo import gdal -from qgis.core import QgsRectangle, QgsGeometry, QgsVectorLayer, QgsPoint, QgsFeature, QgsPointXY, QgsCircularString - -polyline=qgsGeometryToPolyline - -def wasInitialized(layer : QgsVectorLayer): - return sum([1 for f in layer.getFeatures()]) > 0 - -def refreshCanvas(ifac, layer:QgsVectorLayer = None): - if layer and ifac.mapCanvas().isCachingEnabled(): - layer.triggerRepaint() - ifac.mapCanvas().refresh() - -def tangentFeaturesFromPointList(layer: QgsVectorLayer, list:list): - if len(list)>=2: - anterior=list[0] - for p in list[1:]: - feat = QgsFeature(layer.fields()) - feat.setAttribute('Tipo', 'T') - feat.setGeometry(QgsGeometry.fromPolyline([anterior,p])) - layer.dataProvider().addFeatures([feat]) - layer.updateExtents() - anterior=p - - -def perp( a ) : - b = np.empty_like(a) - b[0] = -a[1] - b[1] = a[0] - return b - -# line segment a given by endpoints a1, a2 -# line segment b given by endpoints b1, b2 -# return -def seg_intersect(a1,a2, b1,b2) : - a1=np.array([a1.x(), a1.y()]) - a2=np.array([a2.x(), a2.y()]) - b1=np.array([b1.x(), b1.y()]) - b2=np.array([b2.x(), b2.y()]) - da = a2-a1 - db = b2-b1 - dp = a1-b1 - dap = perp(da) - denom = np.dot( dap, db) - num = np.dot( dap, dp ) - pi=(num / denom.astype(float))*db + b1 - return p2QgsPoint(pi[0], pi[1]) - - -def getTangentesGeometry(layer, i, j=0): - layer: QgsVectorLayer - G=[f.geometry() for f in layer.getFeatures()] - if j==0: - if i >len(G)-1: - G=[G[-1], None] - elif i==0: - G=[None, G[0]] - else: - G=[G[i-1],G[i]] - else: - l1:QgsGeometry - l2:QgsGeometry - l1=G[i] - l2=G[j] - g1=qgsGeometryToPolyline(l1) - g2=qgsGeometryToPolyline(l2) - pi=p2QgsPoint(seg_intersect(g1[0],g1[-1],g2[0],g2[-1])) - G=[QgsGeometry.fromPolyline([p2QgsPoint(g1[0]),pi]), QgsGeometry.fromPolyline([pi,p2QgsPoint(g2[-1])])] - - return G - -def deflection(layer2, i): - line1, line2=getTangentesGeometry(layer2,i) - a1, a2 = [azimuth(qgsGeometryToPolyline(l)[0], qgsGeometryToPolyline(l)[-1]) for l in [line1, line2]] - a=a2-a1 - if abs(a)>180.0: - a=a/abs(a)*abs(180-a) - return a - -def azi(p1,p2=None): - if not p2: - return azimuth(p1[-2], (p1[-1])) - return azimuth(p1, p2) - -def featureCount(layer): - return sum([1 for f in layer.getFeatures()]) - -def featuresList(layer): - return [f for f in layer.getFeatures()] - -def cleanLayer(layer, i=0): - F=[] - - if i==0: - F=[f.id() for f in layer.getFeatures] - else: - F=[f.id() for f in featuresList(layer)[-i:]] - layer.dataProvider().deleteFeatures(F) - -def geolengh(geom): - s=0 - L=qgsGeometryToPolyline(geom)[1:] - p0=L[0] - for pt in L: - s+=p0.distance(pt) - p0=pt - -def contains(rect, geom): - for pt in qgsGeometryToPolyline(geom): - if not rect.contains(pt): - return False - return True - -def splitFeatures(f1, f2): - ''' - - :param f1: feature que define o corte - :param f2: trimmed feature - :return:geometry - ''' - g1 = QgsGeometry(f1.geometry()) - g2 = QgsGeometry(f2.geometry()) - gg = g2.splitGeometry(qgsGeometryToPolyline(g1), False) - gg=gg[1][0] - return g2 if contains(g1.boundingBox(), gg) else gg - -def splitGeometry(g1, g2): - ''' - - :param g1: defining line and rectangle - :param g2:line to split - :return: geometry - ''' - - gg = g2.splitGeometry(qgsGeometryToPolyline(g1), False)[1][0] - return g2 if contains(g1.boundingBox(), gg) else gg - - -def createGeometry(geom): - return QgsGeometry.fromWkt(geom.asWkt()) - - -def unifyGeometry(g1, g2): - PL = polyline(g1) + polyline(g2) - pant = PL[0] - L = [pant] - for p in PL[1:]: - if not (p.x() == pant.x() and p.y() == pant.y()): - L.append(p) - pant = p - - return QgsGeometry.fromPolylineXY(L) - -def clotX(theta): - return 1-theta**2/10+theta**4/216 - -def clotY(theta): - return theta/3-theta**3/42 - -def lastAzimuth(geo): - pol=qgsGeometryToPolyline(geo) - return azimuth(pol[-2],pol[-1]) - -def xrange(n): - for i in range(int(n)): - yield i - yield n - -def polyCircle(layer, data, index, layer2, i): - pass - -def polyTransCircle(layer, data, index, layer2, i, ic): - - LsMax=data["R"]*abs(data["D"])*np.pi/180 - LsMin=0 - - fcount=featureCount(layer) - if fcount>0: - l1, l2=getTangentesGeometry(layer2, ic, i) - d=deflection(layer2, i) - PI=qgsGeometryToPolyline(l1)[-1] - data["Disable"].append("C") - - else: - l1, l2=getTangentesGeometry(layer2, ic, i) - d=deflection(layer2, i) - PI=qgsGeometryToPolyline(l1)[-1] - if l1 is None: - l1=QgsGeometry(l2) - dd=diff(qgsGeometryToPolyline(l2)[0], qgsGeometryToPolyline(l2)[-1]) - l2.translate(dd.x(), dd.y()) - elif l2 is None: - l2=QgsGeometry(l1) - dd=diff(qgsGeometryToPolyline(l1)[-1], qgsGeometryToPolyline(l2)[0]) - l2.translate(dd.x(), dd.y()) - - startAngle=azi(qgsGeometryToPolyline(l1)) - angle=90-(data["D"]+startAngle) - angle=angle if angle>0 else 360+angle - angle=angle if angle<360 else angle-360 - p1=p2QgsPoint(PI) - p2=p2QgsPoint(data["L"]*np.cos(np.deg2rad(angle))+p1.x(), data["L"]*np.sin(np.deg2rad(angle))+p1.y()) - line=QgsGeometry.fromPolyline([p1,p2]) - - a1=azi(polyline(l1)) - a2=azi(polyline(l2)) - msgLog("a1: "+str(a1)+" "+"a2: "+str(a2)) - - - data["C"] = True - corda = 2 * data["R"] * np.sin(np.deg2rad(abs(data["D"]) / 2)) - - - p1 = p2QgsPoint(l1.interpolate(l1.length() - data["T"]).asPoint()) - p2 = p2QgsPoint(l2.interpolate(data["T"]).asPoint()) - PI = p2QgsPoint(PI) - - p1=p2QgsPoint(p1) - p2=p2QgsPoint(p2) - - feat1 = QgsFeature(layerFields()) - feat2 = QgsFeature(layerFields()) - feat3 = QgsFeature(layerFields()) - feat1.setAttributes(['E',"",data["R"],data["D"],data["T"],data["L"]]) - feat2.setAttributes(['C',"",data["R"],data["D"],data["T"],data["L"]]) - feat3.setAttributes(['E',"",data["R"],data["D"],data["T"],data["L"]]) - - # if ((a2 - a1 >= 0 and (a1 <= 90 or a1 >= 270)) or (a2 - a1 <= 0 and (a1 >= 90 or a1 <= 270))) and not ( - # (abs(a1 - a2) > 180 or (a1 < 90 and a2 > 90) or (a1 < 90, a2 < 90)) and not (a2 - a1) < 0): - - pointsT1 = [p2QgsPoint(clotX(L ** 2 / (2 * data["R"] * data["L"])) * L, clotY(L ** 2 / (2 * data["R"] * data["L"])) * L) - for L in xrange(data["L"])] - pointsT2 = list(reversed([p2QgsPoint(clotX(L ** 2 / (2 * data["R"] * data["L"])) * L, 1000 - clotY(L ** 2 / (2 * data["R"] * data["L"])) * L) - for L in xrange(data["L"])])) - - IpointsT1 = [p2QgsPoint(clotX(L ** 2 / (2 * data["R"] * data["L"])) * L, 1000 - clotY(L ** 2 / (2 * data["R"] * data["L"])) * L) - for L in xrange(data["L"])] - IpointsT2 = list(reversed([p2QgsPoint(clotX(L ** 2 / (2 * data["R"] * data["L"])) * L, clotY(L ** 2 / (2 * data["R"] * data["L"])) * L) - for L in xrange(data["L"])])) - - g1=QgsGeometry.fromPolyline(pointsT1) - dd = diff(p1, pointsT1[0]) - g1.translate(dd.x(), dd.y()) - g1.rotate(polyline(l1)[0].azimuth(polyline(l1)[-1])-90,polyline(g1)[0]) - g2=QgsGeometry.fromPolyline(pointsT2) - dd = diff(p2, pointsT2[-1]) - g2.translate(dd.x(), dd.y()) - g2.rotate(polyline(l2)[0].azimuth(polyline(l2)[-1])+90,polyline(g2)[-1]) - - Ig1 = QgsGeometry.fromPolyline(IpointsT1) - dd = diff(p1, IpointsT1[0]) - Ig1.translate(dd.x(), dd.y()) - Ig1.rotate(polyline(l1)[0].azimuth(polyline(l1)[-1]) - 90, polyline(Ig1)[0]) - Ig2 = QgsGeometry.fromPolyline(IpointsT2) - dd = diff(p2, IpointsT2[-1]) - Ig2.translate(dd.x(), dd.y()) - Ig2.rotate(polyline(l2)[0].azimuth(polyline(l2)[-1]) + 90, polyline(Ig2)[-1]) - - g1, g2 = [g1, g2] if polyline(g1)[-1].distance(polyline(g2)[0]) \ - <= polyline(Ig1)[-1].distance(polyline(Ig2)[0]) else [Ig1, Ig2] - - feat1.setGeometry(g1) - feat3.setGeometry(g2) - - p = p2QgsPoint((p1.x() + p2.x()) / 2, (p2.y() + p1.y()) / 2) - p1=p2QgsPoint(polyline(g1)[-1]) - p2=p2QgsPoint(polyline(g2)[0]) - tmp_line=QgsGeometry.fromPolyline([p2QgsPoint(PI),p]) - theta=data["L"]/(2*data["R"]) - ys=clotY(theta)*data["L"] - p=ys-data["R"]*(1-np.cos(theta)) - E = abs((data["R"]+p)/np.cos(np.deg2rad((data["D"]+2*np.rad2deg(theta))/2))-data["R"]) - msgLog("E="+str(E)) - p=p2QgsPoint(tmp_line.interpolate(E).asPoint()) - circularRing = QgsCircularString() - circularRing.setPoints([ - p1, - p, - p2 - ] - ) - feat2.setGeometry(circularRing) - layer.dataProvider().addFeatures([feat1, feat2, feat3]) - - return data - -def circleArc(layer, data, index, layer2, i, ic): - fcount=featureCount(layer) - if fcount>0: - l1, l2=getTangentesGeometry(layer2, ic, i) - d=deflection(layer2, i) - PI=qgsGeometryToPolyline(l1)[-1] - else: - l1, l2=getTangentesGeometry(layer2, ic, i) - d=deflection(layer2, i) - PI=qgsGeometryToPolyline(l1)[-1] - if l1 is None: - l1=QgsGeometry(l2) - dd=diff(qgsGeometryToPolyline(l2)[0], qgsGeometryToPolyline(l2)[-1]) - l2.translate(dd.x(), dd.y()) - elif l2 is None: - l2=QgsGeometry(l1) - dd=diff(qgsGeometryToPolyline(l1)[-1], qgsGeometryToPolyline(l2)[0]) - l2.translate(dd.x(), dd.y()) - - pl=qgsGeometryToPolyline(l1) - startAngle=azi(pl) - angle=90-(data["D"]+startAngle) - angle=angle if angle>0 else 360+angle - angle=angle if angle<360 else angle-360 - angleInternal=180-d - p1=p2QgsPoint(PI) - corda=2*data["R"]*np.sin(np.deg2rad(angleInternal/2)) - p2=p2QgsPoint(corda*np.cos(np.deg2rad(angle))+p1.x(), corda*np.sin(np.deg2rad(angle))+p1.y()) - - T=None - E=None - p=None - arc=None - - - - if index=="R": - if data["C"]: - data["L"]=np.deg2rad(abs(d))*data["R"]*abs(data["D"]/d) - corda=2*data["R"]*np.sin(np.deg2rad(abs(data["D"])/2)) - data["T"]=abs(corda/(2*np.tan(np.deg2rad((abs(data["D"]))/2)))) - p1=p2QgsPoint(l1.interpolate(l1.length()-data["T"]).asPoint()) - p2=p2QgsPoint(l2.interpolate(data["T"]).asPoint()) - PI=p2QgsPoint(PI) - else: - data["L"]=np.deg2rad(abs(data["D"]))*data["R"] - corda=2*data["R"]*np.sin(np.deg2rad(abs(data["D"])/2)) - T=abs(corda/(2*np.tan(np.deg2rad((abs(data["D"]))/2)))) - p1=p2QgsPoint(l1.interpolate(l1.length()-data["T"]).asPoint()) - l2=QgsGeometry(l1) - dd=diff(p1, qgsGeometryToPolyline(l2)[0]) - l2.translate(dd.x(), dd.y()) - dd=diff(l2.interpolate(T).asPoint(), qgsGeometryToPolyline(l2)[0]) - l2.translate(dd.x(), dd.y()) - l2.rotate(data["D"], QgsPointXY(qgsGeometryToPolyline(l2)[0])) - l2.extendLine(0, 500000) - p1=p2QgsPoint(l1.interpolate(l1.length()-data["T"]).asPoint()) - p2=p2QgsPoint(l2.interpolate(data["T"]).asPoint()) - PI=p2QgsPoint(qgsGeometryToPolyline(l2)[0]) - - elif index=="L": - if data["C"]: - if data["L"] > np.deg2rad(abs(d))*data["R"]*abs(data["D"]/d): - data["D"]=d/abs(d)*abs(abs(d)*data["L"]/(np.deg2rad(abs(d))*data["R"])) - if data["L"]>np.deg2rad(abs(d))*data["R"]: - data["R"]=data["L"]/(np.deg2rad(abs(d))) - corda=2*data["R"]*np.sin(np.deg2rad(abs(d)/2)) - data["T"]=abs(corda/(2*np.tan(np.deg2rad((abs(d))/2)))) - p1=p2QgsPoint(l1.interpolate(l1.length()-data["T"]).asPoint()) - p2=p2QgsPoint(l2.interpolate(data["T"]).asPoint()) - PI=p2QgsPoint(PI) - else: - data["R"]=data["L"]/(np.deg2rad(abs(data["D"]))) - corda=2*data["R"]*np.sin(np.deg2rad(abs(data["D"])/2)) - T=abs(corda/(2*np.tan(np.deg2rad(abs(data["D"])/2)))) - p1=p2QgsPoint(l1.interpolate(l1.length()-data["T"]).asPoint()) - l2=QgsGeometry(l1) - dd=diff(p1, qgsGeometryToPolyline(l2)[0]) - l2.translate(dd.x(), dd.y()) - dd=diff(l2.interpolate(T).asPoint(), qgsGeometryToPolyline(l2)[0]) - l2.translate(dd.x(), dd.y()) - l2.rotate(data["D"], QgsPointXY(qgsGeometryToPolyline(l2)[0])) - p1=p2QgsPoint(l1.interpolate(l1.length()-data["T"]).asPoint()) - p2=p2QgsPoint(l2.interpolate(data["T"]).asPoint()) - PI=p2QgsPoint(qgsGeometryToPolyline(l2)[0]) - - - elif index=="T": - if data["C"]: - corda=data["T"]*abs(2*np.tan(np.deg2rad((d)/2))) - data["L"]=np.deg2rad(abs(d))*data["R"]*abs(data["D"]/d) - data["R"]=corda/(2*np.sin(np.deg2rad(angleInternal/2))) - data["L"]=np.deg2rad(abs(d))*data["R"]*abs(data["D"]/d) - p1=p2QgsPoint(l1.interpolate(l1.length()-data["T"]).asPoint()) - p2=p2QgsPoint(l2.interpolate(data["T"]).asPoint()) - PI=p2QgsPoint(PI) - T=data["T"] - else: - corda=2*data["R"]*np.sin(np.deg2rad(abs(data["D"])/2)) - T=abs(corda/(2*np.tan(np.deg2rad((abs(data["D"]))/2)))) - p1=p2QgsPoint(l1.interpolate(l1.length()-data["T"]).asPoint()) - l2=QgsGeometry(l1) - dd=diff(p1, qgsGeometryToPolyline(l2)[0]) - l2.translate(dd.x(), dd.y()) - dd=diff(l2.interpolate(T).asPoint(), qgsGeometryToPolyline(l2)[0]) - l2.translate(dd.x(), dd.y()) - l2.rotate(data["D"], QgsPointXY(qgsGeometryToPolyline(l2)[0])) - p1=p2QgsPoint(l1.interpolate(l1.length()-data["T"]).asPoint()) - p2=p2QgsPoint(l2.interpolate(data["T"]).asPoint()) - PI=p2QgsPoint(qgsGeometryToPolyline(l2)[0]) - - - elif index=="D": - if data["C"]: - T=data["T"] - data["L"]=np.deg2rad(abs(d))*data["R"]*abs(data["D"]/d) - p1=p2QgsPoint(l1.interpolate(l1.length()-data["T"]).asPoint()) - p2=p2QgsPoint(l2.interpolate(data["T"]).asPoint()) - PI=p2QgsPoint(PI) - E=abs(T*np.tan(np.deg2rad(d/4))) - l2=QgsGeometry(l1) - dd=diff(PI, qgsGeometryToPolyline(l2)[0]) - l2.translate(dd.x(), dd.y()) - l2.rotate(abs((abs(d)-180)/d*data["D"]+180-abs(d))*d/abs(d)+d, qgsGeometryToPolyline(l2)[0]) - p=p2QgsPoint((p1.x()+p2.x())/2, (p2.y()+p1.y())/2) - tmp_line=QgsGeometry.fromPolyline([p2QgsPoint(PI),p]) - p=p2QgsPoint(tmp_line.interpolate(E).asPoint()) - arc=QgsCircularString() - arc.setPoints([p1, p, p2]) - l3=QgsGeometry(l2) - dd=diff(qgsGeometryToPolyline(l3)[-1], qgsGeometryToPolyline(l3)[0]) - l3.translate(dd.x(), dd.y()) - l3.rotate(-90*d/abs(d), qgsGeometryToPolyline(l3)[0]) - l2=unifyGeometry(l2,l3) - arc=QgsCircularString() - arc.setPoints([p1,p,p2]) - arc=splitGeometry(l2, createGeometry(arc)) - - else: - data["L"]=np.deg2rad(abs(data["D"]))*data["R"] - corda=2*data["R"]*np.sin(np.deg2rad(abs(data["D"])/2)) - T=abs(corda/(2*np.tan(np.deg2rad((abs(data["D"]))/2)))) - p1=p2QgsPoint(l1.interpolate(l1.length()-data["T"]).asPoint()) - l2=QgsGeometry(l1) - dd=diff(p1, qgsGeometryToPolyline(l2)[0]) - l2.translate(dd.x(), dd.y()) - PI=p2QgsPoint(l2.interpolate(T).asPoint()) - dd=diff(PI, qgsGeometryToPolyline(l2)[0]) - l2.translate(dd.x(), dd.y()) - l2.rotate(data["D"], qgsGeometryToPolyline(l2)[0]) - p2=p2QgsPoint(l2.interpolate(T).asPoint()) - - elif index=="C": - if data["C"]: - data["D"]=d - data["L"]=np.deg2rad(abs(data["D"]))*data["R"] - corda=2*data["R"]*np.sin(np.deg2rad(abs(data["D"])/2)) - data["T"]=abs(corda/(2*np.tan(np.deg2rad((d)/2)))) - p1=p2QgsPoint(l1.interpolate(l1.length()-data["T"]).asPoint()) - p2=p2QgsPoint(l2.interpolate(data["T"]).asPoint()) - PI=p2QgsPoint(PI) - else: - p1=p2QgsPoint(l1.interpolate(l1.length()-data["T"]).asPoint()) - p2=p2QgsPoint(l2.interpolate(data["T"]).asPoint()) - PI=p2QgsPoint(PI) - - elif index=="S": - data["C"]=True - # data["D"]=d - data["L"]=np.deg2rad(abs(data["D"]))*data["R"] - corda=2*data["R"]*np.sin(np.deg2rad(abs(data["D"])/2)) - #data["T"]=abs(corda/(2*np.tan(np.deg2rad((d)/2)))) - p1=p2QgsPoint(l1.interpolate(l1.length()-data["T"]).asPoint()) - p2=p2QgsPoint(l2.interpolate(data["T"]).asPoint()) - PI=p2QgsPoint(PI) - - if (data["T"]>l1.length() or data["T"]>l2.length()) and data["C"]: - data["L"]=np.deg2rad(abs(d))*data["R"]*abs(data["D"]/d) - corda=2*data["R"]*np.sin(np.deg2rad(abs(data["D"])/2)) - data["T"]=abs(corda/(2*np.tan(np.deg2rad((d)/2)))) - p1=p2QgsPoint(l1.interpolate(l1.length()-data["T"]).asPoint()) - p2=p2QgsPoint(l2.interpolate(data["T"]).asPoint()) - PI=p2QgsPoint(PI) - - T = data["T"] if T is None else T - E = abs(T*np.tan(np.deg2rad(data["D"]/4))) if E is None else E - - p=p2QgsPoint((p1.x()+p2.x())/2, (p2.y()+p1.y())/2) - #msgLog("p: " + str(p.x()) +"," +str(p.y())) - #msgLog("PI: " + str(PI.x()) +"," +str(PI.y())) - tmp_line=QgsGeometry.fromPolyline([p2QgsPoint(PI),p]) - p=p2QgsPoint(tmp_line.interpolate(E).asPoint()) - - feat = QgsFeature(layerFields()) - feat.setAttributes(['C',"",data["R"],data["D"],data["T"],data["L"]]) - # Create a QgsCircularStringV2 - circularRing = QgsCircularString() - # Set first point, intermediate point for curvature and end point - circularRing.setPoints([ - p1, - p, - p2] - ) -# data["R"]=QgsGeometryUtils.circleCenterRadius(p1,p,p2)[0] - circularRing=arc if arc else circularRing - feat.setGeometry(circularRing) - f2=QgsFeature(layer.fields()) - f2.setGeometry(l2) - layer.dataProvider().addFeatures([feat]) - - return data - - - - -def inSpiral(layer, data, index, layer2, i): - line1, line2=getTangentesGeometry(layer2,i) - angle=deflection(layer2,i) - PI=qgsGeometryToPolyline(line1)[-1] - if data["T"]>data["L"]: - data["T"]=data["L"] - - if index=="R": - pass - elif index=="L": - pass - elif index=="T": - pass - elif index=="D": - pass - elif index=="C": - pass - elif index=="S": - pass - - feat = QgsFeature(layer.fields()) - feat.setAttribute('Tipo', 'S') -# feat.setGeometry(QgsGeometry.) - layer.dataProvider().addFeatures([feat]) - return data - - -def outSpiral(layer, data, index, layer2, i): - line1, line2=getTangentesGeometry(layer2,i) - angle=deflection(layer2,i) - PI=qgsGeometryToPolyline(line1)[-1] - if data["T"]>data["L"]: - data["T"]=data["L"] - - if index=="R": - pass - elif index=="L": - pass - elif index=="T": - pass - elif index=="D": - pass - elif index=="C": - pass - elif index=="S": - pass - - feat = QgsFeature(layer.fields()) - feat.setAttribute('Tipo', 'S') -# feat.setGeometry(QgsGeometry.) - layer.dataProvider().addFeatures([feat]) - return data - - -def tangent(layer, data, index, layer2, i): - fcount=featureCount(layer) - if fcount>0: - fant=[f for f in layer.getFeatures()][fcount-1] - l1=fant.geometry() - l2=QgsGeometry(l1) - dd=diff(qgsGeometryToPolyline(fant.geometry())[-1],qgsGeometryToPolyline(fant.geometry())[0]) - l2.translate(dd.x(),dd.y()) - PI=qgsGeometryToPolyline(fant.geometry())[-1] - d=0 - data["Disable"].append("C") - - else: - l1, l2=getTangentesGeometry(layer2, i) - d=deflection(layer2, i) - PI=qgsGeometryToPolyline(l1)[-1] - if l1 is None: - l1=QgsGeometry(l2) - dd=diff(qgsGeometryToPolyline(l2)[0], qgsGeometryToPolyline(l2)[-1]) - l2.translate(dd.x(), dd.y()) - elif l2 is None: - l2=QgsGeometry(l1) - dd=diff(qgsGeometryToPolyline(l1)[-1], qgsGeometryToPolyline(l2)[0]) - l2.translate(dd.x(), dd.y()) - - startAngle=azi(qgsGeometryToPolyline(l1)) - angle=90-(data["D"]+startAngle) - angle=angle if angle>0 else 360+angle - angle=angle if angle<360 else angle-360 - p1=p2QgsPoint(PI) - p2=p2QgsPoint(data["L"]*np.cos(np.deg2rad(angle))+p1.x(), data["L"]*np.sin(np.deg2rad(angle))+p1.y()) - line=QgsGeometry.fromPolyline([p1,p2]) - - if data["T"]>l1.length(): - data["T"]=l1.length - - if index=="R": - pass - - elif index=="L": - if data["C"]: - Lmax=np.sqrt(l1.length()**2+l2.length()**2-2*l1.length()*l2.length()*np.cos(np.deg2rad(360-d))) - if data["L"]>Lmax: - data["L"]=Lmax - data["T"]=abs(data["L"]/(2*np.tan(np.deg2rad((d)/2)))) - data["D"]=d-90 - p1=p2QgsPoint(l1.interpolate(l1.length()-data["T"]).asPoint()) - p2=p2QgsPoint(l2.interpolate(data["T"]).asPoint()) - else: - p1=p2QgsPoint(l1.interpolate(l1.length()-data["T"]).asPoint()) - dd=diff(p1,PI) - line.translate(dd.x(), dd.y()) - p2=qgsGeometryToPolyline(line)[-1] - - elif index=="T": - if data["C"]: - data["L"]=abs(data["T"]*2*np.tan(np.deg2rad((d)/2))) - p1=p2QgsPoint(l1.interpolate(l1.length()-data["T"]).asPoint()) - p2=p2QgsPoint(l2.interpolate(data["T"]).asPoint()) - else: - p1=p2QgsPoint(l1.interpolate(l1.length()-data["T"]).asPoint()) - dd=diff(p1,PI) - line.translate(dd.x(), dd.y()) - p2=qgsGeometryToPolyline(line)[-1] - - elif index=="D": - if data["C"]: - data["D"]=0 - data["T"]=0 - data["C"]=False - p2=qgsGeometryToPolyline(line)[-1] - else: - p1=p2QgsPoint(l1.interpolate(l1.length()-data["T"]).asPoint()) - dd=diff(p1,PI) - line.translate(dd.x(), dd.y()) - p2=qgsGeometryToPolyline(line)[-1] - - elif index=="C": - if data["C"]: - Lmax=np.sqrt(l1.length()**2+l2.length()**2-2*l1.length()*l2.length()*np.cos(np.deg2rad(360-d))) - if data["L"]>Lmax: - data["L"]=Lmax - data["T"]=abs(data["L"]/(2*np.tan(np.deg2rad((d)/2)))) - data["D"]=d-90 - p1=p2QgsPoint(l1.interpolate(l1.length()-data["T"]).asPoint()) - p2=p2QgsPoint(l2.interpolate(data["T"]).asPoint()) - else: - data["D"]=d - if data["L"]0: - fant=[f for f in layer.getFeatures()][fcount-1] - l1=fant.geometry() - l2=QgsGeometry(l1) - dd=diff(qgsGeometryToPolyline(fant.geometry())[-1], qgsGeometryToPolyline(fant.geometry())[0]) - l2.translate(dd.x(),dd.y()) - PI=qgsGeometryToPolyline(fant.geometry())[-1] - d=float(data["D"]) if not index=="S" else 90.0 - l2.rotate(d, QgsPointXY(PI)) - - else: - data["Disable"].append("C") - data["Disable"].append("D") - data["Disable"].append("R") - data["Disable"].append("L") - data["Disable"].append("T") - return data - - data["Disable"].append("C") - startAngle=azi(qgsGeometryToPolyline(l1)) - angle=90-(data["D"]+startAngle) - angle=angle if angle>0 else 360+angle - angle=angle if angle<360 else angle-360 - angleInternal=180-abs(d) - p1=p2QgsPoint(PI) - corda=2*data["R"]*np.sin(np.deg2rad(angleInternal/2)) - p2=p2QgsPoint(corda*np.cos(np.deg2rad(angle))+p1.x(), corda*np.sin(np.deg2rad(angle))+p1.y()) - - T=None - E=None - p=None - arc=None - - if index=="R": - pass - elif index=="L": - data["R"]=data["L"]/(np.deg2rad(abs(data["D"]))) - corda=2*data["R"]*np.sin(np.deg2rad(abs(data["D"])/2)) - T=abs(corda/(2*np.tan(np.deg2rad(abs(data["D"])/2)))) - p1=p2QgsPoint(l1.interpolate(l1.length()-data["T"]).asPoint()) - l2=QgsGeometry(l1) - dd=diff(p1, qgsGeometryToPolyline(l2)[0]) - l2.translate(dd.x(), dd.y()) - dd=diff(l2.interpolate(T).asPoint(), qgsGeometryToPolyline(l2)[0]) - l2.translate(dd.x(), dd.y()) - l2.rotate(data["D"], QgsPointXY(qgsGeometryToPolyline(l2)[0])) - p1=p2QgsPoint(l1.interpolate(l1.length()-data["T"]).asPoint()) - p2=p2QgsPoint(l2.interpolate(data["T"]).asPoint()) - PI=p2QgsPoint(qgsGeometryToPolyline(l2)[0]) - - - elif index=="T": - corda=2*data["R"]*np.sin(np.deg2rad(abs(data["D"])/2)) - T=abs(corda/(2*np.tan(np.deg2rad((abs(data["D"]))/2)))) - p1=p2QgsPoint(l1.interpolate(l1.length()-data["T"]).asPoint()) - l2=QgsGeometry(l1) - dd=diff(p1, qgsGeometryToPolyline(l2)[0]) - l2.translate(dd.x(), dd.y()) - dd=diff(l2.interpolate(T).asPoint(), qgsGeometryToPolyline(l2)[0]) - l2.translate(dd.x(), dd.y()) - l2.rotate(data["D"], QgsPointXY(qgsGeometryToPolyline(l2)[0])) - p1=p2QgsPoint(l1.interpolate(l1.length()-data["T"]).asPoint()) - p2=p2QgsPoint(l2.interpolate(data["T"]).asPoint()) - PI=p2QgsPoint(qgsGeometryToPolyline(l2)[0]) - - - elif index=="D": - data["L"]=np.deg2rad(abs(data["D"]))*data["R"] - corda=2*data["R"]*np.sin(np.deg2rad(abs(data["D"])/2)) - T=abs(corda/(2*np.tan(np.deg2rad((abs(data["D"]))/2)))) - p1=p2QgsPoint(l1.interpolate(l1.length()-data["T"]).asPoint()) - l2=QgsGeometry(l1) - dd=diff(p1, qgsGeometryToPolyline(l2)[0]) - l2.translate(dd.x(), dd.y()) - PI=p2QgsPoint(l2.interpolate(T).asPoint()) - dd=diff(PI, qgsGeometryToPolyline(l2)[0]) - l2.translate(dd.x(), dd.y()) - l2.rotate(data["D"], qgsGeometryToPolyline(l2)[0]) - p2=p2QgsPoint(l2.interpolate(T).asPoint()) - - elif index=="C": - pass - elif index=="S": - data["C"]=True - data["D"]=90 - data["L"]=np.deg2rad(abs(data["D"]))*data["R"] - data["T"]=0 - - if (data["T"]>l1.length() or data["T"]>l2.length()) and data["C"]: - data["L"]=np.deg2rad(abs(d))*data["R"]*abs(data["D"]/d) - corda=2*data["R"]*np.sin(np.deg2rad(abs(data["D"])/2)) - data["T"]=abs(corda/(2*np.tan(np.deg2rad((d)/2)))) - p1=p2QgsPoint(l1.interpolate(l1.length()-data["T"]).asPoint()) - PI=p2QgsPoint(PI) - corda=2*data["R"]*np.sin(np.deg2rad(angleInternal/2)) - p2=p2QgsPoint(corda*np.cos(np.deg2rad(angle))+p1.x(), corda*np.sin(np.deg2rad(angle))+p1.y()) - - T = float(data["T"]) if T is None else T - E = abs(T*np.tan(np.deg2rad(data["D"]/4))) if E is None else E - - p=p2QgsPoint((p1.x()+p2.x())/2, (p2.y()+p1.y())/2) - tmp_line=QgsGeometry.fromPolyline([p2QgsPoint(PI),p]) - p=p2QgsPoint(tmp_line.interpolate(E).asPoint()) - - feat = QgsFeature(layer.fields()) - feat.setAttribute('Tipo', 'C') - # Create a QgsCircularStringV2 - circularRing = QgsCircularString() - # Set first point, intermediate point for curvature and end point - circularRing.setPoints([ - p1, - p, - p2] - ) -# data["R"]=QgsGeometryUtils.circleCenterRadius(p1,p,p2)[0] - circularRing=arc if arc else circularRing - feat.setGeometry(circularRing) - f2=QgsFeature(layer.fields()) - f2.setGeometry(l2) - layer.dataProvider().addFeatures([feat]) - - data["Disable"].append("C") - return data - - - - -def inSpiral2(layer, data, index, layer2, i): - line1, line2=getTangentesGeometry(layer2,i) - angle=deflection(layer2,i) - PI=qgsGeometryToPolyline(line1)[-1] - if data["T"]>data["L"]: - data["T"]=data["L"] - - if index=="R": - pass - elif index=="L": - pass - elif index=="T": - pass - elif index=="D": - pass - elif index=="C": - pass - elif index=="S": - pass - - feat = QgsFeature(layer.fields()) - feat.setAttribute('Tipo', 'S') -# feat.setGeometry(QgsGeometry.) - layer.dataProvider().addFeatures([feat]) - return data - - -def outSpiral2(layer, data, index, layer2, i): - line1, line2=getTangentesGeometry(layer2,i) - angle=deflection(layer2,i) - PI=qgsGeometryToPolyline(line1)[-1] - if data["T"]>data["L"]: - data["T"]=data["L"] - - if index=="R": - pass - elif index=="L": - pass - elif index=="T": - pass - elif index=="D": - pass - elif index=="C": - pass - elif index=="S": - pass - - feat = QgsFeature(layer.fields()) - feat.setAttribute('Tipo', 'S') -# feat.setGeometry(QgsGeometry.) - layer.dataProvider().addFeatures([feat]) - return data - - -def tangent2(layer, data, index, layer2, i): - fcount=featureCount(layer) - if fcount>0: - fant=[f for f in layer.getFeatures()][fcount-1] - length=fant.geometry().length() - lpt=qgsGeometryToPolyline(fant.geometry())[-1] - angle=90-lastAzimuth(fant.geometry()) - lpt=p2QgsPoint(lpt.x()-length*np.cos(np.deg2rad(angle)), lpt.y()-length*np.sin(np.deg2rad(angle))) - - l1=QgsGeometry.fromPolyline([p2QgsPoint(lpt), p2QgsPoint(qgsGeometryToPolyline(fant.geometry())[-1])]) - l2=QgsGeometry(l1) - dd=diff(qgsGeometryToPolyline(fant.geometry())[-1],qgsGeometryToPolyline(fant.geometry())[0]) - l2.translate(dd.x(),dd.y()) - PI=qgsGeometryToPolyline(fant.geometry())[-1] - d=0 - data["Disable"].append("C") - - else: - l1, l2=getTangentesGeometry(layer2, i) - d=deflection(layer2, i) - PI=qgsGeometryToPolyline(l1)[-1] - if l1 is None: - l1=QgsGeometry(l2) - dd=diff(qgsGeometryToPolyline(l2)[0], qgsGeometryToPolyline(l2)[-1]) - l2.translate(dd.x(), dd.y()) - elif l2 is None: - l2=QgsGeometry(l1) - dd=diff(qgsGeometryToPolyline(l1)[-1], qgsGeometryToPolyline(l2)[0]) - l2.translate(dd.x(), dd.y()) - - startAngle=azi(qgsGeometryToPolyline(l1)) - angle=90-(data["D"]+startAngle) - angle=angle if angle>0 else 360+angle - angle=angle if angle<360 else angle-360 - p1=p2QgsPoint(PI) - p2=p2QgsPoint(data["L"]*np.cos(np.deg2rad(angle))+p1.x(), data["L"]*np.sin(np.deg2rad(angle))+p1.y()) - line=QgsGeometry.fromPolyline([p1,p2]) - - if data["T"]>l1.length(): - data["T"]=l1.length - - if index=="R": - pass - - elif index=="L": - if data["C"]: - Lmax=np.sqrt(l1.length()**2+l2.length()**2-2*l1.length()*l2.length()*np.cos(np.deg2rad(360-d))) - if data["L"]>Lmax: - data["L"]=Lmax - data["T"]=abs(data["L"]/(2*np.tan(np.deg2rad((d)/2)))) - data["D"]=d-90 - p1=p2QgsPoint(l1.interpolate(l1.length()-data["T"]).asPoint()) - p2=p2QgsPoint(l2.interpolate(data["T"]).asPoint()) - else: - p1=p2QgsPoint(l1.interpolate(l1.length()-data["T"]).asPoint()) - dd=diff(p1,PI) - line.translate(dd.x(), dd.y()) - p2=qgsGeometryToPolyline(line)[-1] - - elif index=="T": - if data["C"]: - data["L"]=abs(data["T"]*2*np.tan(np.deg2rad((d)/2))) - p1=p2QgsPoint(l1.interpolate(l1.length()-data["T"]).asPoint()) - p2=p2QgsPoint(l2.interpolate(data["T"]).asPoint()) - else: - p1=p2QgsPoint(l1.interpolate(l1.length()-data["T"]).asPoint()) - dd=diff(p1,PI) - line.translate(dd.x(), dd.y()) - p2=qgsGeometryToPolyline(line)[-1] - - elif index=="D": - if data["C"]: - data["D"]=0 - data["T"]=0 - data["C"]=False - p2=qgsGeometryToPolyline(line)[-1] - else: - p1=p2QgsPoint(l1.interpolate(l1.length()-data["T"]).asPoint()) - dd=diff(p1,PI) - line.translate(dd.x(), dd.y()) - p2=qgsGeometryToPolyline(line)[-1] - - elif index=="C": - if data["C"]: - Lmax=np.sqrt(l1.length()**2+l2.length()**2-2*l1.length()*l2.length()*np.cos(np.deg2rad(360-d))) - if data["L"]>Lmax: - data["L"]=Lmax - data["T"]=abs(data["L"]/(2*np.tan(np.deg2rad((d)/2)))) - data["D"]=d-90 - p1=p2QgsPoint(l1.interpolate(l1.length()-data["T"]).asPoint()) - p2=p2QgsPoint(l2.interpolate(data["T"]).asPoint()) - else: - data["D"]=d - if data["L"] 0 + +def refreshCanvas(ifac, layer:QgsVectorLayer = None): + if layer and ifac.mapCanvas().isCachingEnabled(): + layer.triggerRepaint() + ifac.mapCanvas().refresh() + +def tangentFeaturesFromPointList(layer: QgsVectorLayer, list:list): + if len(list)>=2: + anterior=list[0] + for p in list[1:]: + feat = QgsFeature(layer.fields()) + feat.setAttribute('Tipo', 'T') + feat.setGeometry(QgsGeometry.fromPolyline([anterior,p])) + layer.dataProvider().addFeatures([feat]) + layer.updateExtents() + anterior=p + + +def perp( a ) : + b = np.empty_like(a) + b[0] = -a[1] + b[1] = a[0] + return b + +# line segment a given by endpoints a1, a2 +# line segment b given by endpoints b1, b2 +# return +def seg_intersect(a1,a2, b1,b2) : + a1=np.array([a1.x(), a1.y()]) + a2=np.array([a2.x(), a2.y()]) + b1=np.array([b1.x(), b1.y()]) + b2=np.array([b2.x(), b2.y()]) + da = a2-a1 + db = b2-b1 + dp = a1-b1 + dap = perp(da) + denom = np.dot( dap, db) + num = np.dot( dap, dp ) + pi=(num / denom.astype(float))*db + b1 + return p2QgsPoint(pi[0], pi[1]) + + +def getTangentesGeometry(layer, i, j=0): + layer: QgsVectorLayer + G=[f.geometry() for f in layer.getFeatures()] + if j==0: + if i >len(G)-1: + G=[G[-1], None] + elif i==0: + G=[None, G[0]] + else: + G=[G[i-1],G[i]] + else: + l1:QgsGeometry + l2:QgsGeometry + l1=G[i] + l2=G[j] + g1=qgsGeometryToPolyline(l1) + g2=qgsGeometryToPolyline(l2) + pi=p2QgsPoint(seg_intersect(g1[0],g1[-1],g2[0],g2[-1])) + G=[QgsGeometry.fromPolyline([p2QgsPoint(g1[0]),pi]), QgsGeometry.fromPolyline([pi,p2QgsPoint(g2[-1])])] + + return G + +def deflection(layer2, i): + line1, line2=getTangentesGeometry(layer2,i) + a1, a2 = [azimuth(qgsGeometryToPolyline(l)[0], qgsGeometryToPolyline(l)[-1]) for l in [line1, line2]] + a=a2-a1 + if abs(a)>180.0: + a=a/abs(a)*abs(180-a) + return a + +def azi(p1,p2=None): + if not p2: + return azimuth(p1[-2], (p1[-1])) + return azimuth(p1, p2) + +def featureCount(layer): + return sum([1 for f in layer.getFeatures()]) + +def featuresList(layer): + return [f for f in layer.getFeatures()] + +def cleanLayer(layer, i=0): + F=[] + + if i==0: + F=[f.id() for f in layer.getFeatures] + else: + F=[f.id() for f in featuresList(layer)[-i:]] + layer.dataProvider().deleteFeatures(F) + +def geolengh(geom): + s=0 + L=qgsGeometryToPolyline(geom)[1:] + p0=L[0] + for pt in L: + s+=p0.distance(pt) + p0=pt + +def contains(rect, geom): + for pt in qgsGeometryToPolyline(geom): + if not rect.contains(pt): + return False + return True + +def splitFeatures(f1, f2): + ''' + + :param f1: feature que define o corte + :param f2: trimmed feature + :return:geometry + ''' + g1 = QgsGeometry(f1.geometry()) + g2 = QgsGeometry(f2.geometry()) + gg = g2.splitGeometry(qgsGeometryToPolyline(g1), False) + gg=gg[1][0] + return g2 if contains(g1.boundingBox(), gg) else gg + +def splitGeometry(g1, g2): + ''' + + :param g1: defining line and rectangle + :param g2:line to split + :return: geometry + ''' + + gg = g2.splitGeometry(qgsGeometryToPolyline(g1), False)[1][0] + return g2 if contains(g1.boundingBox(), gg) else gg + + +def createGeometry(geom): + return QgsGeometry.fromWkt(geom.asWkt()) + + +def unifyGeometry(g1, g2): + PL = polyline(g1) + polyline(g2) + pant = PL[0] + L = [pant] + for p in PL[1:]: + if not (p.x() == pant.x() and p.y() == pant.y()): + L.append(p) + pant = p + + return QgsGeometry.fromPolylineXY(L) + +def clotX(theta): + return 1-theta**2/10+theta**4/216 + +def clotY(theta): + return theta/3-theta**3/42 + +def lastAzimuth(geo): + pol=qgsGeometryToPolyline(geo) + return azimuth(pol[-2],pol[-1]) + +def xrange(n): + for i in range(int(n)): + yield i + yield n + +def polyCircle(layer, data, index, layer2, i): + pass + +def polyTransCircle(layer, data, index, layer2, i, ic): + + LsMax=data["R"]*abs(data["D"])*np.pi/180 + LsMin=0 + + fcount=featureCount(layer) + if fcount>0: + l1, l2=getTangentesGeometry(layer2, ic, i) + d=deflection(layer2, i) + PI=qgsGeometryToPolyline(l1)[-1] + data["Disable"].append("C") + + else: + l1, l2=getTangentesGeometry(layer2, ic, i) + d=deflection(layer2, i) + PI=qgsGeometryToPolyline(l1)[-1] + if l1 is None: + l1=QgsGeometry(l2) + dd=diff(qgsGeometryToPolyline(l2)[0], qgsGeometryToPolyline(l2)[-1]) + l2.translate(dd.x(), dd.y()) + elif l2 is None: + l2=QgsGeometry(l1) + dd=diff(qgsGeometryToPolyline(l1)[-1], qgsGeometryToPolyline(l2)[0]) + l2.translate(dd.x(), dd.y()) + + startAngle=azi(qgsGeometryToPolyline(l1)) + angle=90-(data["D"]+startAngle) + angle=angle if angle>0 else 360+angle + angle=angle if angle<360 else angle-360 + p1=p2QgsPoint(PI) + p2=p2QgsPoint(data["L"]*np.cos(np.deg2rad(angle))+p1.x(), data["L"]*np.sin(np.deg2rad(angle))+p1.y()) + line=QgsGeometry.fromPolyline([p1,p2]) + + a1=azi(polyline(l1)) + a2=azi(polyline(l2)) + msgLog("a1: "+str(a1)+" "+"a2: "+str(a2)) + + + data["C"] = True + corda = 2 * data["R"] * np.sin(np.deg2rad(abs(data["D"]) / 2)) + + + p1 = p2QgsPoint(l1.interpolate(l1.length() - data["T"]).asPoint()) + p2 = p2QgsPoint(l2.interpolate(data["T"]).asPoint()) + PI = p2QgsPoint(PI) + + p1=p2QgsPoint(p1) + p2=p2QgsPoint(p2) + + feat1 = QgsFeature(layerFields()) + feat2 = QgsFeature(layerFields()) + feat3 = QgsFeature(layerFields()) + feat1.setAttributes(['E',"",data["R"],data["D"],data["T"],data["L"]]) + feat2.setAttributes(['C',"",data["R"],data["D"],data["T"],data["L"]]) + feat3.setAttributes(['E',"",data["R"],data["D"],data["T"],data["L"]]) + + # if ((a2 - a1 >= 0 and (a1 <= 90 or a1 >= 270)) or (a2 - a1 <= 0 and (a1 >= 90 or a1 <= 270))) and not ( + # (abs(a1 - a2) > 180 or (a1 < 90 and a2 > 90) or (a1 < 90, a2 < 90)) and not (a2 - a1) < 0): + + pointsT1 = [p2QgsPoint(clotX(L ** 2 / (2 * data["R"] * data["L"])) * L, clotY(L ** 2 / (2 * data["R"] * data["L"])) * L) + for L in xrange(data["L"])] + pointsT2 = list(reversed([p2QgsPoint(clotX(L ** 2 / (2 * data["R"] * data["L"])) * L, 1000 - clotY(L ** 2 / (2 * data["R"] * data["L"])) * L) + for L in xrange(data["L"])])) + + IpointsT1 = [p2QgsPoint(clotX(L ** 2 / (2 * data["R"] * data["L"])) * L, 1000 - clotY(L ** 2 / (2 * data["R"] * data["L"])) * L) + for L in xrange(data["L"])] + IpointsT2 = list(reversed([p2QgsPoint(clotX(L ** 2 / (2 * data["R"] * data["L"])) * L, clotY(L ** 2 / (2 * data["R"] * data["L"])) * L) + for L in xrange(data["L"])])) + + g1=QgsGeometry.fromPolyline(pointsT1) + dd = diff(p1, pointsT1[0]) + g1.translate(dd.x(), dd.y()) + g1.rotate(polyline(l1)[0].azimuth(polyline(l1)[-1])-90,polyline(g1)[0]) + g2=QgsGeometry.fromPolyline(pointsT2) + dd = diff(p2, pointsT2[-1]) + g2.translate(dd.x(), dd.y()) + g2.rotate(polyline(l2)[0].azimuth(polyline(l2)[-1])+90,polyline(g2)[-1]) + + Ig1 = QgsGeometry.fromPolyline(IpointsT1) + dd = diff(p1, IpointsT1[0]) + Ig1.translate(dd.x(), dd.y()) + Ig1.rotate(polyline(l1)[0].azimuth(polyline(l1)[-1]) - 90, polyline(Ig1)[0]) + Ig2 = QgsGeometry.fromPolyline(IpointsT2) + dd = diff(p2, IpointsT2[-1]) + Ig2.translate(dd.x(), dd.y()) + Ig2.rotate(polyline(l2)[0].azimuth(polyline(l2)[-1]) + 90, polyline(Ig2)[-1]) + + g1, g2 = [g1, g2] if polyline(g1)[-1].distance(polyline(g2)[0]) \ + <= polyline(Ig1)[-1].distance(polyline(Ig2)[0]) else [Ig1, Ig2] + + feat1.setGeometry(g1) + feat3.setGeometry(g2) + + p = p2QgsPoint((p1.x() + p2.x()) / 2, (p2.y() + p1.y()) / 2) + p1=p2QgsPoint(polyline(g1)[-1]) + p2=p2QgsPoint(polyline(g2)[0]) + tmp_line=QgsGeometry.fromPolyline([p2QgsPoint(PI),p]) + theta=data["L"]/(2*data["R"]) + ys=clotY(theta)*data["L"] + p=ys-data["R"]*(1-np.cos(theta)) + E = abs((data["R"]+p)/np.cos(np.deg2rad((data["D"]+2*np.rad2deg(theta))/2))-data["R"]) + msgLog("E="+str(E)) + p=p2QgsPoint(tmp_line.interpolate(E).asPoint()) + circularRing = QgsCircularString() + circularRing.setPoints([ + p1, + p, + p2 + ] + ) + feat2.setGeometry(circularRing) + layer.dataProvider().addFeatures([feat1, feat2, feat3]) + + return data + +def circleArc(layer, data, index, layer2, i, ic): + fcount=featureCount(layer) + if fcount>0: + l1, l2=getTangentesGeometry(layer2, ic, i) + d=deflection(layer2, i) + PI=qgsGeometryToPolyline(l1)[-1] + else: + l1, l2=getTangentesGeometry(layer2, ic, i) + d=deflection(layer2, i) + PI=qgsGeometryToPolyline(l1)[-1] + if l1 is None: + l1=QgsGeometry(l2) + dd=diff(qgsGeometryToPolyline(l2)[0], qgsGeometryToPolyline(l2)[-1]) + l2.translate(dd.x(), dd.y()) + elif l2 is None: + l2=QgsGeometry(l1) + dd=diff(qgsGeometryToPolyline(l1)[-1], qgsGeometryToPolyline(l2)[0]) + l2.translate(dd.x(), dd.y()) + + pl=qgsGeometryToPolyline(l1) + startAngle=azi(pl) + angle=90-(data["D"]+startAngle) + angle=angle if angle>0 else 360+angle + angle=angle if angle<360 else angle-360 + angleInternal=180-d + p1=p2QgsPoint(PI) + corda=2*data["R"]*np.sin(np.deg2rad(angleInternal/2)) + p2=p2QgsPoint(corda*np.cos(np.deg2rad(angle))+p1.x(), corda*np.sin(np.deg2rad(angle))+p1.y()) + + T=None + E=None + p=None + arc=None + + + + if index=="R": + if data["C"]: + data["L"]=np.deg2rad(abs(d))*data["R"]*abs(data["D"]/d) + corda=2*data["R"]*np.sin(np.deg2rad(abs(data["D"])/2)) + data["T"]=abs(corda/(2*np.tan(np.deg2rad((abs(data["D"]))/2)))) + p1=p2QgsPoint(l1.interpolate(l1.length()-data["T"]).asPoint()) + p2=p2QgsPoint(l2.interpolate(data["T"]).asPoint()) + PI=p2QgsPoint(PI) + else: + data["L"]=np.deg2rad(abs(data["D"]))*data["R"] + corda=2*data["R"]*np.sin(np.deg2rad(abs(data["D"])/2)) + T=abs(corda/(2*np.tan(np.deg2rad((abs(data["D"]))/2)))) + p1=p2QgsPoint(l1.interpolate(l1.length()-data["T"]).asPoint()) + l2=QgsGeometry(l1) + dd=diff(p1, qgsGeometryToPolyline(l2)[0]) + l2.translate(dd.x(), dd.y()) + dd=diff(l2.interpolate(T).asPoint(), qgsGeometryToPolyline(l2)[0]) + l2.translate(dd.x(), dd.y()) + l2.rotate(data["D"], QgsPointXY(qgsGeometryToPolyline(l2)[0])) + l2.extendLine(0, 500000) + p1=p2QgsPoint(l1.interpolate(l1.length()-data["T"]).asPoint()) + p2=p2QgsPoint(l2.interpolate(data["T"]).asPoint()) + PI=p2QgsPoint(qgsGeometryToPolyline(l2)[0]) + + elif index=="L": + if data["C"]: + if data["L"] > np.deg2rad(abs(d))*data["R"]*abs(data["D"]/d): + data["D"]=d/abs(d)*abs(abs(d)*data["L"]/(np.deg2rad(abs(d))*data["R"])) + if data["L"]>np.deg2rad(abs(d))*data["R"]: + data["R"]=data["L"]/(np.deg2rad(abs(d))) + corda=2*data["R"]*np.sin(np.deg2rad(abs(d)/2)) + data["T"]=abs(corda/(2*np.tan(np.deg2rad((abs(d))/2)))) + p1=p2QgsPoint(l1.interpolate(l1.length()-data["T"]).asPoint()) + p2=p2QgsPoint(l2.interpolate(data["T"]).asPoint()) + PI=p2QgsPoint(PI) + else: + data["R"]=data["L"]/(np.deg2rad(abs(data["D"]))) + corda=2*data["R"]*np.sin(np.deg2rad(abs(data["D"])/2)) + T=abs(corda/(2*np.tan(np.deg2rad(abs(data["D"])/2)))) + p1=p2QgsPoint(l1.interpolate(l1.length()-data["T"]).asPoint()) + l2=QgsGeometry(l1) + dd=diff(p1, qgsGeometryToPolyline(l2)[0]) + l2.translate(dd.x(), dd.y()) + dd=diff(l2.interpolate(T).asPoint(), qgsGeometryToPolyline(l2)[0]) + l2.translate(dd.x(), dd.y()) + l2.rotate(data["D"], QgsPointXY(qgsGeometryToPolyline(l2)[0])) + p1=p2QgsPoint(l1.interpolate(l1.length()-data["T"]).asPoint()) + p2=p2QgsPoint(l2.interpolate(data["T"]).asPoint()) + PI=p2QgsPoint(qgsGeometryToPolyline(l2)[0]) + + + elif index=="T": + if data["C"]: + corda=data["T"]*abs(2*np.tan(np.deg2rad((d)/2))) + data["L"]=np.deg2rad(abs(d))*data["R"]*abs(data["D"]/d) + data["R"]=corda/(2*np.sin(np.deg2rad(angleInternal/2))) + data["L"]=np.deg2rad(abs(d))*data["R"]*abs(data["D"]/d) + p1=p2QgsPoint(l1.interpolate(l1.length()-data["T"]).asPoint()) + p2=p2QgsPoint(l2.interpolate(data["T"]).asPoint()) + PI=p2QgsPoint(PI) + T=data["T"] + else: + corda=2*data["R"]*np.sin(np.deg2rad(abs(data["D"])/2)) + T=abs(corda/(2*np.tan(np.deg2rad((abs(data["D"]))/2)))) + p1=p2QgsPoint(l1.interpolate(l1.length()-data["T"]).asPoint()) + l2=QgsGeometry(l1) + dd=diff(p1, qgsGeometryToPolyline(l2)[0]) + l2.translate(dd.x(), dd.y()) + dd=diff(l2.interpolate(T).asPoint(), qgsGeometryToPolyline(l2)[0]) + l2.translate(dd.x(), dd.y()) + l2.rotate(data["D"], QgsPointXY(qgsGeometryToPolyline(l2)[0])) + p1=p2QgsPoint(l1.interpolate(l1.length()-data["T"]).asPoint()) + p2=p2QgsPoint(l2.interpolate(data["T"]).asPoint()) + PI=p2QgsPoint(qgsGeometryToPolyline(l2)[0]) + + + elif index=="D": + if data["C"]: + T=data["T"] + data["L"]=np.deg2rad(abs(d))*data["R"]*abs(data["D"]/d) + p1=p2QgsPoint(l1.interpolate(l1.length()-data["T"]).asPoint()) + p2=p2QgsPoint(l2.interpolate(data["T"]).asPoint()) + PI=p2QgsPoint(PI) + E=abs(T*np.tan(np.deg2rad(d/4))) + l2=QgsGeometry(l1) + dd=diff(PI, qgsGeometryToPolyline(l2)[0]) + l2.translate(dd.x(), dd.y()) + l2.rotate(abs((abs(d)-180)/d*data["D"]+180-abs(d))*d/abs(d)+d, qgsGeometryToPolyline(l2)[0]) + p=p2QgsPoint((p1.x()+p2.x())/2, (p2.y()+p1.y())/2) + tmp_line=QgsGeometry.fromPolyline([p2QgsPoint(PI),p]) + p=p2QgsPoint(tmp_line.interpolate(E).asPoint()) + arc=QgsCircularString() + arc.setPoints([p1, p, p2]) + l3=QgsGeometry(l2) + dd=diff(qgsGeometryToPolyline(l3)[-1], qgsGeometryToPolyline(l3)[0]) + l3.translate(dd.x(), dd.y()) + l3.rotate(-90*d/abs(d), qgsGeometryToPolyline(l3)[0]) + l2=unifyGeometry(l2,l3) + arc=QgsCircularString() + arc.setPoints([p1,p,p2]) + arc=splitGeometry(l2, createGeometry(arc)) + + else: + data["L"]=np.deg2rad(abs(data["D"]))*data["R"] + corda=2*data["R"]*np.sin(np.deg2rad(abs(data["D"])/2)) + T=abs(corda/(2*np.tan(np.deg2rad((abs(data["D"]))/2)))) + p1=p2QgsPoint(l1.interpolate(l1.length()-data["T"]).asPoint()) + l2=QgsGeometry(l1) + dd=diff(p1, qgsGeometryToPolyline(l2)[0]) + l2.translate(dd.x(), dd.y()) + PI=p2QgsPoint(l2.interpolate(T).asPoint()) + dd=diff(PI, qgsGeometryToPolyline(l2)[0]) + l2.translate(dd.x(), dd.y()) + l2.rotate(data["D"], qgsGeometryToPolyline(l2)[0]) + p2=p2QgsPoint(l2.interpolate(T).asPoint()) + + elif index=="C": + if data["C"]: + data["D"]=d + data["L"]=np.deg2rad(abs(data["D"]))*data["R"] + corda=2*data["R"]*np.sin(np.deg2rad(abs(data["D"])/2)) + data["T"]=abs(corda/(2*np.tan(np.deg2rad((d)/2)))) + p1=p2QgsPoint(l1.interpolate(l1.length()-data["T"]).asPoint()) + p2=p2QgsPoint(l2.interpolate(data["T"]).asPoint()) + PI=p2QgsPoint(PI) + else: + p1=p2QgsPoint(l1.interpolate(l1.length()-data["T"]).asPoint()) + p2=p2QgsPoint(l2.interpolate(data["T"]).asPoint()) + PI=p2QgsPoint(PI) + + elif index=="S": + data["C"]=True + # data["D"]=d + data["L"]=np.deg2rad(abs(data["D"]))*data["R"] + corda=2*data["R"]*np.sin(np.deg2rad(abs(data["D"])/2)) + #data["T"]=abs(corda/(2*np.tan(np.deg2rad((d)/2)))) + p1=p2QgsPoint(l1.interpolate(l1.length()-data["T"]).asPoint()) + p2=p2QgsPoint(l2.interpolate(data["T"]).asPoint()) + PI=p2QgsPoint(PI) + + if (data["T"]>l1.length() or data["T"]>l2.length()) and data["C"]: + data["L"]=np.deg2rad(abs(d))*data["R"]*abs(data["D"]/d) + corda=2*data["R"]*np.sin(np.deg2rad(abs(data["D"])/2)) + data["T"]=abs(corda/(2*np.tan(np.deg2rad((d)/2)))) + p1=p2QgsPoint(l1.interpolate(l1.length()-data["T"]).asPoint()) + p2=p2QgsPoint(l2.interpolate(data["T"]).asPoint()) + PI=p2QgsPoint(PI) + + T = data["T"] if T is None else T + E = abs(T*np.tan(np.deg2rad(data["D"]/4))) if E is None else E + + p=p2QgsPoint((p1.x()+p2.x())/2, (p2.y()+p1.y())/2) + #msgLog("p: " + str(p.x()) +"," +str(p.y())) + #msgLog("PI: " + str(PI.x()) +"," +str(PI.y())) + tmp_line=QgsGeometry.fromPolyline([p2QgsPoint(PI),p]) + p=p2QgsPoint(tmp_line.interpolate(E).asPoint()) + + feat = QgsFeature(layerFields()) + feat.setAttributes(['C',"",data["R"],data["D"],data["T"],data["L"]]) + # Create a QgsCircularStringV2 + circularRing = QgsCircularString() + # Set first point, intermediate point for curvature and end point + circularRing.setPoints([ + p1, + p, + p2] + ) +# data["R"]=QgsGeometryUtils.circleCenterRadius(p1,p,p2)[0] + circularRing=arc if arc else circularRing + feat.setGeometry(circularRing) + f2=QgsFeature(layer.fields()) + f2.setGeometry(l2) + layer.dataProvider().addFeatures([feat]) + + return data + + + + +def inSpiral(layer, data, index, layer2, i): + line1, line2=getTangentesGeometry(layer2,i) + angle=deflection(layer2,i) + PI=qgsGeometryToPolyline(line1)[-1] + if data["T"]>data["L"]: + data["T"]=data["L"] + + if index=="R": + pass + elif index=="L": + pass + elif index=="T": + pass + elif index=="D": + pass + elif index=="C": + pass + elif index=="S": + pass + + feat = QgsFeature(layer.fields()) + feat.setAttribute('Tipo', 'S') +# feat.setGeometry(QgsGeometry.) + layer.dataProvider().addFeatures([feat]) + return data + + +def outSpiral(layer, data, index, layer2, i): + line1, line2=getTangentesGeometry(layer2,i) + angle=deflection(layer2,i) + PI=qgsGeometryToPolyline(line1)[-1] + if data["T"]>data["L"]: + data["T"]=data["L"] + + if index=="R": + pass + elif index=="L": + pass + elif index=="T": + pass + elif index=="D": + pass + elif index=="C": + pass + elif index=="S": + pass + + feat = QgsFeature(layer.fields()) + feat.setAttribute('Tipo', 'S') +# feat.setGeometry(QgsGeometry.) + layer.dataProvider().addFeatures([feat]) + return data + + +def tangent(layer, data, index, layer2, i): + fcount=featureCount(layer) + if fcount>0: + fant=[f for f in layer.getFeatures()][fcount-1] + l1=fant.geometry() + l2=QgsGeometry(l1) + dd=diff(qgsGeometryToPolyline(fant.geometry())[-1],qgsGeometryToPolyline(fant.geometry())[0]) + l2.translate(dd.x(),dd.y()) + PI=qgsGeometryToPolyline(fant.geometry())[-1] + d=0 + data["Disable"].append("C") + + else: + l1, l2=getTangentesGeometry(layer2, i) + d=deflection(layer2, i) + PI=qgsGeometryToPolyline(l1)[-1] + if l1 is None: + l1=QgsGeometry(l2) + dd=diff(qgsGeometryToPolyline(l2)[0], qgsGeometryToPolyline(l2)[-1]) + l2.translate(dd.x(), dd.y()) + elif l2 is None: + l2=QgsGeometry(l1) + dd=diff(qgsGeometryToPolyline(l1)[-1], qgsGeometryToPolyline(l2)[0]) + l2.translate(dd.x(), dd.y()) + + startAngle=azi(qgsGeometryToPolyline(l1)) + angle=90-(data["D"]+startAngle) + angle=angle if angle>0 else 360+angle + angle=angle if angle<360 else angle-360 + p1=p2QgsPoint(PI) + p2=p2QgsPoint(data["L"]*np.cos(np.deg2rad(angle))+p1.x(), data["L"]*np.sin(np.deg2rad(angle))+p1.y()) + line=QgsGeometry.fromPolyline([p1,p2]) + + if data["T"]>l1.length(): + data["T"]=l1.length + + if index=="R": + pass + + elif index=="L": + if data["C"]: + Lmax=np.sqrt(l1.length()**2+l2.length()**2-2*l1.length()*l2.length()*np.cos(np.deg2rad(360-d))) + if data["L"]>Lmax: + data["L"]=Lmax + data["T"]=abs(data["L"]/(2*np.tan(np.deg2rad((d)/2)))) + data["D"]=d-90 + p1=p2QgsPoint(l1.interpolate(l1.length()-data["T"]).asPoint()) + p2=p2QgsPoint(l2.interpolate(data["T"]).asPoint()) + else: + p1=p2QgsPoint(l1.interpolate(l1.length()-data["T"]).asPoint()) + dd=diff(p1,PI) + line.translate(dd.x(), dd.y()) + p2=qgsGeometryToPolyline(line)[-1] + + elif index=="T": + if data["C"]: + data["L"]=abs(data["T"]*2*np.tan(np.deg2rad((d)/2))) + p1=p2QgsPoint(l1.interpolate(l1.length()-data["T"]).asPoint()) + p2=p2QgsPoint(l2.interpolate(data["T"]).asPoint()) + else: + p1=p2QgsPoint(l1.interpolate(l1.length()-data["T"]).asPoint()) + dd=diff(p1,PI) + line.translate(dd.x(), dd.y()) + p2=qgsGeometryToPolyline(line)[-1] + + elif index=="D": + if data["C"]: + data["D"]=0 + data["T"]=0 + data["C"]=False + p2=qgsGeometryToPolyline(line)[-1] + else: + p1=p2QgsPoint(l1.interpolate(l1.length()-data["T"]).asPoint()) + dd=diff(p1,PI) + line.translate(dd.x(), dd.y()) + p2=qgsGeometryToPolyline(line)[-1] + + elif index=="C": + if data["C"]: + Lmax=np.sqrt(l1.length()**2+l2.length()**2-2*l1.length()*l2.length()*np.cos(np.deg2rad(360-d))) + if data["L"]>Lmax: + data["L"]=Lmax + data["T"]=abs(data["L"]/(2*np.tan(np.deg2rad((d)/2)))) + data["D"]=d-90 + p1=p2QgsPoint(l1.interpolate(l1.length()-data["T"]).asPoint()) + p2=p2QgsPoint(l2.interpolate(data["T"]).asPoint()) + else: + data["D"]=d + if data["L"]0: + fant=[f for f in layer.getFeatures()][fcount-1] + l1=fant.geometry() + l2=QgsGeometry(l1) + dd=diff(qgsGeometryToPolyline(fant.geometry())[-1], qgsGeometryToPolyline(fant.geometry())[0]) + l2.translate(dd.x(),dd.y()) + PI=qgsGeometryToPolyline(fant.geometry())[-1] + d=float(data["D"]) if not index=="S" else 90.0 + l2.rotate(d, QgsPointXY(PI)) + + else: + data["Disable"].append("C") + data["Disable"].append("D") + data["Disable"].append("R") + data["Disable"].append("L") + data["Disable"].append("T") + return data + + data["Disable"].append("C") + startAngle=azi(qgsGeometryToPolyline(l1)) + angle=90-(data["D"]+startAngle) + angle=angle if angle>0 else 360+angle + angle=angle if angle<360 else angle-360 + angleInternal=180-abs(d) + p1=p2QgsPoint(PI) + corda=2*data["R"]*np.sin(np.deg2rad(angleInternal/2)) + p2=p2QgsPoint(corda*np.cos(np.deg2rad(angle))+p1.x(), corda*np.sin(np.deg2rad(angle))+p1.y()) + + T=None + E=None + p=None + arc=None + + if index=="R": + pass + elif index=="L": + data["R"]=data["L"]/(np.deg2rad(abs(data["D"]))) + corda=2*data["R"]*np.sin(np.deg2rad(abs(data["D"])/2)) + T=abs(corda/(2*np.tan(np.deg2rad(abs(data["D"])/2)))) + p1=p2QgsPoint(l1.interpolate(l1.length()-data["T"]).asPoint()) + l2=QgsGeometry(l1) + dd=diff(p1, qgsGeometryToPolyline(l2)[0]) + l2.translate(dd.x(), dd.y()) + dd=diff(l2.interpolate(T).asPoint(), qgsGeometryToPolyline(l2)[0]) + l2.translate(dd.x(), dd.y()) + l2.rotate(data["D"], QgsPointXY(qgsGeometryToPolyline(l2)[0])) + p1=p2QgsPoint(l1.interpolate(l1.length()-data["T"]).asPoint()) + p2=p2QgsPoint(l2.interpolate(data["T"]).asPoint()) + PI=p2QgsPoint(qgsGeometryToPolyline(l2)[0]) + + + elif index=="T": + corda=2*data["R"]*np.sin(np.deg2rad(abs(data["D"])/2)) + T=abs(corda/(2*np.tan(np.deg2rad((abs(data["D"]))/2)))) + p1=p2QgsPoint(l1.interpolate(l1.length()-data["T"]).asPoint()) + l2=QgsGeometry(l1) + dd=diff(p1, qgsGeometryToPolyline(l2)[0]) + l2.translate(dd.x(), dd.y()) + dd=diff(l2.interpolate(T).asPoint(), qgsGeometryToPolyline(l2)[0]) + l2.translate(dd.x(), dd.y()) + l2.rotate(data["D"], QgsPointXY(qgsGeometryToPolyline(l2)[0])) + p1=p2QgsPoint(l1.interpolate(l1.length()-data["T"]).asPoint()) + p2=p2QgsPoint(l2.interpolate(data["T"]).asPoint()) + PI=p2QgsPoint(qgsGeometryToPolyline(l2)[0]) + + + elif index=="D": + data["L"]=np.deg2rad(abs(data["D"]))*data["R"] + corda=2*data["R"]*np.sin(np.deg2rad(abs(data["D"])/2)) + T=abs(corda/(2*np.tan(np.deg2rad((abs(data["D"]))/2)))) + p1=p2QgsPoint(l1.interpolate(l1.length()-data["T"]).asPoint()) + l2=QgsGeometry(l1) + dd=diff(p1, qgsGeometryToPolyline(l2)[0]) + l2.translate(dd.x(), dd.y()) + PI=p2QgsPoint(l2.interpolate(T).asPoint()) + dd=diff(PI, qgsGeometryToPolyline(l2)[0]) + l2.translate(dd.x(), dd.y()) + l2.rotate(data["D"], qgsGeometryToPolyline(l2)[0]) + p2=p2QgsPoint(l2.interpolate(T).asPoint()) + + elif index=="C": + pass + elif index=="S": + data["C"]=True + data["D"]=90 + data["L"]=np.deg2rad(abs(data["D"]))*data["R"] + data["T"]=0 + + if (data["T"]>l1.length() or data["T"]>l2.length()) and data["C"]: + data["L"]=np.deg2rad(abs(d))*data["R"]*abs(data["D"]/d) + corda=2*data["R"]*np.sin(np.deg2rad(abs(data["D"])/2)) + data["T"]=abs(corda/(2*np.tan(np.deg2rad((d)/2)))) + p1=p2QgsPoint(l1.interpolate(l1.length()-data["T"]).asPoint()) + PI=p2QgsPoint(PI) + corda=2*data["R"]*np.sin(np.deg2rad(angleInternal/2)) + p2=p2QgsPoint(corda*np.cos(np.deg2rad(angle))+p1.x(), corda*np.sin(np.deg2rad(angle))+p1.y()) + + T = float(data["T"]) if T is None else T + E = abs(T*np.tan(np.deg2rad(data["D"]/4))) if E is None else E + + p=p2QgsPoint((p1.x()+p2.x())/2, (p2.y()+p1.y())/2) + tmp_line=QgsGeometry.fromPolyline([p2QgsPoint(PI),p]) + p=p2QgsPoint(tmp_line.interpolate(E).asPoint()) + + feat = QgsFeature(layer.fields()) + feat.setAttribute('Tipo', 'C') + # Create a QgsCircularStringV2 + circularRing = QgsCircularString() + # Set first point, intermediate point for curvature and end point + circularRing.setPoints([ + p1, + p, + p2] + ) +# data["R"]=QgsGeometryUtils.circleCenterRadius(p1,p,p2)[0] + circularRing=arc if arc else circularRing + feat.setGeometry(circularRing) + f2=QgsFeature(layer.fields()) + f2.setGeometry(l2) + layer.dataProvider().addFeatures([feat]) + + data["Disable"].append("C") + return data + + + + +def inSpiral2(layer, data, index, layer2, i): + line1, line2=getTangentesGeometry(layer2,i) + angle=deflection(layer2,i) + PI=qgsGeometryToPolyline(line1)[-1] + if data["T"]>data["L"]: + data["T"]=data["L"] + + if index=="R": + pass + elif index=="L": + pass + elif index=="T": + pass + elif index=="D": + pass + elif index=="C": + pass + elif index=="S": + pass + + feat = QgsFeature(layer.fields()) + feat.setAttribute('Tipo', 'S') +# feat.setGeometry(QgsGeometry.) + layer.dataProvider().addFeatures([feat]) + return data + + +def outSpiral2(layer, data, index, layer2, i): + line1, line2=getTangentesGeometry(layer2,i) + angle=deflection(layer2,i) + PI=qgsGeometryToPolyline(line1)[-1] + if data["T"]>data["L"]: + data["T"]=data["L"] + + if index=="R": + pass + elif index=="L": + pass + elif index=="T": + pass + elif index=="D": + pass + elif index=="C": + pass + elif index=="S": + pass + + feat = QgsFeature(layer.fields()) + feat.setAttribute('Tipo', 'S') +# feat.setGeometry(QgsGeometry.) + layer.dataProvider().addFeatures([feat]) + return data + + +def tangent2(layer, data, index, layer2, i): + fcount=featureCount(layer) + if fcount>0: + fant=[f for f in layer.getFeatures()][fcount-1] + length=fant.geometry().length() + lpt=qgsGeometryToPolyline(fant.geometry())[-1] + angle=90-lastAzimuth(fant.geometry()) + lpt=p2QgsPoint(lpt.x()-length*np.cos(np.deg2rad(angle)), lpt.y()-length*np.sin(np.deg2rad(angle))) + + l1=QgsGeometry.fromPolyline([p2QgsPoint(lpt), p2QgsPoint(qgsGeometryToPolyline(fant.geometry())[-1])]) + l2=QgsGeometry(l1) + dd=diff(qgsGeometryToPolyline(fant.geometry())[-1],qgsGeometryToPolyline(fant.geometry())[0]) + l2.translate(dd.x(),dd.y()) + PI=qgsGeometryToPolyline(fant.geometry())[-1] + d=0 + data["Disable"].append("C") + + else: + l1, l2=getTangentesGeometry(layer2, i) + d=deflection(layer2, i) + PI=qgsGeometryToPolyline(l1)[-1] + if l1 is None: + l1=QgsGeometry(l2) + dd=diff(qgsGeometryToPolyline(l2)[0], qgsGeometryToPolyline(l2)[-1]) + l2.translate(dd.x(), dd.y()) + elif l2 is None: + l2=QgsGeometry(l1) + dd=diff(qgsGeometryToPolyline(l1)[-1], qgsGeometryToPolyline(l2)[0]) + l2.translate(dd.x(), dd.y()) + + startAngle=azi(qgsGeometryToPolyline(l1)) + angle=90-(data["D"]+startAngle) + angle=angle if angle>0 else 360+angle + angle=angle if angle<360 else angle-360 + p1=p2QgsPoint(PI) + p2=p2QgsPoint(data["L"]*np.cos(np.deg2rad(angle))+p1.x(), data["L"]*np.sin(np.deg2rad(angle))+p1.y()) + line=QgsGeometry.fromPolyline([p1,p2]) + + if data["T"]>l1.length(): + data["T"]=l1.length + + if index=="R": + pass + + elif index=="L": + if data["C"]: + Lmax=np.sqrt(l1.length()**2+l2.length()**2-2*l1.length()*l2.length()*np.cos(np.deg2rad(360-d))) + if data["L"]>Lmax: + data["L"]=Lmax + data["T"]=abs(data["L"]/(2*np.tan(np.deg2rad((d)/2)))) + data["D"]=d-90 + p1=p2QgsPoint(l1.interpolate(l1.length()-data["T"]).asPoint()) + p2=p2QgsPoint(l2.interpolate(data["T"]).asPoint()) + else: + p1=p2QgsPoint(l1.interpolate(l1.length()-data["T"]).asPoint()) + dd=diff(p1,PI) + line.translate(dd.x(), dd.y()) + p2=qgsGeometryToPolyline(line)[-1] + + elif index=="T": + if data["C"]: + data["L"]=abs(data["T"]*2*np.tan(np.deg2rad((d)/2))) + p1=p2QgsPoint(l1.interpolate(l1.length()-data["T"]).asPoint()) + p2=p2QgsPoint(l2.interpolate(data["T"]).asPoint()) + else: + p1=p2QgsPoint(l1.interpolate(l1.length()-data["T"]).asPoint()) + dd=diff(p1,PI) + line.translate(dd.x(), dd.y()) + p2=qgsGeometryToPolyline(line)[-1] + + elif index=="D": + if data["C"]: + data["D"]=0 + data["T"]=0 + data["C"]=False + p2=qgsGeometryToPolyline(line)[-1] + else: + p1=p2QgsPoint(l1.interpolate(l1.length()-data["T"]).asPoint()) + dd=diff(p1,PI) + line.translate(dd.x(), dd.y()) + p2=qgsGeometryToPolyline(line)[-1] + + elif index=="C": + if data["C"]: + Lmax=np.sqrt(l1.length()**2+l2.length()**2-2*l1.length()*l2.length()*np.cos(np.deg2rad(360-d))) + if data["L"]>Lmax: + data["L"]=Lmax + data["T"]=abs(data["L"]/(2*np.tan(np.deg2rad((d)/2)))) + data["D"]=d-90 + p1=p2QgsPoint(l1.interpolate(l1.length()-data["T"]).asPoint()) + p2=p2QgsPoint(l2.interpolate(data["T"]).asPoint()) + else: + data["D"]=d + if data["L"] len(viz): - k = len(viz) - rotulos = np.array([]) - for j in viz[:k]: - rotulos = np.append(rotulos,self.y[j[1]]) - desvio = np.sqrt(np.var(rotulos)) - rotulo = np.mean(rotulos) - while desvio > 0.10 and len(rotulos)>1: - rotulos = np.delete(rotulos,-1,0) - rotulo = np.mean(rotulos) - desvio = np.sqrt(np.var(rotulos)) - Y = np.append(Y,rotulo) - return Y - -#print KNN(3).fit([[1,1],[1,0],[0,0]],[1,1,0]).predict([[0,1],[1,1]]) - - - +from builtins import object +import numpy as np +import math +class KNN(object): + def __init__(self,k=3): + self.x = np.array([]) + self.y = np.array([]) + self.k = k + 1 if k % 2 == 0 else k + + def fit(self,x,y): + self.x = np.array(x) + self.y = np.array(y) + return self + def dist(self,x1,x2): + soma = 0.0 + for i,_ in enumerate(x1): + soma += (x1[i]-x2[i])**2 + return math.sqrt(soma) + + def predict(self,X): + k = self.k + Y = np.array([]) + for i,x in enumerate(X): + dist = [] + for j,y in enumerate(self.x): + dist.append((self.dist(x,y),j)) + viz = sorted(dist) + + if k > len(viz): + k = len(viz) + rotulos = np.array([]) + for j in viz[:k]: + rotulos = np.append(rotulos,self.y[j[1]]) + desvio = np.sqrt(np.var(rotulos)) + rotulo = np.mean(rotulos) + while desvio > 0.10 and len(rotulos)>1: + rotulos = np.delete(rotulos,-1,0) + rotulo = np.mean(rotulos) + desvio = np.sqrt(np.var(rotulos)) + Y = np.append(Y,rotulo) + return Y + +#print KNN(3).fit([[1,1],[1,0],[0,0]],[1,1,0]).predict([[0,1],[1,1]]) + + + diff --git a/app/model/sqlitedb.py b/app/model/sqlitedb.py old mode 100644 new mode 100755 diff --git a/app/model/utils.py b/app/model/utils.py old mode 100644 new mode 100755 index 7a77f51..295ed7e --- a/app/model/utils.py +++ b/app/model/utils.py @@ -1,570 +1,570 @@ -from __future__ import print_function - -from PyQt5.QtCore import QVariant -from PyQt5.QtGui import QPixmap -from PyQt5.QtWidgets import QWidget, QDialog, QLabel -from future import standard_library - -from ..model.config import Config - -standard_library.install_aliases() -from builtins import str -from builtins import range -from builtins import object -# -*- coding: utf-8 -*- -import math - -from qgis.PyQt.QtCore import qDebug -from qgis._core import QgsFeature -from qgis._core import QgsGeometry -from qgis._core import QgsProject -from qgis._core import QgsPoint -from qgis._core import QgsVectorLayer -from qgis.gui import * -import sys, os, http.client, json, tempfile, urllib.request, urllib.parse, urllib.error -from qgis.PyQt import QtWidgets -from qgis.core import QgsRectangle, QgsGeometry, QgsVectorLayer, QgsPoint, QgsFeature, QgsPointXY, QgsCoordinateReferenceSystem, QgsCoordinateTransform, QgsField, QgsFields, QgsMessageLog, QgsWkbTypes - - -class Create_vlayer(object): - '''creation of a virtual layer''' - def __init__(self,nom,type): - self.type=type - self.name = nom - self.layer = QgsVectorLayer(self.type, self.name , "memory") - self.pr =self.layer.dataProvider() - - def create_point(self,geometry): - # add point to the layer - self.seg = QgsFeature() - self.seg.setGeometry(QgsGeometry.fromPoint(geometry)) - self.pr.addFeatures([self.seg]) - self.layer.updateExtents() - - @property - def display_layer(self): - #end of layer and display layer - QgsProject.instance().addMapLayers([self.layer]) - - -def mag(point): - # magnitude of a vector - return math.sqrt(point.x()**2 + point.y()**2) - - -def diff(point2, point1): - # substraction betwen two vector - return p2QgsPoint(point2.x()-point1.x(), point2.y() - point1.y()) - - -def length(point1,point2): - # with PyQGIS: sqrDist - return point1.distance(point2) - - -def dircos(point): - Mag=mag(point) - cosa = 0 - cosb = 0 - - if Mag != 0: - cosa = point.x() / Mag - cosb = point.y() / Mag - - return cosa,cosb - - -def getTipo(feat): - ''' - :param feat: layer feature - :return: str: Tipo do seguimento de geometria (T para tangente, C para curva cirvular, E para curva Espiral - Os valores são computados a partir dos fields da layer - ''' - - try: - s = str(feat["Tipo"]) - if s.startswith("T") or s.startswith("t"): - r = "T" - elif s.startswith("C") or s.startswith("c"): - r = "C" - elif s.startswith("E") or s.startswith("e") or s.startswith("S") or s.startswith("s"): - r = "S" - else: - r = "T" - except: - r = "T" - - return r - -def featureToPolyline(f): - g=f.geometry() - try: - lista=g.asPolyline() - except: - lista=g.asMultiPolyline()[0] - return lista - -def qgsGeometryToPolyline(g): - if g: - try: - lista=g.asPolyline() - except: - lista=g.asMultiPolyline()[0] - else: - lista=[QgsPointXY(0,0),QgsPointXY(0,10)] - - return lista - - -def pairs(lista,inicio=0): - # list pairs iteration - tipo=getTipo(lista) - line=featureToPolyline(lista) - - from math import isclose - start=line[inicio] - for i in range(inicio+1, len(line)-1): - if not (isclose(line[i-1].azimuth(line[i]),line[i].azimuth(line[i+1]),rel_tol=.00001) or start.distance(line[i])<0.01): - yield start, line[i], tipo - start=line[i] - yield start, line[-1], tipo - - - -def moveLine(layer, id, dest, src=None): - try: - geometry=layer.getFeature(id).geometry().asPolyline() - except: - geometry=layer.getFeature(id).geometry().asMultiPolyline()[0] - - if not src: - src=geometry[0] - dx=dest.x()-src.x() - dy=dest.y()-src.y() - g = layer.getFeature(id).geometry() - g.translate(dx,dy) - layer.dataProvider().changeGeometryValues({id: g}) - -def getLastPoint(layer, id): - try: - return layer.getFeature(id-1).geometry().asPolyline()[-1] - except: - return layer.getFeature(id-1).geometry().asMultiPolyline()[0][-1] - - - -def decdeg2dms(dd): - is_positive = dd >= 0 - dd = abs(dd) - minutes,seconds = divmod(dd*3600,60) - degrees,minutes = divmod(minutes,60) - degrees = degrees if is_positive else -degrees - return (degrees,minutes,seconds) - - -def calcI(p1,p2,prog1,prog2): - return ((p2.z()-p1.z())/(prog2-prog1))*100 - - -def azimuth(point1, point2): - # interval 0-180° here - dx = point2.x() - point1.x() - dy = point2.y() - point1.y() - try: - tan = math.atan(dx/dy)*(180/math.pi) - except: - tan = 0.0 - if dx > 0 and dy > 0: - return tan - elif dx > 0 and dy < 0: - return 180 + tan - - elif dx < 0 and dy < 0: - return 180 + tan - elif dx < 0 and dy > 0: - return 360 - abs(tan) - elif dx == 0 and dy > 0: - return 0 - elif dx > 0 and dy == 0: - return 90 - elif dx == 0 and dy < 0: - return 180 - elif dx < 0 and dy == 0: - return 270 - - -class PointTool(QgsMapTool): - def __init__(self, iface, callback): - QgsMapTool.__init__(self, iface.mapCanvas()) - self.iface = iface - self.callback = callback - self.canvas = iface.mapCanvas() - self.rpoint = QgsRubberBand(iface.mapCanvas(), QgsWkbTypes.PointGeometry) - - def canvasReleaseEvent(self, e): - point = self.canvas.getCoordinateTransform().toMapPoint(e.pos().x(), e.pos().y()) - self.point=point - self.canvas.unsetMapTool(self) - self.callback(self.point) - return None - - def start(self): - self.canvas.setMapTool(self) - - -class ClickTool(QgsMapTool): - def __init__(self,iface, callback): - QgsMapTool.__init__(self,iface.mapCanvas()) - self.iface = iface - self.callback = callback - self.canvas = iface.mapCanvas() - self.rpoint=QgsRubberBand(iface.mapCanvas(),QGis.Point ) - self.rline=QgsRubberBand(iface.mapCanvas(),QGis.Line ) - premuto= False - linea=False - point0=iface.mapCanvas().getCoordinateTransform().toMapCoordinates(0, 0) - point1=iface.mapCanvas().getCoordinateTransform().toMapCoordinates(0, 0) - - def canvasReleaseEvent(self,e): - point = self.canvas.getCoordinateTransform().toMapPoint(e.pos().x(),e.pos().y()) - self.callback(point) - return None - -def p2QgsPoint(pt, pt2=None): #Qgis 3.10.0 has a bug where the QgsPoint doesn't accept a QgsPointXY as a constructor - if pt2 is None: - try: - if type(pt) is list: - if len(pt)==3: - return QgsPoint(pt[0], pt[1], pt[2]) - else: - return QgsPoint(pt[0], pt[1]) - else: - return QgsPoint(pt.x(), pt.y()) - except: - return QgsPoint(pt) - else: - return QgsPoint(pt, pt2) - -def pointToWGS84(point): - t=QgsCoordinateReferenceSystem("EPSG:4326") - f=QgsProject.instance().crs() - transformer = QgsCoordinateTransform(f,t, QgsProject.instance()) - pt = transformer.transform(point) - return pt - -def pointTo(crs,point): - t=QgsCoordinateReferenceSystem(crs) - f=QgsProject.instance().crs() - transformer = QgsCoordinateTransform(f,t, QgsProject.instance()) - pt = transformer.transform(point) - return pt - - - -def pointFromWGS84(point): - p = QgsProject.instance() - (proj4string,ok) = p.readEntry("SpatialRefSys","ProjectCRSProj4String") - if not ok: - return point - f = QgsCoordinateReferenceSystem("EPSG:4326") - t=QgsProject.instance().crs() - transformer = QgsCoordinateTransform(f, t, p) - pt = transformer.transform(point) - return pt - - -def addGoogleXYZTiles(iface, QSettings): - sources = [] - sources.append(["connections-xyz", "Google Satellite", "", "", "", - "https://mt1.google.com/vt/lyrs=s&x=%7Bx%7D&y=%7By%7D&z=%7Bz%7D", "", "19", "0"]) - sources.append(["connections-xyz", "Google Terrain", "", "", "", - "https://mt1.google.com/vt/lyrs=t&x=%7Bx%7D&y=%7By%7D&z=%7Bz%7D", "", "19", "0"]) - - for source in sources: - connectionType = source[0] - connectionName = source[1] - QSettings().setValue("qgis/%s/%s/authcfg" % (connectionType, connectionName), source[2]) - QSettings().setValue("qgis/%s/%s/password" % (connectionType, connectionName), source[3]) - QSettings().setValue("qgis/%s/%s/referer" % (connectionType, connectionName), source[4]) - QSettings().setValue("qgis/%s/%s/url" % (connectionType, connectionName), source[5]) - QSettings().setValue("qgis/%s/%s/username" % (connectionType, connectionName), source[6]) - QSettings().setValue("qgis/%s/%s/zmax" % (connectionType, connectionName), source[7]) - QSettings().setValue("qgis/%s/%s/zmin" % (connectionType, connectionName), source[8]) - iface.reloadConnections() - - -def getElevation(crs,point): - # epsg4326 = QgsCoordinateReferenceSystem(4326, QgsCoordinateReferenceSystem.EpsgCrsId) - # mycrs = QgsCoordinateReferenceSystem(int(crs), 0) - # reprojectgeographic = QgsCoordinateTransform(mycrs, epsg4326, QgsCoordinateTransformContext()) - # pt = reprojectgeographic.transform(QgsPointXY(point)) - # conn = http.client.HTTPConnection("maps.googleapis.com") - ## QgsMessageLog.instance().logMessage( - # # "http://maps.googleapis.com/maps/api/elevation/json?locations=" + str(pt[1]) + "," + str( - # # pt[0]) + "&sensor=false", "Elevation") - - # try: - # conn.request("GET", "/maps/api/elevation/json?locations=" + str(pt[1]) + "," + str(pt[0]) + "&sensor=false") - # response = conn.getresponse() - # jsonresult = response.read() - # elevation = 0.0 - # results = json.loads(jsonresult).get('results') - # # fix_print_with_import - # print(results) - # if 0 < len(results): - # elevation = float(round(results[0].get('elevation'),4)) - - - # except Exception as e: - # msgLog(e.message) - # qDebug(e.message) - # elevation=0.0 - - # return elevation - return 0 - - -def layerFields(): - fields = QgsFields() - fields.append(QgsField("Tipo", QVariant.String)) # C, T, E (Circular, tangente, Espiral ... startswith) - fields.append(QgsField("Descricao", QVariant.String)) - fields.append(QgsField("Raio", QVariant.Double)) - fields.append(QgsField("Angulo de Deflexao (Delta)", QVariant.Double)) - fields.append(QgsField("Tangente Externa (T)", QVariant.Double)) - fields.append(QgsField("Desenvolvimento (D)", QVariant.Double)) - return fields - - -def msgLog(msg): - QgsMessageLog.logMessage(str(msg), tag="GeoRoad", level=0) - -def interpolList(l:list,i): - length=len(l) - if length%2!=0: - return l[int(length/2)][i] - else: - return (l[int(length/2)][i]+l[int(length/2)-1][i])/2 - -from urllib.request import urlopen - -def internet_on(): - try: - response = urlopen('https://www.google.com/', timeout=3) - return True - except: - return False - -##TODO allow user to configure precision -precision=4 -longPrecision=8 - -def roundFloat(f:float): - return round(f,precision) - -def roundFloatShort(f): - return round(f,1) - -def shortFloat2String(f): - return str(round(f,2)) - -def formatValue(value): - try: - if int(float(value))==float(value): #value is a int - return str(int(value)) - return str(roundFloat(float(value))) - except: - return str(value) - -def roundFloat2str(f:float): - return str(round(float(f),precision)) - -def longRoundFloat(f:float): - return round(f,longPrecision) - -def longRoundFloat2str(f:float): - return str(round(f,longPrecision)) - -def roundUpFloat2str(f:float): - return str(round(int(f/Config.instance().DIST+1),0)) - -def prog2estacaStr(i :float): - dist=Config.instance().DIST - if i%dist != 0: - return str(int(i/dist))+"+"+str(round(i%dist,2)) - else: - return str(int(i/dist)) - -def fastProg2EstacaStr(i, dist): - if i%dist != 0: - return str(int(i/dist))+"+"+str(round(i%Config.instance().DIST,2)) - else: - return str(int(i/dist)) - -def estaca2progFloat(s: str): - dist=Config.instance().DIST - if '+' in s: - i=int(s.split("+")[0]) - f=float(s.split("+")[1]) - return i*dist+f - else: - return int(s)*dist - -def fastEstaca2progFloat(s: str, dist): - dist=Config.instance().DIST - if '+' in s: - i=int(s.split("+")[0]) - f=float(s.split("+")[1]) - return i*dist+f - else: - return int(s)*dist - - - -class imgDialog(QDialog): - def __init__(self,imagepath,title="Image", parent=None): - super(imgDialog, self).__init__(parent) - self.title = title - self.left = 10 - self.top = 10 - self.width = 640 - self.height = 480 - self.imagepath=imagepath - self.initUI() - - def initUI(self): - self.setWindowTitle(self.title) - self.setGeometry(self.left, self.top, self.width, self.height) - - # Create widget - label = QLabel(self) - pixmap = QPixmap(self.imagepath) - label.setPixmap(pixmap) - self.resize(pixmap.width(), pixmap.height()) - - -def messageDialog(iface=None, title="Concluído", info="", message=""): - msgBox = QtWidgets.QMessageBox(iface) - msgBox.setIcon(QtWidgets.QMessageBox.Question) - msgBox.setWindowTitle(title) - msgBox.setText(message) - msgBox.setInformativeText(info) - msgBox.setStandardButtons(QtWidgets.QMessageBox.Ok) - msgBox.setDefaultButton(QtWidgets.QMessageBox.Ok) - # msgBox.show() - return msgBox.exec_() == QtWidgets.QMessageBox.Ok - - -def yesNoDialog(iface=None, title="Atenção", info="", message=""): - msgBox = QtWidgets.QMessageBox(iface) - msgBox.setIcon(QtWidgets.QMessageBox.Question) - msgBox.setWindowTitle(title) - msgBox.setText(message) - msgBox.setInformativeText(info) - msgBox.setStandardButtons(QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No) - msgBox.setDefaultButton(QtWidgets.QMessageBox.No) - # msgBox.show() - return msgBox.exec_() == QtWidgets.QMessageBox.Yes - -class RasterInterpolator(): - def __init__(self): - self.BLOCK=None - self.LAYER=None - - def getBlockRecAndItemFromPointInRaster(self,layer, p): - pt = p # QgsCoordinateTransform(QgsProject.instance().crs(),layer.crs(),QgsProject.instance()).transform(p) - dp = layer.dataProvider() - finalExtent = dp.extent() - - # Calculate the row / column where the point falls - xres = layer.rasterUnitsPerPixelX() - yres = layer.rasterUnitsPerPixelY() - - from math import floor - col = abs(floor((pt.x() - finalExtent.xMinimum()) / xres)) - row = abs(floor((finalExtent.yMaximum() - pt.y()) / yres)) - - xMin = finalExtent.xMinimum() + col * xres - xMax = xMin + xres - yMax = finalExtent.yMaximum() - row * yres - yMin = yMax - yres - pixelExtent = QgsRectangle(xMin, yMin, xMax, yMax) - # 1 is referring to band 1 - if not(self.LAYER is None or self.BLOCK is None) and layer == self.LAYER: - block=self.BLOCK - else: - block = dp.block(1, finalExtent, layer.width(), layer.height()) - self.BLOCK=block - self.LAYER=layer - - del dp - - if pixelExtent.contains(pt): - return block, pixelExtent, row, col - else: - return False, False, False, False - - - def rectCell(self, layer, row, col): - dp = layer.dataProvider() - finalExtent = dp.extent() - - # Calculate the row / column where the point falls - xres = layer.rasterUnitsPerPixelX() - yres = layer.rasterUnitsPerPixelY() - - xMin = finalExtent.xMinimum() + col * xres - xMax = xMin + xres - yMax = finalExtent.yMaximum() - row * yres - yMin = yMax - yres - del dp - return QgsRectangle(xMin, yMin, xMax, yMax) - - - def cotaFromTiff(self, layer, p, interpolate=True): - p = QgsCoordinateTransform(QgsProject.instance().crs(), layer.crs(), QgsProject.instance()).transform(p) - if interpolate: - b, rec, row, col = self.getBlockRecAndItemFromPointInRaster(layer, p) - if not b: - return 0 - - #matrix dos 9 pixels - matx = [[[None, None, None], [None, None, None], [None, None, None]], - [[None, None, None], [None, None, None], [None, None, None]]] - - from itertools import product - for i, j in product([-1, 0, 1], [-1, 0, 1]): - matx[0][i + 1][j + 1] = b.value(row + i, col + j) # elevações - matx[1][i + 1][j + 1] = self.rectCell(layer, row + i, col + j).center().distance(p) # distancias - if row < 0 or col < 0 or row >= layer.height() or col >= layer.width(): - return 0 - - V = [matx[0][i][j] for i, j in product([0, 1, 2], [0, 1, 2])] #elevações - L = [matx[1][i][j] for i, j in product([0, 1, 2], [0, 1, 2])] #Distancias - - #tolerância de 1 diagonal inteira - max_dist = (layer.rasterUnitsPerPixelX() ** 2 + layer.rasterUnitsPerPixelY() ** 2) ** (1 / 2) - # pesos - I = [(max_dist - l) / max_dist if l < max_dist else 0 for l in L] - # média - del matx - del b - del rec - - return sum(v * i for v, i in zip(V, I)) / sum(I) - - else: - v = layer.dataProvider().sample(p, 1) - try: - if v[1]: - return v[0] - else: - return 0 - except: - return 0 - # - # if layer.extent().contains(p) and v[1]: - # return v[0] - # else: - # return 0 - - +from __future__ import print_function + +from PyQt5.QtCore import QVariant +from PyQt5.QtGui import QPixmap +from PyQt5.QtWidgets import QWidget, QDialog, QLabel +from future import standard_library + +from ..model.config import Config + +standard_library.install_aliases() +from builtins import str +from builtins import range +from builtins import object +# -*- coding: utf-8 -*- +import math + +from qgis.PyQt.QtCore import qDebug +from qgis._core import QgsFeature +from qgis._core import QgsGeometry +from qgis._core import QgsProject +from qgis._core import QgsPoint +from qgis._core import QgsVectorLayer +from qgis.gui import * +import sys, os, http.client, json, tempfile, urllib.request, urllib.parse, urllib.error +from qgis.PyQt import QtWidgets +from qgis.core import QgsRectangle, QgsGeometry, QgsVectorLayer, QgsPoint, QgsFeature, QgsPointXY, QgsCoordinateReferenceSystem, QgsCoordinateTransform, QgsField, QgsFields, QgsMessageLog, QgsWkbTypes + + +class Create_vlayer(object): + '''creation of a virtual layer''' + def __init__(self,nom,type): + self.type=type + self.name = nom + self.layer = QgsVectorLayer(self.type, self.name , "memory") + self.pr =self.layer.dataProvider() + + def create_point(self,geometry): + # add point to the layer + self.seg = QgsFeature() + self.seg.setGeometry(QgsGeometry.fromPoint(geometry)) + self.pr.addFeatures([self.seg]) + self.layer.updateExtents() + + @property + def display_layer(self): + #end of layer and display layer + QgsProject.instance().addMapLayers([self.layer]) + + +def mag(point): + # magnitude of a vector + return math.sqrt(point.x()**2 + point.y()**2) + + +def diff(point2, point1): + # substraction betwen two vector + return p2QgsPoint(point2.x()-point1.x(), point2.y() - point1.y()) + + +def length(point1,point2): + # with PyQGIS: sqrDist + return point1.distance(point2) + + +def dircos(point): + Mag=mag(point) + cosa = 0 + cosb = 0 + + if Mag != 0: + cosa = point.x() / Mag + cosb = point.y() / Mag + + return cosa,cosb + + +def getTipo(feat): + ''' + :param feat: layer feature + :return: str: Tipo do seguimento de geometria (T para tangente, C para curva cirvular, E para curva Espiral + Os valores são computados a partir dos fields da layer + ''' + + try: + s = str(feat["Tipo"]) + if s.startswith("T") or s.startswith("t"): + r = "T" + elif s.startswith("C") or s.startswith("c"): + r = "C" + elif s.startswith("E") or s.startswith("e") or s.startswith("S") or s.startswith("s"): + r = "S" + else: + r = "T" + except: + r = "T" + + return r + +def featureToPolyline(f): + g=f.geometry() + try: + lista=g.asPolyline() + except: + lista=g.asMultiPolyline()[0] + return lista + +def qgsGeometryToPolyline(g): + if g: + try: + lista=g.asPolyline() + except: + lista=g.asMultiPolyline()[0] + else: + lista=[QgsPointXY(0,0),QgsPointXY(0,10)] + + return lista + + +def pairs(lista,inicio=0): + # list pairs iteration + tipo=getTipo(lista) + line=featureToPolyline(lista) + + from math import isclose + start=line[inicio] + for i in range(inicio+1, len(line)-1): + if not (isclose(line[i-1].azimuth(line[i]),line[i].azimuth(line[i+1]),rel_tol=.00001) or start.distance(line[i])<0.01): + yield start, line[i], tipo + start=line[i] + yield start, line[-1], tipo + + + +def moveLine(layer, id, dest, src=None): + try: + geometry=layer.getFeature(id).geometry().asPolyline() + except: + geometry=layer.getFeature(id).geometry().asMultiPolyline()[0] + + if not src: + src=geometry[0] + dx=dest.x()-src.x() + dy=dest.y()-src.y() + g = layer.getFeature(id).geometry() + g.translate(dx,dy) + layer.dataProvider().changeGeometryValues({id: g}) + +def getLastPoint(layer, id): + try: + return layer.getFeature(id-1).geometry().asPolyline()[-1] + except: + return layer.getFeature(id-1).geometry().asMultiPolyline()[0][-1] + + + +def decdeg2dms(dd): + is_positive = dd >= 0 + dd = abs(dd) + minutes,seconds = divmod(dd*3600,60) + degrees,minutes = divmod(minutes,60) + degrees = degrees if is_positive else -degrees + return (degrees,minutes,seconds) + + +def calcI(p1,p2,prog1,prog2): + return ((p2.z()-p1.z())/(prog2-prog1))*100 + + +def azimuth(point1, point2): + # interval 0-180° here + dx = point2.x() - point1.x() + dy = point2.y() - point1.y() + try: + tan = math.atan(dx/dy)*(180/math.pi) + except: + tan = 0.0 + if dx > 0 and dy > 0: + return tan + elif dx > 0 and dy < 0: + return 180 + tan + + elif dx < 0 and dy < 0: + return 180 + tan + elif dx < 0 and dy > 0: + return 360 - abs(tan) + elif dx == 0 and dy > 0: + return 0 + elif dx > 0 and dy == 0: + return 90 + elif dx == 0 and dy < 0: + return 180 + elif dx < 0 and dy == 0: + return 270 + + +class PointTool(QgsMapTool): + def __init__(self, iface, callback): + QgsMapTool.__init__(self, iface.mapCanvas()) + self.iface = iface + self.callback = callback + self.canvas = iface.mapCanvas() + self.rpoint = QgsRubberBand(iface.mapCanvas(), QgsWkbTypes.PointGeometry) + + def canvasReleaseEvent(self, e): + point = self.canvas.getCoordinateTransform().toMapPoint(e.pos().x(), e.pos().y()) + self.point=point + self.canvas.unsetMapTool(self) + self.callback(self.point) + return None + + def start(self): + self.canvas.setMapTool(self) + + +class ClickTool(QgsMapTool): + def __init__(self,iface, callback): + QgsMapTool.__init__(self,iface.mapCanvas()) + self.iface = iface + self.callback = callback + self.canvas = iface.mapCanvas() + self.rpoint=QgsRubberBand(iface.mapCanvas(),QGis.Point ) + self.rline=QgsRubberBand(iface.mapCanvas(),QGis.Line ) + premuto= False + linea=False + point0=iface.mapCanvas().getCoordinateTransform().toMapCoordinates(0, 0) + point1=iface.mapCanvas().getCoordinateTransform().toMapCoordinates(0, 0) + + def canvasReleaseEvent(self,e): + point = self.canvas.getCoordinateTransform().toMapPoint(e.pos().x(),e.pos().y()) + self.callback(point) + return None + +def p2QgsPoint(pt, pt2=None): #Qgis 3.10.0 has a bug where the QgsPoint doesn't accept a QgsPointXY as a constructor + if pt2 is None: + try: + if type(pt) is list: + if len(pt)==3: + return QgsPoint(pt[0], pt[1], pt[2]) + else: + return QgsPoint(pt[0], pt[1]) + else: + return QgsPoint(pt.x(), pt.y()) + except: + return QgsPoint(pt) + else: + return QgsPoint(pt, pt2) + +def pointToWGS84(point): + t=QgsCoordinateReferenceSystem("EPSG:4326") + f=QgsProject.instance().crs() + transformer = QgsCoordinateTransform(f,t, QgsProject.instance()) + pt = transformer.transform(point) + return pt + +def pointTo(crs,point): + t=QgsCoordinateReferenceSystem(crs) + f=QgsProject.instance().crs() + transformer = QgsCoordinateTransform(f,t, QgsProject.instance()) + pt = transformer.transform(point) + return pt + + + +def pointFromWGS84(point): + p = QgsProject.instance() + (proj4string,ok) = p.readEntry("SpatialRefSys","ProjectCRSProj4String") + if not ok: + return point + f = QgsCoordinateReferenceSystem("EPSG:4326") + t=QgsProject.instance().crs() + transformer = QgsCoordinateTransform(f, t, p) + pt = transformer.transform(point) + return pt + + +def addGoogleXYZTiles(iface, QSettings): + sources = [] + sources.append(["connections-xyz", "Google Satellite", "", "", "", + "https://mt1.google.com/vt/lyrs=s&x=%7Bx%7D&y=%7By%7D&z=%7Bz%7D", "", "19", "0"]) + sources.append(["connections-xyz", "Google Terrain", "", "", "", + "https://mt1.google.com/vt/lyrs=t&x=%7Bx%7D&y=%7By%7D&z=%7Bz%7D", "", "19", "0"]) + + for source in sources: + connectionType = source[0] + connectionName = source[1] + QSettings().setValue("qgis/%s/%s/authcfg" % (connectionType, connectionName), source[2]) + QSettings().setValue("qgis/%s/%s/password" % (connectionType, connectionName), source[3]) + QSettings().setValue("qgis/%s/%s/referer" % (connectionType, connectionName), source[4]) + QSettings().setValue("qgis/%s/%s/url" % (connectionType, connectionName), source[5]) + QSettings().setValue("qgis/%s/%s/username" % (connectionType, connectionName), source[6]) + QSettings().setValue("qgis/%s/%s/zmax" % (connectionType, connectionName), source[7]) + QSettings().setValue("qgis/%s/%s/zmin" % (connectionType, connectionName), source[8]) + iface.reloadConnections() + + +def getElevation(crs,point): + # epsg4326 = QgsCoordinateReferenceSystem(4326, QgsCoordinateReferenceSystem.EpsgCrsId) + # mycrs = QgsCoordinateReferenceSystem(int(crs), 0) + # reprojectgeographic = QgsCoordinateTransform(mycrs, epsg4326, QgsCoordinateTransformContext()) + # pt = reprojectgeographic.transform(QgsPointXY(point)) + # conn = http.client.HTTPConnection("maps.googleapis.com") + ## QgsMessageLog.instance().logMessage( + # # "http://maps.googleapis.com/maps/api/elevation/json?locations=" + str(pt[1]) + "," + str( + # # pt[0]) + "&sensor=false", "Elevation") + + # try: + # conn.request("GET", "/maps/api/elevation/json?locations=" + str(pt[1]) + "," + str(pt[0]) + "&sensor=false") + # response = conn.getresponse() + # jsonresult = response.read() + # elevation = 0.0 + # results = json.loads(jsonresult).get('results') + # # fix_print_with_import + # print(results) + # if 0 < len(results): + # elevation = float(round(results[0].get('elevation'),4)) + + + # except Exception as e: + # msgLog(e.message) + # qDebug(e.message) + # elevation=0.0 + + # return elevation + return 0 + + +def layerFields(): + fields = QgsFields() + fields.append(QgsField("Tipo", QVariant.String)) # C, T, E (Circular, tangente, Espiral ... startswith) + fields.append(QgsField("Descricao", QVariant.String)) + fields.append(QgsField("Raio", QVariant.Double)) + fields.append(QgsField("Angulo de Deflexao (Delta)", QVariant.Double)) + fields.append(QgsField("Tangente Externa (T)", QVariant.Double)) + fields.append(QgsField("Desenvolvimento (D)", QVariant.Double)) + return fields + + +def msgLog(msg): + QgsMessageLog.logMessage(str(msg), tag="GeoRoad", level=0) + +def interpolList(l:list,i): + length=len(l) + if length%2!=0: + return l[int(length/2)][i] + else: + return (l[int(length/2)][i]+l[int(length/2)-1][i])/2 + +from urllib.request import urlopen + +def internet_on(): + try: + response = urlopen('https://www.google.com/', timeout=3) + return True + except: + return False + +##TODO allow user to configure precision +precision=4 +longPrecision=8 + +def roundFloat(f:float): + return round(f,precision) + +def roundFloatShort(f): + return round(f,1) + +def shortFloat2String(f): + return str(round(f,2)) + +def formatValue(value): + try: + if int(float(value))==float(value): #value is a int + return str(int(value)) + return str(roundFloat(float(value))) + except: + return str(value) + +def roundFloat2str(f:float): + return str(round(float(f),precision)) + +def longRoundFloat(f:float): + return round(f,longPrecision) + +def longRoundFloat2str(f:float): + return str(round(f,longPrecision)) + +def roundUpFloat2str(f:float): + return str(round(int(f/Config.instance().DIST+1),0)) + +def prog2estacaStr(i :float): + dist=Config.instance().DIST + if i%dist != 0: + return str(int(i/dist))+"+"+str(round(i%dist,2)) + else: + return str(int(i/dist)) + +def fastProg2EstacaStr(i, dist): + if i%dist != 0: + return str(int(i/dist))+"+"+str(round(i%Config.instance().DIST,2)) + else: + return str(int(i/dist)) + +def estaca2progFloat(s: str): + dist=Config.instance().DIST + if '+' in s: + i=int(s.split("+")[0]) + f=float(s.split("+")[1]) + return i*dist+f + else: + return int(s)*dist + +def fastEstaca2progFloat(s: str, dist): + dist=Config.instance().DIST + if '+' in s: + i=int(s.split("+")[0]) + f=float(s.split("+")[1]) + return i*dist+f + else: + return int(s)*dist + + + +class imgDialog(QDialog): + def __init__(self,imagepath,title="Image", parent=None): + super(imgDialog, self).__init__(parent) + self.title = title + self.left = 10 + self.top = 10 + self.width = 640 + self.height = 480 + self.imagepath=imagepath + self.initUI() + + def initUI(self): + self.setWindowTitle(self.title) + self.setGeometry(self.left, self.top, self.width, self.height) + + # Create widget + label = QLabel(self) + pixmap = QPixmap(self.imagepath) + label.setPixmap(pixmap) + self.resize(pixmap.width(), pixmap.height()) + + +def messageDialog(iface=None, title="Concluído", info="", message=""): + msgBox = QtWidgets.QMessageBox(iface) + msgBox.setIcon(QtWidgets.QMessageBox.Question) + msgBox.setWindowTitle(title) + msgBox.setText(message) + msgBox.setInformativeText(info) + msgBox.setStandardButtons(QtWidgets.QMessageBox.Ok) + msgBox.setDefaultButton(QtWidgets.QMessageBox.Ok) + # msgBox.show() + return msgBox.exec_() == QtWidgets.QMessageBox.Ok + + +def yesNoDialog(iface=None, title="Atenção", info="", message=""): + msgBox = QtWidgets.QMessageBox(iface) + msgBox.setIcon(QtWidgets.QMessageBox.Question) + msgBox.setWindowTitle(title) + msgBox.setText(message) + msgBox.setInformativeText(info) + msgBox.setStandardButtons(QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No) + msgBox.setDefaultButton(QtWidgets.QMessageBox.No) + # msgBox.show() + return msgBox.exec_() == QtWidgets.QMessageBox.Yes + +class RasterInterpolator(): + def __init__(self): + self.BLOCK=None + self.LAYER=None + + def getBlockRecAndItemFromPointInRaster(self,layer, p): + pt = p # QgsCoordinateTransform(QgsProject.instance().crs(),layer.crs(),QgsProject.instance()).transform(p) + dp = layer.dataProvider() + finalExtent = dp.extent() + + # Calculate the row / column where the point falls + xres = layer.rasterUnitsPerPixelX() + yres = layer.rasterUnitsPerPixelY() + + from math import floor + col = abs(floor((pt.x() - finalExtent.xMinimum()) / xres)) + row = abs(floor((finalExtent.yMaximum() - pt.y()) / yres)) + + xMin = finalExtent.xMinimum() + col * xres + xMax = xMin + xres + yMax = finalExtent.yMaximum() - row * yres + yMin = yMax - yres + pixelExtent = QgsRectangle(xMin, yMin, xMax, yMax) + # 1 is referring to band 1 + if not(self.LAYER is None or self.BLOCK is None) and layer == self.LAYER: + block=self.BLOCK + else: + block = dp.block(1, finalExtent, layer.width(), layer.height()) + self.BLOCK=block + self.LAYER=layer + + del dp + + if pixelExtent.contains(pt): + return block, pixelExtent, row, col + else: + return False, False, False, False + + + def rectCell(self, layer, row, col): + dp = layer.dataProvider() + finalExtent = dp.extent() + + # Calculate the row / column where the point falls + xres = layer.rasterUnitsPerPixelX() + yres = layer.rasterUnitsPerPixelY() + + xMin = finalExtent.xMinimum() + col * xres + xMax = xMin + xres + yMax = finalExtent.yMaximum() - row * yres + yMin = yMax - yres + del dp + return QgsRectangle(xMin, yMin, xMax, yMax) + + + def cotaFromTiff(self, layer, p, interpolate=True): + p = QgsCoordinateTransform(QgsProject.instance().crs(), layer.crs(), QgsProject.instance()).transform(p) + if interpolate: + b, rec, row, col = self.getBlockRecAndItemFromPointInRaster(layer, p) + if not b: + return 0 + + #matrix dos 9 pixels + matx = [[[None, None, None], [None, None, None], [None, None, None]], + [[None, None, None], [None, None, None], [None, None, None]]] + + from itertools import product + for i, j in product([-1, 0, 1], [-1, 0, 1]): + matx[0][i + 1][j + 1] = b.value(row + i, col + j) # elevações + matx[1][i + 1][j + 1] = self.rectCell(layer, row + i, col + j).center().distance(p) # distancias + if row < 0 or col < 0 or row >= layer.height() or col >= layer.width(): + return 0 + + V = [matx[0][i][j] for i, j in product([0, 1, 2], [0, 1, 2])] #elevações + L = [matx[1][i][j] for i, j in product([0, 1, 2], [0, 1, 2])] #Distancias + + #tolerância de 1 diagonal inteira + max_dist = (layer.rasterUnitsPerPixelX() ** 2 + layer.rasterUnitsPerPixelY() ** 2) ** (1 / 2) + # pesos + I = [(max_dist - l) / max_dist if l < max_dist else 0 for l in L] + # média + del matx + del b + del rec + + return sum(v * i for v, i in zip(V, I)) / sum(I) + + else: + v = layer.dataProvider().sample(p, 1) + try: + if v[1]: + return v[0] + else: + return 0 + except: + return 0 + # + # if layer.extent().contains(p) and v[1]: + # return v[0] + # else: + # return 0 + + diff --git a/app/resources.qrc b/app/resources.qrc old mode 100644 new mode 100755 index 45a6063..69597f9 --- a/app/resources.qrc +++ b/app/resources.qrc @@ -1,13 +1,13 @@ - - - app/resources/icons/logo.png - app/resources/icons/iconnew.png - app/resources/icons/iconopen.png - app/resources/icons/iconsave.png - app/resources/icons/iconcurva.png - app/resources/icons/iconmap.png - app/resources/icons/iconcarta.png - app/resources/icons/icontools.png - app/resources/icons/icondraw.png - - + + + app/resources/icons/logo.png + app/resources/icons/iconnew.png + app/resources/icons/iconopen.png + app/resources/icons/iconsave.png + app/resources/icons/iconcurva.png + app/resources/icons/iconmap.png + app/resources/icons/iconcarta.png + app/resources/icons/icontools.png + app/resources/icons/icondraw.png + + diff --git a/app/resources/icons/icon.png b/app/resources/icons/icon.png old mode 100644 new mode 100755 diff --git a/app/resources/icons/iconcarta.png b/app/resources/icons/iconcarta.png old mode 100644 new mode 100755 diff --git a/app/resources/icons/iconcurva.png b/app/resources/icons/iconcurva.png old mode 100644 new mode 100755 diff --git a/app/resources/icons/icondraw.png b/app/resources/icons/icondraw.png old mode 100644 new mode 100755 diff --git a/app/resources/icons/iconmap.png b/app/resources/icons/iconmap.png old mode 100644 new mode 100755 diff --git a/app/resources/icons/iconnew.png b/app/resources/icons/iconnew.png old mode 100644 new mode 100755 diff --git a/app/resources/icons/iconopen.png b/app/resources/icons/iconopen.png old mode 100644 new mode 100755 diff --git a/app/resources/icons/iconsave.png b/app/resources/icons/iconsave.png old mode 100644 new mode 100755 diff --git a/app/resources/icons/icontools.png b/app/resources/icons/icontools.png old mode 100644 new mode 100755 diff --git a/app/resources/icons/logo.png b/app/resources/icons/logo.png old mode 100644 new mode 100755 diff --git a/app/view/__init__.py b/app/view/__init__.py old mode 100644 new mode 100755 diff --git a/app/view/config.py b/app/view/config.py old mode 100644 new mode 100755 index 14eb4f6..261b94e --- a/app/view/config.py +++ b/app/view/config.py @@ -1,299 +1,299 @@ -from __future__ import print_function - -# -*- coding: utf-8 -*- -import os -from builtins import str - -from qgis.PyQt import uic, QtWidgets -from qgis.PyQt.QtCore import QSettings, Qt -from qgis.PyQt.QtWidgets import QAbstractItemView -from qgis._core import QgsCoordinateReferenceSystem, QgsProject, QgsRasterLayer, QgsMapLayer, QgsRectangle, QgsVectorFileWriter, QgsVectorLayer - -from ..model.utils import yesNoDialog, msgLog -from ..model.config import Config, extractZIP, compactZIP - -FORM_CLASS, _ = uic.loadUiType(os.path.join( - os.path.dirname(__file__), '../view/ui/Topo_dialog_conf.ui')) - - -class TopoConfig(QtWidgets.QDialog, FORM_CLASS): - def __init__(self, iface, parent=None): - """Constructor.""" - # muda configuração padrão para aparecer prompt ao inves de pegar do projeto. - settings = QSettings() - settings.setValue("/Projections/defaultBehaviour", "prompt") - - self.TopoDialogBase: QtWidgets.QDialog - self.button_box: QtWidgets.QDialogButtonBox - self.comboClasse: QtWidgets.QComboBox - self.comboMap: QtWidgets.QComboBox - self.comboUnits: QtWidgets.QComboBox - self.estacas: QtWidgets.QDoubleSpinBox - self.groupBox: QtWidgets.QGroupBox - self.groupBox_2: QtWidgets.QGroupBox - self.label = QtWidgets.QLabel() - self.label_10: QtWidgets.QLabel - self.label_11: QtWidgets.QLabel - self.label_12: QtWidgets.QLabel - self.label_2: QtWidgets.QLabel - self.label_3: QtWidgets.QLabel - self.label_4: QtWidgets.QLabel - self.label_5: QtWidgets.QLabel - self.label_6: QtWidgets.QLabel - self.label_7: QtWidgets.QLabel - self.label_8: QtWidgets.QLabel - self.label_9: QtWidgets.QLabel - self.montanhosoMax: QtWidgets.QDoubleSpinBox - self.montanhosoMin: QtWidgets.QDoubleSpinBox - self.onduladoMax: QtWidgets.QDoubleSpinBox - self.onduladoMin: QtWidgets.QDoubleSpinBox - self.planoMax: QtWidgets.QDoubleSpinBox - self.planoMin: QtWidgets.QDoubleSpinBox - self.tableCRS = QtWidgets.QTableWidget() - self.transversal: QtWidgets.QDoubleSpinBox - self.txtCRS = QtWidgets.QLineEdit() - self.txtCSV: QtWidgets.QLineEdit - self.offsetSpinBox: QtWidgets.QSpinBox - self.velProj : QtWidgets.QSpinBox - - - super(TopoConfig, self).__init__(parent) - self.iface = iface - self.setupUi(self) - self.setWindowFlags(self.windowFlags() & Qt.WindowContextHelpButtonHint) - self.setup() - - self.unitsList=['m','Km','mm'] - self.comboClasse.currentIndexChanged.connect(self.updateVelocidade) - - self.dataAssociationWrite = {Config.data[0]: self.units, - Config.data[1]: self.txtCSV.text, - Config.data[2]: self.estacas.value, - Config.data[3]: self.transversal.value, - Config.data[4]: self.comboClasse.currentIndex, - Config.data[5]: self.txtCRS.text, - Config.data[6]: self.planoMin.value, - Config.data[7]: self.planoMax.value, - Config.data[8]: self.onduladoMin.value, - Config.data[9]: self.onduladoMax.value, - Config.data[10]: self.montanhosoMin.value, - Config.data[11]: self.montanhosoMax.value, - Config.data[12]: self.offsetSpinBox.value, - Config.data[14]: self.interpol.isChecked, - Config.data[15]: self.velProj.value, - Config.data[16]: self.emax.value, - Config.data[17]: self.prec.value - } - - self.dataAssociationRead = {Config.data[0]: self.setUnits, - Config.data[1]: self.txtCSV.setText, - Config.data[2]: self.estacas.setValue, - Config.data[3]: self.transversal.setValue, - Config.data[4]: self.comboClasse.setCurrentIndex, - Config.data[5]: self.txtCRS.setText, - Config.data[6]: self.planoMin.setValue, - Config.data[7]: self.planoMax.setValue, - Config.data[8]: self.onduladoMin.setValue, - Config.data[9]: self.onduladoMax.setValue, - Config.data[10]: self.montanhosoMin.setValue, - Config.data[11]: self.montanhosoMax.setValue, - Config.data[12]: self.offsetSpinBox.setValue, - Config.data[14]: self.interpol.setChecked, - Config.data[15]: self.velProj.setValue, - Config.data[16]: self.emax.setValue, - Config.data[17]: self.prec.setValue - } - - self.dbBuild: QtWidgets.QPushButton - self.dbBuild.clicked.connect(self.buildDb) - - def updateVelocidade(self, i): - v=[100, 100, 80, 80, 70, 60, 40, 40] - self.velProj.setValue(v[i]) - - def buildDb(self): - if yesNoDialog(iface=self, message="Tem certeza que deseja reconstruir o banco de dados?"): - cfg=Config.instance() - extractZIP(cfg.FILE_PATH) - con=cfg.create_datatable(cfg.TMP_DIR_PATH + "tmp/data/data.db") - con.close() - compactZIP(cfg.FILE_PATH) - - - def show(self): - for d in self.dataAssociationRead: - cfg=Config.instance() - try: - self.dataAssociationRead[d](getattr(cfg, d)) - except Exception as e: - import traceback - msgLog("Erro ao ler configurações: "+str(d)) - msgLog("Erro: " + str(traceback.format_exception(None, e, e.__traceback__))[1:-1]) - - return super(TopoConfig, self).show() - - def setUnits(self, s:str): - self.comboUnits.setCurrentIndex(self.unitsList.index(s)) - - def units(self): - return self.unitsList[self.comboUnits.currentIndex()] - - def accept(self): - for d in self.dataAssociationWrite: - setattr(Config, d, self.dataAssociationWrite[d]()) - Config.instance().store(d, self.dataAssociationWrite[d]()) - x=Config.instance().T_OFFSET - return super(TopoConfig, self).accept() - - def setup(self): - self.setWindowTitle(u"Configurações") - self.txtCRS.setText(str(self.iface.mapCanvas().mapSettings().destinationCrs().description())) - self.txtCSV.setText(';') - self.tableCRS.setColumnCount(2) - self.tableCRS.setColumnWidth(1, 254) - self.tableCRS.setSelectionBehavior(QAbstractItemView.SelectRows) - # self.conf.tableCRS.setRowCount(300) - self.tableCRS.setHorizontalHeaderLabels((u"ID", u"CRS")) - self.tableCRS:QtWidgets.QTableWidget - self.tableCRS.hide() - self.txtCRS.hide() - self.label.hide() - self.comboMap.hide() - - def changeCRS(self, crs): - if crs == None: - crs = 31983 - mycrs = QgsCoordinateReferenceSystem(int(crs), 0) - # self.iface.mapCanvas().mapRenderer().setCrs( QgsCoordinateReferenceSystem(mycrs, QgsCoordinateReferenceSystem.EpsgCrsId) ) - self.iface.mapCanvas().mapSettings().setDestinationCrs(mycrs) # set CRS to canvas - # self.iface.mapCanvas().setMapUnits(QGis.Meters) - self.iface.mapCanvas().refresh() - - # self.iface.mapCanvas().mapSettings().setProjectionsEnabled(True) - - def new_file(self): - filename = QtWidgets.QFileDialog.getSaveFileName() - return filename - - def open_file(self): - filename = QtWidgets.QFileDialog.getOpenFileName(filter="Project files (*.zip)") - return filename - - def error(self, msg): - msgBox = QtWidgets.QMessageBox(QtWidgets.QMessageBox.Warning, "AVISO", - u"%s" % msg, - QtWidgets.QMessageBox.NoButton, None) - msgBox.addButton("OK", QtWidgets.QMessageBox.AcceptRole) - # msgBox.addButton("&Continue", QtGui.QMessageBox.RejectRole) - msgBox.exec_() - - def update(self, model, txtcrs): - self.txtCRS.setText(U"%s" % txtcrs) - # print model.CSV_DELIMITER - self.txtCSV.setText(U"%s" % model.CSV_DELIMITER) - self.comboClasse.setCurrentIndex(model.class_project + 1) - self.planoMin.setValue(model.dataTopo[0]) - self.planoMax.setValue(model.dataTopo[1]) - self.onduladoMin.setValue(model.dataTopo[2]) - self.onduladoMax.setValue(model.dataTopo[3]) - self.montanhosoMin.setValue(model.dataTopo[4]) - self.montanhosoMax.setValue(model.dataTopo[5]) - self.comboMap.setCurrentIndex(model.ordem_mapa.index(model.tipo_mapa) + 1) - self.comboUnits.setCurrentIndex(model.ordem_units.index(model.UNITS)) - - def carregamapa(self, tmap=3): - from ..model.utils import msgLog - - root = QgsProject.instance().layerTreeRoot() - urlWithParams = 'type=xyz&url=http://mt1.google.com/vt/lyrs%3Ds%26x%3D%7Bx%7D%26y%3D%7By%7D%26z%3D%7Bz%7D&zmax=19&zmin=0' - rlayer = QgsRasterLayer(urlWithParams, 'Google Satellite', 'wms') - if rlayer.isValid(): - QgsProject.instance().addMapLayer(rlayer, False) - root.addLayer(rlayer) - else: - msgLog('Failed to load Satellite layer') - - - urlWithParams = 'type=xyz&url=http://mt1.google.com/vt/lyrs%3Dt%26x%3D%7Bx%7D%26y%3D%7By%7D%26z%3D%7Bz%7D&zmax=19&zmin=0' - rlayer = QgsRasterLayer(urlWithParams, 'Google Terrain', 'wms') - if rlayer.isValid(): - QgsProject.instance().addMapLayer(rlayer, False) - root.addLayer(rlayer) - else: - msgLog('Failed to load Terrain layer') - - - - def carregacarta(self, model): - # create Qt widget - canvas = self.iface.mapCanvas() - # canvas.setCanvasColor(Qt.black) - - # enable this for smooth rendering - canvas.enableAntiAliasing(True) - - # not updated US6SP10M files from ENC_ROOT - source_dir = QtWidgets.QFileDialog.getExistingDirectory(None, 'Select a folder:', '', - QtWidgets.QFileDialog.ShowDirsOnly) - if source_dir in [None, '']: return - # source_dir = "/home/lucas/python_work/TopoGraph" - canvas_layers = [] - extent = QgsRectangle() - extent.setMinimal() - - # load vector layers - registry = QgsMapLayer.instance() - - try: - os.mkdir(r"%s/tmp" % (source_dir)) - except: - pass - - for files in os.listdir(source_dir): - - # load only the shapefiles - if files.endswith(".dxf") or files.endswith(".shp") or files.endswith(".dgn"): - vlayer = QgsVectorLayer(source_dir + "/" + files, files, "ogr") - - # add layer to the registry - # registry.addMapLayer(vlayer) - # extent.combineExtentWith(vlayer.extent()) - # canvas_layers.append(QgsMapCanvasLayer(vlayer)) - - vlayer = QgsVectorLayer(r"%s/tmp/%s.shp" % (source_dir, files), files, "ogr") - - attr = {} - vlayerUser = vlayer.crs().toProj4() - for elem in vlayerUser.strip().split('+'): - key_value = elem.strip().split('=') - if len(key_value) > 1: - attr[key_value[0]] = key_value[1] - else: - attr[key_value[0]] = None - attr['units'] = Config.UNITS - string_proj = '' - for a in attr: - if a == '': - continue - if attr[a] is None: - string_proj += '+%s ' % a - else: - string_proj += '+%s=%s ' % (a, attr[a]) - crs = QgsCoordinateReferenceSystem() - crs.createFromProj4(string_proj) - vlayer.setCrs(crs) - registry.addMapLayer(vlayer) - extent.combineExtentWith(vlayer.extent()) - canvas_layers.append(QgsMapLayer(vlayer)) - - self.format = QgsVectorFileWriter.writeAsVectorFormat(vlayer, r"%s/tmp/%s.shp" % (source_dir, files), - "utf-8", None, "ESRI Shapefile") - print(self.format) - # set extent to the extent of our layer - # canvas.setExtent(vlayer.extent()) - - # set the map canvas layer set - # canvas.setLayerSet([QgsMapCanvasLayer(vlayer)]) - - canvas.setExtent(extent) - canvas.setLayerSet(canvas_layers) +from __future__ import print_function + +# -*- coding: utf-8 -*- +import os +from builtins import str + +from qgis.PyQt import uic, QtWidgets +from qgis.PyQt.QtCore import QSettings, Qt +from qgis.PyQt.QtWidgets import QAbstractItemView +from qgis._core import QgsCoordinateReferenceSystem, QgsProject, QgsRasterLayer, QgsMapLayer, QgsRectangle, QgsVectorFileWriter, QgsVectorLayer + +from ..model.utils import yesNoDialog, msgLog +from ..model.config import Config, extractZIP, compactZIP + +FORM_CLASS, _ = uic.loadUiType(os.path.join( + os.path.dirname(__file__), '../view/ui/Topo_dialog_conf.ui')) + + +class TopoConfig(QtWidgets.QDialog, FORM_CLASS): + def __init__(self, iface, parent=None): + """Constructor.""" + # muda configuração padrão para aparecer prompt ao inves de pegar do projeto. + settings = QSettings() + settings.setValue("/Projections/defaultBehaviour", "prompt") + + self.TopoDialogBase: QtWidgets.QDialog + self.button_box: QtWidgets.QDialogButtonBox + self.comboClasse: QtWidgets.QComboBox + self.comboMap: QtWidgets.QComboBox + self.comboUnits: QtWidgets.QComboBox + self.estacas: QtWidgets.QDoubleSpinBox + self.groupBox: QtWidgets.QGroupBox + self.groupBox_2: QtWidgets.QGroupBox + self.label = QtWidgets.QLabel() + self.label_10: QtWidgets.QLabel + self.label_11: QtWidgets.QLabel + self.label_12: QtWidgets.QLabel + self.label_2: QtWidgets.QLabel + self.label_3: QtWidgets.QLabel + self.label_4: QtWidgets.QLabel + self.label_5: QtWidgets.QLabel + self.label_6: QtWidgets.QLabel + self.label_7: QtWidgets.QLabel + self.label_8: QtWidgets.QLabel + self.label_9: QtWidgets.QLabel + self.montanhosoMax: QtWidgets.QDoubleSpinBox + self.montanhosoMin: QtWidgets.QDoubleSpinBox + self.onduladoMax: QtWidgets.QDoubleSpinBox + self.onduladoMin: QtWidgets.QDoubleSpinBox + self.planoMax: QtWidgets.QDoubleSpinBox + self.planoMin: QtWidgets.QDoubleSpinBox + self.tableCRS = QtWidgets.QTableWidget() + self.transversal: QtWidgets.QDoubleSpinBox + self.txtCRS = QtWidgets.QLineEdit() + self.txtCSV: QtWidgets.QLineEdit + self.offsetSpinBox: QtWidgets.QSpinBox + self.velProj : QtWidgets.QSpinBox + + + super(TopoConfig, self).__init__(parent) + self.iface = iface + self.setupUi(self) + self.setWindowFlags(self.windowFlags() & Qt.WindowContextHelpButtonHint) + self.setup() + + self.unitsList=['m','Km','mm'] + self.comboClasse.currentIndexChanged.connect(self.updateVelocidade) + + self.dataAssociationWrite = {Config.data[0]: self.units, + Config.data[1]: self.txtCSV.text, + Config.data[2]: self.estacas.value, + Config.data[3]: self.transversal.value, + Config.data[4]: self.comboClasse.currentIndex, + Config.data[5]: self.txtCRS.text, + Config.data[6]: self.planoMin.value, + Config.data[7]: self.planoMax.value, + Config.data[8]: self.onduladoMin.value, + Config.data[9]: self.onduladoMax.value, + Config.data[10]: self.montanhosoMin.value, + Config.data[11]: self.montanhosoMax.value, + Config.data[12]: self.offsetSpinBox.value, + Config.data[14]: self.interpol.isChecked, + Config.data[15]: self.velProj.value, + Config.data[16]: self.emax.value, + Config.data[17]: self.prec.value + } + + self.dataAssociationRead = {Config.data[0]: self.setUnits, + Config.data[1]: self.txtCSV.setText, + Config.data[2]: self.estacas.setValue, + Config.data[3]: self.transversal.setValue, + Config.data[4]: self.comboClasse.setCurrentIndex, + Config.data[5]: self.txtCRS.setText, + Config.data[6]: self.planoMin.setValue, + Config.data[7]: self.planoMax.setValue, + Config.data[8]: self.onduladoMin.setValue, + Config.data[9]: self.onduladoMax.setValue, + Config.data[10]: self.montanhosoMin.setValue, + Config.data[11]: self.montanhosoMax.setValue, + Config.data[12]: self.offsetSpinBox.setValue, + Config.data[14]: self.interpol.setChecked, + Config.data[15]: self.velProj.setValue, + Config.data[16]: self.emax.setValue, + Config.data[17]: self.prec.setValue + } + + self.dbBuild: QtWidgets.QPushButton + self.dbBuild.clicked.connect(self.buildDb) + + def updateVelocidade(self, i): + v=[100, 100, 80, 80, 70, 60, 40, 40] + self.velProj.setValue(v[i]) + + def buildDb(self): + if yesNoDialog(iface=self, message="Tem certeza que deseja reconstruir o banco de dados?"): + cfg=Config.instance() + extractZIP(cfg.FILE_PATH) + con=cfg.create_datatable(cfg.TMP_DIR_PATH + "tmp/data/data.db") + con.close() + compactZIP(cfg.FILE_PATH) + + + def show(self): + for d in self.dataAssociationRead: + cfg=Config.instance() + try: + self.dataAssociationRead[d](getattr(cfg, d)) + except Exception as e: + import traceback + msgLog("Erro ao ler configurações: "+str(d)) + msgLog("Erro: " + str(traceback.format_exception(None, e, e.__traceback__))[1:-1]) + + return super(TopoConfig, self).show() + + def setUnits(self, s:str): + self.comboUnits.setCurrentIndex(self.unitsList.index(s)) + + def units(self): + return self.unitsList[self.comboUnits.currentIndex()] + + def accept(self): + for d in self.dataAssociationWrite: + setattr(Config, d, self.dataAssociationWrite[d]()) + Config.instance().store(d, self.dataAssociationWrite[d]()) + x=Config.instance().T_OFFSET + return super(TopoConfig, self).accept() + + def setup(self): + self.setWindowTitle(u"Configurações") + self.txtCRS.setText(str(self.iface.mapCanvas().mapSettings().destinationCrs().description())) + self.txtCSV.setText(';') + self.tableCRS.setColumnCount(2) + self.tableCRS.setColumnWidth(1, 254) + self.tableCRS.setSelectionBehavior(QAbstractItemView.SelectRows) + # self.conf.tableCRS.setRowCount(300) + self.tableCRS.setHorizontalHeaderLabels((u"ID", u"CRS")) + self.tableCRS:QtWidgets.QTableWidget + self.tableCRS.hide() + self.txtCRS.hide() + self.label.hide() + self.comboMap.hide() + + def changeCRS(self, crs): + if crs == None: + crs = 31983 + mycrs = QgsCoordinateReferenceSystem(int(crs), 0) + # self.iface.mapCanvas().mapRenderer().setCrs( QgsCoordinateReferenceSystem(mycrs, QgsCoordinateReferenceSystem.EpsgCrsId) ) + self.iface.mapCanvas().mapSettings().setDestinationCrs(mycrs) # set CRS to canvas + # self.iface.mapCanvas().setMapUnits(QGis.Meters) + self.iface.mapCanvas().refresh() + + # self.iface.mapCanvas().mapSettings().setProjectionsEnabled(True) + + def new_file(self): + filename = QtWidgets.QFileDialog.getSaveFileName() + return filename + + def open_file(self): + filename = QtWidgets.QFileDialog.getOpenFileName(filter="Project files (*.zip)") + return filename + + def error(self, msg): + msgBox = QtWidgets.QMessageBox(QtWidgets.QMessageBox.Warning, "AVISO", + u"%s" % msg, + QtWidgets.QMessageBox.NoButton, None) + msgBox.addButton("OK", QtWidgets.QMessageBox.AcceptRole) + # msgBox.addButton("&Continue", QtGui.QMessageBox.RejectRole) + msgBox.exec_() + + def update(self, model, txtcrs): + self.txtCRS.setText(U"%s" % txtcrs) + # print model.CSV_DELIMITER + self.txtCSV.setText(U"%s" % model.CSV_DELIMITER) + self.comboClasse.setCurrentIndex(model.class_project + 1) + self.planoMin.setValue(model.dataTopo[0]) + self.planoMax.setValue(model.dataTopo[1]) + self.onduladoMin.setValue(model.dataTopo[2]) + self.onduladoMax.setValue(model.dataTopo[3]) + self.montanhosoMin.setValue(model.dataTopo[4]) + self.montanhosoMax.setValue(model.dataTopo[5]) + self.comboMap.setCurrentIndex(model.ordem_mapa.index(model.tipo_mapa) + 1) + self.comboUnits.setCurrentIndex(model.ordem_units.index(model.UNITS)) + + def carregamapa(self, tmap=3): + from ..model.utils import msgLog + + root = QgsProject.instance().layerTreeRoot() + urlWithParams = 'type=xyz&url=http://mt1.google.com/vt/lyrs%3Ds%26x%3D%7Bx%7D%26y%3D%7By%7D%26z%3D%7Bz%7D&zmax=19&zmin=0' + rlayer = QgsRasterLayer(urlWithParams, 'Google Satellite', 'wms') + if rlayer.isValid(): + QgsProject.instance().addMapLayer(rlayer, False) + root.addLayer(rlayer) + else: + msgLog('Failed to load Satellite layer') + + + urlWithParams = 'type=xyz&url=http://mt1.google.com/vt/lyrs%3Dt%26x%3D%7Bx%7D%26y%3D%7By%7D%26z%3D%7Bz%7D&zmax=19&zmin=0' + rlayer = QgsRasterLayer(urlWithParams, 'Google Terrain', 'wms') + if rlayer.isValid(): + QgsProject.instance().addMapLayer(rlayer, False) + root.addLayer(rlayer) + else: + msgLog('Failed to load Terrain layer') + + + + def carregacarta(self, model): + # create Qt widget + canvas = self.iface.mapCanvas() + # canvas.setCanvasColor(Qt.black) + + # enable this for smooth rendering + canvas.enableAntiAliasing(True) + + # not updated US6SP10M files from ENC_ROOT + source_dir = QtWidgets.QFileDialog.getExistingDirectory(None, 'Select a folder:', '', + QtWidgets.QFileDialog.ShowDirsOnly) + if source_dir in [None, '']: return + # source_dir = "/home/lucas/python_work/TopoGraph" + canvas_layers = [] + extent = QgsRectangle() + extent.setMinimal() + + # load vector layers + registry = QgsMapLayer.instance() + + try: + os.mkdir(r"%s/tmp" % (source_dir)) + except: + pass + + for files in os.listdir(source_dir): + + # load only the shapefiles + if files.endswith(".dxf") or files.endswith(".shp") or files.endswith(".dgn"): + vlayer = QgsVectorLayer(source_dir + "/" + files, files, "ogr") + + # add layer to the registry + # registry.addMapLayer(vlayer) + # extent.combineExtentWith(vlayer.extent()) + # canvas_layers.append(QgsMapCanvasLayer(vlayer)) + + vlayer = QgsVectorLayer(r"%s/tmp/%s.shp" % (source_dir, files), files, "ogr") + + attr = {} + vlayerUser = vlayer.crs().toProj4() + for elem in vlayerUser.strip().split('+'): + key_value = elem.strip().split('=') + if len(key_value) > 1: + attr[key_value[0]] = key_value[1] + else: + attr[key_value[0]] = None + attr['units'] = Config.UNITS + string_proj = '' + for a in attr: + if a == '': + continue + if attr[a] is None: + string_proj += '+%s ' % a + else: + string_proj += '+%s=%s ' % (a, attr[a]) + crs = QgsCoordinateReferenceSystem() + crs.createFromProj4(string_proj) + vlayer.setCrs(crs) + registry.addMapLayer(vlayer) + extent.combineExtentWith(vlayer.extent()) + canvas_layers.append(QgsMapLayer(vlayer)) + + self.format = QgsVectorFileWriter.writeAsVectorFormat(vlayer, r"%s/tmp/%s.shp" % (source_dir, files), + "utf-8", None, "ESRI Shapefile") + print(self.format) + # set extent to the extent of our layer + # canvas.setExtent(vlayer.extent()) + + # set the map canvas layer set + # canvas.setLayerSet([QgsMapCanvasLayer(vlayer)]) + + canvas.setExtent(extent) + canvas.setLayerSet(canvas_layers) diff --git a/app/view/curvas.py b/app/view/curvas.py old mode 100644 new mode 100755 index 970a891..82879ea --- a/app/view/curvas.py +++ b/app/view/curvas.py @@ -1,883 +1,883 @@ -from builtins import str -# -*- coding: utf-8 -*- -import os -import sip -from copy import deepcopy - -from qgis.core import QgsProject, QgsFields, QgsField, QgsPoint - -from ..view.estacas import ProgressDialog -from ..view.ui.ch import CurvasCompositorDialog, EMPTY_DATA -from ..model.utils import msgLog, PointTool, p2QgsPoint - -from ..model.helper.qgsgeometry import * - - -sip.setapi('QString', 2) - -from qgis.PyQt import QtGui, uic, Qt, QtWidgets - -import qgis - -import shutil -from ..model.config import extractZIP, Config, compactZIP -from qgis.PyQt.QtCore import QSettings -from qgis.PyQt.QtWidgets import QAbstractItemView, QDesktopWidget - -from qgis._core import QgsCoordinateReferenceSystem, QgsCoordinateTransform, QgsFeature - -from qgis._core import QgsRectangle -from qgis._core import QgsVectorFileWriter -from qgis._core import QgsVectorLayer -from qgis._core import Qgis - -from qgis.utils import * -from qgis.PyQt import QtWidgets - -from ..model.helper.calculos import * -from ..model.curvas import Curvas as CurvasModel - -FORMCURVA_CLASS, _ = uic.loadUiType(os.path.join(os.path.dirname(__file__), '../view/ui/Topo_dialog_curva.ui')) - -ID_ESTACA = 0 -ESTACA = 1 -DESCRICAO = 2 -PROGRESSIVA = 3 -NORTH = 4 -ESTE = 5 -COTA = 6 -AZIMUTE = 7 - - -class Curvas(QtWidgets.QDialog, FORMCURVA_CLASS): - def __init__(self,view, iface, id_filename, curvas, vertices, tipoClasseProjeto): - super(Curvas, self).__init__(None) - self.view=view - self.iface = iface - self.model = CurvasModel(id_filename) - self.estacas = self.model.list_estacas() - self.estacas_id = [row[0] for row in self.estacas] - - self.curvas = curvas - self.vertices=vertices - - self.tipo = tipoClasseProjeto[0] - self.classe = tipoClasseProjeto[1] - self.id_filename = id_filename - self.tipo_curva = 0 - self.estacaInicial = self.estacas[0] if self.estacas else 0 - self.estacaFinal = self.estacas[0] if self.estacas else 0 - self.setupUi(self) - - self.Dialog: QtWidgets.QDialog - self.btnAjuda: QtWidgets.QPushButton - self.btnApagar: QtWidgets.QPushButton - - self.btnCancela: QtWidgets.QPushButton - - - self.btnInsere: QtWidgets.QPushButton - - self.btnRelatorio: QtWidgets.QPushButton - self.comboCurva: QtWidgets.QComboBox - self.comboElemento: QtWidgets.QComboBox - - self.gDadosCurva: QtWidgets.QGroupBox - self.groupBox: QtWidgets.QGroupBox - self.groupBox_2: QtWidgets.QGroupBox - self.label: QtWidgets.QLabel - self.label_10: QtWidgets.QLabel - self.label_11: QtWidgets.QLabel - self.label_12: QtWidgets.QLabel - self.label_13: QtWidgets.QLabel - self.label_14: QtWidgets.QLabel - self.label_15: QtWidgets.QLabel - self.label_16: QtWidgets.QLabel - self.label_17: QtWidgets.QLabel - self.label_18: QtWidgets.QLabel - self.label_19: QtWidgets.QLabel - self.label_2: QtWidgets.QLabel - self.label_20: QtWidgets.QLabel - self.label_21: QtWidgets.QLabel - self.label_22: QtWidgets.QLabel - self.label_23: QtWidgets.QLabel - self.label_24: QtWidgets.QLabel - self.label_3: QtWidgets.QLabel - self.label_4: QtWidgets.QLabel - self.label_5: QtWidgets.QLabel - self.label_6: QtWidgets.QLabel - self.label_7: QtWidgets.QLabel - self.label_8: QtWidgets.QLabel - self.label_9: QtWidgets.QLabel - self.layoutWidget: QtWidgets.QWidget - self.layoutWidget: QtWidgets.QWidget - self.layoutWidget: QtWidgets.QWidget - self.layoutWidget: QtWidgets.QWidget - self.layoutWidget: QtWidgets.QWidget - self.layoutWidget: QtWidgets.QWidget - self.txtD: QtWidgets.QLineEdit - self.txtDelta: QtWidgets.QLineEdit - - self.txtEMAX: QtWidgets.QDoubleSpinBox - - self.btnAjuda.hide() - - self.txtFMAX: QtWidgets.QTextEdit - self.txtG20: QtWidgets.QLineEdit - self.txtI: QtWidgets.QLineEdit - - - - self.txtRMIN: QtWidgets.QLineEdit - self.txtRUtilizado: QtWidgets.QDoubleSpinBox - self.txtT: QtWidgets.QLineEdit - self.txtVelocidade: QtWidgets.QSpinBox - self.deflexao: QtWidgets.QLineEdit - - self.shortcut1 = QtWidgets.QShortcut(QtGui.QKeySequence.MoveToNextChar, self) - self.shortcut2 = QtWidgets.QShortcut(QtGui.QKeySequence.MoveToPreviousChar, self) - self.whatsThisAction=QtWidgets.QWhatsThis.createAction(self) - self.btnAjuda.clicked.connect(self.whatsThisAction.trigger) - - self.buttons=[self.btnAjuda, self.btnApagar, self.btnCancela, - self.btnInsere, self.btnRelatorio] - - self.dados = { - 'file': self.model.id_filename, - 'tipo': self.comboElemento.currentIndex(), - 'curva': self.comboCurva.currentText(), - 'vel': self.txtVelocidade.value(), - 'emax': self.txtEMAX.value(), - 'ls': self.Ls.value(), - 'R': self.txtRUtilizado.value(), - 'fmax': 0 if self.txtFMAX.text()=="" else float(self.txtFMAX.text()), - 'D': self.txtD.value() - } - - - self.curvas = [self.tr(str(curva[0])) for curva in self.curvas] - self.fill_comboCurva() - self.curvaFailed=False - self.editando = False - self.dChanged=False - - self.eventos() - self.update() - self.location_on_the_screen() - - self.txtI.hide() - self.label_11.hide() - self.progressDialog=ProgressDialog(iface) - - self.nextCurva() - self.previousCurva() - self.mudancaCurva(0) - - def hideEvent(self, event: QtGui.QHideEvent): - if not event.spontaneous(): - event.ignore() - else: - super(Curvas, self).hideEvent(event) - - - def createLayer(self): - if hasattr(self,"c"): - self.c.rejected.emit() - self.c = CurvasCompositorDialog(self) - self.c.accepted.connect(self.saveCurva) - self.c.rejected.connect(self.resetCurva) - self.c.edited.connect(self.drawCurva) - - def location_on_the_screen(self): - screen = QDesktopWidget().screenGeometry() - widget = self.geometry() - x = 0#widget.width() - y = (screen.height()-widget.height())/2 - self.move(x, y) - - def fill_comboCurva(self): - self.comboCurva.clear() - self.PIs=[] - self.layer=self.view.curvaLayers[0] - items=[] - i=0 - for c, vert in enumerate(self.vertices): - digits=int("".join([s for s in vert[0] if s.isdigit()])) - if digits>i-1: - items.append("PI"+str(i)) - self.PIs.append(vert[1]) - i+=1 - items=items[1:-1] - self.comboCurva.addItems(items) - if not wasInitialized(self.layer): - tangentFeaturesFromPointList(self.layer,self.PIs) - refreshCanvas(self.iface, self.layer) - - - def update(self): - self.calcularCurva() - if hasattr(self, "c"): - self.c.rejected.emit() - - def eventos(self): - self.comboCurva.currentIndexChanged.connect(self.mudancaCurva) - self.comboElemento.currentIndexChanged.connect(self.mudancaTipo) - self.btnInsere.clicked.connect(self.insert) - self.btnApagar.clicked.connect(self.apagar) - self.btnRelatorio.clicked.connect(self.draw) - self.btnCancela.clicked.connect(self.mudancaCurva) - self.generateAll.clicked.connect(self.genAll) - self.btnErase.clicked.connect(self.eraseAll) - self.txtD.valueChanged.connect(self.changeD) - self.txtDls.valueChanged.connect(self.changeD) - [w.valueChanged.connect(lambda: self.calcularCurva(False)) - for w in [self.txtVelocidade, self.txtRUtilizado, self.txtEMAX, self.Ls, self.txtD, self.txtDls]] - self.shortcut1.activated.connect(self.nextCurva) - self.shortcut2.activated.connect(self.previousCurva) - - def changeD(self): - self.dChanged=True - - def uneventos(self): - self.comboCurva.currentIndexChanged.disconnect() - self.comboElemento.currentIndexChanged.disconnect() - self.btnInsere.clicked.disconnect() - self.btnApagar.clicked.disconnect() - self.btnRelatorio.clicked.disconnect() - self.btnCancela.clicked.disconnect() - self.generateAll.clicked.disconnect() - self.btnErase.clicked.disconnect() - [w.valueChanged.disconnect() - for w in [self.txtVelocidade, self.txtRUtilizado, self.txtEMAX, self.Ls, self.txtD, self.txtDls]] - self.shortcut1.activated.disconnect() - self.shortcut2.activated.disconnect() - - def eraseAll(self): - self.progressDialog.show() - self.progressDialog.setLoop(100,self.comboCurva.count()) - self.comboCurva.setCurrentIndex(0) - while self.next.isEnabled(): - self.progressDialog.increment() - try: - self.apagar() - except: - pass - self.nextCurva() - - try: - self.apagar() - except: - pass - self.progressDialog.close() - self.progressDialog.setValue(0) - - def genAll(self): - self.progressDialog.show() - self.progressDialog.setLoop(100,self.comboCurva.count()) - self.comboCurva.setCurrentIndex(0) - while self.next.isEnabled(): - self.progressDialog.increment() - try: - self.insert() - except: - pass - self.nextCurva() - - try: - self.insert() - except: - pass - self.progressDialog.close() - self.progressDialog.setValue(0) - - def apagar(self): - if self.curva_id: - self.model.delete_curva(self.curva_id, self.dados) - self.update() - features=[] - PI=0 - for i,feat in enumerate(self.layer.getFeatures()): - if i>self.current_index and i 0): - ultima = self.curvas[-1][0] - else: - ultima = -1 - self.curvas.append(["%d" % (ultima + 1,)]) - #self.comboCurva.addItems([self.tr("%d" % (ultima + 1,))]) - self.calcularCurva(new=True) - - def exec_(self): - self.comboCurva: QtWidgets.QComboBox - if self.comboCurva.count()>1: - self.comboCurva.setCurrentIndex(0) - if self.view.empty and not featureCount(self.layer): - PT=PointTool(self.iface, self.pointLayerDefine) - PT.start() - self.setNoLayer() - else: - return super(Curvas, self).exec_() - - def pointLayerDefine(self, point): - point=QgsPointXY(point) - tangentFeaturesFromPointList(self.layer,[p2QgsPoint(point), p2QgsPoint(point.x(),point.y()+.001)]) - refreshCanvas(self.iface, self.layer) - self.comboCurva.addItem("PI"+str(0)) - self.enableInterface() - self.justStarted=True - return super(Curvas, self).exec_() - - def setNoLayer(self): - self.oldTitle=self.windowTitle() - self.setWindowTitle(u"Escolha o ponto de partida no mapa!!!") - for btn in self.buttons: - btn:QtWidgets.QPushButton - btn.setDisabled(True) - - def enableInterface(self): - self.setWindowTitle(self.oldTitle) - for btn in self.buttons: - btn:QtWidgets.QPushButton - btn.setDisabled(False) - - def drawCurva(self): - if not hasattr(self.c, "dados"): - self.c.dados=[] - self.comboCurva: QtWidgets.QComboBox - layer = QgsVectorLayer('LineString?crs=%s'%(QgsProject.instance().crs().authid()), "Curva: " + str(self.comboCurva.currentText()) , "memory") - layer.setCrs(QgsCoordinateReferenceSystem(QgsProject.instance().crs())) - layer.renderer().symbol().setWidth(.5) - layer.renderer().symbol().setColor(QtGui.QColor("#0f16d0")) - layer.triggerRepaint() - fields=layerFields() - layer.dataProvider().addAttributes(fields) - layer.updateFields() - QgsProject.instance().addMapLayer(layer, False) - QgsProject.instance().layerTreeRoot().insertLayer(0, layer) - self.c.layer=layer - - layer=self.c.layer - layer.dataProvider().deleteFeatures([f.id() for f in layer.getFeatures()]) - - vmax=0 - k=0 - i=-1 - data=None - - try: - if hasattr(self,"justStarted") and self.justStarted: - for tipo, index, state in self.c.readData(): - i+=1 - if tipo=="C": - data=circleArc2(layer, state, index, self.layer, self.next_index) - k=0 - vmax="120 km/h" - - elif tipo=="EC": - data = polyTransCircle(layer, state, index, self.layer, self.next_index, self.current_index) - k = 0 - vmax = "120 km/h" - - elif tipo=="EE": - data=inSpiral2(layer, state, index, self.layer, self.next_index) - k=0 - vmax="120 km/h" - - elif tipo=="ES": - data=outSpiral2(layer, state, index, self.layer, self.next_index) - k=0 - vmax="120 km/h" - - elif tipo=="T": - data=tangent2(layer, state, index, self.layer, self.next_index) - k=0 - vmax="120 km/h" - else: - continue - - if len(self.c.dados)-1=self.comboCurva.count()-1: - self.next.setEnabled(False) - self.comboCurva.setCurrentIndex(self.comboCurva.count()-1) - elif i0: - self.comboCurva.setCurrentIndex(i) - self.prev.setEnabled(True) - self.next.setEnabled(True) - - def saveCurva(self): - self.layer: QgsVectorLayer - self.comboCurva : QtWidgets.QComboBox - self.draw() - if self.curvaFailed: - return - - curvaFeats=featuresList(self.c.layer) - features = [] - if hasattr(self, "justStarted") and self.justStarted: - i=0 - for f, tipo in zip(curvaFeats, self.c.dados): - feat=QgsFeature(self.layer.fields()) - feat.setGeometry(f.geometry()) - feat.setAttributes([i,str(tipo[0]), "Traçado"]) - features.append(feat) - i+=1 - self.justStarted=False - - elif len(curvaFeats)>0: - fid=1 - nomes=[] - #Delete all features of self.layer and add layer geometry in between - for i,feat in enumerate(self.layer.getFeatures()): - if i>self.current_index and i0: - self.groupBox_3.show() - else: - self.groupBox_3.hide() - - self.calcularCurva(True) - - - def mudancaEstacaInicial(self, pos): - - self.estacaInicial = self.estacas[pos] - - self.calcularCurva() - - def mudancaEstacaFinal(self, pos): - self.calcularCurva() - - def desabilitarControles(self): - #self.habilitarControles(False) - pass - - def habilitarControles(self, signal): - - if type(signal) != type(True): - return False - - self.comboCurva.setEnabled(not (signal)) - - - self.btnApagar.setEnabled(not (signal)) - self.btnRelatorio.setEnabled(not (signal)) - self.btnInsere.setEnabled(signal) - self.comboElemento.setEnabled(not signal) - - - self.txtVelocidade.setEnabled(signal) - self.txtEMAX.setEnabled(signal) - self.txtRUtilizado.setEnabled(signal) - self.btnRelatorio.setEnabled(signal) - self.btnCancela.setEnabled(signal) - self.txtFMAX.setEnabled(signal) - self.prev.setEnabled(not signal) - self.next.setEnabled(not signal) - - if self.comboElemento.currentIndex()>0: - self.Ls.setEnabled(signal) - - return True - - def currentIndex(self): - i=self.comboCurva.currentIndex() - f=0 - n=0 - for feat1, feat2 in zip(featuresList(self.layer), featuresList(self.layer)[1:]): - if n == i: - self.current_index = max(f, 0) - return max(f, 0) - if getTipo(feat2)=="T": - n+=1 - f+=1 - self.current_index= max(f-1, 0) - return max(f-1, 0) - - def nextIndex(self): - i=self.currentIndex()+1 - fl = featuresList(self.layer) - feat = fl[i] - while getTipo(feat) != "T": - i += 1 - feat = fl[i] - self.next_index=i - return i - - def calcularCurva(self, new=False): - self.nextIndex() - try: - self.uneventos() - except: - pass - # i = calculeI(float(self.estacaInicial[PROGRESSIVA]), float(self.estacaFinal[PROGRESSIVA]), - # float(self.estacaInicial[COTA]), float(self.estacaFinal[COTA])) - i=0 - v = Config.instance().velproj if new else self.txtVelocidade.value() - #velocidade(float(i), self.classe, self.tipo) - e_max = Config.instance().emax if new else float(self.txtEMAX.value()) - f_max = fmax(int(v))# if new else 0 if self.txtFMAX.text()=="" else float(self.txtFMAX.text()) - - delta_val = delta(float(azi(featureToPolyline(featuresList(self.layer)[self.current_index]))), - float(azi(featureToPolyline(featuresList(self.layer)[self.next_index])))) - - if new: - rutilizado=rmin(int(v), e_max, f_max) - if self.comboElemento.currentIndex() == 0: - d_val = d_curva_simples(rutilizado, delta_val) - dist=Config.instance().DIST - d_val=d_val+dist-d_val%dist - rutilizado = r_curva_simples(d_val, delta_val) - lutilizado=0 - else: - d_val = d_curva_simples(rutilizado, delta_val) - dist=Config.instance().DIST - d_val=d_val+dist-d_val%dist - rutilizado = r_curva_simples(d_val, delta_val) - lutilizado = l_utilizado(rutilizado,v,delta_val) - lutilizado = lutilizado + dist - lutilizado % dist - - self.txtRUtilizado.setValue(rutilizado) - self.txtVelocidade.setValue(v) - self.txtEMAX.setValue(e_max) - self.Ls.setValue(lutilizado) - self.txtD.setValue(roundFloat(d_val)) - else: - lutilizado = float(self.Ls.value()) - if not self.dChanged: - rutilizado = float(self.txtRUtilizado.value()) - d_val = d_curva_simples(rutilizado, delta_val) - self.txtD.setValue(roundFloat(d_val)) - else: - if self.comboElemento.currentIndex() == 0: - d_val=self.txtD.value() - rutilizado=r_curva_simples(d_val, delta_val) - else: - dls=self.txtDls.value() - rutilizado=(lutilizado+dls)/np.deg2rad(delta_val) - self.txtRUtilizado.setValue(rutilizado) - self.dChanged=False - - g20_val = g20(rutilizado) - t_val = t(rutilizado, delta_val) - - if self.comboElemento.currentIndex() > 0: - # d_val, theta, lsmin, lsmax, sc, cs - lsmin=max(0.036*v**3/rutilizado, 0.556*v) - lsmax=rutilizado*delta_val*np.pi/180 - theta=lutilizado/(2*rutilizado) - self.theta.setText(roundFloat2str(np.rad2deg(theta))) - self.lsmax.setText(roundFloat2str(lsmax)) - self.lsmin.setText(roundFloat2str(0.036*v**3/rutilizado)) - self.txtD.setEnabled(True) - - #d_val=self.txtD.value() - xs=clotX(theta)*lutilizado - ys=clotY(theta)*lutilizado - k=xs-rutilizado*np.sin(theta) - p=ys-rutilizado*(1-np.cos(theta)) - t_val=k+(rutilizado+p)*np.tan(np.deg2rad(delta_val)/2) - phi=delta_val-2*np.rad2deg(theta) - self.txtTT.setText(roundFloat2str(t_val)) - self.txtp.setText(roundFloat2str(p)) - self.txtk.setText(roundFloat2str(k)) - self.txtPhi.setText(roundFloat2str(phi)) - self.lsminv.setText(roundFloat2str(.556*v)) - self.xs.setText(roundFloat2str(xs)) - self.ys.setText(roundFloat2str(ys)) - d_val=rutilizado*(delta_val-2*np.rad2deg(theta))*np.pi/180 - self.txtDls.setValue(roundFloat(np.deg2rad(phi)*rutilizado)) - self.groupBox_3.show() - self.groupBox_2.hide() - - else: - self.theta.setText(roundFloat2str(np.rad2deg(0))) - self.lsmax.setText(roundFloat2str(0)) - self.lsmin.setText(roundFloat2str(0)) - self.xs.setText(roundFloat2str(0)) - self.ys.setText(roundFloat2str(0)) - self.Ls.setValue(0) - self.groupBox_3.hide() - self.groupBox_2.show() - - self.param = { - 'g20': g20_val, - 't': t_val, - 'd': d_val, - } - self.txtI.setText("%f" % i) - self.txtI.setEnabled(False) - self.txtT.setText("%f" % t_val) - self.txtG20.setText("%f" % g20_val) - self.txtFMAX.setText(roundFloat2str(f_max)) - self.txtRMIN.setText("%f" % rmin(int(v), e_max, f_max)) - self.txtVelocidade.setValue(int(v)) - self.txtDelta.setText("%f" % delta_val) - - self.dados = { - 'file': self.model.id_filename, - 'tipo': self.comboElemento.currentIndex(), - 'curva': self.comboCurva.currentText(), - 'vel': self.txtVelocidade.value(), - 'emax': self.txtEMAX.value(), - 'ls': self.Ls.value(), - 'R': self.txtRUtilizado.value(), - 'fmax': float(self.txtFMAX.text()), - 'D': self.txtD.value() - } - self.nextIndex() - self.btnTable.setEnabled(self.editando) - self.eventos() - - def insert(self): - if not hasattr(self,"c"): - self.createLayer() - self.c.accepted.emit() - if self.curvaFailed: - self.curvaFailed=False - if hasattr(self,"c"): - self.c.rejected.emit() - return - - model = CurvasModel(self.id_filename) - if self.editando: - model.edit(self.dados) - else: - self.curva_id=model.new(self.dados) - self.editando=True - self.update() - - # noinspection PyMethodMayBeStatic - def tr(self, message): - """Get the translation for a string using Qt translation API. - - We implement this ourselves since we do not inherit QObject. - - :param message: String for translation. - :type message: str, QString - - :returns: Translated version of message. - :rtype: QString - """ - # noinspection PyTypeChecker,PyArgumentList,PyCallByClass - return QCoreApplication.translate('TopoGrafia', message) +from builtins import str +# -*- coding: utf-8 -*- +import os +import sip +from copy import deepcopy + +from qgis.core import QgsProject, QgsFields, QgsField, QgsPoint + +from ..view.estacas import ProgressDialog +from ..view.ui.ch import CurvasCompositorDialog, EMPTY_DATA +from ..model.utils import msgLog, PointTool, p2QgsPoint + +from ..model.helper.qgsgeometry import * + + +sip.setapi('QString', 2) + +from qgis.PyQt import QtGui, uic, Qt, QtWidgets + +import qgis + +import shutil +from ..model.config import extractZIP, Config, compactZIP +from qgis.PyQt.QtCore import QSettings +from qgis.PyQt.QtWidgets import QAbstractItemView, QDesktopWidget + +from qgis._core import QgsCoordinateReferenceSystem, QgsCoordinateTransform, QgsFeature + +from qgis._core import QgsRectangle +from qgis._core import QgsVectorFileWriter +from qgis._core import QgsVectorLayer +from qgis._core import Qgis + +from qgis.utils import * +from qgis.PyQt import QtWidgets + +from ..model.helper.calculos import * +from ..model.curvas import Curvas as CurvasModel + +FORMCURVA_CLASS, _ = uic.loadUiType(os.path.join(os.path.dirname(__file__), '../view/ui/Topo_dialog_curva.ui')) + +ID_ESTACA = 0 +ESTACA = 1 +DESCRICAO = 2 +PROGRESSIVA = 3 +NORTH = 4 +ESTE = 5 +COTA = 6 +AZIMUTE = 7 + + +class Curvas(QtWidgets.QDialog, FORMCURVA_CLASS): + def __init__(self,view, iface, id_filename, curvas, vertices, tipoClasseProjeto): + super(Curvas, self).__init__(None) + self.view=view + self.iface = iface + self.model = CurvasModel(id_filename) + self.estacas = self.model.list_estacas() + self.estacas_id = [row[0] for row in self.estacas] + + self.curvas = curvas + self.vertices=vertices + + self.tipo = tipoClasseProjeto[0] + self.classe = tipoClasseProjeto[1] + self.id_filename = id_filename + self.tipo_curva = 0 + self.estacaInicial = self.estacas[0] if self.estacas else 0 + self.estacaFinal = self.estacas[0] if self.estacas else 0 + self.setupUi(self) + + self.Dialog: QtWidgets.QDialog + self.btnAjuda: QtWidgets.QPushButton + self.btnApagar: QtWidgets.QPushButton + + self.btnCancela: QtWidgets.QPushButton + + + self.btnInsere: QtWidgets.QPushButton + + self.btnRelatorio: QtWidgets.QPushButton + self.comboCurva: QtWidgets.QComboBox + self.comboElemento: QtWidgets.QComboBox + + self.gDadosCurva: QtWidgets.QGroupBox + self.groupBox: QtWidgets.QGroupBox + self.groupBox_2: QtWidgets.QGroupBox + self.label: QtWidgets.QLabel + self.label_10: QtWidgets.QLabel + self.label_11: QtWidgets.QLabel + self.label_12: QtWidgets.QLabel + self.label_13: QtWidgets.QLabel + self.label_14: QtWidgets.QLabel + self.label_15: QtWidgets.QLabel + self.label_16: QtWidgets.QLabel + self.label_17: QtWidgets.QLabel + self.label_18: QtWidgets.QLabel + self.label_19: QtWidgets.QLabel + self.label_2: QtWidgets.QLabel + self.label_20: QtWidgets.QLabel + self.label_21: QtWidgets.QLabel + self.label_22: QtWidgets.QLabel + self.label_23: QtWidgets.QLabel + self.label_24: QtWidgets.QLabel + self.label_3: QtWidgets.QLabel + self.label_4: QtWidgets.QLabel + self.label_5: QtWidgets.QLabel + self.label_6: QtWidgets.QLabel + self.label_7: QtWidgets.QLabel + self.label_8: QtWidgets.QLabel + self.label_9: QtWidgets.QLabel + self.layoutWidget: QtWidgets.QWidget + self.layoutWidget: QtWidgets.QWidget + self.layoutWidget: QtWidgets.QWidget + self.layoutWidget: QtWidgets.QWidget + self.layoutWidget: QtWidgets.QWidget + self.layoutWidget: QtWidgets.QWidget + self.txtD: QtWidgets.QLineEdit + self.txtDelta: QtWidgets.QLineEdit + + self.txtEMAX: QtWidgets.QDoubleSpinBox + + self.btnAjuda.hide() + + self.txtFMAX: QtWidgets.QTextEdit + self.txtG20: QtWidgets.QLineEdit + self.txtI: QtWidgets.QLineEdit + + + + self.txtRMIN: QtWidgets.QLineEdit + self.txtRUtilizado: QtWidgets.QDoubleSpinBox + self.txtT: QtWidgets.QLineEdit + self.txtVelocidade: QtWidgets.QSpinBox + self.deflexao: QtWidgets.QLineEdit + + self.shortcut1 = QtWidgets.QShortcut(QtGui.QKeySequence.MoveToNextChar, self) + self.shortcut2 = QtWidgets.QShortcut(QtGui.QKeySequence.MoveToPreviousChar, self) + self.whatsThisAction=QtWidgets.QWhatsThis.createAction(self) + self.btnAjuda.clicked.connect(self.whatsThisAction.trigger) + + self.buttons=[self.btnAjuda, self.btnApagar, self.btnCancela, + self.btnInsere, self.btnRelatorio] + + self.dados = { + 'file': self.model.id_filename, + 'tipo': self.comboElemento.currentIndex(), + 'curva': self.comboCurva.currentText(), + 'vel': self.txtVelocidade.value(), + 'emax': self.txtEMAX.value(), + 'ls': self.Ls.value(), + 'R': self.txtRUtilizado.value(), + 'fmax': 0 if self.txtFMAX.text()=="" else float(self.txtFMAX.text()), + 'D': self.txtD.value() + } + + + self.curvas = [self.tr(str(curva[0])) for curva in self.curvas] + self.fill_comboCurva() + self.curvaFailed=False + self.editando = False + self.dChanged=False + + self.eventos() + self.update() + self.location_on_the_screen() + + self.txtI.hide() + self.label_11.hide() + self.progressDialog=ProgressDialog(iface) + + self.nextCurva() + self.previousCurva() + self.mudancaCurva(0) + + def hideEvent(self, event: QtGui.QHideEvent): + if not event.spontaneous(): + event.ignore() + else: + super(Curvas, self).hideEvent(event) + + + def createLayer(self): + if hasattr(self,"c"): + self.c.rejected.emit() + self.c = CurvasCompositorDialog(self) + self.c.accepted.connect(self.saveCurva) + self.c.rejected.connect(self.resetCurva) + self.c.edited.connect(self.drawCurva) + + def location_on_the_screen(self): + screen = QDesktopWidget().screenGeometry() + widget = self.geometry() + x = 0#widget.width() + y = (screen.height()-widget.height())/2 + self.move(x, y) + + def fill_comboCurva(self): + self.comboCurva.clear() + self.PIs=[] + self.layer=self.view.curvaLayers[0] + items=[] + i=0 + for c, vert in enumerate(self.vertices): + digits=int("".join([s for s in vert[0] if s.isdigit()])) + if digits>i-1: + items.append("PI"+str(i)) + self.PIs.append(vert[1]) + i+=1 + items=items[1:-1] + self.comboCurva.addItems(items) + if not wasInitialized(self.layer): + tangentFeaturesFromPointList(self.layer,self.PIs) + refreshCanvas(self.iface, self.layer) + + + def update(self): + self.calcularCurva() + if hasattr(self, "c"): + self.c.rejected.emit() + + def eventos(self): + self.comboCurva.currentIndexChanged.connect(self.mudancaCurva) + self.comboElemento.currentIndexChanged.connect(self.mudancaTipo) + self.btnInsere.clicked.connect(self.insert) + self.btnApagar.clicked.connect(self.apagar) + self.btnRelatorio.clicked.connect(self.draw) + self.btnCancela.clicked.connect(self.mudancaCurva) + self.generateAll.clicked.connect(self.genAll) + self.btnErase.clicked.connect(self.eraseAll) + self.txtD.valueChanged.connect(self.changeD) + self.txtDls.valueChanged.connect(self.changeD) + [w.valueChanged.connect(lambda: self.calcularCurva(False)) + for w in [self.txtVelocidade, self.txtRUtilizado, self.txtEMAX, self.Ls, self.txtD, self.txtDls]] + self.shortcut1.activated.connect(self.nextCurva) + self.shortcut2.activated.connect(self.previousCurva) + + def changeD(self): + self.dChanged=True + + def uneventos(self): + self.comboCurva.currentIndexChanged.disconnect() + self.comboElemento.currentIndexChanged.disconnect() + self.btnInsere.clicked.disconnect() + self.btnApagar.clicked.disconnect() + self.btnRelatorio.clicked.disconnect() + self.btnCancela.clicked.disconnect() + self.generateAll.clicked.disconnect() + self.btnErase.clicked.disconnect() + [w.valueChanged.disconnect() + for w in [self.txtVelocidade, self.txtRUtilizado, self.txtEMAX, self.Ls, self.txtD, self.txtDls]] + self.shortcut1.activated.disconnect() + self.shortcut2.activated.disconnect() + + def eraseAll(self): + self.progressDialog.show() + self.progressDialog.setLoop(100,self.comboCurva.count()) + self.comboCurva.setCurrentIndex(0) + while self.next.isEnabled(): + self.progressDialog.increment() + try: + self.apagar() + except: + pass + self.nextCurva() + + try: + self.apagar() + except: + pass + self.progressDialog.close() + self.progressDialog.setValue(0) + + def genAll(self): + self.progressDialog.show() + self.progressDialog.setLoop(100,self.comboCurva.count()) + self.comboCurva.setCurrentIndex(0) + while self.next.isEnabled(): + self.progressDialog.increment() + try: + self.insert() + except: + pass + self.nextCurva() + + try: + self.insert() + except: + pass + self.progressDialog.close() + self.progressDialog.setValue(0) + + def apagar(self): + if self.curva_id: + self.model.delete_curva(self.curva_id, self.dados) + self.update() + features=[] + PI=0 + for i,feat in enumerate(self.layer.getFeatures()): + if i>self.current_index and i 0): + ultima = self.curvas[-1][0] + else: + ultima = -1 + self.curvas.append(["%d" % (ultima + 1,)]) + #self.comboCurva.addItems([self.tr("%d" % (ultima + 1,))]) + self.calcularCurva(new=True) + + def exec_(self): + self.comboCurva: QtWidgets.QComboBox + if self.comboCurva.count()>1: + self.comboCurva.setCurrentIndex(0) + if self.view.empty and not featureCount(self.layer): + PT=PointTool(self.iface, self.pointLayerDefine) + PT.start() + self.setNoLayer() + else: + return super(Curvas, self).exec_() + + def pointLayerDefine(self, point): + point=QgsPointXY(point) + tangentFeaturesFromPointList(self.layer,[p2QgsPoint(point), p2QgsPoint(point.x(),point.y()+.001)]) + refreshCanvas(self.iface, self.layer) + self.comboCurva.addItem("PI"+str(0)) + self.enableInterface() + self.justStarted=True + return super(Curvas, self).exec_() + + def setNoLayer(self): + self.oldTitle=self.windowTitle() + self.setWindowTitle(u"Escolha o ponto de partida no mapa!!!") + for btn in self.buttons: + btn:QtWidgets.QPushButton + btn.setDisabled(True) + + def enableInterface(self): + self.setWindowTitle(self.oldTitle) + for btn in self.buttons: + btn:QtWidgets.QPushButton + btn.setDisabled(False) + + def drawCurva(self): + if not hasattr(self.c, "dados"): + self.c.dados=[] + self.comboCurva: QtWidgets.QComboBox + layer = QgsVectorLayer('LineString?crs=%s'%(QgsProject.instance().crs().authid()), "Curva: " + str(self.comboCurva.currentText()) , "memory") + layer.setCrs(QgsCoordinateReferenceSystem(QgsProject.instance().crs())) + layer.renderer().symbol().setWidth(.5) + layer.renderer().symbol().setColor(QtGui.QColor("#0f16d0")) + layer.triggerRepaint() + fields=layerFields() + layer.dataProvider().addAttributes(fields) + layer.updateFields() + QgsProject.instance().addMapLayer(layer, False) + QgsProject.instance().layerTreeRoot().insertLayer(0, layer) + self.c.layer=layer + + layer=self.c.layer + layer.dataProvider().deleteFeatures([f.id() for f in layer.getFeatures()]) + + vmax=0 + k=0 + i=-1 + data=None + + try: + if hasattr(self,"justStarted") and self.justStarted: + for tipo, index, state in self.c.readData(): + i+=1 + if tipo=="C": + data=circleArc2(layer, state, index, self.layer, self.next_index) + k=0 + vmax="120 km/h" + + elif tipo=="EC": + data = polyTransCircle(layer, state, index, self.layer, self.next_index, self.current_index) + k = 0 + vmax = "120 km/h" + + elif tipo=="EE": + data=inSpiral2(layer, state, index, self.layer, self.next_index) + k=0 + vmax="120 km/h" + + elif tipo=="ES": + data=outSpiral2(layer, state, index, self.layer, self.next_index) + k=0 + vmax="120 km/h" + + elif tipo=="T": + data=tangent2(layer, state, index, self.layer, self.next_index) + k=0 + vmax="120 km/h" + else: + continue + + if len(self.c.dados)-1=self.comboCurva.count()-1: + self.next.setEnabled(False) + self.comboCurva.setCurrentIndex(self.comboCurva.count()-1) + elif i0: + self.comboCurva.setCurrentIndex(i) + self.prev.setEnabled(True) + self.next.setEnabled(True) + + def saveCurva(self): + self.layer: QgsVectorLayer + self.comboCurva : QtWidgets.QComboBox + self.draw() + if self.curvaFailed: + return + + curvaFeats=featuresList(self.c.layer) + features = [] + if hasattr(self, "justStarted") and self.justStarted: + i=0 + for f, tipo in zip(curvaFeats, self.c.dados): + feat=QgsFeature(self.layer.fields()) + feat.setGeometry(f.geometry()) + feat.setAttributes([i,str(tipo[0]), "Traçado"]) + features.append(feat) + i+=1 + self.justStarted=False + + elif len(curvaFeats)>0: + fid=1 + nomes=[] + #Delete all features of self.layer and add layer geometry in between + for i,feat in enumerate(self.layer.getFeatures()): + if i>self.current_index and i0: + self.groupBox_3.show() + else: + self.groupBox_3.hide() + + self.calcularCurva(True) + + + def mudancaEstacaInicial(self, pos): + + self.estacaInicial = self.estacas[pos] + + self.calcularCurva() + + def mudancaEstacaFinal(self, pos): + self.calcularCurva() + + def desabilitarControles(self): + #self.habilitarControles(False) + pass + + def habilitarControles(self, signal): + + if type(signal) != type(True): + return False + + self.comboCurva.setEnabled(not (signal)) + + + self.btnApagar.setEnabled(not (signal)) + self.btnRelatorio.setEnabled(not (signal)) + self.btnInsere.setEnabled(signal) + self.comboElemento.setEnabled(not signal) + + + self.txtVelocidade.setEnabled(signal) + self.txtEMAX.setEnabled(signal) + self.txtRUtilizado.setEnabled(signal) + self.btnRelatorio.setEnabled(signal) + self.btnCancela.setEnabled(signal) + self.txtFMAX.setEnabled(signal) + self.prev.setEnabled(not signal) + self.next.setEnabled(not signal) + + if self.comboElemento.currentIndex()>0: + self.Ls.setEnabled(signal) + + return True + + def currentIndex(self): + i=self.comboCurva.currentIndex() + f=0 + n=0 + for feat1, feat2 in zip(featuresList(self.layer), featuresList(self.layer)[1:]): + if n == i: + self.current_index = max(f, 0) + return max(f, 0) + if getTipo(feat2)=="T": + n+=1 + f+=1 + self.current_index= max(f-1, 0) + return max(f-1, 0) + + def nextIndex(self): + i=self.currentIndex()+1 + fl = featuresList(self.layer) + feat = fl[i] + while getTipo(feat) != "T": + i += 1 + feat = fl[i] + self.next_index=i + return i + + def calcularCurva(self, new=False): + self.nextIndex() + try: + self.uneventos() + except: + pass + # i = calculeI(float(self.estacaInicial[PROGRESSIVA]), float(self.estacaFinal[PROGRESSIVA]), + # float(self.estacaInicial[COTA]), float(self.estacaFinal[COTA])) + i=0 + v = Config.instance().velproj if new else self.txtVelocidade.value() + #velocidade(float(i), self.classe, self.tipo) + e_max = Config.instance().emax if new else float(self.txtEMAX.value()) + f_max = fmax(int(v))# if new else 0 if self.txtFMAX.text()=="" else float(self.txtFMAX.text()) + + delta_val = delta(float(azi(featureToPolyline(featuresList(self.layer)[self.current_index]))), + float(azi(featureToPolyline(featuresList(self.layer)[self.next_index])))) + + if new: + rutilizado=rmin(int(v), e_max, f_max) + if self.comboElemento.currentIndex() == 0: + d_val = d_curva_simples(rutilizado, delta_val) + dist=Config.instance().DIST + d_val=d_val+dist-d_val%dist + rutilizado = r_curva_simples(d_val, delta_val) + lutilizado=0 + else: + d_val = d_curva_simples(rutilizado, delta_val) + dist=Config.instance().DIST + d_val=d_val+dist-d_val%dist + rutilizado = r_curva_simples(d_val, delta_val) + lutilizado = l_utilizado(rutilizado,v,delta_val) + lutilizado = lutilizado + dist - lutilizado % dist + + self.txtRUtilizado.setValue(rutilizado) + self.txtVelocidade.setValue(v) + self.txtEMAX.setValue(e_max) + self.Ls.setValue(lutilizado) + self.txtD.setValue(roundFloat(d_val)) + else: + lutilizado = float(self.Ls.value()) + if not self.dChanged: + rutilizado = float(self.txtRUtilizado.value()) + d_val = d_curva_simples(rutilizado, delta_val) + self.txtD.setValue(roundFloat(d_val)) + else: + if self.comboElemento.currentIndex() == 0: + d_val=self.txtD.value() + rutilizado=r_curva_simples(d_val, delta_val) + else: + dls=self.txtDls.value() + rutilizado=(lutilizado+dls)/np.deg2rad(delta_val) + self.txtRUtilizado.setValue(rutilizado) + self.dChanged=False + + g20_val = g20(rutilizado) + t_val = t(rutilizado, delta_val) + + if self.comboElemento.currentIndex() > 0: + # d_val, theta, lsmin, lsmax, sc, cs + lsmin=max(0.036*v**3/rutilizado, 0.556*v) + lsmax=rutilizado*delta_val*np.pi/180 + theta=lutilizado/(2*rutilizado) + self.theta.setText(roundFloat2str(np.rad2deg(theta))) + self.lsmax.setText(roundFloat2str(lsmax)) + self.lsmin.setText(roundFloat2str(0.036*v**3/rutilizado)) + self.txtD.setEnabled(True) + + #d_val=self.txtD.value() + xs=clotX(theta)*lutilizado + ys=clotY(theta)*lutilizado + k=xs-rutilizado*np.sin(theta) + p=ys-rutilizado*(1-np.cos(theta)) + t_val=k+(rutilizado+p)*np.tan(np.deg2rad(delta_val)/2) + phi=delta_val-2*np.rad2deg(theta) + self.txtTT.setText(roundFloat2str(t_val)) + self.txtp.setText(roundFloat2str(p)) + self.txtk.setText(roundFloat2str(k)) + self.txtPhi.setText(roundFloat2str(phi)) + self.lsminv.setText(roundFloat2str(.556*v)) + self.xs.setText(roundFloat2str(xs)) + self.ys.setText(roundFloat2str(ys)) + d_val=rutilizado*(delta_val-2*np.rad2deg(theta))*np.pi/180 + self.txtDls.setValue(roundFloat(np.deg2rad(phi)*rutilizado)) + self.groupBox_3.show() + self.groupBox_2.hide() + + else: + self.theta.setText(roundFloat2str(np.rad2deg(0))) + self.lsmax.setText(roundFloat2str(0)) + self.lsmin.setText(roundFloat2str(0)) + self.xs.setText(roundFloat2str(0)) + self.ys.setText(roundFloat2str(0)) + self.Ls.setValue(0) + self.groupBox_3.hide() + self.groupBox_2.show() + + self.param = { + 'g20': g20_val, + 't': t_val, + 'd': d_val, + } + self.txtI.setText("%f" % i) + self.txtI.setEnabled(False) + self.txtT.setText("%f" % t_val) + self.txtG20.setText("%f" % g20_val) + self.txtFMAX.setText(roundFloat2str(f_max)) + self.txtRMIN.setText("%f" % rmin(int(v), e_max, f_max)) + self.txtVelocidade.setValue(int(v)) + self.txtDelta.setText("%f" % delta_val) + + self.dados = { + 'file': self.model.id_filename, + 'tipo': self.comboElemento.currentIndex(), + 'curva': self.comboCurva.currentText(), + 'vel': self.txtVelocidade.value(), + 'emax': self.txtEMAX.value(), + 'ls': self.Ls.value(), + 'R': self.txtRUtilizado.value(), + 'fmax': float(self.txtFMAX.text()), + 'D': self.txtD.value() + } + self.nextIndex() + self.btnTable.setEnabled(self.editando) + self.eventos() + + def insert(self): + if not hasattr(self,"c"): + self.createLayer() + self.c.accepted.emit() + if self.curvaFailed: + self.curvaFailed=False + if hasattr(self,"c"): + self.c.rejected.emit() + return + + model = CurvasModel(self.id_filename) + if self.editando: + model.edit(self.dados) + else: + self.curva_id=model.new(self.dados) + self.editando=True + self.update() + + # noinspection PyMethodMayBeStatic + def tr(self, message): + """Get the translation for a string using Qt translation API. + + We implement this ourselves since we do not inherit QObject. + + :param message: String for translation. + :type message: str, QString + + :returns: Translated version of message. + :rtype: QString + """ + # noinspection PyTypeChecker,PyArgumentList,PyCallByClass + return QCoreApplication.translate('TopoGrafia', message) diff --git a/app/view/estacas.py b/app/view/estacas.py old mode 100644 new mode 100755 index e919900..9c59271 --- a/app/view/estacas.py +++ b/app/view/estacas.py @@ -1,2538 +1,2538 @@ -from __future__ import print_function - -import sip -from builtins import range - -import numpy as np -from PyQt5.QtCore import Qt -from qgis.PyQt import QtWidgets, QtGui -from qgis.PyQt import uic -from qgis.PyQt.QtCore import pyqtSignal, QVariant -from qgis.PyQt.QtGui import QKeySequence -from qgis.PyQt.QtWidgets import * -import qgis._core -from qgis._core import QgsCoordinateReferenceSystem -from qgis.core import QgsRectangle, QgsGeometry, QgsVectorLayer, QgsPoint, QgsFeature -from qgis.gui import * -from qgis.utils import * -from qgis.core import QgsProject, QgsCoordinateTransform, QgsPointXY, QgsVectorFileWriter, QgsWkbTypes, QgsField, QgsFields, QgsCoordinateTransformContext - -from ..model.config import Config -from ..model.utils import formatValue, msgLog, prog2estacaStr, p2QgsPoint, fastProg2EstacaStr - - -# -*- coding: utf-8 -*- -sip.setapi('QString',2) -sip.setapi('QVariant',2) - -try: - _fromUtf8 = QtCore.QString.fromUtf8 -except AttributeError: - def _fromUtf8(s): - return s - -try: - _encoding = QtWidgets.QApplication.UnicodeUTF8 - def _translate(context, text, disambig): - return QtWidgets.QApplication.translate(context.encode('utf8'), text.encode('utf8'), disambig, _encoding) -except AttributeError: - def _translate(context, text, disambig): - return QtWidgets.QApplication.translate(context.encode('utf8'), text.encode('utf8'), disambig) - -FORMESTACA1_CLASS, _ = uic.loadUiType(os.path.join( - os.path.dirname(__file__), '../view/ui/Topo_dialog_estacas1.ui')) -FORMGERATRACADO_CLASS, _ = uic.loadUiType(os.path.join( - os.path.dirname(__file__), '../view/ui/Topo_dialog_gera_tracado_1.ui')) -APLICAR_TRANSVERSAL_DIALOG, _ = uic.loadUiType(os.path.join( - os.path.dirname(__file__), '../view/ui/applyTransDiag.ui')) -SETCTATI_DIALOG, _ = uic.loadUiType(os.path.join( - os.path.dirname(__file__), '../view/ui/setTransPtsIndexes.ui')) -VERTICE_EDIT_DIALOG, _ = uic.loadUiType(os.path.join( - os.path.dirname(__file__), '../view/ui/Topo_dialog-cv.ui')) -SET_ESCALA_DIALOG, _ = uic.loadUiType(os.path.join( - os.path.dirname(__file__), '../view/ui/setEscala.ui')) -SELECT_FEATURE, _ = uic.loadUiType(os.path.join( - os.path.dirname(__file__), '../view/ui/selectFeature.ui')) -ESTACAS_DIALOG, _ = uic.loadUiType(os.path.join( - os.path.dirname(__file__), '../view/ui/Topo_dialog_estacas.ui')) -PROGRESS_DIALOG, _ = uic.loadUiType(os.path.join( - os.path.dirname(__file__), '../view/ui/progressBarDialog.ui')) -BRUCKNER_SELECT, _ = uic.loadUiType(os.path.join( - os.path.dirname(__file__), '../view/ui/bruckner_select.ui')) -VOLUME_DIALOG, _ = uic.loadUiType(os.path.join( - os.path.dirname(__file__), '../view/ui/volume.ui')) -EXPORTAR_CORTE,_ = uic.loadUiType(os.path.join( - os.path.dirname(__file__), '../view/ui/cortePreview.ui')) - -rb = QgsRubberBand(iface.mapCanvas(), 1) -premuto = False -point0 = iface.mapCanvas().getCoordinateTransform().toMapCoordinates(0, 0) - - -class PointTool(QgsMapTool): - def __init__(self, canvas, ref, method): - - QgsMapTool.__init__(self, canvas) - self.canvas = canvas - self.estacasUI = ref - self.method = method - self.callback = eval('self.estacasUI.%s'%self.method) - - - - def canvasPressEvent(self, event): - x = event.pos().x() - y = event.pos().y() - self.callback(self.canvas.getCoordinateTransform().toMapCoordinates(x, y)) - - -class CopySelectedCellsAction(QtWidgets.QAction): - def __init__(self, iface, table_widget): - if not isinstance(table_widget, QtWidgets.QTableWidget): - raise ValueError(str('CopySelectedCellsAction must be initialised with a QTableWidget. A %s was given.' % type(table_widget))) - super(CopySelectedCellsAction, self).__init__("Copy", table_widget) - self.setShortcut('Ctrl+C') - s=QShortcut(QKeySequence("Ctrl+C"), iface) - s.activated.connect(self.copy_cells_to_clipboard) - self.triggered.connect(self.copy_cells_to_clipboard) - self.table_widget = table_widget - - def copy_cells_to_clipboard(self): - if len(self.table_widget.selectionModel().selectedIndexes()) > 0: - columnIndex=list(set(index.column() for index in self.table_widget.selectionModel().selectedIndexes())) - rowIndex=list(set(index.row() for index in self.table_widget.selectionModel().selectedIndexes())) - columnIndex.sort() - rowIndex.sort() - nSelectedColumns=len(columnIndex) - nSelectedRows=len(rowIndex) - matx=[[None for a in range(max(columnIndex[-1]-columnIndex[0]+1,nSelectedColumns))] for a in range(max(1+rowIndex[-1]-rowIndex[0],nSelectedRows))] - start=[rowIndex[0],columnIndex[0]] - - for index in self.table_widget.selectionModel().selectedIndexes(): - i=index.row()-start[0] - j=index.column()-start[1] - matx[i][j]=index.data() - - - import numpy as np - final=np.array(matx).transpose() - matx=[] - for col in final: - if any(x is not None for x in col): - matx.append(col) - final=np.array(matx).transpose() - clipboard="" - for row in final: - if not any(x is not None for x in row): - continue - for column in row: - clipboard += str(column if column else "")+'\t' - clipboard += '\n' - - clipboard=clipboard.replace(".", ",") - # copy to the system clipboard - sys_clip = QtWidgets.QApplication.clipboard() - sys_clip.setText(clipboard) - -class reversedSpinBox(QtWidgets.QSpinBox): - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - self.lineEdit().setReadOnly(True) - - def stepBy(self, steps: int): - super().stepBy(-steps) - -class Dialog(QtWidgets.QDialog): - def __init__(self): - QtWidgets.QWidget.__init__(self) - button = QtWidgets.QPushButton('Open Dialog', self) - button.clicked.connect(self.handleOpenDialog) - self.resize(300, 200) - self._dialog = None - - def handleOpenDialog(self): - if self._dialog is None: - self._dialog = QtWidgets.QDialog(self) - self._dialog.resize(200, 100) - self._dialog.show() - - -class GeraTracadoUI(QtWidgets.QDialog,FORMGERATRACADO_CLASS): - def __init__(self, iface): - super(GeraTracadoUI, self).__init__(None) - self.iface = iface - self.setupUi(self) - -class EstacasUI(QtWidgets.QDialog,FORMESTACA1_CLASS): - deleted=QtCore.pyqtSignal() - - def __init__(self, iface): - super(EstacasUI, self).__init__(None) - self.iface = iface - self.setupUi(self) - self.setupUi2(self) - self.points = [] - self.crs = 1 - self.edit = False - self.dialog = QtWidgets.QDialog(None) - self.actual_point = None - self.btnGerarCurvas.hide() - - - def curvasDialog(self, estacas, layer): - coordenadas=[[float(x),float(y)] for y,x in zip([e[3] for e in estacas],[e[4] for e in estacas])].copy() - - - #return estaca,descricao,progressiva,norte,este,cota,azimute - - - def keyPressEvent(self, a0: QtGui.QKeyEvent): - if a0.key() == QtCore.Qt.Key_Delete: - self.deleted.emit() - super(EstacasUI, self).keyPressEvent(a0) - - - def error(self, msg): - msgBox = QtWidgets.QMessageBox(QtWidgets.QMessageBox.Warning, "AVISO", - u"%s" % msg, - QtWidgets.QMessageBox.NoButton, None) - msgBox.addButton("OK", QtWidgets.QMessageBox.AcceptRole) - msgBox.exec_() - - def openCSV(self): - filename = QtWidgets.QFileDialog.getOpenFileName(filter="Arquivo CSV (*.csv)") - if filename in ["", None]: return None - fileDB, ok = QtWidgets.QInputDialog.getText(None, "Nome do arquivo", u"Nome do arquivo a ser salvo no projeto:", text="Traçado csv") - if not ok: - return None - return filename, fileDB - - def new(self,recalcular=False,layerName=None,filename=None, lastIndex=0, ask=True): - mapCanvas = self.iface.mapCanvas() - itens = [] - for i in range(mapCanvas.layerCount() - 1, -1, -1): - try: - layer = mapCanvas.layer(i) - name = layer.name() - itens.append(name) - except: - pass - - if len(itens) == 0: - from ..model.utils import messageDialog - messageDialog(message="Nenhuma layer visível foi encontrada no projeto, por favor adicione alguma.") - return None - - if not filename: - if not recalcular: - filename="" - names=[self.tableEstacas.item(i,1).text() for i in range(self.tableEstacas.rowCount())] - first=True - nomeSugerido="Traçado "+str(lastIndex) - c=0 - while nomeSugerido in names and c<3: - c+=1 - nomeSugerido+="_" - while filename=="" or filename in names: - if not first: - from ..model.utils import messageDialog - messageDialog(self,title="Erro",message="Já existe um arquivo com esse nome") - - filename, ok = QtWidgets.QInputDialog.getText(None, "Nome do arquivo", u"Nome do arquivo:", text=nomeSugerido) - if not ok: - return None - - first=False - else: - filename = '' - - if layerName is not None: - layerList = QgsProject .instance().mapLayersByName(layerName) - layer = None - if layerList: - layer = layerList[-1] - else: - itens = [] - for i in range(mapCanvas.layerCount() - 1, -1, -1): - try: - layer = mapCanvas.layer(i) - layerName = layer.name() - if type(layer) == qgis._core.QgsVectorLayer: - itens.append(layerName) - except: - pass - item, ok = QtWidgets.QInputDialog.getItem(None, "Camada com tracado", u"Selecione a camada com o traçado:", - reversed(itens), - 0, False) - if not(ok) or not(item): - return None - else: - layerList = QgsProject .instance().mapLayersByName(item) - layer = None - if layerList: - layer = layerList[0] - if ask: - dist, ok = QtWidgets.QInputDialog.getDouble(None, "Distancia", u"Distancia entre estacas:", Config.instance().DIST, 1, - 10000, 2) - else: - ok=True - dist=Config.instance().DIST - if not ok or dist<=0: - return None - - if ask: - estaca, ok = QtWidgets.QInputDialog.getInt(None, "Estaca Inicial", u"Estaca Inicial:", 0, 0, 10000000, 2) - else: - ok=True - estaca=0 - if not ok: - return None - return filename, layer, dist, estaca - - def fill_table_index(self, files): - self.tableEstacas : QtWidgets.QTableWidget - self.tableEstacas.setRowCount(0) - self.tableEstacas.clearContents() - for i,f in enumerate(files): - self.tableEstacas.insertRow(self.tableEstacas.rowCount()) - for j,f2 in enumerate(f): - tableItem=QtWidgets.QTableWidgetItem(u"%s" % f2) - tableItem.setFlags(tableItem.flags() ^ Qt.ItemIsEditable) - self.tableEstacas.setItem(i,j,tableItem) - self.tableEstacas.cellDoubleClicked.connect(self.accept) - - - def create_line(self,p1,p2,name): - layer = QgsVectorLayer('LineString?crs=%s'%int(self.crs), name, "memory") - mycrs = QgsCoordinateReferenceSystem(int(self.crs), 0) - self.reprojectgeographic = QgsCoordinateTransform(self.iface.mapCanvas().mapSettings().destinationCrs(), mycrs, QgsCoordinateTransformContext()) - pr = layer.dataProvider() - line = QgsFeature() - line.setGeometry(QgsGeometry.fromPolyline([p2QgsPoint(self.reprojectgeographic.transform(point=QgsPointXY(p1))), p2QgsPoint(self.reprojectgeographic.transform(point=QgsPointXY(p2)))])) - pr.addFeatures([line]) - #layer.setCrs(QgsCoordinateReferenceSystem(int(self.crs), 0)) - layer.updateExtents() - - QgsProject.instance().addMapLayer(layer) - - return p1, p2 - - def create_point(self,p1,name): - layer = QgsVectorLayer('Point?crs=%s'%int(self.crs), name, "memory") - mycrs = QgsCoordinateReferenceSystem(int(self.crs), 0) - self.reprojectgeographic = QgsCoordinateTransform(self.iface.mapCanvas().mapSettings().destinationCrs(), mycrs, QgsCoordinateTransformContext()) - pr = layer.dataProvider() - point = QgsFeature() - point.setGeometry(QgsGeometry.fromPoint(p2QgsPoint(self.reprojectgeographic.transform(point=QgsPointXY(p1))))) - pr.addFeatures([point]) - #layer.setCrs(QgsCoordinateReferenceSystem(int(self.crs), 0)) - layer.updateExtents() - - QgsProject.instance().addMapLayer(layer) - - return p1 - - def drawShapeFileAndLoad(self, crs): - #Creates a shapefile on the given path and triggers the digitizing menu QActions - #For editing and saving the LineString - #This relies on the QActions order on the menu - - fields = QgsFields() - fields.append(QgsField("Tipo", QVariant.String)) - fields.append(QgsField("Descricao", QVariant.String)) - dialog = QtWidgets.QFileDialog() - dialog.setWindowTitle("Caminho para criar arquivo shapefile") - dialog.setDefaultSuffix("shp") - path = QtWidgets.QFileDialog.getSaveFileName(filter="Shapefiles (*.shp)")[0] - - if not path: - return None - - writer = QgsVectorFileWriter(path, 'UTF-8', fields, QgsWkbTypes.MultiLineString, - QgsCoordinateReferenceSystem('EPSG:' + str(crs)), 'ESRI Shapefile') - del writer - self.iface.addVectorLayer(path,"","ogr") - - self.iface.digitizeToolBar().show() - addLineAction = self.iface.digitizeToolBar().actions()[8] - toggleEditAction = self.iface.digitizeToolBar().actions()[1] - if not addLineAction.isChecked(): - toggleEditAction.trigger() - addLineAction.setChecked(True) - addLineAction.trigger() - - - def get_click_coordenate(self,point, mouse): - self.actual_point=p2QgsPoint(point) - if self.tracado_dlg.txtNorthStart.text().strip()=='': - self.tracado_dlg.txtNorthStart.setText("%f"%self.actual_point.y()) - self.tracado_dlg.txtEsteStart.setText("%f"%self.actual_point.x()) - elif self.tracado_dlg.txtNorthEnd.text().strip()=='': - self.tracado_dlg.txtNorthEnd.setText("%f"%self.actual_point.y()) - self.tracado_dlg.txtEsteEnd.setText("%f"%self.actual_point.x()) - - def gera_tracado_pontos(self,inicial=False,final=False,callback_inst=None,callback_method=None,crs=None): - if (not (inicial) and not (final)): - self.callback = eval('callback_inst.%s' % callback_method) - self.crs = crs - self.tracado_dlg_inicial = GeraTracadoUI(self.iface) - self.tracado_dlg_inicial.lblName.setText("Ponto Inicial") - self.tracado_dlg_inicial.btnCapture.clicked.connect(self.capture_point_inicial) - self.tracado_dlg_final = GeraTracadoUI(self.iface) - self.tracado_dlg_final.lblName.setText("Ponto Final") - self.tracado_dlg_final.btnCapture.clicked.connect(self.capture_point_final) - if (not (inicial) and not (final)) or not (final): - ok = self.tracado_dlg_inicial.exec_() - if not (ok): - return None - else: - pn = float(self.tracado_dlg_inicial.txtNorth.text().strip().replace(",", ".")) - pe = float(self.tracado_dlg_inicial.txtEste.text().strip().replace(",", ".")) - self.gera_tracado_ponto_inicial(p2QgsPoint(pe, pn)) - - if (not (inicial) and not (final)) or not (inicial): - ok = self.tracado_dlg_final.exec_() - if not (ok): - return None - else: - pn = float(self.tracado_dlg_final.txtNorth.text().strip().replace(",", ".")) - pe = float(self.tracado_dlg_final.txtEste.text().strip().replace(",", ".")) - self.gera_tracado_ponto_final(p2QgsPoint(pe, pn)) - - if inicial and final: - p1n = float(self.tracado_dlg_inicial.txtNorth.text().strip().replace(",", ".")) - p1e = float(self.tracado_dlg_inicial.txtEste.text().strip().replace(",", ".")) - p2n = float(self.tracado_dlg_final.txtNorth.text().strip().replace(",", ".")) - p2e = float(self.tracado_dlg_final.txtEste.text().strip().replace(",", ".")) - self.iface.mapCanvas().setMapTool(None) - self.callback(pontos=self.create_line(p2QgsPoint(p1e, p1n), p2QgsPoint(p2e, p2n), "Diretriz"), parte=1) - - - - def gera_tracado_ponto_inicial(self,point): - self.tracado_dlg_inicial.txtNorth.setText("%f"%point.y()) - self.tracado_dlg_inicial.txtEste.setText("%f"%point.x()) - ok = self.tracado_dlg_inicial.exec_() - if not(ok): - return None - else: - pn = float(self.tracado_dlg_inicial.txtNorth.text().strip().replace(",",".")) - pe = float(self.tracado_dlg_inicial.txtEste.text().strip().replace(",",".")) - self.gera_tracado_ponto_final(p2QgsPoint(pe, pn)) - - #self.gera_tracado_pontos(inicial=True) - self.gera_tracado_pontos(final=True) - - def gera_tracado_ponto_final(self,point): - self.tracado_dlg_final.txtNorth.setText("%f"%point.y()) - self.tracado_dlg_final.txtEste.setText("%f"%point.x()) - ok = self.tracado_dlg_final.exec_() - if not(ok): - return None - else: - pn = float(self.tracado_dlg_final.txtNorth.text().strip().replace(",",".")) - pe = float(self.tracado_dlg_final.txtEste.text().strip().replace(",",".")) - #self.gera_tracado_ponto_final(p2QgsPoint(pe, pn)) - - #self.gera_tracado_pontos(final=True) - self.gera_tracado_pontos(inicial=True,final=True) - - def capture_point_inicial(self): - tool = PointTool(self.iface.mapCanvas(),self,'gera_tracado_ponto_inicial') - self.iface.mapCanvas().setMapTool(tool) - - def capture_point_final(self): - tool = PointTool(self.iface.mapCanvas(),self,'gera_tracado_ponto_final') - self.iface.mapCanvas().setMapTool(tool) - - - def exit_dialog(self, points, crs): - self.dialog.close() - - layer = QgsVectorLayer('LineString', self.name_tracado, "memory") - pr = layer.dataProvider() - # fix_print_with_import - print(points) - anterior = p2QgsPoint(points[0]) - fets=[] - for p in points[1:]: - fet = QgsFeature(layer.fields()) - fet.setGeometry(QgsGeometry.fromPolyline([anterior, p2QgsPoint(p)])) - fets.append(fet) - anterior = p2QgsPoint(p) - pr.addFeatures(fets) - self.crs = crs - layer.setCrs(QgsCoordinateReferenceSystem(int(crs), 0)) - layer.updateExtents() - - QgsProject.instance().addMapLayer(layer) - - def gera_tracado_vertices(self,pointerEmitter): - self.iface.mapCanvas().setMapTool(pointerEmitter) - self.name_tracado = "TracadoNovo" - self.dialog.resize(200, 100) - self.dialog.setWindowTitle(u"Traçado") - self.dialog.btnClose = QtWidgets.QPushButton("Terminar",self.dialog) - self.dialog.show() - return self.name_tracado - - def setupUi2(self,Form): - Form.setObjectName(_fromUtf8(u"Traçado Horizontal")) - self.tableEstacas : QtWidgets.QTableWidget - self.tableEstacas.setColumnCount(3) - self.tableEstacas.setRowCount(0) - self.tableEstacas.setSelectionBehavior(QAbstractItemView.SelectRows) - self.tableEstacas.setHorizontalHeaderLabels((u"ID",u"Arquivo",u"Data de criação")) - - - - self.table=self.tableEstacas - self.table.horizontalHeader().setSectionResizeMode(QtWidgets.QHeaderView.Interactive) - self.table.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) - self.table.horizontalHeader().setStretchLastSection(True) - self.stretchTable(self.table) - - def resizeEvent(self, event): - self.stretchTable(self.table) - super(EstacasUI, self).resizeEvent(event) # Restores the original behaviour of the resize event - - def stretchTable(self, table): - tableSize = table.width() - sideHeaderWidth = table.verticalHeader().width() - tableSize -= sideHeaderWidth - numberOfColumns = table.columnCount() - - remainingWidth = tableSize % numberOfColumns - for columnNum in range(table.columnCount()): - if remainingWidth > 0: - table.setColumnWidth(columnNum, int(tableSize / numberOfColumns) + 1) - remainingWidth -= 1 - else: - table.setColumnWidth(columnNum, int(tableSize / numberOfColumns)) - - def exec_(self): - self.tableEstacas: QtWidgets.QTableWidget - self.stretchTable(self.table) - self.tableEstacas.selectRow(0) - self.checkButtons() - return super(EstacasUI, self).exec_() - - def checkButtons(self): - if self.tableEstacas.rowCount() == 0: - self.btnOpen.setEnabled(False) - self.btnOpenCv.setEnabled(False) - else: - self.btnOpen.setEnabled(True) - self.btnOpenCv.setEnabled(True) - - -class EstacasIntersec(QtWidgets.QDialog): - def __init__(self,iface): - super(EstacasIntersec, self).__init__(None) - self.iface = iface - self.setupUi(self) - - def clear(self): - self.tableWidget.setRowCount(0) - self.tableWidget.clearContents() - - def saveEstacasCSV(self): - filename = QtWidgets.QFileDialog.getSaveFileName() - return filename - - def fill_table(self, xxx_todo_changeme,f=False): - (estaca,descricao,progressiva,cota) = xxx_todo_changeme - self.tableWidget.insertRow(self.tableWidget.rowCount()) - k = self.tableWidget.rowCount() - 1 - self.tableWidget.setItem(k, 0, QtWidgets.QTableWidgetItem(u"%s" % estaca)) - self.tableWidget.setItem(k, 1, QtWidgets.QTableWidgetItem(u"%s" % descricao)) - self.tableWidget.setItem(k, 2, QtWidgets.QTableWidgetItem(u"%s" % progressiva)) - self.tableWidget.setItem(k, 3, QtWidgets.QTableWidgetItem(u"%s" % cota)) - '''if not f: - naz = decdeg2dms(azimute) - str_az = "%s* %s\' %s\'\'" % (int(naz[0]), int(naz[1]), naz[2]) - self.tableWidget.setItem(k, 6, QtWidgets.QTableWidgetItem(str_az)) - else:''' - - - def get_estacas(self): - estacas = [] - for i in range(self.tableWidget.rowCount()): - estaca = [] - for j in range(self.tableWidget.columnCount()): - estaca.append(self.tableWidget.item(i,j).text()) - estacas.append(estaca) - return estacas - - - def setupUi(self, Form): - Form.setObjectName(_fromUtf8(u"Traçado Horizontal")) - Form.resize(919, 510) - self.tableWidget = QtWidgets.QTableWidget(Form) - self.tableWidget.setGeometry(QtCore.QRect(0, 0, 750, 511)) - self.tableWidget.setObjectName(_fromUtf8("tableWidget")) - self.modelSource = self.tableWidget.model() - - - self.tableWidget.setColumnCount(8) - self.tableWidget.setRowCount(0) - self.tableWidget.setHorizontalHeaderLabels((u"Estaca",u"Descrição",u"Progressiva",u"Cota", u"Relevo", u"Norte",u"Este",u"Azimute")) - - - self.btnGen = QtWidgets.QPushButton(Form) - self.btnGen.setText("Tabela de Verticais") - self.btnGen.setGeometry(QtCore.QRect(755, 16, 180, 45)) - self.btnGen.setObjectName(_fromUtf8("btnGen")) - #self.btnGen.clicked.connect(self.generate) - - self.btnTrans = QtWidgets.QPushButton(Form) - self.btnTrans.setText("Definir Seção Tipo") - self.btnTrans.setGeometry(QtCore.QRect(760, 50+16, 160, 30)) - self.btnTrans.setObjectName(_fromUtf8("btnTrans")) - #self.btnEstacas.clicked.connect(self.ref_super.tracado) - - self.btnPrint = QtWidgets.QPushButton(Form) - self.btnPrint.setText("Imprimir") - self.btnPrint.setGeometry(QtCore.QRect(760, 16 + 34 * 6, 160, 30)) - self.btnPrint.setObjectName(_fromUtf8("btnPrint")) - #self.btnEstacas.clicked.connect(self.ref_super.tracado) - - self.btnClean = QtWidgets.QPushButton(Form) - self.btnClean.setText("Apagar Dados") - self.btnClean.setGeometry(QtCore.QRect(760, 16 + 34 * 7, 160, 30)) - self.btnClean.setObjectName(_fromUtf8("btnClean")) - - - self.retranslateUi(Form) - QtCore.QMetaObject.connectSlotsByName(Form) - - - - def retranslateUi(self, Form): - Form.setWindowTitle(_translate("Traçado Horizontal", "Traçado Vertical", None)) - - -class EstacasCv(QtWidgets.QDialog): - layerUpdated=pyqtSignal() - - def __init__(self,iface, parent): - super(EstacasCv, self).__init__(None) - self.mode="N" - self.iface = iface - self.parent = parent - self.setupUi(self) - self.location_on_the_screen() - - - self.spinBox: QtWidgets.QSpinBox - self.spinBox.hide() - self.comboBox: QtWidgets.QComboBox - self.comboBox.currentTextChanged.connect(self.search) - self.comboBox.view().setVerticalScrollBarPolicy(Qt.ScrollBarAsNeeded) - self.spinBox.valueChanged.connect(self.changeSearchResult) - self.searchResults=[] - self.curvaLayers=[] - - def changeSearchResult(self, i): - if i==0 or i==len(self.searchResults)+1: - self.spinBox.valueChanged.disconnect() - self.spinBox.setValue(i+1 if i==0 else i-1) - self.spinBox.valueChanged.connect(self.changeSearchResult) - return - - if len(self.searchResults)>0: - columnIndexes = list(set(index.column() - for index in self.tableWidget.selectionModel().selectedIndexes())) - row=self.searchResults[i-1] - - if len(columnIndexes)==0: - self.tableWidget.setRangeSelected( - QTableWidgetSelectionRange(row, 0, row, self.tableWidget.columnCount()-1), True) - self.tableWidget.setCurrentCell(row,0) - else: - for i in columnIndexes: - self.tableWidget.setRangeSelected( - QTableWidgetSelectionRange(row, i, row, i), True) - self.tableWidget.setCurrentCell(row, columnIndexes[0]) - - def search(self, txt): - self.searchResults=[] - columnIndexes = list(set(index.column() - for index in self.tableWidget.selectionModel().selectedIndexes())) - def searchRange(estaca, columnIndexes): - if len(columnIndexes)>0: - estaca=[estaca[i] for i in columnIndexes] - return "* ".join(estaca) - - for i, estaca in enumerate(self.get_estacas()): - if txt.upper() in searchRange(estaca, columnIndexes).upper(): - self.searchResults.append(i) - lres=len(self.searchResults) - if lres>1: - self.spinBox.show() - self.spinBox.setMaximum(lres+1) - else: - self.spinBox.hide() - self.changeSearchResult(1) - self.spinBox.setValue(1) - - - - def location_on_the_screen(self): - screen = QDesktopWidget().screenGeometry() - widget = self.geometry() - x = 0#widget.width() - y = (screen.height()-widget.height())/2 - self.move(x, y) - - def clear(self): - self.tableWidget.setRowCount(0) - self.tableWidget.clearContents() - self.comboBox.clear() - - def setIntersect(self): - if hasattr(self, "mode") and self.mode=="T": - return - self.clear() - self.tableWidget.setColumnCount(8) - self.tableWidget.setRowCount(0) - self.tableWidget.setHorizontalHeaderLabels((u"Estaca",u"Descrição",u"Progressiva",u"Norte",u"Este",u"Greide",u"Cota",u"Azimute")) - try: - self.btnGen.clicked.disconnect() - except: - pass - self.tableWidget.cellClicked.connect(self.zoom) - self.btnGen.setText("Tabela de verticais") - self.btnCorte.setText("Exportar Traçado") - self.btnCorte.setToolTip("Exportar curvas de nível do traçado como um arquivo dxf") - self.mode="T" - self.stretchTable() - - - def setCv(self): - if hasattr(self, "mode") and self.mode=="CV": - return - self.clear() - self.tableWidget.setColumnCount(4) - self.tableWidget.setRowCount(0) - try: - self.tableWidget.cellClicked.disconnect() - except: - pass - self.tableWidget.setHorizontalHeaderLabels((u"Estaca",u"Descrição",u"Progressiva",u"Greide")) - self.btnGen.setText("Tabela de Interseção") - self.btnCorte.setText("Exportar Greide") - self.btnCorte.setToolTip("Exportar o greide e o terreno do traçado como um arquivo dxf") - self.mode="CV" - self.stretchTable() - - - def saveEstacasCSV(self): - filename = QtWidgets.QFileDialog.getSaveFileName() - return filename - - - def fill_table(self, estaca, f=False): - try: - self.comboBox.currentTextChanged.disconnect(self.search) - except: - pass - self.tableWidget.insertRow(self.tableWidget.rowCount()) - k = self.tableWidget.rowCount() - 1 - j = 0 - for value in list(estaca): - cell_item = QtWidgets.QTableWidgetItem(u"%s" % formatValue(value)) - cell_item.setFlags(cell_item.flags() ^ Qt.ItemIsEditable) - self.tableWidget.setItem(k, j, cell_item) - j += 1 - - if len(estaca[1]) != 0 and not (estaca[1] in [self.comboBox.itemText(i) - for i in range(self.comboBox.count())]): - self.comboBox.addItem(estaca[1]) - self.comboBox.currentTextChanged.connect(self.search) - - def get_estacas(self): - estacas = [] - for i in range(self.tableWidget.rowCount()): - estaca = [] - for j in range(self.tableWidget.columnCount()): - estaca.append(self.tableWidget.item(i,j).text()) - estacas.append(estaca) - return estacas - - def getEstacas(self): - for i in range(self.tableWidget.rowCount()): - estaca = [] - for j in range(self.tableWidget.columnCount()): - estaca.append(self.tableWidget.item(i,j).text()) - yield estaca - - - def setupUi(self, Form): - Form.setObjectName(_fromUtf8(u"Traçado Horizontal")) - Form.resize(919, 510) - self.tableWidget = QtWidgets.QTableWidget(Form) - self.gridLayout = QtWidgets.QGridLayout(Form) - self.gridLayout.setObjectName("gridLayout") - self.gridLayout.setColumnStretch(0, 4) -# self.gridLayout.setRowStretch(1,3) - - self.tableWidget.setGeometry(QtCore.QRect(0, 0, 750, 511)) - self.tableWidget.setObjectName(_fromUtf8("tableWidget")) - self.modelSource = self.tableWidget.model() - - column=1 - row=0 - - self.btnRecalcular = QtWidgets.QPushButton(Form) - self.btnRecalcular.setText("Recalcular") - self.btnRecalcular.setGeometry(QtCore.QRect(760, 16 + 34 * 7, 160, 30)) - self.btnRecalcular.setWhatsThis("Recalcula a tabela em vista \n A tabela vertical deve" - " ser calculada antes da de interseção para que as mudanças se " - "apliquem corretamente") - self.btnRecalcular.setObjectName(_fromUtf8("btnRecalcular")) - self.gridLayout.addWidget(self.btnRecalcular, row, column, 1, 1) - row+=1 - - self.btnPerfil = QtWidgets.QPushButton(Form) - self.btnPerfil.setText("Gerar Perfil \nLongitudinal") - self.btnPerfil.setGeometry(QtCore.QRect(760, 16 + 34 * 7, 160, 30)) - self.btnPerfil.setWhatsThis("Define o greide") - self.btnPerfil.setToolTip("Define o Greide") - self.btnPerfil.setObjectName(_fromUtf8("btnPerfil")) - self.gridLayout.addWidget(self.btnPerfil, row, column, 1, 1) - row+=1 - self.btnPerfil.hide() - - self.btnGen = QtWidgets.QPushButton(Form) - self.btnGen.setText("Tabela de interseção") - self.btnGen.setGeometry(QtCore.QRect(755, 16, 180, 45)) - self.btnGen.setObjectName(_fromUtf8("btnGen")) - self.gridLayout.addWidget(self.btnGen, row, column, 1,1) - self.btnGen.setToolTip("Tabela contendo os dados horizonais e verticais") - #self.btnGen.clicked.connect(self.generate) - row+=1 - - self.btnTrans = QtWidgets.QPushButton(Form) - self.btnTrans.setText("Definir Seção Tipo") - self.btnTrans.setGeometry(QtCore.QRect(760, 50+16, 160, 30)) - self.btnTrans.setObjectName(_fromUtf8("btnTrans")) - self.btnTrans.setToolTip("Inicia interface para a edição do perfil transversal") - #self.btnEstacas.clicked.connect(self.ref_super.tracado) - - self.gridLayout.addWidget(self.btnTrans, row, column, 1,1) - row+=1 - - self.btnBruck = QtWidgets.QPushButton(Form) - self.btnBruck.setText("Diagrama de Bruckner") - self.btnBruck.setGeometry(QtCore.QRect(760, 16 + 34 * 6, 160, 30)) - self.btnBruck.setObjectName(_fromUtf8("btnBruck")) - #self.btnEstacas.clicked.connect(self.ref_super.tracado) - self.btnBruck.setToolTip("Visualizar e editar o diagrama de bruckner para um intervalo de estacas") - self.gridLayout.addWidget(self.btnBruck, row, column, 1, 1) - row+=3 - - self.btnCsv = QtWidgets.QPushButton(Form) - self.btnCsv.setText("Exportar Tabela CSV") - self.btnCsv.setGeometry(QtCore.QRect(760, 16 + 34 * 6, 160, 30)) - self.btnCsv.setObjectName(_fromUtf8("btnCsv")) - #self.btnEstacas.clicked.connect(self.ref_super.tracado) - self.btnCsv.setToolTip("Exportar a tabela em visualização para um arquivo csv") - self.gridLayout.addWidget(self.btnCsv, row, column, 1,1) - row+=1 - - self.btnCorte = QtWidgets.QPushButton(Form) - self.btnCorte.setText("Exportar Greide") - self.btnCorte.setGeometry(QtCore.QRect(760, 16 + 34 * 6, 160, 30)) - self.btnCorte.setObjectName(_fromUtf8("btnCorte")) - #self.btnEstacas.clicked.connect(self.ref_super.tracado) - self.btnCorte.setToolTip("Exportar o greide e o terreno do traçado como um arquivo dxf") - self.gridLayout.addWidget(self.btnCorte, row, column, 1,1) - row+=1 - - self.btnCrossSectionExport = QtWidgets.QPushButton(Form) - self.btnCrossSectionExport.setText("Exportar Transversais") - self.btnCrossSectionExport.setGeometry(QtCore.QRect(760, 16 + 34 * 6, 160, 30)) - self.btnCrossSectionExport.setObjectName(_fromUtf8("btnCrossSectionExport")) - self.btnCrossSectionExport.setToolTip("Extportar os contornos dos perfis transversais e verticais como um arquivo CAD dxf") - #self.btnEstacas.clicked.connect(self.ref_super.tracado) - self.gridLayout.addWidget(self.btnCrossSectionExport, row, column, 1,1) - row+=1 - - self.btn3DView = QtWidgets.QPushButton(Form) - self.btn3DView.setText("Visualizar Modelo") - self.btn3DView.setToolTip("Visualiza o modelo tridimensional em uma estaca") - self.btn3DView.setGeometry(QtCore.QRect(760, 16 + 34 * 7, 160, 30)) - self.btn3DView.setObjectName(_fromUtf8("btn3DView")) - self.gridLayout.addWidget(self.btn3DView, row, column, 1, 1) - row+=1 - - self.btn3D = QtWidgets.QPushButton(Form) - self.btn3D.setText("Exportar Modelo") - self.btn3D.setGeometry(QtCore.QRect(760, 16 + 34 * 6, 160, 30)) - self.btn3D.setObjectName(_fromUtf8("btn3D")) - toolTip = "

Exportar um modelo tridimensional do projeto como um arquivo de malha triangular." \ - "Se o blender (https://www.blender.org/) estiver instalado no sistema uma animação percorrendo " \ - "o traçado pode ser gerada automaticamente" \ - "

" - - self.btn3D.setToolTip(toolTip) - self.btn3D.setWhatsThis(toolTip) - # self.btnEstacas.clicked.connect(self.ref_super.tracado) - self.gridLayout.addWidget(self.btn3D, row, column, 1, 1) - row += 1 - - - self.btnClean = QtWidgets.QPushButton(Form) - self.btnClean.setText("Apagar Dados Transversais") - self.btnClean.setGeometry(QtCore.QRect(760, 16 + 34 * 7, 160, 30)) - self.btnClean.setObjectName(_fromUtf8("btnClean")) - self.gridLayout.addWidget(self.btnClean, row, column, 1, 1) - self.btnClean.hide() - row+=3 - - self.labelProcurar = QtWidgets.QLabel(Form) - self.labelProcurar.setText("Procurar: ") - self.labelProcurar.setGeometry(QtCore.QRect(760, 16 + 34 * 7, 160, 30)) - self.labelProcurar.setObjectName(_fromUtf8("labelProcurar")) - self.gridLayout.addWidget(self.labelProcurar, row, column, 1, 1) - row+=1 - - self.hor=QtWidgets.QHBoxLayout(Form) - self.hor.setGeometry(QtCore.QRect(760, 16 + 34 * 7, 160, 30)) - self.hor.setObjectName(_fromUtf8("hor")) - self.comboBox=QtWidgets.QComboBox(Form) - self.comboBox.setEditable(True) - self.spinBox=reversedSpinBox(Form) - self.spinBox.setMinimum(0) - self.hor.addWidget(self.comboBox) - self.hor.addWidget(self.spinBox) - self.gridLayout.addLayout(self.hor, row, column, 1, 1) - row+=1 - - self.labelComp = QtWidgets.QLabel(Form) - self.labelComp.setText("Comprimento total: ") - self.labelComp.setGeometry(QtCore.QRect(760, 16 + 34 * 7, 160, 30)) - self.labelComp.setObjectName(_fromUtf8("labelComp")) - self.gridLayout.addWidget(self.labelComp, row, column, 1, 1) - row+=1 - - self.comprimento = QtWidgets.QLineEdit(Form) - self.comprimento.setGeometry(QtCore.QRect(760, 16 + 34 * 7, 160, 30)) - self.comprimento.setObjectName(_fromUtf8("comprimento")) - self.comprimento.setReadOnly(True) - self.comprimento.setWhatsThis(u"Comprimento total do traçado (considerando a profundidade do greide)") - self.gridLayout.addWidget(self.comprimento, row, column, 1, 1) - - self.gridLayout.addWidget(self.tableWidget, 0, 0, row+1, 1) - self.retranslateUi(Form) - QtCore.QMetaObject.connectSlotsByName(Form) - self.setCv() - self.Form=Form - - self.table : QtWidgets.QTableWidget - self.table=self.tableWidget - self.table.horizontalHeader().setSectionResizeMode(QtWidgets.QHeaderView.Interactive) - self.table.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) - self.table.horizontalHeader().setStretchLastSection(True) - - self.stretchTable() - self.setCopy() - self.point=False - - def setCopy(self): - if not hasattr(self, "copyAction"): - self.copyAction=CopySelectedCellsAction(self, self.table) - - def resizeEvent(self, event): - self.stretchTable() - super().resizeEvent(event) # Restores the original behaviour of the resize event - - def stretchTable(self): - table=self.tableWidget - tableSize = table.width() - sideHeaderWidth = table.verticalHeader().width() - tableSize -= sideHeaderWidth - numberOfColumns = table.columnCount() - - remainingWidth = tableSize % numberOfColumns - for columnNum in range(table.columnCount()): - if remainingWidth > 0: - table.setColumnWidth(columnNum, int(tableSize / numberOfColumns) + 1) - remainingWidth -= 1 - else: - table.setColumnWidth(columnNum, int(tableSize / numberOfColumns)) - - def retranslateUi(self, Form): - Form.setWindowTitle(_translate("Traçado Horizontal", "Traçado Vertical", None)) - - - - def openLayers(self): - self.closeLayers() - self.parent.model.iface = self.iface - l = self.parent.model.getSavedLayers(self.windowTitle().split(":")[0]) - if l: - l.setName("Curvas: " + l.name()) - l.startEditing() - self.curvaLayers.append(l) - l.layerModified.connect(lambda: self.add_row(l)) - self.parent.iface.setActiveLayer(l) - - l.renderer().symbol().setWidth(.5) - l.renderer().symbol().setColor(QtGui.QColor("#be0c21")) - l.triggerRepaint() - - if len([a for a in l.getFeatures()]): - self.parent.iface.mapCanvas().setExtent(l.extent()) - - def add_row(self, l): - self.layer = l - self.layerUpdated.emit() - - def closeLayers(self): - for l in self.curvaLayers: - lyr=l - name=lyr.name() - try: - l.commitChanges() - l.endEditCommand() - path=l.dataProvider().dataSourceUri() - QgsProject.instance().removeMapLayer(l.id()) - self.parent.model.saveLayer(path) - del l - except Exception as e: - try: - msgLog("Erro: "+str(e)+" ao remover layer "+name) - del l - except Exception as ee: - msgLog("Erro: " + str(e) +" _&_ "+ str(ee)) - - self.curvaLayers=[] - - def reject(self): - try: - self.closeLayers() - self.setWindowTitle(": Horizontal") - except: - pass - - self.removePoint() - self.comboBox.clear() - return super(EstacasCv, self).reject() - - def close(self): - self.removePoint() - self.comboBox.clear() - return super(EstacasCv, self).close() - - def accept(self): - try: - self.closeLayers() - self.setWindowTitle(": Horizontal") - except: - pass - - self.removePoint() - self.comboBox.clear() - return super(EstacasCv, self).accept() - - def removePoint(self): - root = QgsProject.instance() - try: - if self.point: - root.removeMapLayer(self.point) - except RuntimeError as e: - pass#Duplicado - from ..model.helper.qgsgeometry import refreshCanvas - refreshCanvas(self.iface) - - def zoom(self, row, column): - root = QgsProject.instance() - try: - if self.point: - root.removeMapLayer(self.point) - except RuntimeError as e: - pass#Duplicado - - #ZOOM - scale = 100 - table=self.tableWidget - e, x, y = table.item(row,0).text(), float(table.item(row,4).text()), float(table.item(row,3).text()) - point = QgsPointXY(x,y) - rect = QgsRectangle(x - scale, y - scale, x + scale, y + scale) - self.iface.mapCanvas().setExtent(rect) - self.iface.mapCanvas().refresh() - - - #ADD Point Layer - layer = QgsVectorLayer("Point?crs=%s"%(root.crs().authid()), "Estaca: "+str(e),"memory") - layer.setCrs(root.crs()) - prov = layer.dataProvider() - feat = QgsFeature() - feat.setGeometry(QgsGeometry.fromPointXY(point)) - prov.addFeatures([feat]) - root.addMapLayer(layer, False) - QgsProject.instance().layerTreeRoot().insertLayer(0, layer) - self.point=layer - - def exec_(self): - self.point=False - self.setCopy() - self.stretchTable() - name=self.parent.model.getNameFromId(self.parent.model.id_filename) - self.setWindowTitle(name + ": Vertical") - self.openLayers() - return super().exec_() - - - -class Estacas(QtWidgets.QDialog, ESTACAS_DIALOG): - - layerUpdated=pyqtSignal() - - def __init__(self,iface, parent): - super().__init__(None) - self.parent=parent - self.iface = iface - self.type="horizontal" - self.setupUi(self) - self.curvaLayers=[] - self.empty=True - self.location_on_the_screen() - #self.btnPerfil.hide() - - self.spinBox: QtWidgets.QSpinBox - self.horizontalLayout: QtWidgets.QHBoxLayout - sp=reversedSpinBox() - self.horizontalLayout.addWidget(sp) - self.spinBox=sp - self.spinBox.setMinimum(0) - self.spinBox.hide() - self.comboBox: QtWidgets.QComboBox - self.comboBox.currentIndexChanged.connect(lambda: - self.tableWidget.setRangeSelected( - QTableWidgetSelectionRange(0, 0, 0, self.tableWidget.columnCount() - 1), True) - ) - self.comboBox.currentTextChanged.connect(self.search) - self.comboBox.view().setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded) - self.spinBox.valueChanged.connect(self.changeSearchResult) - self.searchResults = [] - self.btnDuplicar.hide() - - - def changeSearchResult(self, i): - if i == 0 or i == len(self.searchResults) + 1: - self.spinBox.valueChanged.disconnect() - self.spinBox.setValue(i + 1 if i == 0 else i - 1) - self.spinBox.valueChanged.connect(self.changeSearchResult) - return - - if len(self.searchResults) > 0: - columnIndexes = list(set(index.column() - for index in self.tableWidget.selectionModel().selectedIndexes())) - row = self.searchResults[i - 1] - - if len(columnIndexes) == 0: - self.tableWidget.setRangeSelected( - QTableWidgetSelectionRange(row, 0, row, self.tableWidget.columnCount() - 1), True) - self.tableWidget.setCurrentCell(row, 0) - else: - for i in columnIndexes: - self.tableWidget.setRangeSelected( - QTableWidgetSelectionRange(row, i, row, i), True) - self.tableWidget.setCurrentCell(row, columnIndexes[0]) - - def search(self, txt): - self.searchResults = [] - columnIndexes = list(set(index.column() - for index in self.tableWidget.selectionModel().selectedIndexes())) - - def searchRange(estaca, columnIndexes): - if len(columnIndexes) > 0: - estaca = [estaca[i] for i in columnIndexes] - return "* ".join(estaca) - - for i, estaca in enumerate(self.get_estacas()): - if txt.upper() in searchRange(estaca, columnIndexes).upper(): - self.searchResults.append(i) - lres = len(self.searchResults) - if lres > 1: - self.spinBox.show() - self.spinBox.setMaximum(lres + 1) - else: - self.spinBox.hide() - self.changeSearchResult(1) - self.spinBox.setValue(1) - - - def location_on_the_screen(self): - screen = QDesktopWidget().screenGeometry() - widget = self.geometry() - x = 0#widget.width() - y = (screen.height()-widget.height())/2 - self.move(x, y) - - def clear(self): - self.tableWidget.setRowCount(0) - self.tableWidget.clearContents() - self.comboBox.clear() - - def saveEstacasCSV(self): - filename = QtWidgets.QFileDialog.getSaveFileName(caption="Save Worksheet",filter="Arquivo CSV (*.csv)") - return filename - - - def fill_table(self, estaca,f=False): - self.comboBox.currentTextChanged.disconnect(self.search) - self.tableWidget.insertRow(self.tableWidget.rowCount()) - k = self.tableWidget.rowCount() - 1 - j=0 - for value in list(estaca): - cell_item = QtWidgets.QTableWidgetItem(u"%s" % formatValue(value)) - cell_item.setFlags(cell_item.flags() ^ Qt.ItemIsEditable) - self.tableWidget.setItem(k,j,cell_item) - j+=1 - - if len(estaca[1])!=0 and not (estaca[1] in [self.comboBox.itemText(i) - for i in range(self.comboBox.count())]): - self.comboBox.addItem(estaca[1]) - self.comboBox.currentTextChanged.connect(self.search) - - def get_estacas(self): - estacas = [] - for i in range(self.tableWidget.rowCount()): - estaca = [] - for j in range(self.tableWidget.columnCount()): - estaca.append(self.tableWidget.item(i,j).text()) - estacas.append(estaca) - return estacas - - def plotar(self): - vl = QgsVectorLayer("Point", "temporary_points", "memory") - pr = vl.dataProvider() - - # Enter editing mode - vl.startEditing() - - # add fields - pr.addAttributes([QgsField("estaca", QVariant.String), QgsField("descrição", QVariant.String), - QgsField("north", QVariant.String), QgsField("este", QVariant.String), - QgsField("cota", QVariant.String), QgsField("azimite", QVariant.String)]) - fets = [] - - for r in range(self.tableWidget.rowCount()): - ident = self.tableWidget.item(r, 0).text() - if ident in ["", None]: break - fet = QgsFeature(vl.pendingFields()) - n = 0.0 - e = 0.0 - try: - es = self.tableWidget.item(r, 0).text() - d = self.tableWidget.item(r, 1).text() - n = float(self.tableWidget.item(r, 3).text()) - e = float(self.tableWidget.item(r, 4).text()) - c = float(self.tableWidget.item(r, 5).text()) - a = self.tableWidget.item(r, 6).text() - except: - break - fet.setGeometry(QgsGeometry.fromPoint(p2QgsPoint(e, n))) - fet.setAttributes([es, d, n, e, c, a]) - fets.append(fet) - pr.addFeatures(fets) - vl.commitChanges() - QgsProject .instance().addMapLayer(vl) - - def openTIFF(self): - mapCanvas = self.iface.mapCanvas() - itens = [] - for i in range(mapCanvas.layerCount() - 1, -1, -1): - try: - layer = mapCanvas.layer(i) - layerName = layer.name() - if type(layer)==qgis._core.QgsRasterLayer and not layer.name() in ['Google Terrain','Google Satellite']: - itens.append(layerName) - except: - pass - item, ok = QtWidgets.QInputDialog.getItem(None, "Camada com tracado", u"Selecione o raster com as elevações:", - itens, - 0, False) - if not(ok) or not(item): - return None - else: - layerList = QgsProject .instance().mapLayersByName(item) - layer = None - if layerList: - layer = layerList[0] - - filename = layer.source() - #filename = QtWidgets.QFileDialog.getOpenFileName(filter="Image files (*.tiff *.tif)") - - return filename - - def openDXF(self): - filename = QtWidgets.QFileDialog.getOpenFileName(filter="Autocad files (*.dxf)") - return filename - - def setupUi(self, Form): - super(Estacas, self).setupUi(Form) - Form.setObjectName(_fromUtf8(u"Traçado Horizontal")) - self.modelSource = self.tableWidget.model() - self.tableWidget.setColumnCount(7) - self.tableWidget.setRowCount(0) - self.tableWidget.setHorizontalHeaderLabels((u"Estaca",u"Descrição",u"Progressiva",u"Norte",u"Este",u"Cota",u"Azimute")) - self.tableWidget.cellClicked.connect(self.zoom) - - self.table : QtWidgets.QTableWidget - self.table=self.tableWidget - self.table.horizontalHeader().setSectionResizeMode(QtWidgets.QHeaderView.Interactive) - self.table.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) - self.table.horizontalHeader().setStretchLastSection(True) - self.stretchTable() - - - def resizeEvent(self, event): - self.stretchTable() - super().resizeEvent(event) # Restores the original behaviour of the resize event - - def stretchTable(self): - table=self.table - tableSize = table.width() - sideHeaderWidth = table.verticalHeader().width() - tableSize -= sideHeaderWidth - numberOfColumns = table.columnCount() - - remainingWidth = tableSize % numberOfColumns - for columnNum in range(table.columnCount()): - if remainingWidth > 0: - table.setColumnWidth(columnNum, int(tableSize / numberOfColumns) + 1) - remainingWidth -= 1 - else: - table.setColumnWidth(columnNum, int(tableSize / numberOfColumns)) - - def event(self, event: QtCore.QEvent): - if event.type() == QtCore.QEvent.WindowStateChange and self.windowState() & QtCore.Qt.WindowMinimized and hasattr(self, "chview"): - view=self.chview -# view.show() - view.setWindowState(view.windowState() & ~QtCore.Qt.WindowMinimized | QtCore.Qt.WindowActive) - view.activateWindow() - return super(Estacas, self).event(event) - - def exec_(self): - self.point=False - self.setCopy() - self.stretchTable() - self.openLayers() - return super().exec_() - - def accept(self): - try: - self.closeLayers() - self.setWindowTitle(": Horizontal") - except: - pass - return super().accept() - - def reject(self): - try: - self.closeLayers() - self.setWindowTitle(": Horizontal") - except: - pass - return super().reject() - - def openLayers(self): - self.closeLayers() - - self.parent.model.iface=self.iface - l=self.parent.model.getSavedLayers(self.windowTitle().split(":")[0]) - if l: - l.setName("Curvas: "+l.name()) - l.startEditing() - self.curvaLayers.append(l) - l.layerModified.connect(lambda: self.add_row(l)) - self.parent.iface.setActiveLayer(l) - - l.renderer().symbol().setWidth(.5) - l.renderer().symbol().setColor(QtGui.QColor("#be0c21")) - l.triggerRepaint() - - if len([a for a in l.getFeatures()]): - self.parent.iface.mapCanvas().setExtent(l.extent()) - - - def add_row(self,l): - self.layer=l - self.layerUpdated.emit() - - - def closeLayers(self): - for l in self.curvaLayers: - try: - lyr=l - name=lyr.name() - except: - break - try: - l.commitChanges() - l.endEditCommand() - path=l.dataProvider().dataSourceUri() - QgsProject.instance().removeMapLayer(l.id()) - self.parent.model.saveLayer(path) - del l - except Exception as e: - try: - msgLog("Erro: "+str(e)+" ao remover layer "+name) - del l - except Exception as ee: - msgLog("Erro: " + str(e) +" _&_ "+ str(ee)) - - self.curvaLayers=[] - - def setCopy(self): - if not hasattr(self, "copyAction"): - self.copyAction=CopySelectedCellsAction(self, self.table) - - - def clearLayers(self): - try: - if hasattr(self,"point") and self.point: - QgsProject.instance().removeMapLayer(self.point) - self.iface.mapCanvas().refresh() - - except: - pass - - def zoom(self, row, column): - root = QgsProject.instance() - try: - if self.point: - root.removeMapLayer(self.point) - except RuntimeError as e: - pass#Duplicado - - #ZOOM - scale = 100 - table=self.tableWidget - e, x, y = table.item(row,0).text(), float(table.item(row,4).text()), float(table.item(row,3).text()) - point = QgsPointXY(x,y) - rect = QgsRectangle(x - scale, y - scale, x + scale, y + scale) - self.iface.mapCanvas().setExtent(rect) - self.iface.mapCanvas().refresh() - - - #ADD Point Layer - layer = QgsVectorLayer("Point?crs=%s"%(root.crs().authid()), "Estaca: "+str(e),"memory") - layer.setCrs(root.crs()) - prov = layer.dataProvider() - feat = QgsFeature() - feat.setGeometry(QgsGeometry.fromPointXY(point)) - prov.addFeatures([feat]) - root.addMapLayer(layer, False) - QgsProject.instance().layerTreeRoot().insertLayer(0, layer) - self.point=layer - - - -class closeDialog(QtWidgets.QDialog): - save = QtCore.pyqtSignal() - dischart = QtCore.pyqtSignal() - cancel = QtCore.pyqtSignal() - - def __init__(self, *args, **kwds): - super(closeDialog, self).__init__(*args, **kwds) - self.wasCanceled=False - self.setupUI() - - def setupUI(self): - - self.setWindowTitle("Fechar") - label = QtWidgets.QLabel(u"Deseja salvar suas alterações?") - btnSave=QtWidgets.QPushButton(self) - btnSave.setText("Sim") - btnSave.setToolTip("Salvar o perfil vertical desenhado") - btnSave.clicked.connect(self.__exitSave) - - - btnNot=QtWidgets.QPushButton(self) - btnNot.setText(u"Não") - btnNot.setToolTip(u"Descartar alterações") - btnNot.clicked.connect(self.__exitNotSave) - - - btnCancel=QtWidgets.QPushButton(self) - btnCancel.setText("Cancelar") - btnCancel.setToolTip("Voltar para Janela de desenho") - btnCancel.clicked.connect(self.__exitCancel) - - - Vlayout=QtWidgets.QVBoxLayout() - HLayout=QtWidgets.QHBoxLayout() - - Vlayout.addWidget(label) - HLayout.addWidget(btnSave) - HLayout.addWidget(btnNot) - HLayout.addWidget(btnCancel) - Vlayout.addLayout(HLayout) - - self.setLayout(Vlayout) - - - - def __exitSave(self): - self.save.emit() - self.close() - def __exitNotSave(self): - self.dischart.emit() - self.close() - def __exitCancel(self): - self.cancel.emit() - self.close() - - - - -class rampaDialog(QtWidgets.QDialog): - def __init__(self, roi, segment, pos, index=1): - super(rampaDialog, self).__init__(None) - self.setWindowTitle(u"Modificar Rampa") - self.roi=roi - self.segment=segment - self.pos=pos - self.index=index - self.setupUI() - - - def setupUI(self): - r=[] - for handle in self.roi.getHandles(): - r.append(handle) - - self.firstHandle=r[0] - self.lastHandle=r[len(r)-1] - - H1layout=QtWidgets.QHBoxLayout() - H2layout=QtWidgets.QHBoxLayout() - H3layout=QtWidgets.QHBoxLayout() - Vlayout=QtWidgets.QVBoxLayout(self) - - label=QtWidgets.QLabel("Modificar Rampa") - - Incl=QtWidgets.QDoubleSpinBox() - Incl.setMaximum(99.99) - Incl.setMinimum(-99.99) - Incl.setSingleStep(.05) - compr=QtWidgets.QDoubleSpinBox() - compr.setMaximum(1000000000.0) - compr.setMinimum(0.0) - cota=QtWidgets.QDoubleSpinBox() - cota.setMinimum(0.0) - cota.setMaximum(10000.0) - cota2 = QtWidgets.QDoubleSpinBox() - cota2.setMinimum(0.0) - cota2.setMaximum(10000.0) - abscissa=QtWidgets.QDoubleSpinBox() - abscissa.setMaximum(1000000000.0) - abscissa.setMinimum(0.0) - - InclLbl=QtWidgets.QLabel(u"Inclinação: ") - posInclLbl=QtWidgets.QLabel(u"%") - comprLbl=QtWidgets.QLabel(u"Distância inclinada: ") - poscomprLbl=QtWidgets.QLabel(u"m") - cotaLbl=QtWidgets.QLabel(u"Cotas: V"+str(self.index-2)+"") - cotaLbl2=QtWidgets.QLabel(u"V"+str(self.index-1)) - poscotaLbl=QtWidgets.QLabel(u"m") - abscissalbl=QtWidgets.QLabel(u"Distância Horizontal: ") - posabscissaLbl=QtWidgets.QLabel(u"m") - - - h1 = self.segment.handles[0]['item'] - h2 = self.segment.handles[1]['item'] - - self.h1=h1 - self.h2=h2 - - self.initialPos=[h1.pos(),h2.pos()] - - b1 = QtWidgets.QPushButton("ok",self) - b1.clicked.connect(self.finishDialog) - b2 = QtWidgets.QPushButton("cancelar", self) - b2.clicked.connect(lambda: self.cleanClose()) - - H1layout.addWidget(cotaLbl) - H1layout.addWidget(cota2) - H1layout.addWidget(cotaLbl2) - H1layout.addWidget(cota) - H1layout.addWidget(poscotaLbl) - H1layout.addItem(QtWidgets.QSpacerItem(80, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)) - - H1layout.addWidget(comprLbl) - H1layout.addWidget(compr) - H1layout.addWidget(poscomprLbl) - H1layout.addItem(QtWidgets.QSpacerItem(80, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)) - - H2layout.addWidget(InclLbl) - H2layout.addWidget(Incl) - H2layout.addWidget(posInclLbl) - H2layout.addItem(QtWidgets.QSpacerItem(80, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)) - - H2layout.addWidget(abscissalbl) - H2layout.addWidget(abscissa) - H2layout.addWidget(posabscissaLbl) - H2layout.addItem(QtWidgets.QSpacerItem(80, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)) - - Vlayout.addWidget(label) - Vlayout.addLayout(H1layout) - Vlayout.addLayout(H2layout) - H3layout.addItem(QtWidgets.QSpacerItem(80,20,QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)) - H3layout.addWidget(b1) - H3layout.addWidget(b2) - Vlayout.addLayout(H3layout) - - self.InclText=Incl - self.Incl=100*(h2.pos().y()-h1.pos().y())/(h2.pos().x()-h1.pos().x()) - self.comprText=compr - self.compr=np.sqrt((h2.pos().y()-h1.pos().y())**2+(h2.pos().x()-h1.pos().x())**2) - self.cotaText=cota - self.cotaText2=cota2 - self.cota=h2.pos().y() - self.cotaa=h1.pos().y() - self.abscissaText=abscissa - self.abscissa=h2.pos().x()-h1.pos().x() - cota2.setValue(round(h1.pos().y(), 2)) - #cota2.setDisabled(True) - cota2.setWhatsThis("Cota do ponto anterior ao seguimento") - cota.setWhatsThis("Cota do ponto adjacente ao seguimento") - - Incl.setValue(round(self.Incl,2)) - compr.setValue(round(self.compr,2)) - cota.setValue(round(self.cota,2)) - abscissa.setValue(round(self.abscissa,2)) - - compr.valueChanged.connect(self.updateCompr) - cota.valueChanged.connect(self.updateCota) - cota2.valueChanged.connect(self.updateCota) - abscissa.valueChanged.connect(self.updateAbscissa) - Incl.valueChanged.connect(self.updateIncl) - - self.setWindowModality(QtCore.Qt.ApplicationModal) - self.isBeingModified=False - - - def updateCompr(self): - try: - if not self.isBeingModified: - c=self.compr - self.compr=float(self.comprText.value()) - dc=self.compr-c - Incl = float(np.arctan(self.InclText.value() / 100)) - self.cota=self.cota+np.sin(np.deg2rad(self.Incl))*dc - self.abscissa = np.cos((Incl)) * self.compr - self.update() - self.redefineUI(1) - - except ValueError: - pass - - - - def updateCota(self): - try: - if not self.isBeingModified: - self.cota=float(self.cotaText.value()) - self.cotaa=float(self.cotaText2.value()) - self.update() - self.compr=np.sqrt((self.h2.pos().y()-self.h1.pos().y())**2+(self.h2.pos().x()-self.h1.pos().x())**2) - self.Incl=100*(self.h2.pos().y()-self.h1.pos().y())/(self.h2.pos().x()-self.h1.pos().x()) - self.redefineUI(2) - except ValueError: - pass - - - def updateAbscissa(self): - try: - if not self.isBeingModified: - self.abscissa=float(self.abscissaText.value()) - self.update() - self.compr=np.sqrt((self.h2.pos().y()-self.h1.pos().y())**2+(self.h2.pos().x()-self.h1.pos().x())**2) - self.Incl=100*(self.h2.pos().y()-self.h1.pos().y())/(self.h2.pos().x()-self.h1.pos().x()) - self.redefineUI(3) - except ValueError: - pass - - - def updateIncl(self): - try: - if not self.isBeingModified: - self.Incl=float(np.arctan(self.InclText.value()/100)) - self.cota=np.sin((self.Incl))*self.compr+self.h1.pos().y() - #self.abscissa=np.cos((self.Incl))*self.compr - self.update() - self.compr = np.sqrt((self.h2.pos().y() - self.h1.pos().y()) ** 2 + (self.h2.pos().x() - self.h1.pos().x()) ** 2) - self.redefineUI(4) - except ValueError: - pass - - - def update(self): - - self.h2.setPos(self.abscissa+self.h1.pos().x(), self.cota) - self.h1.setPos(self.h1.pos().x(), self.cotaa) - - if self.firstHandle == self.h2: - self.firstHandle.setPos(self.initialPos[1].x(),self.cota) - self.Incl=100*(self.h2.pos().y()-self.h1.pos().y())/(self.h2.pos().x()-self.h1.pos().x()) - self.compr=np.sqrt((self.h2.pos().y()-self.h1.pos().y())**2+(self.h2.pos().x()-self.h1.pos().x())**2) - self.cota=self.h2.pos().y() - self.abscissa=self.h2.pos().x()-self.h1.pos().x() - self.cotaText.setValue(float(self.cota)) - self.abscissaText.setValue(float(self.abscissa)) - - if self.lastHandle == self.h2: - self.lastHandle.setPos(self.initialPos[1].x(),self.cota) - self.Incl=100*(self.h2.pos().y()-self.h1.pos().y())/(self.h2.pos().x()-self.h1.pos().x()) - self.compr=np.sqrt((self.h2.pos().y()-self.h1.pos().y())**2+(self.h2.pos().x()-self.h1.pos().x())**2) - self.cota=self.h2.pos().y() - self.abscissa=self.h2.pos().x()-self.h1.pos().x() - self.cotaText.setValue(float(self.cota)) - self.abscissaText.setValue(float(self.abscissa)) - - - def redefineUI(self, elm): - self.isBeingModified=True - - if elm==1: - self.cotaText.setValue(float(round(self.cota,2))) - self.abscissaText.setValue(float(round(self.abscissa,2))) - self.InclText.setValue(float(round(self.Incl,2))) - elif elm==2: - self.comprText.setValue(float(round(self.compr,2))) - self.abscissaText.setValue(float(round(self.abscissa,2))) - self.InclText.setValue(float(round(self.Incl,2))) - elif elm==3: - self.comprText.setValue(float(round(self.compr,2))) - self.cotaText.setValue(float(round(self.cota,2))) - self.InclText.setValue(float(round(self.Incl,2))) - elif elm==4: - self.comprText.setValue(float(round(self.compr,2))) - self.cotaText.setValue(float(round(self.cota,2))) - self.abscissaText.setValue(float(round(self.abscissa,2))) - - - self.isBeingModified=False - - - def finishDialog(self): - self.close() - - def cleanClose(self): - self.h2.setPos(self.initialPos[1].x(),self.initialPos[1].y()) - self.h1.setPos(self.initialPos[0].x(),self.initialPos[0].y()) - self.close() - -class ssRampaDialog(rampaDialog): - def __init__(self, roi, segment, pos, cota): - self.ycenter=cota - self.isBeingModified = True - super().__init__(roi, segment, pos) - self.setWindowTitle("Modificar Elemento") - - - def setupUI(self): - r = [] - for handle in self.roi.getHandles(): - r.append(handle) - - self.firstHandle = r[0] - self.lastHandle = r[len(r) - 1] - - H1layout = QtWidgets.QHBoxLayout() - H2layout = QtWidgets.QHBoxLayout() - H3layout = QtWidgets.QHBoxLayout() - Vlayout = QtWidgets.QVBoxLayout(self) - - label = QtWidgets.QLabel("Modificar Rampa") - - Incl=QtWidgets.QDoubleSpinBox() - Incl.setMaximum(99.99) - Incl.setMinimum(-99.99) - Incl.setSingleStep(.05) - compr=QtWidgets.QDoubleSpinBox() - compr.setMaximum(1000000000.0) - compr.setMinimum(0.0) - compr.setSingleStep(.1) - cota=QtWidgets.QDoubleSpinBox() - cota.setMinimum(-10000.0) - cota.setMaximum(10000.0) - cota.setSingleStep(.1) - cota2 = QtWidgets.QDoubleSpinBox() - cota2.setMinimum(-10000.0) - cota2.setMaximum(10000.0) - cota2.setSingleStep(.1) - abscissa=QtWidgets.QDoubleSpinBox() - abscissa.setMaximum(100000.0) - abscissa.setMinimum(-10000.0) - abscissa.setSingleStep(.1) - - InclLbl = QtWidgets.QLabel(u"Inclinação: ") - posInclLbl = QtWidgets.QLabel(u"%") - comprLbl = QtWidgets.QLabel(u"Comprimento: ") - poscomprLbl = QtWidgets.QLabel(u"m") - cotaLbl = QtWidgets.QLabel(u"Cota: ") - poscotaLbl = QtWidgets.QLabel(u"m") - abscissalbl = QtWidgets.QLabel(u"Distância até o eixo") - posabscissaLbl = QtWidgets.QLabel(u"m") - - h1 = self.segment.handles[0]['item'] - h2 = self.segment.handles[1]['item'] - - self.h1 = h1 - self.h2 = h2 - - self.initialPos = [h1.pos(), h2.pos()] - - b1 = QtWidgets.QPushButton("ok", self) - b1.clicked.connect(self.finishDialog) - b2 = QtWidgets.QPushButton("cancelar", self) - b2.clicked.connect(lambda: self.cleanClose()) - - H1layout.addWidget(cotaLbl) - H1layout.addWidget(cota2) - H1layout.addWidget(cota) - H1layout.addWidget(poscotaLbl) - H1layout.addItem(QtWidgets.QSpacerItem(80, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)) - - H1layout.addWidget(comprLbl) - H1layout.addWidget(compr) - H1layout.addWidget(poscomprLbl) - H1layout.addItem(QtWidgets.QSpacerItem(80, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)) - - H2layout.addWidget(InclLbl) - H2layout.addWidget(Incl) - H2layout.addWidget(posInclLbl) - H2layout.addItem(QtWidgets.QSpacerItem(80, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)) - - H2layout.addWidget(abscissalbl) - H2layout.addWidget(abscissa) - H2layout.addWidget(posabscissaLbl) - H2layout.addItem(QtWidgets.QSpacerItem(80, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)) - - Vlayout.addWidget(label) - Vlayout.addLayout(H1layout) - Vlayout.addLayout(H2layout) - H3layout.addItem(QtWidgets.QSpacerItem(80, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)) - H3layout.addWidget(b1) - H3layout.addWidget(b2) - Vlayout.addLayout(H3layout) - - self.InclText = Incl - self.Incl = 100 * (h2.pos().y() - h1.pos().y()) / (h2.pos().x() - h1.pos().x()) - self.comprText = compr - self.compr = np.sqrt((h2.pos().y() - h1.pos().y()) ** 2 + (h2.pos().x() - h1.pos().x()) ** 2) - self.cotaText = cota - self.cota = h2.pos().y() - self.cotaa = h1.pos().y() - self.abscissaText = abscissa - self.abscissa = h2.pos().x() - cota2.setWhatsThis("Cota do ponto anterior ao seguimento") - cota.setWhatsThis("Cota do ponto adjacente ao seguimento") - self.cotaText2 = cota2 - - cota.setValue(float(round(self.cota-self.ycenter, 2))) - abscissa.setValue(float(round(self.abscissa, 2))) - cota2.setValue(round(self.cotaa-self.ycenter,2)) - - compr.valueChanged.connect(self.updateCompr) - cota.valueChanged.connect(self.updateCota) - abscissa.valueChanged.connect(self.updateAbscissa) - Incl.valueChanged.connect(self.updateIncl) - cota2.valueChanged.connect(self.updateCota) - - Incl.setValue(float(round(self.Incl, 2))) - compr.setValue(float(round(self.compr, 2))) - self.setWindowModality(QtCore.Qt.ApplicationModal) - self.isBeingModified = False - - def updateCompr(self): - try: - if not self.isBeingModified: - self.Incl = float(np.arctan(self.InclText.value() / 100)) - c=self.compr - self.compr=float(self.comprText.value()) - dc=self.compr-c - self.cota=self.cota+np.sin(np.deg2rad(self.Incl))*dc - self.abscissa=self.abscissa+np.cos(np.deg2rad(self.Incl))*dc - self.update() - self.redefineUI(1) - - except ValueError: - pass - - - def updateIncl(self): - try: - if not self.isBeingModified: - self.Incl=float(np.arctan(self.InclText.value()/100)) - self.cota=np.sin((self.Incl))*self.compr+self.h1.pos().y() - self.abscissa=np.cos((self.Incl))*self.compr+self.h1.pos().x() - self.update() - self.redefineUI(4) - except ValueError: - pass - - - def updateAbscissa(self): - try: - if not self.isBeingModified: - self.abscissa=float(self.abscissaText.value()) - self.update() - self.compr=np.sqrt((self.h2.pos().y()-self.h1.pos().y())**2+(self.h2.pos().x()-self.h1.pos().x())**2) - self.Incl=100*(self.h2.pos().y()-self.h1.pos().y())/(self.h2.pos().x()-self.h1.pos().x()) - self.redefineUI(3) - except ValueError: - pass - - def updateCota(self): - try: - if not self.isBeingModified: - self.cota=float(self.cotaText.value())+self.ycenter - self.cotaa=float(self.cotaText2.value())+self.ycenter - self.update() - self.compr=np.sqrt((self.h2.pos().y()-self.h1.pos().y())**2+(self.h2.pos().x()-self.h1.pos().x())**2) - self.Incl=100*(self.h2.pos().y()-self.h1.pos().y())/(self.h2.pos().x()-self.h1.pos().x()) - self.redefineUI(2) - except ValueError: - pass - - def redefineUI(self, elm): - self.isBeingModified = True - - if elm == 1: - self.cotaText.setValue(float(round(self.cota-self.ycenter, 2))) - self.abscissaText.setValue(float(round(self.abscissa, 2))) - self.InclText.setValue(float(round(self.Incl, 2))) - elif elm == 2: - self.comprText.setValue(float(round(self.compr, 2))) - self.abscissaText.setValue(float(round(self.abscissa, 2))) - self.InclText.setValue(float(round(self.Incl, 2))) - elif elm == 3: - self.comprText.setValue(float(round(self.compr, 2))) - self.cotaText.setValue(float(round(self.cota-self.ycenter, 2))) - self.InclText.setValue(float(round(self.Incl, 2))) - elif elm == 4: - self.comprText.setValue(float(round(self.compr, 2))) - self.cotaText.setValue(float(round(self.cota-self.ycenter, 2))) - self.abscissaText.setValue(float(round(self.abscissa, 2))) - self.isBeingModified=False - - - def update(self): - - self.h2.setPos(self.abscissa, self.cota) - self.h1.setPos(self.h1.pos().x(), self.cotaa) - - if self.firstHandle == self.h2: - self.firstHandle.setPos(self.initialPos[1].x(),self.cota) - self.Incl=100*(self.h2.pos().y()-self.h1.pos().y())/(self.h2.pos().x()-self.h1.pos().x()) - self.compr=np.sqrt((self.h2.pos().y()-self.h1.pos().y())**2+(self.h2.pos().x()-self.h1.pos().x())**2) - self.cota=self.h2.pos().y() - self.abscissa=self.h2.pos().x() - self.cotaText.setValue(float(self.cota)-self.ycenter) - self.abscissaText.setValue(float(self.abscissa)) - - if self.lastHandle == self.h2: - self.lastHandle.setPos(self.initialPos[1].x(),self.cota) - self.Incl=100*(self.h2.pos().y()-self.h1.pos().y())/(self.h2.pos().x()-self.h1.pos().x()) - self.compr=np.sqrt((self.h2.pos().y()-self.h1.pos().y())**2+(self.h2.pos().x()-self.h1.pos().x())**2) - self.cota=self.h2.pos().y() - self.abscissa=self.h2.pos().x() - self.cotaText.setValue(float(self.cota)-self.ycenter) - self.abscissaText.setValue(float(self.abscissa)) - - - -class brucknerRampaDialog(rampaDialog): - def __init__(self, roi, segment, pos): - super(brucknerRampaDialog, self).__init__(roi, segment, pos) - self.setWindowTitle("Modificar Elemento") - - def setupUI(self): - r = [] - for handle in self.roi.getHandles(): - r.append(handle) - - self.firstHandle = r[0] - self.lastHandle = r[len(r) - 1] - - H1layout = QtWidgets.QHBoxLayout() - H2layout = QtWidgets.QHBoxLayout() - H3layout = QtWidgets.QHBoxLayout() - Vlayout = QtWidgets.QVBoxLayout(self) - - label = QtWidgets.QLabel("Modificar Rampa") - - Incl=QtWidgets.QDoubleSpinBox() - Incl.setMaximum(100.0) - Incl.setMinimum(-100.0) - compr=QtWidgets.QDoubleSpinBox() - compr.setMaximum(1000000000.0) - compr.setMinimum(0.0) - cota=QtWidgets.QDoubleSpinBox() - cota.setMinimum(0.0) - cota.setMaximum(100000000.0) - abscissa=QtWidgets.QDoubleSpinBox() - abscissa.setMaximum(1000000000.0) - abscissa.setMinimum(0.0) - Incl.setSingleStep(.01) - - InclLbl = QtWidgets.QLabel(u"Inclinação: ") - posInclLbl = QtWidgets.QLabel(u"%") - comprLbl = QtWidgets.QLabel(u"Comprimento: ") - poscomprLbl = QtWidgets.QLabel(u"m") - cotaLbl = QtWidgets.QLabel(u"Cota: ") - poscotaLbl = QtWidgets.QLabel(u"m") - abscissalbl = QtWidgets.QLabel(u"Distância até o eixo") - posabscissaLbl = QtWidgets.QLabel(u"m") - - h1 = self.segment.handles[0]['item'] - h2 = self.segment.handles[1]['item'] - - self.h1 = h1 - self.h2 = h2 - - self.initialPos = [h1.pos(), h2.pos()] - - b1 = QtWidgets.QPushButton("ok", self) - b1.clicked.connect(self.finishDialog) - b2 = QtWidgets.QPushButton("cancelar", self) - b2.clicked.connect(lambda: self.cleanClose()) - - H1layout.addWidget(InclLbl) - H1layout.addWidget(Incl) - H1layout.addWidget(posInclLbl) - H1layout.addItem(QtWidgets.QSpacerItem(80, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)) - - H1layout.addWidget(comprLbl) - H1layout.addWidget(compr) - H1layout.addWidget(poscomprLbl) - H1layout.addItem(QtWidgets.QSpacerItem(80, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)) - - H2layout.addWidget(cotaLbl) - H2layout.addWidget(cota) - H2layout.addWidget(poscotaLbl) - H2layout.addItem(QtWidgets.QSpacerItem(80, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)) - - H2layout.addWidget(abscissalbl) - H2layout.addWidget(abscissa) - H2layout.addWidget(posabscissaLbl) - H2layout.addItem(QtWidgets.QSpacerItem(80, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)) - - Vlayout.addWidget(label) - Vlayout.addLayout(H1layout) - Vlayout.addLayout(H2layout) - H3layout.addItem(QtWidgets.QSpacerItem(80, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)) - H3layout.addWidget(b1) - H3layout.addWidget(b2) - Vlayout.addLayout(H3layout) - - self.InclText = Incl - self.Incl = 100 * (h2.pos().y() - h1.pos().y()) / (h2.pos().x() - h1.pos().x()) - self.comprText = compr - self.compr = (h2.pos().x() - h1.pos().x()) - self.cotaText = cota - self.cota = h2.pos().y()/1000000 - self.abscissaText = abscissa - self.abscissa = h2.pos().x() - - Incl.setValue(float(round(self.Incl, 2))) - compr.setValue(float(round(self.compr, 2))) - cota.setValue(float(round(self.cota, 2))) - abscissa.setValue(float(round(self.abscissa, 2))) - - compr.valueChanged.connect(self.updateCompr) - #cota.valueChanged.connect(self.updateCota) - abscissa.valueChanged.connect(self.updateAbscissa) - Incl.valueChanged.connect(self.updateIncl) - - self.setWindowModality(QtCore.Qt.ApplicationModal) - self.isBeingModified = False - - Incl.setDisabled(True) - posabscissaLbl.setText(" m") - poscomprLbl.setText(" m") - cotaLbl.setText(" Eixo") - poscotaLbl.setText(u' 10⁶ m³') - InclLbl.setDisabled(True) - posInclLbl.setDisabled(True) - - self.cotasb=cota - - def updateCompr(self): - try: - if not self.isBeingModified: - c = self.compr - self.compr = round(float(self.comprText.value()), 2) - dc = self.compr - c - self.cota = round(self.cota + np.sin(np.deg2rad(self.Incl)) * dc, 2) - self.abscissa = round(self.abscissa + np.cos(np.deg2rad(self.Incl)) * dc, 2) - self.update() - self.redefineUI(1) - - except ValueError: - pass - - def update(self): - self.h2.setPos(self.abscissa, self.h2.pos().y()) - if self.firstHandle == self.h2: - self.firstHandle.setPos(self.initialPos[1].x(),self.cota) - self.Incl=round(100*(self.h2.pos().y()-self.h1.pos().y())/(self.h2.pos().x()-self.h1.pos().x()) , 2) - self.compr=round(np.sqrt((self.h2.pos().y()-self.h1.pos().y())**2+(self.h2.pos().x()-self.h1.pos().x())**2) , 2) - self.cota=round(self.h2.pos().y(), 2) - self.abscissa=round(self.h2.pos().x(), 2) - self.cotaText.setValue(float(self.cota)) - self.abscissaText.setValue(float(self.abscissa)) - - if self.lastHandle == self.h2: - self.lastHandle.setPos(self.initialPos[1].x(),self.cota) - self.Incl=round(100*(self.h2.pos().y()-self.h1.pos().y())/(self.h2.pos().x()-self.h1.pos().x()), 2) - self.compr=round(np.sqrt((self.h2.pos().y()-self.h1.pos().y())**2+(self.h2.pos().x()-self.h1.pos().x())**2) , 2) - self.cota=round(self.h2.pos().y(), 2) - self.abscissa=round(self.h2.pos().x(), 2) - self.cotaText.setValue(float(self.cota)) - self.abscissaText.setValue(float(self.abscissa)) - - -class cvEdit(QtWidgets.QDialog, VERTICE_EDIT_DIALOG): - def __init__(self, iface): - super(cvEdit, self).__init__(None) - self.iface = iface - self.setupUi(self) - - # self.setFixedSize(self.size()) - - def removeCv(self): - self.groupBox_2.setFlat(True) - self.groupBox_2.setStyleSheet("border:1;") - - self.pushButton.hide() - self.widget1.hide() - self.widget2.hide() - self.widget3.hide() - self.widget4.hide() - self.groupBox_2.setTitle('') - - -class ApplyTransDialog(QtWidgets.QDialog, APLICAR_TRANSVERSAL_DIALOG): - firstCb: QtWidgets.QComboBox - secondCb: QtWidgets.QComboBox - - def __init__(self, iface, prog): - super(ApplyTransDialog, self).__init__(None) - self.iface=iface - self.setupUi(self) - self.progressiva=prog - self.progressivas=[] - self.dist=Config.instance().DIST - self.firstCb.currentIndexChanged.connect(self.setSecondCb) - self.secondCb.currentIndexChanged.connect(self.setIndexes) - self.firstCb.view().setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded) - self.secondCb.view().setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded) - self.setupUi2() - - def setupUi2(self): - d=self.dist - self.firstCb.addItems(list(map(lambda i: fastProg2EstacaStr(i, d), self.progressiva))) - self.setSecondCb() - - def setSecondCb(self): - d=self.dist - self.secondCb.clear() - self.secondCb.addItems(list(map(lambda i: fastProg2EstacaStr(i, d), self.progressiva[self.firstCb.currentIndex():]))) - self.setIndexes() - - def setIndexes(self): - self.progressivas=[self.firstCb.currentIndex(),self.secondCb.currentIndex()] - - -class SetCtAtiDialog(QtWidgets.QDialog, SETCTATI_DIALOG): - firstCb: QtWidgets.QComboBox - secondCb: QtWidgets.QComboBox - - def __init__(self, iface, prog): - super(SetCtAtiDialog, self).__init__(None) - self.iface=iface - self.setupUi(self) - self.roiIndexes=[] - self.firstOptions=[] - self.secondOptions=[] - for i, _ in enumerate(prog): - self.roiIndexes.append(i) - self.firstOptions.append(i+1) - - self.indices=None - self.setupUi2() - self.firstCb.currentIndexChanged.connect(self.setIndexes) - self.secondCb.currentIndexChanged.connect(self.setIndexes) - - def setupUi2(self): - self.firstCb.addItems(list(map(str, self.firstOptions))) - self.secondCb.addItems(list(map(str, self.firstOptions))) - - def setIndexes(self): - self.cti=self.firstCb.currentIndex() - self.ati=self.secondCb.currentIndex() - - -#TODO convert to real scale -class setEscalaDialog(QtWidgets.QDialog, SET_ESCALA_DIALOG): - def __init__(self, iface): - super(setEscalaDialog, self).__init__(None) - self.iface=iface - self.x: QtWidgets.QSpinBox - self.y: QtWidgets.QSpinBox - self.setupUi(self) - self.vb=self.iface.vb - self.x.setValue(1.0) - self.y.setValue(1.0) - self.x.valueChanged.connect(self.changed) - self.y.valueChanged.connect(self.changed) - self.zoomBtn.clicked.connect(self.zoom) - - def getX(self): - return float(self.x.value()) - - def getY(self): - return float(self.y.value()) - - def zoom(self): - self.vb.autoRange() - - def changed(self): - self.zoom() - self.vb.scaleBy((self.getX(), self.getY())) - - -class SelectFeatureDialog(QtWidgets.QDialog, SELECT_FEATURE): - def __init__(self, iface, layer): - super().__init__(None) - self.iface=iface - self.layer=layer - self.setupUi(self) - self.Dialog: QtWidgets.QDialog - self.buttonBox: QtWidgets.QDialogButtonBox - self.checkBox: QtWidgets.QCheckBox - self.groupBox: QtWidgets.QGroupBox - self.tableWidget: QtWidgets.QTableWidget - self.tableWidget.setSelectionBehavior(QAbstractItemView.SelectRows) - self.tableWidget.setSelectionMode(QAbstractItemView.SingleSelection) - self.result=-1 #loop over all - - for feat in layer.getFeatures(): - if self.tableWidget.columnCount()>9: - break - if feat.hasGeometry(): - row = [] - for f in feat.fields(): - row.append(str(f.name()) + ": " + str(feat[f.name()])) - row.append("Comprimento: "+str(feat.geometry().length())) - self.tableWidget.insertRow(self.tableWidget.rowCount()) - k = self.tableWidget.rowCount() - 1 - j=0 - for r in row: - if j>=self.tableWidget.columnCount(): - self.tableWidget.insertColumn(self.tableWidget.columnCount()) - item=QtWidgets.QTableWidgetItem(u"%s" % r) - item.setFlags(item.flags() ^ Qt.ItemIsEditable) - self.tableWidget.setItem(k, j, item) - j+=1 - - self.tableWidget.horizontalHeader().setStretchLastSection(True) - self.tableWidget.cellDoubleClicked.connect(self.accept) - self.tableWidget.selectRow(self.tableWidget.rowCount()-1) - self.tableWidget.setCurrentIndex(self.tableWidget.model().index(self.tableWidget.rowCount()-1,self.tableWidget.columnCount()-1)) - - if self.tableWidget.rowCount()==0: - self.checkBox.setChecked(True) - self.checkBox.setDisabled(True) - self.accept() - else: - self.result=self.tableWidget.rowCount()-1 #feature index - self.tableWidget.itemSelectionChanged.connect(self.updateResult) - self.checkBox.stateChanged.connect(self.check) - - self.checkBox.setChecked(True) - self.checkBox.setFocus() - - def updateResult(self): - self.result=self.tableWidget.currentRow() - g : QgsRectangle - f=0 - for x in self.layer.getFeatures(): - if f==self.result: - g = self.layer.getFeature(self.result).geometry().boundingBox() - break - f+=1 - iface.mapCanvas().setExtent(QgsRectangle(g.xMinimum()-50,g.yMinimum()-50,g.xMaximum()+50,g.yMaximum()+50)) - iface.mapCanvas().refresh() - - def check(self, i): - if i==0: - self.tableWidget.setDisabled(False) - self.updateResult() - else: - self.result=-1 - self.tableWidget.setDisabled(True) - -from qgis.PyQt.QtWidgets import QProgressBar - - -class ProgressDialog():#QtWidgets.QProgressDialog): #, PROGRESS_DIALOG): - - def __init__(self, iface, msg=None, noProgressBar=False): - - self.iface=iface - self.text=None - self.floor=0 - self.stepValue=1 - self.ceiling=100 - self.value=0 - - # self.setupUi(self) -# -# self.Dialog: QtWidgets.QDialog -# self.label: QtWidgets.QLabel -# self.progressBar: QtWidgets.QProgressBar -# -# if not msg is None: -# self.label.setText(str(msg)) -# self.progressBar.setValue(0) -## self.setWindowFlags((self.windowFlags() | Qt.CustomizeWindowHint) & ~Qt.WindowCloseButtonHint) -# -# if noProgressBar: -# self.progressBar.hide() -# self.stepValue=1 - # super(ProgressDialog, self).__init__(iface) - # self.setLabelText(msg) - # self.setWindowTitle("Aguarde") - - - def show(self): - # r=super().forceShow() - # self.setWindowModality(Qt.WindowModal) - # self.setValue(0) - # return r - if self.text==None: - self.text="Carregando" - - self.progressMessageBar = iface.messageBar().createMessage(self.text) - self.progressBar = QProgressBar() - self.progressBar.setMaximum(100) - self.progressBar.setValue(0) - self.progressBar.setAlignment(Qt.AlignLeft | Qt.AlignVCenter) - self.progressMessageBar.layout().addWidget(self.progressBar) - self.iface.messageBar().pushWidget(self.progressMessageBar, Qgis.Info) - - -# def forceShow(self): -# return super(ProgressDialog, self).forceShow() - -# def keyPressEvent(self, a0: QtGui.QKeyEvent): -# if a0.key() != Qt.Key_Escape: -# super().keyPressEvent(a0) -# else: -# self.showMinimized() -# - def setValue(self, f:float): - self.progressBar: QtWidgets.QProgressBar - self.progressBar.setValue(f) - self.floor=f - - def setLoop(self, ceiling, totalSteps, floor=None): - """ - :param ceiling: Onde quero chegar (Startinf point) in range 0-100 - :param totalSteps: Número de passos (Number of loop steps) 0-100 - :param floor: Onde vou partir (Starting value) 0-100 - :return: - """ - if floor is None: - self.floor=self.progressBar.value() - else: - self.floor=floor - self.progressBar.setValue(floor) - self.ceiling=ceiling - self.totalSteps=totalSteps - self.stepValue=(self.ceiling-self.floor)/totalSteps - - def increment(self): - """ - Dá um passo. Útil para ser usada em loop - :return: - """ - self.progressBar: QtWidgets.QProgressBar - self.progressBar.show() - self.value+=self.stepValue - self.setValue(int(min(self.value, self.ceiling))) - # msgLog("Progress bar"+str(self.progressBar.value())) - - def close(self): - self.progressBar.setValue(0) - self.__init__(self.iface) - # return super().close() - self.iface.messageBar().clearWidgets() - - def setText(self, s): - self.text=s - self.textSet=True - try: - if hasattr(self, "progressBar") and self.progressBar.isVisible(): - self.close() - self.show() - except: #C++ runtine error because progressBar was deleted - pass - - - -class EstacaRangeSelect(QtWidgets.QDialog, BRUCKNER_SELECT): - - def __init__(self, iface, estacas, bruck=[]): - super().__init__(iface) - self.iface=iface - self.setupUi(self) - - self.Dialog : QtWidgets.QDialog - self.final_2 : QtWidgets.QComboBox - self.inicial : QtWidgets.QComboBox - self.label : QtWidgets.QLabel - self.label_2 : QtWidgets.QLabel - self.listWidget : QtWidgets.QListWidget - self.btnApagar : QtWidgets.QPushButton - - estacas=[str(e) for e in estacas] - self.inicial.addItems(estacas) - self.inicial.setCurrentIndex(0) - self.final_2.addItems(estacas) - self.final_2.setCurrentIndex(1) - self.inicial.currentIndexChanged.connect(self.change1) - self.final_2.currentIndexChanged.connect(self.change2) - self.inicial.view().setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded) - self.final_2.view().setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded) - - self.ei=float(self.inicial.currentText()) - self.ef=float(self.final_2.currentText()) - self.listWidget.itemClicked.connect(self.itemClick) - self.bruck=bruck - self.fill_list(self.bruck) - self.btnApagar.clicked.connect(self.apagar) - - def apagar(self): - self.listWidget : QtWidgets.QListWidget - for s in self.listWidget.selectedItems(): - self.listWidget.removeItemWidget(s) - del self.bruck[s.text()] - msgLog("Erasing "+str(s.text())) - self.fill_list(self.bruck) - - def itemClick(self, item): - ests=item.text().split("-") - index = self.inicial.findText(ests[0]) - self.inicial.setCurrentIndex(index) - index = self.final_2.findText(ests[1]) - self.final_2.setCurrentIndex(index) - msgLog("Setting range "+str(ests)) - - def change1(self): - self.inicial : QtWidgets.QComboBox - self.final_2 : QtWidgets.QComboBox - if self.inicial.currentIndex() >= self.final_2.currentIndex(): - self.final_2.setCurrentIndex(self.inicial.currentIndex()+1) - - - def change2(self): - self.inicial : QtWidgets.QComboBox - self.final_2 : QtWidgets.QComboBox - if self.final_2.currentIndex() <= self.inicial.currentIndex(): - self.final_2.setCurrentIndex(self.inicial.currentIndex()+1) - - def fill_list(self, data): - self.listWidget : QtWidgets.QListWidget - self.listWidget.clear() - for key in list(data.keys()): - if "-" in key: - self.listWidget.addItem(str(key)) - - -class VolumeDialog(QtWidgets.QDialog, VOLUME_DIALOG): - def __init__(self, iface): - super().__init__(iface) - self.iface = iface - self.setupUi(self) - - def set(self, corte, aterro): - from ..model.utils import roundFloat2str - self.corte: QtWidgets.QLineEdit - self.aterro: QtWidgets.QLineEdit - self.corte.setText(roundFloat2str(corte)) - self.aterro.setText(roundFloat2str(aterro)) - self.soma.setText(roundFloat2str(corte+aterro)) - - - -class CorteExport(QtWidgets.QDialog, EXPORTAR_CORTE): - def __init__(self, iface, maxprog): - super().__init__(iface) - self.iface = iface - self.setupUi(self) - self.ExportarCorte: QtWidgets.QDialog - self.btnPreview: QtWidgets.QPushButton - self.btnSave: QtWidgets.QPushButton - self.buttonBox: QtWidgets.QDialogButtonBox - self.checkBox: QtWidgets.QCheckBox - self.comboBox: QtWidgets.QComboBox - self.espSb: QtWidgets.QDoubleSpinBox - self.finalSb: QtWidgets.QSpinBox - self.inicialSb: QtWidgets.QSpinBox - self.intSp: QtWidgets.QDoubleSpinBox - self.label: QtWidgets.QLabel - self.label_2: QtWidgets.QLabel - self.label_3: QtWidgets.QLabel - self.label_4: QtWidgets.QLabel - self.label_5: QtWidgets.QLabel - self.label_6: QtWidgets.QLabel - self.label_7: QtWidgets.QLabel - self.label_8: QtWidgets.QLabel - self.line: QtWidgets.Line - self.line_2: QtWidgets.Line - self.line_3: QtWidgets.Line - self.planoDb: QtWidgets.QDoubleSpinBox - self.typeLbl: QtWidgets.QLabel - - self.inicialSb.setMaximum(maxprog) - self.finalSb.setMaximum(maxprog) - self.inicialSb.valueChanged.connect(self.finalSb.setMinimum) - self.intSp.valueChanged.connect(self.espSb.setMinimum) - self.espSb.valueChanged.connect(self.offsetSb.setMaximum) - self.btnPreview.setFocus() - - self.comboBox.currentIndexChanged.connect(self.updateUi) - - self.types=["H", "V", "T"] - - def getType(self): - return self.types[self.comboBox.currentIndex()] - - def isEstaca(self): - return self.checkBox.isChecked() - - def updateUi(self): - if self.getType()=="T": - self.inicialSb.setEnabled(True) - self.finalSb.setEnabled(True) - self.espSb.setMaximum(Config.instance().DIST) - elif self.getType()=="V": - self.inicialSb.setEnabled(False) - self.finalSb.setEnabled(False) - self.espSb.setMaximum(10000) - else: #H - self.inicialSb.setEnabled(False) - self.finalSb.setEnabled(False) - self.espSb.setMaximum(10000) +from __future__ import print_function + +import sip +from builtins import range + +import numpy as np +from PyQt5.QtCore import Qt +from qgis.PyQt import QtWidgets, QtGui +from qgis.PyQt import uic +from qgis.PyQt.QtCore import pyqtSignal, QVariant +from qgis.PyQt.QtGui import QKeySequence +from qgis.PyQt.QtWidgets import * +import qgis._core +from qgis._core import QgsCoordinateReferenceSystem +from qgis.core import QgsRectangle, QgsGeometry, QgsVectorLayer, QgsPoint, QgsFeature +from qgis.gui import * +from qgis.utils import * +from qgis.core import QgsProject, QgsCoordinateTransform, QgsPointXY, QgsVectorFileWriter, QgsWkbTypes, QgsField, QgsFields, QgsCoordinateTransformContext + +from ..model.config import Config +from ..model.utils import formatValue, msgLog, prog2estacaStr, p2QgsPoint, fastProg2EstacaStr + + +# -*- coding: utf-8 -*- +sip.setapi('QString',2) +sip.setapi('QVariant',2) + +try: + _fromUtf8 = QtCore.QString.fromUtf8 +except AttributeError: + def _fromUtf8(s): + return s + +try: + _encoding = QtWidgets.QApplication.UnicodeUTF8 + def _translate(context, text, disambig): + return QtWidgets.QApplication.translate(context.encode('utf8'), text.encode('utf8'), disambig, _encoding) +except AttributeError: + def _translate(context, text, disambig): + return QtWidgets.QApplication.translate(context.encode('utf8'), text.encode('utf8'), disambig) + +FORMESTACA1_CLASS, _ = uic.loadUiType(os.path.join( + os.path.dirname(__file__), '../view/ui/Topo_dialog_estacas1.ui')) +FORMGERATRACADO_CLASS, _ = uic.loadUiType(os.path.join( + os.path.dirname(__file__), '../view/ui/Topo_dialog_gera_tracado_1.ui')) +APLICAR_TRANSVERSAL_DIALOG, _ = uic.loadUiType(os.path.join( + os.path.dirname(__file__), '../view/ui/applyTransDiag.ui')) +SETCTATI_DIALOG, _ = uic.loadUiType(os.path.join( + os.path.dirname(__file__), '../view/ui/setTransPtsIndexes.ui')) +VERTICE_EDIT_DIALOG, _ = uic.loadUiType(os.path.join( + os.path.dirname(__file__), '../view/ui/Topo_dialog-cv.ui')) +SET_ESCALA_DIALOG, _ = uic.loadUiType(os.path.join( + os.path.dirname(__file__), '../view/ui/setEscala.ui')) +SELECT_FEATURE, _ = uic.loadUiType(os.path.join( + os.path.dirname(__file__), '../view/ui/selectFeature.ui')) +ESTACAS_DIALOG, _ = uic.loadUiType(os.path.join( + os.path.dirname(__file__), '../view/ui/Topo_dialog_estacas.ui')) +PROGRESS_DIALOG, _ = uic.loadUiType(os.path.join( + os.path.dirname(__file__), '../view/ui/progressBarDialog.ui')) +BRUCKNER_SELECT, _ = uic.loadUiType(os.path.join( + os.path.dirname(__file__), '../view/ui/bruckner_select.ui')) +VOLUME_DIALOG, _ = uic.loadUiType(os.path.join( + os.path.dirname(__file__), '../view/ui/volume.ui')) +EXPORTAR_CORTE,_ = uic.loadUiType(os.path.join( + os.path.dirname(__file__), '../view/ui/cortePreview.ui')) + +rb = QgsRubberBand(iface.mapCanvas(), 1) +premuto = False +point0 = iface.mapCanvas().getCoordinateTransform().toMapCoordinates(0, 0) + + +class PointTool(QgsMapTool): + def __init__(self, canvas, ref, method): + + QgsMapTool.__init__(self, canvas) + self.canvas = canvas + self.estacasUI = ref + self.method = method + self.callback = eval('self.estacasUI.%s'%self.method) + + + + def canvasPressEvent(self, event): + x = event.pos().x() + y = event.pos().y() + self.callback(self.canvas.getCoordinateTransform().toMapCoordinates(x, y)) + + +class CopySelectedCellsAction(QtWidgets.QAction): + def __init__(self, iface, table_widget): + if not isinstance(table_widget, QtWidgets.QTableWidget): + raise ValueError(str('CopySelectedCellsAction must be initialised with a QTableWidget. A %s was given.' % type(table_widget))) + super(CopySelectedCellsAction, self).__init__("Copy", table_widget) + self.setShortcut('Ctrl+C') + s=QShortcut(QKeySequence("Ctrl+C"), iface) + s.activated.connect(self.copy_cells_to_clipboard) + self.triggered.connect(self.copy_cells_to_clipboard) + self.table_widget = table_widget + + def copy_cells_to_clipboard(self): + if len(self.table_widget.selectionModel().selectedIndexes()) > 0: + columnIndex=list(set(index.column() for index in self.table_widget.selectionModel().selectedIndexes())) + rowIndex=list(set(index.row() for index in self.table_widget.selectionModel().selectedIndexes())) + columnIndex.sort() + rowIndex.sort() + nSelectedColumns=len(columnIndex) + nSelectedRows=len(rowIndex) + matx=[[None for a in range(max(columnIndex[-1]-columnIndex[0]+1,nSelectedColumns))] for a in range(max(1+rowIndex[-1]-rowIndex[0],nSelectedRows))] + start=[rowIndex[0],columnIndex[0]] + + for index in self.table_widget.selectionModel().selectedIndexes(): + i=index.row()-start[0] + j=index.column()-start[1] + matx[i][j]=index.data() + + + import numpy as np + final=np.array(matx).transpose() + matx=[] + for col in final: + if any(x is not None for x in col): + matx.append(col) + final=np.array(matx).transpose() + clipboard="" + for row in final: + if not any(x is not None for x in row): + continue + for column in row: + clipboard += str(column if column else "")+'\t' + clipboard += '\n' + + clipboard=clipboard.replace(".", ",") + # copy to the system clipboard + sys_clip = QtWidgets.QApplication.clipboard() + sys_clip.setText(clipboard) + +class reversedSpinBox(QtWidgets.QSpinBox): + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + self.lineEdit().setReadOnly(True) + + def stepBy(self, steps: int): + super().stepBy(-steps) + +class Dialog(QtWidgets.QDialog): + def __init__(self): + QtWidgets.QWidget.__init__(self) + button = QtWidgets.QPushButton('Open Dialog', self) + button.clicked.connect(self.handleOpenDialog) + self.resize(300, 200) + self._dialog = None + + def handleOpenDialog(self): + if self._dialog is None: + self._dialog = QtWidgets.QDialog(self) + self._dialog.resize(200, 100) + self._dialog.show() + + +class GeraTracadoUI(QtWidgets.QDialog,FORMGERATRACADO_CLASS): + def __init__(self, iface): + super(GeraTracadoUI, self).__init__(None) + self.iface = iface + self.setupUi(self) + +class EstacasUI(QtWidgets.QDialog,FORMESTACA1_CLASS): + deleted=QtCore.pyqtSignal() + + def __init__(self, iface): + super(EstacasUI, self).__init__(None) + self.iface = iface + self.setupUi(self) + self.setupUi2(self) + self.points = [] + self.crs = 1 + self.edit = False + self.dialog = QtWidgets.QDialog(None) + self.actual_point = None + self.btnGerarCurvas.hide() + + + def curvasDialog(self, estacas, layer): + coordenadas=[[float(x),float(y)] for y,x in zip([e[3] for e in estacas],[e[4] for e in estacas])].copy() + + + #return estaca,descricao,progressiva,norte,este,cota,azimute + + + def keyPressEvent(self, a0: QtGui.QKeyEvent): + if a0.key() == QtCore.Qt.Key_Delete: + self.deleted.emit() + super(EstacasUI, self).keyPressEvent(a0) + + + def error(self, msg): + msgBox = QtWidgets.QMessageBox(QtWidgets.QMessageBox.Warning, "AVISO", + u"%s" % msg, + QtWidgets.QMessageBox.NoButton, None) + msgBox.addButton("OK", QtWidgets.QMessageBox.AcceptRole) + msgBox.exec_() + + def openCSV(self): + filename = QtWidgets.QFileDialog.getOpenFileName(filter="Arquivo CSV (*.csv)") + if filename in ["", None]: return None + fileDB, ok = QtWidgets.QInputDialog.getText(None, "Nome do arquivo", u"Nome do arquivo a ser salvo no projeto:", text="Traçado csv") + if not ok: + return None + return filename, fileDB + + def new(self,recalcular=False,layerName=None,filename=None, lastIndex=0, ask=True): + mapCanvas = self.iface.mapCanvas() + itens = [] + for i in range(mapCanvas.layerCount() - 1, -1, -1): + try: + layer = mapCanvas.layer(i) + name = layer.name() + itens.append(name) + except: + pass + + if len(itens) == 0: + from ..model.utils import messageDialog + messageDialog(message="Nenhuma layer visível foi encontrada no projeto, por favor adicione alguma.") + return None + + if not filename: + if not recalcular: + filename="" + names=[self.tableEstacas.item(i,1).text() for i in range(self.tableEstacas.rowCount())] + first=True + nomeSugerido="Traçado "+str(lastIndex) + c=0 + while nomeSugerido in names and c<3: + c+=1 + nomeSugerido+="_" + while filename=="" or filename in names: + if not first: + from ..model.utils import messageDialog + messageDialog(self,title="Erro",message="Já existe um arquivo com esse nome") + + filename, ok = QtWidgets.QInputDialog.getText(None, "Nome do arquivo", u"Nome do arquivo:", text=nomeSugerido) + if not ok: + return None + + first=False + else: + filename = '' + + if layerName is not None: + layerList = QgsProject .instance().mapLayersByName(layerName) + layer = None + if layerList: + layer = layerList[-1] + else: + itens = [] + for i in range(mapCanvas.layerCount() - 1, -1, -1): + try: + layer = mapCanvas.layer(i) + layerName = layer.name() + if type(layer) == qgis._core.QgsVectorLayer: + itens.append(layerName) + except: + pass + item, ok = QtWidgets.QInputDialog.getItem(None, "Camada com tracado", u"Selecione a camada com o traçado:", + reversed(itens), + 0, False) + if not(ok) or not(item): + return None + else: + layerList = QgsProject .instance().mapLayersByName(item) + layer = None + if layerList: + layer = layerList[0] + if ask: + dist, ok = QtWidgets.QInputDialog.getDouble(None, "Distancia", u"Distancia entre estacas:", Config.instance().DIST, 1, + 10000, 2) + else: + ok=True + dist=Config.instance().DIST + if not ok or dist<=0: + return None + + if ask: + estaca, ok = QtWidgets.QInputDialog.getInt(None, "Estaca Inicial", u"Estaca Inicial:", 0, 0, 10000000, 2) + else: + ok=True + estaca=0 + if not ok: + return None + return filename, layer, dist, estaca + + def fill_table_index(self, files): + self.tableEstacas : QtWidgets.QTableWidget + self.tableEstacas.setRowCount(0) + self.tableEstacas.clearContents() + for i,f in enumerate(files): + self.tableEstacas.insertRow(self.tableEstacas.rowCount()) + for j,f2 in enumerate(f): + tableItem=QtWidgets.QTableWidgetItem(u"%s" % f2) + tableItem.setFlags(tableItem.flags() ^ Qt.ItemIsEditable) + self.tableEstacas.setItem(i,j,tableItem) + self.tableEstacas.cellDoubleClicked.connect(self.accept) + + + def create_line(self,p1,p2,name): + layer = QgsVectorLayer('LineString?crs=%s'%int(self.crs), name, "memory") + mycrs = QgsCoordinateReferenceSystem(int(self.crs), 0) + self.reprojectgeographic = QgsCoordinateTransform(self.iface.mapCanvas().mapSettings().destinationCrs(), mycrs, QgsCoordinateTransformContext()) + pr = layer.dataProvider() + line = QgsFeature() + line.setGeometry(QgsGeometry.fromPolyline([p2QgsPoint(self.reprojectgeographic.transform(point=QgsPointXY(p1))), p2QgsPoint(self.reprojectgeographic.transform(point=QgsPointXY(p2)))])) + pr.addFeatures([line]) + #layer.setCrs(QgsCoordinateReferenceSystem(int(self.crs), 0)) + layer.updateExtents() + + QgsProject.instance().addMapLayer(layer) + + return p1, p2 + + def create_point(self,p1,name): + layer = QgsVectorLayer('Point?crs=%s'%int(self.crs), name, "memory") + mycrs = QgsCoordinateReferenceSystem(int(self.crs), 0) + self.reprojectgeographic = QgsCoordinateTransform(self.iface.mapCanvas().mapSettings().destinationCrs(), mycrs, QgsCoordinateTransformContext()) + pr = layer.dataProvider() + point = QgsFeature() + point.setGeometry(QgsGeometry.fromPoint(p2QgsPoint(self.reprojectgeographic.transform(point=QgsPointXY(p1))))) + pr.addFeatures([point]) + #layer.setCrs(QgsCoordinateReferenceSystem(int(self.crs), 0)) + layer.updateExtents() + + QgsProject.instance().addMapLayer(layer) + + return p1 + + def drawShapeFileAndLoad(self, crs): + #Creates a shapefile on the given path and triggers the digitizing menu QActions + #For editing and saving the LineString + #This relies on the QActions order on the menu + + fields = QgsFields() + fields.append(QgsField("Tipo", QVariant.String)) + fields.append(QgsField("Descricao", QVariant.String)) + dialog = QtWidgets.QFileDialog() + dialog.setWindowTitle("Caminho para criar arquivo shapefile") + dialog.setDefaultSuffix("shp") + path = QtWidgets.QFileDialog.getSaveFileName(filter="Shapefiles (*.shp)")[0] + + if not path: + return None + + writer = QgsVectorFileWriter(path, 'UTF-8', fields, QgsWkbTypes.MultiLineString, + QgsCoordinateReferenceSystem('EPSG:' + str(crs)), 'ESRI Shapefile') + del writer + self.iface.addVectorLayer(path,"","ogr") + + self.iface.digitizeToolBar().show() + addLineAction = self.iface.digitizeToolBar().actions()[8] + toggleEditAction = self.iface.digitizeToolBar().actions()[1] + if not addLineAction.isChecked(): + toggleEditAction.trigger() + addLineAction.setChecked(True) + addLineAction.trigger() + + + def get_click_coordenate(self,point, mouse): + self.actual_point=p2QgsPoint(point) + if self.tracado_dlg.txtNorthStart.text().strip()=='': + self.tracado_dlg.txtNorthStart.setText("%f"%self.actual_point.y()) + self.tracado_dlg.txtEsteStart.setText("%f"%self.actual_point.x()) + elif self.tracado_dlg.txtNorthEnd.text().strip()=='': + self.tracado_dlg.txtNorthEnd.setText("%f"%self.actual_point.y()) + self.tracado_dlg.txtEsteEnd.setText("%f"%self.actual_point.x()) + + def gera_tracado_pontos(self,inicial=False,final=False,callback_inst=None,callback_method=None,crs=None): + if (not (inicial) and not (final)): + self.callback = eval('callback_inst.%s' % callback_method) + self.crs = crs + self.tracado_dlg_inicial = GeraTracadoUI(self.iface) + self.tracado_dlg_inicial.lblName.setText("Ponto Inicial") + self.tracado_dlg_inicial.btnCapture.clicked.connect(self.capture_point_inicial) + self.tracado_dlg_final = GeraTracadoUI(self.iface) + self.tracado_dlg_final.lblName.setText("Ponto Final") + self.tracado_dlg_final.btnCapture.clicked.connect(self.capture_point_final) + if (not (inicial) and not (final)) or not (final): + ok = self.tracado_dlg_inicial.exec_() + if not (ok): + return None + else: + pn = float(self.tracado_dlg_inicial.txtNorth.text().strip().replace(",", ".")) + pe = float(self.tracado_dlg_inicial.txtEste.text().strip().replace(",", ".")) + self.gera_tracado_ponto_inicial(p2QgsPoint(pe, pn)) + + if (not (inicial) and not (final)) or not (inicial): + ok = self.tracado_dlg_final.exec_() + if not (ok): + return None + else: + pn = float(self.tracado_dlg_final.txtNorth.text().strip().replace(",", ".")) + pe = float(self.tracado_dlg_final.txtEste.text().strip().replace(",", ".")) + self.gera_tracado_ponto_final(p2QgsPoint(pe, pn)) + + if inicial and final: + p1n = float(self.tracado_dlg_inicial.txtNorth.text().strip().replace(",", ".")) + p1e = float(self.tracado_dlg_inicial.txtEste.text().strip().replace(",", ".")) + p2n = float(self.tracado_dlg_final.txtNorth.text().strip().replace(",", ".")) + p2e = float(self.tracado_dlg_final.txtEste.text().strip().replace(",", ".")) + self.iface.mapCanvas().setMapTool(None) + self.callback(pontos=self.create_line(p2QgsPoint(p1e, p1n), p2QgsPoint(p2e, p2n), "Diretriz"), parte=1) + + + + def gera_tracado_ponto_inicial(self,point): + self.tracado_dlg_inicial.txtNorth.setText("%f"%point.y()) + self.tracado_dlg_inicial.txtEste.setText("%f"%point.x()) + ok = self.tracado_dlg_inicial.exec_() + if not(ok): + return None + else: + pn = float(self.tracado_dlg_inicial.txtNorth.text().strip().replace(",",".")) + pe = float(self.tracado_dlg_inicial.txtEste.text().strip().replace(",",".")) + self.gera_tracado_ponto_final(p2QgsPoint(pe, pn)) + + #self.gera_tracado_pontos(inicial=True) + self.gera_tracado_pontos(final=True) + + def gera_tracado_ponto_final(self,point): + self.tracado_dlg_final.txtNorth.setText("%f"%point.y()) + self.tracado_dlg_final.txtEste.setText("%f"%point.x()) + ok = self.tracado_dlg_final.exec_() + if not(ok): + return None + else: + pn = float(self.tracado_dlg_final.txtNorth.text().strip().replace(",",".")) + pe = float(self.tracado_dlg_final.txtEste.text().strip().replace(",",".")) + #self.gera_tracado_ponto_final(p2QgsPoint(pe, pn)) + + #self.gera_tracado_pontos(final=True) + self.gera_tracado_pontos(inicial=True,final=True) + + def capture_point_inicial(self): + tool = PointTool(self.iface.mapCanvas(),self,'gera_tracado_ponto_inicial') + self.iface.mapCanvas().setMapTool(tool) + + def capture_point_final(self): + tool = PointTool(self.iface.mapCanvas(),self,'gera_tracado_ponto_final') + self.iface.mapCanvas().setMapTool(tool) + + + def exit_dialog(self, points, crs): + self.dialog.close() + + layer = QgsVectorLayer('LineString', self.name_tracado, "memory") + pr = layer.dataProvider() + # fix_print_with_import + print(points) + anterior = p2QgsPoint(points[0]) + fets=[] + for p in points[1:]: + fet = QgsFeature(layer.fields()) + fet.setGeometry(QgsGeometry.fromPolyline([anterior, p2QgsPoint(p)])) + fets.append(fet) + anterior = p2QgsPoint(p) + pr.addFeatures(fets) + self.crs = crs + layer.setCrs(QgsCoordinateReferenceSystem(int(crs), 0)) + layer.updateExtents() + + QgsProject.instance().addMapLayer(layer) + + def gera_tracado_vertices(self,pointerEmitter): + self.iface.mapCanvas().setMapTool(pointerEmitter) + self.name_tracado = "TracadoNovo" + self.dialog.resize(200, 100) + self.dialog.setWindowTitle(u"Traçado") + self.dialog.btnClose = QtWidgets.QPushButton("Terminar",self.dialog) + self.dialog.show() + return self.name_tracado + + def setupUi2(self,Form): + Form.setObjectName(_fromUtf8(u"Traçado Horizontal")) + self.tableEstacas : QtWidgets.QTableWidget + self.tableEstacas.setColumnCount(3) + self.tableEstacas.setRowCount(0) + self.tableEstacas.setSelectionBehavior(QAbstractItemView.SelectRows) + self.tableEstacas.setHorizontalHeaderLabels((u"ID",u"Arquivo",u"Data de criação")) + + + + self.table=self.tableEstacas + self.table.horizontalHeader().setSectionResizeMode(QtWidgets.QHeaderView.Interactive) + self.table.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) + self.table.horizontalHeader().setStretchLastSection(True) + self.stretchTable(self.table) + + def resizeEvent(self, event): + self.stretchTable(self.table) + super(EstacasUI, self).resizeEvent(event) # Restores the original behaviour of the resize event + + def stretchTable(self, table): + tableSize = table.width() + sideHeaderWidth = table.verticalHeader().width() + tableSize -= sideHeaderWidth + numberOfColumns = table.columnCount() + + remainingWidth = tableSize % numberOfColumns + for columnNum in range(table.columnCount()): + if remainingWidth > 0: + table.setColumnWidth(columnNum, int(tableSize / numberOfColumns) + 1) + remainingWidth -= 1 + else: + table.setColumnWidth(columnNum, int(tableSize / numberOfColumns)) + + def exec_(self): + self.tableEstacas: QtWidgets.QTableWidget + self.stretchTable(self.table) + self.tableEstacas.selectRow(0) + self.checkButtons() + return super(EstacasUI, self).exec_() + + def checkButtons(self): + if self.tableEstacas.rowCount() == 0: + self.btnOpen.setEnabled(False) + self.btnOpenCv.setEnabled(False) + else: + self.btnOpen.setEnabled(True) + self.btnOpenCv.setEnabled(True) + + +class EstacasIntersec(QtWidgets.QDialog): + def __init__(self,iface): + super(EstacasIntersec, self).__init__(None) + self.iface = iface + self.setupUi(self) + + def clear(self): + self.tableWidget.setRowCount(0) + self.tableWidget.clearContents() + + def saveEstacasCSV(self): + filename = QtWidgets.QFileDialog.getSaveFileName() + return filename + + def fill_table(self, xxx_todo_changeme,f=False): + (estaca,descricao,progressiva,cota) = xxx_todo_changeme + self.tableWidget.insertRow(self.tableWidget.rowCount()) + k = self.tableWidget.rowCount() - 1 + self.tableWidget.setItem(k, 0, QtWidgets.QTableWidgetItem(u"%s" % estaca)) + self.tableWidget.setItem(k, 1, QtWidgets.QTableWidgetItem(u"%s" % descricao)) + self.tableWidget.setItem(k, 2, QtWidgets.QTableWidgetItem(u"%s" % progressiva)) + self.tableWidget.setItem(k, 3, QtWidgets.QTableWidgetItem(u"%s" % cota)) + '''if not f: + naz = decdeg2dms(azimute) + str_az = "%s* %s\' %s\'\'" % (int(naz[0]), int(naz[1]), naz[2]) + self.tableWidget.setItem(k, 6, QtWidgets.QTableWidgetItem(str_az)) + else:''' + + + def get_estacas(self): + estacas = [] + for i in range(self.tableWidget.rowCount()): + estaca = [] + for j in range(self.tableWidget.columnCount()): + estaca.append(self.tableWidget.item(i,j).text()) + estacas.append(estaca) + return estacas + + + def setupUi(self, Form): + Form.setObjectName(_fromUtf8(u"Traçado Horizontal")) + Form.resize(919, 510) + self.tableWidget = QtWidgets.QTableWidget(Form) + self.tableWidget.setGeometry(QtCore.QRect(0, 0, 750, 511)) + self.tableWidget.setObjectName(_fromUtf8("tableWidget")) + self.modelSource = self.tableWidget.model() + + + self.tableWidget.setColumnCount(8) + self.tableWidget.setRowCount(0) + self.tableWidget.setHorizontalHeaderLabels((u"Estaca",u"Descrição",u"Progressiva",u"Cota", u"Relevo", u"Norte",u"Este",u"Azimute")) + + + self.btnGen = QtWidgets.QPushButton(Form) + self.btnGen.setText("Tabela de Verticais") + self.btnGen.setGeometry(QtCore.QRect(755, 16, 180, 45)) + self.btnGen.setObjectName(_fromUtf8("btnGen")) + #self.btnGen.clicked.connect(self.generate) + + self.btnTrans = QtWidgets.QPushButton(Form) + self.btnTrans.setText("Definir Seção Tipo") + self.btnTrans.setGeometry(QtCore.QRect(760, 50+16, 160, 30)) + self.btnTrans.setObjectName(_fromUtf8("btnTrans")) + #self.btnEstacas.clicked.connect(self.ref_super.tracado) + + self.btnPrint = QtWidgets.QPushButton(Form) + self.btnPrint.setText("Imprimir") + self.btnPrint.setGeometry(QtCore.QRect(760, 16 + 34 * 6, 160, 30)) + self.btnPrint.setObjectName(_fromUtf8("btnPrint")) + #self.btnEstacas.clicked.connect(self.ref_super.tracado) + + self.btnClean = QtWidgets.QPushButton(Form) + self.btnClean.setText("Apagar Dados") + self.btnClean.setGeometry(QtCore.QRect(760, 16 + 34 * 7, 160, 30)) + self.btnClean.setObjectName(_fromUtf8("btnClean")) + + + self.retranslateUi(Form) + QtCore.QMetaObject.connectSlotsByName(Form) + + + + def retranslateUi(self, Form): + Form.setWindowTitle(_translate("Traçado Horizontal", "Traçado Vertical", None)) + + +class EstacasCv(QtWidgets.QDialog): + layerUpdated=pyqtSignal() + + def __init__(self,iface, parent): + super(EstacasCv, self).__init__(None) + self.mode="N" + self.iface = iface + self.parent = parent + self.setupUi(self) + self.location_on_the_screen() + + + self.spinBox: QtWidgets.QSpinBox + self.spinBox.hide() + self.comboBox: QtWidgets.QComboBox + self.comboBox.currentTextChanged.connect(self.search) + self.comboBox.view().setVerticalScrollBarPolicy(Qt.ScrollBarAsNeeded) + self.spinBox.valueChanged.connect(self.changeSearchResult) + self.searchResults=[] + self.curvaLayers=[] + + def changeSearchResult(self, i): + if i==0 or i==len(self.searchResults)+1: + self.spinBox.valueChanged.disconnect() + self.spinBox.setValue(i+1 if i==0 else i-1) + self.spinBox.valueChanged.connect(self.changeSearchResult) + return + + if len(self.searchResults)>0: + columnIndexes = list(set(index.column() + for index in self.tableWidget.selectionModel().selectedIndexes())) + row=self.searchResults[i-1] + + if len(columnIndexes)==0: + self.tableWidget.setRangeSelected( + QTableWidgetSelectionRange(row, 0, row, self.tableWidget.columnCount()-1), True) + self.tableWidget.setCurrentCell(row,0) + else: + for i in columnIndexes: + self.tableWidget.setRangeSelected( + QTableWidgetSelectionRange(row, i, row, i), True) + self.tableWidget.setCurrentCell(row, columnIndexes[0]) + + def search(self, txt): + self.searchResults=[] + columnIndexes = list(set(index.column() + for index in self.tableWidget.selectionModel().selectedIndexes())) + def searchRange(estaca, columnIndexes): + if len(columnIndexes)>0: + estaca=[estaca[i] for i in columnIndexes] + return "* ".join(estaca) + + for i, estaca in enumerate(self.get_estacas()): + if txt.upper() in searchRange(estaca, columnIndexes).upper(): + self.searchResults.append(i) + lres=len(self.searchResults) + if lres>1: + self.spinBox.show() + self.spinBox.setMaximum(lres+1) + else: + self.spinBox.hide() + self.changeSearchResult(1) + self.spinBox.setValue(1) + + + + def location_on_the_screen(self): + screen = QDesktopWidget().screenGeometry() + widget = self.geometry() + x = 0#widget.width() + y = (screen.height()-widget.height())/2 + self.move(x, y) + + def clear(self): + self.tableWidget.setRowCount(0) + self.tableWidget.clearContents() + self.comboBox.clear() + + def setIntersect(self): + if hasattr(self, "mode") and self.mode=="T": + return + self.clear() + self.tableWidget.setColumnCount(8) + self.tableWidget.setRowCount(0) + self.tableWidget.setHorizontalHeaderLabels((u"Estaca",u"Descrição",u"Progressiva",u"Norte",u"Este",u"Greide",u"Cota",u"Azimute")) + try: + self.btnGen.clicked.disconnect() + except: + pass + self.tableWidget.cellClicked.connect(self.zoom) + self.btnGen.setText("Tabela de verticais") + self.btnCorte.setText("Exportar Traçado") + self.btnCorte.setToolTip("Exportar curvas de nível do traçado como um arquivo dxf") + self.mode="T" + self.stretchTable() + + + def setCv(self): + if hasattr(self, "mode") and self.mode=="CV": + return + self.clear() + self.tableWidget.setColumnCount(4) + self.tableWidget.setRowCount(0) + try: + self.tableWidget.cellClicked.disconnect() + except: + pass + self.tableWidget.setHorizontalHeaderLabels((u"Estaca",u"Descrição",u"Progressiva",u"Greide")) + self.btnGen.setText("Tabela de Interseção") + self.btnCorte.setText("Exportar Greide") + self.btnCorte.setToolTip("Exportar o greide e o terreno do traçado como um arquivo dxf") + self.mode="CV" + self.stretchTable() + + + def saveEstacasCSV(self): + filename = QtWidgets.QFileDialog.getSaveFileName() + return filename + + + def fill_table(self, estaca, f=False): + try: + self.comboBox.currentTextChanged.disconnect(self.search) + except: + pass + self.tableWidget.insertRow(self.tableWidget.rowCount()) + k = self.tableWidget.rowCount() - 1 + j = 0 + for value in list(estaca): + cell_item = QtWidgets.QTableWidgetItem(u"%s" % formatValue(value)) + cell_item.setFlags(cell_item.flags() ^ Qt.ItemIsEditable) + self.tableWidget.setItem(k, j, cell_item) + j += 1 + + if len(estaca[1]) != 0 and not (estaca[1] in [self.comboBox.itemText(i) + for i in range(self.comboBox.count())]): + self.comboBox.addItem(estaca[1]) + self.comboBox.currentTextChanged.connect(self.search) + + def get_estacas(self): + estacas = [] + for i in range(self.tableWidget.rowCount()): + estaca = [] + for j in range(self.tableWidget.columnCount()): + estaca.append(self.tableWidget.item(i,j).text()) + estacas.append(estaca) + return estacas + + def getEstacas(self): + for i in range(self.tableWidget.rowCount()): + estaca = [] + for j in range(self.tableWidget.columnCount()): + estaca.append(self.tableWidget.item(i,j).text()) + yield estaca + + + def setupUi(self, Form): + Form.setObjectName(_fromUtf8(u"Traçado Horizontal")) + Form.resize(919, 510) + self.tableWidget = QtWidgets.QTableWidget(Form) + self.gridLayout = QtWidgets.QGridLayout(Form) + self.gridLayout.setObjectName("gridLayout") + self.gridLayout.setColumnStretch(0, 4) +# self.gridLayout.setRowStretch(1,3) + + self.tableWidget.setGeometry(QtCore.QRect(0, 0, 750, 511)) + self.tableWidget.setObjectName(_fromUtf8("tableWidget")) + self.modelSource = self.tableWidget.model() + + column=1 + row=0 + + self.btnRecalcular = QtWidgets.QPushButton(Form) + self.btnRecalcular.setText("Recalcular") + self.btnRecalcular.setGeometry(QtCore.QRect(760, 16 + 34 * 7, 160, 30)) + self.btnRecalcular.setWhatsThis("Recalcula a tabela em vista \n A tabela vertical deve" + " ser calculada antes da de interseção para que as mudanças se " + "apliquem corretamente") + self.btnRecalcular.setObjectName(_fromUtf8("btnRecalcular")) + self.gridLayout.addWidget(self.btnRecalcular, row, column, 1, 1) + row+=1 + + self.btnPerfil = QtWidgets.QPushButton(Form) + self.btnPerfil.setText("Gerar Perfil \nLongitudinal") + self.btnPerfil.setGeometry(QtCore.QRect(760, 16 + 34 * 7, 160, 30)) + self.btnPerfil.setWhatsThis("Define o greide") + self.btnPerfil.setToolTip("Define o Greide") + self.btnPerfil.setObjectName(_fromUtf8("btnPerfil")) + self.gridLayout.addWidget(self.btnPerfil, row, column, 1, 1) + row+=1 + self.btnPerfil.hide() + + self.btnGen = QtWidgets.QPushButton(Form) + self.btnGen.setText("Tabela de interseção") + self.btnGen.setGeometry(QtCore.QRect(755, 16, 180, 45)) + self.btnGen.setObjectName(_fromUtf8("btnGen")) + self.gridLayout.addWidget(self.btnGen, row, column, 1,1) + self.btnGen.setToolTip("Tabela contendo os dados horizonais e verticais") + #self.btnGen.clicked.connect(self.generate) + row+=1 + + self.btnTrans = QtWidgets.QPushButton(Form) + self.btnTrans.setText("Definir Seção Tipo") + self.btnTrans.setGeometry(QtCore.QRect(760, 50+16, 160, 30)) + self.btnTrans.setObjectName(_fromUtf8("btnTrans")) + self.btnTrans.setToolTip("Inicia interface para a edição do perfil transversal") + #self.btnEstacas.clicked.connect(self.ref_super.tracado) + + self.gridLayout.addWidget(self.btnTrans, row, column, 1,1) + row+=1 + + self.btnBruck = QtWidgets.QPushButton(Form) + self.btnBruck.setText("Diagrama de Bruckner") + self.btnBruck.setGeometry(QtCore.QRect(760, 16 + 34 * 6, 160, 30)) + self.btnBruck.setObjectName(_fromUtf8("btnBruck")) + #self.btnEstacas.clicked.connect(self.ref_super.tracado) + self.btnBruck.setToolTip("Visualizar e editar o diagrama de bruckner para um intervalo de estacas") + self.gridLayout.addWidget(self.btnBruck, row, column, 1, 1) + row+=3 + + self.btnCsv = QtWidgets.QPushButton(Form) + self.btnCsv.setText("Exportar Tabela CSV") + self.btnCsv.setGeometry(QtCore.QRect(760, 16 + 34 * 6, 160, 30)) + self.btnCsv.setObjectName(_fromUtf8("btnCsv")) + #self.btnEstacas.clicked.connect(self.ref_super.tracado) + self.btnCsv.setToolTip("Exportar a tabela em visualização para um arquivo csv") + self.gridLayout.addWidget(self.btnCsv, row, column, 1,1) + row+=1 + + self.btnCorte = QtWidgets.QPushButton(Form) + self.btnCorte.setText("Exportar Greide") + self.btnCorte.setGeometry(QtCore.QRect(760, 16 + 34 * 6, 160, 30)) + self.btnCorte.setObjectName(_fromUtf8("btnCorte")) + #self.btnEstacas.clicked.connect(self.ref_super.tracado) + self.btnCorte.setToolTip("Exportar o greide e o terreno do traçado como um arquivo dxf") + self.gridLayout.addWidget(self.btnCorte, row, column, 1,1) + row+=1 + + self.btnCrossSectionExport = QtWidgets.QPushButton(Form) + self.btnCrossSectionExport.setText("Exportar Transversais") + self.btnCrossSectionExport.setGeometry(QtCore.QRect(760, 16 + 34 * 6, 160, 30)) + self.btnCrossSectionExport.setObjectName(_fromUtf8("btnCrossSectionExport")) + self.btnCrossSectionExport.setToolTip("Extportar os contornos dos perfis transversais e verticais como um arquivo CAD dxf") + #self.btnEstacas.clicked.connect(self.ref_super.tracado) + self.gridLayout.addWidget(self.btnCrossSectionExport, row, column, 1,1) + row+=1 + + self.btn3DView = QtWidgets.QPushButton(Form) + self.btn3DView.setText("Visualizar Modelo") + self.btn3DView.setToolTip("Visualiza o modelo tridimensional em uma estaca") + self.btn3DView.setGeometry(QtCore.QRect(760, 16 + 34 * 7, 160, 30)) + self.btn3DView.setObjectName(_fromUtf8("btn3DView")) + self.gridLayout.addWidget(self.btn3DView, row, column, 1, 1) + row+=1 + + self.btn3D = QtWidgets.QPushButton(Form) + self.btn3D.setText("Exportar Modelo") + self.btn3D.setGeometry(QtCore.QRect(760, 16 + 34 * 6, 160, 30)) + self.btn3D.setObjectName(_fromUtf8("btn3D")) + toolTip = "

Exportar um modelo tridimensional do projeto como um arquivo de malha triangular." \ + "Se o blender (https://www.blender.org/) estiver instalado no sistema uma animação percorrendo " \ + "o traçado pode ser gerada automaticamente" \ + "

" + + self.btn3D.setToolTip(toolTip) + self.btn3D.setWhatsThis(toolTip) + # self.btnEstacas.clicked.connect(self.ref_super.tracado) + self.gridLayout.addWidget(self.btn3D, row, column, 1, 1) + row += 1 + + + self.btnClean = QtWidgets.QPushButton(Form) + self.btnClean.setText("Apagar Dados Transversais") + self.btnClean.setGeometry(QtCore.QRect(760, 16 + 34 * 7, 160, 30)) + self.btnClean.setObjectName(_fromUtf8("btnClean")) + self.gridLayout.addWidget(self.btnClean, row, column, 1, 1) + self.btnClean.hide() + row+=3 + + self.labelProcurar = QtWidgets.QLabel(Form) + self.labelProcurar.setText("Procurar: ") + self.labelProcurar.setGeometry(QtCore.QRect(760, 16 + 34 * 7, 160, 30)) + self.labelProcurar.setObjectName(_fromUtf8("labelProcurar")) + self.gridLayout.addWidget(self.labelProcurar, row, column, 1, 1) + row+=1 + + self.hor=QtWidgets.QHBoxLayout(Form) + self.hor.setGeometry(QtCore.QRect(760, 16 + 34 * 7, 160, 30)) + self.hor.setObjectName(_fromUtf8("hor")) + self.comboBox=QtWidgets.QComboBox(Form) + self.comboBox.setEditable(True) + self.spinBox=reversedSpinBox(Form) + self.spinBox.setMinimum(0) + self.hor.addWidget(self.comboBox) + self.hor.addWidget(self.spinBox) + self.gridLayout.addLayout(self.hor, row, column, 1, 1) + row+=1 + + self.labelComp = QtWidgets.QLabel(Form) + self.labelComp.setText("Comprimento total: ") + self.labelComp.setGeometry(QtCore.QRect(760, 16 + 34 * 7, 160, 30)) + self.labelComp.setObjectName(_fromUtf8("labelComp")) + self.gridLayout.addWidget(self.labelComp, row, column, 1, 1) + row+=1 + + self.comprimento = QtWidgets.QLineEdit(Form) + self.comprimento.setGeometry(QtCore.QRect(760, 16 + 34 * 7, 160, 30)) + self.comprimento.setObjectName(_fromUtf8("comprimento")) + self.comprimento.setReadOnly(True) + self.comprimento.setWhatsThis(u"Comprimento total do traçado (considerando a profundidade do greide)") + self.gridLayout.addWidget(self.comprimento, row, column, 1, 1) + + self.gridLayout.addWidget(self.tableWidget, 0, 0, row+1, 1) + self.retranslateUi(Form) + QtCore.QMetaObject.connectSlotsByName(Form) + self.setCv() + self.Form=Form + + self.table : QtWidgets.QTableWidget + self.table=self.tableWidget + self.table.horizontalHeader().setSectionResizeMode(QtWidgets.QHeaderView.Interactive) + self.table.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) + self.table.horizontalHeader().setStretchLastSection(True) + + self.stretchTable() + self.setCopy() + self.point=False + + def setCopy(self): + if not hasattr(self, "copyAction"): + self.copyAction=CopySelectedCellsAction(self, self.table) + + def resizeEvent(self, event): + self.stretchTable() + super().resizeEvent(event) # Restores the original behaviour of the resize event + + def stretchTable(self): + table=self.tableWidget + tableSize = table.width() + sideHeaderWidth = table.verticalHeader().width() + tableSize -= sideHeaderWidth + numberOfColumns = table.columnCount() + + remainingWidth = tableSize % numberOfColumns + for columnNum in range(table.columnCount()): + if remainingWidth > 0: + table.setColumnWidth(columnNum, int(tableSize / numberOfColumns) + 1) + remainingWidth -= 1 + else: + table.setColumnWidth(columnNum, int(tableSize / numberOfColumns)) + + def retranslateUi(self, Form): + Form.setWindowTitle(_translate("Traçado Horizontal", "Traçado Vertical", None)) + + + + def openLayers(self): + self.closeLayers() + self.parent.model.iface = self.iface + l = self.parent.model.getSavedLayers(self.windowTitle().split(":")[0]) + if l: + l.setName("Curvas: " + l.name()) + l.startEditing() + self.curvaLayers.append(l) + l.layerModified.connect(lambda: self.add_row(l)) + self.parent.iface.setActiveLayer(l) + + l.renderer().symbol().setWidth(.5) + l.renderer().symbol().setColor(QtGui.QColor("#be0c21")) + l.triggerRepaint() + + if len([a for a in l.getFeatures()]): + self.parent.iface.mapCanvas().setExtent(l.extent()) + + def add_row(self, l): + self.layer = l + self.layerUpdated.emit() + + def closeLayers(self): + for l in self.curvaLayers: + lyr=l + name=lyr.name() + try: + l.commitChanges() + l.endEditCommand() + path=l.dataProvider().dataSourceUri() + QgsProject.instance().removeMapLayer(l.id()) + self.parent.model.saveLayer(path) + del l + except Exception as e: + try: + msgLog("Erro: "+str(e)+" ao remover layer "+name) + del l + except Exception as ee: + msgLog("Erro: " + str(e) +" _&_ "+ str(ee)) + + self.curvaLayers=[] + + def reject(self): + try: + self.closeLayers() + self.setWindowTitle(": Horizontal") + except: + pass + + self.removePoint() + self.comboBox.clear() + return super(EstacasCv, self).reject() + + def close(self): + self.removePoint() + self.comboBox.clear() + return super(EstacasCv, self).close() + + def accept(self): + try: + self.closeLayers() + self.setWindowTitle(": Horizontal") + except: + pass + + self.removePoint() + self.comboBox.clear() + return super(EstacasCv, self).accept() + + def removePoint(self): + root = QgsProject.instance() + try: + if self.point: + root.removeMapLayer(self.point) + except RuntimeError as e: + pass#Duplicado + from ..model.helper.qgsgeometry import refreshCanvas + refreshCanvas(self.iface) + + def zoom(self, row, column): + root = QgsProject.instance() + try: + if self.point: + root.removeMapLayer(self.point) + except RuntimeError as e: + pass#Duplicado + + #ZOOM + scale = 100 + table=self.tableWidget + e, x, y = table.item(row,0).text(), float(table.item(row,4).text()), float(table.item(row,3).text()) + point = QgsPointXY(x,y) + rect = QgsRectangle(x - scale, y - scale, x + scale, y + scale) + self.iface.mapCanvas().setExtent(rect) + self.iface.mapCanvas().refresh() + + + #ADD Point Layer + layer = QgsVectorLayer("Point?crs=%s"%(root.crs().authid()), "Estaca: "+str(e),"memory") + layer.setCrs(root.crs()) + prov = layer.dataProvider() + feat = QgsFeature() + feat.setGeometry(QgsGeometry.fromPointXY(point)) + prov.addFeatures([feat]) + root.addMapLayer(layer, False) + QgsProject.instance().layerTreeRoot().insertLayer(0, layer) + self.point=layer + + def exec_(self): + self.point=False + self.setCopy() + self.stretchTable() + name=self.parent.model.getNameFromId(self.parent.model.id_filename) + self.setWindowTitle(name + ": Vertical") + self.openLayers() + return super().exec_() + + + +class Estacas(QtWidgets.QDialog, ESTACAS_DIALOG): + + layerUpdated=pyqtSignal() + + def __init__(self,iface, parent): + super().__init__(None) + self.parent=parent + self.iface = iface + self.type="horizontal" + self.setupUi(self) + self.curvaLayers=[] + self.empty=True + self.location_on_the_screen() + #self.btnPerfil.hide() + + self.spinBox: QtWidgets.QSpinBox + self.horizontalLayout: QtWidgets.QHBoxLayout + sp=reversedSpinBox() + self.horizontalLayout.addWidget(sp) + self.spinBox=sp + self.spinBox.setMinimum(0) + self.spinBox.hide() + self.comboBox: QtWidgets.QComboBox + self.comboBox.currentIndexChanged.connect(lambda: + self.tableWidget.setRangeSelected( + QTableWidgetSelectionRange(0, 0, 0, self.tableWidget.columnCount() - 1), True) + ) + self.comboBox.currentTextChanged.connect(self.search) + self.comboBox.view().setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded) + self.spinBox.valueChanged.connect(self.changeSearchResult) + self.searchResults = [] + self.btnDuplicar.hide() + + + def changeSearchResult(self, i): + if i == 0 or i == len(self.searchResults) + 1: + self.spinBox.valueChanged.disconnect() + self.spinBox.setValue(i + 1 if i == 0 else i - 1) + self.spinBox.valueChanged.connect(self.changeSearchResult) + return + + if len(self.searchResults) > 0: + columnIndexes = list(set(index.column() + for index in self.tableWidget.selectionModel().selectedIndexes())) + row = self.searchResults[i - 1] + + if len(columnIndexes) == 0: + self.tableWidget.setRangeSelected( + QTableWidgetSelectionRange(row, 0, row, self.tableWidget.columnCount() - 1), True) + self.tableWidget.setCurrentCell(row, 0) + else: + for i in columnIndexes: + self.tableWidget.setRangeSelected( + QTableWidgetSelectionRange(row, i, row, i), True) + self.tableWidget.setCurrentCell(row, columnIndexes[0]) + + def search(self, txt): + self.searchResults = [] + columnIndexes = list(set(index.column() + for index in self.tableWidget.selectionModel().selectedIndexes())) + + def searchRange(estaca, columnIndexes): + if len(columnIndexes) > 0: + estaca = [estaca[i] for i in columnIndexes] + return "* ".join(estaca) + + for i, estaca in enumerate(self.get_estacas()): + if txt.upper() in searchRange(estaca, columnIndexes).upper(): + self.searchResults.append(i) + lres = len(self.searchResults) + if lres > 1: + self.spinBox.show() + self.spinBox.setMaximum(lres + 1) + else: + self.spinBox.hide() + self.changeSearchResult(1) + self.spinBox.setValue(1) + + + def location_on_the_screen(self): + screen = QDesktopWidget().screenGeometry() + widget = self.geometry() + x = 0#widget.width() + y = (screen.height()-widget.height())/2 + self.move(x, y) + + def clear(self): + self.tableWidget.setRowCount(0) + self.tableWidget.clearContents() + self.comboBox.clear() + + def saveEstacasCSV(self): + filename = QtWidgets.QFileDialog.getSaveFileName(caption="Save Worksheet",filter="Arquivo CSV (*.csv)") + return filename + + + def fill_table(self, estaca,f=False): + self.comboBox.currentTextChanged.disconnect(self.search) + self.tableWidget.insertRow(self.tableWidget.rowCount()) + k = self.tableWidget.rowCount() - 1 + j=0 + for value in list(estaca): + cell_item = QtWidgets.QTableWidgetItem(u"%s" % formatValue(value)) + cell_item.setFlags(cell_item.flags() ^ Qt.ItemIsEditable) + self.tableWidget.setItem(k,j,cell_item) + j+=1 + + if len(estaca[1])!=0 and not (estaca[1] in [self.comboBox.itemText(i) + for i in range(self.comboBox.count())]): + self.comboBox.addItem(estaca[1]) + self.comboBox.currentTextChanged.connect(self.search) + + def get_estacas(self): + estacas = [] + for i in range(self.tableWidget.rowCount()): + estaca = [] + for j in range(self.tableWidget.columnCount()): + estaca.append(self.tableWidget.item(i,j).text()) + estacas.append(estaca) + return estacas + + def plotar(self): + vl = QgsVectorLayer("Point", "temporary_points", "memory") + pr = vl.dataProvider() + + # Enter editing mode + vl.startEditing() + + # add fields + pr.addAttributes([QgsField("estaca", QVariant.String), QgsField("descrição", QVariant.String), + QgsField("north", QVariant.String), QgsField("este", QVariant.String), + QgsField("cota", QVariant.String), QgsField("azimite", QVariant.String)]) + fets = [] + + for r in range(self.tableWidget.rowCount()): + ident = self.tableWidget.item(r, 0).text() + if ident in ["", None]: break + fet = QgsFeature(vl.pendingFields()) + n = 0.0 + e = 0.0 + try: + es = self.tableWidget.item(r, 0).text() + d = self.tableWidget.item(r, 1).text() + n = float(self.tableWidget.item(r, 3).text()) + e = float(self.tableWidget.item(r, 4).text()) + c = float(self.tableWidget.item(r, 5).text()) + a = self.tableWidget.item(r, 6).text() + except: + break + fet.setGeometry(QgsGeometry.fromPoint(p2QgsPoint(e, n))) + fet.setAttributes([es, d, n, e, c, a]) + fets.append(fet) + pr.addFeatures(fets) + vl.commitChanges() + QgsProject .instance().addMapLayer(vl) + + def openTIFF(self): + mapCanvas = self.iface.mapCanvas() + itens = [] + for i in range(mapCanvas.layerCount() - 1, -1, -1): + try: + layer = mapCanvas.layer(i) + layerName = layer.name() + if type(layer)==qgis._core.QgsRasterLayer and not layer.name() in ['Google Terrain','Google Satellite']: + itens.append(layerName) + except: + pass + item, ok = QtWidgets.QInputDialog.getItem(None, "Camada com tracado", u"Selecione o raster com as elevações:", + itens, + 0, False) + if not(ok) or not(item): + return None + else: + layerList = QgsProject .instance().mapLayersByName(item) + layer = None + if layerList: + layer = layerList[0] + + filename = layer.source() + #filename = QtWidgets.QFileDialog.getOpenFileName(filter="Image files (*.tiff *.tif)") + + return filename + + def openDXF(self): + filename = QtWidgets.QFileDialog.getOpenFileName(filter="Autocad files (*.dxf)") + return filename + + def setupUi(self, Form): + super(Estacas, self).setupUi(Form) + Form.setObjectName(_fromUtf8(u"Traçado Horizontal")) + self.modelSource = self.tableWidget.model() + self.tableWidget.setColumnCount(7) + self.tableWidget.setRowCount(0) + self.tableWidget.setHorizontalHeaderLabels((u"Estaca",u"Descrição",u"Progressiva",u"Norte",u"Este",u"Cota",u"Azimute")) + self.tableWidget.cellClicked.connect(self.zoom) + + self.table : QtWidgets.QTableWidget + self.table=self.tableWidget + self.table.horizontalHeader().setSectionResizeMode(QtWidgets.QHeaderView.Interactive) + self.table.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) + self.table.horizontalHeader().setStretchLastSection(True) + self.stretchTable() + + + def resizeEvent(self, event): + self.stretchTable() + super().resizeEvent(event) # Restores the original behaviour of the resize event + + def stretchTable(self): + table=self.table + tableSize = table.width() + sideHeaderWidth = table.verticalHeader().width() + tableSize -= sideHeaderWidth + numberOfColumns = table.columnCount() + + remainingWidth = tableSize % numberOfColumns + for columnNum in range(table.columnCount()): + if remainingWidth > 0: + table.setColumnWidth(columnNum, int(tableSize / numberOfColumns) + 1) + remainingWidth -= 1 + else: + table.setColumnWidth(columnNum, int(tableSize / numberOfColumns)) + + def event(self, event: QtCore.QEvent): + if event.type() == QtCore.QEvent.WindowStateChange and self.windowState() & QtCore.Qt.WindowMinimized and hasattr(self, "chview"): + view=self.chview +# view.show() + view.setWindowState(view.windowState() & ~QtCore.Qt.WindowMinimized | QtCore.Qt.WindowActive) + view.activateWindow() + return super(Estacas, self).event(event) + + def exec_(self): + self.point=False + self.setCopy() + self.stretchTable() + self.openLayers() + return super().exec_() + + def accept(self): + try: + self.closeLayers() + self.setWindowTitle(": Horizontal") + except: + pass + return super().accept() + + def reject(self): + try: + self.closeLayers() + self.setWindowTitle(": Horizontal") + except: + pass + return super().reject() + + def openLayers(self): + self.closeLayers() + + self.parent.model.iface=self.iface + l=self.parent.model.getSavedLayers(self.windowTitle().split(":")[0]) + if l: + l.setName("Curvas: "+l.name()) + l.startEditing() + self.curvaLayers.append(l) + l.layerModified.connect(lambda: self.add_row(l)) + self.parent.iface.setActiveLayer(l) + + l.renderer().symbol().setWidth(.5) + l.renderer().symbol().setColor(QtGui.QColor("#be0c21")) + l.triggerRepaint() + + if len([a for a in l.getFeatures()]): + self.parent.iface.mapCanvas().setExtent(l.extent()) + + + def add_row(self,l): + self.layer=l + self.layerUpdated.emit() + + + def closeLayers(self): + for l in self.curvaLayers: + try: + lyr=l + name=lyr.name() + except: + break + try: + l.commitChanges() + l.endEditCommand() + path=l.dataProvider().dataSourceUri() + QgsProject.instance().removeMapLayer(l.id()) + self.parent.model.saveLayer(path) + del l + except Exception as e: + try: + msgLog("Erro: "+str(e)+" ao remover layer "+name) + del l + except Exception as ee: + msgLog("Erro: " + str(e) +" _&_ "+ str(ee)) + + self.curvaLayers=[] + + def setCopy(self): + if not hasattr(self, "copyAction"): + self.copyAction=CopySelectedCellsAction(self, self.table) + + + def clearLayers(self): + try: + if hasattr(self,"point") and self.point: + QgsProject.instance().removeMapLayer(self.point) + self.iface.mapCanvas().refresh() + + except: + pass + + def zoom(self, row, column): + root = QgsProject.instance() + try: + if self.point: + root.removeMapLayer(self.point) + except RuntimeError as e: + pass#Duplicado + + #ZOOM + scale = 100 + table=self.tableWidget + e, x, y = table.item(row,0).text(), float(table.item(row,4).text()), float(table.item(row,3).text()) + point = QgsPointXY(x,y) + rect = QgsRectangle(x - scale, y - scale, x + scale, y + scale) + self.iface.mapCanvas().setExtent(rect) + self.iface.mapCanvas().refresh() + + + #ADD Point Layer + layer = QgsVectorLayer("Point?crs=%s"%(root.crs().authid()), "Estaca: "+str(e),"memory") + layer.setCrs(root.crs()) + prov = layer.dataProvider() + feat = QgsFeature() + feat.setGeometry(QgsGeometry.fromPointXY(point)) + prov.addFeatures([feat]) + root.addMapLayer(layer, False) + QgsProject.instance().layerTreeRoot().insertLayer(0, layer) + self.point=layer + + + +class closeDialog(QtWidgets.QDialog): + save = QtCore.pyqtSignal() + dischart = QtCore.pyqtSignal() + cancel = QtCore.pyqtSignal() + + def __init__(self, *args, **kwds): + super(closeDialog, self).__init__(*args, **kwds) + self.wasCanceled=False + self.setupUI() + + def setupUI(self): + + self.setWindowTitle("Fechar") + label = QtWidgets.QLabel(u"Deseja salvar suas alterações?") + btnSave=QtWidgets.QPushButton(self) + btnSave.setText("Sim") + btnSave.setToolTip("Salvar o perfil vertical desenhado") + btnSave.clicked.connect(self.__exitSave) + + + btnNot=QtWidgets.QPushButton(self) + btnNot.setText(u"Não") + btnNot.setToolTip(u"Descartar alterações") + btnNot.clicked.connect(self.__exitNotSave) + + + btnCancel=QtWidgets.QPushButton(self) + btnCancel.setText("Cancelar") + btnCancel.setToolTip("Voltar para Janela de desenho") + btnCancel.clicked.connect(self.__exitCancel) + + + Vlayout=QtWidgets.QVBoxLayout() + HLayout=QtWidgets.QHBoxLayout() + + Vlayout.addWidget(label) + HLayout.addWidget(btnSave) + HLayout.addWidget(btnNot) + HLayout.addWidget(btnCancel) + Vlayout.addLayout(HLayout) + + self.setLayout(Vlayout) + + + + def __exitSave(self): + self.save.emit() + self.close() + def __exitNotSave(self): + self.dischart.emit() + self.close() + def __exitCancel(self): + self.cancel.emit() + self.close() + + + + +class rampaDialog(QtWidgets.QDialog): + def __init__(self, roi, segment, pos, index=1): + super(rampaDialog, self).__init__(None) + self.setWindowTitle(u"Modificar Rampa") + self.roi=roi + self.segment=segment + self.pos=pos + self.index=index + self.setupUI() + + + def setupUI(self): + r=[] + for handle in self.roi.getHandles(): + r.append(handle) + + self.firstHandle=r[0] + self.lastHandle=r[len(r)-1] + + H1layout=QtWidgets.QHBoxLayout() + H2layout=QtWidgets.QHBoxLayout() + H3layout=QtWidgets.QHBoxLayout() + Vlayout=QtWidgets.QVBoxLayout(self) + + label=QtWidgets.QLabel("Modificar Rampa") + + Incl=QtWidgets.QDoubleSpinBox() + Incl.setMaximum(99.99) + Incl.setMinimum(-99.99) + Incl.setSingleStep(.05) + compr=QtWidgets.QDoubleSpinBox() + compr.setMaximum(1000000000.0) + compr.setMinimum(0.0) + cota=QtWidgets.QDoubleSpinBox() + cota.setMinimum(0.0) + cota.setMaximum(10000.0) + cota2 = QtWidgets.QDoubleSpinBox() + cota2.setMinimum(0.0) + cota2.setMaximum(10000.0) + abscissa=QtWidgets.QDoubleSpinBox() + abscissa.setMaximum(1000000000.0) + abscissa.setMinimum(0.0) + + InclLbl=QtWidgets.QLabel(u"Inclinação: ") + posInclLbl=QtWidgets.QLabel(u"%") + comprLbl=QtWidgets.QLabel(u"Distância inclinada: ") + poscomprLbl=QtWidgets.QLabel(u"m") + cotaLbl=QtWidgets.QLabel(u"Cotas: V"+str(self.index-2)+"") + cotaLbl2=QtWidgets.QLabel(u"V"+str(self.index-1)) + poscotaLbl=QtWidgets.QLabel(u"m") + abscissalbl=QtWidgets.QLabel(u"Distância Horizontal: ") + posabscissaLbl=QtWidgets.QLabel(u"m") + + + h1 = self.segment.handles[0]['item'] + h2 = self.segment.handles[1]['item'] + + self.h1=h1 + self.h2=h2 + + self.initialPos=[h1.pos(),h2.pos()] + + b1 = QtWidgets.QPushButton("ok",self) + b1.clicked.connect(self.finishDialog) + b2 = QtWidgets.QPushButton("cancelar", self) + b2.clicked.connect(lambda: self.cleanClose()) + + H1layout.addWidget(cotaLbl) + H1layout.addWidget(cota2) + H1layout.addWidget(cotaLbl2) + H1layout.addWidget(cota) + H1layout.addWidget(poscotaLbl) + H1layout.addItem(QtWidgets.QSpacerItem(80, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)) + + H1layout.addWidget(comprLbl) + H1layout.addWidget(compr) + H1layout.addWidget(poscomprLbl) + H1layout.addItem(QtWidgets.QSpacerItem(80, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)) + + H2layout.addWidget(InclLbl) + H2layout.addWidget(Incl) + H2layout.addWidget(posInclLbl) + H2layout.addItem(QtWidgets.QSpacerItem(80, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)) + + H2layout.addWidget(abscissalbl) + H2layout.addWidget(abscissa) + H2layout.addWidget(posabscissaLbl) + H2layout.addItem(QtWidgets.QSpacerItem(80, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)) + + Vlayout.addWidget(label) + Vlayout.addLayout(H1layout) + Vlayout.addLayout(H2layout) + H3layout.addItem(QtWidgets.QSpacerItem(80,20,QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)) + H3layout.addWidget(b1) + H3layout.addWidget(b2) + Vlayout.addLayout(H3layout) + + self.InclText=Incl + self.Incl=100*(h2.pos().y()-h1.pos().y())/(h2.pos().x()-h1.pos().x()) + self.comprText=compr + self.compr=np.sqrt((h2.pos().y()-h1.pos().y())**2+(h2.pos().x()-h1.pos().x())**2) + self.cotaText=cota + self.cotaText2=cota2 + self.cota=h2.pos().y() + self.cotaa=h1.pos().y() + self.abscissaText=abscissa + self.abscissa=h2.pos().x()-h1.pos().x() + cota2.setValue(round(h1.pos().y(), 2)) + #cota2.setDisabled(True) + cota2.setWhatsThis("Cota do ponto anterior ao seguimento") + cota.setWhatsThis("Cota do ponto adjacente ao seguimento") + + Incl.setValue(round(self.Incl,2)) + compr.setValue(round(self.compr,2)) + cota.setValue(round(self.cota,2)) + abscissa.setValue(round(self.abscissa,2)) + + compr.valueChanged.connect(self.updateCompr) + cota.valueChanged.connect(self.updateCota) + cota2.valueChanged.connect(self.updateCota) + abscissa.valueChanged.connect(self.updateAbscissa) + Incl.valueChanged.connect(self.updateIncl) + + self.setWindowModality(QtCore.Qt.ApplicationModal) + self.isBeingModified=False + + + def updateCompr(self): + try: + if not self.isBeingModified: + c=self.compr + self.compr=float(self.comprText.value()) + dc=self.compr-c + Incl = float(np.arctan(self.InclText.value() / 100)) + self.cota=self.cota+np.sin(np.deg2rad(self.Incl))*dc + self.abscissa = np.cos((Incl)) * self.compr + self.update() + self.redefineUI(1) + + except ValueError: + pass + + + + def updateCota(self): + try: + if not self.isBeingModified: + self.cota=float(self.cotaText.value()) + self.cotaa=float(self.cotaText2.value()) + self.update() + self.compr=np.sqrt((self.h2.pos().y()-self.h1.pos().y())**2+(self.h2.pos().x()-self.h1.pos().x())**2) + self.Incl=100*(self.h2.pos().y()-self.h1.pos().y())/(self.h2.pos().x()-self.h1.pos().x()) + self.redefineUI(2) + except ValueError: + pass + + + def updateAbscissa(self): + try: + if not self.isBeingModified: + self.abscissa=float(self.abscissaText.value()) + self.update() + self.compr=np.sqrt((self.h2.pos().y()-self.h1.pos().y())**2+(self.h2.pos().x()-self.h1.pos().x())**2) + self.Incl=100*(self.h2.pos().y()-self.h1.pos().y())/(self.h2.pos().x()-self.h1.pos().x()) + self.redefineUI(3) + except ValueError: + pass + + + def updateIncl(self): + try: + if not self.isBeingModified: + self.Incl=float(np.arctan(self.InclText.value()/100)) + self.cota=np.sin((self.Incl))*self.compr+self.h1.pos().y() + #self.abscissa=np.cos((self.Incl))*self.compr + self.update() + self.compr = np.sqrt((self.h2.pos().y() - self.h1.pos().y()) ** 2 + (self.h2.pos().x() - self.h1.pos().x()) ** 2) + self.redefineUI(4) + except ValueError: + pass + + + def update(self): + + self.h2.setPos(self.abscissa+self.h1.pos().x(), self.cota) + self.h1.setPos(self.h1.pos().x(), self.cotaa) + + if self.firstHandle == self.h2: + self.firstHandle.setPos(self.initialPos[1].x(),self.cota) + self.Incl=100*(self.h2.pos().y()-self.h1.pos().y())/(self.h2.pos().x()-self.h1.pos().x()) + self.compr=np.sqrt((self.h2.pos().y()-self.h1.pos().y())**2+(self.h2.pos().x()-self.h1.pos().x())**2) + self.cota=self.h2.pos().y() + self.abscissa=self.h2.pos().x()-self.h1.pos().x() + self.cotaText.setValue(float(self.cota)) + self.abscissaText.setValue(float(self.abscissa)) + + if self.lastHandle == self.h2: + self.lastHandle.setPos(self.initialPos[1].x(),self.cota) + self.Incl=100*(self.h2.pos().y()-self.h1.pos().y())/(self.h2.pos().x()-self.h1.pos().x()) + self.compr=np.sqrt((self.h2.pos().y()-self.h1.pos().y())**2+(self.h2.pos().x()-self.h1.pos().x())**2) + self.cota=self.h2.pos().y() + self.abscissa=self.h2.pos().x()-self.h1.pos().x() + self.cotaText.setValue(float(self.cota)) + self.abscissaText.setValue(float(self.abscissa)) + + + def redefineUI(self, elm): + self.isBeingModified=True + + if elm==1: + self.cotaText.setValue(float(round(self.cota,2))) + self.abscissaText.setValue(float(round(self.abscissa,2))) + self.InclText.setValue(float(round(self.Incl,2))) + elif elm==2: + self.comprText.setValue(float(round(self.compr,2))) + self.abscissaText.setValue(float(round(self.abscissa,2))) + self.InclText.setValue(float(round(self.Incl,2))) + elif elm==3: + self.comprText.setValue(float(round(self.compr,2))) + self.cotaText.setValue(float(round(self.cota,2))) + self.InclText.setValue(float(round(self.Incl,2))) + elif elm==4: + self.comprText.setValue(float(round(self.compr,2))) + self.cotaText.setValue(float(round(self.cota,2))) + self.abscissaText.setValue(float(round(self.abscissa,2))) + + + self.isBeingModified=False + + + def finishDialog(self): + self.close() + + def cleanClose(self): + self.h2.setPos(self.initialPos[1].x(),self.initialPos[1].y()) + self.h1.setPos(self.initialPos[0].x(),self.initialPos[0].y()) + self.close() + +class ssRampaDialog(rampaDialog): + def __init__(self, roi, segment, pos, cota): + self.ycenter=cota + self.isBeingModified = True + super().__init__(roi, segment, pos) + self.setWindowTitle("Modificar Elemento") + + + def setupUI(self): + r = [] + for handle in self.roi.getHandles(): + r.append(handle) + + self.firstHandle = r[0] + self.lastHandle = r[len(r) - 1] + + H1layout = QtWidgets.QHBoxLayout() + H2layout = QtWidgets.QHBoxLayout() + H3layout = QtWidgets.QHBoxLayout() + Vlayout = QtWidgets.QVBoxLayout(self) + + label = QtWidgets.QLabel("Modificar Rampa") + + Incl=QtWidgets.QDoubleSpinBox() + Incl.setMaximum(99.99) + Incl.setMinimum(-99.99) + Incl.setSingleStep(.05) + compr=QtWidgets.QDoubleSpinBox() + compr.setMaximum(1000000000.0) + compr.setMinimum(0.0) + compr.setSingleStep(.1) + cota=QtWidgets.QDoubleSpinBox() + cota.setMinimum(-10000.0) + cota.setMaximum(10000.0) + cota.setSingleStep(.1) + cota2 = QtWidgets.QDoubleSpinBox() + cota2.setMinimum(-10000.0) + cota2.setMaximum(10000.0) + cota2.setSingleStep(.1) + abscissa=QtWidgets.QDoubleSpinBox() + abscissa.setMaximum(100000.0) + abscissa.setMinimum(-10000.0) + abscissa.setSingleStep(.1) + + InclLbl = QtWidgets.QLabel(u"Inclinação: ") + posInclLbl = QtWidgets.QLabel(u"%") + comprLbl = QtWidgets.QLabel(u"Comprimento: ") + poscomprLbl = QtWidgets.QLabel(u"m") + cotaLbl = QtWidgets.QLabel(u"Cota: ") + poscotaLbl = QtWidgets.QLabel(u"m") + abscissalbl = QtWidgets.QLabel(u"Distância até o eixo") + posabscissaLbl = QtWidgets.QLabel(u"m") + + h1 = self.segment.handles[0]['item'] + h2 = self.segment.handles[1]['item'] + + self.h1 = h1 + self.h2 = h2 + + self.initialPos = [h1.pos(), h2.pos()] + + b1 = QtWidgets.QPushButton("ok", self) + b1.clicked.connect(self.finishDialog) + b2 = QtWidgets.QPushButton("cancelar", self) + b2.clicked.connect(lambda: self.cleanClose()) + + H1layout.addWidget(cotaLbl) + H1layout.addWidget(cota2) + H1layout.addWidget(cota) + H1layout.addWidget(poscotaLbl) + H1layout.addItem(QtWidgets.QSpacerItem(80, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)) + + H1layout.addWidget(comprLbl) + H1layout.addWidget(compr) + H1layout.addWidget(poscomprLbl) + H1layout.addItem(QtWidgets.QSpacerItem(80, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)) + + H2layout.addWidget(InclLbl) + H2layout.addWidget(Incl) + H2layout.addWidget(posInclLbl) + H2layout.addItem(QtWidgets.QSpacerItem(80, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)) + + H2layout.addWidget(abscissalbl) + H2layout.addWidget(abscissa) + H2layout.addWidget(posabscissaLbl) + H2layout.addItem(QtWidgets.QSpacerItem(80, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)) + + Vlayout.addWidget(label) + Vlayout.addLayout(H1layout) + Vlayout.addLayout(H2layout) + H3layout.addItem(QtWidgets.QSpacerItem(80, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)) + H3layout.addWidget(b1) + H3layout.addWidget(b2) + Vlayout.addLayout(H3layout) + + self.InclText = Incl + self.Incl = 100 * (h2.pos().y() - h1.pos().y()) / (h2.pos().x() - h1.pos().x()) + self.comprText = compr + self.compr = np.sqrt((h2.pos().y() - h1.pos().y()) ** 2 + (h2.pos().x() - h1.pos().x()) ** 2) + self.cotaText = cota + self.cota = h2.pos().y() + self.cotaa = h1.pos().y() + self.abscissaText = abscissa + self.abscissa = h2.pos().x() + cota2.setWhatsThis("Cota do ponto anterior ao seguimento") + cota.setWhatsThis("Cota do ponto adjacente ao seguimento") + self.cotaText2 = cota2 + + cota.setValue(float(round(self.cota-self.ycenter, 2))) + abscissa.setValue(float(round(self.abscissa, 2))) + cota2.setValue(round(self.cotaa-self.ycenter,2)) + + compr.valueChanged.connect(self.updateCompr) + cota.valueChanged.connect(self.updateCota) + abscissa.valueChanged.connect(self.updateAbscissa) + Incl.valueChanged.connect(self.updateIncl) + cota2.valueChanged.connect(self.updateCota) + + Incl.setValue(float(round(self.Incl, 2))) + compr.setValue(float(round(self.compr, 2))) + self.setWindowModality(QtCore.Qt.ApplicationModal) + self.isBeingModified = False + + def updateCompr(self): + try: + if not self.isBeingModified: + self.Incl = float(np.arctan(self.InclText.value() / 100)) + c=self.compr + self.compr=float(self.comprText.value()) + dc=self.compr-c + self.cota=self.cota+np.sin(np.deg2rad(self.Incl))*dc + self.abscissa=self.abscissa+np.cos(np.deg2rad(self.Incl))*dc + self.update() + self.redefineUI(1) + + except ValueError: + pass + + + def updateIncl(self): + try: + if not self.isBeingModified: + self.Incl=float(np.arctan(self.InclText.value()/100)) + self.cota=np.sin((self.Incl))*self.compr+self.h1.pos().y() + self.abscissa=np.cos((self.Incl))*self.compr+self.h1.pos().x() + self.update() + self.redefineUI(4) + except ValueError: + pass + + + def updateAbscissa(self): + try: + if not self.isBeingModified: + self.abscissa=float(self.abscissaText.value()) + self.update() + self.compr=np.sqrt((self.h2.pos().y()-self.h1.pos().y())**2+(self.h2.pos().x()-self.h1.pos().x())**2) + self.Incl=100*(self.h2.pos().y()-self.h1.pos().y())/(self.h2.pos().x()-self.h1.pos().x()) + self.redefineUI(3) + except ValueError: + pass + + def updateCota(self): + try: + if not self.isBeingModified: + self.cota=float(self.cotaText.value())+self.ycenter + self.cotaa=float(self.cotaText2.value())+self.ycenter + self.update() + self.compr=np.sqrt((self.h2.pos().y()-self.h1.pos().y())**2+(self.h2.pos().x()-self.h1.pos().x())**2) + self.Incl=100*(self.h2.pos().y()-self.h1.pos().y())/(self.h2.pos().x()-self.h1.pos().x()) + self.redefineUI(2) + except ValueError: + pass + + def redefineUI(self, elm): + self.isBeingModified = True + + if elm == 1: + self.cotaText.setValue(float(round(self.cota-self.ycenter, 2))) + self.abscissaText.setValue(float(round(self.abscissa, 2))) + self.InclText.setValue(float(round(self.Incl, 2))) + elif elm == 2: + self.comprText.setValue(float(round(self.compr, 2))) + self.abscissaText.setValue(float(round(self.abscissa, 2))) + self.InclText.setValue(float(round(self.Incl, 2))) + elif elm == 3: + self.comprText.setValue(float(round(self.compr, 2))) + self.cotaText.setValue(float(round(self.cota-self.ycenter, 2))) + self.InclText.setValue(float(round(self.Incl, 2))) + elif elm == 4: + self.comprText.setValue(float(round(self.compr, 2))) + self.cotaText.setValue(float(round(self.cota-self.ycenter, 2))) + self.abscissaText.setValue(float(round(self.abscissa, 2))) + self.isBeingModified=False + + + def update(self): + + self.h2.setPos(self.abscissa, self.cota) + self.h1.setPos(self.h1.pos().x(), self.cotaa) + + if self.firstHandle == self.h2: + self.firstHandle.setPos(self.initialPos[1].x(),self.cota) + self.Incl=100*(self.h2.pos().y()-self.h1.pos().y())/(self.h2.pos().x()-self.h1.pos().x()) + self.compr=np.sqrt((self.h2.pos().y()-self.h1.pos().y())**2+(self.h2.pos().x()-self.h1.pos().x())**2) + self.cota=self.h2.pos().y() + self.abscissa=self.h2.pos().x() + self.cotaText.setValue(float(self.cota)-self.ycenter) + self.abscissaText.setValue(float(self.abscissa)) + + if self.lastHandle == self.h2: + self.lastHandle.setPos(self.initialPos[1].x(),self.cota) + self.Incl=100*(self.h2.pos().y()-self.h1.pos().y())/(self.h2.pos().x()-self.h1.pos().x()) + self.compr=np.sqrt((self.h2.pos().y()-self.h1.pos().y())**2+(self.h2.pos().x()-self.h1.pos().x())**2) + self.cota=self.h2.pos().y() + self.abscissa=self.h2.pos().x() + self.cotaText.setValue(float(self.cota)-self.ycenter) + self.abscissaText.setValue(float(self.abscissa)) + + + +class brucknerRampaDialog(rampaDialog): + def __init__(self, roi, segment, pos): + super(brucknerRampaDialog, self).__init__(roi, segment, pos) + self.setWindowTitle("Modificar Elemento") + + def setupUI(self): + r = [] + for handle in self.roi.getHandles(): + r.append(handle) + + self.firstHandle = r[0] + self.lastHandle = r[len(r) - 1] + + H1layout = QtWidgets.QHBoxLayout() + H2layout = QtWidgets.QHBoxLayout() + H3layout = QtWidgets.QHBoxLayout() + Vlayout = QtWidgets.QVBoxLayout(self) + + label = QtWidgets.QLabel("Modificar Rampa") + + Incl=QtWidgets.QDoubleSpinBox() + Incl.setMaximum(100.0) + Incl.setMinimum(-100.0) + compr=QtWidgets.QDoubleSpinBox() + compr.setMaximum(1000000000.0) + compr.setMinimum(0.0) + cota=QtWidgets.QDoubleSpinBox() + cota.setMinimum(0.0) + cota.setMaximum(100000000.0) + abscissa=QtWidgets.QDoubleSpinBox() + abscissa.setMaximum(1000000000.0) + abscissa.setMinimum(0.0) + Incl.setSingleStep(.01) + + InclLbl = QtWidgets.QLabel(u"Inclinação: ") + posInclLbl = QtWidgets.QLabel(u"%") + comprLbl = QtWidgets.QLabel(u"Comprimento: ") + poscomprLbl = QtWidgets.QLabel(u"m") + cotaLbl = QtWidgets.QLabel(u"Cota: ") + poscotaLbl = QtWidgets.QLabel(u"m") + abscissalbl = QtWidgets.QLabel(u"Distância até o eixo") + posabscissaLbl = QtWidgets.QLabel(u"m") + + h1 = self.segment.handles[0]['item'] + h2 = self.segment.handles[1]['item'] + + self.h1 = h1 + self.h2 = h2 + + self.initialPos = [h1.pos(), h2.pos()] + + b1 = QtWidgets.QPushButton("ok", self) + b1.clicked.connect(self.finishDialog) + b2 = QtWidgets.QPushButton("cancelar", self) + b2.clicked.connect(lambda: self.cleanClose()) + + H1layout.addWidget(InclLbl) + H1layout.addWidget(Incl) + H1layout.addWidget(posInclLbl) + H1layout.addItem(QtWidgets.QSpacerItem(80, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)) + + H1layout.addWidget(comprLbl) + H1layout.addWidget(compr) + H1layout.addWidget(poscomprLbl) + H1layout.addItem(QtWidgets.QSpacerItem(80, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)) + + H2layout.addWidget(cotaLbl) + H2layout.addWidget(cota) + H2layout.addWidget(poscotaLbl) + H2layout.addItem(QtWidgets.QSpacerItem(80, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)) + + H2layout.addWidget(abscissalbl) + H2layout.addWidget(abscissa) + H2layout.addWidget(posabscissaLbl) + H2layout.addItem(QtWidgets.QSpacerItem(80, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)) + + Vlayout.addWidget(label) + Vlayout.addLayout(H1layout) + Vlayout.addLayout(H2layout) + H3layout.addItem(QtWidgets.QSpacerItem(80, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)) + H3layout.addWidget(b1) + H3layout.addWidget(b2) + Vlayout.addLayout(H3layout) + + self.InclText = Incl + self.Incl = 100 * (h2.pos().y() - h1.pos().y()) / (h2.pos().x() - h1.pos().x()) + self.comprText = compr + self.compr = (h2.pos().x() - h1.pos().x()) + self.cotaText = cota + self.cota = h2.pos().y()/1000000 + self.abscissaText = abscissa + self.abscissa = h2.pos().x() + + Incl.setValue(float(round(self.Incl, 2))) + compr.setValue(float(round(self.compr, 2))) + cota.setValue(float(round(self.cota, 2))) + abscissa.setValue(float(round(self.abscissa, 2))) + + compr.valueChanged.connect(self.updateCompr) + #cota.valueChanged.connect(self.updateCota) + abscissa.valueChanged.connect(self.updateAbscissa) + Incl.valueChanged.connect(self.updateIncl) + + self.setWindowModality(QtCore.Qt.ApplicationModal) + self.isBeingModified = False + + Incl.setDisabled(True) + posabscissaLbl.setText(" m") + poscomprLbl.setText(" m") + cotaLbl.setText(" Eixo") + poscotaLbl.setText(u' 10⁶ m³') + InclLbl.setDisabled(True) + posInclLbl.setDisabled(True) + + self.cotasb=cota + + def updateCompr(self): + try: + if not self.isBeingModified: + c = self.compr + self.compr = round(float(self.comprText.value()), 2) + dc = self.compr - c + self.cota = round(self.cota + np.sin(np.deg2rad(self.Incl)) * dc, 2) + self.abscissa = round(self.abscissa + np.cos(np.deg2rad(self.Incl)) * dc, 2) + self.update() + self.redefineUI(1) + + except ValueError: + pass + + def update(self): + self.h2.setPos(self.abscissa, self.h2.pos().y()) + if self.firstHandle == self.h2: + self.firstHandle.setPos(self.initialPos[1].x(),self.cota) + self.Incl=round(100*(self.h2.pos().y()-self.h1.pos().y())/(self.h2.pos().x()-self.h1.pos().x()) , 2) + self.compr=round(np.sqrt((self.h2.pos().y()-self.h1.pos().y())**2+(self.h2.pos().x()-self.h1.pos().x())**2) , 2) + self.cota=round(self.h2.pos().y(), 2) + self.abscissa=round(self.h2.pos().x(), 2) + self.cotaText.setValue(float(self.cota)) + self.abscissaText.setValue(float(self.abscissa)) + + if self.lastHandle == self.h2: + self.lastHandle.setPos(self.initialPos[1].x(),self.cota) + self.Incl=round(100*(self.h2.pos().y()-self.h1.pos().y())/(self.h2.pos().x()-self.h1.pos().x()), 2) + self.compr=round(np.sqrt((self.h2.pos().y()-self.h1.pos().y())**2+(self.h2.pos().x()-self.h1.pos().x())**2) , 2) + self.cota=round(self.h2.pos().y(), 2) + self.abscissa=round(self.h2.pos().x(), 2) + self.cotaText.setValue(float(self.cota)) + self.abscissaText.setValue(float(self.abscissa)) + + +class cvEdit(QtWidgets.QDialog, VERTICE_EDIT_DIALOG): + def __init__(self, iface): + super(cvEdit, self).__init__(None) + self.iface = iface + self.setupUi(self) + + # self.setFixedSize(self.size()) + + def removeCv(self): + self.groupBox_2.setFlat(True) + self.groupBox_2.setStyleSheet("border:1;") + + self.pushButton.hide() + self.widget1.hide() + self.widget2.hide() + self.widget3.hide() + self.widget4.hide() + self.groupBox_2.setTitle('') + + +class ApplyTransDialog(QtWidgets.QDialog, APLICAR_TRANSVERSAL_DIALOG): + firstCb: QtWidgets.QComboBox + secondCb: QtWidgets.QComboBox + + def __init__(self, iface, prog): + super(ApplyTransDialog, self).__init__(None) + self.iface=iface + self.setupUi(self) + self.progressiva=prog + self.progressivas=[] + self.dist=Config.instance().DIST + self.firstCb.currentIndexChanged.connect(self.setSecondCb) + self.secondCb.currentIndexChanged.connect(self.setIndexes) + self.firstCb.view().setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded) + self.secondCb.view().setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded) + self.setupUi2() + + def setupUi2(self): + d=self.dist + self.firstCb.addItems(list(map(lambda i: fastProg2EstacaStr(i, d), self.progressiva))) + self.setSecondCb() + + def setSecondCb(self): + d=self.dist + self.secondCb.clear() + self.secondCb.addItems(list(map(lambda i: fastProg2EstacaStr(i, d), self.progressiva[self.firstCb.currentIndex():]))) + self.setIndexes() + + def setIndexes(self): + self.progressivas=[self.firstCb.currentIndex(),self.secondCb.currentIndex()] + + +class SetCtAtiDialog(QtWidgets.QDialog, SETCTATI_DIALOG): + firstCb: QtWidgets.QComboBox + secondCb: QtWidgets.QComboBox + + def __init__(self, iface, prog): + super(SetCtAtiDialog, self).__init__(None) + self.iface=iface + self.setupUi(self) + self.roiIndexes=[] + self.firstOptions=[] + self.secondOptions=[] + for i, _ in enumerate(prog): + self.roiIndexes.append(i) + self.firstOptions.append(i+1) + + self.indices=None + self.setupUi2() + self.firstCb.currentIndexChanged.connect(self.setIndexes) + self.secondCb.currentIndexChanged.connect(self.setIndexes) + + def setupUi2(self): + self.firstCb.addItems(list(map(str, self.firstOptions))) + self.secondCb.addItems(list(map(str, self.firstOptions))) + + def setIndexes(self): + self.cti=self.firstCb.currentIndex() + self.ati=self.secondCb.currentIndex() + + +#TODO convert to real scale +class setEscalaDialog(QtWidgets.QDialog, SET_ESCALA_DIALOG): + def __init__(self, iface): + super(setEscalaDialog, self).__init__(None) + self.iface=iface + self.x: QtWidgets.QSpinBox + self.y: QtWidgets.QSpinBox + self.setupUi(self) + self.vb=self.iface.vb + self.x.setValue(1.0) + self.y.setValue(1.0) + self.x.valueChanged.connect(self.changed) + self.y.valueChanged.connect(self.changed) + self.zoomBtn.clicked.connect(self.zoom) + + def getX(self): + return float(self.x.value()) + + def getY(self): + return float(self.y.value()) + + def zoom(self): + self.vb.autoRange() + + def changed(self): + self.zoom() + self.vb.scaleBy((self.getX(), self.getY())) + + +class SelectFeatureDialog(QtWidgets.QDialog, SELECT_FEATURE): + def __init__(self, iface, layer): + super().__init__(None) + self.iface=iface + self.layer=layer + self.setupUi(self) + self.Dialog: QtWidgets.QDialog + self.buttonBox: QtWidgets.QDialogButtonBox + self.checkBox: QtWidgets.QCheckBox + self.groupBox: QtWidgets.QGroupBox + self.tableWidget: QtWidgets.QTableWidget + self.tableWidget.setSelectionBehavior(QAbstractItemView.SelectRows) + self.tableWidget.setSelectionMode(QAbstractItemView.SingleSelection) + self.result=-1 #loop over all + + for feat in layer.getFeatures(): + if self.tableWidget.columnCount()>9: + break + if feat.hasGeometry(): + row = [] + for f in feat.fields(): + row.append(str(f.name()) + ": " + str(feat[f.name()])) + row.append("Comprimento: "+str(feat.geometry().length())) + self.tableWidget.insertRow(self.tableWidget.rowCount()) + k = self.tableWidget.rowCount() - 1 + j=0 + for r in row: + if j>=self.tableWidget.columnCount(): + self.tableWidget.insertColumn(self.tableWidget.columnCount()) + item=QtWidgets.QTableWidgetItem(u"%s" % r) + item.setFlags(item.flags() ^ Qt.ItemIsEditable) + self.tableWidget.setItem(k, j, item) + j+=1 + + self.tableWidget.horizontalHeader().setStretchLastSection(True) + self.tableWidget.cellDoubleClicked.connect(self.accept) + self.tableWidget.selectRow(self.tableWidget.rowCount()-1) + self.tableWidget.setCurrentIndex(self.tableWidget.model().index(self.tableWidget.rowCount()-1,self.tableWidget.columnCount()-1)) + + if self.tableWidget.rowCount()==0: + self.checkBox.setChecked(True) + self.checkBox.setDisabled(True) + self.accept() + else: + self.result=self.tableWidget.rowCount()-1 #feature index + self.tableWidget.itemSelectionChanged.connect(self.updateResult) + self.checkBox.stateChanged.connect(self.check) + + self.checkBox.setChecked(True) + self.checkBox.setFocus() + + def updateResult(self): + self.result=self.tableWidget.currentRow() + g : QgsRectangle + f=0 + for x in self.layer.getFeatures(): + if f==self.result: + g = self.layer.getFeature(self.result).geometry().boundingBox() + break + f+=1 + iface.mapCanvas().setExtent(QgsRectangle(g.xMinimum()-50,g.yMinimum()-50,g.xMaximum()+50,g.yMaximum()+50)) + iface.mapCanvas().refresh() + + def check(self, i): + if i==0: + self.tableWidget.setDisabled(False) + self.updateResult() + else: + self.result=-1 + self.tableWidget.setDisabled(True) + +from qgis.PyQt.QtWidgets import QProgressBar + + +class ProgressDialog():#QtWidgets.QProgressDialog): #, PROGRESS_DIALOG): + + def __init__(self, iface, msg=None, noProgressBar=False): + + self.iface=iface + self.text=None + self.floor=0 + self.stepValue=1 + self.ceiling=100 + self.value=0 + + # self.setupUi(self) +# +# self.Dialog: QtWidgets.QDialog +# self.label: QtWidgets.QLabel +# self.progressBar: QtWidgets.QProgressBar +# +# if not msg is None: +# self.label.setText(str(msg)) +# self.progressBar.setValue(0) +## self.setWindowFlags((self.windowFlags() | Qt.CustomizeWindowHint) & ~Qt.WindowCloseButtonHint) +# +# if noProgressBar: +# self.progressBar.hide() +# self.stepValue=1 + # super(ProgressDialog, self).__init__(iface) + # self.setLabelText(msg) + # self.setWindowTitle("Aguarde") + + + def show(self): + # r=super().forceShow() + # self.setWindowModality(Qt.WindowModal) + # self.setValue(0) + # return r + if self.text==None: + self.text="Carregando" + + self.progressMessageBar = iface.messageBar().createMessage(self.text) + self.progressBar = QProgressBar() + self.progressBar.setMaximum(100) + self.progressBar.setValue(0) + self.progressBar.setAlignment(Qt.AlignLeft | Qt.AlignVCenter) + self.progressMessageBar.layout().addWidget(self.progressBar) + self.iface.messageBar().pushWidget(self.progressMessageBar, Qgis.Info) + + +# def forceShow(self): +# return super(ProgressDialog, self).forceShow() + +# def keyPressEvent(self, a0: QtGui.QKeyEvent): +# if a0.key() != Qt.Key_Escape: +# super().keyPressEvent(a0) +# else: +# self.showMinimized() +# + def setValue(self, f:float): + self.progressBar: QtWidgets.QProgressBar + self.progressBar.setValue(f) + self.floor=f + + def setLoop(self, ceiling, totalSteps, floor=None): + """ + :param ceiling: Onde quero chegar (Startinf point) in range 0-100 + :param totalSteps: Número de passos (Number of loop steps) 0-100 + :param floor: Onde vou partir (Starting value) 0-100 + :return: + """ + if floor is None: + self.floor=self.progressBar.value() + else: + self.floor=floor + self.progressBar.setValue(floor) + self.ceiling=ceiling + self.totalSteps=totalSteps + self.stepValue=(self.ceiling-self.floor)/totalSteps + + def increment(self): + """ + Dá um passo. Útil para ser usada em loop + :return: + """ + self.progressBar: QtWidgets.QProgressBar + self.progressBar.show() + self.value+=self.stepValue + self.setValue(int(min(self.value, self.ceiling))) + # msgLog("Progress bar"+str(self.progressBar.value())) + + def close(self): + self.progressBar.setValue(0) + self.__init__(self.iface) + # return super().close() + self.iface.messageBar().clearWidgets() + + def setText(self, s): + self.text=s + self.textSet=True + try: + if hasattr(self, "progressBar") and self.progressBar.isVisible(): + self.close() + self.show() + except: #C++ runtine error because progressBar was deleted + pass + + + +class EstacaRangeSelect(QtWidgets.QDialog, BRUCKNER_SELECT): + + def __init__(self, iface, estacas, bruck=[]): + super().__init__(iface) + self.iface=iface + self.setupUi(self) + + self.Dialog : QtWidgets.QDialog + self.final_2 : QtWidgets.QComboBox + self.inicial : QtWidgets.QComboBox + self.label : QtWidgets.QLabel + self.label_2 : QtWidgets.QLabel + self.listWidget : QtWidgets.QListWidget + self.btnApagar : QtWidgets.QPushButton + + estacas=[str(e) for e in estacas] + self.inicial.addItems(estacas) + self.inicial.setCurrentIndex(0) + self.final_2.addItems(estacas) + self.final_2.setCurrentIndex(1) + self.inicial.currentIndexChanged.connect(self.change1) + self.final_2.currentIndexChanged.connect(self.change2) + self.inicial.view().setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded) + self.final_2.view().setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded) + + self.ei=float(self.inicial.currentText()) + self.ef=float(self.final_2.currentText()) + self.listWidget.itemClicked.connect(self.itemClick) + self.bruck=bruck + self.fill_list(self.bruck) + self.btnApagar.clicked.connect(self.apagar) + + def apagar(self): + self.listWidget : QtWidgets.QListWidget + for s in self.listWidget.selectedItems(): + self.listWidget.removeItemWidget(s) + del self.bruck[s.text()] + msgLog("Erasing "+str(s.text())) + self.fill_list(self.bruck) + + def itemClick(self, item): + ests=item.text().split("-") + index = self.inicial.findText(ests[0]) + self.inicial.setCurrentIndex(index) + index = self.final_2.findText(ests[1]) + self.final_2.setCurrentIndex(index) + msgLog("Setting range "+str(ests)) + + def change1(self): + self.inicial : QtWidgets.QComboBox + self.final_2 : QtWidgets.QComboBox + if self.inicial.currentIndex() >= self.final_2.currentIndex(): + self.final_2.setCurrentIndex(self.inicial.currentIndex()+1) + + + def change2(self): + self.inicial : QtWidgets.QComboBox + self.final_2 : QtWidgets.QComboBox + if self.final_2.currentIndex() <= self.inicial.currentIndex(): + self.final_2.setCurrentIndex(self.inicial.currentIndex()+1) + + def fill_list(self, data): + self.listWidget : QtWidgets.QListWidget + self.listWidget.clear() + for key in list(data.keys()): + if "-" in key: + self.listWidget.addItem(str(key)) + + +class VolumeDialog(QtWidgets.QDialog, VOLUME_DIALOG): + def __init__(self, iface): + super().__init__(iface) + self.iface = iface + self.setupUi(self) + + def set(self, corte, aterro): + from ..model.utils import roundFloat2str + self.corte: QtWidgets.QLineEdit + self.aterro: QtWidgets.QLineEdit + self.corte.setText(roundFloat2str(corte)) + self.aterro.setText(roundFloat2str(aterro)) + self.soma.setText(roundFloat2str(corte+aterro)) + + + +class CorteExport(QtWidgets.QDialog, EXPORTAR_CORTE): + def __init__(self, iface, maxprog): + super().__init__(iface) + self.iface = iface + self.setupUi(self) + self.ExportarCorte: QtWidgets.QDialog + self.btnPreview: QtWidgets.QPushButton + self.btnSave: QtWidgets.QPushButton + self.buttonBox: QtWidgets.QDialogButtonBox + self.checkBox: QtWidgets.QCheckBox + self.comboBox: QtWidgets.QComboBox + self.espSb: QtWidgets.QDoubleSpinBox + self.finalSb: QtWidgets.QSpinBox + self.inicialSb: QtWidgets.QSpinBox + self.intSp: QtWidgets.QDoubleSpinBox + self.label: QtWidgets.QLabel + self.label_2: QtWidgets.QLabel + self.label_3: QtWidgets.QLabel + self.label_4: QtWidgets.QLabel + self.label_5: QtWidgets.QLabel + self.label_6: QtWidgets.QLabel + self.label_7: QtWidgets.QLabel + self.label_8: QtWidgets.QLabel + self.line: QtWidgets.Line + self.line_2: QtWidgets.Line + self.line_3: QtWidgets.Line + self.planoDb: QtWidgets.QDoubleSpinBox + self.typeLbl: QtWidgets.QLabel + + self.inicialSb.setMaximum(maxprog) + self.finalSb.setMaximum(maxprog) + self.inicialSb.valueChanged.connect(self.finalSb.setMinimum) + self.intSp.valueChanged.connect(self.espSb.setMinimum) + self.espSb.valueChanged.connect(self.offsetSb.setMaximum) + self.btnPreview.setFocus() + + self.comboBox.currentIndexChanged.connect(self.updateUi) + + self.types=["H", "V", "T"] + + def getType(self): + return self.types[self.comboBox.currentIndex()] + + def isEstaca(self): + return self.checkBox.isChecked() + + def updateUi(self): + if self.getType()=="T": + self.inicialSb.setEnabled(True) + self.finalSb.setEnabled(True) + self.espSb.setMaximum(Config.instance().DIST) + elif self.getType()=="V": + self.inicialSb.setEnabled(False) + self.finalSb.setEnabled(False) + self.espSb.setMaximum(10000) + else: #H + self.inicialSb.setEnabled(False) + self.finalSb.setEnabled(False) + self.espSb.setMaximum(10000) diff --git a/app/view/glmesh.py b/app/view/glmesh.py old mode 100644 new mode 100755 index c8d2b50..7bc7f19 --- a/app/view/glmesh.py +++ b/app/view/glmesh.py @@ -1,189 +1,189 @@ -# -*- coding: utf-8 -*- - -from PyQt5 import QtCore, QtGui, QtWidgets -from ... import PyQtGraph as pg -from ...PyQtGraph import opengl as gl -from ..model.utils import msgLog -from ..model.config import Config - -import numpy as np - - -shaders=[ - 'balloon', - 'viewNormalColor', - 'normalColor', - 'shaded', - 'edgeHilight', - 'heightColor', - 'pointSprite'] - - -class view3D_Ui(QtWidgets.QDialog): - def __init__(self, intersect=[], vertices=None, faces=None): - super().__init__() - self.w=gl.GLViewWidget() - self.intersect=intersect - self.vertices=np.array(vertices) - self.faces=np.array(faces) - self.setWindowTitle('Modelo tridimensional') - self.w.setCameraPosition(distance=40) - # self.g = gl.GLGridItem() - # self.g.scale(2, 2, 1) - # self.g.setSize(1000000, 1000000) - # self.w.addItem(self.g) - self.meshList = [] - self.setupUi() - - if intersect: - colors=[] - msgLog("Colorindo pista...") - terreno=[0.1,1,0.2,.85] - pista=[.4,.15,.15,1] - eixo=[np.array([float(intersect[j][4]), float(intersect[j][3]), float(intersect[j][5])]) - for j in range(len(intersect))] - n=0 - for f in faces: - ca=terreno -# for i in f: -# for j, e in enumerate(eixo[n:n+3]): -# d=np.linalg.norm(np.array(vertices[i]) - e) -# if d < 5: -# ca=pista -# if j>1: -# n+=1 -# break -# if ca==pista: -# msgLog("debug: " + str(f)) -# break - colors.append(ca) - msgLog("last: "+str(f)) - self.addMesh(vertices, faces, np.array(colors)) - else: - self.addMesh(vertices, faces) - - def setupUi(self): - self.vl=QtWidgets.QVBoxLayout() - self.hl=QtWidgets.QHBoxLayout() - self.vl.addWidget(self.w) - self.comboBox=QtWidgets.QComboBox() - self.comboBox.view().setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded) - self.comboBox.addItems([est[0] for est in self.intersect]) - self.comboBox.currentIndexChanged.connect(self.changeEstaca) - label=QtWidgets.QLabel("Estaca: ") - self.hl.addWidget(label) - self.hl.addWidget(self.comboBox) - spacer = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Minimum) - self.hl.addItem(spacer) - label2=QtWidgets.QLabel("Shader: ") - self.hl.addWidget(label2) - cbsh=QtWidgets.QComboBox() - cbsh.addItems(shaders) - cbsh.currentTextChanged.connect(self.changeShader) - cbsh.setCurrentIndex(3) - self.hl.addWidget(cbsh) - spacer5 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Minimum) - self.hl.addItem(spacer5) - col1 = QtWidgets.QPushButton("Cor") - col1.clicked.connect(self.meshColorChanged) - self.hl.addWidget(col1) - spacer3 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Minimum) - self.hl.addItem(spacer3) - col=QtWidgets.QPushButton("Cor de Fundo") - col.clicked.connect(self.colorChanged) - self.hl.addWidget(col) - spacer4 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Minimum) - self.hl.addItem(spacer4) - btn = QtWidgets.QCheckBox("Wireframe") - btn.setChecked(True) - btn.stateChanged.connect(self.wireframeToggle) - self.hl.addWidget(btn) - spacer2 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) - self.hl.addItem(spacer2) - self.vl.addLayout(self.hl) - self.setLayout(self.vl) - - self.changeEstaca(0) - - - def colorChanged(self): - color = QtWidgets.QColorDialog.getColor() - if color.isValid(): - self.w.setBackgroundColor(color) - self.w.update() - - def meshColorChanged(self): - color = QtWidgets.QColorDialog.getColor() - colorC=[color.redF(), color.greenF(), color.blueF(), color.alphaF()] - if color.isValid(): - mesh = self.meshList[-1] - colors=np.array([colorC for c in mesh.opts['faceColors']]) - msgLog('Debug: Color lengh is '+str(len(colors))) - mesh.setMeshData(vertexes=self.vertices, faces=self.faces, faceColors=colors, smooth=False, drawEdges=mesh.opts['drawEdges'], edgeColor=(0, 0, 0, 1), shader=mesh.opts['shader']) -# mesh.parseMeshData() - # mesh.paint() - self.w.update() - - def wireframeToggle(self, state): - mesh=self.meshList[-1] - mesh.opts["drawEdges"]=True if state else False - mesh.parseMeshData() - mesh.paint() - self.w.update() - #mesh.meshDataChanged() - - def changeShader(self, shader): - for mesh in self.meshList: - mesh.setShader(shader) - - def changeEstaca(self, index): - intersect = self.intersect - self.w.setWindowTitle("Estaca "+str(intersect[index][0])) - campos=self.w.cameraPosition() - self.w.pan(float(intersect[index][4])-campos.x(), float(intersect[index][3])-campos.y(), - float(intersect[index][5])-campos.z()+40) - # az = float(intersect[index][7]) - # self.w.orbit(az, 20) - - def addMesh(self, verts, faces, colors=[]): - m1 = gl.GLMeshItem(vertexes=verts, faces=faces, faceColors=colors, smooth=False, drawEdges=True, edgeColor=(0, 0, 0, 1), shader='shaded') - #m1.translate(5, 5, 0) - m1.setGLOptions('translucent') - m1.setDepthValue(0) - self.w.addItem(m1) - self.meshList.append(m1) - - - -## Start Qt event loop unless running in interactive mode. -if __name__ == '__main__': - app = QtGui.QApplication([]) - w=view3D_Ui() - w.show() - - ## Example 1: - ## Array of vertex positions and array of vertex indexes defining faces - ## Colors are specified per-face - - verts = np.array([ - [0, 0, 0], - [2, 0, 0], - [1, 2, 0], - [1, 1, 1], - ]) - faces = np.array([ - [0, 1, 2], - [0, 1, 3], - [0, 2, 3], - [1, 2, 3] - ]) - colors = np.array([ - [1, 0, 0, 0.3], - [0, 1, 0, 0.3], - [0, 0, 1, 0.3], - [1, 1, 0, 0.3] - ]) - w.addMesh(verts, faces, colors) - import sys - if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'): - QtGui.QApplication.instance().exec_() +# -*- coding: utf-8 -*- + +from PyQt5 import QtCore, QtGui, QtWidgets +from ... import PyQtGraph as pg +from ...PyQtGraph import opengl as gl +from ..model.utils import msgLog +from ..model.config import Config + +import numpy as np + + +shaders=[ + 'balloon', + 'viewNormalColor', + 'normalColor', + 'shaded', + 'edgeHilight', + 'heightColor', + 'pointSprite'] + + +class view3D_Ui(QtWidgets.QDialog): + def __init__(self, intersect=[], vertices=None, faces=None): + super().__init__() + self.w=gl.GLViewWidget() + self.intersect=intersect + self.vertices=np.array(vertices) + self.faces=np.array(faces) + self.setWindowTitle('Modelo tridimensional') + self.w.setCameraPosition(distance=40) + # self.g = gl.GLGridItem() + # self.g.scale(2, 2, 1) + # self.g.setSize(1000000, 1000000) + # self.w.addItem(self.g) + self.meshList = [] + self.setupUi() + + if intersect: + colors=[] + msgLog("Colorindo pista...") + terreno=[0.1,1,0.2,.85] + pista=[.4,.15,.15,1] + eixo=[np.array([float(intersect[j][4]), float(intersect[j][3]), float(intersect[j][5])]) + for j in range(len(intersect))] + n=0 + for f in faces: + ca=terreno +# for i in f: +# for j, e in enumerate(eixo[n:n+3]): +# d=np.linalg.norm(np.array(vertices[i]) - e) +# if d < 5: +# ca=pista +# if j>1: +# n+=1 +# break +# if ca==pista: +# msgLog("debug: " + str(f)) +# break + colors.append(ca) + msgLog("last: "+str(f)) + self.addMesh(vertices, faces, np.array(colors)) + else: + self.addMesh(vertices, faces) + + def setupUi(self): + self.vl=QtWidgets.QVBoxLayout() + self.hl=QtWidgets.QHBoxLayout() + self.vl.addWidget(self.w) + self.comboBox=QtWidgets.QComboBox() + self.comboBox.view().setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded) + self.comboBox.addItems([est[0] for est in self.intersect]) + self.comboBox.currentIndexChanged.connect(self.changeEstaca) + label=QtWidgets.QLabel("Estaca: ") + self.hl.addWidget(label) + self.hl.addWidget(self.comboBox) + spacer = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Minimum) + self.hl.addItem(spacer) + label2=QtWidgets.QLabel("Shader: ") + self.hl.addWidget(label2) + cbsh=QtWidgets.QComboBox() + cbsh.addItems(shaders) + cbsh.currentTextChanged.connect(self.changeShader) + cbsh.setCurrentIndex(3) + self.hl.addWidget(cbsh) + spacer5 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Minimum) + self.hl.addItem(spacer5) + col1 = QtWidgets.QPushButton("Cor") + col1.clicked.connect(self.meshColorChanged) + self.hl.addWidget(col1) + spacer3 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Minimum) + self.hl.addItem(spacer3) + col=QtWidgets.QPushButton("Cor de Fundo") + col.clicked.connect(self.colorChanged) + self.hl.addWidget(col) + spacer4 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Minimum) + self.hl.addItem(spacer4) + btn = QtWidgets.QCheckBox("Wireframe") + btn.setChecked(True) + btn.stateChanged.connect(self.wireframeToggle) + self.hl.addWidget(btn) + spacer2 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) + self.hl.addItem(spacer2) + self.vl.addLayout(self.hl) + self.setLayout(self.vl) + + self.changeEstaca(0) + + + def colorChanged(self): + color = QtWidgets.QColorDialog.getColor() + if color.isValid(): + self.w.setBackgroundColor(color) + self.w.update() + + def meshColorChanged(self): + color = QtWidgets.QColorDialog.getColor() + colorC=[color.redF(), color.greenF(), color.blueF(), color.alphaF()] + if color.isValid(): + mesh = self.meshList[-1] + colors=np.array([colorC for c in mesh.opts['faceColors']]) + msgLog('Debug: Color lengh is '+str(len(colors))) + mesh.setMeshData(vertexes=self.vertices, faces=self.faces, faceColors=colors, smooth=False, drawEdges=mesh.opts['drawEdges'], edgeColor=(0, 0, 0, 1), shader=mesh.opts['shader']) +# mesh.parseMeshData() + # mesh.paint() + self.w.update() + + def wireframeToggle(self, state): + mesh=self.meshList[-1] + mesh.opts["drawEdges"]=True if state else False + mesh.parseMeshData() + mesh.paint() + self.w.update() + #mesh.meshDataChanged() + + def changeShader(self, shader): + for mesh in self.meshList: + mesh.setShader(shader) + + def changeEstaca(self, index): + intersect = self.intersect + self.w.setWindowTitle("Estaca "+str(intersect[index][0])) + campos=self.w.cameraPosition() + self.w.pan(float(intersect[index][4])-campos.x(), float(intersect[index][3])-campos.y(), + float(intersect[index][5])-campos.z()+40) + # az = float(intersect[index][7]) + # self.w.orbit(az, 20) + + def addMesh(self, verts, faces, colors=[]): + m1 = gl.GLMeshItem(vertexes=verts, faces=faces, faceColors=colors, smooth=False, drawEdges=True, edgeColor=(0, 0, 0, 1), shader='shaded') + #m1.translate(5, 5, 0) + m1.setGLOptions('translucent') + m1.setDepthValue(0) + self.w.addItem(m1) + self.meshList.append(m1) + + + +## Start Qt event loop unless running in interactive mode. +if __name__ == '__main__': + app = QtGui.QApplication([]) + w=view3D_Ui() + w.show() + + ## Example 1: + ## Array of vertex positions and array of vertex indexes defining faces + ## Colors are specified per-face + + verts = np.array([ + [0, 0, 0], + [2, 0, 0], + [1, 2, 0], + [1, 1, 1], + ]) + faces = np.array([ + [0, 1, 2], + [0, 1, 3], + [0, 2, 3], + [1, 2, 3] + ]) + colors = np.array([ + [1, 0, 0, 0.3], + [0, 1, 0, 0.3], + [0, 0, 1, 0.3], + [1, 1, 0, 0.3] + ]) + w.addMesh(verts, faces, colors) + import sys + if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'): + QtGui.QApplication.instance().exec_() diff --git a/app/view/pointer.py b/app/view/pointer.py old mode 100644 new mode 100755 index 52b64f1..8536de9 --- a/app/view/pointer.py +++ b/app/view/pointer.py @@ -1,83 +1,83 @@ -from builtins import str -from qgis.core import * -from qgis.gui import * -from qgis.utils import * - -from qgis.PyQt.QtCore import * -import math - -class PointTool(QgsMapTool): - - def __init__(self, canvas): - - QgsMapTool.__init__(self, canvas) - self.canvas = canvas - - def canvasPressEvent(self, event): - x = event.pos().x() - y = event.pos().y() - global rb ,premuto ,point0 - if not premuto: - premuto=True - rb=QgsRubberBand(iface.mapCanvas(),QGis.Point ) - rb.setColor ( Qt.red ) - point0 = self.canvas.getCoordinateTransform().toMapCoordinates(x, y) - rb.addPoint(point0) - - def canvasMoveEvent(self, event): - x = event.pos().x() - y = event.pos().y() - global premuto,point0,point1,linea,rl - if premuto: - if not linea: - rl.setColor ( Qt.red ) - poin1 = self.canvas.getCoordinateTransform().toMapCoordinates(x, y) - rl.appendPoint(point0) - rl.appendPoint(point1) - linea=True - else: - if linea: - point1 = self.canvas.getCoordinateTransform().toMapCoordinates(x, y) - rl.reset(QGis.Line) - rl.appendPoint(point0) - rl.appendPoint(point1) - - - - def canvasReleaseEvent(self, event): - global premuto,linea,rb,rl,point1,point0 - angle = math.atan2(point1.x() - point0.x(), point1.y() - point0.y()) - angle = math.degrees(angle)if angle>0 else (math.degrees(angle) + 180)+180 - premuto=False - linea=False - actual_crs = self.canvas.mapRenderer().destinationCrs() - crsDest = QgsCoordinateReferenceSystem(4326) # WGS 84 / UTM zone 33N - xform = QgsCoordinateTransform(actual_crs, crsDest) - pt1 = xform.transform(point0) - dbName = os.getenv("HOME")+'/.qgis2/python/plugins/StreetView/page' - f1 = open(dbName, 'r') - f2 = open(dbName+'.html', 'w') - for line in f1: - line=line.replace('yyyy', str(pt1.x())) - line=line.replace('xxxx', str(pt1.y())) - line=line.replace('aaaa', str(int(angle))) - f2.write(line) - f1.close() - f2.close() - webbrowser.open_new(dbName+'.html') - #rl.reset() - #rb.reset() - def activate(self): - pass - - def deactivate(self): - pass - - def isZoomTool(self): - return False - - def isTransient(self): - return False - - def isEditTool(self): +from builtins import str +from qgis.core import * +from qgis.gui import * +from qgis.utils import * + +from qgis.PyQt.QtCore import * +import math + +class PointTool(QgsMapTool): + + def __init__(self, canvas): + + QgsMapTool.__init__(self, canvas) + self.canvas = canvas + + def canvasPressEvent(self, event): + x = event.pos().x() + y = event.pos().y() + global rb ,premuto ,point0 + if not premuto: + premuto=True + rb=QgsRubberBand(iface.mapCanvas(),QGis.Point ) + rb.setColor ( Qt.red ) + point0 = self.canvas.getCoordinateTransform().toMapCoordinates(x, y) + rb.addPoint(point0) + + def canvasMoveEvent(self, event): + x = event.pos().x() + y = event.pos().y() + global premuto,point0,point1,linea,rl + if premuto: + if not linea: + rl.setColor ( Qt.red ) + poin1 = self.canvas.getCoordinateTransform().toMapCoordinates(x, y) + rl.appendPoint(point0) + rl.appendPoint(point1) + linea=True + else: + if linea: + point1 = self.canvas.getCoordinateTransform().toMapCoordinates(x, y) + rl.reset(QGis.Line) + rl.appendPoint(point0) + rl.appendPoint(point1) + + + + def canvasReleaseEvent(self, event): + global premuto,linea,rb,rl,point1,point0 + angle = math.atan2(point1.x() - point0.x(), point1.y() - point0.y()) + angle = math.degrees(angle)if angle>0 else (math.degrees(angle) + 180)+180 + premuto=False + linea=False + actual_crs = self.canvas.mapRenderer().destinationCrs() + crsDest = QgsCoordinateReferenceSystem(4326) # WGS 84 / UTM zone 33N + xform = QgsCoordinateTransform(actual_crs, crsDest) + pt1 = xform.transform(point0) + dbName = os.getenv("HOME")+'/.qgis2/python/plugins/StreetView/page' + f1 = open(dbName, 'r') + f2 = open(dbName+'.html', 'w') + for line in f1: + line=line.replace('yyyy', str(pt1.x())) + line=line.replace('xxxx', str(pt1.y())) + line=line.replace('aaaa', str(int(angle))) + f2.write(line) + f1.close() + f2.close() + webbrowser.open_new(dbName+'.html') + #rl.reset() + #rb.reset() + def activate(self): + pass + + def deactivate(self): + pass + + def isZoomTool(self): + return False + + def isTransient(self): + return False + + def isEditTool(self): return True \ No newline at end of file diff --git a/app/view/ui/TOPO_dialog_base.ui b/app/view/ui/TOPO_dialog_base.ui old mode 100644 new mode 100755 index 14d4495..3dc86c3 --- a/app/view/ui/TOPO_dialog_base.ui +++ b/app/view/ui/TOPO_dialog_base.ui @@ -1,116 +1,116 @@ - - - TopoDialogBase - - - Qt::WindowModal - - - - 0 - 0 - 352 - 277 - - - - - 0 - 0 - - - - Topo - - - false - - - false - - - - - - Abrir Cartas - - - - - - - Abrir Mapa - - - - - - - false - - - false - - - - Selecione qual sistemas de coordenadas - - - - - - - - true - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - openFolderAction - - - - - - - button_box - accepted() - TopoDialogBase - accept() - - - 20 - 20 - - - 20 - 20 - - - - - button_box - rejected() - TopoDialogBase - reject() - - - 20 - 20 - - - 20 - 20 - - - - - + + + TopoDialogBase + + + Qt::WindowModal + + + + 0 + 0 + 352 + 277 + + + + + 0 + 0 + + + + Topo + + + false + + + false + + + + + + Abrir Cartas + + + + + + + Abrir Mapa + + + + + + + false + + + false + + + + Selecione qual sistemas de coordenadas + + + + + + + + true + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + openFolderAction + + + + + + + button_box + accepted() + TopoDialogBase + accept() + + + 20 + 20 + + + 20 + 20 + + + + + button_box + rejected() + TopoDialogBase + reject() + + + 20 + 20 + + + 20 + 20 + + + + + diff --git a/app/view/ui/Topo_dialog-cv.ui b/app/view/ui/Topo_dialog-cv.ui old mode 100644 new mode 100755 index 452a06a..9d72c4f --- a/app/view/ui/Topo_dialog-cv.ui +++ b/app/view/ui/Topo_dialog-cv.ui @@ -1,978 +1,978 @@ - - - Dialog - - - - 0 - 0 - 727 - 597 - - - - Modificar Curva Vertical - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Cancel - - - - - - - - 100 - 0 - - - - OK - - - - - - - - - - - true - - - - 0 - 0 - - - - - - - - - - - - L utilizado: - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - 1.000000000000000 - - - 9999.000000000000000 - - - 10.000000000000000 - - - - - - - - - - - Salvar - - - - - - - Gerar Todas - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - 75 - true - - - - - - - - - - - Qt::Vertical - - - - - - - Qt::Horizontal - - - - - - - - - - - - flexa (f): - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - - - - true - - - - - - - - - - 250 - 0 - - - - - 75 - true - - - - - - - - - - - - 75 - true - - - - Lmin - - - - - - - - - - - - - <html><head/><body><p>Lmin≥Dp</p></body></html> - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - true - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - - - - <html><head/><body><p>Lmin&lt;Dp</p></body></html> - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - true - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - - - - Critério do mínimo valor absoluto: - - - - - - - - 0 - 0 - - - - true - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - Critério da máxima aceleração: - - - - - - - true - - - - 0 - 0 - - - - true - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - Critério da distância de visibilidade: - - - - - - - - - - - g(%): - - - - - - - - 0 - 0 - - - - - 100 - 0 - - - - true - - - - - - - - - - 0 - 0 - - - - Curva: - - - - - - - - - true - - - - 0 - 0 - - - - true - - - - - - - Velocidade - - - - - - - Velocidade de projeto - - - 0 - - - 1000 - - - 10 - - - 0 - - - - - - - - - f: - - - - - - - - 0 - 0 - - - - - - - true - - - - - - - Dp - - - - - - - - 0 - 0 - - - - true - - - - - - - - - - - - - - - - Dados da Curva - - - - - - - - - - - - - 0 - 0 - - - - - - - 1 - - - Cota - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - false - - - uicota1 - - - - - - - - 0 - 0 - - - - - - - true - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 40 - 20 - - - - - - - - - - - - - - - &Cota - - - uicota - - - - - - - - 0 - 0 - - - - - - - Qt::ImhDigitsOnly|Qt::ImhFormattedNumbersOnly|Qt::ImhPreferNumbers - - - true - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 40 - 20 - - - - - - - - - - - - - 0 - 0 - - - - - - - Cota - - - uicota2 - - - - - - - - 0 - 0 - - - - - - - true - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 40 - 20 - - - - - - - - - - - - - - - - 1 - - - - - - - - &Distância - - - uihorizontal1 - - - - - - - - - - Horizontal - - - - - - - - - - 0 - 0 - - - - - - - true - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 40 - 20 - - - - - - - - - - - - - i1(%): - - - - - - - - 0 - 0 - - - - - - - true - - - - - - - - - - - - - 1 - - - - - Dist&ância - - - uihorizontal2 - - - - - - - Hori&zontal - - - uihorizontal2 - - - - - - - - - - 0 - 0 - - - - - - - true - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 40 - 20 - - - - - - - - - - - - - i2(%): - - - - - - - - 0 - 0 - - - - - - - true - - - - - - - - - - - - - - - - - - - - Vértice - - - - - - - - - - Aproximar - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Anterior - - - - - - - Próximo - - - - - - - - - addCurveBtn - uiLutilizado - cancelBtn - okBtn - uihorizontal2 - uicota1 - uicota2 - uii1 - uii2 - uiG - uif - uiL - uicota - - - - + + + Dialog + + + + 0 + 0 + 727 + 597 + + + + Modificar Curva Vertical + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Cancel + + + + + + + + 100 + 0 + + + + OK + + + + + + + + + + + true + + + + 0 + 0 + + + + + + + + + + + + L utilizado: + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + 1.000000000000000 + + + 9999.000000000000000 + + + 10.000000000000000 + + + + + + + + + + + Salvar + + + + + + + Gerar Todas + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + 75 + true + + + + + + + + + + + Qt::Vertical + + + + + + + Qt::Horizontal + + + + + + + + + + + + flexa (f): + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + + + + true + + + + + + + + + + 250 + 0 + + + + + 75 + true + + + + + + + + + + + + 75 + true + + + + Lmin + + + + + + + + + + + + + <html><head/><body><p>Lmin≥Dp</p></body></html> + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + true + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + + + + <html><head/><body><p>Lmin&lt;Dp</p></body></html> + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + true + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + + + + Critério do mínimo valor absoluto: + + + + + + + + 0 + 0 + + + + true + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + Critério da máxima aceleração: + + + + + + + true + + + + 0 + 0 + + + + true + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Critério da distância de visibilidade: + + + + + + + + + + + g(%): + + + + + + + + 0 + 0 + + + + + 100 + 0 + + + + true + + + + + + + + + + 0 + 0 + + + + Curva: + + + + + + + + + true + + + + 0 + 0 + + + + true + + + + + + + Velocidade + + + + + + + Velocidade de projeto + + + 0 + + + 1000 + + + 10 + + + 0 + + + + + + + + + f: + + + + + + + + 0 + 0 + + + + + + + true + + + + + + + Dp + + + + + + + + 0 + 0 + + + + true + + + + + + + + + + + + + + + + Dados da Curva + + + + + + + + + + + + + 0 + 0 + + + + + + + 1 + + + Cota + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + false + + + uicota1 + + + + + + + + 0 + 0 + + + + + + + true + + + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 40 + 20 + + + + + + + + + + + + + + + &Cota + + + uicota + + + + + + + + 0 + 0 + + + + + + + Qt::ImhDigitsOnly|Qt::ImhFormattedNumbersOnly|Qt::ImhPreferNumbers + + + true + + + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 40 + 20 + + + + + + + + + + + + + 0 + 0 + + + + + + + Cota + + + uicota2 + + + + + + + + 0 + 0 + + + + + + + true + + + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 40 + 20 + + + + + + + + + + + + + + + + 1 + + + + + + + + &Distância + + + uihorizontal1 + + + + + + + + + + Horizontal + + + + + + + + + + 0 + 0 + + + + + + + true + + + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 40 + 20 + + + + + + + + + + + + + i1(%): + + + + + + + + 0 + 0 + + + + + + + true + + + + + + + + + + + + + 1 + + + + + Dist&ância + + + uihorizontal2 + + + + + + + Hori&zontal + + + uihorizontal2 + + + + + + + + + + 0 + 0 + + + + + + + true + + + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 40 + 20 + + + + + + + + + + + + + i2(%): + + + + + + + + 0 + 0 + + + + + + + true + + + + + + + + + + + + + + + + + + + + Vértice + + + + + + + + + + Aproximar + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Anterior + + + + + + + Próximo + + + + + + + + + addCurveBtn + uiLutilizado + cancelBtn + okBtn + uihorizontal2 + uicota1 + uicota2 + uii1 + uii2 + uiG + uif + uiL + uicota + + + + diff --git a/app/view/ui/Topo_dialog_conf.ui b/app/view/ui/Topo_dialog_conf.ui old mode 100644 new mode 100755 index 97ee32e..8917efc --- a/app/view/ui/Topo_dialog_conf.ui +++ b/app/view/ui/Topo_dialog_conf.ui @@ -1,827 +1,827 @@ - - - TopoDialogBase - - - Qt::WindowModal - - - - 0 - 0 - 820 - 636 - - - - - 0 - 0 - - - - - 820 - 300 - - - - Configurações do projeto - - - false - - - false - - - - - - - - - 0 - 0 - - - - Separador CSV - - - txtCSV - - - - - - - - 0 - 0 - - - - ; - - - 1 - - - Qt::AlignCenter - - - - - - - Qt::Horizontal - - - QSizePolicy::Minimum - - - - 40 - 20 - - - - - - - - - - - - - - - - 0 - 0 - - - - at&é - - - planoMax - - - - - - - 8.000000000000000 - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - true - - - - 0 - 0 - - - - I&nclinação para terreno plano (%) - - - true - - - planoMin - - - - - - - - 0 - 0 - - - - Inc&linação para terreno ondulado (%) - - - true - - - onduladoMin - - - - - - - - - - 0 - 0 - - - - Dist&ância entre estacas (m) - - - estacas - - - - - - - - - - - - - - - - - - - - - - 0 - 0 - - - - EMA&X: - - - emax - - - - - - - 4 - - - 1.000000000000000 - - - 0.010000000000000 - - - 0.080000000000000 - - - - - - - m/m - - - - - - - - - - - 8.000000000000000 - - - - - - - &até - - - onduladoMax - - - - - - - 20.000000000000000 - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - Velocidade &de projeto: - - - velProj - - - - - - - Velocidade de projeto. Valor padrão utilizado para cálculo das curvas horizontais. - - - 400.000000000000000 - - - 100.000000000000000 - - - - - - - km/h - - - - - - - - - - - - 0 - 0 - - - - N&º de pontos - - - offsetSpinBox - - - - - - - - 80 - 16777215 - - - - <html><head/><body><p>Número de pontos para interpolar na seção transversal, incluindo o ponto central</p><p><br/></p><p><br/></p></body></html> - - - 2 - - - 6 - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 40 - 20 - - - - - - - - - - Reconstruir banco de dados - - - - - - - - - &Unidades - - - comboUnits - - - - - - - false - - - false - - - - Metros - - - - - Kilometros - - - - - Milimetros - - - - - - - - - 0 - 0 - - - - Qt::Horizontal - - - QSizePolicy::Minimum - - - - 40 - 20 - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - 0 - 70 - - - - Classe do projeto: - - - - - 20 - 30 - 421 - 27 - - - - false - - - false - - - - Selecione a classe do projeto - - - - - 0 - Via Expressa, controle total de acesso - - - - - 1(A) - Pista dupla, controle parcial de acesso - - - - - 1 (B) - Pista simples, controle parcial de acesso - - - - - 2 - Pista simples - - - - - 3 - Pista simples - - - - - 4 (A) - Pista simples - - - - - 4 (B) - Pista simples - - - - - - - - - - 0 - 0 - - - - Inclinaç&ão para terreno montanhoso (%) - - - true - - - montanhosoMin - - - - - - - - - - 0 - 0 - - - - Espa&çamento transversal de cada lado (m) - - - true - - - transversal - - - - - - - <html><head/><body><p>Espaçamento transversal em metros de cada lado da seção transversal</p></body></html> - - - 0.100000000000000 - - - 500.000000000000000 - - - 50.000000000000000 - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 40 - 20 - - - - - - - - - - - - true - - - - 0 - 0 - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Save - - - - - - - - - false - - - - - - - - - 20.000000000000000 - - - - - - - até - - - montanhosoMax - - - - - - - 100.000000000000000 - - - 100.000000000000000 - - - - - - - - - Interpolar Rasters? - - - true - - - - - - - - - <html><head/><body><p>Distância mímima para unir estacas. Se duas estacas na tabela de interseção tem uma distância menor que essa elas serão unificadas. Isso serve para resolver problemas na construção do modelo da pista e para simplificar o traçado.</p></body></html> - - - <html><head/><body><p>Distância mímima para unir estacas. Se duas estacas na tabela de interseção tem uma distância menor que essa elas serão unificadas. Isso serve para resolver problemas na construção do modelo da pista e para simplificar o traçado.</p></body></html> - - - Precisão das estacas: - - - - - - - <html><head/><body><p>Distância mímima para unir estacas. Se duas estacas na tabela de interseção tem uma distância menor que essa elas serão unificadas. Isso serve para resolver problemas na construção do modelo da pista e para simplificar o traçado.</p></body></html> - - - <html><head/><body><p>Distância mímima para unir estacas. Se duas estacas na tabela de interseção tem uma distância menor que essa elas serão unificadas. Isso serve para resolver problemas na construção do modelo da pista e para simplificar o traçado.</p></body></html> - - - 4 - - - 10.000000000000000 - - - 0.050000000000000 - - - 0.100000000000000 - - - - - - - m - - - - - - - - - openFolderAction - - - - - - - button_box - accepted() - TopoDialogBase - accept() - - - 809 - 600 - - - 20 - 20 - - - - - button_box - rejected() - TopoDialogBase - reject() - - - 809 - 600 - - - 20 - 20 - - - - - planoMax - valueChanged(double) - onduladoMin - setValue(double) - - - 702 - 96 - - - 524 - 151 - - - - - onduladoMin - valueChanged(double) - planoMax - setValue(double) - - - 461 - 136 - - - 698 - 98 - - - - - onduladoMax - valueChanged(double) - montanhosoMin - setValue(double) - - - 722 - 144 - - - 523 - 192 - - - - - montanhosoMin - valueChanged(double) - onduladoMax - setValue(double) - - - 496 - 177 - - - 688 - 151 - - - - - + + + TopoDialogBase + + + Qt::WindowModal + + + + 0 + 0 + 820 + 636 + + + + + 0 + 0 + + + + + 820 + 300 + + + + Configurações do projeto + + + false + + + false + + + + + + + + + 0 + 0 + + + + Separador CSV + + + txtCSV + + + + + + + + 0 + 0 + + + + ; + + + 1 + + + Qt::AlignCenter + + + + + + + Qt::Horizontal + + + QSizePolicy::Minimum + + + + 40 + 20 + + + + + + + + + + + + + + + + 0 + 0 + + + + at&é + + + planoMax + + + + + + + 8.000000000000000 + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + true + + + + 0 + 0 + + + + I&nclinação para terreno plano (%) + + + true + + + planoMin + + + + + + + + 0 + 0 + + + + Inc&linação para terreno ondulado (%) + + + true + + + onduladoMin + + + + + + + + + + 0 + 0 + + + + Dist&ância entre estacas (m) + + + estacas + + + + + + + + + + + + + + + + + + + + + + 0 + 0 + + + + EMA&X: + + + emax + + + + + + + 4 + + + 1.000000000000000 + + + 0.010000000000000 + + + 0.080000000000000 + + + + + + + m/m + + + + + + + + + + + 8.000000000000000 + + + + + + + &até + + + onduladoMax + + + + + + + 20.000000000000000 + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + Velocidade &de projeto: + + + velProj + + + + + + + Velocidade de projeto. Valor padrão utilizado para cálculo das curvas horizontais. + + + 400.000000000000000 + + + 100.000000000000000 + + + + + + + km/h + + + + + + + + + + + + 0 + 0 + + + + N&º de pontos + + + offsetSpinBox + + + + + + + + 80 + 16777215 + + + + <html><head/><body><p>Número de pontos para interpolar na seção transversal, incluindo o ponto central</p><p><br/></p><p><br/></p></body></html> + + + 2 + + + 6 + + + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 40 + 20 + + + + + + + + + + Reconstruir banco de dados + + + + + + + + + &Unidades + + + comboUnits + + + + + + + false + + + false + + + + Metros + + + + + Kilometros + + + + + Milimetros + + + + + + + + + 0 + 0 + + + + Qt::Horizontal + + + QSizePolicy::Minimum + + + + 40 + 20 + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + 0 + 70 + + + + Classe do projeto: + + + + + 20 + 30 + 421 + 27 + + + + false + + + false + + + + Selecione a classe do projeto + + + + + 0 - Via Expressa, controle total de acesso + + + + + 1(A) - Pista dupla, controle parcial de acesso + + + + + 1 (B) - Pista simples, controle parcial de acesso + + + + + 2 - Pista simples + + + + + 3 - Pista simples + + + + + 4 (A) - Pista simples + + + + + 4 (B) - Pista simples + + + + + + + + + + 0 + 0 + + + + Inclinaç&ão para terreno montanhoso (%) + + + true + + + montanhosoMin + + + + + + + + + + 0 + 0 + + + + Espa&çamento transversal de cada lado (m) + + + true + + + transversal + + + + + + + <html><head/><body><p>Espaçamento transversal em metros de cada lado da seção transversal</p></body></html> + + + 0.100000000000000 + + + 500.000000000000000 + + + 50.000000000000000 + + + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 40 + 20 + + + + + + + + + + + + true + + + + 0 + 0 + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Save + + + + + + + + + false + + + + + + + + + 20.000000000000000 + + + + + + + até + + + montanhosoMax + + + + + + + 100.000000000000000 + + + 100.000000000000000 + + + + + + + + + Interpolar Rasters? + + + true + + + + + + + + + <html><head/><body><p>Distância mímima para unir estacas. Se duas estacas na tabela de interseção tem uma distância menor que essa elas serão unificadas. Isso serve para resolver problemas na construção do modelo da pista e para simplificar o traçado.</p></body></html> + + + <html><head/><body><p>Distância mímima para unir estacas. Se duas estacas na tabela de interseção tem uma distância menor que essa elas serão unificadas. Isso serve para resolver problemas na construção do modelo da pista e para simplificar o traçado.</p></body></html> + + + Precisão das estacas: + + + + + + + <html><head/><body><p>Distância mímima para unir estacas. Se duas estacas na tabela de interseção tem uma distância menor que essa elas serão unificadas. Isso serve para resolver problemas na construção do modelo da pista e para simplificar o traçado.</p></body></html> + + + <html><head/><body><p>Distância mímima para unir estacas. Se duas estacas na tabela de interseção tem uma distância menor que essa elas serão unificadas. Isso serve para resolver problemas na construção do modelo da pista e para simplificar o traçado.</p></body></html> + + + 4 + + + 10.000000000000000 + + + 0.050000000000000 + + + 0.100000000000000 + + + + + + + m + + + + + + + + + openFolderAction + + + + + + + button_box + accepted() + TopoDialogBase + accept() + + + 809 + 600 + + + 20 + 20 + + + + + button_box + rejected() + TopoDialogBase + reject() + + + 809 + 600 + + + 20 + 20 + + + + + planoMax + valueChanged(double) + onduladoMin + setValue(double) + + + 702 + 96 + + + 524 + 151 + + + + + onduladoMin + valueChanged(double) + planoMax + setValue(double) + + + 461 + 136 + + + 698 + 98 + + + + + onduladoMax + valueChanged(double) + montanhosoMin + setValue(double) + + + 722 + 144 + + + 523 + 192 + + + + + montanhosoMin + valueChanged(double) + onduladoMax + setValue(double) + + + 496 + 177 + + + 688 + 151 + + + + + diff --git a/app/view/ui/Topo_dialog_curva.ui b/app/view/ui/Topo_dialog_curva.ui old mode 100644 new mode 100755 index b1db005..80305c0 --- a/app/view/ui/Topo_dialog_curva.ui +++ b/app/view/ui/Topo_dialog_curva.ui @@ -1,1069 +1,1069 @@ - - - Dialog - - - - 0 - 0 - 917 - 574 - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - Curvas Horizontais - - - - - - - - Curva: - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Tipo da Curva: - - - - - - - true - - - - Circular Simples - - - - - Circular com Transição Simétrica - - - - - - - - - - - - - - false - - - Anterior - - - - - - - false - - - Próxima - - - - - - - - - ? - - - - - - - Curvas: - - - - - - - true - - - Desenhar - - - - - - - true - - - Salvar - - - - - - - - 0 - 0 - - - - Apagar - - - - - - - true - - - Cancelar - - - - - - - Gerar todas as curvas automaticamente. Esta operação pode Demorar. - - - Gerar Todas - - - - - - - Apagar todas as curvas. - - - Apagar Todas - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - Tabela: - - - - - - - Recalcular tabela de Estacas com as novas curvas - - - Recalcular tabela de Estacas com as novas curvas - - - Calcular - - - - - - - Mostar a curva atual em tabela - - - Mostar a curva atual em tabela - - - Visualizar - - - - - - - - - Dados da Curva - - - - - - true - - - false - - - 0.010000000000000 - - - 10000.000000000000000 - - - 50.000000000000000 - - - 500.000000000000000 - - - - - - - true - - - false - - - 0.010000000000000 - - - 400.000000000000000 - - - 20.000000000000000 - - - - - - - <html><head/><body><p>Raio Mínimo da curva circular (m)</p></body></html> - - - <html><head/><body><p>Raio Mínimo da curva circular (m)</p></body></html> - - - Raio Minimo: - - - - - - - true - - - <html><head/><body><p>Raio Mínimo da curva circular (m)</p></body></html> - - - <html><head/><body><p>Raio Mínimo da curva circular (m)</p></body></html> - - - - - - true - - - - - - - Ve&locidade: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - txtVelocidade - - - - - - - <html><head/><body><p>Inclinação do trecho (%)</p></body></html> - - - I: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Qt::Horizontal - - - - 100 - 20 - - - - - - - - Raio &Utilizado: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - txtRUtilizado - - - - - - - E&MAX: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - txtEMAX - - - - - - - true - - - false - - - 0.000000000000000 - - - 1.000000000000000 - - - 0.010000000000000 - - - 0.080000000000000 - - - - - - - <html><head/><body><p>Deflexão da curva horizontal circular</p></body></html> - - - <html><head/><body><p>Deflexão da curva horizontal circular</p></body></html> - - - <html><head/><body><p align="right">Δ :</p></body></html> - - - Qt::RichText - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - true - - - <html><head/><body><p>Deflexão da curva horizontal circular</p></body></html> - - - <html><head/><body><p>Deflexão da curva horizontal circular</p></body></html> - - - - - - true - - - - - - - true - - - true - - - - - - - FMAX: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - true - - - <html><head/><body><p>Inclinação do trecho (%)</p></body></html> - - - <html><head/><body><p>Inclinação do trecho (%)</p></body></html> - - - - - - true - - - - - - - - - - Curvas Simples - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - G20: - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - true - - - false - - - 0.010000000000000 - - - 5000.000000000000000 - - - 20.000000000000000 - - - - - - - true - - - - - - true - - - - - - - <html><head/><body><p>Comprimento da curva circular (m)</p></body></html> - - - <html><head/><body><p>Comprimento da curva circular (m)</p></body></html> - - - &D: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - txtD - - - - - - - <html><head/><body><p>Afastamento da curva (m)</p></body></html> - - - T: - - - - - - - true - - - <html><head/><body><p>Afastamento da curva (m)</p></body></html> - - - <html><head/><body><p>Afastamento da curva (m)</p></body></html> - - - - - - true - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - - 0 - 0 - - - - Curva de Transição - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 0 - 0 - - - - Abscissa do cento O' - - - true - - - - - - - true - - - - - - - L&s: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - Ls - - - - - - - true - - - - 0 - 0 - - - - <html><head/><body><p>Comprimento mínimo de transição (m)</p></body></html> - - - <html><head/><body><p>Comprimento mínimo de transição (m)</p></body></html> - - - true - - - - - - - Afastamento da Curva Circular - - - p: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Abscissa do cento O' - - - k: - - - - - - - true - - - <html><head/><body><p>Cooordenadas Xs e Ys do ponto entre curva circular e de transição.</p></body></html> - - - <html><head/><body><p>Cooordenadas Xs e Ys do ponto entre curva circular e de transição.</p></body></html> - - - true - - - - - - - <html><head/><body><p>Cooordenadas Xs e Ys do ponto entre curva de transição e circular.</p></body></html> - - - <html><head/><body><p>Cooordenadas Xs e Ys do ponto entre curva de transição e circular.</p></body></html> - - - Xs: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - true - - - false - - - 0.010000000000000 - - - 4000.000000000000000 - - - 20.000000000000000 - - - - - - - true - - - <html><head/><body><p>Cooordenadas Xs e Ys do ponto entre curva de transição e circular.</p></body></html> - - - <html><head/><body><p>Cooordenadas Xs e Ys do ponto entre curva de transição e circular.</p></body></html> - - - true - - - - - - - Tangente Total - - - TT: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Lsmin: - - - - - - - Afastamento da Curva Circular - - - true - - - - - - - <html><head/><body><p>Comprimento mácimo de transição (m)</p></body></html> - - - <html><head/><body><p>Comprimento mácimo de transição (m)</p></body></html> - - - Lsmax: - - - - - - - true - - - <html><head/><body><p>Comprimento mácimo de transição (m)</p></body></html> - - - <html><head/><body><p>Comprimento mácimo de transição (m)</p></body></html> - - - true - - - - - - - <html><head/><body><p>Comprimento mínimo de transição (m)</p></body></html> - - - <html><head/><body><p>Comprimento mínimo de transição (m)</p></body></html> - - - Lsmin: - - - - - - - true - - - - 0 - 0 - - - - Ângulo de transição - - - <html><head/><body><p>Angulo de defleção da transição</p></body></html> - - - true - - - - - - - Ângulo de transição - - - <html><head/><body><p>Angulo de defleção da transição</p></body></html> - - - <html><head/><body><p>θ :</p></body></html> - - - Qt::RichText - - - Qt::AlignJustify|Qt::AlignVCenter - - - - - - - <html><head/><body><p>Cooordenadas Xs e Ys do ponto entre curva circular e de transição.</p></body></html> - - - <html><head/><body><p>Cooordenadas Xs e Ys do ponto entre curva circular e de transição.</p></body></html> - - - Ys: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Tangente Total - - - true - - - - - - - 0.010000000000000 - - - 10000.000000000000000 - - - 20.000000000000000 - - - - - - - Desenvolvimento do trecho circular, após a intercalação da espiral. - - - D: - - - - - - - Ângulo central do trecho circular - - - - <html><head/><body><p align="right">φ : </p></body></html> - - - Qt::RichText - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Ângulo central do trecho circular - - - - - - - - - - - btnInsere - txtRUtilizado - txtD - Ls - btnRecalcular - btnTable - next - btnApagar - txtG20 - txtT - lsmin - theta - lsmax - txtI - lsminv - xs - ys - txtk - txtp - txtTT - comboCurva - comboElemento - prev - txtEMAX - btnAjuda - txtRMIN - txtFMAX - txtDelta - btnCancela - generateAll - btnErase - btnRelatorio - txtVelocidade - - - - - prev - clicked() - Dialog - previousCurva() - - - 835 - 46 - - - 728 - 413 - - - - - next - clicked() - Dialog - nextCurva() - - - 925 - 46 - - - 778 - 504 - - - - - btnCancela - clicked() - Dialog - desabilitarControles() - - - 926 - 418 - - - 801 - 151 - - - - - - previousCurva() - nextCurva() - habilitarControles(bool) - desabilitarControles() - - + + + Dialog + + + + 0 + 0 + 917 + 574 + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + Curvas Horizontais + + + + + + + + Curva: + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Tipo da Curva: + + + + + + + true + + + + Circular Simples + + + + + Circular com Transição Simétrica + + + + + + + + + + + + + + false + + + Anterior + + + + + + + false + + + Próxima + + + + + + + + + ? + + + + + + + Curvas: + + + + + + + true + + + Desenhar + + + + + + + true + + + Salvar + + + + + + + + 0 + 0 + + + + Apagar + + + + + + + true + + + Cancelar + + + + + + + Gerar todas as curvas automaticamente. Esta operação pode Demorar. + + + Gerar Todas + + + + + + + Apagar todas as curvas. + + + Apagar Todas + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Tabela: + + + + + + + Recalcular tabela de Estacas com as novas curvas + + + Recalcular tabela de Estacas com as novas curvas + + + Calcular + + + + + + + Mostar a curva atual em tabela + + + Mostar a curva atual em tabela + + + Visualizar + + + + + + + + + Dados da Curva + + + + + + true + + + false + + + 0.010000000000000 + + + 10000.000000000000000 + + + 50.000000000000000 + + + 500.000000000000000 + + + + + + + true + + + false + + + 0.010000000000000 + + + 400.000000000000000 + + + 20.000000000000000 + + + + + + + <html><head/><body><p>Raio Mínimo da curva circular (m)</p></body></html> + + + <html><head/><body><p>Raio Mínimo da curva circular (m)</p></body></html> + + + Raio Minimo: + + + + + + + true + + + <html><head/><body><p>Raio Mínimo da curva circular (m)</p></body></html> + + + <html><head/><body><p>Raio Mínimo da curva circular (m)</p></body></html> + + + + + + true + + + + + + + Ve&locidade: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + txtVelocidade + + + + + + + <html><head/><body><p>Inclinação do trecho (%)</p></body></html> + + + I: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Qt::Horizontal + + + + 100 + 20 + + + + + + + + Raio &Utilizado: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + txtRUtilizado + + + + + + + E&MAX: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + txtEMAX + + + + + + + true + + + false + + + 0.000000000000000 + + + 1.000000000000000 + + + 0.010000000000000 + + + 0.080000000000000 + + + + + + + <html><head/><body><p>Deflexão da curva horizontal circular</p></body></html> + + + <html><head/><body><p>Deflexão da curva horizontal circular</p></body></html> + + + <html><head/><body><p align="right">Δ :</p></body></html> + + + Qt::RichText + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + true + + + <html><head/><body><p>Deflexão da curva horizontal circular</p></body></html> + + + <html><head/><body><p>Deflexão da curva horizontal circular</p></body></html> + + + + + + true + + + + + + + true + + + true + + + + + + + FMAX: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + true + + + <html><head/><body><p>Inclinação do trecho (%)</p></body></html> + + + <html><head/><body><p>Inclinação do trecho (%)</p></body></html> + + + + + + true + + + + + + + + + + Curvas Simples + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + G20: + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + true + + + false + + + 0.010000000000000 + + + 5000.000000000000000 + + + 20.000000000000000 + + + + + + + true + + + + + + true + + + + + + + <html><head/><body><p>Comprimento da curva circular (m)</p></body></html> + + + <html><head/><body><p>Comprimento da curva circular (m)</p></body></html> + + + &D: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + txtD + + + + + + + <html><head/><body><p>Afastamento da curva (m)</p></body></html> + + + T: + + + + + + + true + + + <html><head/><body><p>Afastamento da curva (m)</p></body></html> + + + <html><head/><body><p>Afastamento da curva (m)</p></body></html> + + + + + + true + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + 0 + 0 + + + + Curva de Transição + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + Abscissa do cento O' + + + true + + + + + + + true + + + + + + + L&s: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + Ls + + + + + + + true + + + + 0 + 0 + + + + <html><head/><body><p>Comprimento mínimo de transição (m)</p></body></html> + + + <html><head/><body><p>Comprimento mínimo de transição (m)</p></body></html> + + + true + + + + + + + Afastamento da Curva Circular + + + p: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Abscissa do cento O' + + + k: + + + + + + + true + + + <html><head/><body><p>Cooordenadas Xs e Ys do ponto entre curva circular e de transição.</p></body></html> + + + <html><head/><body><p>Cooordenadas Xs e Ys do ponto entre curva circular e de transição.</p></body></html> + + + true + + + + + + + <html><head/><body><p>Cooordenadas Xs e Ys do ponto entre curva de transição e circular.</p></body></html> + + + <html><head/><body><p>Cooordenadas Xs e Ys do ponto entre curva de transição e circular.</p></body></html> + + + Xs: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + true + + + false + + + 0.010000000000000 + + + 4000.000000000000000 + + + 20.000000000000000 + + + + + + + true + + + <html><head/><body><p>Cooordenadas Xs e Ys do ponto entre curva de transição e circular.</p></body></html> + + + <html><head/><body><p>Cooordenadas Xs e Ys do ponto entre curva de transição e circular.</p></body></html> + + + true + + + + + + + Tangente Total + + + TT: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Lsmin: + + + + + + + Afastamento da Curva Circular + + + true + + + + + + + <html><head/><body><p>Comprimento mácimo de transição (m)</p></body></html> + + + <html><head/><body><p>Comprimento mácimo de transição (m)</p></body></html> + + + Lsmax: + + + + + + + true + + + <html><head/><body><p>Comprimento mácimo de transição (m)</p></body></html> + + + <html><head/><body><p>Comprimento mácimo de transição (m)</p></body></html> + + + true + + + + + + + <html><head/><body><p>Comprimento mínimo de transição (m)</p></body></html> + + + <html><head/><body><p>Comprimento mínimo de transição (m)</p></body></html> + + + Lsmin: + + + + + + + true + + + + 0 + 0 + + + + Ângulo de transição + + + <html><head/><body><p>Angulo de defleção da transição</p></body></html> + + + true + + + + + + + Ângulo de transição + + + <html><head/><body><p>Angulo de defleção da transição</p></body></html> + + + <html><head/><body><p>θ :</p></body></html> + + + Qt::RichText + + + Qt::AlignJustify|Qt::AlignVCenter + + + + + + + <html><head/><body><p>Cooordenadas Xs e Ys do ponto entre curva circular e de transição.</p></body></html> + + + <html><head/><body><p>Cooordenadas Xs e Ys do ponto entre curva circular e de transição.</p></body></html> + + + Ys: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Tangente Total + + + true + + + + + + + 0.010000000000000 + + + 10000.000000000000000 + + + 20.000000000000000 + + + + + + + Desenvolvimento do trecho circular, após a intercalação da espiral. + + + D: + + + + + + + Ângulo central do trecho circular + + + + <html><head/><body><p align="right">φ : </p></body></html> + + + Qt::RichText + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Ângulo central do trecho circular + + + + + + + + + + + btnInsere + txtRUtilizado + txtD + Ls + btnRecalcular + btnTable + next + btnApagar + txtG20 + txtT + lsmin + theta + lsmax + txtI + lsminv + xs + ys + txtk + txtp + txtTT + comboCurva + comboElemento + prev + txtEMAX + btnAjuda + txtRMIN + txtFMAX + txtDelta + btnCancela + generateAll + btnErase + btnRelatorio + txtVelocidade + + + + + prev + clicked() + Dialog + previousCurva() + + + 835 + 46 + + + 728 + 413 + + + + + next + clicked() + Dialog + nextCurva() + + + 925 + 46 + + + 778 + 504 + + + + + btnCancela + clicked() + Dialog + desabilitarControles() + + + 926 + 418 + + + 801 + 151 + + + + + + previousCurva() + nextCurva() + habilitarControles(bool) + desabilitarControles() + + diff --git a/app/view/ui/Topo_dialog_estacas.1.ui b/app/view/ui/Topo_dialog_estacas.1.ui old mode 100644 new mode 100755 index 9dc83b6..bd45375 --- a/app/view/ui/Topo_dialog_estacas.1.ui +++ b/app/view/ui/Topo_dialog_estacas.1.ui @@ -1,105 +1,105 @@ - - - Dialog - - - - 0 - 0 - 945 - 513 - - - - Dialog - - - - - - - - - - - Abrir Arquivo - - - buttonGroup - - - - - - - Recalcular Estacas - - - buttonGroup - - - - - - - Plotar - - - buttonGroup - - - - - - - Perfil de trecho - - - buttonGroup - - - - - - - Salvar em CSV - - - buttonGroup - - - - - - - true - - - Salvar - - - buttonGroup - - - - - - - - - true - - - Obter Cotas -via Google - - - - - - - - - - - + + + Dialog + + + + 0 + 0 + 945 + 513 + + + + Dialog + + + + + + + + + + + Abrir Arquivo + + + buttonGroup + + + + + + + Recalcular Estacas + + + buttonGroup + + + + + + + Plotar + + + buttonGroup + + + + + + + Perfil de trecho + + + buttonGroup + + + + + + + Salvar em CSV + + + buttonGroup + + + + + + + true + + + Salvar + + + buttonGroup + + + + + + + + + true + + + Obter Cotas +via Google + + + + + + + + + + + diff --git a/app/view/ui/Topo_dialog_estacas.ui b/app/view/ui/Topo_dialog_estacas.ui old mode 100644 new mode 100755 index 825dd9c..c55169a --- a/app/view/ui/Topo_dialog_estacas.ui +++ b/app/view/ui/Topo_dialog_estacas.ui @@ -1,205 +1,205 @@ - - - Dialog - - - - 0 - 0 - 965 - 610 - - - - Traçado Horizontal - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - <html><head/><body><p>Procurar por uma estaca ou descriçao. O texto aqui inserido será buscado na coluna selecionada da tabela.</p></body></html> - - - <html><head/><body><p>Procurar por uma estaca ou descriçao. Digite uma estaca ou selecione um ponto.</p></body></html> - - - true - - - - - - - - - - - <html><head/><body><p>Recalcula as estacas com base em uma layer</p></body></html> - - - Recalcular Estacas - - - buttonGroup - - - - - - - <html><head/><body><p>Duplica os dados horizontai com, curvas da estaca e perfil vertical com curvas.</p></body></html> - - - Duplicar - - - - - - - <html><head/><body><p>Gera uma layer com o traçado. Essa layer não conterá informações de curvas.</p></body></html> - - - Plotar - - - buttonGroup - - - - - - - <html><head/><body><p>Calcular Curvas Horizontais</p></body></html> - - - <html><head/><body><p>Cria e gerencia as curvas do traçado horizontal.</p></body></html> - - - Curvas - - - - - - - <html><head/><body><p>Define o greide.</p></body></html> - - - Perfil de trecho - - - buttonGroup - - - - - - - true - - - <html><head/><body><p>Salva a tabela horizontal e as edições manuais feitas nela</p></body></html> - - - Salvar - - - buttonGroup - - - - - - - <html><head/><body><p>Exporta a tabela em uma planilha.</p></body></html> - - - Salvar em CSV - - - buttonGroup - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - Obter Cotas -via Google - - - - - - - <html><head/><body><p>Extrair cotas de um arquivo raster de imagem tiff</p></body></html> - - - Obter Cotas -via GeoTIFF - - - - - - - Obter Cotas -via DXF - - - - - - - <html><head/><body><p>Procurar por uma estaca ou descriçao. Digite uma estaca ou selecione um ponto.</p></body></html> - - - <html><head/><body><p>Procurar por uma estaca ou descriçao. Digite uma estaca ou selecione um ponto.</p></body></html> - - - Procurar: - - - - - - - - - - - - - - + + + Dialog + + + + 0 + 0 + 965 + 610 + + + + Traçado Horizontal + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + <html><head/><body><p>Procurar por uma estaca ou descriçao. O texto aqui inserido será buscado na coluna selecionada da tabela.</p></body></html> + + + <html><head/><body><p>Procurar por uma estaca ou descriçao. Digite uma estaca ou selecione um ponto.</p></body></html> + + + true + + + + + + + + + + + <html><head/><body><p>Recalcula as estacas com base em uma layer</p></body></html> + + + Recalcular Estacas + + + buttonGroup + + + + + + + <html><head/><body><p>Duplica os dados horizontai com, curvas da estaca e perfil vertical com curvas.</p></body></html> + + + Duplicar + + + + + + + <html><head/><body><p>Gera uma layer com o traçado. Essa layer não conterá informações de curvas.</p></body></html> + + + Plotar + + + buttonGroup + + + + + + + <html><head/><body><p>Calcular Curvas Horizontais</p></body></html> + + + <html><head/><body><p>Cria e gerencia as curvas do traçado horizontal.</p></body></html> + + + Curvas + + + + + + + <html><head/><body><p>Define o greide.</p></body></html> + + + Perfil de trecho + + + buttonGroup + + + + + + + true + + + <html><head/><body><p>Salva a tabela horizontal e as edições manuais feitas nela</p></body></html> + + + Salvar + + + buttonGroup + + + + + + + <html><head/><body><p>Exporta a tabela em uma planilha.</p></body></html> + + + Salvar em CSV + + + buttonGroup + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + Obter Cotas +via Google + + + + + + + <html><head/><body><p>Extrair cotas de um arquivo raster de imagem tiff</p></body></html> + + + Obter Cotas +via GeoTIFF + + + + + + + Obter Cotas +via DXF + + + + + + + <html><head/><body><p>Procurar por uma estaca ou descriçao. Digite uma estaca ou selecione um ponto.</p></body></html> + + + <html><head/><body><p>Procurar por uma estaca ou descriçao. Digite uma estaca ou selecione um ponto.</p></body></html> + + + Procurar: + + + + + + + + + + + + + + diff --git a/app/view/ui/Topo_dialog_estacas1.ui b/app/view/ui/Topo_dialog_estacas1.ui old mode 100644 new mode 100755 index 3ac5523..fa71882 --- a/app/view/ui/Topo_dialog_estacas1.ui +++ b/app/view/ui/Topo_dialog_estacas1.ui @@ -1,299 +1,299 @@ - - - ProjetoEstradas - - - - 0 - 0 - 894 - 508 - - - - Projeto de Estradas - - - - - - - 0 - 0 - - - - Arquivos de estacas salvos no projeto - - - - - - QLayout::SetNoConstraint - - - - - - - - - - <html><head/><body><p>Cria um novo arquivo a partir do traçado horizontal definido uma layer.</p></body></html> - - - Novo arquivo de estacas - - - false - - - - - - - <html><head/><body><p>Traçado horizontal em tabela curvas horizontais, edição do perfil vertical e curvas verticais.</p></body></html> - - - Abrir - - - true - - - - - - - <html><head/><body><p>Tabelas de interseção de estacas, edição do perfil transversal, cálculo de volumes de corte e aterro, diagrama de bruckner</p></body></html> - - - Abrir Verticais - - - false - - - - - - - <html><head/><body><p>Cria o traçado transversal a partir de um arquivo CSV extraído pelo plugin ou no formato do plugin.</p></body></html> - - - Abrir Arquivo CSV - - - false - - - - - - - <html><head/><body><p>Duplica o arquivo selecionado.</p><p>Dados horizontais e a configuração do perfil transversal serão copiados.<br/>A tabela de verticais e de interseção serão recalculadas.</p></body></html> - - - Duplicar - - - false - - - - - - - <html><head/><body><p>Gera um arquivo shapefile que será incluído no projeto contento as tranversais.</p></body></html> - - - Gerar Traçado - - - false - - - buttonGroup_2 - - - - - - - <html><head/><body><p>Gera um geopackage do projeto que pode conter curvas e tangentes. </p><p>Essa opção é útil caso você queira gerar o traçado e curvas de uma só vez.</p></body></html> - - - Gerar Curvas - - - Alt+C - - - false - - - - - - - Apagar Arquivo - - - false - - - buttonGroup_2 - - - - - - - Cancelar - - - false - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - - - - - - - btnCancela - clicked() - ProjetoEstradas - reject() - - - 877 - 445 - - - 336 - 245 - - - - - btnOpen - clicked() - ProjetoEstradas - accept() - - - 877 - 130 - - - 336 - 245 - - - - - btnNovo - clicked() - ProjetoEstradas - accept() - - - 877 - 85 - - - 336 - 245 - - - - - btnOpenCSV - clicked() - ProjetoEstradas - accept() - - - 877 - 220 - - - 336 - 245 - - - - - btnGerarTracado - clicked() - ProjetoEstradas - reject() - - - 877 - 310 - - - 336 - 233 - - - - - btnOpenCv - clicked() - ProjetoEstradas - accept() - - - 814 - 172 - - - 897 - 169 - - - - - btnGerarCurvas - clicked() - ProjetoEstradas - accept() - - - 772 - 332 - - - 684 - 505 - - - - - - - - + + + ProjetoEstradas + + + + 0 + 0 + 894 + 508 + + + + Projeto de Estradas + + + + + + + 0 + 0 + + + + Arquivos de estacas salvos no projeto + + + + + + QLayout::SetNoConstraint + + + + + + + + + + <html><head/><body><p>Cria um novo arquivo a partir do traçado horizontal definido uma layer.</p></body></html> + + + Novo arquivo de estacas + + + false + + + + + + + <html><head/><body><p>Traçado horizontal em tabela curvas horizontais, edição do perfil vertical e curvas verticais.</p></body></html> + + + Abrir + + + true + + + + + + + <html><head/><body><p>Tabelas de interseção de estacas, edição do perfil transversal, cálculo de volumes de corte e aterro, diagrama de bruckner</p></body></html> + + + Abrir Verticais + + + false + + + + + + + <html><head/><body><p>Cria o traçado transversal a partir de um arquivo CSV extraído pelo plugin ou no formato do plugin.</p></body></html> + + + Abrir Arquivo CSV + + + false + + + + + + + <html><head/><body><p>Duplica o arquivo selecionado.</p><p>Dados horizontais e a configuração do perfil transversal serão copiados.<br/>A tabela de verticais e de interseção serão recalculadas.</p></body></html> + + + Duplicar + + + false + + + + + + + <html><head/><body><p>Gera um arquivo shapefile que será incluído no projeto contento as tranversais.</p></body></html> + + + Gerar Traçado + + + false + + + buttonGroup_2 + + + + + + + <html><head/><body><p>Gera um geopackage do projeto que pode conter curvas e tangentes. </p><p>Essa opção é útil caso você queira gerar o traçado e curvas de uma só vez.</p></body></html> + + + Gerar Curvas + + + Alt+C + + + false + + + + + + + Apagar Arquivo + + + false + + + buttonGroup_2 + + + + + + + Cancelar + + + false + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + + + + + btnCancela + clicked() + ProjetoEstradas + reject() + + + 877 + 445 + + + 336 + 245 + + + + + btnOpen + clicked() + ProjetoEstradas + accept() + + + 877 + 130 + + + 336 + 245 + + + + + btnNovo + clicked() + ProjetoEstradas + accept() + + + 877 + 85 + + + 336 + 245 + + + + + btnOpenCSV + clicked() + ProjetoEstradas + accept() + + + 877 + 220 + + + 336 + 245 + + + + + btnGerarTracado + clicked() + ProjetoEstradas + reject() + + + 877 + 310 + + + 336 + 233 + + + + + btnOpenCv + clicked() + ProjetoEstradas + accept() + + + 814 + 172 + + + 897 + 169 + + + + + btnGerarCurvas + clicked() + ProjetoEstradas + accept() + + + 772 + 332 + + + 684 + 505 + + + + + + + + diff --git a/app/view/ui/Topo_dialog_gera_tracado.ui b/app/view/ui/Topo_dialog_gera_tracado.ui old mode 100644 new mode 100755 index aebe1d7..2f949c5 --- a/app/view/ui/Topo_dialog_gera_tracado.ui +++ b/app/view/ui/Topo_dialog_gera_tracado.ui @@ -1,121 +1,121 @@ - - - GeraTracadoDialog - - - - 0 - 0 - 399 - 287 - - - - - 399 - 287 - - - - Gera Traçado - - - false - - - - - - Ponto Inicial - - - - - - - - 0 - 0 - - - - North - - - - - - - Este - - - - - - - Ponto Final - - - - - - - North - - - - - - - Este - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - - buttonBox - accepted() - GeraTracadoDialog - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - GeraTracadoDialog - reject() - - - 316 - 260 - - - 286 - 274 - - - - - + + + GeraTracadoDialog + + + + 0 + 0 + 399 + 287 + + + + + 399 + 287 + + + + Gera Traçado + + + false + + + + + + Ponto Inicial + + + + + + + + 0 + 0 + + + + North + + + + + + + Este + + + + + + + Ponto Final + + + + + + + North + + + + + + + Este + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + buttonBox + accepted() + GeraTracadoDialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + GeraTracadoDialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/app/view/ui/Topo_dialog_gera_tracado_1.ui b/app/view/ui/Topo_dialog_gera_tracado_1.ui old mode 100644 new mode 100755 index 7068a13..2b7691f --- a/app/view/ui/Topo_dialog_gera_tracado_1.ui +++ b/app/view/ui/Topo_dialog_gera_tracado_1.ui @@ -1,157 +1,157 @@ - - - GeraTracadoDialog - - - - 0 - 0 - 395 - 100 - - - - - 425 - 287 - - - - Gera Traçado - - - false - - - false - - - - - - 0 - - - - - 0 - - - 0 - - - 0 - - - 6 - - - - - Ponto Inicial - - - - - - - - 0 - 0 - - - - North - - - - - - - Este - - - - - - - - - - - Cancela - - - - - - - Capturar - - - - - - - OK - - - - - - - - - - - - - btnCapture - clicked() - GeraTracadoDialog - reject() - - - 69 - 113 - - - 199 - 71 - - - - - btnOK - clicked() - GeraTracadoDialog - accept() - - - 329 - 113 - - - 199 - 71 - - - - - btnCancela - clicked() - GeraTracadoDialog - reject() - - - 69 - 113 - - - 199 - 71 - - - - - + + + GeraTracadoDialog + + + + 0 + 0 + 395 + 100 + + + + + 425 + 287 + + + + Gera Traçado + + + false + + + false + + + + + + 0 + + + + + 0 + + + 0 + + + 0 + + + 6 + + + + + Ponto Inicial + + + + + + + + 0 + 0 + + + + North + + + + + + + Este + + + + + + + + + + + Cancela + + + + + + + Capturar + + + + + + + OK + + + + + + + + + + + + + btnCapture + clicked() + GeraTracadoDialog + reject() + + + 69 + 113 + + + 199 + 71 + + + + + btnOK + clicked() + GeraTracadoDialog + accept() + + + 329 + 113 + + + 199 + 71 + + + + + btnCancela + clicked() + GeraTracadoDialog + reject() + + + 69 + 113 + + + 199 + 71 + + + + + diff --git a/app/view/ui/Topo_dialog_perfil.ui b/app/view/ui/Topo_dialog_perfil.ui old mode 100644 new mode 100755 index c041afa..4e8853e --- a/app/view/ui/Topo_dialog_perfil.ui +++ b/app/view/ui/Topo_dialog_perfil.ui @@ -1,70 +1,70 @@ - - - PerfilTrecho - - - - 0 - 0 - 590 - 169 - - - - Perfil do trecho - - - - - - Estaca 1 - - - - - - - - Selecione Estaca Inicial - - - - - - - - Estaca 2 - - - - - - - - Selecione Estaca Final - - - - - - - - Calcular - - - - - - - Plano - - - Qt::AlignCenter - - - - - - - - + + + PerfilTrecho + + + + 0 + 0 + 590 + 169 + + + + Perfil do trecho + + + + + + Estaca 1 + + + + + + + + Selecione Estaca Inicial + + + + + + + + Estaca 2 + + + + + + + + Selecione Estaca Final + + + + + + + + Calcular + + + + + + + Plano + + + Qt::AlignCenter + + + + + + + + diff --git a/app/view/ui/applyTransDiag.ui b/app/view/ui/applyTransDiag.ui old mode 100644 new mode 100755 index 3598b9c..ca0f184 --- a/app/view/ui/applyTransDiag.ui +++ b/app/view/ui/applyTransDiag.ui @@ -1,112 +1,112 @@ - - - Dialog - - - - 0 - 0 - 583 - 144 - - - - Aplicar seção tipo - - - - - - - - - - Partindo da estaca: - - - - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Minimum - - - - 10 - 20 - - - - - - - - - - Até estaca: - - - - - - - - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - - buttonBox - accepted() - Dialog - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - Dialog - reject() - - - 316 - 260 - - - 286 - 274 - - - - - + + + Dialog + + + + 0 + 0 + 583 + 144 + + + + Aplicar seção tipo + + + + + + + + + + Partindo da estaca: + + + + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Minimum + + + + 10 + 20 + + + + + + + + + + Até estaca: + + + + + + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + buttonBox + accepted() + Dialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + Dialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/app/view/ui/bruckner_select.ui b/app/view/ui/bruckner_select.ui old mode 100644 new mode 100755 index 6dcae7e..f3a25b3 --- a/app/view/ui/bruckner_select.ui +++ b/app/view/ui/bruckner_select.ui @@ -1,206 +1,206 @@ - - - Dialog - - - - 0 - 0 - 510 - 438 - - - - Intervalo de Estacas - - - - - - - 0 - 0 - - - - <html><head/><body><p>Apagar o diagrama selecionado na lista abaixo.</p></body></html> - - - Apagar - - - - - - - Qt::Horizontal - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - QAbstractItemView::SingleSelection - - - true - - - - - - - Escolha as estacas de partida e final para criar o Diagrama de Bruckner - - - true - - - - - - - Diagramas anteriores: - - - - - - - - - Estaca Inicial: - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Estaca Final: - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - Qt::Vertical - - - QSizePolicy::Preferred - - - - 20 - 40 - - - - - - - - - - buttonBox - accepted() - Dialog - accept() - - - 422 - 428 - - - 294 - 127 - - - - - buttonBox - rejected() - Dialog - reject() - - - 422 - 428 - - - 178 - 156 - - - - - listWidget - itemDoubleClicked(QListWidgetItem*) - Dialog - accept() - - - 184 - 251 - - - 42 - 125 - - - - - + + + Dialog + + + + 0 + 0 + 510 + 438 + + + + Intervalo de Estacas + + + + + + + 0 + 0 + + + + <html><head/><body><p>Apagar o diagrama selecionado na lista abaixo.</p></body></html> + + + Apagar + + + + + + + Qt::Horizontal + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + QAbstractItemView::SingleSelection + + + true + + + + + + + Escolha as estacas de partida e final para criar o Diagrama de Bruckner + + + true + + + + + + + Diagramas anteriores: + + + + + + + + + Estaca Inicial: + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Estaca Final: + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Qt::Vertical + + + QSizePolicy::Preferred + + + + 20 + 40 + + + + + + + + + + buttonBox + accepted() + Dialog + accept() + + + 422 + 428 + + + 294 + 127 + + + + + buttonBox + rejected() + Dialog + reject() + + + 422 + 428 + + + 178 + 156 + + + + + listWidget + itemDoubleClicked(QListWidgetItem*) + Dialog + accept() + + + 184 + 251 + + + 42 + 125 + + + + + diff --git a/app/view/ui/ch.py b/app/view/ui/ch.py old mode 100644 new mode 100755 index 72bde69..369a23b --- a/app/view/ui/ch.py +++ b/app/view/ui/ch.py @@ -1,239 +1,239 @@ -from copy import deepcopy - -from qgis.PyQt import QtGui, uic, Qt, QtWidgets -import os -from qgis.PyQt.QtCore import pyqtSignal - -from ...model.utils import msgLog - -COMPOSI, _= uic.loadUiType(os.path.join(os.path.dirname(__file__), 'compor_curvas.ui')) -CWIDGET, _= uic.loadUiType(os.path.join(os.path.dirname(__file__), 'curvaWidget.ui')) - -class CurvasWidget(QtWidgets.QWidget, CWIDGET): - edited=pyqtSignal() - - def __init__(self, parent): - super(CurvasWidget,self).__init__(parent) - self.iface=parent - self.setupUi(self) - self.Form: QtWidgets.QWidget - - self.T: QtWidgets.QDoubleSpinBox - self.checkBox: QtWidgets.QCheckBox - self.comprimento: QtWidgets.QDoubleSpinBox - self.deflexao: QtWidgets.QDoubleSpinBox - self.k: QtWidgets.QLineEdit - self.label: QtWidgets.QLabel - self.label_2: QtWidgets.QLabel - self.label_3: QtWidgets.QLabel - self.label_4: QtWidgets.QLabel - self.label_5: QtWidgets.QLabel - self.label_6: QtWidgets.QLabel - self.nome: QtWidgets.QLabel - self.pushButton: QtWidgets.QPushButton - self.raio: QtWidgets.QDoubleSpinBox - self.vmax: QtWidgets.QLineEdit - self.parent.comboBox: QtWidgets.QComboBox - - self.setTipo(self.iface.comboBox.currentIndex()) - - if self.tipo=="T": - self.raio.setEnabled(False) - - self.modified="S" #Started - self.events() - - self.vmax.hide() - self.label_2.hide() - self.k.hide() - self.label.hide() - - def fill(self, data, k='',vmax=''): - T=data["T"] - raio=data["R"] - deflexao=data["D"] - comprimento=data["L"] - checkBoxState=data["C"] if data["C"] else False - - self.eventsDisconnect() - self.T: QtWidgets.QDoubleSpinBox - try: - self.k.setText(str(k)) - self.vmax.setText(str(vmax)) - self.T.setValue(T) - self.deflexao.setValue(deflexao) - self.raio.setValue(raio) - self.comprimento.setValue(comprimento) - self.checkBox.setChecked(checkBoxState) - - self.T.setEnabled(True) - self.raio.setEnabled(True) - self.deflexao.setEnabled(True) - self.comprimento.setEnabled(True) - self.checkBox.setEnabled(True) - - if "Disable" in data: - D=data["Disable"] - for d in D: - if d=="T": - self.T.setEnabled(False) - if d=="R": - self.raio.setEnabled(False) - if d=="D": - self.deflexao.setEnabled(False) - if d=="L": - self.comprimento.setEnabled(False) - if d=="C": - self.checkBox.setEnabled(False) - - self.events() - - except: - pass - - - def eventsDisconnect(self): - try: - self.raio.valueChanged.disconnect() - self.comprimento.valueChanged.disconnect() - self.T.valueChanged.disconnect() - self.deflexao.valueChanged.disconnect() - self.checkBox.stateChanged.disconnect() - except: - pass - - - def events(self): - self.raio.valueChanged.connect(lambda: self.setModified("R")) - self.raio.valueChanged.connect(self.edited.emit) - self.comprimento.valueChanged.connect(lambda: self.setModified("L")) - self.comprimento.valueChanged.connect(self.edited.emit) - self.T.valueChanged.connect(lambda: self.setModified("T")) - self.T.valueChanged.connect(self.edited.emit) - self.deflexao.valueChanged.connect(lambda: self.setModified("D")) - self.deflexao.valueChanged.connect(self.edited.emit) - self.checkBox.stateChanged.connect(lambda: self.setModified("C")) - self.checkBox.stateChanged.connect(self.edited.emit) - - - def setModified(self, s): - self.modified=s - - def setTipo(self, i=-1): - if i>=0: - if i==3: - self.tipo="EE" - elif i==0: - self.tipo="C" - elif i==1: - self.tipo="EC" - elif i==4: - self.tipo="ES" - elif i==2: - self.tipo= "T" - else: - msgLog("Os valores do combobox estão errados!") - self.tipo=None - return self.tipo - - def read(self): - try: - return self.tipo, self.modified, {"R": self.raio.value(), "L": self.comprimento.value(), - "T": self.T.value(), "D": self.deflexao.value(), "C": self.checkBox.isChecked(), "Disable": []} #tipo de curva, raio, comprimento (L) - except: - return self.tipo, None, None - -#DADOS: R, L, T, D float -# C bool -# Disable list (of index to setEnabled(false) - -EMPTY_DATA={"R":0.0, "L":0.0, "T":0.0, "D":0.0, "C": False} -def empty_data(): - return deepcopy(EMPTY_DATA) - - -class CurvasCompositorDialog(QtWidgets.QDialog, COMPOSI): - edited=pyqtSignal() - def __init__(self, parent): - super(CurvasCompositorDialog, self).__init__(parent) - self.iface=parent - self.setupUi(self) - - self.Dialog: QtWidgets.QDialog - self.btnAdd: QtWidgets.QPushButton - self.buttonBox: QtWidgets.QDialogButtonBox - self.comboBox: QtWidgets.QComboBox - self.listWidget: QtWidgets.QListWidget - self.lastWidget=False - self.btnAdd.clicked.connect(lambda: self.addCurva()) - - if self.iface.comboElemento.currentIndex() == 0: #Circular simples - self.comboBox.setCurrentIndex(0) - self.addCurva({'D': float(self.iface.txtDelta.text()), 'R': self.iface.txtRUtilizado.value(), 'T': float(self.iface.txtT.text()), 'L': 0, 'C': True}) - elif self.iface.comboElemento.currentIndex() == 1: #Circular simétrica com transição - self.comboBox.setCurrentIndex(1) - self.addCurva({'D': float(self.iface.txtDelta.text())-2*float(self.iface.theta.text()), 'R': self.iface.txtRUtilizado.value(), 'T': float(self.iface.txtT.text()), 'L': self.iface.Ls.value(), 'C': True}) - - def addCurva(self, data=None): - self.listWidget: QtWidgets.QListWidget - self.comboBox: QtWidgets.QComboBox - itemN = QtWidgets.QListWidgetItem() - widget = CurvasWidget(self) - widget.nome.setText(self.comboBox.currentText().upper()) - widget.horizontalLayout.addStretch() - widget.horizontalLayout.setSizeConstraint(QtWidgets.QLayout.SetFixedSize) - if data==None: - try: - _,_,data=self.lastWidget.read() - data["D"]=0 - data["C"]=False - widget.fill(data, k=self.lastWidget.k.text(), vmax=self.lastWidget.vmax.text()) - except: - pass - else: - widget.fill(data) - self.comboBox.hide() - self.btnAdd.hide() - #self.horizontalSpacer.hide() - - self.listWidget.addItem(itemN) - self.listWidget.setItemWidget(itemN, widget) - - widget.pushButton.clicked.connect(lambda: self.listWidget.takeItem(self.listWidget.row(itemN))) - widget.pushButton.clicked.connect(lambda: self.deleteCurva) - widget.pushButton.clicked.connect(self.edited.emit) - widget.edited.connect(self.edited.emit) - -# try: -# if self.lastWidget: -# self.lastWidget.pushButton : QtWidgets.QPushButton -# self.lastWidget.setDisabled(True) -# lastWidget=self.lastWidget -# widget.pushButton.clicked.connect(lambda: lastWidget.setDisabled(False)) -# except: -# pass - - self.lastWidget=widget - itemN.setSizeHint(widget.sizeHint()) - self.listWidget.scrollToBottom() - self.edited.emit() - - def deleteCurva(self): - self.lastWidget=[self.listWidget.itemWidget(self.listWidget.item(i)) for i in range(self.listWidget.count())][-1] - if self.listWidget.count()==0: - self.lastWidget=False - - def readData(self): - for i in range(self.listWidget.count()): - yield self.listWidget.itemWidget(self.listWidget.item(i)).read() - - def read(self): - return self.lastWidget.read() - - def activeWidget(self): - return self.lastWidget - - def show(self): - self.edited.emit() - return super(CurvasCompositorDialog, self).show() - +from copy import deepcopy + +from qgis.PyQt import QtGui, uic, Qt, QtWidgets +import os +from qgis.PyQt.QtCore import pyqtSignal + +from ...model.utils import msgLog + +COMPOSI, _= uic.loadUiType(os.path.join(os.path.dirname(__file__), 'compor_curvas.ui')) +CWIDGET, _= uic.loadUiType(os.path.join(os.path.dirname(__file__), 'curvaWidget.ui')) + +class CurvasWidget(QtWidgets.QWidget, CWIDGET): + edited=pyqtSignal() + + def __init__(self, parent): + super(CurvasWidget,self).__init__(parent) + self.iface=parent + self.setupUi(self) + self.Form: QtWidgets.QWidget + + self.T: QtWidgets.QDoubleSpinBox + self.checkBox: QtWidgets.QCheckBox + self.comprimento: QtWidgets.QDoubleSpinBox + self.deflexao: QtWidgets.QDoubleSpinBox + self.k: QtWidgets.QLineEdit + self.label: QtWidgets.QLabel + self.label_2: QtWidgets.QLabel + self.label_3: QtWidgets.QLabel + self.label_4: QtWidgets.QLabel + self.label_5: QtWidgets.QLabel + self.label_6: QtWidgets.QLabel + self.nome: QtWidgets.QLabel + self.pushButton: QtWidgets.QPushButton + self.raio: QtWidgets.QDoubleSpinBox + self.vmax: QtWidgets.QLineEdit + self.parent.comboBox: QtWidgets.QComboBox + + self.setTipo(self.iface.comboBox.currentIndex()) + + if self.tipo=="T": + self.raio.setEnabled(False) + + self.modified="S" #Started + self.events() + + self.vmax.hide() + self.label_2.hide() + self.k.hide() + self.label.hide() + + def fill(self, data, k='',vmax=''): + T=data["T"] + raio=data["R"] + deflexao=data["D"] + comprimento=data["L"] + checkBoxState=data["C"] if data["C"] else False + + self.eventsDisconnect() + self.T: QtWidgets.QDoubleSpinBox + try: + self.k.setText(str(k)) + self.vmax.setText(str(vmax)) + self.T.setValue(T) + self.deflexao.setValue(deflexao) + self.raio.setValue(raio) + self.comprimento.setValue(comprimento) + self.checkBox.setChecked(checkBoxState) + + self.T.setEnabled(True) + self.raio.setEnabled(True) + self.deflexao.setEnabled(True) + self.comprimento.setEnabled(True) + self.checkBox.setEnabled(True) + + if "Disable" in data: + D=data["Disable"] + for d in D: + if d=="T": + self.T.setEnabled(False) + if d=="R": + self.raio.setEnabled(False) + if d=="D": + self.deflexao.setEnabled(False) + if d=="L": + self.comprimento.setEnabled(False) + if d=="C": + self.checkBox.setEnabled(False) + + self.events() + + except: + pass + + + def eventsDisconnect(self): + try: + self.raio.valueChanged.disconnect() + self.comprimento.valueChanged.disconnect() + self.T.valueChanged.disconnect() + self.deflexao.valueChanged.disconnect() + self.checkBox.stateChanged.disconnect() + except: + pass + + + def events(self): + self.raio.valueChanged.connect(lambda: self.setModified("R")) + self.raio.valueChanged.connect(self.edited.emit) + self.comprimento.valueChanged.connect(lambda: self.setModified("L")) + self.comprimento.valueChanged.connect(self.edited.emit) + self.T.valueChanged.connect(lambda: self.setModified("T")) + self.T.valueChanged.connect(self.edited.emit) + self.deflexao.valueChanged.connect(lambda: self.setModified("D")) + self.deflexao.valueChanged.connect(self.edited.emit) + self.checkBox.stateChanged.connect(lambda: self.setModified("C")) + self.checkBox.stateChanged.connect(self.edited.emit) + + + def setModified(self, s): + self.modified=s + + def setTipo(self, i=-1): + if i>=0: + if i==3: + self.tipo="EE" + elif i==0: + self.tipo="C" + elif i==1: + self.tipo="EC" + elif i==4: + self.tipo="ES" + elif i==2: + self.tipo= "T" + else: + msgLog("Os valores do combobox estão errados!") + self.tipo=None + return self.tipo + + def read(self): + try: + return self.tipo, self.modified, {"R": self.raio.value(), "L": self.comprimento.value(), + "T": self.T.value(), "D": self.deflexao.value(), "C": self.checkBox.isChecked(), "Disable": []} #tipo de curva, raio, comprimento (L) + except: + return self.tipo, None, None + +#DADOS: R, L, T, D float +# C bool +# Disable list (of index to setEnabled(false) + +EMPTY_DATA={"R":0.0, "L":0.0, "T":0.0, "D":0.0, "C": False} +def empty_data(): + return deepcopy(EMPTY_DATA) + + +class CurvasCompositorDialog(QtWidgets.QDialog, COMPOSI): + edited=pyqtSignal() + def __init__(self, parent): + super(CurvasCompositorDialog, self).__init__(parent) + self.iface=parent + self.setupUi(self) + + self.Dialog: QtWidgets.QDialog + self.btnAdd: QtWidgets.QPushButton + self.buttonBox: QtWidgets.QDialogButtonBox + self.comboBox: QtWidgets.QComboBox + self.listWidget: QtWidgets.QListWidget + self.lastWidget=False + self.btnAdd.clicked.connect(lambda: self.addCurva()) + + if self.iface.comboElemento.currentIndex() == 0: #Circular simples + self.comboBox.setCurrentIndex(0) + self.addCurva({'D': float(self.iface.txtDelta.text()), 'R': self.iface.txtRUtilizado.value(), 'T': float(self.iface.txtT.text()), 'L': 0, 'C': True}) + elif self.iface.comboElemento.currentIndex() == 1: #Circular simétrica com transição + self.comboBox.setCurrentIndex(1) + self.addCurva({'D': float(self.iface.txtDelta.text())-2*float(self.iface.theta.text()), 'R': self.iface.txtRUtilizado.value(), 'T': float(self.iface.txtT.text()), 'L': self.iface.Ls.value(), 'C': True}) + + def addCurva(self, data=None): + self.listWidget: QtWidgets.QListWidget + self.comboBox: QtWidgets.QComboBox + itemN = QtWidgets.QListWidgetItem() + widget = CurvasWidget(self) + widget.nome.setText(self.comboBox.currentText().upper()) + widget.horizontalLayout.addStretch() + widget.horizontalLayout.setSizeConstraint(QtWidgets.QLayout.SetFixedSize) + if data==None: + try: + _,_,data=self.lastWidget.read() + data["D"]=0 + data["C"]=False + widget.fill(data, k=self.lastWidget.k.text(), vmax=self.lastWidget.vmax.text()) + except: + pass + else: + widget.fill(data) + self.comboBox.hide() + self.btnAdd.hide() + #self.horizontalSpacer.hide() + + self.listWidget.addItem(itemN) + self.listWidget.setItemWidget(itemN, widget) + + widget.pushButton.clicked.connect(lambda: self.listWidget.takeItem(self.listWidget.row(itemN))) + widget.pushButton.clicked.connect(lambda: self.deleteCurva) + widget.pushButton.clicked.connect(self.edited.emit) + widget.edited.connect(self.edited.emit) + +# try: +# if self.lastWidget: +# self.lastWidget.pushButton : QtWidgets.QPushButton +# self.lastWidget.setDisabled(True) +# lastWidget=self.lastWidget +# widget.pushButton.clicked.connect(lambda: lastWidget.setDisabled(False)) +# except: +# pass + + self.lastWidget=widget + itemN.setSizeHint(widget.sizeHint()) + self.listWidget.scrollToBottom() + self.edited.emit() + + def deleteCurva(self): + self.lastWidget=[self.listWidget.itemWidget(self.listWidget.item(i)) for i in range(self.listWidget.count())][-1] + if self.listWidget.count()==0: + self.lastWidget=False + + def readData(self): + for i in range(self.listWidget.count()): + yield self.listWidget.itemWidget(self.listWidget.item(i)).read() + + def read(self): + return self.lastWidget.read() + + def activeWidget(self): + return self.lastWidget + + def show(self): + self.edited.emit() + return super(CurvasCompositorDialog, self).show() + diff --git a/app/view/ui/compile.sh b/app/view/ui/compile.sh index 974d395..03fc290 100755 --- a/app/view/ui/compile.sh +++ b/app/view/ui/compile.sh @@ -1,3 +1,3 @@ -#!/bin/bash -for i in *.ui; do pyuic5 -o "py/$i.py" $i; done - +#!/bin/bash +for i in *.ui; do pyuic5 -o "py/$i.py" $i; done + diff --git a/app/view/ui/compor_curvas.ui b/app/view/ui/compor_curvas.ui old mode 100644 new mode 100755 index a5f8f53..34e30d1 --- a/app/view/ui/compor_curvas.ui +++ b/app/view/ui/compor_curvas.ui @@ -1,128 +1,128 @@ - - - Dialog - - - - 0 - 0 - 613 - 626 - - - - - 580 - 0 - - - - Composição das Curvas - - - - - - <html><head/><body><p>Inserir tipo de curva definida a esquerda</p><p><br/></p></body></html> - - - Adicionar - - - - - - - <html><head/><body><p>Tipo de curva:</p><p>Circular: Curva com Raio Constante</p><p>Espiral: Clotóide ou Espiral de Cornu</p></body></html> - - - - Circular - - - - - Circular com Transição Simétrica - - - - - Tangente - - - - - Espiral de Entrada - - - - - Espiral de Saída - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - - buttonBox - accepted() - Dialog - accept() - - - 524 - 619 - - - 157 - 274 - - - - - buttonBox - rejected() - Dialog - reject() - - - 592 - 619 - - - 286 - 274 - - - - - + + + Dialog + + + + 0 + 0 + 613 + 626 + + + + + 580 + 0 + + + + Composição das Curvas + + + + + + <html><head/><body><p>Inserir tipo de curva definida a esquerda</p><p><br/></p></body></html> + + + Adicionar + + + + + + + <html><head/><body><p>Tipo de curva:</p><p>Circular: Curva com Raio Constante</p><p>Espiral: Clotóide ou Espiral de Cornu</p></body></html> + + + + Circular + + + + + Circular com Transição Simétrica + + + + + Tangente + + + + + Espiral de Entrada + + + + + Espiral de Saída + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + buttonBox + accepted() + Dialog + accept() + + + 524 + 619 + + + 157 + 274 + + + + + buttonBox + rejected() + Dialog + reject() + + + 592 + 619 + + + 286 + 274 + + + + + diff --git a/app/view/ui/cortePreview.ui b/app/view/ui/cortePreview.ui old mode 100644 new mode 100755 index 55b6bc4..6adf776 --- a/app/view/ui/cortePreview.ui +++ b/app/view/ui/cortePreview.ui @@ -1,369 +1,369 @@ - - - ExportarCorte - - - - 0 - 0 - 632 - 288 - - - - Exportar Corte - - - - - - Qt::Vertical - - - - - - - - 0 - 0 - - - - - Corte Horizontal - - - - - Corte Vertical - - - - - Corte Transversal - - - - - - - - - - De: - - - - - - - false - - - - 0 - 0 - - - - <html><head/><body><p>Estaca de partida.</p><p><br/></p></body></html> - - - 1000000000 - - - 20 - - - - - - - até - - - - - - - false - - - - 0 - 0 - - - - <html><head/><body><p>Última estaca (Será incluída).</p></body></html> - - - 1000000000 - - - 20 - - - - - - - - - Corte: - - - - - - - Tipo de Corte: - - - - - - - <html><head/><body><p>Intervalo de estacas para formar o desenho(s).</p></body></html> - - - Intervalo de progressivas: - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Preferred - - - - 40 - 20 - - - - - - - - <html><head/><body><p>Pré visualizar como será o desenho em uma janela separada.</p></body></html> - - - Visualizar - - - - - - - <html><head/><body><p>Exportar arquivo dxf.</p><p><br/></p></body></html> - - - Salvar - - - - - - - - 0 - 0 - - - - Qt::Horizontal - - - QDialogButtonBox::Ok - - - - - - - - - Qt::Horizontal - - - - - - - - - - - Profundidade: - - - - - - - - 0 - 0 - - - - <html><head/><body><p>Espessura do Corte.</p></body></html> - - - 3 - - - 1.000000000000000 - - - 10000.989999999999782 - - - 250.000000000000000 - - - - - - - m - - - - - - - - - - - Offset: - - - - - - - - 0 - 0 - - - - <html><head/><body><p>Afastamento do corte.</p></body></html> - - - - - - - m - - - - - - - - - - - Intervalo: - - - - - - - - 0 - 0 - - - - <html><head/><body><p>Intervalo no qual o corte é feito</p></body></html> - - - 3 - - - 0.100000000000000 - - - 10000.989999999999782 - - - 1.000000000000000 - - - - - - - m - - - - - - - - - - - <html><head/><body><p>Mostrar textos com numeração das estacas no arquivo.</p><p><br/></p></body></html> - - - Mostar Estacas - - - true - - - - - - - - - buttonBox - accepted() - ExportarCorte - accept() - - - 420 - 260 - - - 157 - 274 - - - - - buttonBox - rejected() - ExportarCorte - reject() - - - 316 - 260 - - - 286 - 274 - - - - - + + + ExportarCorte + + + + 0 + 0 + 632 + 288 + + + + Exportar Corte + + + + + + Qt::Vertical + + + + + + + + 0 + 0 + + + + + Corte Horizontal + + + + + Corte Vertical + + + + + Corte Transversal + + + + + + + + + + De: + + + + + + + false + + + + 0 + 0 + + + + <html><head/><body><p>Estaca de partida.</p><p><br/></p></body></html> + + + 1000000000 + + + 20 + + + + + + + até + + + + + + + false + + + + 0 + 0 + + + + <html><head/><body><p>Última estaca (Será incluída).</p></body></html> + + + 1000000000 + + + 20 + + + + + + + + + Corte: + + + + + + + Tipo de Corte: + + + + + + + <html><head/><body><p>Intervalo de estacas para formar o desenho(s).</p></body></html> + + + Intervalo de progressivas: + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Preferred + + + + 40 + 20 + + + + + + + + <html><head/><body><p>Pré visualizar como será o desenho em uma janela separada.</p></body></html> + + + Visualizar + + + + + + + <html><head/><body><p>Exportar arquivo dxf.</p><p><br/></p></body></html> + + + Salvar + + + + + + + + 0 + 0 + + + + Qt::Horizontal + + + QDialogButtonBox::Ok + + + + + + + + + Qt::Horizontal + + + + + + + + + + + Profundidade: + + + + + + + + 0 + 0 + + + + <html><head/><body><p>Espessura do Corte.</p></body></html> + + + 3 + + + 1.000000000000000 + + + 10000.989999999999782 + + + 250.000000000000000 + + + + + + + m + + + + + + + + + + + Offset: + + + + + + + + 0 + 0 + + + + <html><head/><body><p>Afastamento do corte.</p></body></html> + + + + + + + m + + + + + + + + + + + Intervalo: + + + + + + + + 0 + 0 + + + + <html><head/><body><p>Intervalo no qual o corte é feito</p></body></html> + + + 3 + + + 0.100000000000000 + + + 10000.989999999999782 + + + 1.000000000000000 + + + + + + + m + + + + + + + + + + + <html><head/><body><p>Mostrar textos com numeração das estacas no arquivo.</p><p><br/></p></body></html> + + + Mostar Estacas + + + true + + + + + + + + + buttonBox + accepted() + ExportarCorte + accept() + + + 420 + 260 + + + 157 + 274 + + + + + buttonBox + rejected() + ExportarCorte + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/app/view/ui/curvaWidget.ui b/app/view/ui/curvaWidget.ui old mode 100644 new mode 100755 index 42348b8..095cd25 --- a/app/view/ui/curvaWidget.ui +++ b/app/view/ui/curvaWidget.ui @@ -1,360 +1,360 @@ - - - Form - - - - 0 - 0 - 513 - 246 - - - - Form - - - - - - - - <html><head/><body><p>Parâmetro da curva Espiral (K)</p></body></html> - - - Parâmetro: - - - - - - - false - - - - 150 - 0 - - - - - 150 - 16777215 - - - - <html><head/><body><p>Parâmetro da curva Espiral (K)</p></body></html> - - - 0 - - - true - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - <html><head/><body><p>Velocidade Máxima para esse trecho de curva</p><p><br/></p></body></html> - - - Vmax: - - - - - - - false - - - - 150 - 0 - - - - - 150 - 16777215 - - - - <html><head/><body><p>Velocidade Máxima para esse trecho de curva</p><p><br/></p></body></html> - - - 0 - - - true - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - <html><head/><body><p>Tipo de elemento a ser adicionado</p><p><br/></p></body></html> - - - ERRO - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - <html><head/><body><p>Remover esse elemento ou curva</p><p><br/></p></body></html> - - - Excluir - - - - - - - - - - - - - <html><head/><body><p>Raio da curva</p></body></html> - - - Raio : - - - - - - - <html><head/><body><p>Raio da curva</p></body></html> - - - 3 - - - 100000.000000000000000 - - - 10.000000000000000 - - - 160.000000000000000 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - <html><head/><body><p>Deflexão da curva em graus</p><p><br/></p></body></html> - - - Deflexão: - - - - - - - 3 - - - -180.000000000000000 - - - 180.000000000000000 - - - 5.000000000000000 - - - - - - - - - - - <html><head/><body><p>Desenvolvimento da curva (L)</p></body></html> - - - Comprimento: - - - - - - - <html><head/><body><p>Desenvolvimento da curva (L)</p></body></html> - - - 3 - - - 1000000.000000000000000 - - - 10.000000000000000 - - - 60.000000000000000 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Afastamento: - - - - - - - 3 - - - 100000.000000000000000 - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Centralizar - - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - Qt::Horizontal - - - - - - - - + + + Form + + + + 0 + 0 + 513 + 246 + + + + Form + + + + + + + + <html><head/><body><p>Parâmetro da curva Espiral (K)</p></body></html> + + + Parâmetro: + + + + + + + false + + + + 150 + 0 + + + + + 150 + 16777215 + + + + <html><head/><body><p>Parâmetro da curva Espiral (K)</p></body></html> + + + 0 + + + true + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + <html><head/><body><p>Velocidade Máxima para esse trecho de curva</p><p><br/></p></body></html> + + + Vmax: + + + + + + + false + + + + 150 + 0 + + + + + 150 + 16777215 + + + + <html><head/><body><p>Velocidade Máxima para esse trecho de curva</p><p><br/></p></body></html> + + + 0 + + + true + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + <html><head/><body><p>Tipo de elemento a ser adicionado</p><p><br/></p></body></html> + + + ERRO + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + <html><head/><body><p>Remover esse elemento ou curva</p><p><br/></p></body></html> + + + Excluir + + + + + + + + + + + + + <html><head/><body><p>Raio da curva</p></body></html> + + + Raio : + + + + + + + <html><head/><body><p>Raio da curva</p></body></html> + + + 3 + + + 100000.000000000000000 + + + 10.000000000000000 + + + 160.000000000000000 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + <html><head/><body><p>Deflexão da curva em graus</p><p><br/></p></body></html> + + + Deflexão: + + + + + + + 3 + + + -180.000000000000000 + + + 180.000000000000000 + + + 5.000000000000000 + + + + + + + + + + + <html><head/><body><p>Desenvolvimento da curva (L)</p></body></html> + + + Comprimento: + + + + + + + <html><head/><body><p>Desenvolvimento da curva (L)</p></body></html> + + + 3 + + + 1000000.000000000000000 + + + 10.000000000000000 + + + 60.000000000000000 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Afastamento: + + + + + + + 3 + + + 100000.000000000000000 + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Centralizar + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Qt::Horizontal + + + + + + + + diff --git a/app/view/ui/cv.py b/app/view/ui/cv.py old mode 100644 new mode 100755 index 9c5eadd..646a128 --- a/app/view/ui/cv.py +++ b/app/view/ui/cv.py @@ -1,116 +1,116 @@ -# -*- coding: utf-8 -*- - -# Form implementation generated from reading ui file 'Topo_dialog-cv.ui' -# -# Created by: PyQt5 UI code generator 5.10.1 -# -# WARNING! All changes made in this file will be lost! - -from PyQt5 import QtCore, QtGui, QtWidgets - -class Ui_Dialog(object): - def setupUi(self, Dialog): - Dialog.setObjectName("Dialog") - Dialog.resize(745, 559) - self.buttonBox = QtWidgets.QDialogButtonBox(Dialog) - self.buttonBox.setGeometry(QtCore.QRect(340, 510, 391, 51)) - self.buttonBox.setOrientation(QtCore.Qt.Horizontal) - self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok) - self.buttonBox.setObjectName("buttonBox") - self.groupBox = QtWidgets.QGroupBox(Dialog) - self.groupBox.setGeometry(QtCore.QRect(10, 10, 731, 141)) - self.groupBox.setObjectName("groupBox") - self.widget = QtWidgets.QWidget(self.groupBox) - self.widget.setGeometry(QtCore.QRect(60, 60, 581, 39)) - self.widget.setObjectName("widget") - self.horizontalLayout = QtWidgets.QHBoxLayout(self.widget) - self.horizontalLayout.setContentsMargins(0, 0, 0, 0) - self.horizontalLayout.setObjectName("horizontalLayout") - self.cotaLabel = QtWidgets.QLabel(self.widget) - self.cotaLabel.setObjectName("cotaLabel") - self.horizontalLayout.addWidget(self.cotaLabel) - self.cota = QtWidgets.QLineEdit(self.widget) - self.cota.setObjectName("cota") - self.horizontalLayout.addWidget(self.cota) - spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) - self.horizontalLayout.addItem(spacerItem) - self.horizontalLabel = QtWidgets.QLabel(self.widget) - self.horizontalLabel.setObjectName("horizontalLabel") - self.horizontalLayout.addWidget(self.horizontalLabel) - self.horizontal = QtWidgets.QLineEdit(self.widget) - self.horizontal.setObjectName("horizontal") - self.horizontalLayout.addWidget(self.horizontal) - self.groupBox_2 = QtWidgets.QGroupBox(Dialog) - self.groupBox_2.setGeometry(QtCore.QRect(10, 170, 731, 321)) - self.groupBox_2.setObjectName("groupBox_2") - self.pushButton = QtWidgets.QPushButton(self.groupBox_2) - self.pushButton.setGeometry(QtCore.QRect(550, 230, 105, 39)) - self.pushButton.setObjectName("pushButton") - self.widget1 = QtWidgets.QWidget(self.groupBox_2) - self.widget1.setGeometry(QtCore.QRect(20, 240, 182, 39)) - self.widget1.setObjectName("widget1") - self.horizontalLayout_2 = QtWidgets.QHBoxLayout(self.widget1) - self.horizontalLayout_2.setContentsMargins(0, 0, 0, 0) - self.horizontalLayout_2.setObjectName("horizontalLayout_2") - self.cotaLabel_4 = QtWidgets.QLabel(self.widget1) - self.cotaLabel_4.setObjectName("cotaLabel_4") - self.horizontalLayout_2.addWidget(self.cotaLabel_4) - self.i2 = QtWidgets.QLineEdit(self.widget1) - self.i2.setObjectName("i2") - self.horizontalLayout_2.addWidget(self.i2) - self.widget2 = QtWidgets.QWidget(self.groupBox_2) - self.widget2.setGeometry(QtCore.QRect(20, 170, 182, 39)) - self.widget2.setObjectName("widget2") - self.horizontalLayout_3 = QtWidgets.QHBoxLayout(self.widget2) - self.horizontalLayout_3.setContentsMargins(0, 0, 0, 0) - self.horizontalLayout_3.setObjectName("horizontalLayout_3") - self.cotaLabel_3 = QtWidgets.QLabel(self.widget2) - self.cotaLabel_3.setObjectName("cotaLabel_3") - self.horizontalLayout_3.addWidget(self.cotaLabel_3) - self.i1 = QtWidgets.QLineEdit(self.widget2) - self.i1.setObjectName("i1") - self.horizontalLayout_3.addWidget(self.i1) - self.widget3 = QtWidgets.QWidget(self.groupBox_2) - self.widget3.setGeometry(QtCore.QRect(380, 120, 273, 39)) - self.widget3.setObjectName("widget3") - self.horizontalLayout_4 = QtWidgets.QHBoxLayout(self.widget3) - self.horizontalLayout_4.setContentsMargins(0, 0, 0, 0) - self.horizontalLayout_4.setObjectName("horizontalLayout_4") - self.cotaLabel_7 = QtWidgets.QLabel(self.widget3) - self.cotaLabel_7.setObjectName("cotaLabel_7") - self.horizontalLayout_4.addWidget(self.cotaLabel_7) - self.L = QtWidgets.QLineEdit(self.widget3) - self.L.setObjectName("L") - self.horizontalLayout_4.addWidget(self.L) - self.widget4 = QtWidgets.QWidget(self.groupBox_2) - self.widget4.setGeometry(QtCore.QRect(20, 70, 181, 39)) - self.widget4.setObjectName("widget4") - self.horizontalLayout_5 = QtWidgets.QHBoxLayout(self.widget4) - self.horizontalLayout_5.setContentsMargins(0, 0, 0, 0) - self.horizontalLayout_5.setObjectName("horizontalLayout_5") - self.cotaLabel_2 = QtWidgets.QLabel(self.widget4) - self.cotaLabel_2.setObjectName("cotaLabel_2") - self.horizontalLayout_5.addWidget(self.cotaLabel_2) - self.G = QtWidgets.QLineEdit(self.widget4) - self.G.setObjectName("G") - self.horizontalLayout_5.addWidget(self.G) - - self.retranslateUi(Dialog) - self.buttonBox.accepted.connect(Dialog.accept) - self.buttonBox.rejected.connect(Dialog.reject) - - QtCore.QMetaObject.connectSlotsByName(Dialog) - - def retranslateUi(self, Dialog): - _translate = QtCore.QCoreApplication.translate - Dialog.setWindowTitle(_translate("Dialog", "Modificar Curva Vertical")) - self.groupBox.setTitle(_translate("Dialog", "Vértice")) - self.cotaLabel.setText(_translate("Dialog", "Cota:")) - self.horizontalLabel.setText(_translate("Dialog", "Horizontal111: ")) - self.groupBox_2.setTitle(_translate("Dialog", "Curva Vertical")) - self.pushButton.setText(_translate("Dialog", "Ver Curva")) - self.cotaLabel_4.setText(_translate("Dialog", "i2: ")) - self.cotaLabel_3.setText(_translate("Dialog", "i1: ")) - self.cotaLabel_7.setText(_translate("Dialog", "Comprimento: ")) - self.cotaLabel_2.setText(_translate("Dialog", "G: ")) - +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'Topo_dialog-cv.ui' +# +# Created by: PyQt5 UI code generator 5.10.1 +# +# WARNING! All changes made in this file will be lost! + +from PyQt5 import QtCore, QtGui, QtWidgets + +class Ui_Dialog(object): + def setupUi(self, Dialog): + Dialog.setObjectName("Dialog") + Dialog.resize(745, 559) + self.buttonBox = QtWidgets.QDialogButtonBox(Dialog) + self.buttonBox.setGeometry(QtCore.QRect(340, 510, 391, 51)) + self.buttonBox.setOrientation(QtCore.Qt.Horizontal) + self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok) + self.buttonBox.setObjectName("buttonBox") + self.groupBox = QtWidgets.QGroupBox(Dialog) + self.groupBox.setGeometry(QtCore.QRect(10, 10, 731, 141)) + self.groupBox.setObjectName("groupBox") + self.widget = QtWidgets.QWidget(self.groupBox) + self.widget.setGeometry(QtCore.QRect(60, 60, 581, 39)) + self.widget.setObjectName("widget") + self.horizontalLayout = QtWidgets.QHBoxLayout(self.widget) + self.horizontalLayout.setContentsMargins(0, 0, 0, 0) + self.horizontalLayout.setObjectName("horizontalLayout") + self.cotaLabel = QtWidgets.QLabel(self.widget) + self.cotaLabel.setObjectName("cotaLabel") + self.horizontalLayout.addWidget(self.cotaLabel) + self.cota = QtWidgets.QLineEdit(self.widget) + self.cota.setObjectName("cota") + self.horizontalLayout.addWidget(self.cota) + spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) + self.horizontalLayout.addItem(spacerItem) + self.horizontalLabel = QtWidgets.QLabel(self.widget) + self.horizontalLabel.setObjectName("horizontalLabel") + self.horizontalLayout.addWidget(self.horizontalLabel) + self.horizontal = QtWidgets.QLineEdit(self.widget) + self.horizontal.setObjectName("horizontal") + self.horizontalLayout.addWidget(self.horizontal) + self.groupBox_2 = QtWidgets.QGroupBox(Dialog) + self.groupBox_2.setGeometry(QtCore.QRect(10, 170, 731, 321)) + self.groupBox_2.setObjectName("groupBox_2") + self.pushButton = QtWidgets.QPushButton(self.groupBox_2) + self.pushButton.setGeometry(QtCore.QRect(550, 230, 105, 39)) + self.pushButton.setObjectName("pushButton") + self.widget1 = QtWidgets.QWidget(self.groupBox_2) + self.widget1.setGeometry(QtCore.QRect(20, 240, 182, 39)) + self.widget1.setObjectName("widget1") + self.horizontalLayout_2 = QtWidgets.QHBoxLayout(self.widget1) + self.horizontalLayout_2.setContentsMargins(0, 0, 0, 0) + self.horizontalLayout_2.setObjectName("horizontalLayout_2") + self.cotaLabel_4 = QtWidgets.QLabel(self.widget1) + self.cotaLabel_4.setObjectName("cotaLabel_4") + self.horizontalLayout_2.addWidget(self.cotaLabel_4) + self.i2 = QtWidgets.QLineEdit(self.widget1) + self.i2.setObjectName("i2") + self.horizontalLayout_2.addWidget(self.i2) + self.widget2 = QtWidgets.QWidget(self.groupBox_2) + self.widget2.setGeometry(QtCore.QRect(20, 170, 182, 39)) + self.widget2.setObjectName("widget2") + self.horizontalLayout_3 = QtWidgets.QHBoxLayout(self.widget2) + self.horizontalLayout_3.setContentsMargins(0, 0, 0, 0) + self.horizontalLayout_3.setObjectName("horizontalLayout_3") + self.cotaLabel_3 = QtWidgets.QLabel(self.widget2) + self.cotaLabel_3.setObjectName("cotaLabel_3") + self.horizontalLayout_3.addWidget(self.cotaLabel_3) + self.i1 = QtWidgets.QLineEdit(self.widget2) + self.i1.setObjectName("i1") + self.horizontalLayout_3.addWidget(self.i1) + self.widget3 = QtWidgets.QWidget(self.groupBox_2) + self.widget3.setGeometry(QtCore.QRect(380, 120, 273, 39)) + self.widget3.setObjectName("widget3") + self.horizontalLayout_4 = QtWidgets.QHBoxLayout(self.widget3) + self.horizontalLayout_4.setContentsMargins(0, 0, 0, 0) + self.horizontalLayout_4.setObjectName("horizontalLayout_4") + self.cotaLabel_7 = QtWidgets.QLabel(self.widget3) + self.cotaLabel_7.setObjectName("cotaLabel_7") + self.horizontalLayout_4.addWidget(self.cotaLabel_7) + self.L = QtWidgets.QLineEdit(self.widget3) + self.L.setObjectName("L") + self.horizontalLayout_4.addWidget(self.L) + self.widget4 = QtWidgets.QWidget(self.groupBox_2) + self.widget4.setGeometry(QtCore.QRect(20, 70, 181, 39)) + self.widget4.setObjectName("widget4") + self.horizontalLayout_5 = QtWidgets.QHBoxLayout(self.widget4) + self.horizontalLayout_5.setContentsMargins(0, 0, 0, 0) + self.horizontalLayout_5.setObjectName("horizontalLayout_5") + self.cotaLabel_2 = QtWidgets.QLabel(self.widget4) + self.cotaLabel_2.setObjectName("cotaLabel_2") + self.horizontalLayout_5.addWidget(self.cotaLabel_2) + self.G = QtWidgets.QLineEdit(self.widget4) + self.G.setObjectName("G") + self.horizontalLayout_5.addWidget(self.G) + + self.retranslateUi(Dialog) + self.buttonBox.accepted.connect(Dialog.accept) + self.buttonBox.rejected.connect(Dialog.reject) + + QtCore.QMetaObject.connectSlotsByName(Dialog) + + def retranslateUi(self, Dialog): + _translate = QtCore.QCoreApplication.translate + Dialog.setWindowTitle(_translate("Dialog", "Modificar Curva Vertical")) + self.groupBox.setTitle(_translate("Dialog", "Vértice")) + self.cotaLabel.setText(_translate("Dialog", "Cota:")) + self.horizontalLabel.setText(_translate("Dialog", "Horizontal111: ")) + self.groupBox_2.setTitle(_translate("Dialog", "Curva Vertical")) + self.pushButton.setText(_translate("Dialog", "Ver Curva")) + self.cotaLabel_4.setText(_translate("Dialog", "i2: ")) + self.cotaLabel_3.setText(_translate("Dialog", "i1: ")) + self.cotaLabel_7.setText(_translate("Dialog", "Comprimento: ")) + self.cotaLabel_2.setText(_translate("Dialog", "G: ")) + diff --git a/app/view/ui/procura.ui b/app/view/ui/procura.ui old mode 100644 new mode 100755 index 1338a50..4a7bc83 --- a/app/view/ui/procura.ui +++ b/app/view/ui/procura.ui @@ -1,34 +1,34 @@ - - - Dialog - - - - 0 - 0 - 555 - 53 - - - - Procurar - - - - - - - - - Procurar - - - - - - - - - - - + + + Dialog + + + + 0 + 0 + 555 + 53 + + + + Procurar + + + + + + + + + Procurar + + + + + + + + + + + diff --git a/app/view/ui/progressBarDialog.ui b/app/view/ui/progressBarDialog.ui old mode 100644 new mode 100755 index 6a68652..fa84d24 --- a/app/view/ui/progressBarDialog.ui +++ b/app/view/ui/progressBarDialog.ui @@ -1,45 +1,45 @@ - - - Dialog - - - - 0 - 0 - 398 - 153 - - - - Aguarde - - - - - - 0 - - - - - - - - - - true - - - - - - - Por favor aguarde.... - - - - - - - - + + + Dialog + + + + 0 + 0 + 398 + 153 + + + + Aguarde + + + + + + 0 + + + + + + + + + + true + + + + + + + Por favor aguarde.... + + + + + + + + diff --git a/app/view/ui/py/TOPO_dialog_base.ui.py b/app/view/ui/py/TOPO_dialog_base.ui.py old mode 100644 new mode 100755 index f72801e..7d94dd7 --- a/app/view/ui/py/TOPO_dialog_base.ui.py +++ b/app/view/ui/py/TOPO_dialog_base.ui.py @@ -1,60 +1,60 @@ -# -*- coding: utf-8 -*- - -# Form implementation generated from reading ui file 'TOPO_dialog_base.ui' -# -# Created by: PyQt5 UI code generator 5.12.2 -# -# WARNING! All changes made in this file will be lost! - -from PyQt5 import QtCore, QtGui, QtWidgets - - -class Ui_TopoDialogBase(object): - def setupUi(self, TopoDialogBase): - TopoDialogBase.setObjectName("TopoDialogBase") - TopoDialogBase.setWindowModality(QtCore.Qt.WindowModal) - TopoDialogBase.resize(352, 277) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(TopoDialogBase.sizePolicy().hasHeightForWidth()) - TopoDialogBase.setSizePolicy(sizePolicy) - TopoDialogBase.setAutoFillBackground(False) - TopoDialogBase.setSizeGripEnabled(False) - self.gridLayout = QtWidgets.QGridLayout(TopoDialogBase) - self.gridLayout.setObjectName("gridLayout") - self.openFolder = QtWidgets.QPushButton(TopoDialogBase) - self.openFolder.setObjectName("openFolder") - self.gridLayout.addWidget(self.openFolder, 0, 0, 1, 1) - self.openMap = QtWidgets.QPushButton(TopoDialogBase) - self.openMap.setObjectName("openMap") - self.gridLayout.addWidget(self.openMap, 1, 0, 1, 1) - self.crsCombo = QtWidgets.QComboBox(TopoDialogBase) - self.crsCombo.setAcceptDrops(False) - self.crsCombo.setEditable(False) - self.crsCombo.setObjectName("crsCombo") - self.crsCombo.addItem("") - self.gridLayout.addWidget(self.crsCombo, 2, 0, 1, 1) - self.button_box = QtWidgets.QDialogButtonBox(TopoDialogBase) - self.button_box.setEnabled(True) - self.button_box.setOrientation(QtCore.Qt.Horizontal) - self.button_box.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok) - self.button_box.setObjectName("button_box") - self.gridLayout.addWidget(self.button_box, 3, 0, 1, 1) - self.actionOpenFolderAction = QtWidgets.QAction(TopoDialogBase) - self.actionOpenFolderAction.setObjectName("actionOpenFolderAction") - - self.retranslateUi(TopoDialogBase) - self.button_box.accepted.connect(TopoDialogBase.accept) - self.button_box.rejected.connect(TopoDialogBase.reject) - QtCore.QMetaObject.connectSlotsByName(TopoDialogBase) - - def retranslateUi(self, TopoDialogBase): - _translate = QtCore.QCoreApplication.translate - TopoDialogBase.setWindowTitle(_translate("TopoDialogBase", "Topo")) - self.openFolder.setText(_translate("TopoDialogBase", "Abrir Cartas")) - self.openMap.setText(_translate("TopoDialogBase", "Abrir Mapa")) - self.crsCombo.setItemText(0, _translate("TopoDialogBase", "Selecione qual sistemas de coordenadas")) - self.actionOpenFolderAction.setText(_translate("TopoDialogBase", "openFolderAction")) - - +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'TOPO_dialog_base.ui' +# +# Created by: PyQt5 UI code generator 5.12.2 +# +# WARNING! All changes made in this file will be lost! + +from PyQt5 import QtCore, QtGui, QtWidgets + + +class Ui_TopoDialogBase(object): + def setupUi(self, TopoDialogBase): + TopoDialogBase.setObjectName("TopoDialogBase") + TopoDialogBase.setWindowModality(QtCore.Qt.WindowModal) + TopoDialogBase.resize(352, 277) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(TopoDialogBase.sizePolicy().hasHeightForWidth()) + TopoDialogBase.setSizePolicy(sizePolicy) + TopoDialogBase.setAutoFillBackground(False) + TopoDialogBase.setSizeGripEnabled(False) + self.gridLayout = QtWidgets.QGridLayout(TopoDialogBase) + self.gridLayout.setObjectName("gridLayout") + self.openFolder = QtWidgets.QPushButton(TopoDialogBase) + self.openFolder.setObjectName("openFolder") + self.gridLayout.addWidget(self.openFolder, 0, 0, 1, 1) + self.openMap = QtWidgets.QPushButton(TopoDialogBase) + self.openMap.setObjectName("openMap") + self.gridLayout.addWidget(self.openMap, 1, 0, 1, 1) + self.crsCombo = QtWidgets.QComboBox(TopoDialogBase) + self.crsCombo.setAcceptDrops(False) + self.crsCombo.setEditable(False) + self.crsCombo.setObjectName("crsCombo") + self.crsCombo.addItem("") + self.gridLayout.addWidget(self.crsCombo, 2, 0, 1, 1) + self.button_box = QtWidgets.QDialogButtonBox(TopoDialogBase) + self.button_box.setEnabled(True) + self.button_box.setOrientation(QtCore.Qt.Horizontal) + self.button_box.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok) + self.button_box.setObjectName("button_box") + self.gridLayout.addWidget(self.button_box, 3, 0, 1, 1) + self.actionOpenFolderAction = QtWidgets.QAction(TopoDialogBase) + self.actionOpenFolderAction.setObjectName("actionOpenFolderAction") + + self.retranslateUi(TopoDialogBase) + self.button_box.accepted.connect(TopoDialogBase.accept) + self.button_box.rejected.connect(TopoDialogBase.reject) + QtCore.QMetaObject.connectSlotsByName(TopoDialogBase) + + def retranslateUi(self, TopoDialogBase): + _translate = QtCore.QCoreApplication.translate + TopoDialogBase.setWindowTitle(_translate("TopoDialogBase", "Topo")) + self.openFolder.setText(_translate("TopoDialogBase", "Abrir Cartas")) + self.openMap.setText(_translate("TopoDialogBase", "Abrir Mapa")) + self.crsCombo.setItemText(0, _translate("TopoDialogBase", "Selecione qual sistemas de coordenadas")) + self.actionOpenFolderAction.setText(_translate("TopoDialogBase", "openFolderAction")) + + diff --git a/app/view/ui/py/Topo_dialog-cv.ui.py b/app/view/ui/py/Topo_dialog-cv.ui.py old mode 100644 new mode 100755 index 8aa7df3..18f6e11 --- a/app/view/ui/py/Topo_dialog-cv.ui.py +++ b/app/view/ui/py/Topo_dialog-cv.ui.py @@ -1,552 +1,552 @@ -# -*- coding: utf-8 -*- - -# Form implementation generated from reading ui file 'Topo_dialog-cv.ui' -# -# Created by: PyQt5 UI code generator 5.12.2 -# -# WARNING! All changes made in this file will be lost! - -from PyQt5 import QtCore, QtGui, QtWidgets - - -class Ui_Dialog(object): - def setupUi(self, Dialog): - Dialog.setObjectName("Dialog") - Dialog.resize(916, 666) - self.groupBox = QtWidgets.QGroupBox(Dialog) - self.groupBox.setGeometry(QtCore.QRect(10, 10, 881, 241)) - self.groupBox.setObjectName("groupBox") - self.horizontalLayoutWidget = QtWidgets.QWidget(self.groupBox) - self.horizontalLayoutWidget.setGeometry(QtCore.QRect(10, 40, 932, 195)) - self.horizontalLayoutWidget.setObjectName("horizontalLayoutWidget") - self.horizontalLayout_10 = QtWidgets.QHBoxLayout(self.horizontalLayoutWidget) - self.horizontalLayout_10.setContentsMargins(0, 0, 0, 0) - self.horizontalLayout_10.setObjectName("horizontalLayout_10") - self.verticalLayout_5 = QtWidgets.QVBoxLayout() - self.verticalLayout_5.setObjectName("verticalLayout_5") - self.horizontalLayout_8 = QtWidgets.QHBoxLayout() - self.horizontalLayout_8.setObjectName("horizontalLayout_8") - self.label_7 = QtWidgets.QLabel(self.horizontalLayoutWidget) - self.label_7.setToolTip("") - self.label_7.setObjectName("label_7") - self.horizontalLayout_8.addWidget(self.label_7) - self.uiestaca1 = QtWidgets.QLabel(self.horizontalLayoutWidget) - self.uiestaca1.setToolTip("") - self.uiestaca1.setText("") - self.uiestaca1.setObjectName("uiestaca1") - self.horizontalLayout_8.addWidget(self.uiestaca1) - self.label_3 = QtWidgets.QLabel(self.horizontalLayoutWidget) - self.label_3.setToolTip("") - self.label_3.setObjectName("label_3") - self.horizontalLayout_8.addWidget(self.label_3) - spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) - self.horizontalLayout_8.addItem(spacerItem) - self.verticalLayout_5.addLayout(self.horizontalLayout_8) - self.horizontalLayout_14 = QtWidgets.QHBoxLayout() - self.horizontalLayout_14.setObjectName("horizontalLayout_14") - self.cotaLabel_6 = QtWidgets.QLabel(self.horizontalLayoutWidget) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.cotaLabel_6.sizePolicy().hasHeightForWidth()) - self.cotaLabel_6.setSizePolicy(sizePolicy) - self.cotaLabel_6.setToolTip("") - self.cotaLabel_6.setLineWidth(1) - self.cotaLabel_6.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) - self.cotaLabel_6.setWordWrap(False) - self.cotaLabel_6.setObjectName("cotaLabel_6") - self.horizontalLayout_14.addWidget(self.cotaLabel_6) - self.uicota1 = QtWidgets.QLineEdit(self.horizontalLayoutWidget) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Maximum) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.uicota1.sizePolicy().hasHeightForWidth()) - self.uicota1.setSizePolicy(sizePolicy) - self.uicota1.setToolTip("") - self.uicota1.setReadOnly(True) - self.uicota1.setObjectName("uicota1") - self.horizontalLayout_14.addWidget(self.uicota1) - spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Minimum) - self.horizontalLayout_14.addItem(spacerItem1) - self.verticalLayout_5.addLayout(self.horizontalLayout_14) - self.horizontalLayout_15 = QtWidgets.QHBoxLayout() - self.horizontalLayout_15.setObjectName("horizontalLayout_15") - self.verticalLayout_6 = QtWidgets.QVBoxLayout() - self.verticalLayout_6.setSpacing(1) - self.verticalLayout_6.setObjectName("verticalLayout_6") - self.label_8 = QtWidgets.QLabel(self.horizontalLayoutWidget) - self.label_8.setToolTip("") - self.label_8.setObjectName("label_8") - self.verticalLayout_6.addWidget(self.label_8) - self.label_9 = QtWidgets.QLabel(self.horizontalLayoutWidget) - self.label_9.setToolTip("") - self.label_9.setObjectName("label_9") - self.verticalLayout_6.addWidget(self.label_9) - self.horizontalLayout_15.addLayout(self.verticalLayout_6) - self.uihorizontal1 = QtWidgets.QLineEdit(self.horizontalLayoutWidget) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.uihorizontal1.sizePolicy().hasHeightForWidth()) - self.uihorizontal1.setSizePolicy(sizePolicy) - self.uihorizontal1.setToolTip("") - self.uihorizontal1.setObjectName("uihorizontal1") - self.horizontalLayout_15.addWidget(self.uihorizontal1) - spacerItem2 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Minimum) - self.horizontalLayout_15.addItem(spacerItem2) - self.verticalLayout_5.addLayout(self.horizontalLayout_15) - self.horizontalLayout_10.addLayout(self.verticalLayout_5) - self.verticalLayout = QtWidgets.QVBoxLayout() - self.verticalLayout.setObjectName("verticalLayout") - self.horizontalLayout_19 = QtWidgets.QHBoxLayout() - self.horizontalLayout_19.setObjectName("horizontalLayout_19") - self.label_16 = QtWidgets.QLabel(self.horizontalLayoutWidget) - self.label_16.setToolTip("") - self.label_16.setObjectName("label_16") - self.horizontalLayout_19.addWidget(self.label_16) - self.uiestaca = QtWidgets.QLabel(self.horizontalLayoutWidget) - self.uiestaca.setText("") - self.uiestaca.setObjectName("uiestaca") - self.horizontalLayout_19.addWidget(self.uiestaca) - self.label_4 = QtWidgets.QLabel(self.horizontalLayoutWidget) - self.label_4.setToolTip("") - self.label_4.setObjectName("label_4") - self.horizontalLayout_19.addWidget(self.label_4) - spacerItem3 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) - self.horizontalLayout_19.addItem(spacerItem3) - self.verticalLayout.addLayout(self.horizontalLayout_19) - self.horizontalLayout = QtWidgets.QHBoxLayout() - self.horizontalLayout.setObjectName("horizontalLayout") - self.cotaLabel = QtWidgets.QLabel(self.horizontalLayoutWidget) - self.cotaLabel.setToolTip("") - self.cotaLabel.setObjectName("cotaLabel") - self.horizontalLayout.addWidget(self.cotaLabel) - self.uicota = QtWidgets.QLineEdit(self.horizontalLayoutWidget) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.uicota.sizePolicy().hasHeightForWidth()) - self.uicota.setSizePolicy(sizePolicy) - self.uicota.setToolTip("") - self.uicota.setInputMethodHints(QtCore.Qt.ImhDigitsOnly|QtCore.Qt.ImhFormattedNumbersOnly|QtCore.Qt.ImhPreferNumbers) - self.uicota.setObjectName("uicota") - self.horizontalLayout.addWidget(self.uicota) - spacerItem4 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) - self.horizontalLayout.addItem(spacerItem4) - self.verticalLayout.addLayout(self.horizontalLayout) - self.verticalLayout_9 = QtWidgets.QVBoxLayout() - self.verticalLayout_9.setSpacing(1) - self.verticalLayout_9.setObjectName("verticalLayout_9") - spacerItem5 = QtWidgets.QSpacerItem(20, 50, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Preferred) - self.verticalLayout_9.addItem(spacerItem5) - self.verticalLayout.addLayout(self.verticalLayout_9) - self.horizontalLayout_10.addLayout(self.verticalLayout) - self.verticalLayout_7 = QtWidgets.QVBoxLayout() - self.verticalLayout_7.setObjectName("verticalLayout_7") - self.horizontalLayout_20 = QtWidgets.QHBoxLayout() - self.horizontalLayout_20.setObjectName("horizontalLayout_20") - self.label_18 = QtWidgets.QLabel(self.horizontalLayoutWidget) - self.label_18.setObjectName("label_18") - self.horizontalLayout_20.addWidget(self.label_18) - self.uiestaca2 = QtWidgets.QLabel(self.horizontalLayoutWidget) - self.uiestaca2.setToolTip("") - self.uiestaca2.setText("") - self.uiestaca2.setObjectName("uiestaca2") - self.horizontalLayout_20.addWidget(self.uiestaca2) - self.label_17 = QtWidgets.QLabel(self.horizontalLayoutWidget) - self.label_17.setObjectName("label_17") - self.horizontalLayout_20.addWidget(self.label_17) - spacerItem6 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) - self.horizontalLayout_20.addItem(spacerItem6) - self.verticalLayout_7.addLayout(self.horizontalLayout_20) - self.horizontalLayout_16 = QtWidgets.QHBoxLayout() - self.horizontalLayout_16.setObjectName("horizontalLayout_16") - self.cotaLabel_8 = QtWidgets.QLabel(self.horizontalLayoutWidget) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Preferred) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.cotaLabel_8.sizePolicy().hasHeightForWidth()) - self.cotaLabel_8.setSizePolicy(sizePolicy) - self.cotaLabel_8.setToolTip("") - self.cotaLabel_8.setObjectName("cotaLabel_8") - self.horizontalLayout_16.addWidget(self.cotaLabel_8) - spacerItem7 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Minimum) - self.horizontalLayout_16.addItem(spacerItem7) - self.uicota2 = QtWidgets.QLineEdit(self.horizontalLayoutWidget) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.uicota2.sizePolicy().hasHeightForWidth()) - self.uicota2.setSizePolicy(sizePolicy) - self.uicota2.setToolTip("") - self.uicota2.setReadOnly(True) - self.uicota2.setObjectName("uicota2") - self.horizontalLayout_16.addWidget(self.uicota2) - spacerItem8 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) - self.horizontalLayout_16.addItem(spacerItem8) - self.verticalLayout_7.addLayout(self.horizontalLayout_16) - self.horizontalLayout_17 = QtWidgets.QHBoxLayout() - self.horizontalLayout_17.setObjectName("horizontalLayout_17") - self.verticalLayout_8 = QtWidgets.QVBoxLayout() - self.verticalLayout_8.setSpacing(1) - self.verticalLayout_8.setObjectName("verticalLayout_8") - self.label_11 = QtWidgets.QLabel(self.horizontalLayoutWidget) - self.label_11.setObjectName("label_11") - self.verticalLayout_8.addWidget(self.label_11) - self.label_12 = QtWidgets.QLabel(self.horizontalLayoutWidget) - self.label_12.setObjectName("label_12") - self.verticalLayout_8.addWidget(self.label_12) - self.horizontalLayout_17.addLayout(self.verticalLayout_8) - self.uihorizontal2 = QtWidgets.QLineEdit(self.horizontalLayoutWidget) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.uihorizontal2.sizePolicy().hasHeightForWidth()) - self.uihorizontal2.setSizePolicy(sizePolicy) - self.uihorizontal2.setToolTip("") - self.uihorizontal2.setObjectName("uihorizontal2") - self.horizontalLayout_17.addWidget(self.uihorizontal2) - spacerItem9 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) - self.horizontalLayout_17.addItem(spacerItem9) - self.verticalLayout_7.addLayout(self.horizontalLayout_17) - self.horizontalLayout_10.addLayout(self.verticalLayout_7) - self.groupBox_2 = QtWidgets.QGroupBox(Dialog) - self.groupBox_2.setEnabled(True) - self.groupBox_2.setGeometry(QtCore.QRect(10, 310, 881, 301)) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Preferred) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.groupBox_2.sizePolicy().hasHeightForWidth()) - self.groupBox_2.setSizePolicy(sizePolicy) - self.groupBox_2.setObjectName("groupBox_2") - self.layoutWidget = QtWidgets.QWidget(self.groupBox_2) - self.layoutWidget.setGeometry(QtCore.QRect(20, 100, 221, 39)) - self.layoutWidget.setObjectName("layoutWidget") - self.horizontalLayout_2 = QtWidgets.QHBoxLayout(self.layoutWidget) - self.horizontalLayout_2.setContentsMargins(0, 0, 0, 0) - self.horizontalLayout_2.setObjectName("horizontalLayout_2") - self.cotaLabel_4 = QtWidgets.QLabel(self.layoutWidget) - self.cotaLabel_4.setToolTip("") - self.cotaLabel_4.setObjectName("cotaLabel_4") - self.horizontalLayout_2.addWidget(self.cotaLabel_4) - self.uii2 = QtWidgets.QLineEdit(self.layoutWidget) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.uii2.sizePolicy().hasHeightForWidth()) - self.uii2.setSizePolicy(sizePolicy) - self.uii2.setToolTip("") - self.uii2.setReadOnly(True) - self.uii2.setObjectName("uii2") - self.horizontalLayout_2.addWidget(self.uii2) - self.layoutWidget1 = QtWidgets.QWidget(self.groupBox_2) - self.layoutWidget1.setGeometry(QtCore.QRect(20, 50, 221, 39)) - self.layoutWidget1.setObjectName("layoutWidget1") - self.horizontalLayout_3 = QtWidgets.QHBoxLayout(self.layoutWidget1) - self.horizontalLayout_3.setContentsMargins(0, 0, 0, 0) - self.horizontalLayout_3.setObjectName("horizontalLayout_3") - self.cotaLabel_3 = QtWidgets.QLabel(self.layoutWidget1) - self.cotaLabel_3.setToolTip("") - self.cotaLabel_3.setObjectName("cotaLabel_3") - self.horizontalLayout_3.addWidget(self.cotaLabel_3) - self.uii1 = QtWidgets.QLineEdit(self.layoutWidget1) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.uii1.sizePolicy().hasHeightForWidth()) - self.uii1.setSizePolicy(sizePolicy) - self.uii1.setToolTip("") - self.uii1.setReadOnly(True) - self.uii1.setObjectName("uii1") - self.horizontalLayout_3.addWidget(self.uii1) - self.layoutWidget2 = QtWidgets.QWidget(self.groupBox_2) - self.layoutWidget2.setGeometry(QtCore.QRect(320, 50, 227, 39)) - self.layoutWidget2.setObjectName("layoutWidget2") - self.horizontalLayout_4 = QtWidgets.QHBoxLayout(self.layoutWidget2) - self.horizontalLayout_4.setContentsMargins(0, 0, 0, 0) - self.horizontalLayout_4.setObjectName("horizontalLayout_4") - self.cotaLabel_7 = QtWidgets.QLabel(self.layoutWidget2) - self.cotaLabel_7.setObjectName("cotaLabel_7") - self.horizontalLayout_4.addWidget(self.cotaLabel_7) - self.uiL = QtWidgets.QLineEdit(self.layoutWidget2) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.uiL.sizePolicy().hasHeightForWidth()) - self.uiL.setSizePolicy(sizePolicy) - self.uiL.setObjectName("uiL") - self.horizontalLayout_4.addWidget(self.uiL) - self.layoutWidget3 = QtWidgets.QWidget(self.groupBox_2) - self.layoutWidget3.setGeometry(QtCore.QRect(20, 150, 221, 39)) - self.layoutWidget3.setObjectName("layoutWidget3") - self.horizontalLayout_5 = QtWidgets.QHBoxLayout(self.layoutWidget3) - self.horizontalLayout_5.setContentsMargins(0, 0, 0, 0) - self.horizontalLayout_5.setObjectName("horizontalLayout_5") - self.cotaLabel_2 = QtWidgets.QLabel(self.layoutWidget3) - self.cotaLabel_2.setObjectName("cotaLabel_2") - self.horizontalLayout_5.addWidget(self.cotaLabel_2) - self.uiG = QtWidgets.QLineEdit(self.layoutWidget3) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.uiG.sizePolicy().hasHeightForWidth()) - self.uiG.setSizePolicy(sizePolicy) - self.uiG.setReadOnly(True) - self.uiG.setObjectName("uiG") - self.horizontalLayout_5.addWidget(self.uiG) - self.layoutWidget_2 = QtWidgets.QWidget(self.groupBox_2) - self.layoutWidget_2.setGeometry(QtCore.QRect(20, 200, 221, 39)) - self.layoutWidget_2.setObjectName("layoutWidget_2") - self.horizontalLayout_11 = QtWidgets.QHBoxLayout(self.layoutWidget_2) - self.horizontalLayout_11.setContentsMargins(0, 0, 0, 0) - self.horizontalLayout_11.setObjectName("horizontalLayout_11") - self.cotaLabel_9 = QtWidgets.QLabel(self.layoutWidget_2) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Preferred) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.cotaLabel_9.sizePolicy().hasHeightForWidth()) - self.cotaLabel_9.setSizePolicy(sizePolicy) - self.cotaLabel_9.setObjectName("cotaLabel_9") - self.horizontalLayout_11.addWidget(self.cotaLabel_9) - self.uiCurveType = QtWidgets.QLineEdit(self.layoutWidget_2) - self.uiCurveType.setEnabled(True) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.uiCurveType.sizePolicy().hasHeightForWidth()) - self.uiCurveType.setSizePolicy(sizePolicy) - self.uiCurveType.setReadOnly(True) - self.uiCurveType.setObjectName("uiCurveType") - self.horizontalLayout_11.addWidget(self.uiCurveType) - self.layoutWidget_3 = QtWidgets.QWidget(self.groupBox_2) - self.layoutWidget_3.setGeometry(QtCore.QRect(20, 250, 291, 39)) - self.layoutWidget_3.setObjectName("layoutWidget_3") - self.horizontalLayout_18 = QtWidgets.QHBoxLayout(self.layoutWidget_3) - self.horizontalLayout_18.setContentsMargins(0, 0, 0, 0) - self.horizontalLayout_18.setObjectName("horizontalLayout_18") - self.cotaLabel_10 = QtWidgets.QLabel(self.layoutWidget_3) - self.cotaLabel_10.setToolTip("") - self.cotaLabel_10.setObjectName("cotaLabel_10") - self.horizontalLayout_18.addWidget(self.cotaLabel_10) - self.uif = QtWidgets.QLineEdit(self.layoutWidget_3) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.uif.sizePolicy().hasHeightForWidth()) - self.uif.setSizePolicy(sizePolicy) - self.uif.setToolTip("") - self.uif.setReadOnly(True) - self.uif.setObjectName("uif") - self.horizontalLayout_18.addWidget(self.uif) - self.label_19 = QtWidgets.QLabel(self.layoutWidget_3) - self.label_19.setObjectName("label_19") - self.horizontalLayout_18.addWidget(self.label_19) - self.layoutWidget_4 = QtWidgets.QWidget(self.groupBox_2) - self.layoutWidget_4.setGeometry(QtCore.QRect(320, 250, 221, 39)) - self.layoutWidget_4.setObjectName("layoutWidget_4") - self.horizontalLayout_27 = QtWidgets.QHBoxLayout(self.layoutWidget_4) - self.horizontalLayout_27.setContentsMargins(0, 0, 0, 0) - self.horizontalLayout_27.setObjectName("horizontalLayout_27") - self.cotaLabel_19 = QtWidgets.QLabel(self.layoutWidget_4) - self.cotaLabel_19.setObjectName("cotaLabel_19") - self.horizontalLayout_27.addWidget(self.cotaLabel_19) - self.uiLdes = QtWidgets.QLineEdit(self.layoutWidget_4) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.uiLdes.sizePolicy().hasHeightForWidth()) - self.uiLdes.setSizePolicy(sizePolicy) - self.uiLdes.setReadOnly(True) - self.uiLdes.setObjectName("uiLdes") - self.horizontalLayout_27.addWidget(self.uiLdes) - self.layoutWidget_5 = QtWidgets.QWidget(self.groupBox_2) - self.layoutWidget_5.setGeometry(QtCore.QRect(320, 100, 221, 39)) - self.layoutWidget_5.setObjectName("layoutWidget_5") - self.horizontalLayout_28 = QtWidgets.QHBoxLayout(self.layoutWidget_5) - self.horizontalLayout_28.setContentsMargins(0, 0, 0, 0) - self.horizontalLayout_28.setObjectName("horizontalLayout_28") - self.cotaLabel_20 = QtWidgets.QLabel(self.layoutWidget_5) - self.cotaLabel_20.setObjectName("cotaLabel_20") - self.horizontalLayout_28.addWidget(self.cotaLabel_20) - self.uiKmin = QtWidgets.QLineEdit(self.layoutWidget_5) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.uiKmin.sizePolicy().hasHeightForWidth()) - self.uiKmin.setSizePolicy(sizePolicy) - self.uiKmin.setReadOnly(True) - self.uiKmin.setObjectName("uiKmin") - self.horizontalLayout_28.addWidget(self.uiKmin) - self.layoutWidget_6 = QtWidgets.QWidget(self.groupBox_2) - self.layoutWidget_6.setGeometry(QtCore.QRect(320, 150, 221, 39)) - self.layoutWidget_6.setObjectName("layoutWidget_6") - self.horizontalLayout_29 = QtWidgets.QHBoxLayout(self.layoutWidget_6) - self.horizontalLayout_29.setContentsMargins(0, 0, 0, 0) - self.horizontalLayout_29.setObjectName("horizontalLayout_29") - self.cotaLabel_21 = QtWidgets.QLabel(self.layoutWidget_6) - self.cotaLabel_21.setObjectName("cotaLabel_21") - self.horizontalLayout_29.addWidget(self.cotaLabel_21) - self.uiKdes = QtWidgets.QLineEdit(self.layoutWidget_6) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.uiKdes.sizePolicy().hasHeightForWidth()) - self.uiKdes.setSizePolicy(sizePolicy) - self.uiKdes.setReadOnly(True) - self.uiKdes.setObjectName("uiKdes") - self.horizontalLayout_29.addWidget(self.uiKdes) - self.layoutWidget_7 = QtWidgets.QWidget(self.groupBox_2) - self.layoutWidget_7.setGeometry(QtCore.QRect(320, 200, 221, 39)) - self.layoutWidget_7.setObjectName("layoutWidget_7") - self.horizontalLayout_30 = QtWidgets.QHBoxLayout(self.layoutWidget_7) - self.horizontalLayout_30.setContentsMargins(0, 0, 0, 0) - self.horizontalLayout_30.setObjectName("horizontalLayout_30") - self.cotaLabel_22 = QtWidgets.QLabel(self.layoutWidget_7) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Preferred) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.cotaLabel_22.sizePolicy().hasHeightForWidth()) - self.cotaLabel_22.setSizePolicy(sizePolicy) - self.cotaLabel_22.setObjectName("cotaLabel_22") - self.horizontalLayout_30.addWidget(self.cotaLabel_22) - self.uiLmin = QtWidgets.QLineEdit(self.layoutWidget_7) - self.uiLmin.setEnabled(True) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.uiLmin.sizePolicy().hasHeightForWidth()) - self.uiLmin.setSizePolicy(sizePolicy) - self.uiLmin.setReadOnly(True) - self.uiLmin.setObjectName("uiLmin") - self.horizontalLayout_30.addWidget(self.uiLmin) - self.layoutWidget_8 = QtWidgets.QWidget(self.groupBox_2) - self.layoutWidget_8.setGeometry(QtCore.QRect(600, 50, 241, 39)) - self.layoutWidget_8.setObjectName("layoutWidget_8") - self.horizontalLayout_31 = QtWidgets.QHBoxLayout(self.layoutWidget_8) - self.horizontalLayout_31.setContentsMargins(0, 0, 0, 0) - self.horizontalLayout_31.setObjectName("horizontalLayout_31") - self.cotaLabel_23 = QtWidgets.QLabel(self.layoutWidget_8) - self.cotaLabel_23.setObjectName("cotaLabel_23") - self.horizontalLayout_31.addWidget(self.cotaLabel_23) - self.uiLutilizado = QtWidgets.QDoubleSpinBox(self.layoutWidget_8) - self.uiLutilizado.setMaximum(99999.99) - self.uiLutilizado.setSingleStep(10.0) - self.uiLutilizado.setObjectName("uiLutilizado") - self.horizontalLayout_31.addWidget(self.uiLutilizado) - self.layoutWidget4 = QtWidgets.QWidget(self.groupBox_2) - self.layoutWidget4.setGeometry(QtCore.QRect(750, 130, 91, 86)) - self.layoutWidget4.setObjectName("layoutWidget4") - self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.layoutWidget4) - self.verticalLayout_2.setContentsMargins(0, 0, 0, 0) - self.verticalLayout_2.setObjectName("verticalLayout_2") - self.viewCurveBtn = QtWidgets.QPushButton(self.layoutWidget4) - self.viewCurveBtn.setObjectName("viewCurveBtn") - self.verticalLayout_2.addWidget(self.viewCurveBtn) - self.uiAlertaLb = QtWidgets.QLabel(self.groupBox_2) - self.uiAlertaLb.setGeometry(QtCore.QRect(580, 250, 251, 23)) - self.uiAlertaLb.setText("") - self.uiAlertaLb.setObjectName("uiAlertaLb") - self.addCurveBtn = QtWidgets.QPushButton(Dialog) - self.addCurveBtn.setGeometry(QtCore.QRect(350, 260, 171, 39)) - self.addCurveBtn.setObjectName("addCurveBtn") - self.layoutWidget5 = QtWidgets.QWidget(Dialog) - self.layoutWidget5.setGeometry(QtCore.QRect(10, 620, 881, 43)) - self.layoutWidget5.setObjectName("layoutWidget5") - self.horizontalLayout_7 = QtWidgets.QHBoxLayout(self.layoutWidget5) - self.horizontalLayout_7.setContentsMargins(0, 0, 0, 0) - self.horizontalLayout_7.setObjectName("horizontalLayout_7") - self.horizontalLayout_6 = QtWidgets.QHBoxLayout() - self.horizontalLayout_6.setObjectName("horizontalLayout_6") - self.label = QtWidgets.QLabel(self.layoutWidget5) - self.label.setObjectName("label") - self.horizontalLayout_6.addWidget(self.label) - self.verticeCb = QtWidgets.QComboBox(self.layoutWidget5) - self.verticeCb.setObjectName("verticeCb") - self.horizontalLayout_6.addWidget(self.verticeCb) - spacerItem10 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum) - self.horizontalLayout_6.addItem(spacerItem10) - self.previousBtn = QtWidgets.QPushButton(self.layoutWidget5) - self.previousBtn.setObjectName("previousBtn") - self.horizontalLayout_6.addWidget(self.previousBtn) - self.nextBtn = QtWidgets.QPushButton(self.layoutWidget5) - self.nextBtn.setObjectName("nextBtn") - self.horizontalLayout_6.addWidget(self.nextBtn) - spacerItem11 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) - self.horizontalLayout_6.addItem(spacerItem11) - self.cancelBtn = QtWidgets.QPushButton(self.layoutWidget5) - self.cancelBtn.setObjectName("cancelBtn") - self.horizontalLayout_6.addWidget(self.cancelBtn) - self.okBtn = QtWidgets.QPushButton(self.layoutWidget5) - self.okBtn.setObjectName("okBtn") - self.horizontalLayout_6.addWidget(self.okBtn) - self.horizontalLayout_7.addLayout(self.horizontalLayout_6) - self.cotaLabel_6.setBuddy(self.uicota1) - self.label_8.setBuddy(self.uihorizontal1) - self.cotaLabel.setBuddy(self.uicota) - self.cotaLabel_8.setBuddy(self.uicota2) - self.label_11.setBuddy(self.uihorizontal2) - self.label_12.setBuddy(self.uihorizontal2) - - self.retranslateUi(Dialog) - QtCore.QMetaObject.connectSlotsByName(Dialog) - Dialog.setTabOrder(self.uicota, self.uihorizontal1) - Dialog.setTabOrder(self.uihorizontal1, self.uihorizontal2) - Dialog.setTabOrder(self.uihorizontal2, self.addCurveBtn) - Dialog.setTabOrder(self.addCurveBtn, self.viewCurveBtn) - Dialog.setTabOrder(self.viewCurveBtn, self.nextBtn) - Dialog.setTabOrder(self.nextBtn, self.previousBtn) - Dialog.setTabOrder(self.previousBtn, self.verticeCb) - Dialog.setTabOrder(self.verticeCb, self.okBtn) - Dialog.setTabOrder(self.okBtn, self.cancelBtn) - Dialog.setTabOrder(self.cancelBtn, self.uicota1) - Dialog.setTabOrder(self.uicota1, self.uicota2) - Dialog.setTabOrder(self.uicota2, self.uii1) - Dialog.setTabOrder(self.uii1, self.uii2) - Dialog.setTabOrder(self.uii2, self.uiG) - Dialog.setTabOrder(self.uiG, self.uiCurveType) - Dialog.setTabOrder(self.uiCurveType, self.uif) - Dialog.setTabOrder(self.uif, self.uiL) - Dialog.setTabOrder(self.uiL, self.uiKmin) - Dialog.setTabOrder(self.uiKmin, self.uiKdes) - Dialog.setTabOrder(self.uiKdes, self.uiLmin) - Dialog.setTabOrder(self.uiLmin, self.uiLdes) - - def retranslateUi(self, Dialog): - _translate = QtCore.QCoreApplication.translate - Dialog.setWindowTitle(_translate("Dialog", "Modificar Curva Vertical")) - self.groupBox.setTitle(_translate("Dialog", "Dados")) - self.label_7.setText(_translate("Dialog", "Vértice 1 (")) - self.label_3.setText(_translate("Dialog", ")")) - self.cotaLabel_6.setText(_translate("Dialog", "Co&ta:")) - self.label_8.setText(_translate("Dialog", "&Distância")) - self.label_9.setText(_translate("Dialog", "Horizontal")) - self.label_16.setText(_translate("Dialog", "Vértice 2 (")) - self.label_4.setText(_translate("Dialog", ")")) - self.cotaLabel.setText(_translate("Dialog", "&Cota:")) - self.label_18.setText(_translate("Dialog", "Vértice 3 (")) - self.label_17.setText(_translate("Dialog", ")")) - self.cotaLabel_8.setText(_translate("Dialog", "Cota:")) - self.label_11.setText(_translate("Dialog", "Dist&ância")) - self.label_12.setText(_translate("Dialog", "Hori&zontal")) - self.groupBox_2.setTitle(_translate("Dialog", "Curva Vertical: Vértice 2")) - self.cotaLabel_4.setText(_translate("Dialog", "i2(%): ")) - self.cotaLabel_3.setText(_translate("Dialog", "i1(%): ")) - self.cotaLabel_7.setText(_translate("Dialog", "L( 0,6.V): ")) - self.cotaLabel_2.setText(_translate("Dialog", "g(%): ")) - self.cotaLabel_9.setText(_translate("Dialog", "Curva: ")) - self.cotaLabel_10.setText(_translate("Dialog", "f:")) - self.label_19.setText(_translate("Dialog", ". x²")) - self.cotaLabel_19.setText(_translate("Dialog", "L des:")) - self.cotaLabel_20.setText(_translate("Dialog", "Kmin:")) - self.cotaLabel_21.setText(_translate("Dialog", "Kdes:")) - self.cotaLabel_22.setText(_translate("Dialog", "L min:")) - self.cotaLabel_23.setText(_translate("Dialog", "L utilizado")) - self.viewCurveBtn.setText(_translate("Dialog", "Ver Curva")) - self.addCurveBtn.setText(_translate("Dialog", "ADICIONAR CURVA")) - self.label.setText(_translate("Dialog", "Vértice")) - self.previousBtn.setText(_translate("Dialog", "Anterior")) - self.nextBtn.setText(_translate("Dialog", "Próximo")) - self.cancelBtn.setText(_translate("Dialog", "Cancel")) - self.okBtn.setText(_translate("Dialog", "OK")) - - +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'Topo_dialog-cv.ui' +# +# Created by: PyQt5 UI code generator 5.12.2 +# +# WARNING! All changes made in this file will be lost! + +from PyQt5 import QtCore, QtGui, QtWidgets + + +class Ui_Dialog(object): + def setupUi(self, Dialog): + Dialog.setObjectName("Dialog") + Dialog.resize(916, 666) + self.groupBox = QtWidgets.QGroupBox(Dialog) + self.groupBox.setGeometry(QtCore.QRect(10, 10, 881, 241)) + self.groupBox.setObjectName("groupBox") + self.horizontalLayoutWidget = QtWidgets.QWidget(self.groupBox) + self.horizontalLayoutWidget.setGeometry(QtCore.QRect(10, 40, 932, 195)) + self.horizontalLayoutWidget.setObjectName("horizontalLayoutWidget") + self.horizontalLayout_10 = QtWidgets.QHBoxLayout(self.horizontalLayoutWidget) + self.horizontalLayout_10.setContentsMargins(0, 0, 0, 0) + self.horizontalLayout_10.setObjectName("horizontalLayout_10") + self.verticalLayout_5 = QtWidgets.QVBoxLayout() + self.verticalLayout_5.setObjectName("verticalLayout_5") + self.horizontalLayout_8 = QtWidgets.QHBoxLayout() + self.horizontalLayout_8.setObjectName("horizontalLayout_8") + self.label_7 = QtWidgets.QLabel(self.horizontalLayoutWidget) + self.label_7.setToolTip("") + self.label_7.setObjectName("label_7") + self.horizontalLayout_8.addWidget(self.label_7) + self.uiestaca1 = QtWidgets.QLabel(self.horizontalLayoutWidget) + self.uiestaca1.setToolTip("") + self.uiestaca1.setText("") + self.uiestaca1.setObjectName("uiestaca1") + self.horizontalLayout_8.addWidget(self.uiestaca1) + self.label_3 = QtWidgets.QLabel(self.horizontalLayoutWidget) + self.label_3.setToolTip("") + self.label_3.setObjectName("label_3") + self.horizontalLayout_8.addWidget(self.label_3) + spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) + self.horizontalLayout_8.addItem(spacerItem) + self.verticalLayout_5.addLayout(self.horizontalLayout_8) + self.horizontalLayout_14 = QtWidgets.QHBoxLayout() + self.horizontalLayout_14.setObjectName("horizontalLayout_14") + self.cotaLabel_6 = QtWidgets.QLabel(self.horizontalLayoutWidget) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.cotaLabel_6.sizePolicy().hasHeightForWidth()) + self.cotaLabel_6.setSizePolicy(sizePolicy) + self.cotaLabel_6.setToolTip("") + self.cotaLabel_6.setLineWidth(1) + self.cotaLabel_6.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) + self.cotaLabel_6.setWordWrap(False) + self.cotaLabel_6.setObjectName("cotaLabel_6") + self.horizontalLayout_14.addWidget(self.cotaLabel_6) + self.uicota1 = QtWidgets.QLineEdit(self.horizontalLayoutWidget) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Maximum) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.uicota1.sizePolicy().hasHeightForWidth()) + self.uicota1.setSizePolicy(sizePolicy) + self.uicota1.setToolTip("") + self.uicota1.setReadOnly(True) + self.uicota1.setObjectName("uicota1") + self.horizontalLayout_14.addWidget(self.uicota1) + spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Minimum) + self.horizontalLayout_14.addItem(spacerItem1) + self.verticalLayout_5.addLayout(self.horizontalLayout_14) + self.horizontalLayout_15 = QtWidgets.QHBoxLayout() + self.horizontalLayout_15.setObjectName("horizontalLayout_15") + self.verticalLayout_6 = QtWidgets.QVBoxLayout() + self.verticalLayout_6.setSpacing(1) + self.verticalLayout_6.setObjectName("verticalLayout_6") + self.label_8 = QtWidgets.QLabel(self.horizontalLayoutWidget) + self.label_8.setToolTip("") + self.label_8.setObjectName("label_8") + self.verticalLayout_6.addWidget(self.label_8) + self.label_9 = QtWidgets.QLabel(self.horizontalLayoutWidget) + self.label_9.setToolTip("") + self.label_9.setObjectName("label_9") + self.verticalLayout_6.addWidget(self.label_9) + self.horizontalLayout_15.addLayout(self.verticalLayout_6) + self.uihorizontal1 = QtWidgets.QLineEdit(self.horizontalLayoutWidget) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.uihorizontal1.sizePolicy().hasHeightForWidth()) + self.uihorizontal1.setSizePolicy(sizePolicy) + self.uihorizontal1.setToolTip("") + self.uihorizontal1.setObjectName("uihorizontal1") + self.horizontalLayout_15.addWidget(self.uihorizontal1) + spacerItem2 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Minimum) + self.horizontalLayout_15.addItem(spacerItem2) + self.verticalLayout_5.addLayout(self.horizontalLayout_15) + self.horizontalLayout_10.addLayout(self.verticalLayout_5) + self.verticalLayout = QtWidgets.QVBoxLayout() + self.verticalLayout.setObjectName("verticalLayout") + self.horizontalLayout_19 = QtWidgets.QHBoxLayout() + self.horizontalLayout_19.setObjectName("horizontalLayout_19") + self.label_16 = QtWidgets.QLabel(self.horizontalLayoutWidget) + self.label_16.setToolTip("") + self.label_16.setObjectName("label_16") + self.horizontalLayout_19.addWidget(self.label_16) + self.uiestaca = QtWidgets.QLabel(self.horizontalLayoutWidget) + self.uiestaca.setText("") + self.uiestaca.setObjectName("uiestaca") + self.horizontalLayout_19.addWidget(self.uiestaca) + self.label_4 = QtWidgets.QLabel(self.horizontalLayoutWidget) + self.label_4.setToolTip("") + self.label_4.setObjectName("label_4") + self.horizontalLayout_19.addWidget(self.label_4) + spacerItem3 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) + self.horizontalLayout_19.addItem(spacerItem3) + self.verticalLayout.addLayout(self.horizontalLayout_19) + self.horizontalLayout = QtWidgets.QHBoxLayout() + self.horizontalLayout.setObjectName("horizontalLayout") + self.cotaLabel = QtWidgets.QLabel(self.horizontalLayoutWidget) + self.cotaLabel.setToolTip("") + self.cotaLabel.setObjectName("cotaLabel") + self.horizontalLayout.addWidget(self.cotaLabel) + self.uicota = QtWidgets.QLineEdit(self.horizontalLayoutWidget) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.uicota.sizePolicy().hasHeightForWidth()) + self.uicota.setSizePolicy(sizePolicy) + self.uicota.setToolTip("") + self.uicota.setInputMethodHints(QtCore.Qt.ImhDigitsOnly|QtCore.Qt.ImhFormattedNumbersOnly|QtCore.Qt.ImhPreferNumbers) + self.uicota.setObjectName("uicota") + self.horizontalLayout.addWidget(self.uicota) + spacerItem4 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) + self.horizontalLayout.addItem(spacerItem4) + self.verticalLayout.addLayout(self.horizontalLayout) + self.verticalLayout_9 = QtWidgets.QVBoxLayout() + self.verticalLayout_9.setSpacing(1) + self.verticalLayout_9.setObjectName("verticalLayout_9") + spacerItem5 = QtWidgets.QSpacerItem(20, 50, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Preferred) + self.verticalLayout_9.addItem(spacerItem5) + self.verticalLayout.addLayout(self.verticalLayout_9) + self.horizontalLayout_10.addLayout(self.verticalLayout) + self.verticalLayout_7 = QtWidgets.QVBoxLayout() + self.verticalLayout_7.setObjectName("verticalLayout_7") + self.horizontalLayout_20 = QtWidgets.QHBoxLayout() + self.horizontalLayout_20.setObjectName("horizontalLayout_20") + self.label_18 = QtWidgets.QLabel(self.horizontalLayoutWidget) + self.label_18.setObjectName("label_18") + self.horizontalLayout_20.addWidget(self.label_18) + self.uiestaca2 = QtWidgets.QLabel(self.horizontalLayoutWidget) + self.uiestaca2.setToolTip("") + self.uiestaca2.setText("") + self.uiestaca2.setObjectName("uiestaca2") + self.horizontalLayout_20.addWidget(self.uiestaca2) + self.label_17 = QtWidgets.QLabel(self.horizontalLayoutWidget) + self.label_17.setObjectName("label_17") + self.horizontalLayout_20.addWidget(self.label_17) + spacerItem6 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) + self.horizontalLayout_20.addItem(spacerItem6) + self.verticalLayout_7.addLayout(self.horizontalLayout_20) + self.horizontalLayout_16 = QtWidgets.QHBoxLayout() + self.horizontalLayout_16.setObjectName("horizontalLayout_16") + self.cotaLabel_8 = QtWidgets.QLabel(self.horizontalLayoutWidget) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Preferred) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.cotaLabel_8.sizePolicy().hasHeightForWidth()) + self.cotaLabel_8.setSizePolicy(sizePolicy) + self.cotaLabel_8.setToolTip("") + self.cotaLabel_8.setObjectName("cotaLabel_8") + self.horizontalLayout_16.addWidget(self.cotaLabel_8) + spacerItem7 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Minimum) + self.horizontalLayout_16.addItem(spacerItem7) + self.uicota2 = QtWidgets.QLineEdit(self.horizontalLayoutWidget) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.uicota2.sizePolicy().hasHeightForWidth()) + self.uicota2.setSizePolicy(sizePolicy) + self.uicota2.setToolTip("") + self.uicota2.setReadOnly(True) + self.uicota2.setObjectName("uicota2") + self.horizontalLayout_16.addWidget(self.uicota2) + spacerItem8 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) + self.horizontalLayout_16.addItem(spacerItem8) + self.verticalLayout_7.addLayout(self.horizontalLayout_16) + self.horizontalLayout_17 = QtWidgets.QHBoxLayout() + self.horizontalLayout_17.setObjectName("horizontalLayout_17") + self.verticalLayout_8 = QtWidgets.QVBoxLayout() + self.verticalLayout_8.setSpacing(1) + self.verticalLayout_8.setObjectName("verticalLayout_8") + self.label_11 = QtWidgets.QLabel(self.horizontalLayoutWidget) + self.label_11.setObjectName("label_11") + self.verticalLayout_8.addWidget(self.label_11) + self.label_12 = QtWidgets.QLabel(self.horizontalLayoutWidget) + self.label_12.setObjectName("label_12") + self.verticalLayout_8.addWidget(self.label_12) + self.horizontalLayout_17.addLayout(self.verticalLayout_8) + self.uihorizontal2 = QtWidgets.QLineEdit(self.horizontalLayoutWidget) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.uihorizontal2.sizePolicy().hasHeightForWidth()) + self.uihorizontal2.setSizePolicy(sizePolicy) + self.uihorizontal2.setToolTip("") + self.uihorizontal2.setObjectName("uihorizontal2") + self.horizontalLayout_17.addWidget(self.uihorizontal2) + spacerItem9 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) + self.horizontalLayout_17.addItem(spacerItem9) + self.verticalLayout_7.addLayout(self.horizontalLayout_17) + self.horizontalLayout_10.addLayout(self.verticalLayout_7) + self.groupBox_2 = QtWidgets.QGroupBox(Dialog) + self.groupBox_2.setEnabled(True) + self.groupBox_2.setGeometry(QtCore.QRect(10, 310, 881, 301)) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Preferred) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.groupBox_2.sizePolicy().hasHeightForWidth()) + self.groupBox_2.setSizePolicy(sizePolicy) + self.groupBox_2.setObjectName("groupBox_2") + self.layoutWidget = QtWidgets.QWidget(self.groupBox_2) + self.layoutWidget.setGeometry(QtCore.QRect(20, 100, 221, 39)) + self.layoutWidget.setObjectName("layoutWidget") + self.horizontalLayout_2 = QtWidgets.QHBoxLayout(self.layoutWidget) + self.horizontalLayout_2.setContentsMargins(0, 0, 0, 0) + self.horizontalLayout_2.setObjectName("horizontalLayout_2") + self.cotaLabel_4 = QtWidgets.QLabel(self.layoutWidget) + self.cotaLabel_4.setToolTip("") + self.cotaLabel_4.setObjectName("cotaLabel_4") + self.horizontalLayout_2.addWidget(self.cotaLabel_4) + self.uii2 = QtWidgets.QLineEdit(self.layoutWidget) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.uii2.sizePolicy().hasHeightForWidth()) + self.uii2.setSizePolicy(sizePolicy) + self.uii2.setToolTip("") + self.uii2.setReadOnly(True) + self.uii2.setObjectName("uii2") + self.horizontalLayout_2.addWidget(self.uii2) + self.layoutWidget1 = QtWidgets.QWidget(self.groupBox_2) + self.layoutWidget1.setGeometry(QtCore.QRect(20, 50, 221, 39)) + self.layoutWidget1.setObjectName("layoutWidget1") + self.horizontalLayout_3 = QtWidgets.QHBoxLayout(self.layoutWidget1) + self.horizontalLayout_3.setContentsMargins(0, 0, 0, 0) + self.horizontalLayout_3.setObjectName("horizontalLayout_3") + self.cotaLabel_3 = QtWidgets.QLabel(self.layoutWidget1) + self.cotaLabel_3.setToolTip("") + self.cotaLabel_3.setObjectName("cotaLabel_3") + self.horizontalLayout_3.addWidget(self.cotaLabel_3) + self.uii1 = QtWidgets.QLineEdit(self.layoutWidget1) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.uii1.sizePolicy().hasHeightForWidth()) + self.uii1.setSizePolicy(sizePolicy) + self.uii1.setToolTip("") + self.uii1.setReadOnly(True) + self.uii1.setObjectName("uii1") + self.horizontalLayout_3.addWidget(self.uii1) + self.layoutWidget2 = QtWidgets.QWidget(self.groupBox_2) + self.layoutWidget2.setGeometry(QtCore.QRect(320, 50, 227, 39)) + self.layoutWidget2.setObjectName("layoutWidget2") + self.horizontalLayout_4 = QtWidgets.QHBoxLayout(self.layoutWidget2) + self.horizontalLayout_4.setContentsMargins(0, 0, 0, 0) + self.horizontalLayout_4.setObjectName("horizontalLayout_4") + self.cotaLabel_7 = QtWidgets.QLabel(self.layoutWidget2) + self.cotaLabel_7.setObjectName("cotaLabel_7") + self.horizontalLayout_4.addWidget(self.cotaLabel_7) + self.uiL = QtWidgets.QLineEdit(self.layoutWidget2) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.uiL.sizePolicy().hasHeightForWidth()) + self.uiL.setSizePolicy(sizePolicy) + self.uiL.setObjectName("uiL") + self.horizontalLayout_4.addWidget(self.uiL) + self.layoutWidget3 = QtWidgets.QWidget(self.groupBox_2) + self.layoutWidget3.setGeometry(QtCore.QRect(20, 150, 221, 39)) + self.layoutWidget3.setObjectName("layoutWidget3") + self.horizontalLayout_5 = QtWidgets.QHBoxLayout(self.layoutWidget3) + self.horizontalLayout_5.setContentsMargins(0, 0, 0, 0) + self.horizontalLayout_5.setObjectName("horizontalLayout_5") + self.cotaLabel_2 = QtWidgets.QLabel(self.layoutWidget3) + self.cotaLabel_2.setObjectName("cotaLabel_2") + self.horizontalLayout_5.addWidget(self.cotaLabel_2) + self.uiG = QtWidgets.QLineEdit(self.layoutWidget3) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.uiG.sizePolicy().hasHeightForWidth()) + self.uiG.setSizePolicy(sizePolicy) + self.uiG.setReadOnly(True) + self.uiG.setObjectName("uiG") + self.horizontalLayout_5.addWidget(self.uiG) + self.layoutWidget_2 = QtWidgets.QWidget(self.groupBox_2) + self.layoutWidget_2.setGeometry(QtCore.QRect(20, 200, 221, 39)) + self.layoutWidget_2.setObjectName("layoutWidget_2") + self.horizontalLayout_11 = QtWidgets.QHBoxLayout(self.layoutWidget_2) + self.horizontalLayout_11.setContentsMargins(0, 0, 0, 0) + self.horizontalLayout_11.setObjectName("horizontalLayout_11") + self.cotaLabel_9 = QtWidgets.QLabel(self.layoutWidget_2) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Preferred) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.cotaLabel_9.sizePolicy().hasHeightForWidth()) + self.cotaLabel_9.setSizePolicy(sizePolicy) + self.cotaLabel_9.setObjectName("cotaLabel_9") + self.horizontalLayout_11.addWidget(self.cotaLabel_9) + self.uiCurveType = QtWidgets.QLineEdit(self.layoutWidget_2) + self.uiCurveType.setEnabled(True) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.uiCurveType.sizePolicy().hasHeightForWidth()) + self.uiCurveType.setSizePolicy(sizePolicy) + self.uiCurveType.setReadOnly(True) + self.uiCurveType.setObjectName("uiCurveType") + self.horizontalLayout_11.addWidget(self.uiCurveType) + self.layoutWidget_3 = QtWidgets.QWidget(self.groupBox_2) + self.layoutWidget_3.setGeometry(QtCore.QRect(20, 250, 291, 39)) + self.layoutWidget_3.setObjectName("layoutWidget_3") + self.horizontalLayout_18 = QtWidgets.QHBoxLayout(self.layoutWidget_3) + self.horizontalLayout_18.setContentsMargins(0, 0, 0, 0) + self.horizontalLayout_18.setObjectName("horizontalLayout_18") + self.cotaLabel_10 = QtWidgets.QLabel(self.layoutWidget_3) + self.cotaLabel_10.setToolTip("") + self.cotaLabel_10.setObjectName("cotaLabel_10") + self.horizontalLayout_18.addWidget(self.cotaLabel_10) + self.uif = QtWidgets.QLineEdit(self.layoutWidget_3) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.uif.sizePolicy().hasHeightForWidth()) + self.uif.setSizePolicy(sizePolicy) + self.uif.setToolTip("") + self.uif.setReadOnly(True) + self.uif.setObjectName("uif") + self.horizontalLayout_18.addWidget(self.uif) + self.label_19 = QtWidgets.QLabel(self.layoutWidget_3) + self.label_19.setObjectName("label_19") + self.horizontalLayout_18.addWidget(self.label_19) + self.layoutWidget_4 = QtWidgets.QWidget(self.groupBox_2) + self.layoutWidget_4.setGeometry(QtCore.QRect(320, 250, 221, 39)) + self.layoutWidget_4.setObjectName("layoutWidget_4") + self.horizontalLayout_27 = QtWidgets.QHBoxLayout(self.layoutWidget_4) + self.horizontalLayout_27.setContentsMargins(0, 0, 0, 0) + self.horizontalLayout_27.setObjectName("horizontalLayout_27") + self.cotaLabel_19 = QtWidgets.QLabel(self.layoutWidget_4) + self.cotaLabel_19.setObjectName("cotaLabel_19") + self.horizontalLayout_27.addWidget(self.cotaLabel_19) + self.uiLdes = QtWidgets.QLineEdit(self.layoutWidget_4) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.uiLdes.sizePolicy().hasHeightForWidth()) + self.uiLdes.setSizePolicy(sizePolicy) + self.uiLdes.setReadOnly(True) + self.uiLdes.setObjectName("uiLdes") + self.horizontalLayout_27.addWidget(self.uiLdes) + self.layoutWidget_5 = QtWidgets.QWidget(self.groupBox_2) + self.layoutWidget_5.setGeometry(QtCore.QRect(320, 100, 221, 39)) + self.layoutWidget_5.setObjectName("layoutWidget_5") + self.horizontalLayout_28 = QtWidgets.QHBoxLayout(self.layoutWidget_5) + self.horizontalLayout_28.setContentsMargins(0, 0, 0, 0) + self.horizontalLayout_28.setObjectName("horizontalLayout_28") + self.cotaLabel_20 = QtWidgets.QLabel(self.layoutWidget_5) + self.cotaLabel_20.setObjectName("cotaLabel_20") + self.horizontalLayout_28.addWidget(self.cotaLabel_20) + self.uiKmin = QtWidgets.QLineEdit(self.layoutWidget_5) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.uiKmin.sizePolicy().hasHeightForWidth()) + self.uiKmin.setSizePolicy(sizePolicy) + self.uiKmin.setReadOnly(True) + self.uiKmin.setObjectName("uiKmin") + self.horizontalLayout_28.addWidget(self.uiKmin) + self.layoutWidget_6 = QtWidgets.QWidget(self.groupBox_2) + self.layoutWidget_6.setGeometry(QtCore.QRect(320, 150, 221, 39)) + self.layoutWidget_6.setObjectName("layoutWidget_6") + self.horizontalLayout_29 = QtWidgets.QHBoxLayout(self.layoutWidget_6) + self.horizontalLayout_29.setContentsMargins(0, 0, 0, 0) + self.horizontalLayout_29.setObjectName("horizontalLayout_29") + self.cotaLabel_21 = QtWidgets.QLabel(self.layoutWidget_6) + self.cotaLabel_21.setObjectName("cotaLabel_21") + self.horizontalLayout_29.addWidget(self.cotaLabel_21) + self.uiKdes = QtWidgets.QLineEdit(self.layoutWidget_6) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.uiKdes.sizePolicy().hasHeightForWidth()) + self.uiKdes.setSizePolicy(sizePolicy) + self.uiKdes.setReadOnly(True) + self.uiKdes.setObjectName("uiKdes") + self.horizontalLayout_29.addWidget(self.uiKdes) + self.layoutWidget_7 = QtWidgets.QWidget(self.groupBox_2) + self.layoutWidget_7.setGeometry(QtCore.QRect(320, 200, 221, 39)) + self.layoutWidget_7.setObjectName("layoutWidget_7") + self.horizontalLayout_30 = QtWidgets.QHBoxLayout(self.layoutWidget_7) + self.horizontalLayout_30.setContentsMargins(0, 0, 0, 0) + self.horizontalLayout_30.setObjectName("horizontalLayout_30") + self.cotaLabel_22 = QtWidgets.QLabel(self.layoutWidget_7) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Preferred) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.cotaLabel_22.sizePolicy().hasHeightForWidth()) + self.cotaLabel_22.setSizePolicy(sizePolicy) + self.cotaLabel_22.setObjectName("cotaLabel_22") + self.horizontalLayout_30.addWidget(self.cotaLabel_22) + self.uiLmin = QtWidgets.QLineEdit(self.layoutWidget_7) + self.uiLmin.setEnabled(True) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.uiLmin.sizePolicy().hasHeightForWidth()) + self.uiLmin.setSizePolicy(sizePolicy) + self.uiLmin.setReadOnly(True) + self.uiLmin.setObjectName("uiLmin") + self.horizontalLayout_30.addWidget(self.uiLmin) + self.layoutWidget_8 = QtWidgets.QWidget(self.groupBox_2) + self.layoutWidget_8.setGeometry(QtCore.QRect(600, 50, 241, 39)) + self.layoutWidget_8.setObjectName("layoutWidget_8") + self.horizontalLayout_31 = QtWidgets.QHBoxLayout(self.layoutWidget_8) + self.horizontalLayout_31.setContentsMargins(0, 0, 0, 0) + self.horizontalLayout_31.setObjectName("horizontalLayout_31") + self.cotaLabel_23 = QtWidgets.QLabel(self.layoutWidget_8) + self.cotaLabel_23.setObjectName("cotaLabel_23") + self.horizontalLayout_31.addWidget(self.cotaLabel_23) + self.uiLutilizado = QtWidgets.QDoubleSpinBox(self.layoutWidget_8) + self.uiLutilizado.setMaximum(99999.99) + self.uiLutilizado.setSingleStep(10.0) + self.uiLutilizado.setObjectName("uiLutilizado") + self.horizontalLayout_31.addWidget(self.uiLutilizado) + self.layoutWidget4 = QtWidgets.QWidget(self.groupBox_2) + self.layoutWidget4.setGeometry(QtCore.QRect(750, 130, 91, 86)) + self.layoutWidget4.setObjectName("layoutWidget4") + self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.layoutWidget4) + self.verticalLayout_2.setContentsMargins(0, 0, 0, 0) + self.verticalLayout_2.setObjectName("verticalLayout_2") + self.viewCurveBtn = QtWidgets.QPushButton(self.layoutWidget4) + self.viewCurveBtn.setObjectName("viewCurveBtn") + self.verticalLayout_2.addWidget(self.viewCurveBtn) + self.uiAlertaLb = QtWidgets.QLabel(self.groupBox_2) + self.uiAlertaLb.setGeometry(QtCore.QRect(580, 250, 251, 23)) + self.uiAlertaLb.setText("") + self.uiAlertaLb.setObjectName("uiAlertaLb") + self.addCurveBtn = QtWidgets.QPushButton(Dialog) + self.addCurveBtn.setGeometry(QtCore.QRect(350, 260, 171, 39)) + self.addCurveBtn.setObjectName("addCurveBtn") + self.layoutWidget5 = QtWidgets.QWidget(Dialog) + self.layoutWidget5.setGeometry(QtCore.QRect(10, 620, 881, 43)) + self.layoutWidget5.setObjectName("layoutWidget5") + self.horizontalLayout_7 = QtWidgets.QHBoxLayout(self.layoutWidget5) + self.horizontalLayout_7.setContentsMargins(0, 0, 0, 0) + self.horizontalLayout_7.setObjectName("horizontalLayout_7") + self.horizontalLayout_6 = QtWidgets.QHBoxLayout() + self.horizontalLayout_6.setObjectName("horizontalLayout_6") + self.label = QtWidgets.QLabel(self.layoutWidget5) + self.label.setObjectName("label") + self.horizontalLayout_6.addWidget(self.label) + self.verticeCb = QtWidgets.QComboBox(self.layoutWidget5) + self.verticeCb.setObjectName("verticeCb") + self.horizontalLayout_6.addWidget(self.verticeCb) + spacerItem10 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum) + self.horizontalLayout_6.addItem(spacerItem10) + self.previousBtn = QtWidgets.QPushButton(self.layoutWidget5) + self.previousBtn.setObjectName("previousBtn") + self.horizontalLayout_6.addWidget(self.previousBtn) + self.nextBtn = QtWidgets.QPushButton(self.layoutWidget5) + self.nextBtn.setObjectName("nextBtn") + self.horizontalLayout_6.addWidget(self.nextBtn) + spacerItem11 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) + self.horizontalLayout_6.addItem(spacerItem11) + self.cancelBtn = QtWidgets.QPushButton(self.layoutWidget5) + self.cancelBtn.setObjectName("cancelBtn") + self.horizontalLayout_6.addWidget(self.cancelBtn) + self.okBtn = QtWidgets.QPushButton(self.layoutWidget5) + self.okBtn.setObjectName("okBtn") + self.horizontalLayout_6.addWidget(self.okBtn) + self.horizontalLayout_7.addLayout(self.horizontalLayout_6) + self.cotaLabel_6.setBuddy(self.uicota1) + self.label_8.setBuddy(self.uihorizontal1) + self.cotaLabel.setBuddy(self.uicota) + self.cotaLabel_8.setBuddy(self.uicota2) + self.label_11.setBuddy(self.uihorizontal2) + self.label_12.setBuddy(self.uihorizontal2) + + self.retranslateUi(Dialog) + QtCore.QMetaObject.connectSlotsByName(Dialog) + Dialog.setTabOrder(self.uicota, self.uihorizontal1) + Dialog.setTabOrder(self.uihorizontal1, self.uihorizontal2) + Dialog.setTabOrder(self.uihorizontal2, self.addCurveBtn) + Dialog.setTabOrder(self.addCurveBtn, self.viewCurveBtn) + Dialog.setTabOrder(self.viewCurveBtn, self.nextBtn) + Dialog.setTabOrder(self.nextBtn, self.previousBtn) + Dialog.setTabOrder(self.previousBtn, self.verticeCb) + Dialog.setTabOrder(self.verticeCb, self.okBtn) + Dialog.setTabOrder(self.okBtn, self.cancelBtn) + Dialog.setTabOrder(self.cancelBtn, self.uicota1) + Dialog.setTabOrder(self.uicota1, self.uicota2) + Dialog.setTabOrder(self.uicota2, self.uii1) + Dialog.setTabOrder(self.uii1, self.uii2) + Dialog.setTabOrder(self.uii2, self.uiG) + Dialog.setTabOrder(self.uiG, self.uiCurveType) + Dialog.setTabOrder(self.uiCurveType, self.uif) + Dialog.setTabOrder(self.uif, self.uiL) + Dialog.setTabOrder(self.uiL, self.uiKmin) + Dialog.setTabOrder(self.uiKmin, self.uiKdes) + Dialog.setTabOrder(self.uiKdes, self.uiLmin) + Dialog.setTabOrder(self.uiLmin, self.uiLdes) + + def retranslateUi(self, Dialog): + _translate = QtCore.QCoreApplication.translate + Dialog.setWindowTitle(_translate("Dialog", "Modificar Curva Vertical")) + self.groupBox.setTitle(_translate("Dialog", "Dados")) + self.label_7.setText(_translate("Dialog", "Vértice 1 (")) + self.label_3.setText(_translate("Dialog", ")")) + self.cotaLabel_6.setText(_translate("Dialog", "Co&ta:")) + self.label_8.setText(_translate("Dialog", "&Distância")) + self.label_9.setText(_translate("Dialog", "Horizontal")) + self.label_16.setText(_translate("Dialog", "Vértice 2 (")) + self.label_4.setText(_translate("Dialog", ")")) + self.cotaLabel.setText(_translate("Dialog", "&Cota:")) + self.label_18.setText(_translate("Dialog", "Vértice 3 (")) + self.label_17.setText(_translate("Dialog", ")")) + self.cotaLabel_8.setText(_translate("Dialog", "Cota:")) + self.label_11.setText(_translate("Dialog", "Dist&ância")) + self.label_12.setText(_translate("Dialog", "Hori&zontal")) + self.groupBox_2.setTitle(_translate("Dialog", "Curva Vertical: Vértice 2")) + self.cotaLabel_4.setText(_translate("Dialog", "i2(%): ")) + self.cotaLabel_3.setText(_translate("Dialog", "i1(%): ")) + self.cotaLabel_7.setText(_translate("Dialog", "L( 0,6.V): ")) + self.cotaLabel_2.setText(_translate("Dialog", "g(%): ")) + self.cotaLabel_9.setText(_translate("Dialog", "Curva: ")) + self.cotaLabel_10.setText(_translate("Dialog", "f:")) + self.label_19.setText(_translate("Dialog", ". x²")) + self.cotaLabel_19.setText(_translate("Dialog", "L des:")) + self.cotaLabel_20.setText(_translate("Dialog", "Kmin:")) + self.cotaLabel_21.setText(_translate("Dialog", "Kdes:")) + self.cotaLabel_22.setText(_translate("Dialog", "L min:")) + self.cotaLabel_23.setText(_translate("Dialog", "L utilizado")) + self.viewCurveBtn.setText(_translate("Dialog", "Ver Curva")) + self.addCurveBtn.setText(_translate("Dialog", "ADICIONAR CURVA")) + self.label.setText(_translate("Dialog", "Vértice")) + self.previousBtn.setText(_translate("Dialog", "Anterior")) + self.nextBtn.setText(_translate("Dialog", "Próximo")) + self.cancelBtn.setText(_translate("Dialog", "Cancel")) + self.okBtn.setText(_translate("Dialog", "OK")) + + diff --git a/app/view/ui/py/Topo_dialog_conf.ui.py b/app/view/ui/py/Topo_dialog_conf.ui.py old mode 100644 new mode 100755 index 6ddc891..374063b --- a/app/view/ui/py/Topo_dialog_conf.ui.py +++ b/app/view/ui/py/Topo_dialog_conf.ui.py @@ -1,339 +1,339 @@ -# -*- coding: utf-8 -*- - -# Form implementation generated from reading ui file 'Topo_dialog_conf.ui' -# -# Created by: PyQt5 UI code generator 5.12.2 -# -# WARNING! All changes made in this file will be lost! - -from PyQt5 import QtCore, QtGui, QtWidgets - - -class Ui_TopoDialogBase(object): - def setupUi(self, TopoDialogBase): - TopoDialogBase.setObjectName("TopoDialogBase") - TopoDialogBase.setWindowModality(QtCore.Qt.WindowModal) - TopoDialogBase.resize(820, 653) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(TopoDialogBase.sizePolicy().hasHeightForWidth()) - TopoDialogBase.setSizePolicy(sizePolicy) - TopoDialogBase.setMinimumSize(QtCore.QSize(820, 300)) - TopoDialogBase.setAutoFillBackground(False) - TopoDialogBase.setSizeGripEnabled(False) - self.gridLayout = QtWidgets.QGridLayout(TopoDialogBase) - self.gridLayout.setObjectName("gridLayout") - self.horizontalLayout_3 = QtWidgets.QHBoxLayout() - self.horizontalLayout_3.setObjectName("horizontalLayout_3") - self.label_14 = QtWidgets.QLabel(TopoDialogBase) - self.label_14.setObjectName("label_14") - self.horizontalLayout_3.addWidget(self.label_14) - self.velProj = QtWidgets.QDoubleSpinBox(TopoDialogBase) - self.velProj.setMaximum(400.0) - self.velProj.setProperty("value", 100.0) - self.velProj.setObjectName("velProj") - self.horizontalLayout_3.addWidget(self.velProj) - self.label_8 = QtWidgets.QLabel(TopoDialogBase) - self.label_8.setObjectName("label_8") - self.horizontalLayout_3.addWidget(self.label_8) - self.gridLayout.addLayout(self.horizontalLayout_3, 12, 1, 1, 1) - spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) - self.gridLayout.addItem(spacerItem, 11, 2, 1, 1) - self.horizontalLayout_6 = QtWidgets.QHBoxLayout() - self.horizontalLayout_6.setObjectName("horizontalLayout_6") - self.label_emax = QtWidgets.QLabel(TopoDialogBase) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Preferred) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.label_emax.sizePolicy().hasHeightForWidth()) - self.label_emax.setSizePolicy(sizePolicy) - self.label_emax.setObjectName("label_emax") - self.horizontalLayout_6.addWidget(self.label_emax) - self.emax = QtWidgets.QDoubleSpinBox(TopoDialogBase) - self.emax.setDecimals(4) - self.emax.setMaximum(1.0) - self.emax.setSingleStep(0.01) - self.emax.setProperty("value", 0.08) - self.emax.setObjectName("emax") - self.horizontalLayout_6.addWidget(self.emax) - self.label_15 = QtWidgets.QLabel(TopoDialogBase) - self.label_15.setObjectName("label_15") - self.horizontalLayout_6.addWidget(self.label_15) - self.gridLayout.addLayout(self.horizontalLayout_6, 12, 2, 1, 1) - self.horizontalLayout_9 = QtWidgets.QHBoxLayout() - self.horizontalLayout_9.setObjectName("horizontalLayout_9") - self.onduladoMin = QtWidgets.QDoubleSpinBox(TopoDialogBase) - self.onduladoMin.setProperty("value", 8.0) - self.onduladoMin.setObjectName("onduladoMin") - self.horizontalLayout_9.addWidget(self.onduladoMin) - self.label_6 = QtWidgets.QLabel(TopoDialogBase) - self.label_6.setObjectName("label_6") - self.horizontalLayout_9.addWidget(self.label_6) - self.onduladoMax = QtWidgets.QDoubleSpinBox(TopoDialogBase) - self.onduladoMax.setProperty("value", 20.0) - self.onduladoMax.setObjectName("onduladoMax") - self.horizontalLayout_9.addWidget(self.onduladoMax) - self.gridLayout.addLayout(self.horizontalLayout_9, 9, 2, 1, 1) - self.dbBuild = QtWidgets.QPushButton(TopoDialogBase) - self.dbBuild.setObjectName("dbBuild") - self.gridLayout.addWidget(self.dbBuild, 21, 1, 1, 1) - self.comboMap = QtWidgets.QComboBox(TopoDialogBase) - self.comboMap.setEnabled(False) - self.comboMap.setObjectName("comboMap") - self.gridLayout.addWidget(self.comboMap, 21, 2, 1, 1) - self.interpol = QtWidgets.QCheckBox(TopoDialogBase) - self.interpol.setChecked(True) - self.interpol.setObjectName("interpol") - self.gridLayout.addWidget(self.interpol, 15, 2, 1, 1) - self.label_3 = QtWidgets.QLabel(TopoDialogBase) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Preferred) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.label_3.sizePolicy().hasHeightForWidth()) - self.label_3.setSizePolicy(sizePolicy) - self.label_3.setWordWrap(True) - self.label_3.setObjectName("label_3") - self.gridLayout.addWidget(self.label_3, 9, 1, 1, 1) - self.horizontalLayout = QtWidgets.QHBoxLayout() - self.horizontalLayout.setObjectName("horizontalLayout") - self.label_10 = QtWidgets.QLabel(TopoDialogBase) - self.label_10.setObjectName("label_10") - self.horizontalLayout.addWidget(self.label_10) - self.comboUnits = QtWidgets.QComboBox(TopoDialogBase) - self.comboUnits.setAcceptDrops(False) - self.comboUnits.setEditable(False) - self.comboUnits.setObjectName("comboUnits") - self.comboUnits.addItem("") - self.comboUnits.addItem("") - self.comboUnits.addItem("") - self.horizontalLayout.addWidget(self.comboUnits) - spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum) - self.horizontalLayout.addItem(spacerItem1) - self.gridLayout.addLayout(self.horizontalLayout, 14, 1, 1, 1) - self.horizontalLayout_2 = QtWidgets.QHBoxLayout() - self.horizontalLayout_2.setObjectName("horizontalLayout_2") - self.label_9 = QtWidgets.QLabel(TopoDialogBase) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Preferred) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.label_9.sizePolicy().hasHeightForWidth()) - self.label_9.setSizePolicy(sizePolicy) - self.label_9.setObjectName("label_9") - self.horizontalLayout_2.addWidget(self.label_9) - self.txtCSV = QtWidgets.QLineEdit(TopoDialogBase) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.txtCSV.sizePolicy().hasHeightForWidth()) - self.txtCSV.setSizePolicy(sizePolicy) - self.txtCSV.setMaxLength(1) - self.txtCSV.setAlignment(QtCore.Qt.AlignCenter) - self.txtCSV.setObjectName("txtCSV") - self.horizontalLayout_2.addWidget(self.txtCSV) - spacerItem2 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum) - self.horizontalLayout_2.addItem(spacerItem2) - self.gridLayout.addLayout(self.horizontalLayout_2, 15, 1, 1, 1) - self.label_2 = QtWidgets.QLabel(TopoDialogBase) - self.label_2.setEnabled(True) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Preferred) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.label_2.sizePolicy().hasHeightForWidth()) - self.label_2.setSizePolicy(sizePolicy) - self.label_2.setWordWrap(True) - self.label_2.setObjectName("label_2") - self.gridLayout.addWidget(self.label_2, 7, 1, 1, 1) - self.label_4 = QtWidgets.QLabel(TopoDialogBase) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Preferred) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.label_4.sizePolicy().hasHeightForWidth()) - self.label_4.setSizePolicy(sizePolicy) - self.label_4.setWordWrap(True) - self.label_4.setObjectName("label_4") - self.gridLayout.addWidget(self.label_4, 10, 1, 1, 1) - self.groupBox = QtWidgets.QGroupBox(TopoDialogBase) - self.groupBox.setMinimumSize(QtCore.QSize(0, 70)) - self.groupBox.setObjectName("groupBox") - self.comboClasse = QtWidgets.QComboBox(self.groupBox) - self.comboClasse.setGeometry(QtCore.QRect(20, 30, 421, 27)) - self.comboClasse.setAcceptDrops(False) - self.comboClasse.setEditable(False) - self.comboClasse.setObjectName("comboClasse") - self.comboClasse.addItem("") - self.comboClasse.addItem("") - self.comboClasse.addItem("") - self.comboClasse.addItem("") - self.comboClasse.addItem("") - self.comboClasse.addItem("") - self.comboClasse.addItem("") - self.comboClasse.addItem("") - self.gridLayout.addWidget(self.groupBox, 0, 1, 1, 2) - self.horizontalLayout_5 = QtWidgets.QHBoxLayout() - self.horizontalLayout_5.setObjectName("horizontalLayout_5") - self.label_11 = QtWidgets.QLabel(TopoDialogBase) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Preferred) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.label_11.sizePolicy().hasHeightForWidth()) - self.label_11.setSizePolicy(sizePolicy) - self.label_11.setObjectName("label_11") - self.horizontalLayout_5.addWidget(self.label_11) - self.estacas = QtWidgets.QDoubleSpinBox(TopoDialogBase) - self.estacas.setObjectName("estacas") - self.horizontalLayout_5.addWidget(self.estacas) - self.label_16 = QtWidgets.QLabel(TopoDialogBase) - self.label_16.setText("") - self.label_16.setObjectName("label_16") - self.horizontalLayout_5.addWidget(self.label_16) - self.gridLayout.addLayout(self.horizontalLayout_5, 14, 2, 1, 1) - spacerItem3 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) - self.gridLayout.addItem(spacerItem3, 16, 1, 1, 1) - self.horizontalLayout_8 = QtWidgets.QHBoxLayout() - self.horizontalLayout_8.setObjectName("horizontalLayout_8") - self.planoMin = QtWidgets.QDoubleSpinBox(TopoDialogBase) - self.planoMin.setObjectName("planoMin") - self.horizontalLayout_8.addWidget(self.planoMin) - self.label_5 = QtWidgets.QLabel(TopoDialogBase) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.label_5.sizePolicy().hasHeightForWidth()) - self.label_5.setSizePolicy(sizePolicy) - self.label_5.setObjectName("label_5") - self.horizontalLayout_8.addWidget(self.label_5) - self.planoMax = QtWidgets.QDoubleSpinBox(TopoDialogBase) - self.planoMax.setProperty("value", 8.0) - self.planoMax.setObjectName("planoMax") - self.horizontalLayout_8.addWidget(self.planoMax) - self.gridLayout.addLayout(self.horizontalLayout_8, 7, 2, 1, 1) - self.horizontalLayout_4 = QtWidgets.QHBoxLayout() - self.horizontalLayout_4.setObjectName("horizontalLayout_4") - self.button_box = QtWidgets.QDialogButtonBox(TopoDialogBase) - self.button_box.setEnabled(True) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.button_box.sizePolicy().hasHeightForWidth()) - self.button_box.setSizePolicy(sizePolicy) - self.button_box.setOrientation(QtCore.Qt.Horizontal) - self.button_box.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Save) - self.button_box.setObjectName("button_box") - self.horizontalLayout_4.addWidget(self.button_box) - self.gridLayout.addLayout(self.horizontalLayout_4, 23, 1, 1, 2) - self.horizontalLayout_10 = QtWidgets.QHBoxLayout() - self.horizontalLayout_10.setObjectName("horizontalLayout_10") - self.montanhosoMin = QtWidgets.QDoubleSpinBox(TopoDialogBase) - self.montanhosoMin.setProperty("value", 20.0) - self.montanhosoMin.setObjectName("montanhosoMin") - self.horizontalLayout_10.addWidget(self.montanhosoMin) - self.label_7 = QtWidgets.QLabel(TopoDialogBase) - self.label_7.setObjectName("label_7") - self.horizontalLayout_10.addWidget(self.label_7) - self.montanhosoMax = QtWidgets.QDoubleSpinBox(TopoDialogBase) - self.montanhosoMax.setMaximum(100.0) - self.montanhosoMax.setProperty("value", 100.0) - self.montanhosoMax.setObjectName("montanhosoMax") - self.horizontalLayout_10.addWidget(self.montanhosoMax) - self.gridLayout.addLayout(self.horizontalLayout_10, 10, 2, 1, 1) - self.horizontalLayout_7 = QtWidgets.QHBoxLayout() - self.horizontalLayout_7.setObjectName("horizontalLayout_7") - self.label_12 = QtWidgets.QLabel(TopoDialogBase) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.label_12.sizePolicy().hasHeightForWidth()) - self.label_12.setSizePolicy(sizePolicy) - self.label_12.setWordWrap(True) - self.label_12.setObjectName("label_12") - self.horizontalLayout_7.addWidget(self.label_12) - self.transversal = QtWidgets.QDoubleSpinBox(TopoDialogBase) - self.transversal.setMinimum(0.1) - self.transversal.setMaximum(500.0) - self.transversal.setProperty("value", 30.0) - self.transversal.setObjectName("transversal") - self.horizontalLayout_7.addWidget(self.transversal) - spacerItem4 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) - self.horizontalLayout_7.addItem(spacerItem4) - self.gridLayout.addLayout(self.horizontalLayout_7, 17, 1, 1, 2) - self.horizontalLayout_12 = QtWidgets.QHBoxLayout() - self.horizontalLayout_12.setObjectName("horizontalLayout_12") - self.label_13 = QtWidgets.QLabel(TopoDialogBase) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Preferred) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.label_13.sizePolicy().hasHeightForWidth()) - self.label_13.setSizePolicy(sizePolicy) - self.label_13.setObjectName("label_13") - self.horizontalLayout_12.addWidget(self.label_13) - self.offsetSpinBox = QtWidgets.QSpinBox(TopoDialogBase) - self.offsetSpinBox.setMaximumSize(QtCore.QSize(80, 16777215)) - self.offsetSpinBox.setMinimum(2) - self.offsetSpinBox.setProperty("value", 6) - self.offsetSpinBox.setObjectName("offsetSpinBox") - self.horizontalLayout_12.addWidget(self.offsetSpinBox) - spacerItem5 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) - self.horizontalLayout_12.addItem(spacerItem5) - self.gridLayout.addLayout(self.horizontalLayout_12, 19, 1, 1, 2) - spacerItem6 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) - self.gridLayout.addItem(spacerItem6, 20, 1, 1, 1) - self.actionOpenFolderAction = QtWidgets.QAction(TopoDialogBase) - self.actionOpenFolderAction.setObjectName("actionOpenFolderAction") - self.label_14.setBuddy(self.velProj) - self.label_emax.setBuddy(self.emax) - self.label_6.setBuddy(self.onduladoMax) - self.label_3.setBuddy(self.onduladoMin) - self.label_10.setBuddy(self.comboUnits) - self.label_9.setBuddy(self.txtCSV) - self.label_2.setBuddy(self.planoMin) - self.label_4.setBuddy(self.montanhosoMin) - self.label_11.setBuddy(self.estacas) - self.label_5.setBuddy(self.planoMax) - self.label_7.setBuddy(self.montanhosoMax) - self.label_12.setBuddy(self.transversal) - self.label_13.setBuddy(self.offsetSpinBox) - - self.retranslateUi(TopoDialogBase) - self.button_box.accepted.connect(TopoDialogBase.accept) - self.button_box.rejected.connect(TopoDialogBase.reject) - QtCore.QMetaObject.connectSlotsByName(TopoDialogBase) - - def retranslateUi(self, TopoDialogBase): - _translate = QtCore.QCoreApplication.translate - TopoDialogBase.setWindowTitle(_translate("TopoDialogBase", "Configurações do projeto")) - self.label_14.setText(_translate("TopoDialogBase", "Velocidade &de projeto: ")) - self.label_8.setText(_translate("TopoDialogBase", "km/h")) - self.label_emax.setText(_translate("TopoDialogBase", " EMA&X: ")) - self.label_15.setText(_translate("TopoDialogBase", "m/m")) - self.label_6.setText(_translate("TopoDialogBase", "&até")) - self.dbBuild.setText(_translate("TopoDialogBase", "Reconstruir banco de dados")) - self.interpol.setText(_translate("TopoDialogBase", "Interpolar Rasters?")) - self.label_3.setText(_translate("TopoDialogBase", "Inc&linação para terreno ondulado (%)")) - self.label_10.setText(_translate("TopoDialogBase", "&Unidades")) - self.comboUnits.setItemText(0, _translate("TopoDialogBase", "Metros")) - self.comboUnits.setItemText(1, _translate("TopoDialogBase", "Kilometros")) - self.comboUnits.setItemText(2, _translate("TopoDialogBase", "Milimetros")) - self.label_9.setText(_translate("TopoDialogBase", "Separador CSV")) - self.txtCSV.setText(_translate("TopoDialogBase", ";")) - self.label_2.setText(_translate("TopoDialogBase", "I&nclinação para terreno plano (%)")) - self.label_4.setText(_translate("TopoDialogBase", "Inclinação para terreno &montanhoso (%)")) - self.groupBox.setTitle(_translate("TopoDialogBase", "Classe do projeto:")) - self.comboClasse.setItemText(0, _translate("TopoDialogBase", "Selecione a classe do projeto")) - self.comboClasse.setItemText(1, _translate("TopoDialogBase", "0 - Via Expressa, controle total de acesso")) - self.comboClasse.setItemText(2, _translate("TopoDialogBase", "1(A) - Pista dupla, controle parcial de acesso")) - self.comboClasse.setItemText(3, _translate("TopoDialogBase", "1 (B) - Pista simples, controle parcial de acesso")) - self.comboClasse.setItemText(4, _translate("TopoDialogBase", "2 - Pista simples")) - self.comboClasse.setItemText(5, _translate("TopoDialogBase", "3 - Pista simples")) - self.comboClasse.setItemText(6, _translate("TopoDialogBase", "4 (A) - Pista simples")) - self.comboClasse.setItemText(7, _translate("TopoDialogBase", "4 (B) - Pista simples")) - self.label_11.setText(_translate("TopoDialogBase", "Dist&ância entre estacas (m)")) - self.label_5.setText(_translate("TopoDialogBase", "at&é")) - self.label_7.setText(_translate("TopoDialogBase", "até")) - self.label_12.setText(_translate("TopoDialogBase", "Espa&çamento transversal de cada lado (m)")) - self.transversal.setWhatsThis(_translate("TopoDialogBase", "

Espaçamento transversal em metros de cada lado da seção transversal

")) - self.label_13.setText(_translate("TopoDialogBase", "N&º de pontos ")) - self.offsetSpinBox.setWhatsThis(_translate("TopoDialogBase", "

Número de pontos para interpolar na seção transversal, incluindo o ponto central



")) - self.actionOpenFolderAction.setText(_translate("TopoDialogBase", "openFolderAction")) - - +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'Topo_dialog_conf.ui' +# +# Created by: PyQt5 UI code generator 5.12.2 +# +# WARNING! All changes made in this file will be lost! + +from PyQt5 import QtCore, QtGui, QtWidgets + + +class Ui_TopoDialogBase(object): + def setupUi(self, TopoDialogBase): + TopoDialogBase.setObjectName("TopoDialogBase") + TopoDialogBase.setWindowModality(QtCore.Qt.WindowModal) + TopoDialogBase.resize(820, 653) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(TopoDialogBase.sizePolicy().hasHeightForWidth()) + TopoDialogBase.setSizePolicy(sizePolicy) + TopoDialogBase.setMinimumSize(QtCore.QSize(820, 300)) + TopoDialogBase.setAutoFillBackground(False) + TopoDialogBase.setSizeGripEnabled(False) + self.gridLayout = QtWidgets.QGridLayout(TopoDialogBase) + self.gridLayout.setObjectName("gridLayout") + self.horizontalLayout_3 = QtWidgets.QHBoxLayout() + self.horizontalLayout_3.setObjectName("horizontalLayout_3") + self.label_14 = QtWidgets.QLabel(TopoDialogBase) + self.label_14.setObjectName("label_14") + self.horizontalLayout_3.addWidget(self.label_14) + self.velProj = QtWidgets.QDoubleSpinBox(TopoDialogBase) + self.velProj.setMaximum(400.0) + self.velProj.setProperty("value", 100.0) + self.velProj.setObjectName("velProj") + self.horizontalLayout_3.addWidget(self.velProj) + self.label_8 = QtWidgets.QLabel(TopoDialogBase) + self.label_8.setObjectName("label_8") + self.horizontalLayout_3.addWidget(self.label_8) + self.gridLayout.addLayout(self.horizontalLayout_3, 12, 1, 1, 1) + spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) + self.gridLayout.addItem(spacerItem, 11, 2, 1, 1) + self.horizontalLayout_6 = QtWidgets.QHBoxLayout() + self.horizontalLayout_6.setObjectName("horizontalLayout_6") + self.label_emax = QtWidgets.QLabel(TopoDialogBase) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Preferred) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.label_emax.sizePolicy().hasHeightForWidth()) + self.label_emax.setSizePolicy(sizePolicy) + self.label_emax.setObjectName("label_emax") + self.horizontalLayout_6.addWidget(self.label_emax) + self.emax = QtWidgets.QDoubleSpinBox(TopoDialogBase) + self.emax.setDecimals(4) + self.emax.setMaximum(1.0) + self.emax.setSingleStep(0.01) + self.emax.setProperty("value", 0.08) + self.emax.setObjectName("emax") + self.horizontalLayout_6.addWidget(self.emax) + self.label_15 = QtWidgets.QLabel(TopoDialogBase) + self.label_15.setObjectName("label_15") + self.horizontalLayout_6.addWidget(self.label_15) + self.gridLayout.addLayout(self.horizontalLayout_6, 12, 2, 1, 1) + self.horizontalLayout_9 = QtWidgets.QHBoxLayout() + self.horizontalLayout_9.setObjectName("horizontalLayout_9") + self.onduladoMin = QtWidgets.QDoubleSpinBox(TopoDialogBase) + self.onduladoMin.setProperty("value", 8.0) + self.onduladoMin.setObjectName("onduladoMin") + self.horizontalLayout_9.addWidget(self.onduladoMin) + self.label_6 = QtWidgets.QLabel(TopoDialogBase) + self.label_6.setObjectName("label_6") + self.horizontalLayout_9.addWidget(self.label_6) + self.onduladoMax = QtWidgets.QDoubleSpinBox(TopoDialogBase) + self.onduladoMax.setProperty("value", 20.0) + self.onduladoMax.setObjectName("onduladoMax") + self.horizontalLayout_9.addWidget(self.onduladoMax) + self.gridLayout.addLayout(self.horizontalLayout_9, 9, 2, 1, 1) + self.dbBuild = QtWidgets.QPushButton(TopoDialogBase) + self.dbBuild.setObjectName("dbBuild") + self.gridLayout.addWidget(self.dbBuild, 21, 1, 1, 1) + self.comboMap = QtWidgets.QComboBox(TopoDialogBase) + self.comboMap.setEnabled(False) + self.comboMap.setObjectName("comboMap") + self.gridLayout.addWidget(self.comboMap, 21, 2, 1, 1) + self.interpol = QtWidgets.QCheckBox(TopoDialogBase) + self.interpol.setChecked(True) + self.interpol.setObjectName("interpol") + self.gridLayout.addWidget(self.interpol, 15, 2, 1, 1) + self.label_3 = QtWidgets.QLabel(TopoDialogBase) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Preferred) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.label_3.sizePolicy().hasHeightForWidth()) + self.label_3.setSizePolicy(sizePolicy) + self.label_3.setWordWrap(True) + self.label_3.setObjectName("label_3") + self.gridLayout.addWidget(self.label_3, 9, 1, 1, 1) + self.horizontalLayout = QtWidgets.QHBoxLayout() + self.horizontalLayout.setObjectName("horizontalLayout") + self.label_10 = QtWidgets.QLabel(TopoDialogBase) + self.label_10.setObjectName("label_10") + self.horizontalLayout.addWidget(self.label_10) + self.comboUnits = QtWidgets.QComboBox(TopoDialogBase) + self.comboUnits.setAcceptDrops(False) + self.comboUnits.setEditable(False) + self.comboUnits.setObjectName("comboUnits") + self.comboUnits.addItem("") + self.comboUnits.addItem("") + self.comboUnits.addItem("") + self.horizontalLayout.addWidget(self.comboUnits) + spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum) + self.horizontalLayout.addItem(spacerItem1) + self.gridLayout.addLayout(self.horizontalLayout, 14, 1, 1, 1) + self.horizontalLayout_2 = QtWidgets.QHBoxLayout() + self.horizontalLayout_2.setObjectName("horizontalLayout_2") + self.label_9 = QtWidgets.QLabel(TopoDialogBase) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Preferred) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.label_9.sizePolicy().hasHeightForWidth()) + self.label_9.setSizePolicy(sizePolicy) + self.label_9.setObjectName("label_9") + self.horizontalLayout_2.addWidget(self.label_9) + self.txtCSV = QtWidgets.QLineEdit(TopoDialogBase) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.txtCSV.sizePolicy().hasHeightForWidth()) + self.txtCSV.setSizePolicy(sizePolicy) + self.txtCSV.setMaxLength(1) + self.txtCSV.setAlignment(QtCore.Qt.AlignCenter) + self.txtCSV.setObjectName("txtCSV") + self.horizontalLayout_2.addWidget(self.txtCSV) + spacerItem2 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum) + self.horizontalLayout_2.addItem(spacerItem2) + self.gridLayout.addLayout(self.horizontalLayout_2, 15, 1, 1, 1) + self.label_2 = QtWidgets.QLabel(TopoDialogBase) + self.label_2.setEnabled(True) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Preferred) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.label_2.sizePolicy().hasHeightForWidth()) + self.label_2.setSizePolicy(sizePolicy) + self.label_2.setWordWrap(True) + self.label_2.setObjectName("label_2") + self.gridLayout.addWidget(self.label_2, 7, 1, 1, 1) + self.label_4 = QtWidgets.QLabel(TopoDialogBase) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Preferred) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.label_4.sizePolicy().hasHeightForWidth()) + self.label_4.setSizePolicy(sizePolicy) + self.label_4.setWordWrap(True) + self.label_4.setObjectName("label_4") + self.gridLayout.addWidget(self.label_4, 10, 1, 1, 1) + self.groupBox = QtWidgets.QGroupBox(TopoDialogBase) + self.groupBox.setMinimumSize(QtCore.QSize(0, 70)) + self.groupBox.setObjectName("groupBox") + self.comboClasse = QtWidgets.QComboBox(self.groupBox) + self.comboClasse.setGeometry(QtCore.QRect(20, 30, 421, 27)) + self.comboClasse.setAcceptDrops(False) + self.comboClasse.setEditable(False) + self.comboClasse.setObjectName("comboClasse") + self.comboClasse.addItem("") + self.comboClasse.addItem("") + self.comboClasse.addItem("") + self.comboClasse.addItem("") + self.comboClasse.addItem("") + self.comboClasse.addItem("") + self.comboClasse.addItem("") + self.comboClasse.addItem("") + self.gridLayout.addWidget(self.groupBox, 0, 1, 1, 2) + self.horizontalLayout_5 = QtWidgets.QHBoxLayout() + self.horizontalLayout_5.setObjectName("horizontalLayout_5") + self.label_11 = QtWidgets.QLabel(TopoDialogBase) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Preferred) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.label_11.sizePolicy().hasHeightForWidth()) + self.label_11.setSizePolicy(sizePolicy) + self.label_11.setObjectName("label_11") + self.horizontalLayout_5.addWidget(self.label_11) + self.estacas = QtWidgets.QDoubleSpinBox(TopoDialogBase) + self.estacas.setObjectName("estacas") + self.horizontalLayout_5.addWidget(self.estacas) + self.label_16 = QtWidgets.QLabel(TopoDialogBase) + self.label_16.setText("") + self.label_16.setObjectName("label_16") + self.horizontalLayout_5.addWidget(self.label_16) + self.gridLayout.addLayout(self.horizontalLayout_5, 14, 2, 1, 1) + spacerItem3 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) + self.gridLayout.addItem(spacerItem3, 16, 1, 1, 1) + self.horizontalLayout_8 = QtWidgets.QHBoxLayout() + self.horizontalLayout_8.setObjectName("horizontalLayout_8") + self.planoMin = QtWidgets.QDoubleSpinBox(TopoDialogBase) + self.planoMin.setObjectName("planoMin") + self.horizontalLayout_8.addWidget(self.planoMin) + self.label_5 = QtWidgets.QLabel(TopoDialogBase) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.label_5.sizePolicy().hasHeightForWidth()) + self.label_5.setSizePolicy(sizePolicy) + self.label_5.setObjectName("label_5") + self.horizontalLayout_8.addWidget(self.label_5) + self.planoMax = QtWidgets.QDoubleSpinBox(TopoDialogBase) + self.planoMax.setProperty("value", 8.0) + self.planoMax.setObjectName("planoMax") + self.horizontalLayout_8.addWidget(self.planoMax) + self.gridLayout.addLayout(self.horizontalLayout_8, 7, 2, 1, 1) + self.horizontalLayout_4 = QtWidgets.QHBoxLayout() + self.horizontalLayout_4.setObjectName("horizontalLayout_4") + self.button_box = QtWidgets.QDialogButtonBox(TopoDialogBase) + self.button_box.setEnabled(True) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.button_box.sizePolicy().hasHeightForWidth()) + self.button_box.setSizePolicy(sizePolicy) + self.button_box.setOrientation(QtCore.Qt.Horizontal) + self.button_box.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Save) + self.button_box.setObjectName("button_box") + self.horizontalLayout_4.addWidget(self.button_box) + self.gridLayout.addLayout(self.horizontalLayout_4, 23, 1, 1, 2) + self.horizontalLayout_10 = QtWidgets.QHBoxLayout() + self.horizontalLayout_10.setObjectName("horizontalLayout_10") + self.montanhosoMin = QtWidgets.QDoubleSpinBox(TopoDialogBase) + self.montanhosoMin.setProperty("value", 20.0) + self.montanhosoMin.setObjectName("montanhosoMin") + self.horizontalLayout_10.addWidget(self.montanhosoMin) + self.label_7 = QtWidgets.QLabel(TopoDialogBase) + self.label_7.setObjectName("label_7") + self.horizontalLayout_10.addWidget(self.label_7) + self.montanhosoMax = QtWidgets.QDoubleSpinBox(TopoDialogBase) + self.montanhosoMax.setMaximum(100.0) + self.montanhosoMax.setProperty("value", 100.0) + self.montanhosoMax.setObjectName("montanhosoMax") + self.horizontalLayout_10.addWidget(self.montanhosoMax) + self.gridLayout.addLayout(self.horizontalLayout_10, 10, 2, 1, 1) + self.horizontalLayout_7 = QtWidgets.QHBoxLayout() + self.horizontalLayout_7.setObjectName("horizontalLayout_7") + self.label_12 = QtWidgets.QLabel(TopoDialogBase) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.label_12.sizePolicy().hasHeightForWidth()) + self.label_12.setSizePolicy(sizePolicy) + self.label_12.setWordWrap(True) + self.label_12.setObjectName("label_12") + self.horizontalLayout_7.addWidget(self.label_12) + self.transversal = QtWidgets.QDoubleSpinBox(TopoDialogBase) + self.transversal.setMinimum(0.1) + self.transversal.setMaximum(500.0) + self.transversal.setProperty("value", 30.0) + self.transversal.setObjectName("transversal") + self.horizontalLayout_7.addWidget(self.transversal) + spacerItem4 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) + self.horizontalLayout_7.addItem(spacerItem4) + self.gridLayout.addLayout(self.horizontalLayout_7, 17, 1, 1, 2) + self.horizontalLayout_12 = QtWidgets.QHBoxLayout() + self.horizontalLayout_12.setObjectName("horizontalLayout_12") + self.label_13 = QtWidgets.QLabel(TopoDialogBase) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Preferred) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.label_13.sizePolicy().hasHeightForWidth()) + self.label_13.setSizePolicy(sizePolicy) + self.label_13.setObjectName("label_13") + self.horizontalLayout_12.addWidget(self.label_13) + self.offsetSpinBox = QtWidgets.QSpinBox(TopoDialogBase) + self.offsetSpinBox.setMaximumSize(QtCore.QSize(80, 16777215)) + self.offsetSpinBox.setMinimum(2) + self.offsetSpinBox.setProperty("value", 6) + self.offsetSpinBox.setObjectName("offsetSpinBox") + self.horizontalLayout_12.addWidget(self.offsetSpinBox) + spacerItem5 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) + self.horizontalLayout_12.addItem(spacerItem5) + self.gridLayout.addLayout(self.horizontalLayout_12, 19, 1, 1, 2) + spacerItem6 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) + self.gridLayout.addItem(spacerItem6, 20, 1, 1, 1) + self.actionOpenFolderAction = QtWidgets.QAction(TopoDialogBase) + self.actionOpenFolderAction.setObjectName("actionOpenFolderAction") + self.label_14.setBuddy(self.velProj) + self.label_emax.setBuddy(self.emax) + self.label_6.setBuddy(self.onduladoMax) + self.label_3.setBuddy(self.onduladoMin) + self.label_10.setBuddy(self.comboUnits) + self.label_9.setBuddy(self.txtCSV) + self.label_2.setBuddy(self.planoMin) + self.label_4.setBuddy(self.montanhosoMin) + self.label_11.setBuddy(self.estacas) + self.label_5.setBuddy(self.planoMax) + self.label_7.setBuddy(self.montanhosoMax) + self.label_12.setBuddy(self.transversal) + self.label_13.setBuddy(self.offsetSpinBox) + + self.retranslateUi(TopoDialogBase) + self.button_box.accepted.connect(TopoDialogBase.accept) + self.button_box.rejected.connect(TopoDialogBase.reject) + QtCore.QMetaObject.connectSlotsByName(TopoDialogBase) + + def retranslateUi(self, TopoDialogBase): + _translate = QtCore.QCoreApplication.translate + TopoDialogBase.setWindowTitle(_translate("TopoDialogBase", "Configurações do projeto")) + self.label_14.setText(_translate("TopoDialogBase", "Velocidade &de projeto: ")) + self.label_8.setText(_translate("TopoDialogBase", "km/h")) + self.label_emax.setText(_translate("TopoDialogBase", " EMA&X: ")) + self.label_15.setText(_translate("TopoDialogBase", "m/m")) + self.label_6.setText(_translate("TopoDialogBase", "&até")) + self.dbBuild.setText(_translate("TopoDialogBase", "Reconstruir banco de dados")) + self.interpol.setText(_translate("TopoDialogBase", "Interpolar Rasters?")) + self.label_3.setText(_translate("TopoDialogBase", "Inc&linação para terreno ondulado (%)")) + self.label_10.setText(_translate("TopoDialogBase", "&Unidades")) + self.comboUnits.setItemText(0, _translate("TopoDialogBase", "Metros")) + self.comboUnits.setItemText(1, _translate("TopoDialogBase", "Kilometros")) + self.comboUnits.setItemText(2, _translate("TopoDialogBase", "Milimetros")) + self.label_9.setText(_translate("TopoDialogBase", "Separador CSV")) + self.txtCSV.setText(_translate("TopoDialogBase", ";")) + self.label_2.setText(_translate("TopoDialogBase", "I&nclinação para terreno plano (%)")) + self.label_4.setText(_translate("TopoDialogBase", "Inclinação para terreno &montanhoso (%)")) + self.groupBox.setTitle(_translate("TopoDialogBase", "Classe do projeto:")) + self.comboClasse.setItemText(0, _translate("TopoDialogBase", "Selecione a classe do projeto")) + self.comboClasse.setItemText(1, _translate("TopoDialogBase", "0 - Via Expressa, controle total de acesso")) + self.comboClasse.setItemText(2, _translate("TopoDialogBase", "1(A) - Pista dupla, controle parcial de acesso")) + self.comboClasse.setItemText(3, _translate("TopoDialogBase", "1 (B) - Pista simples, controle parcial de acesso")) + self.comboClasse.setItemText(4, _translate("TopoDialogBase", "2 - Pista simples")) + self.comboClasse.setItemText(5, _translate("TopoDialogBase", "3 - Pista simples")) + self.comboClasse.setItemText(6, _translate("TopoDialogBase", "4 (A) - Pista simples")) + self.comboClasse.setItemText(7, _translate("TopoDialogBase", "4 (B) - Pista simples")) + self.label_11.setText(_translate("TopoDialogBase", "Dist&ância entre estacas (m)")) + self.label_5.setText(_translate("TopoDialogBase", "at&é")) + self.label_7.setText(_translate("TopoDialogBase", "até")) + self.label_12.setText(_translate("TopoDialogBase", "Espa&çamento transversal de cada lado (m)")) + self.transversal.setWhatsThis(_translate("TopoDialogBase", "

Espaçamento transversal em metros de cada lado da seção transversal

")) + self.label_13.setText(_translate("TopoDialogBase", "N&º de pontos ")) + self.offsetSpinBox.setWhatsThis(_translate("TopoDialogBase", "

Número de pontos para interpolar na seção transversal, incluindo o ponto central



")) + self.actionOpenFolderAction.setText(_translate("TopoDialogBase", "openFolderAction")) + + diff --git a/app/view/ui/py/Topo_dialog_curva.ui.py b/app/view/ui/py/Topo_dialog_curva.ui.py old mode 100644 new mode 100755 index 57e413e..7439242 --- a/app/view/ui/py/Topo_dialog_curva.ui.py +++ b/app/view/ui/py/Topo_dialog_curva.ui.py @@ -1,531 +1,531 @@ -# -*- coding: utf-8 -*- - -# Form implementation generated from reading ui file 'Topo_dialog_curva.ui' -# -# Created by: PyQt5 UI code generator 5.12.2 -# -# WARNING! All changes made in this file will be lost! - -from PyQt5 import QtCore, QtGui, QtWidgets - - -class Ui_Dialog(object): - def setupUi(self, Dialog): - Dialog.setObjectName("Dialog") - Dialog.resize(1009, 769) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(Dialog.sizePolicy().hasHeightForWidth()) - Dialog.setSizePolicy(sizePolicy) - self.gridLayout_4 = QtWidgets.QGridLayout(Dialog) - self.gridLayout_4.setObjectName("gridLayout_4") - self.horizontalLayout_5 = QtWidgets.QHBoxLayout() - self.horizontalLayout_5.setObjectName("horizontalLayout_5") - self.label = QtWidgets.QLabel(Dialog) - self.label.setObjectName("label") - self.horizontalLayout_5.addWidget(self.label) - self.comboCurva = QtWidgets.QComboBox(Dialog) - self.comboCurva.setObjectName("comboCurva") - self.horizontalLayout_5.addWidget(self.comboCurva) - spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) - self.horizontalLayout_5.addItem(spacerItem) - self.label_2 = QtWidgets.QLabel(Dialog) - self.label_2.setObjectName("label_2") - self.horizontalLayout_5.addWidget(self.label_2) - self.comboElemento = QtWidgets.QComboBox(Dialog) - self.comboElemento.setEnabled(True) - self.comboElemento.setObjectName("comboElemento") - self.comboElemento.addItem("") - self.comboElemento.addItem("") - self.horizontalLayout_5.addWidget(self.comboElemento) - self.gridLayout_4.addLayout(self.horizontalLayout_5, 0, 0, 1, 2) - self.verticalLayout = QtWidgets.QVBoxLayout() - self.verticalLayout.setObjectName("verticalLayout") - self.verticalLayout_11 = QtWidgets.QVBoxLayout() - self.verticalLayout_11.setObjectName("verticalLayout_11") - self.verticalLayout.addLayout(self.verticalLayout_11) - self.btnClose = QtWidgets.QPushButton(Dialog) - self.btnClose.setObjectName("btnClose") - self.verticalLayout.addWidget(self.btnClose) - self.verticalLayout_10 = QtWidgets.QVBoxLayout() - self.verticalLayout_10.setObjectName("verticalLayout_10") - self.verticalLayout.addLayout(self.verticalLayout_10) - self.horizontalLayout_4 = QtWidgets.QHBoxLayout() - self.horizontalLayout_4.setObjectName("horizontalLayout_4") - self.prev = QtWidgets.QPushButton(Dialog) - self.prev.setEnabled(False) - self.prev.setObjectName("prev") - self.horizontalLayout_4.addWidget(self.prev) - self.next = QtWidgets.QPushButton(Dialog) - self.next.setEnabled(False) - self.next.setObjectName("next") - self.horizontalLayout_4.addWidget(self.next) - self.verticalLayout.addLayout(self.horizontalLayout_4) - self.btnAjuda = QtWidgets.QPushButton(Dialog) - self.btnAjuda.setObjectName("btnAjuda") - self.verticalLayout.addWidget(self.btnAjuda) - spacerItem1 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) - self.verticalLayout.addItem(spacerItem1) - self.gridLayout_4.addLayout(self.verticalLayout, 0, 2, 2, 1) - self.groupBox = QtWidgets.QGroupBox(Dialog) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.groupBox.sizePolicy().hasHeightForWidth()) - self.groupBox.setSizePolicy(sizePolicy) - self.groupBox.setMinimumSize(QtCore.QSize(300, 300)) - self.groupBox.setObjectName("groupBox") - self.gridLayout_7 = QtWidgets.QGridLayout(self.groupBox) - self.gridLayout_7.setObjectName("gridLayout_7") - self.gridLayout = QtWidgets.QGridLayout() - self.gridLayout.setObjectName("gridLayout") - spacerItem2 = QtWidgets.QSpacerItem(20, 5, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) - self.gridLayout.addItem(spacerItem2, 0, 0, 1, 1) - self.label_3 = QtWidgets.QLabel(self.groupBox) - self.label_3.setObjectName("label_3") - self.gridLayout.addWidget(self.label_3, 1, 0, 1, 1) - self.comboEstacaInicial = QtWidgets.QComboBox(self.groupBox) - self.comboEstacaInicial.setEnabled(False) - self.comboEstacaInicial.setObjectName("comboEstacaInicial") - self.gridLayout.addWidget(self.comboEstacaInicial, 1, 1, 1, 1) - self.label_6 = QtWidgets.QLabel(self.groupBox) - self.label_6.setObjectName("label_6") - self.gridLayout.addWidget(self.label_6, 3, 0, 1, 1) - self.label_7 = QtWidgets.QLabel(self.groupBox) - self.label_7.setObjectName("label_7") - self.gridLayout.addWidget(self.label_7, 4, 0, 1, 1) - self.txtEsteInicial = QtWidgets.QLineEdit(self.groupBox) - self.txtEsteInicial.setEnabled(False) - self.txtEsteInicial.setObjectName("txtEsteInicial") - self.gridLayout.addWidget(self.txtEsteInicial, 4, 1, 1, 1) - self.txtNorthInicial = QtWidgets.QLineEdit(self.groupBox) - self.txtNorthInicial.setEnabled(False) - self.txtNorthInicial.setObjectName("txtNorthInicial") - self.gridLayout.addWidget(self.txtNorthInicial, 3, 1, 1, 1) - self.label_4 = QtWidgets.QLabel(self.groupBox) - self.label_4.setObjectName("label_4") - self.gridLayout.addWidget(self.label_4, 2, 0, 1, 1) - self.txtNomeInicial = QtWidgets.QLineEdit(self.groupBox) - self.txtNomeInicial.setEnabled(False) - self.txtNomeInicial.setText("") - self.txtNomeInicial.setObjectName("txtNomeInicial") - self.gridLayout.addWidget(self.txtNomeInicial, 2, 1, 1, 1) - self.gridLayout_7.addLayout(self.gridLayout, 0, 0, 1, 1) - self.gridLayout_4.addWidget(self.groupBox, 1, 0, 2, 1) - self.groupBox_2 = QtWidgets.QGroupBox(Dialog) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.groupBox_2.sizePolicy().hasHeightForWidth()) - self.groupBox_2.setSizePolicy(sizePolicy) - self.groupBox_2.setMinimumSize(QtCore.QSize(300, 300)) - self.groupBox_2.setObjectName("groupBox_2") - self.gridLayout_6 = QtWidgets.QGridLayout(self.groupBox_2) - self.gridLayout_6.setObjectName("gridLayout_6") - self.gridLayout_2 = QtWidgets.QGridLayout() - self.gridLayout_2.setObjectName("gridLayout_2") - self.comboEstacaFinal = QtWidgets.QComboBox(self.groupBox_2) - self.comboEstacaFinal.setEnabled(False) - self.comboEstacaFinal.setObjectName("comboEstacaFinal") - self.gridLayout_2.addWidget(self.comboEstacaFinal, 1, 1, 1, 1) - self.label_5 = QtWidgets.QLabel(self.groupBox_2) - self.label_5.setObjectName("label_5") - self.gridLayout_2.addWidget(self.label_5, 1, 0, 1, 1) - self.label_8 = QtWidgets.QLabel(self.groupBox_2) - self.label_8.setObjectName("label_8") - self.gridLayout_2.addWidget(self.label_8, 2, 0, 1, 1) - self.txtNomeFinal = QtWidgets.QLineEdit(self.groupBox_2) - self.txtNomeFinal.setEnabled(False) - self.txtNomeFinal.setObjectName("txtNomeFinal") - self.gridLayout_2.addWidget(self.txtNomeFinal, 2, 1, 1, 1) - self.txtNorthFinal = QtWidgets.QLineEdit(self.groupBox_2) - self.txtNorthFinal.setEnabled(False) - self.txtNorthFinal.setObjectName("txtNorthFinal") - self.gridLayout_2.addWidget(self.txtNorthFinal, 3, 1, 1, 1) - self.label_10 = QtWidgets.QLabel(self.groupBox_2) - self.label_10.setObjectName("label_10") - self.gridLayout_2.addWidget(self.label_10, 4, 0, 1, 1) - self.txtEsteFinal = QtWidgets.QLineEdit(self.groupBox_2) - self.txtEsteFinal.setEnabled(False) - self.txtEsteFinal.setObjectName("txtEsteFinal") - self.gridLayout_2.addWidget(self.txtEsteFinal, 4, 1, 1, 1) - self.label_9 = QtWidgets.QLabel(self.groupBox_2) - self.label_9.setObjectName("label_9") - self.gridLayout_2.addWidget(self.label_9, 3, 0, 1, 1) - spacerItem3 = QtWidgets.QSpacerItem(20, 5, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) - self.gridLayout_2.addItem(spacerItem3, 0, 0, 1, 1) - self.gridLayout_6.addLayout(self.gridLayout_2, 0, 0, 1, 1) - self.gridLayout_4.addWidget(self.groupBox_2, 1, 1, 2, 1) - self.verticalLayout_2 = QtWidgets.QVBoxLayout() - self.verticalLayout_2.setObjectName("verticalLayout_2") - self.btnNew = QtWidgets.QPushButton(Dialog) - self.btnNew.setObjectName("btnNew") - self.verticalLayout_2.addWidget(self.btnNew) - self.btnEditar = QtWidgets.QPushButton(Dialog) - self.btnEditar.setObjectName("btnEditar") - self.verticalLayout_2.addWidget(self.btnEditar) - self.btnInsere = QtWidgets.QPushButton(Dialog) - self.btnInsere.setEnabled(False) - self.btnInsere.setObjectName("btnInsere") - self.verticalLayout_2.addWidget(self.btnInsere) - self.btnApagar = QtWidgets.QPushButton(Dialog) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.btnApagar.sizePolicy().hasHeightForWidth()) - self.btnApagar.setSizePolicy(sizePolicy) - self.btnApagar.setObjectName("btnApagar") - self.verticalLayout_2.addWidget(self.btnApagar) - self.btnCancela = QtWidgets.QPushButton(Dialog) - self.btnCancela.setEnabled(False) - self.btnCancela.setObjectName("btnCancela") - self.verticalLayout_2.addWidget(self.btnCancela) - spacerItem4 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) - self.verticalLayout_2.addItem(spacerItem4) - self.gridLayout_4.addLayout(self.verticalLayout_2, 2, 2, 2, 1) - self.verticalLayout_9 = QtWidgets.QVBoxLayout() - self.verticalLayout_9.setObjectName("verticalLayout_9") - self.label_24 = QtWidgets.QLabel(Dialog) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Preferred) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.label_24.sizePolicy().hasHeightForWidth()) - self.label_24.setSizePolicy(sizePolicy) - self.label_24.setAlignment(QtCore.Qt.AlignCenter) - self.label_24.setObjectName("label_24") - self.verticalLayout_9.addWidget(self.label_24) - self.txtDist = QtWidgets.QLineEdit(Dialog) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.txtDist.sizePolicy().hasHeightForWidth()) - self.txtDist.setSizePolicy(sizePolicy) - self.txtDist.setObjectName("txtDist") - self.verticalLayout_9.addWidget(self.txtDist) - self.btnCalcular = QtWidgets.QPushButton(Dialog) - self.btnCalcular.setObjectName("btnCalcular") - self.verticalLayout_9.addWidget(self.btnCalcular) - spacerItem5 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) - self.verticalLayout_9.addItem(spacerItem5) - self.btnRelatorio = QtWidgets.QPushButton(Dialog) - self.btnRelatorio.setEnabled(False) - self.btnRelatorio.setObjectName("btnRelatorio") - self.verticalLayout_9.addWidget(self.btnRelatorio) - self.gridLayout_4.addLayout(self.verticalLayout_9, 4, 2, 1, 1) - self.gDadosCurva = QtWidgets.QGroupBox(Dialog) - self.gDadosCurva.setObjectName("gDadosCurva") - self.gridLayout_5 = QtWidgets.QGridLayout(self.gDadosCurva) - self.gridLayout_5.setObjectName("gridLayout_5") - self.horizontalLayout = QtWidgets.QHBoxLayout() - self.horizontalLayout.setObjectName("horizontalLayout") - self.verticalLayout_4 = QtWidgets.QVBoxLayout() - self.verticalLayout_4.setObjectName("verticalLayout_4") - self.label_15 = QtWidgets.QLabel(self.gDadosCurva) - self.label_15.setObjectName("label_15") - self.verticalLayout_4.addWidget(self.label_15) - self.label_16 = QtWidgets.QLabel(self.gDadosCurva) - self.label_16.setObjectName("label_16") - self.verticalLayout_4.addWidget(self.label_16) - self.horizontalLayout.addLayout(self.verticalLayout_4) - self.verticalLayout_3 = QtWidgets.QVBoxLayout() - self.verticalLayout_3.setObjectName("verticalLayout_3") - self.txtVelocidade = QtWidgets.QDoubleSpinBox(self.gDadosCurva) - self.txtVelocidade.setEnabled(False) - self.txtVelocidade.setMaximum(400.0) - self.txtVelocidade.setSingleStep(20.0) - self.txtVelocidade.setObjectName("txtVelocidade") - self.verticalLayout_3.addWidget(self.txtVelocidade) - self.txtRUtilizado = QtWidgets.QDoubleSpinBox(self.gDadosCurva) - self.txtRUtilizado.setEnabled(False) - self.txtRUtilizado.setMaximum(10000.0) - self.txtRUtilizado.setSingleStep(50.0) - self.txtRUtilizado.setProperty("value", 500.0) - self.txtRUtilizado.setObjectName("txtRUtilizado") - self.verticalLayout_3.addWidget(self.txtRUtilizado) - self.horizontalLayout.addLayout(self.verticalLayout_3) - self.gridLayout_5.addLayout(self.horizontalLayout, 0, 0, 1, 1) - self.gridLayout_3 = QtWidgets.QGridLayout() - self.gridLayout_3.setObjectName("gridLayout_3") - self.txtFMAX = QtWidgets.QDoubleSpinBox(self.gDadosCurva) - self.txtFMAX.setEnabled(False) - self.txtFMAX.setMaximum(1.0) - self.txtFMAX.setSingleStep(0.1) - self.txtFMAX.setObjectName("txtFMAX") - self.gridLayout_3.addWidget(self.txtFMAX, 1, 1, 1, 1) - self.label_13 = QtWidgets.QLabel(self.gDadosCurva) - self.label_13.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) - self.label_13.setObjectName("label_13") - self.gridLayout_3.addWidget(self.label_13, 0, 0, 1, 1) - self.label_14 = QtWidgets.QLabel(self.gDadosCurva) - self.label_14.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) - self.label_14.setObjectName("label_14") - self.gridLayout_3.addWidget(self.label_14, 1, 0, 1, 1) - self.txtEMAX = QtWidgets.QDoubleSpinBox(self.gDadosCurva) - self.txtEMAX.setEnabled(False) - self.txtEMAX.setMaximum(1.0) - self.txtEMAX.setSingleStep(0.01) - self.txtEMAX.setProperty("value", 0.08) - self.txtEMAX.setObjectName("txtEMAX") - self.gridLayout_3.addWidget(self.txtEMAX, 0, 1, 1, 1) - self.Ls = QtWidgets.QDoubleSpinBox(self.gDadosCurva) - self.Ls.setEnabled(False) - self.Ls.setMaximum(4000.0) - self.Ls.setSingleStep(20.0) - self.Ls.setObjectName("Ls") - self.gridLayout_3.addWidget(self.Ls, 0, 3, 1, 1) - self.label_25 = QtWidgets.QLabel(self.gDadosCurva) - self.label_25.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) - self.label_25.setObjectName("label_25") - self.gridLayout_3.addWidget(self.label_25, 0, 2, 1, 1) - self.label_19 = QtWidgets.QLabel(self.gDadosCurva) - self.label_19.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) - self.label_19.setObjectName("label_19") - self.gridLayout_3.addWidget(self.label_19, 1, 2, 1, 1) - self.txtD = QtWidgets.QDoubleSpinBox(self.gDadosCurva) - self.txtD.setEnabled(False) - self.txtD.setMaximum(5000.0) - self.txtD.setSingleStep(20.0) - self.txtD.setObjectName("txtD") - self.gridLayout_3.addWidget(self.txtD, 1, 3, 1, 1) - self.gridLayout_5.addLayout(self.gridLayout_3, 0, 2, 1, 3) - spacerItem6 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) - self.gridLayout_5.addItem(spacerItem6, 0, 1, 1, 1) - self.horizontalLayout_3 = QtWidgets.QHBoxLayout() - self.horizontalLayout_3.setObjectName("horizontalLayout_3") - self.verticalLayout_7 = QtWidgets.QVBoxLayout() - self.verticalLayout_7.setObjectName("verticalLayout_7") - self.label_18 = QtWidgets.QLabel(self.gDadosCurva) - self.label_18.setObjectName("label_18") - self.verticalLayout_7.addWidget(self.label_18) - self.label_26 = QtWidgets.QLabel(self.gDadosCurva) - self.label_26.setObjectName("label_26") - self.verticalLayout_7.addWidget(self.label_26) - self.label_20 = QtWidgets.QLabel(self.gDadosCurva) - self.label_20.setObjectName("label_20") - self.verticalLayout_7.addWidget(self.label_20) - self.label_23 = QtWidgets.QLabel(self.gDadosCurva) - self.label_23.setObjectName("label_23") - self.verticalLayout_7.addWidget(self.label_23) - self.horizontalLayout_3.addLayout(self.verticalLayout_7) - self.verticalLayout_8 = QtWidgets.QVBoxLayout() - self.verticalLayout_8.setObjectName("verticalLayout_8") - self.txtT = QtWidgets.QLineEdit(self.gDadosCurva) - self.txtT.setEnabled(False) - self.txtT.setText("") - self.txtT.setObjectName("txtT") - self.verticalLayout_8.addWidget(self.txtT) - self.theta = QtWidgets.QLineEdit(self.gDadosCurva) - self.theta.setEnabled(False) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.theta.sizePolicy().hasHeightForWidth()) - self.theta.setSizePolicy(sizePolicy) - self.theta.setObjectName("theta") - self.verticalLayout_8.addWidget(self.theta) - self.txtG20 = QtWidgets.QLineEdit(self.gDadosCurva) - self.txtG20.setEnabled(False) - self.txtG20.setText("") - self.txtG20.setObjectName("txtG20") - self.verticalLayout_8.addWidget(self.txtG20) - self.txtEPT = QtWidgets.QLineEdit(self.gDadosCurva) - self.txtEPT.setEnabled(False) - self.txtEPT.setText("") - self.txtEPT.setObjectName("txtEPT") - self.verticalLayout_8.addWidget(self.txtEPT) - self.horizontalLayout_3.addLayout(self.verticalLayout_8) - self.gridLayout_5.addLayout(self.horizontalLayout_3, 1, 2, 2, 1) - self.horizontalLayout_2 = QtWidgets.QHBoxLayout() - self.horizontalLayout_2.setObjectName("horizontalLayout_2") - self.verticalLayout_5 = QtWidgets.QVBoxLayout() - self.verticalLayout_5.setObjectName("verticalLayout_5") - self.label_11 = QtWidgets.QLabel(self.gDadosCurva) - self.label_11.setObjectName("label_11") - self.verticalLayout_5.addWidget(self.label_11) - self.label_12 = QtWidgets.QLabel(self.gDadosCurva) - self.label_12.setObjectName("label_12") - self.verticalLayout_5.addWidget(self.label_12) - self.label_17 = QtWidgets.QLabel(self.gDadosCurva) - self.label_17.setObjectName("label_17") - self.verticalLayout_5.addWidget(self.label_17) - self.label_21 = QtWidgets.QLabel(self.gDadosCurva) - self.label_21.setObjectName("label_21") - self.verticalLayout_5.addWidget(self.label_21) - self.label_22 = QtWidgets.QLabel(self.gDadosCurva) - self.label_22.setObjectName("label_22") - self.verticalLayout_5.addWidget(self.label_22) - self.horizontalLayout_2.addLayout(self.verticalLayout_5) - self.verticalLayout_6 = QtWidgets.QVBoxLayout() - self.verticalLayout_6.setObjectName("verticalLayout_6") - self.txtI = QtWidgets.QLineEdit(self.gDadosCurva) - self.txtI.setEnabled(False) - self.txtI.setText("") - self.txtI.setObjectName("txtI") - self.verticalLayout_6.addWidget(self.txtI) - self.txtDelta = QtWidgets.QLineEdit(self.gDadosCurva) - self.txtDelta.setEnabled(False) - self.txtDelta.setText("") - self.txtDelta.setObjectName("txtDelta") - self.verticalLayout_6.addWidget(self.txtDelta) - self.txtRMIN = QtWidgets.QLineEdit(self.gDadosCurva) - self.txtRMIN.setEnabled(False) - self.txtRMIN.setText("") - self.txtRMIN.setObjectName("txtRMIN") - self.verticalLayout_6.addWidget(self.txtRMIN) - self.txtEPI = QtWidgets.QLineEdit(self.gDadosCurva) - self.txtEPI.setEnabled(False) - self.txtEPI.setText("") - self.txtEPI.setObjectName("txtEPI") - self.verticalLayout_6.addWidget(self.txtEPI) - self.txtEPC = QtWidgets.QLineEdit(self.gDadosCurva) - self.txtEPC.setEnabled(False) - self.txtEPC.setText("") - self.txtEPC.setObjectName("txtEPC") - self.verticalLayout_6.addWidget(self.txtEPC) - self.horizontalLayout_2.addLayout(self.verticalLayout_6) - self.gridLayout_5.addLayout(self.horizontalLayout_2, 1, 0, 2, 1) - spacerItem7 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) - self.gridLayout_5.addItem(spacerItem7, 1, 3, 1, 1) - self.verticalLayout_12 = QtWidgets.QVBoxLayout() - self.verticalLayout_12.setObjectName("verticalLayout_12") - self.gridLayout_9 = QtWidgets.QGridLayout() - self.gridLayout_9.setObjectName("gridLayout_9") - self.label_29 = QtWidgets.QLabel(self.gDadosCurva) - self.label_29.setObjectName("label_29") - self.gridLayout_9.addWidget(self.label_29, 2, 0, 1, 1) - self.lsmin = QtWidgets.QLineEdit(self.gDadosCurva) - self.lsmin.setEnabled(False) - self.lsmin.setObjectName("lsmin") - self.gridLayout_9.addWidget(self.lsmin, 0, 1, 1, 1) - self.label_28 = QtWidgets.QLabel(self.gDadosCurva) - self.label_28.setObjectName("label_28") - self.gridLayout_9.addWidget(self.label_28, 1, 0, 1, 1) - self.lsmax = QtWidgets.QLineEdit(self.gDadosCurva) - self.lsmax.setEnabled(False) - self.lsmax.setObjectName("lsmax") - self.gridLayout_9.addWidget(self.lsmax, 1, 1, 1, 1) - self.label_27 = QtWidgets.QLabel(self.gDadosCurva) - self.label_27.setObjectName("label_27") - self.gridLayout_9.addWidget(self.label_27, 0, 0, 1, 1) - self.label_30 = QtWidgets.QLabel(self.gDadosCurva) - self.label_30.setObjectName("label_30") - self.gridLayout_9.addWidget(self.label_30, 3, 0, 1, 1) - self.xs = QtWidgets.QLineEdit(self.gDadosCurva) - self.xs.setEnabled(False) - self.xs.setObjectName("xs") - self.gridLayout_9.addWidget(self.xs, 2, 1, 1, 1) - self.ys = QtWidgets.QLineEdit(self.gDadosCurva) - self.ys.setEnabled(False) - self.ys.setObjectName("ys") - self.gridLayout_9.addWidget(self.ys, 3, 1, 1, 1) - self.verticalLayout_12.addLayout(self.gridLayout_9) - self.gridLayout_5.addLayout(self.verticalLayout_12, 1, 4, 2, 1) - self.gridLayout_4.addWidget(self.gDadosCurva, 3, 0, 2, 2) - self.label_3.setBuddy(self.comboEstacaInicial) - self.label_6.setBuddy(self.txtNorthInicial) - self.label_7.setBuddy(self.txtEsteInicial) - self.label_4.setBuddy(self.txtNomeInicial) - self.label_5.setBuddy(self.comboEstacaFinal) - self.label_8.setBuddy(self.txtNomeFinal) - self.label_10.setBuddy(self.txtEsteFinal) - self.label_9.setBuddy(self.txtNorthFinal) - self.label_16.setBuddy(self.txtRUtilizado) - self.label_13.setBuddy(self.txtEMAX) - self.label_14.setBuddy(self.txtFMAX) - - self.retranslateUi(Dialog) - self.btnClose.clicked.connect(Dialog.accept) - self.prev.clicked.connect(Dialog.previousCurva) - self.next.clicked.connect(Dialog.nextCurva) - self.btnCancela.clicked.connect(Dialog.desabilitarControles) - QtCore.QMetaObject.connectSlotsByName(Dialog) - - def retranslateUi(self, Dialog): - _translate = QtCore.QCoreApplication.translate - Dialog.setWindowTitle(_translate("Dialog", "Curvas Horizontais")) - self.label.setText(_translate("Dialog", "Curva:")) - self.label_2.setText(_translate("Dialog", "Tipo da Curva:")) - self.comboElemento.setItemText(0, _translate("Dialog", "Circular Simples")) - self.comboElemento.setItemText(1, _translate("Dialog", "Circular com Trasição Simétrica")) - self.btnClose.setText(_translate("Dialog", "Fechar")) - self.prev.setText(_translate("Dialog", "Anterior")) - self.next.setText(_translate("Dialog", "Próxima")) - self.btnAjuda.setText(_translate("Dialog", "?")) - self.groupBox.setTitle(_translate("Dialog", "Ponto Inicial")) - self.label_3.setText(_translate("Dialog", "E&staca:")) - self.label_6.setText(_translate("Dialog", "&North:")) - self.label_7.setText(_translate("Dialog", "Este:")) - self.label_4.setText(_translate("Dialog", "&Nome:")) - self.groupBox_2.setTitle(_translate("Dialog", "Ponto Final")) - self.label_5.setText(_translate("Dialog", "Esta&ca:")) - self.label_8.setText(_translate("Dialog", "No&me:")) - self.label_10.setText(_translate("Dialog", "E&ste:")) - self.label_9.setText(_translate("Dialog", "&North:")) - self.btnNew.setText(_translate("Dialog", "Novo")) - self.btnEditar.setText(_translate("Dialog", "Editar")) - self.btnInsere.setText(_translate("Dialog", "Inserir")) - self.btnApagar.setText(_translate("Dialog", "Apagar")) - self.btnCancela.setText(_translate("Dialog", "Cancelar")) - self.label_24.setText(_translate("Dialog", "Distância entre\n" -"estacas:")) - self.btnCalcular.setText(_translate("Dialog", "Calcular")) - self.btnRelatorio.setText(_translate("Dialog", "Desenhar")) - self.gDadosCurva.setTitle(_translate("Dialog", "Dados da Curva")) - self.label_15.setText(_translate("Dialog", "Velocidade:")) - self.label_16.setText(_translate("Dialog", "Raio &Utilizado:")) - self.label_13.setText(_translate("Dialog", "EMA&X:")) - self.label_14.setText(_translate("Dialog", "FM&AX:")) - self.label_25.setText(_translate("Dialog", " Ls:")) - self.label_19.setToolTip(_translate("Dialog", "

Comprimento da curva circular (m)

")) - self.label_19.setWhatsThis(_translate("Dialog", "

Comprimento da curva circular (m)

")) - self.label_19.setText(_translate("Dialog", " D:")) - self.label_18.setWhatsThis(_translate("Dialog", "

Afastamento da curva (m)

")) - self.label_18.setText(_translate("Dialog", "T:")) - self.label_26.setToolTip(_translate("Dialog", "

Angulo de defleção da transição

")) - self.label_26.setWhatsThis(_translate("Dialog", "

Angulo de defleção da transição

")) - self.label_26.setText(_translate("Dialog", "Theta:")) - self.label_20.setText(_translate("Dialog", "G20:")) - self.label_23.setText(_translate("Dialog", "E(PT):")) - self.txtT.setToolTip(_translate("Dialog", "

Afastamento da curva (m)

")) - self.txtT.setWhatsThis(_translate("Dialog", "

Afastamento da curva (m)

")) - self.theta.setToolTip(_translate("Dialog", "

Angulo de defleção da transição

")) - self.theta.setWhatsThis(_translate("Dialog", "

Angulo de defleção da transição

")) - self.label_11.setWhatsThis(_translate("Dialog", "

Inclinação do trecho (%)

")) - self.label_11.setText(_translate("Dialog", "I")) - self.label_12.setToolTip(_translate("Dialog", "

Deflexão da curva horizontal circular

")) - self.label_12.setWhatsThis(_translate("Dialog", "

Deflexão da curva horizontal circular

")) - self.label_12.setText(_translate("Dialog", "Delta:")) - self.label_17.setToolTip(_translate("Dialog", "

Raio Mínimo da curva circular (m)

")) - self.label_17.setWhatsThis(_translate("Dialog", "

Raio Mínimo da curva circular (m)

")) - self.label_17.setText(_translate("Dialog", "Raio Minimo:")) - self.label_21.setText(_translate("Dialog", "E(PInovo):")) - self.label_22.setText(_translate("Dialog", "E(PC):")) - self.txtI.setToolTip(_translate("Dialog", "

Inclinação do trecho (%)

")) - self.txtI.setWhatsThis(_translate("Dialog", "

Inclinação do trecho (%)

")) - self.txtDelta.setToolTip(_translate("Dialog", "

Deflexão da curva horizontal circular

")) - self.txtDelta.setWhatsThis(_translate("Dialog", "

Deflexão da curva horizontal circular

")) - self.txtRMIN.setToolTip(_translate("Dialog", "

Raio Mínimo da curva circular (m)

")) - self.txtRMIN.setWhatsThis(_translate("Dialog", "

Raio Mínimo da curva circular (m)

")) - self.label_29.setToolTip(_translate("Dialog", "

Cooordenadas Xs e Ys do ponto entre curva de transição e circular.

")) - self.label_29.setWhatsThis(_translate("Dialog", "

Cooordenadas Xs e Ys do ponto entre curva de transição e circular.

")) - self.label_29.setText(_translate("Dialog", "Xs")) - self.lsmin.setToolTip(_translate("Dialog", "

Comprimento mínimo de transição (m)

")) - self.lsmin.setWhatsThis(_translate("Dialog", "

Comprimento mínimo de transição (m)

")) - self.label_28.setToolTip(_translate("Dialog", "

Comprimento mácimo de transição (m)

")) - self.label_28.setWhatsThis(_translate("Dialog", "

Comprimento mácimo de transição (m)

")) - self.label_28.setText(_translate("Dialog", "Lsmax: ")) - self.lsmax.setToolTip(_translate("Dialog", "

Comprimento mácimo de transição (m)

")) - self.lsmax.setWhatsThis(_translate("Dialog", "

Comprimento mácimo de transição (m)

")) - self.label_27.setToolTip(_translate("Dialog", "

Comprimento mínimo de transição (m)

")) - self.label_27.setWhatsThis(_translate("Dialog", "

Comprimento mínimo de transição (m)

")) - self.label_27.setText(_translate("Dialog", "Lsmin: ")) - self.label_30.setToolTip(_translate("Dialog", "

Cooordenadas Xs e Ys do ponto entre curva circular e de transição.

")) - self.label_30.setWhatsThis(_translate("Dialog", "

Cooordenadas Xs e Ys do ponto entre curva circular e de transição.

")) - self.label_30.setText(_translate("Dialog", "Ys")) - self.xs.setToolTip(_translate("Dialog", "

Cooordenadas Xs e Ys do ponto entre curva de transição e circular.

")) - self.xs.setWhatsThis(_translate("Dialog", "

Cooordenadas Xs e Ys do ponto entre curva de transição e circular.

")) - self.ys.setToolTip(_translate("Dialog", "

Cooordenadas Xs e Ys do ponto entre curva circular e de transição.

")) - self.ys.setWhatsThis(_translate("Dialog", "

Cooordenadas Xs e Ys do ponto entre curva circular e de transição.

")) - - +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'Topo_dialog_curva.ui' +# +# Created by: PyQt5 UI code generator 5.12.2 +# +# WARNING! All changes made in this file will be lost! + +from PyQt5 import QtCore, QtGui, QtWidgets + + +class Ui_Dialog(object): + def setupUi(self, Dialog): + Dialog.setObjectName("Dialog") + Dialog.resize(1009, 769) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(Dialog.sizePolicy().hasHeightForWidth()) + Dialog.setSizePolicy(sizePolicy) + self.gridLayout_4 = QtWidgets.QGridLayout(Dialog) + self.gridLayout_4.setObjectName("gridLayout_4") + self.horizontalLayout_5 = QtWidgets.QHBoxLayout() + self.horizontalLayout_5.setObjectName("horizontalLayout_5") + self.label = QtWidgets.QLabel(Dialog) + self.label.setObjectName("label") + self.horizontalLayout_5.addWidget(self.label) + self.comboCurva = QtWidgets.QComboBox(Dialog) + self.comboCurva.setObjectName("comboCurva") + self.horizontalLayout_5.addWidget(self.comboCurva) + spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) + self.horizontalLayout_5.addItem(spacerItem) + self.label_2 = QtWidgets.QLabel(Dialog) + self.label_2.setObjectName("label_2") + self.horizontalLayout_5.addWidget(self.label_2) + self.comboElemento = QtWidgets.QComboBox(Dialog) + self.comboElemento.setEnabled(True) + self.comboElemento.setObjectName("comboElemento") + self.comboElemento.addItem("") + self.comboElemento.addItem("") + self.horizontalLayout_5.addWidget(self.comboElemento) + self.gridLayout_4.addLayout(self.horizontalLayout_5, 0, 0, 1, 2) + self.verticalLayout = QtWidgets.QVBoxLayout() + self.verticalLayout.setObjectName("verticalLayout") + self.verticalLayout_11 = QtWidgets.QVBoxLayout() + self.verticalLayout_11.setObjectName("verticalLayout_11") + self.verticalLayout.addLayout(self.verticalLayout_11) + self.btnClose = QtWidgets.QPushButton(Dialog) + self.btnClose.setObjectName("btnClose") + self.verticalLayout.addWidget(self.btnClose) + self.verticalLayout_10 = QtWidgets.QVBoxLayout() + self.verticalLayout_10.setObjectName("verticalLayout_10") + self.verticalLayout.addLayout(self.verticalLayout_10) + self.horizontalLayout_4 = QtWidgets.QHBoxLayout() + self.horizontalLayout_4.setObjectName("horizontalLayout_4") + self.prev = QtWidgets.QPushButton(Dialog) + self.prev.setEnabled(False) + self.prev.setObjectName("prev") + self.horizontalLayout_4.addWidget(self.prev) + self.next = QtWidgets.QPushButton(Dialog) + self.next.setEnabled(False) + self.next.setObjectName("next") + self.horizontalLayout_4.addWidget(self.next) + self.verticalLayout.addLayout(self.horizontalLayout_4) + self.btnAjuda = QtWidgets.QPushButton(Dialog) + self.btnAjuda.setObjectName("btnAjuda") + self.verticalLayout.addWidget(self.btnAjuda) + spacerItem1 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) + self.verticalLayout.addItem(spacerItem1) + self.gridLayout_4.addLayout(self.verticalLayout, 0, 2, 2, 1) + self.groupBox = QtWidgets.QGroupBox(Dialog) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.groupBox.sizePolicy().hasHeightForWidth()) + self.groupBox.setSizePolicy(sizePolicy) + self.groupBox.setMinimumSize(QtCore.QSize(300, 300)) + self.groupBox.setObjectName("groupBox") + self.gridLayout_7 = QtWidgets.QGridLayout(self.groupBox) + self.gridLayout_7.setObjectName("gridLayout_7") + self.gridLayout = QtWidgets.QGridLayout() + self.gridLayout.setObjectName("gridLayout") + spacerItem2 = QtWidgets.QSpacerItem(20, 5, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) + self.gridLayout.addItem(spacerItem2, 0, 0, 1, 1) + self.label_3 = QtWidgets.QLabel(self.groupBox) + self.label_3.setObjectName("label_3") + self.gridLayout.addWidget(self.label_3, 1, 0, 1, 1) + self.comboEstacaInicial = QtWidgets.QComboBox(self.groupBox) + self.comboEstacaInicial.setEnabled(False) + self.comboEstacaInicial.setObjectName("comboEstacaInicial") + self.gridLayout.addWidget(self.comboEstacaInicial, 1, 1, 1, 1) + self.label_6 = QtWidgets.QLabel(self.groupBox) + self.label_6.setObjectName("label_6") + self.gridLayout.addWidget(self.label_6, 3, 0, 1, 1) + self.label_7 = QtWidgets.QLabel(self.groupBox) + self.label_7.setObjectName("label_7") + self.gridLayout.addWidget(self.label_7, 4, 0, 1, 1) + self.txtEsteInicial = QtWidgets.QLineEdit(self.groupBox) + self.txtEsteInicial.setEnabled(False) + self.txtEsteInicial.setObjectName("txtEsteInicial") + self.gridLayout.addWidget(self.txtEsteInicial, 4, 1, 1, 1) + self.txtNorthInicial = QtWidgets.QLineEdit(self.groupBox) + self.txtNorthInicial.setEnabled(False) + self.txtNorthInicial.setObjectName("txtNorthInicial") + self.gridLayout.addWidget(self.txtNorthInicial, 3, 1, 1, 1) + self.label_4 = QtWidgets.QLabel(self.groupBox) + self.label_4.setObjectName("label_4") + self.gridLayout.addWidget(self.label_4, 2, 0, 1, 1) + self.txtNomeInicial = QtWidgets.QLineEdit(self.groupBox) + self.txtNomeInicial.setEnabled(False) + self.txtNomeInicial.setText("") + self.txtNomeInicial.setObjectName("txtNomeInicial") + self.gridLayout.addWidget(self.txtNomeInicial, 2, 1, 1, 1) + self.gridLayout_7.addLayout(self.gridLayout, 0, 0, 1, 1) + self.gridLayout_4.addWidget(self.groupBox, 1, 0, 2, 1) + self.groupBox_2 = QtWidgets.QGroupBox(Dialog) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.groupBox_2.sizePolicy().hasHeightForWidth()) + self.groupBox_2.setSizePolicy(sizePolicy) + self.groupBox_2.setMinimumSize(QtCore.QSize(300, 300)) + self.groupBox_2.setObjectName("groupBox_2") + self.gridLayout_6 = QtWidgets.QGridLayout(self.groupBox_2) + self.gridLayout_6.setObjectName("gridLayout_6") + self.gridLayout_2 = QtWidgets.QGridLayout() + self.gridLayout_2.setObjectName("gridLayout_2") + self.comboEstacaFinal = QtWidgets.QComboBox(self.groupBox_2) + self.comboEstacaFinal.setEnabled(False) + self.comboEstacaFinal.setObjectName("comboEstacaFinal") + self.gridLayout_2.addWidget(self.comboEstacaFinal, 1, 1, 1, 1) + self.label_5 = QtWidgets.QLabel(self.groupBox_2) + self.label_5.setObjectName("label_5") + self.gridLayout_2.addWidget(self.label_5, 1, 0, 1, 1) + self.label_8 = QtWidgets.QLabel(self.groupBox_2) + self.label_8.setObjectName("label_8") + self.gridLayout_2.addWidget(self.label_8, 2, 0, 1, 1) + self.txtNomeFinal = QtWidgets.QLineEdit(self.groupBox_2) + self.txtNomeFinal.setEnabled(False) + self.txtNomeFinal.setObjectName("txtNomeFinal") + self.gridLayout_2.addWidget(self.txtNomeFinal, 2, 1, 1, 1) + self.txtNorthFinal = QtWidgets.QLineEdit(self.groupBox_2) + self.txtNorthFinal.setEnabled(False) + self.txtNorthFinal.setObjectName("txtNorthFinal") + self.gridLayout_2.addWidget(self.txtNorthFinal, 3, 1, 1, 1) + self.label_10 = QtWidgets.QLabel(self.groupBox_2) + self.label_10.setObjectName("label_10") + self.gridLayout_2.addWidget(self.label_10, 4, 0, 1, 1) + self.txtEsteFinal = QtWidgets.QLineEdit(self.groupBox_2) + self.txtEsteFinal.setEnabled(False) + self.txtEsteFinal.setObjectName("txtEsteFinal") + self.gridLayout_2.addWidget(self.txtEsteFinal, 4, 1, 1, 1) + self.label_9 = QtWidgets.QLabel(self.groupBox_2) + self.label_9.setObjectName("label_9") + self.gridLayout_2.addWidget(self.label_9, 3, 0, 1, 1) + spacerItem3 = QtWidgets.QSpacerItem(20, 5, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) + self.gridLayout_2.addItem(spacerItem3, 0, 0, 1, 1) + self.gridLayout_6.addLayout(self.gridLayout_2, 0, 0, 1, 1) + self.gridLayout_4.addWidget(self.groupBox_2, 1, 1, 2, 1) + self.verticalLayout_2 = QtWidgets.QVBoxLayout() + self.verticalLayout_2.setObjectName("verticalLayout_2") + self.btnNew = QtWidgets.QPushButton(Dialog) + self.btnNew.setObjectName("btnNew") + self.verticalLayout_2.addWidget(self.btnNew) + self.btnEditar = QtWidgets.QPushButton(Dialog) + self.btnEditar.setObjectName("btnEditar") + self.verticalLayout_2.addWidget(self.btnEditar) + self.btnInsere = QtWidgets.QPushButton(Dialog) + self.btnInsere.setEnabled(False) + self.btnInsere.setObjectName("btnInsere") + self.verticalLayout_2.addWidget(self.btnInsere) + self.btnApagar = QtWidgets.QPushButton(Dialog) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.btnApagar.sizePolicy().hasHeightForWidth()) + self.btnApagar.setSizePolicy(sizePolicy) + self.btnApagar.setObjectName("btnApagar") + self.verticalLayout_2.addWidget(self.btnApagar) + self.btnCancela = QtWidgets.QPushButton(Dialog) + self.btnCancela.setEnabled(False) + self.btnCancela.setObjectName("btnCancela") + self.verticalLayout_2.addWidget(self.btnCancela) + spacerItem4 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) + self.verticalLayout_2.addItem(spacerItem4) + self.gridLayout_4.addLayout(self.verticalLayout_2, 2, 2, 2, 1) + self.verticalLayout_9 = QtWidgets.QVBoxLayout() + self.verticalLayout_9.setObjectName("verticalLayout_9") + self.label_24 = QtWidgets.QLabel(Dialog) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Preferred) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.label_24.sizePolicy().hasHeightForWidth()) + self.label_24.setSizePolicy(sizePolicy) + self.label_24.setAlignment(QtCore.Qt.AlignCenter) + self.label_24.setObjectName("label_24") + self.verticalLayout_9.addWidget(self.label_24) + self.txtDist = QtWidgets.QLineEdit(Dialog) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.txtDist.sizePolicy().hasHeightForWidth()) + self.txtDist.setSizePolicy(sizePolicy) + self.txtDist.setObjectName("txtDist") + self.verticalLayout_9.addWidget(self.txtDist) + self.btnCalcular = QtWidgets.QPushButton(Dialog) + self.btnCalcular.setObjectName("btnCalcular") + self.verticalLayout_9.addWidget(self.btnCalcular) + spacerItem5 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) + self.verticalLayout_9.addItem(spacerItem5) + self.btnRelatorio = QtWidgets.QPushButton(Dialog) + self.btnRelatorio.setEnabled(False) + self.btnRelatorio.setObjectName("btnRelatorio") + self.verticalLayout_9.addWidget(self.btnRelatorio) + self.gridLayout_4.addLayout(self.verticalLayout_9, 4, 2, 1, 1) + self.gDadosCurva = QtWidgets.QGroupBox(Dialog) + self.gDadosCurva.setObjectName("gDadosCurva") + self.gridLayout_5 = QtWidgets.QGridLayout(self.gDadosCurva) + self.gridLayout_5.setObjectName("gridLayout_5") + self.horizontalLayout = QtWidgets.QHBoxLayout() + self.horizontalLayout.setObjectName("horizontalLayout") + self.verticalLayout_4 = QtWidgets.QVBoxLayout() + self.verticalLayout_4.setObjectName("verticalLayout_4") + self.label_15 = QtWidgets.QLabel(self.gDadosCurva) + self.label_15.setObjectName("label_15") + self.verticalLayout_4.addWidget(self.label_15) + self.label_16 = QtWidgets.QLabel(self.gDadosCurva) + self.label_16.setObjectName("label_16") + self.verticalLayout_4.addWidget(self.label_16) + self.horizontalLayout.addLayout(self.verticalLayout_4) + self.verticalLayout_3 = QtWidgets.QVBoxLayout() + self.verticalLayout_3.setObjectName("verticalLayout_3") + self.txtVelocidade = QtWidgets.QDoubleSpinBox(self.gDadosCurva) + self.txtVelocidade.setEnabled(False) + self.txtVelocidade.setMaximum(400.0) + self.txtVelocidade.setSingleStep(20.0) + self.txtVelocidade.setObjectName("txtVelocidade") + self.verticalLayout_3.addWidget(self.txtVelocidade) + self.txtRUtilizado = QtWidgets.QDoubleSpinBox(self.gDadosCurva) + self.txtRUtilizado.setEnabled(False) + self.txtRUtilizado.setMaximum(10000.0) + self.txtRUtilizado.setSingleStep(50.0) + self.txtRUtilizado.setProperty("value", 500.0) + self.txtRUtilizado.setObjectName("txtRUtilizado") + self.verticalLayout_3.addWidget(self.txtRUtilizado) + self.horizontalLayout.addLayout(self.verticalLayout_3) + self.gridLayout_5.addLayout(self.horizontalLayout, 0, 0, 1, 1) + self.gridLayout_3 = QtWidgets.QGridLayout() + self.gridLayout_3.setObjectName("gridLayout_3") + self.txtFMAX = QtWidgets.QDoubleSpinBox(self.gDadosCurva) + self.txtFMAX.setEnabled(False) + self.txtFMAX.setMaximum(1.0) + self.txtFMAX.setSingleStep(0.1) + self.txtFMAX.setObjectName("txtFMAX") + self.gridLayout_3.addWidget(self.txtFMAX, 1, 1, 1, 1) + self.label_13 = QtWidgets.QLabel(self.gDadosCurva) + self.label_13.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) + self.label_13.setObjectName("label_13") + self.gridLayout_3.addWidget(self.label_13, 0, 0, 1, 1) + self.label_14 = QtWidgets.QLabel(self.gDadosCurva) + self.label_14.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) + self.label_14.setObjectName("label_14") + self.gridLayout_3.addWidget(self.label_14, 1, 0, 1, 1) + self.txtEMAX = QtWidgets.QDoubleSpinBox(self.gDadosCurva) + self.txtEMAX.setEnabled(False) + self.txtEMAX.setMaximum(1.0) + self.txtEMAX.setSingleStep(0.01) + self.txtEMAX.setProperty("value", 0.08) + self.txtEMAX.setObjectName("txtEMAX") + self.gridLayout_3.addWidget(self.txtEMAX, 0, 1, 1, 1) + self.Ls = QtWidgets.QDoubleSpinBox(self.gDadosCurva) + self.Ls.setEnabled(False) + self.Ls.setMaximum(4000.0) + self.Ls.setSingleStep(20.0) + self.Ls.setObjectName("Ls") + self.gridLayout_3.addWidget(self.Ls, 0, 3, 1, 1) + self.label_25 = QtWidgets.QLabel(self.gDadosCurva) + self.label_25.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) + self.label_25.setObjectName("label_25") + self.gridLayout_3.addWidget(self.label_25, 0, 2, 1, 1) + self.label_19 = QtWidgets.QLabel(self.gDadosCurva) + self.label_19.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) + self.label_19.setObjectName("label_19") + self.gridLayout_3.addWidget(self.label_19, 1, 2, 1, 1) + self.txtD = QtWidgets.QDoubleSpinBox(self.gDadosCurva) + self.txtD.setEnabled(False) + self.txtD.setMaximum(5000.0) + self.txtD.setSingleStep(20.0) + self.txtD.setObjectName("txtD") + self.gridLayout_3.addWidget(self.txtD, 1, 3, 1, 1) + self.gridLayout_5.addLayout(self.gridLayout_3, 0, 2, 1, 3) + spacerItem6 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) + self.gridLayout_5.addItem(spacerItem6, 0, 1, 1, 1) + self.horizontalLayout_3 = QtWidgets.QHBoxLayout() + self.horizontalLayout_3.setObjectName("horizontalLayout_3") + self.verticalLayout_7 = QtWidgets.QVBoxLayout() + self.verticalLayout_7.setObjectName("verticalLayout_7") + self.label_18 = QtWidgets.QLabel(self.gDadosCurva) + self.label_18.setObjectName("label_18") + self.verticalLayout_7.addWidget(self.label_18) + self.label_26 = QtWidgets.QLabel(self.gDadosCurva) + self.label_26.setObjectName("label_26") + self.verticalLayout_7.addWidget(self.label_26) + self.label_20 = QtWidgets.QLabel(self.gDadosCurva) + self.label_20.setObjectName("label_20") + self.verticalLayout_7.addWidget(self.label_20) + self.label_23 = QtWidgets.QLabel(self.gDadosCurva) + self.label_23.setObjectName("label_23") + self.verticalLayout_7.addWidget(self.label_23) + self.horizontalLayout_3.addLayout(self.verticalLayout_7) + self.verticalLayout_8 = QtWidgets.QVBoxLayout() + self.verticalLayout_8.setObjectName("verticalLayout_8") + self.txtT = QtWidgets.QLineEdit(self.gDadosCurva) + self.txtT.setEnabled(False) + self.txtT.setText("") + self.txtT.setObjectName("txtT") + self.verticalLayout_8.addWidget(self.txtT) + self.theta = QtWidgets.QLineEdit(self.gDadosCurva) + self.theta.setEnabled(False) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.theta.sizePolicy().hasHeightForWidth()) + self.theta.setSizePolicy(sizePolicy) + self.theta.setObjectName("theta") + self.verticalLayout_8.addWidget(self.theta) + self.txtG20 = QtWidgets.QLineEdit(self.gDadosCurva) + self.txtG20.setEnabled(False) + self.txtG20.setText("") + self.txtG20.setObjectName("txtG20") + self.verticalLayout_8.addWidget(self.txtG20) + self.txtEPT = QtWidgets.QLineEdit(self.gDadosCurva) + self.txtEPT.setEnabled(False) + self.txtEPT.setText("") + self.txtEPT.setObjectName("txtEPT") + self.verticalLayout_8.addWidget(self.txtEPT) + self.horizontalLayout_3.addLayout(self.verticalLayout_8) + self.gridLayout_5.addLayout(self.horizontalLayout_3, 1, 2, 2, 1) + self.horizontalLayout_2 = QtWidgets.QHBoxLayout() + self.horizontalLayout_2.setObjectName("horizontalLayout_2") + self.verticalLayout_5 = QtWidgets.QVBoxLayout() + self.verticalLayout_5.setObjectName("verticalLayout_5") + self.label_11 = QtWidgets.QLabel(self.gDadosCurva) + self.label_11.setObjectName("label_11") + self.verticalLayout_5.addWidget(self.label_11) + self.label_12 = QtWidgets.QLabel(self.gDadosCurva) + self.label_12.setObjectName("label_12") + self.verticalLayout_5.addWidget(self.label_12) + self.label_17 = QtWidgets.QLabel(self.gDadosCurva) + self.label_17.setObjectName("label_17") + self.verticalLayout_5.addWidget(self.label_17) + self.label_21 = QtWidgets.QLabel(self.gDadosCurva) + self.label_21.setObjectName("label_21") + self.verticalLayout_5.addWidget(self.label_21) + self.label_22 = QtWidgets.QLabel(self.gDadosCurva) + self.label_22.setObjectName("label_22") + self.verticalLayout_5.addWidget(self.label_22) + self.horizontalLayout_2.addLayout(self.verticalLayout_5) + self.verticalLayout_6 = QtWidgets.QVBoxLayout() + self.verticalLayout_6.setObjectName("verticalLayout_6") + self.txtI = QtWidgets.QLineEdit(self.gDadosCurva) + self.txtI.setEnabled(False) + self.txtI.setText("") + self.txtI.setObjectName("txtI") + self.verticalLayout_6.addWidget(self.txtI) + self.txtDelta = QtWidgets.QLineEdit(self.gDadosCurva) + self.txtDelta.setEnabled(False) + self.txtDelta.setText("") + self.txtDelta.setObjectName("txtDelta") + self.verticalLayout_6.addWidget(self.txtDelta) + self.txtRMIN = QtWidgets.QLineEdit(self.gDadosCurva) + self.txtRMIN.setEnabled(False) + self.txtRMIN.setText("") + self.txtRMIN.setObjectName("txtRMIN") + self.verticalLayout_6.addWidget(self.txtRMIN) + self.txtEPI = QtWidgets.QLineEdit(self.gDadosCurva) + self.txtEPI.setEnabled(False) + self.txtEPI.setText("") + self.txtEPI.setObjectName("txtEPI") + self.verticalLayout_6.addWidget(self.txtEPI) + self.txtEPC = QtWidgets.QLineEdit(self.gDadosCurva) + self.txtEPC.setEnabled(False) + self.txtEPC.setText("") + self.txtEPC.setObjectName("txtEPC") + self.verticalLayout_6.addWidget(self.txtEPC) + self.horizontalLayout_2.addLayout(self.verticalLayout_6) + self.gridLayout_5.addLayout(self.horizontalLayout_2, 1, 0, 2, 1) + spacerItem7 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) + self.gridLayout_5.addItem(spacerItem7, 1, 3, 1, 1) + self.verticalLayout_12 = QtWidgets.QVBoxLayout() + self.verticalLayout_12.setObjectName("verticalLayout_12") + self.gridLayout_9 = QtWidgets.QGridLayout() + self.gridLayout_9.setObjectName("gridLayout_9") + self.label_29 = QtWidgets.QLabel(self.gDadosCurva) + self.label_29.setObjectName("label_29") + self.gridLayout_9.addWidget(self.label_29, 2, 0, 1, 1) + self.lsmin = QtWidgets.QLineEdit(self.gDadosCurva) + self.lsmin.setEnabled(False) + self.lsmin.setObjectName("lsmin") + self.gridLayout_9.addWidget(self.lsmin, 0, 1, 1, 1) + self.label_28 = QtWidgets.QLabel(self.gDadosCurva) + self.label_28.setObjectName("label_28") + self.gridLayout_9.addWidget(self.label_28, 1, 0, 1, 1) + self.lsmax = QtWidgets.QLineEdit(self.gDadosCurva) + self.lsmax.setEnabled(False) + self.lsmax.setObjectName("lsmax") + self.gridLayout_9.addWidget(self.lsmax, 1, 1, 1, 1) + self.label_27 = QtWidgets.QLabel(self.gDadosCurva) + self.label_27.setObjectName("label_27") + self.gridLayout_9.addWidget(self.label_27, 0, 0, 1, 1) + self.label_30 = QtWidgets.QLabel(self.gDadosCurva) + self.label_30.setObjectName("label_30") + self.gridLayout_9.addWidget(self.label_30, 3, 0, 1, 1) + self.xs = QtWidgets.QLineEdit(self.gDadosCurva) + self.xs.setEnabled(False) + self.xs.setObjectName("xs") + self.gridLayout_9.addWidget(self.xs, 2, 1, 1, 1) + self.ys = QtWidgets.QLineEdit(self.gDadosCurva) + self.ys.setEnabled(False) + self.ys.setObjectName("ys") + self.gridLayout_9.addWidget(self.ys, 3, 1, 1, 1) + self.verticalLayout_12.addLayout(self.gridLayout_9) + self.gridLayout_5.addLayout(self.verticalLayout_12, 1, 4, 2, 1) + self.gridLayout_4.addWidget(self.gDadosCurva, 3, 0, 2, 2) + self.label_3.setBuddy(self.comboEstacaInicial) + self.label_6.setBuddy(self.txtNorthInicial) + self.label_7.setBuddy(self.txtEsteInicial) + self.label_4.setBuddy(self.txtNomeInicial) + self.label_5.setBuddy(self.comboEstacaFinal) + self.label_8.setBuddy(self.txtNomeFinal) + self.label_10.setBuddy(self.txtEsteFinal) + self.label_9.setBuddy(self.txtNorthFinal) + self.label_16.setBuddy(self.txtRUtilizado) + self.label_13.setBuddy(self.txtEMAX) + self.label_14.setBuddy(self.txtFMAX) + + self.retranslateUi(Dialog) + self.btnClose.clicked.connect(Dialog.accept) + self.prev.clicked.connect(Dialog.previousCurva) + self.next.clicked.connect(Dialog.nextCurva) + self.btnCancela.clicked.connect(Dialog.desabilitarControles) + QtCore.QMetaObject.connectSlotsByName(Dialog) + + def retranslateUi(self, Dialog): + _translate = QtCore.QCoreApplication.translate + Dialog.setWindowTitle(_translate("Dialog", "Curvas Horizontais")) + self.label.setText(_translate("Dialog", "Curva:")) + self.label_2.setText(_translate("Dialog", "Tipo da Curva:")) + self.comboElemento.setItemText(0, _translate("Dialog", "Circular Simples")) + self.comboElemento.setItemText(1, _translate("Dialog", "Circular com Trasição Simétrica")) + self.btnClose.setText(_translate("Dialog", "Fechar")) + self.prev.setText(_translate("Dialog", "Anterior")) + self.next.setText(_translate("Dialog", "Próxima")) + self.btnAjuda.setText(_translate("Dialog", "?")) + self.groupBox.setTitle(_translate("Dialog", "Ponto Inicial")) + self.label_3.setText(_translate("Dialog", "E&staca:")) + self.label_6.setText(_translate("Dialog", "&North:")) + self.label_7.setText(_translate("Dialog", "Este:")) + self.label_4.setText(_translate("Dialog", "&Nome:")) + self.groupBox_2.setTitle(_translate("Dialog", "Ponto Final")) + self.label_5.setText(_translate("Dialog", "Esta&ca:")) + self.label_8.setText(_translate("Dialog", "No&me:")) + self.label_10.setText(_translate("Dialog", "E&ste:")) + self.label_9.setText(_translate("Dialog", "&North:")) + self.btnNew.setText(_translate("Dialog", "Novo")) + self.btnEditar.setText(_translate("Dialog", "Editar")) + self.btnInsere.setText(_translate("Dialog", "Inserir")) + self.btnApagar.setText(_translate("Dialog", "Apagar")) + self.btnCancela.setText(_translate("Dialog", "Cancelar")) + self.label_24.setText(_translate("Dialog", "Distância entre\n" +"estacas:")) + self.btnCalcular.setText(_translate("Dialog", "Calcular")) + self.btnRelatorio.setText(_translate("Dialog", "Desenhar")) + self.gDadosCurva.setTitle(_translate("Dialog", "Dados da Curva")) + self.label_15.setText(_translate("Dialog", "Velocidade:")) + self.label_16.setText(_translate("Dialog", "Raio &Utilizado:")) + self.label_13.setText(_translate("Dialog", "EMA&X:")) + self.label_14.setText(_translate("Dialog", "FM&AX:")) + self.label_25.setText(_translate("Dialog", " Ls:")) + self.label_19.setToolTip(_translate("Dialog", "

Comprimento da curva circular (m)

")) + self.label_19.setWhatsThis(_translate("Dialog", "

Comprimento da curva circular (m)

")) + self.label_19.setText(_translate("Dialog", " D:")) + self.label_18.setWhatsThis(_translate("Dialog", "

Afastamento da curva (m)

")) + self.label_18.setText(_translate("Dialog", "T:")) + self.label_26.setToolTip(_translate("Dialog", "

Angulo de defleção da transição

")) + self.label_26.setWhatsThis(_translate("Dialog", "

Angulo de defleção da transição

")) + self.label_26.setText(_translate("Dialog", "Theta:")) + self.label_20.setText(_translate("Dialog", "G20:")) + self.label_23.setText(_translate("Dialog", "E(PT):")) + self.txtT.setToolTip(_translate("Dialog", "

Afastamento da curva (m)

")) + self.txtT.setWhatsThis(_translate("Dialog", "

Afastamento da curva (m)

")) + self.theta.setToolTip(_translate("Dialog", "

Angulo de defleção da transição

")) + self.theta.setWhatsThis(_translate("Dialog", "

Angulo de defleção da transição

")) + self.label_11.setWhatsThis(_translate("Dialog", "

Inclinação do trecho (%)

")) + self.label_11.setText(_translate("Dialog", "I")) + self.label_12.setToolTip(_translate("Dialog", "

Deflexão da curva horizontal circular

")) + self.label_12.setWhatsThis(_translate("Dialog", "

Deflexão da curva horizontal circular

")) + self.label_12.setText(_translate("Dialog", "Delta:")) + self.label_17.setToolTip(_translate("Dialog", "

Raio Mínimo da curva circular (m)

")) + self.label_17.setWhatsThis(_translate("Dialog", "

Raio Mínimo da curva circular (m)

")) + self.label_17.setText(_translate("Dialog", "Raio Minimo:")) + self.label_21.setText(_translate("Dialog", "E(PInovo):")) + self.label_22.setText(_translate("Dialog", "E(PC):")) + self.txtI.setToolTip(_translate("Dialog", "

Inclinação do trecho (%)

")) + self.txtI.setWhatsThis(_translate("Dialog", "

Inclinação do trecho (%)

")) + self.txtDelta.setToolTip(_translate("Dialog", "

Deflexão da curva horizontal circular

")) + self.txtDelta.setWhatsThis(_translate("Dialog", "

Deflexão da curva horizontal circular

")) + self.txtRMIN.setToolTip(_translate("Dialog", "

Raio Mínimo da curva circular (m)

")) + self.txtRMIN.setWhatsThis(_translate("Dialog", "

Raio Mínimo da curva circular (m)

")) + self.label_29.setToolTip(_translate("Dialog", "

Cooordenadas Xs e Ys do ponto entre curva de transição e circular.

")) + self.label_29.setWhatsThis(_translate("Dialog", "

Cooordenadas Xs e Ys do ponto entre curva de transição e circular.

")) + self.label_29.setText(_translate("Dialog", "Xs")) + self.lsmin.setToolTip(_translate("Dialog", "

Comprimento mínimo de transição (m)

")) + self.lsmin.setWhatsThis(_translate("Dialog", "

Comprimento mínimo de transição (m)

")) + self.label_28.setToolTip(_translate("Dialog", "

Comprimento mácimo de transição (m)

")) + self.label_28.setWhatsThis(_translate("Dialog", "

Comprimento mácimo de transição (m)

")) + self.label_28.setText(_translate("Dialog", "Lsmax: ")) + self.lsmax.setToolTip(_translate("Dialog", "

Comprimento mácimo de transição (m)

")) + self.lsmax.setWhatsThis(_translate("Dialog", "

Comprimento mácimo de transição (m)

")) + self.label_27.setToolTip(_translate("Dialog", "

Comprimento mínimo de transição (m)

")) + self.label_27.setWhatsThis(_translate("Dialog", "

Comprimento mínimo de transição (m)

")) + self.label_27.setText(_translate("Dialog", "Lsmin: ")) + self.label_30.setToolTip(_translate("Dialog", "

Cooordenadas Xs e Ys do ponto entre curva circular e de transição.

")) + self.label_30.setWhatsThis(_translate("Dialog", "

Cooordenadas Xs e Ys do ponto entre curva circular e de transição.

")) + self.label_30.setText(_translate("Dialog", "Ys")) + self.xs.setToolTip(_translate("Dialog", "

Cooordenadas Xs e Ys do ponto entre curva de transição e circular.

")) + self.xs.setWhatsThis(_translate("Dialog", "

Cooordenadas Xs e Ys do ponto entre curva de transição e circular.

")) + self.ys.setToolTip(_translate("Dialog", "

Cooordenadas Xs e Ys do ponto entre curva circular e de transição.

")) + self.ys.setWhatsThis(_translate("Dialog", "

Cooordenadas Xs e Ys do ponto entre curva circular e de transição.

")) + + diff --git a/app/view/ui/py/Topo_dialog_estacas.1.ui.py b/app/view/ui/py/Topo_dialog_estacas.1.ui.py old mode 100644 new mode 100755 index 6b8c100..0a2cb7f --- a/app/view/ui/py/Topo_dialog_estacas.1.ui.py +++ b/app/view/ui/py/Topo_dialog_estacas.1.ui.py @@ -1,73 +1,73 @@ -# -*- coding: utf-8 -*- - -# Form implementation generated from reading ui file 'Topo_dialog_estacas.1.ui' -# -# Created by: PyQt5 UI code generator 5.12.2 -# -# WARNING! All changes made in this file will be lost! - -from PyQt5 import QtCore, QtGui, QtWidgets - - -class Ui_Dialog(object): - def setupUi(self, Dialog): - Dialog.setObjectName("Dialog") - Dialog.resize(945, 513) - self.gridLayout = QtWidgets.QGridLayout(Dialog) - self.gridLayout.setObjectName("gridLayout") - self.tableWidget = QtWidgets.QTableWidget(Dialog) - self.tableWidget.setObjectName("tableWidget") - self.tableWidget.setColumnCount(0) - self.tableWidget.setRowCount(0) - self.gridLayout.addWidget(self.tableWidget, 0, 0, 2, 1) - self.verticalLayout = QtWidgets.QVBoxLayout() - self.verticalLayout.setObjectName("verticalLayout") - self.pushButton = QtWidgets.QPushButton(Dialog) - self.pushButton.setObjectName("pushButton") - self.buttonGroup = QtWidgets.QButtonGroup(Dialog) - self.buttonGroup.setObjectName("buttonGroup") - self.buttonGroup.addButton(self.pushButton) - self.verticalLayout.addWidget(self.pushButton) - self.pushButton_2 = QtWidgets.QPushButton(Dialog) - self.pushButton_2.setObjectName("pushButton_2") - self.buttonGroup.addButton(self.pushButton_2) - self.verticalLayout.addWidget(self.pushButton_2) - self.pushButton_3 = QtWidgets.QPushButton(Dialog) - self.pushButton_3.setObjectName("pushButton_3") - self.buttonGroup.addButton(self.pushButton_3) - self.verticalLayout.addWidget(self.pushButton_3) - self.pushButton_4 = QtWidgets.QPushButton(Dialog) - self.pushButton_4.setObjectName("pushButton_4") - self.buttonGroup.addButton(self.pushButton_4) - self.verticalLayout.addWidget(self.pushButton_4) - self.pushButton_6 = QtWidgets.QPushButton(Dialog) - self.pushButton_6.setObjectName("pushButton_6") - self.buttonGroup.addButton(self.pushButton_6) - self.verticalLayout.addWidget(self.pushButton_6) - self.pushButton_5 = QtWidgets.QPushButton(Dialog) - self.pushButton_5.setEnabled(True) - self.pushButton_5.setObjectName("pushButton_5") - self.buttonGroup.addButton(self.pushButton_5) - self.verticalLayout.addWidget(self.pushButton_5) - self.gridLayout.addLayout(self.verticalLayout, 0, 1, 1, 1) - self.btnCota = QtWidgets.QPushButton(Dialog) - self.btnCota.setEnabled(True) - self.btnCota.setObjectName("btnCota") - self.gridLayout.addWidget(self.btnCota, 1, 1, 1, 1) - - self.retranslateUi(Dialog) - QtCore.QMetaObject.connectSlotsByName(Dialog) - - def retranslateUi(self, Dialog): - _translate = QtCore.QCoreApplication.translate - Dialog.setWindowTitle(_translate("Dialog", "Dialog")) - self.pushButton.setText(_translate("Dialog", "Abrir Arquivo")) - self.pushButton_2.setText(_translate("Dialog", "Recalcular Estacas")) - self.pushButton_3.setText(_translate("Dialog", "Plotar")) - self.pushButton_4.setText(_translate("Dialog", "Perfil de trecho")) - self.pushButton_6.setText(_translate("Dialog", "Salvar em CSV")) - self.pushButton_5.setText(_translate("Dialog", "Salvar")) - self.btnCota.setText(_translate("Dialog", "Obter Cotas\n" -"via Google")) - - +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'Topo_dialog_estacas.1.ui' +# +# Created by: PyQt5 UI code generator 5.12.2 +# +# WARNING! All changes made in this file will be lost! + +from PyQt5 import QtCore, QtGui, QtWidgets + + +class Ui_Dialog(object): + def setupUi(self, Dialog): + Dialog.setObjectName("Dialog") + Dialog.resize(945, 513) + self.gridLayout = QtWidgets.QGridLayout(Dialog) + self.gridLayout.setObjectName("gridLayout") + self.tableWidget = QtWidgets.QTableWidget(Dialog) + self.tableWidget.setObjectName("tableWidget") + self.tableWidget.setColumnCount(0) + self.tableWidget.setRowCount(0) + self.gridLayout.addWidget(self.tableWidget, 0, 0, 2, 1) + self.verticalLayout = QtWidgets.QVBoxLayout() + self.verticalLayout.setObjectName("verticalLayout") + self.pushButton = QtWidgets.QPushButton(Dialog) + self.pushButton.setObjectName("pushButton") + self.buttonGroup = QtWidgets.QButtonGroup(Dialog) + self.buttonGroup.setObjectName("buttonGroup") + self.buttonGroup.addButton(self.pushButton) + self.verticalLayout.addWidget(self.pushButton) + self.pushButton_2 = QtWidgets.QPushButton(Dialog) + self.pushButton_2.setObjectName("pushButton_2") + self.buttonGroup.addButton(self.pushButton_2) + self.verticalLayout.addWidget(self.pushButton_2) + self.pushButton_3 = QtWidgets.QPushButton(Dialog) + self.pushButton_3.setObjectName("pushButton_3") + self.buttonGroup.addButton(self.pushButton_3) + self.verticalLayout.addWidget(self.pushButton_3) + self.pushButton_4 = QtWidgets.QPushButton(Dialog) + self.pushButton_4.setObjectName("pushButton_4") + self.buttonGroup.addButton(self.pushButton_4) + self.verticalLayout.addWidget(self.pushButton_4) + self.pushButton_6 = QtWidgets.QPushButton(Dialog) + self.pushButton_6.setObjectName("pushButton_6") + self.buttonGroup.addButton(self.pushButton_6) + self.verticalLayout.addWidget(self.pushButton_6) + self.pushButton_5 = QtWidgets.QPushButton(Dialog) + self.pushButton_5.setEnabled(True) + self.pushButton_5.setObjectName("pushButton_5") + self.buttonGroup.addButton(self.pushButton_5) + self.verticalLayout.addWidget(self.pushButton_5) + self.gridLayout.addLayout(self.verticalLayout, 0, 1, 1, 1) + self.btnCota = QtWidgets.QPushButton(Dialog) + self.btnCota.setEnabled(True) + self.btnCota.setObjectName("btnCota") + self.gridLayout.addWidget(self.btnCota, 1, 1, 1, 1) + + self.retranslateUi(Dialog) + QtCore.QMetaObject.connectSlotsByName(Dialog) + + def retranslateUi(self, Dialog): + _translate = QtCore.QCoreApplication.translate + Dialog.setWindowTitle(_translate("Dialog", "Dialog")) + self.pushButton.setText(_translate("Dialog", "Abrir Arquivo")) + self.pushButton_2.setText(_translate("Dialog", "Recalcular Estacas")) + self.pushButton_3.setText(_translate("Dialog", "Plotar")) + self.pushButton_4.setText(_translate("Dialog", "Perfil de trecho")) + self.pushButton_6.setText(_translate("Dialog", "Salvar em CSV")) + self.pushButton_5.setText(_translate("Dialog", "Salvar")) + self.btnCota.setText(_translate("Dialog", "Obter Cotas\n" +"via Google")) + + diff --git a/app/view/ui/py/Topo_dialog_estacas.ui.py b/app/view/ui/py/Topo_dialog_estacas.ui.py old mode 100644 new mode 100755 index fbdd1ff..a1d625e --- a/app/view/ui/py/Topo_dialog_estacas.ui.py +++ b/app/view/ui/py/Topo_dialog_estacas.ui.py @@ -1,96 +1,96 @@ -# -*- coding: utf-8 -*- - -# Form implementation generated from reading ui file 'Topo_dialog_estacas.ui' -# -# Created by: PyQt5 UI code generator 5.12.2 -# -# WARNING! All changes made in this file will be lost! - -from PyQt5 import QtCore, QtGui, QtWidgets - - -class Ui_Dialog(object): - def setupUi(self, Dialog): - Dialog.setObjectName("Dialog") - Dialog.resize(965, 575) - self.gridLayout = QtWidgets.QGridLayout(Dialog) - self.gridLayout.setObjectName("gridLayout") - self.verticalLayout = QtWidgets.QVBoxLayout() - self.verticalLayout.setObjectName("verticalLayout") - self.btnEstacas = QtWidgets.QPushButton(Dialog) - self.btnEstacas.setObjectName("btnEstacas") - self.buttonGroup = QtWidgets.QButtonGroup(Dialog) - self.buttonGroup.setObjectName("buttonGroup") - self.buttonGroup.addButton(self.btnEstacas) - self.verticalLayout.addWidget(self.btnEstacas) - self.btnDuplicar = QtWidgets.QPushButton(Dialog) - self.btnDuplicar.setObjectName("btnDuplicar") - self.verticalLayout.addWidget(self.btnDuplicar) - self.btnLayer = QtWidgets.QPushButton(Dialog) - self.btnLayer.setObjectName("btnLayer") - self.buttonGroup.addButton(self.btnLayer) - self.verticalLayout.addWidget(self.btnLayer) - self.btnCurva = QtWidgets.QPushButton(Dialog) - self.btnCurva.setObjectName("btnCurva") - self.verticalLayout.addWidget(self.btnCurva) - self.btnPerfil = QtWidgets.QPushButton(Dialog) - self.btnPerfil.setObjectName("btnPerfil") - self.buttonGroup.addButton(self.btnPerfil) - self.verticalLayout.addWidget(self.btnPerfil) - self.btnSave = QtWidgets.QPushButton(Dialog) - self.btnSave.setEnabled(True) - self.btnSave.setObjectName("btnSave") - self.buttonGroup.addButton(self.btnSave) - self.verticalLayout.addWidget(self.btnSave) - self.btnSaveCSV = QtWidgets.QPushButton(Dialog) - self.btnSaveCSV.setObjectName("btnSaveCSV") - self.buttonGroup.addButton(self.btnSaveCSV) - self.verticalLayout.addWidget(self.btnSaveCSV) - spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) - self.verticalLayout.addItem(spacerItem) - self.gridLayout.addLayout(self.verticalLayout, 0, 1, 1, 1) - self.tableWidget = QtWidgets.QTableWidget(Dialog) - self.tableWidget.setObjectName("tableWidget") - self.tableWidget.setColumnCount(0) - self.tableWidget.setRowCount(0) - self.gridLayout.addWidget(self.tableWidget, 0, 0, 5, 1) - self.btnCotaTIFF = QtWidgets.QPushButton(Dialog) - self.btnCotaTIFF.setObjectName("btnCotaTIFF") - self.gridLayout.addWidget(self.btnCotaTIFF, 1, 1, 1, 1) - self.btnCotaPC = QtWidgets.QPushButton(Dialog) - self.btnCotaPC.setObjectName("btnCotaPC") - self.gridLayout.addWidget(self.btnCotaPC, 2, 1, 1, 1) - self.btnCota = QtWidgets.QPushButton(Dialog) - self.btnCota.setObjectName("btnCota") - self.gridLayout.addWidget(self.btnCota, 3, 1, 1, 1) - - self.retranslateUi(Dialog) - QtCore.QMetaObject.connectSlotsByName(Dialog) - - def retranslateUi(self, Dialog): - _translate = QtCore.QCoreApplication.translate - Dialog.setWindowTitle(_translate("Dialog", "Traçado Horizontal")) - self.btnEstacas.setWhatsThis(_translate("Dialog", "

Recalcula as estacas com base em uma layer

")) - self.btnEstacas.setText(_translate("Dialog", "Recalcular Estacas")) - self.btnDuplicar.setWhatsThis(_translate("Dialog", "

Duplica os dados horizontai com, curvas da estaca e perfil vertical com curvas.

")) - self.btnDuplicar.setText(_translate("Dialog", "Duplicar")) - self.btnLayer.setWhatsThis(_translate("Dialog", "

Gera uma layer com o traçado. Essa layer não conterá informações de curvas.

")) - self.btnLayer.setText(_translate("Dialog", "Plotar")) - self.btnCurva.setToolTip(_translate("Dialog", "

Calcular Curvas Horizontais

")) - self.btnCurva.setWhatsThis(_translate("Dialog", "

Cria e gerencia as curvas do traçado horizontal.

")) - self.btnCurva.setText(_translate("Dialog", "Curvas")) - self.btnPerfil.setWhatsThis(_translate("Dialog", "

Define o greide.

")) - self.btnPerfil.setText(_translate("Dialog", "Perfil de trecho")) - self.btnSave.setWhatsThis(_translate("Dialog", "

Salva a tabela horizontal e as edições manuais feitas nela

")) - self.btnSave.setText(_translate("Dialog", "Salvar")) - self.btnSaveCSV.setWhatsThis(_translate("Dialog", "

Exporta a tabela em uma planilha.

")) - self.btnSaveCSV.setText(_translate("Dialog", "Salvar em CSV")) - self.btnCotaTIFF.setWhatsThis(_translate("Dialog", "

Extrair cotas de um arquivo raster de imagem tiff

")) - self.btnCotaTIFF.setText(_translate("Dialog", "Obter Cotas\n" -"via GeoTIFF")) - self.btnCotaPC.setText(_translate("Dialog", "Obter Cotas\n" -"via DXF")) - self.btnCota.setText(_translate("Dialog", "Obter Cotas \n" -"via Google")) - - +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'Topo_dialog_estacas.ui' +# +# Created by: PyQt5 UI code generator 5.12.2 +# +# WARNING! All changes made in this file will be lost! + +from PyQt5 import QtCore, QtGui, QtWidgets + + +class Ui_Dialog(object): + def setupUi(self, Dialog): + Dialog.setObjectName("Dialog") + Dialog.resize(965, 575) + self.gridLayout = QtWidgets.QGridLayout(Dialog) + self.gridLayout.setObjectName("gridLayout") + self.verticalLayout = QtWidgets.QVBoxLayout() + self.verticalLayout.setObjectName("verticalLayout") + self.btnEstacas = QtWidgets.QPushButton(Dialog) + self.btnEstacas.setObjectName("btnEstacas") + self.buttonGroup = QtWidgets.QButtonGroup(Dialog) + self.buttonGroup.setObjectName("buttonGroup") + self.buttonGroup.addButton(self.btnEstacas) + self.verticalLayout.addWidget(self.btnEstacas) + self.btnDuplicar = QtWidgets.QPushButton(Dialog) + self.btnDuplicar.setObjectName("btnDuplicar") + self.verticalLayout.addWidget(self.btnDuplicar) + self.btnLayer = QtWidgets.QPushButton(Dialog) + self.btnLayer.setObjectName("btnLayer") + self.buttonGroup.addButton(self.btnLayer) + self.verticalLayout.addWidget(self.btnLayer) + self.btnCurva = QtWidgets.QPushButton(Dialog) + self.btnCurva.setObjectName("btnCurva") + self.verticalLayout.addWidget(self.btnCurva) + self.btnPerfil = QtWidgets.QPushButton(Dialog) + self.btnPerfil.setObjectName("btnPerfil") + self.buttonGroup.addButton(self.btnPerfil) + self.verticalLayout.addWidget(self.btnPerfil) + self.btnSave = QtWidgets.QPushButton(Dialog) + self.btnSave.setEnabled(True) + self.btnSave.setObjectName("btnSave") + self.buttonGroup.addButton(self.btnSave) + self.verticalLayout.addWidget(self.btnSave) + self.btnSaveCSV = QtWidgets.QPushButton(Dialog) + self.btnSaveCSV.setObjectName("btnSaveCSV") + self.buttonGroup.addButton(self.btnSaveCSV) + self.verticalLayout.addWidget(self.btnSaveCSV) + spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) + self.verticalLayout.addItem(spacerItem) + self.gridLayout.addLayout(self.verticalLayout, 0, 1, 1, 1) + self.tableWidget = QtWidgets.QTableWidget(Dialog) + self.tableWidget.setObjectName("tableWidget") + self.tableWidget.setColumnCount(0) + self.tableWidget.setRowCount(0) + self.gridLayout.addWidget(self.tableWidget, 0, 0, 5, 1) + self.btnCotaTIFF = QtWidgets.QPushButton(Dialog) + self.btnCotaTIFF.setObjectName("btnCotaTIFF") + self.gridLayout.addWidget(self.btnCotaTIFF, 1, 1, 1, 1) + self.btnCotaPC = QtWidgets.QPushButton(Dialog) + self.btnCotaPC.setObjectName("btnCotaPC") + self.gridLayout.addWidget(self.btnCotaPC, 2, 1, 1, 1) + self.btnCota = QtWidgets.QPushButton(Dialog) + self.btnCota.setObjectName("btnCota") + self.gridLayout.addWidget(self.btnCota, 3, 1, 1, 1) + + self.retranslateUi(Dialog) + QtCore.QMetaObject.connectSlotsByName(Dialog) + + def retranslateUi(self, Dialog): + _translate = QtCore.QCoreApplication.translate + Dialog.setWindowTitle(_translate("Dialog", "Traçado Horizontal")) + self.btnEstacas.setWhatsThis(_translate("Dialog", "

Recalcula as estacas com base em uma layer

")) + self.btnEstacas.setText(_translate("Dialog", "Recalcular Estacas")) + self.btnDuplicar.setWhatsThis(_translate("Dialog", "

Duplica os dados horizontai com, curvas da estaca e perfil vertical com curvas.

")) + self.btnDuplicar.setText(_translate("Dialog", "Duplicar")) + self.btnLayer.setWhatsThis(_translate("Dialog", "

Gera uma layer com o traçado. Essa layer não conterá informações de curvas.

")) + self.btnLayer.setText(_translate("Dialog", "Plotar")) + self.btnCurva.setToolTip(_translate("Dialog", "

Calcular Curvas Horizontais

")) + self.btnCurva.setWhatsThis(_translate("Dialog", "

Cria e gerencia as curvas do traçado horizontal.

")) + self.btnCurva.setText(_translate("Dialog", "Curvas")) + self.btnPerfil.setWhatsThis(_translate("Dialog", "

Define o greide.

")) + self.btnPerfil.setText(_translate("Dialog", "Perfil de trecho")) + self.btnSave.setWhatsThis(_translate("Dialog", "

Salva a tabela horizontal e as edições manuais feitas nela

")) + self.btnSave.setText(_translate("Dialog", "Salvar")) + self.btnSaveCSV.setWhatsThis(_translate("Dialog", "

Exporta a tabela em uma planilha.

")) + self.btnSaveCSV.setText(_translate("Dialog", "Salvar em CSV")) + self.btnCotaTIFF.setWhatsThis(_translate("Dialog", "

Extrair cotas de um arquivo raster de imagem tiff

")) + self.btnCotaTIFF.setText(_translate("Dialog", "Obter Cotas\n" +"via GeoTIFF")) + self.btnCotaPC.setText(_translate("Dialog", "Obter Cotas\n" +"via DXF")) + self.btnCota.setText(_translate("Dialog", "Obter Cotas \n" +"via Google")) + + diff --git a/app/view/ui/py/Topo_dialog_estacas1.ui.py b/app/view/ui/py/Topo_dialog_estacas1.ui.py old mode 100644 new mode 100755 index 1d9c124..a5de021 --- a/app/view/ui/py/Topo_dialog_estacas1.ui.py +++ b/app/view/ui/py/Topo_dialog_estacas1.ui.py @@ -1,115 +1,115 @@ -# -*- coding: utf-8 -*- - -# Form implementation generated from reading ui file 'Topo_dialog_estacas1.ui' -# -# Created by: PyQt5 UI code generator 5.12.2 -# -# WARNING! All changes made in this file will be lost! - -from PyQt5 import QtCore, QtGui, QtWidgets - - -class Ui_ProjetoEstradas(object): - def setupUi(self, ProjetoEstradas): - ProjetoEstradas.setObjectName("ProjetoEstradas") - ProjetoEstradas.resize(894, 508) - self.gridLayout = QtWidgets.QGridLayout(ProjetoEstradas) - self.gridLayout.setObjectName("gridLayout") - self.groupBox = QtWidgets.QGroupBox(ProjetoEstradas) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.groupBox.sizePolicy().hasHeightForWidth()) - self.groupBox.setSizePolicy(sizePolicy) - self.groupBox.setObjectName("groupBox") - self.horizontalLayout_2 = QtWidgets.QHBoxLayout(self.groupBox) - self.horizontalLayout_2.setObjectName("horizontalLayout_2") - self.horizontalLayout = QtWidgets.QHBoxLayout() - self.horizontalLayout.setSizeConstraint(QtWidgets.QLayout.SetNoConstraint) - self.horizontalLayout.setObjectName("horizontalLayout") - self.tableEstacas = QtWidgets.QTableWidget(self.groupBox) - self.tableEstacas.setObjectName("tableEstacas") - self.tableEstacas.setColumnCount(0) - self.tableEstacas.setRowCount(0) - self.horizontalLayout.addWidget(self.tableEstacas) - self.verticalLayout = QtWidgets.QVBoxLayout() - self.verticalLayout.setObjectName("verticalLayout") - self.btnNovo = QtWidgets.QPushButton(self.groupBox) - self.btnNovo.setAutoDefault(False) - self.btnNovo.setObjectName("btnNovo") - self.verticalLayout.addWidget(self.btnNovo) - self.btnOpen = QtWidgets.QPushButton(self.groupBox) - self.btnOpen.setDefault(True) - self.btnOpen.setObjectName("btnOpen") - self.verticalLayout.addWidget(self.btnOpen) - self.btnOpenCv = QtWidgets.QPushButton(self.groupBox) - self.btnOpenCv.setAutoDefault(False) - self.btnOpenCv.setObjectName("btnOpenCv") - self.verticalLayout.addWidget(self.btnOpenCv) - self.btnOpenCSV = QtWidgets.QPushButton(self.groupBox) - self.btnOpenCSV.setAutoDefault(False) - self.btnOpenCSV.setObjectName("btnOpenCSV") - self.verticalLayout.addWidget(self.btnOpenCSV) - self.btnDuplicar = QtWidgets.QPushButton(self.groupBox) - self.btnDuplicar.setAutoDefault(False) - self.btnDuplicar.setObjectName("btnDuplicar") - self.verticalLayout.addWidget(self.btnDuplicar) - self.btnGerarTracado = QtWidgets.QPushButton(self.groupBox) - self.btnGerarTracado.setAutoDefault(False) - self.btnGerarTracado.setObjectName("btnGerarTracado") - self.buttonGroup_2 = QtWidgets.QButtonGroup(ProjetoEstradas) - self.buttonGroup_2.setObjectName("buttonGroup_2") - self.buttonGroup_2.addButton(self.btnGerarTracado) - self.verticalLayout.addWidget(self.btnGerarTracado) - self.btnGerarCurvas = QtWidgets.QPushButton(self.groupBox) - self.btnGerarCurvas.setAutoDefault(False) - self.btnGerarCurvas.setObjectName("btnGerarCurvas") - self.verticalLayout.addWidget(self.btnGerarCurvas) - self.btnApagar = QtWidgets.QPushButton(self.groupBox) - self.btnApagar.setAutoDefault(False) - self.btnApagar.setObjectName("btnApagar") - self.buttonGroup_2.addButton(self.btnApagar) - self.verticalLayout.addWidget(self.btnApagar) - self.btnCancela = QtWidgets.QPushButton(self.groupBox) - self.btnCancela.setAutoDefault(False) - self.btnCancela.setObjectName("btnCancela") - self.verticalLayout.addWidget(self.btnCancela) - spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) - self.verticalLayout.addItem(spacerItem) - self.horizontalLayout.addLayout(self.verticalLayout) - self.horizontalLayout_2.addLayout(self.horizontalLayout) - self.gridLayout.addWidget(self.groupBox, 0, 0, 1, 1) - - self.retranslateUi(ProjetoEstradas) - self.btnCancela.clicked.connect(ProjetoEstradas.reject) - self.btnOpen.clicked.connect(ProjetoEstradas.accept) - self.btnNovo.clicked.connect(ProjetoEstradas.accept) - self.btnOpenCSV.clicked.connect(ProjetoEstradas.accept) - self.btnGerarTracado.clicked.connect(ProjetoEstradas.reject) - self.btnOpenCv.clicked.connect(ProjetoEstradas.accept) - self.btnGerarCurvas.clicked.connect(ProjetoEstradas.accept) - QtCore.QMetaObject.connectSlotsByName(ProjetoEstradas) - - def retranslateUi(self, ProjetoEstradas): - _translate = QtCore.QCoreApplication.translate - ProjetoEstradas.setWindowTitle(_translate("ProjetoEstradas", "Projeto de Estradas")) - self.groupBox.setTitle(_translate("ProjetoEstradas", "Arquivos de estacas salvos no projeto")) - self.btnNovo.setWhatsThis(_translate("ProjetoEstradas", "

Cria um novo arquivo a partir do traçado horizontal definido uma layer.

")) - self.btnNovo.setText(_translate("ProjetoEstradas", "Novo arquivo de estacas")) - self.btnOpen.setWhatsThis(_translate("ProjetoEstradas", "

Traçado horizontal em tabela curvas horizontais, edição do perfil vertical e curvas verticais.

")) - self.btnOpen.setText(_translate("ProjetoEstradas", "Abrir")) - self.btnOpenCv.setWhatsThis(_translate("ProjetoEstradas", "

Tabelas de interseção de estacas, edição do perfil transversal, cálculo de volumes de corte e aterro, diagrama de bruckner

")) - self.btnOpenCv.setText(_translate("ProjetoEstradas", "Abrir Verticais")) - self.btnOpenCSV.setWhatsThis(_translate("ProjetoEstradas", "

Cria o traçado transversal a partir de um arquivo CSV extraído pelo plugin ou no formato do plugin.

")) - self.btnOpenCSV.setText(_translate("ProjetoEstradas", "Abrir Arquivo CSV")) - self.btnDuplicar.setWhatsThis(_translate("ProjetoEstradas", "

Duplica o arquivo selecionado.

Dados horizontais e a configuração do perfil transversal serão copiados.
A tabela de verticais e de interseção serão recalculadas.

")) - self.btnDuplicar.setText(_translate("ProjetoEstradas", "Duplicar")) - self.btnGerarTracado.setWhatsThis(_translate("ProjetoEstradas", "

Gera um arquivo shapefile que será incluído no projeto contento as tranversais.

")) - self.btnGerarTracado.setText(_translate("ProjetoEstradas", "Gerar Traçado")) - self.btnGerarCurvas.setWhatsThis(_translate("ProjetoEstradas", "

Gera um geopackage do projeto que pode conter curvas e tangentes.

Essa opção é útil caso você queira gerar o traçado e curvas de uma só vez.

")) - self.btnGerarCurvas.setText(_translate("ProjetoEstradas", "Gerar Curvas")) - self.btnGerarCurvas.setShortcut(_translate("ProjetoEstradas", "Alt+C")) - self.btnApagar.setText(_translate("ProjetoEstradas", "Apagar Arquivo")) - self.btnCancela.setText(_translate("ProjetoEstradas", "Cancelar")) - - +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'Topo_dialog_estacas1.ui' +# +# Created by: PyQt5 UI code generator 5.12.2 +# +# WARNING! All changes made in this file will be lost! + +from PyQt5 import QtCore, QtGui, QtWidgets + + +class Ui_ProjetoEstradas(object): + def setupUi(self, ProjetoEstradas): + ProjetoEstradas.setObjectName("ProjetoEstradas") + ProjetoEstradas.resize(894, 508) + self.gridLayout = QtWidgets.QGridLayout(ProjetoEstradas) + self.gridLayout.setObjectName("gridLayout") + self.groupBox = QtWidgets.QGroupBox(ProjetoEstradas) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.groupBox.sizePolicy().hasHeightForWidth()) + self.groupBox.setSizePolicy(sizePolicy) + self.groupBox.setObjectName("groupBox") + self.horizontalLayout_2 = QtWidgets.QHBoxLayout(self.groupBox) + self.horizontalLayout_2.setObjectName("horizontalLayout_2") + self.horizontalLayout = QtWidgets.QHBoxLayout() + self.horizontalLayout.setSizeConstraint(QtWidgets.QLayout.SetNoConstraint) + self.horizontalLayout.setObjectName("horizontalLayout") + self.tableEstacas = QtWidgets.QTableWidget(self.groupBox) + self.tableEstacas.setObjectName("tableEstacas") + self.tableEstacas.setColumnCount(0) + self.tableEstacas.setRowCount(0) + self.horizontalLayout.addWidget(self.tableEstacas) + self.verticalLayout = QtWidgets.QVBoxLayout() + self.verticalLayout.setObjectName("verticalLayout") + self.btnNovo = QtWidgets.QPushButton(self.groupBox) + self.btnNovo.setAutoDefault(False) + self.btnNovo.setObjectName("btnNovo") + self.verticalLayout.addWidget(self.btnNovo) + self.btnOpen = QtWidgets.QPushButton(self.groupBox) + self.btnOpen.setDefault(True) + self.btnOpen.setObjectName("btnOpen") + self.verticalLayout.addWidget(self.btnOpen) + self.btnOpenCv = QtWidgets.QPushButton(self.groupBox) + self.btnOpenCv.setAutoDefault(False) + self.btnOpenCv.setObjectName("btnOpenCv") + self.verticalLayout.addWidget(self.btnOpenCv) + self.btnOpenCSV = QtWidgets.QPushButton(self.groupBox) + self.btnOpenCSV.setAutoDefault(False) + self.btnOpenCSV.setObjectName("btnOpenCSV") + self.verticalLayout.addWidget(self.btnOpenCSV) + self.btnDuplicar = QtWidgets.QPushButton(self.groupBox) + self.btnDuplicar.setAutoDefault(False) + self.btnDuplicar.setObjectName("btnDuplicar") + self.verticalLayout.addWidget(self.btnDuplicar) + self.btnGerarTracado = QtWidgets.QPushButton(self.groupBox) + self.btnGerarTracado.setAutoDefault(False) + self.btnGerarTracado.setObjectName("btnGerarTracado") + self.buttonGroup_2 = QtWidgets.QButtonGroup(ProjetoEstradas) + self.buttonGroup_2.setObjectName("buttonGroup_2") + self.buttonGroup_2.addButton(self.btnGerarTracado) + self.verticalLayout.addWidget(self.btnGerarTracado) + self.btnGerarCurvas = QtWidgets.QPushButton(self.groupBox) + self.btnGerarCurvas.setAutoDefault(False) + self.btnGerarCurvas.setObjectName("btnGerarCurvas") + self.verticalLayout.addWidget(self.btnGerarCurvas) + self.btnApagar = QtWidgets.QPushButton(self.groupBox) + self.btnApagar.setAutoDefault(False) + self.btnApagar.setObjectName("btnApagar") + self.buttonGroup_2.addButton(self.btnApagar) + self.verticalLayout.addWidget(self.btnApagar) + self.btnCancela = QtWidgets.QPushButton(self.groupBox) + self.btnCancela.setAutoDefault(False) + self.btnCancela.setObjectName("btnCancela") + self.verticalLayout.addWidget(self.btnCancela) + spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) + self.verticalLayout.addItem(spacerItem) + self.horizontalLayout.addLayout(self.verticalLayout) + self.horizontalLayout_2.addLayout(self.horizontalLayout) + self.gridLayout.addWidget(self.groupBox, 0, 0, 1, 1) + + self.retranslateUi(ProjetoEstradas) + self.btnCancela.clicked.connect(ProjetoEstradas.reject) + self.btnOpen.clicked.connect(ProjetoEstradas.accept) + self.btnNovo.clicked.connect(ProjetoEstradas.accept) + self.btnOpenCSV.clicked.connect(ProjetoEstradas.accept) + self.btnGerarTracado.clicked.connect(ProjetoEstradas.reject) + self.btnOpenCv.clicked.connect(ProjetoEstradas.accept) + self.btnGerarCurvas.clicked.connect(ProjetoEstradas.accept) + QtCore.QMetaObject.connectSlotsByName(ProjetoEstradas) + + def retranslateUi(self, ProjetoEstradas): + _translate = QtCore.QCoreApplication.translate + ProjetoEstradas.setWindowTitle(_translate("ProjetoEstradas", "Projeto de Estradas")) + self.groupBox.setTitle(_translate("ProjetoEstradas", "Arquivos de estacas salvos no projeto")) + self.btnNovo.setWhatsThis(_translate("ProjetoEstradas", "

Cria um novo arquivo a partir do traçado horizontal definido uma layer.

")) + self.btnNovo.setText(_translate("ProjetoEstradas", "Novo arquivo de estacas")) + self.btnOpen.setWhatsThis(_translate("ProjetoEstradas", "

Traçado horizontal em tabela curvas horizontais, edição do perfil vertical e curvas verticais.

")) + self.btnOpen.setText(_translate("ProjetoEstradas", "Abrir")) + self.btnOpenCv.setWhatsThis(_translate("ProjetoEstradas", "

Tabelas de interseção de estacas, edição do perfil transversal, cálculo de volumes de corte e aterro, diagrama de bruckner

")) + self.btnOpenCv.setText(_translate("ProjetoEstradas", "Abrir Verticais")) + self.btnOpenCSV.setWhatsThis(_translate("ProjetoEstradas", "

Cria o traçado transversal a partir de um arquivo CSV extraído pelo plugin ou no formato do plugin.

")) + self.btnOpenCSV.setText(_translate("ProjetoEstradas", "Abrir Arquivo CSV")) + self.btnDuplicar.setWhatsThis(_translate("ProjetoEstradas", "

Duplica o arquivo selecionado.

Dados horizontais e a configuração do perfil transversal serão copiados.
A tabela de verticais e de interseção serão recalculadas.

")) + self.btnDuplicar.setText(_translate("ProjetoEstradas", "Duplicar")) + self.btnGerarTracado.setWhatsThis(_translate("ProjetoEstradas", "

Gera um arquivo shapefile que será incluído no projeto contento as tranversais.

")) + self.btnGerarTracado.setText(_translate("ProjetoEstradas", "Gerar Traçado")) + self.btnGerarCurvas.setWhatsThis(_translate("ProjetoEstradas", "

Gera um geopackage do projeto que pode conter curvas e tangentes.

Essa opção é útil caso você queira gerar o traçado e curvas de uma só vez.

")) + self.btnGerarCurvas.setText(_translate("ProjetoEstradas", "Gerar Curvas")) + self.btnGerarCurvas.setShortcut(_translate("ProjetoEstradas", "Alt+C")) + self.btnApagar.setText(_translate("ProjetoEstradas", "Apagar Arquivo")) + self.btnCancela.setText(_translate("ProjetoEstradas", "Cancelar")) + + diff --git a/app/view/ui/py/Topo_dialog_gera_tracado.ui.py b/app/view/ui/py/Topo_dialog_gera_tracado.ui.py old mode 100644 new mode 100755 index db1fc7d..c7014a7 --- a/app/view/ui/py/Topo_dialog_gera_tracado.ui.py +++ b/app/view/ui/py/Topo_dialog_gera_tracado.ui.py @@ -1,64 +1,64 @@ -# -*- coding: utf-8 -*- - -# Form implementation generated from reading ui file 'Topo_dialog_gera_tracado.ui' -# -# Created by: PyQt5 UI code generator 5.12.2 -# -# WARNING! All changes made in this file will be lost! - -from PyQt5 import QtCore, QtGui, QtWidgets - - -class Ui_GeraTracadoDialog(object): - def setupUi(self, GeraTracadoDialog): - GeraTracadoDialog.setObjectName("GeraTracadoDialog") - GeraTracadoDialog.resize(399, 287) - GeraTracadoDialog.setMaximumSize(QtCore.QSize(399, 287)) - GeraTracadoDialog.setSizeGripEnabled(False) - self.gridLayout = QtWidgets.QGridLayout(GeraTracadoDialog) - self.gridLayout.setObjectName("gridLayout") - self.label = QtWidgets.QLabel(GeraTracadoDialog) - self.label.setObjectName("label") - self.gridLayout.addWidget(self.label, 0, 0, 1, 1) - self.txtNorthStart = QtWidgets.QLineEdit(GeraTracadoDialog) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.txtNorthStart.sizePolicy().hasHeightForWidth()) - self.txtNorthStart.setSizePolicy(sizePolicy) - self.txtNorthStart.setObjectName("txtNorthStart") - self.gridLayout.addWidget(self.txtNorthStart, 0, 1, 1, 1) - self.txtEsteStart = QtWidgets.QLineEdit(GeraTracadoDialog) - self.txtEsteStart.setObjectName("txtEsteStart") - self.gridLayout.addWidget(self.txtEsteStart, 0, 2, 1, 1) - self.label_3 = QtWidgets.QLabel(GeraTracadoDialog) - self.label_3.setObjectName("label_3") - self.gridLayout.addWidget(self.label_3, 1, 0, 1, 1) - self.txtNorthEnd = QtWidgets.QLineEdit(GeraTracadoDialog) - self.txtNorthEnd.setObjectName("txtNorthEnd") - self.gridLayout.addWidget(self.txtNorthEnd, 1, 1, 1, 1) - self.txtEsteEnd = QtWidgets.QLineEdit(GeraTracadoDialog) - self.txtEsteEnd.setObjectName("txtEsteEnd") - self.gridLayout.addWidget(self.txtEsteEnd, 1, 2, 1, 1) - self.buttonBox = QtWidgets.QDialogButtonBox(GeraTracadoDialog) - self.buttonBox.setOrientation(QtCore.Qt.Horizontal) - self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok) - self.buttonBox.setObjectName("buttonBox") - self.gridLayout.addWidget(self.buttonBox, 2, 0, 1, 3) - - self.retranslateUi(GeraTracadoDialog) - self.buttonBox.accepted.connect(GeraTracadoDialog.accept) - self.buttonBox.rejected.connect(GeraTracadoDialog.reject) - QtCore.QMetaObject.connectSlotsByName(GeraTracadoDialog) - - def retranslateUi(self, GeraTracadoDialog): - _translate = QtCore.QCoreApplication.translate - GeraTracadoDialog.setWindowTitle(_translate("GeraTracadoDialog", "Gera Traçado")) - self.label.setText(_translate("GeraTracadoDialog", "Ponto Inicial")) - self.txtNorthStart.setPlaceholderText(_translate("GeraTracadoDialog", "North")) - self.txtEsteStart.setPlaceholderText(_translate("GeraTracadoDialog", "Este")) - self.label_3.setText(_translate("GeraTracadoDialog", "Ponto Final")) - self.txtNorthEnd.setPlaceholderText(_translate("GeraTracadoDialog", "North")) - self.txtEsteEnd.setPlaceholderText(_translate("GeraTracadoDialog", "Este")) - - +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'Topo_dialog_gera_tracado.ui' +# +# Created by: PyQt5 UI code generator 5.12.2 +# +# WARNING! All changes made in this file will be lost! + +from PyQt5 import QtCore, QtGui, QtWidgets + + +class Ui_GeraTracadoDialog(object): + def setupUi(self, GeraTracadoDialog): + GeraTracadoDialog.setObjectName("GeraTracadoDialog") + GeraTracadoDialog.resize(399, 287) + GeraTracadoDialog.setMaximumSize(QtCore.QSize(399, 287)) + GeraTracadoDialog.setSizeGripEnabled(False) + self.gridLayout = QtWidgets.QGridLayout(GeraTracadoDialog) + self.gridLayout.setObjectName("gridLayout") + self.label = QtWidgets.QLabel(GeraTracadoDialog) + self.label.setObjectName("label") + self.gridLayout.addWidget(self.label, 0, 0, 1, 1) + self.txtNorthStart = QtWidgets.QLineEdit(GeraTracadoDialog) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.txtNorthStart.sizePolicy().hasHeightForWidth()) + self.txtNorthStart.setSizePolicy(sizePolicy) + self.txtNorthStart.setObjectName("txtNorthStart") + self.gridLayout.addWidget(self.txtNorthStart, 0, 1, 1, 1) + self.txtEsteStart = QtWidgets.QLineEdit(GeraTracadoDialog) + self.txtEsteStart.setObjectName("txtEsteStart") + self.gridLayout.addWidget(self.txtEsteStart, 0, 2, 1, 1) + self.label_3 = QtWidgets.QLabel(GeraTracadoDialog) + self.label_3.setObjectName("label_3") + self.gridLayout.addWidget(self.label_3, 1, 0, 1, 1) + self.txtNorthEnd = QtWidgets.QLineEdit(GeraTracadoDialog) + self.txtNorthEnd.setObjectName("txtNorthEnd") + self.gridLayout.addWidget(self.txtNorthEnd, 1, 1, 1, 1) + self.txtEsteEnd = QtWidgets.QLineEdit(GeraTracadoDialog) + self.txtEsteEnd.setObjectName("txtEsteEnd") + self.gridLayout.addWidget(self.txtEsteEnd, 1, 2, 1, 1) + self.buttonBox = QtWidgets.QDialogButtonBox(GeraTracadoDialog) + self.buttonBox.setOrientation(QtCore.Qt.Horizontal) + self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok) + self.buttonBox.setObjectName("buttonBox") + self.gridLayout.addWidget(self.buttonBox, 2, 0, 1, 3) + + self.retranslateUi(GeraTracadoDialog) + self.buttonBox.accepted.connect(GeraTracadoDialog.accept) + self.buttonBox.rejected.connect(GeraTracadoDialog.reject) + QtCore.QMetaObject.connectSlotsByName(GeraTracadoDialog) + + def retranslateUi(self, GeraTracadoDialog): + _translate = QtCore.QCoreApplication.translate + GeraTracadoDialog.setWindowTitle(_translate("GeraTracadoDialog", "Gera Traçado")) + self.label.setText(_translate("GeraTracadoDialog", "Ponto Inicial")) + self.txtNorthStart.setPlaceholderText(_translate("GeraTracadoDialog", "North")) + self.txtEsteStart.setPlaceholderText(_translate("GeraTracadoDialog", "Este")) + self.label_3.setText(_translate("GeraTracadoDialog", "Ponto Final")) + self.txtNorthEnd.setPlaceholderText(_translate("GeraTracadoDialog", "North")) + self.txtEsteEnd.setPlaceholderText(_translate("GeraTracadoDialog", "Este")) + + diff --git a/app/view/ui/py/Topo_dialog_gera_tracado_1.ui.py b/app/view/ui/py/Topo_dialog_gera_tracado_1.ui.py old mode 100644 new mode 100755 index 5dac1c0..cdc4ac6 --- a/app/view/ui/py/Topo_dialog_gera_tracado_1.ui.py +++ b/app/view/ui/py/Topo_dialog_gera_tracado_1.ui.py @@ -1,72 +1,72 @@ -# -*- coding: utf-8 -*- - -# Form implementation generated from reading ui file 'Topo_dialog_gera_tracado_1.ui' -# -# Created by: PyQt5 UI code generator 5.12.2 -# -# WARNING! All changes made in this file will be lost! - -from PyQt5 import QtCore, QtGui, QtWidgets - - -class Ui_GeraTracadoDialog(object): - def setupUi(self, GeraTracadoDialog): - GeraTracadoDialog.setObjectName("GeraTracadoDialog") - GeraTracadoDialog.resize(395, 100) - GeraTracadoDialog.setMaximumSize(QtCore.QSize(425, 287)) - GeraTracadoDialog.setSizeGripEnabled(False) - GeraTracadoDialog.setModal(False) - self.gridLayout = QtWidgets.QGridLayout(GeraTracadoDialog) - self.gridLayout.setObjectName("gridLayout") - self.verticalLayout = QtWidgets.QVBoxLayout() - self.verticalLayout.setSpacing(0) - self.verticalLayout.setObjectName("verticalLayout") - self.horizontalLayout = QtWidgets.QHBoxLayout() - self.horizontalLayout.setContentsMargins(0, 0, 0, 6) - self.horizontalLayout.setObjectName("horizontalLayout") - self.lblName = QtWidgets.QLabel(GeraTracadoDialog) - self.lblName.setObjectName("lblName") - self.horizontalLayout.addWidget(self.lblName) - self.txtNorth = QtWidgets.QLineEdit(GeraTracadoDialog) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.txtNorth.sizePolicy().hasHeightForWidth()) - self.txtNorth.setSizePolicy(sizePolicy) - self.txtNorth.setObjectName("txtNorth") - self.horizontalLayout.addWidget(self.txtNorth) - self.txtEste = QtWidgets.QLineEdit(GeraTracadoDialog) - self.txtEste.setObjectName("txtEste") - self.horizontalLayout.addWidget(self.txtEste) - self.verticalLayout.addLayout(self.horizontalLayout) - self.horizontalLayout_2 = QtWidgets.QHBoxLayout() - self.horizontalLayout_2.setObjectName("horizontalLayout_2") - self.btnCancela = QtWidgets.QPushButton(GeraTracadoDialog) - self.btnCancela.setObjectName("btnCancela") - self.horizontalLayout_2.addWidget(self.btnCancela) - self.btnCapture = QtWidgets.QPushButton(GeraTracadoDialog) - self.btnCapture.setObjectName("btnCapture") - self.horizontalLayout_2.addWidget(self.btnCapture) - self.btnOK = QtWidgets.QPushButton(GeraTracadoDialog) - self.btnOK.setObjectName("btnOK") - self.horizontalLayout_2.addWidget(self.btnOK) - self.verticalLayout.addLayout(self.horizontalLayout_2) - self.gridLayout.addLayout(self.verticalLayout, 0, 0, 1, 1) - - self.retranslateUi(GeraTracadoDialog) - self.btnCapture.clicked.connect(GeraTracadoDialog.reject) - self.btnOK.clicked.connect(GeraTracadoDialog.accept) - self.btnCancela.clicked.connect(GeraTracadoDialog.reject) - QtCore.QMetaObject.connectSlotsByName(GeraTracadoDialog) - - def retranslateUi(self, GeraTracadoDialog): - _translate = QtCore.QCoreApplication.translate - GeraTracadoDialog.setWindowTitle(_translate("GeraTracadoDialog", "Gera Traçado")) - self.lblName.setText(_translate("GeraTracadoDialog", "Ponto Inicial ")) - self.txtNorth.setPlaceholderText(_translate("GeraTracadoDialog", "North")) - self.txtEste.setPlaceholderText(_translate("GeraTracadoDialog", "Este")) - self.btnCancela.setText(_translate("GeraTracadoDialog", "Cancela")) - self.btnCapture.setText(_translate("GeraTracadoDialog", "Capturar")) - self.btnOK.setText(_translate("GeraTracadoDialog", "OK")) - - +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'Topo_dialog_gera_tracado_1.ui' +# +# Created by: PyQt5 UI code generator 5.12.2 +# +# WARNING! All changes made in this file will be lost! + +from PyQt5 import QtCore, QtGui, QtWidgets + + +class Ui_GeraTracadoDialog(object): + def setupUi(self, GeraTracadoDialog): + GeraTracadoDialog.setObjectName("GeraTracadoDialog") + GeraTracadoDialog.resize(395, 100) + GeraTracadoDialog.setMaximumSize(QtCore.QSize(425, 287)) + GeraTracadoDialog.setSizeGripEnabled(False) + GeraTracadoDialog.setModal(False) + self.gridLayout = QtWidgets.QGridLayout(GeraTracadoDialog) + self.gridLayout.setObjectName("gridLayout") + self.verticalLayout = QtWidgets.QVBoxLayout() + self.verticalLayout.setSpacing(0) + self.verticalLayout.setObjectName("verticalLayout") + self.horizontalLayout = QtWidgets.QHBoxLayout() + self.horizontalLayout.setContentsMargins(0, 0, 0, 6) + self.horizontalLayout.setObjectName("horizontalLayout") + self.lblName = QtWidgets.QLabel(GeraTracadoDialog) + self.lblName.setObjectName("lblName") + self.horizontalLayout.addWidget(self.lblName) + self.txtNorth = QtWidgets.QLineEdit(GeraTracadoDialog) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.txtNorth.sizePolicy().hasHeightForWidth()) + self.txtNorth.setSizePolicy(sizePolicy) + self.txtNorth.setObjectName("txtNorth") + self.horizontalLayout.addWidget(self.txtNorth) + self.txtEste = QtWidgets.QLineEdit(GeraTracadoDialog) + self.txtEste.setObjectName("txtEste") + self.horizontalLayout.addWidget(self.txtEste) + self.verticalLayout.addLayout(self.horizontalLayout) + self.horizontalLayout_2 = QtWidgets.QHBoxLayout() + self.horizontalLayout_2.setObjectName("horizontalLayout_2") + self.btnCancela = QtWidgets.QPushButton(GeraTracadoDialog) + self.btnCancela.setObjectName("btnCancela") + self.horizontalLayout_2.addWidget(self.btnCancela) + self.btnCapture = QtWidgets.QPushButton(GeraTracadoDialog) + self.btnCapture.setObjectName("btnCapture") + self.horizontalLayout_2.addWidget(self.btnCapture) + self.btnOK = QtWidgets.QPushButton(GeraTracadoDialog) + self.btnOK.setObjectName("btnOK") + self.horizontalLayout_2.addWidget(self.btnOK) + self.verticalLayout.addLayout(self.horizontalLayout_2) + self.gridLayout.addLayout(self.verticalLayout, 0, 0, 1, 1) + + self.retranslateUi(GeraTracadoDialog) + self.btnCapture.clicked.connect(GeraTracadoDialog.reject) + self.btnOK.clicked.connect(GeraTracadoDialog.accept) + self.btnCancela.clicked.connect(GeraTracadoDialog.reject) + QtCore.QMetaObject.connectSlotsByName(GeraTracadoDialog) + + def retranslateUi(self, GeraTracadoDialog): + _translate = QtCore.QCoreApplication.translate + GeraTracadoDialog.setWindowTitle(_translate("GeraTracadoDialog", "Gera Traçado")) + self.lblName.setText(_translate("GeraTracadoDialog", "Ponto Inicial ")) + self.txtNorth.setPlaceholderText(_translate("GeraTracadoDialog", "North")) + self.txtEste.setPlaceholderText(_translate("GeraTracadoDialog", "Este")) + self.btnCancela.setText(_translate("GeraTracadoDialog", "Cancela")) + self.btnCapture.setText(_translate("GeraTracadoDialog", "Capturar")) + self.btnOK.setText(_translate("GeraTracadoDialog", "OK")) + + diff --git a/app/view/ui/py/Topo_dialog_perfil.ui.py b/app/view/ui/py/Topo_dialog_perfil.ui.py old mode 100644 new mode 100755 index 4b62a0b..ccc4e24 --- a/app/view/ui/py/Topo_dialog_perfil.ui.py +++ b/app/view/ui/py/Topo_dialog_perfil.ui.py @@ -1,53 +1,53 @@ -# -*- coding: utf-8 -*- - -# Form implementation generated from reading ui file 'Topo_dialog_perfil.ui' -# -# Created by: PyQt5 UI code generator 5.12.2 -# -# WARNING! All changes made in this file will be lost! - -from PyQt5 import QtCore, QtGui, QtWidgets - - -class Ui_PerfilTrecho(object): - def setupUi(self, PerfilTrecho): - PerfilTrecho.setObjectName("PerfilTrecho") - PerfilTrecho.resize(590, 169) - self.gridLayout = QtWidgets.QGridLayout(PerfilTrecho) - self.gridLayout.setObjectName("gridLayout") - self.label = QtWidgets.QLabel(PerfilTrecho) - self.label.setObjectName("label") - self.gridLayout.addWidget(self.label, 0, 0, 1, 1) - self.comboEstaca1 = QtWidgets.QComboBox(PerfilTrecho) - self.comboEstaca1.setObjectName("comboEstaca1") - self.comboEstaca1.addItem("") - self.gridLayout.addWidget(self.comboEstaca1, 0, 1, 1, 1) - self.label_2 = QtWidgets.QLabel(PerfilTrecho) - self.label_2.setObjectName("label_2") - self.gridLayout.addWidget(self.label_2, 0, 2, 1, 1) - self.comboEstaca2 = QtWidgets.QComboBox(PerfilTrecho) - self.comboEstaca2.setObjectName("comboEstaca2") - self.comboEstaca2.addItem("") - self.gridLayout.addWidget(self.comboEstaca2, 0, 3, 1, 1) - self.btnCalcular = QtWidgets.QPushButton(PerfilTrecho) - self.btnCalcular.setObjectName("btnCalcular") - self.gridLayout.addWidget(self.btnCalcular, 1, 1, 1, 2) - self.lblTipo = QtWidgets.QLabel(PerfilTrecho) - self.lblTipo.setAlignment(QtCore.Qt.AlignCenter) - self.lblTipo.setObjectName("lblTipo") - self.gridLayout.addWidget(self.lblTipo, 2, 1, 1, 3) - - self.retranslateUi(PerfilTrecho) - QtCore.QMetaObject.connectSlotsByName(PerfilTrecho) - - def retranslateUi(self, PerfilTrecho): - _translate = QtCore.QCoreApplication.translate - PerfilTrecho.setWindowTitle(_translate("PerfilTrecho", "Perfil do trecho")) - self.label.setText(_translate("PerfilTrecho", "Estaca 1")) - self.comboEstaca1.setItemText(0, _translate("PerfilTrecho", "Selecione Estaca Inicial")) - self.label_2.setText(_translate("PerfilTrecho", "Estaca 2")) - self.comboEstaca2.setItemText(0, _translate("PerfilTrecho", "Selecione Estaca Final")) - self.btnCalcular.setText(_translate("PerfilTrecho", "Calcular")) - self.lblTipo.setText(_translate("PerfilTrecho", "Plano")) - - +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'Topo_dialog_perfil.ui' +# +# Created by: PyQt5 UI code generator 5.12.2 +# +# WARNING! All changes made in this file will be lost! + +from PyQt5 import QtCore, QtGui, QtWidgets + + +class Ui_PerfilTrecho(object): + def setupUi(self, PerfilTrecho): + PerfilTrecho.setObjectName("PerfilTrecho") + PerfilTrecho.resize(590, 169) + self.gridLayout = QtWidgets.QGridLayout(PerfilTrecho) + self.gridLayout.setObjectName("gridLayout") + self.label = QtWidgets.QLabel(PerfilTrecho) + self.label.setObjectName("label") + self.gridLayout.addWidget(self.label, 0, 0, 1, 1) + self.comboEstaca1 = QtWidgets.QComboBox(PerfilTrecho) + self.comboEstaca1.setObjectName("comboEstaca1") + self.comboEstaca1.addItem("") + self.gridLayout.addWidget(self.comboEstaca1, 0, 1, 1, 1) + self.label_2 = QtWidgets.QLabel(PerfilTrecho) + self.label_2.setObjectName("label_2") + self.gridLayout.addWidget(self.label_2, 0, 2, 1, 1) + self.comboEstaca2 = QtWidgets.QComboBox(PerfilTrecho) + self.comboEstaca2.setObjectName("comboEstaca2") + self.comboEstaca2.addItem("") + self.gridLayout.addWidget(self.comboEstaca2, 0, 3, 1, 1) + self.btnCalcular = QtWidgets.QPushButton(PerfilTrecho) + self.btnCalcular.setObjectName("btnCalcular") + self.gridLayout.addWidget(self.btnCalcular, 1, 1, 1, 2) + self.lblTipo = QtWidgets.QLabel(PerfilTrecho) + self.lblTipo.setAlignment(QtCore.Qt.AlignCenter) + self.lblTipo.setObjectName("lblTipo") + self.gridLayout.addWidget(self.lblTipo, 2, 1, 1, 3) + + self.retranslateUi(PerfilTrecho) + QtCore.QMetaObject.connectSlotsByName(PerfilTrecho) + + def retranslateUi(self, PerfilTrecho): + _translate = QtCore.QCoreApplication.translate + PerfilTrecho.setWindowTitle(_translate("PerfilTrecho", "Perfil do trecho")) + self.label.setText(_translate("PerfilTrecho", "Estaca 1")) + self.comboEstaca1.setItemText(0, _translate("PerfilTrecho", "Selecione Estaca Inicial")) + self.label_2.setText(_translate("PerfilTrecho", "Estaca 2")) + self.comboEstaca2.setItemText(0, _translate("PerfilTrecho", "Selecione Estaca Final")) + self.btnCalcular.setText(_translate("PerfilTrecho", "Calcular")) + self.lblTipo.setText(_translate("PerfilTrecho", "Plano")) + + diff --git a/app/view/ui/py/applyTransDiag.ui.py b/app/view/ui/py/applyTransDiag.ui.py old mode 100644 new mode 100755 index a9fb916..cf9f7af --- a/app/view/ui/py/applyTransDiag.ui.py +++ b/app/view/ui/py/applyTransDiag.ui.py @@ -1,58 +1,58 @@ -# -*- coding: utf-8 -*- - -# Form implementation generated from reading ui file 'applyTransDiag.ui' -# -# Created by: PyQt5 UI code generator 5.12.2 -# -# WARNING! All changes made in this file will be lost! - -from PyQt5 import QtCore, QtGui, QtWidgets - - -class Ui_Dialog(object): - def setupUi(self, Dialog): - Dialog.setObjectName("Dialog") - Dialog.resize(583, 160) - self.gridLayout = QtWidgets.QGridLayout(Dialog) - self.gridLayout.setObjectName("gridLayout") - self.horizontalLayout = QtWidgets.QHBoxLayout() - self.horizontalLayout.setObjectName("horizontalLayout") - self.verticalLayout_2 = QtWidgets.QVBoxLayout() - self.verticalLayout_2.setObjectName("verticalLayout_2") - self.label_2 = QtWidgets.QLabel(Dialog) - self.label_2.setObjectName("label_2") - self.verticalLayout_2.addWidget(self.label_2) - self.firstCb = QtWidgets.QComboBox(Dialog) - self.firstCb.setObjectName("firstCb") - self.verticalLayout_2.addWidget(self.firstCb) - self.horizontalLayout.addLayout(self.verticalLayout_2) - spacerItem = QtWidgets.QSpacerItem(10, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum) - self.horizontalLayout.addItem(spacerItem) - self.verticalLayout = QtWidgets.QVBoxLayout() - self.verticalLayout.setObjectName("verticalLayout") - self.label = QtWidgets.QLabel(Dialog) - self.label.setObjectName("label") - self.verticalLayout.addWidget(self.label) - self.secondCb = QtWidgets.QComboBox(Dialog) - self.secondCb.setObjectName("secondCb") - self.verticalLayout.addWidget(self.secondCb) - self.horizontalLayout.addLayout(self.verticalLayout) - self.gridLayout.addLayout(self.horizontalLayout, 0, 0, 1, 1) - self.buttonBox = QtWidgets.QDialogButtonBox(Dialog) - self.buttonBox.setOrientation(QtCore.Qt.Horizontal) - self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok) - self.buttonBox.setObjectName("buttonBox") - self.gridLayout.addWidget(self.buttonBox, 1, 0, 1, 1) - - self.retranslateUi(Dialog) - self.buttonBox.accepted.connect(Dialog.accept) - self.buttonBox.rejected.connect(Dialog.reject) - QtCore.QMetaObject.connectSlotsByName(Dialog) - - def retranslateUi(self, Dialog): - _translate = QtCore.QCoreApplication.translate - Dialog.setWindowTitle(_translate("Dialog", "Aplicar seção tipo")) - self.label_2.setText(_translate("Dialog", "Partindo da estaca:")) - self.label.setText(_translate("Dialog", "Até estaca:")) - - +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'applyTransDiag.ui' +# +# Created by: PyQt5 UI code generator 5.12.2 +# +# WARNING! All changes made in this file will be lost! + +from PyQt5 import QtCore, QtGui, QtWidgets + + +class Ui_Dialog(object): + def setupUi(self, Dialog): + Dialog.setObjectName("Dialog") + Dialog.resize(583, 160) + self.gridLayout = QtWidgets.QGridLayout(Dialog) + self.gridLayout.setObjectName("gridLayout") + self.horizontalLayout = QtWidgets.QHBoxLayout() + self.horizontalLayout.setObjectName("horizontalLayout") + self.verticalLayout_2 = QtWidgets.QVBoxLayout() + self.verticalLayout_2.setObjectName("verticalLayout_2") + self.label_2 = QtWidgets.QLabel(Dialog) + self.label_2.setObjectName("label_2") + self.verticalLayout_2.addWidget(self.label_2) + self.firstCb = QtWidgets.QComboBox(Dialog) + self.firstCb.setObjectName("firstCb") + self.verticalLayout_2.addWidget(self.firstCb) + self.horizontalLayout.addLayout(self.verticalLayout_2) + spacerItem = QtWidgets.QSpacerItem(10, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum) + self.horizontalLayout.addItem(spacerItem) + self.verticalLayout = QtWidgets.QVBoxLayout() + self.verticalLayout.setObjectName("verticalLayout") + self.label = QtWidgets.QLabel(Dialog) + self.label.setObjectName("label") + self.verticalLayout.addWidget(self.label) + self.secondCb = QtWidgets.QComboBox(Dialog) + self.secondCb.setObjectName("secondCb") + self.verticalLayout.addWidget(self.secondCb) + self.horizontalLayout.addLayout(self.verticalLayout) + self.gridLayout.addLayout(self.horizontalLayout, 0, 0, 1, 1) + self.buttonBox = QtWidgets.QDialogButtonBox(Dialog) + self.buttonBox.setOrientation(QtCore.Qt.Horizontal) + self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok) + self.buttonBox.setObjectName("buttonBox") + self.gridLayout.addWidget(self.buttonBox, 1, 0, 1, 1) + + self.retranslateUi(Dialog) + self.buttonBox.accepted.connect(Dialog.accept) + self.buttonBox.rejected.connect(Dialog.reject) + QtCore.QMetaObject.connectSlotsByName(Dialog) + + def retranslateUi(self, Dialog): + _translate = QtCore.QCoreApplication.translate + Dialog.setWindowTitle(_translate("Dialog", "Aplicar seção tipo")) + self.label_2.setText(_translate("Dialog", "Partindo da estaca:")) + self.label.setText(_translate("Dialog", "Até estaca:")) + + diff --git a/app/view/ui/py/bruckner_select.ui.py b/app/view/ui/py/bruckner_select.ui.py old mode 100644 new mode 100755 index f279ba5..0922f1d --- a/app/view/ui/py/bruckner_select.ui.py +++ b/app/view/ui/py/bruckner_select.ui.py @@ -1,58 +1,58 @@ -# -*- coding: utf-8 -*- - -# Form implementation generated from reading ui file 'bruckner_select.ui' -# -# Created by: PyQt5 UI code generator 5.12.2 -# -# WARNING! All changes made in this file will be lost! - -from PyQt5 import QtCore, QtGui, QtWidgets - - -class Ui_Dialog(object): - def setupUi(self, Dialog): - Dialog.setObjectName("Dialog") - Dialog.resize(476, 165) - self.gridLayout = QtWidgets.QGridLayout(Dialog) - self.gridLayout.setObjectName("gridLayout") - self.label_3 = QtWidgets.QLabel(Dialog) - self.label_3.setWordWrap(True) - self.label_3.setObjectName("label_3") - self.gridLayout.addWidget(self.label_3, 0, 0, 1, 6) - self.horizontalLayout = QtWidgets.QHBoxLayout() - self.horizontalLayout.setObjectName("horizontalLayout") - self.label = QtWidgets.QLabel(Dialog) - self.label.setObjectName("label") - self.horizontalLayout.addWidget(self.label) - self.inicial = QtWidgets.QComboBox(Dialog) - self.inicial.setObjectName("inicial") - self.horizontalLayout.addWidget(self.inicial) - spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) - self.horizontalLayout.addItem(spacerItem) - self.label_2 = QtWidgets.QLabel(Dialog) - self.label_2.setObjectName("label_2") - self.horizontalLayout.addWidget(self.label_2) - self.final_2 = QtWidgets.QComboBox(Dialog) - self.final_2.setObjectName("final_2") - self.horizontalLayout.addWidget(self.final_2) - self.gridLayout.addLayout(self.horizontalLayout, 2, 0, 1, 5) - self.buttonBox = QtWidgets.QDialogButtonBox(Dialog) - self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok) - self.buttonBox.setObjectName("buttonBox") - self.gridLayout.addWidget(self.buttonBox, 3, 4, 1, 1) - spacerItem1 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) - self.gridLayout.addItem(spacerItem1, 1, 0, 1, 1) - - self.retranslateUi(Dialog) - self.buttonBox.accepted.connect(Dialog.accept) - self.buttonBox.rejected.connect(Dialog.reject) - QtCore.QMetaObject.connectSlotsByName(Dialog) - - def retranslateUi(self, Dialog): - _translate = QtCore.QCoreApplication.translate - Dialog.setWindowTitle(_translate("Dialog", "Intervalo de Estacas")) - self.label_3.setText(_translate("Dialog", "Escolha as estacas de partida e final para criação do Diagrama de Bruckner")) - self.label.setText(_translate("Dialog", "Estaca Inicial:")) - self.label_2.setText(_translate("Dialog", "Estaca Final:")) - - +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'bruckner_select.ui' +# +# Created by: PyQt5 UI code generator 5.12.2 +# +# WARNING! All changes made in this file will be lost! + +from PyQt5 import QtCore, QtGui, QtWidgets + + +class Ui_Dialog(object): + def setupUi(self, Dialog): + Dialog.setObjectName("Dialog") + Dialog.resize(476, 165) + self.gridLayout = QtWidgets.QGridLayout(Dialog) + self.gridLayout.setObjectName("gridLayout") + self.label_3 = QtWidgets.QLabel(Dialog) + self.label_3.setWordWrap(True) + self.label_3.setObjectName("label_3") + self.gridLayout.addWidget(self.label_3, 0, 0, 1, 6) + self.horizontalLayout = QtWidgets.QHBoxLayout() + self.horizontalLayout.setObjectName("horizontalLayout") + self.label = QtWidgets.QLabel(Dialog) + self.label.setObjectName("label") + self.horizontalLayout.addWidget(self.label) + self.inicial = QtWidgets.QComboBox(Dialog) + self.inicial.setObjectName("inicial") + self.horizontalLayout.addWidget(self.inicial) + spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) + self.horizontalLayout.addItem(spacerItem) + self.label_2 = QtWidgets.QLabel(Dialog) + self.label_2.setObjectName("label_2") + self.horizontalLayout.addWidget(self.label_2) + self.final_2 = QtWidgets.QComboBox(Dialog) + self.final_2.setObjectName("final_2") + self.horizontalLayout.addWidget(self.final_2) + self.gridLayout.addLayout(self.horizontalLayout, 2, 0, 1, 5) + self.buttonBox = QtWidgets.QDialogButtonBox(Dialog) + self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok) + self.buttonBox.setObjectName("buttonBox") + self.gridLayout.addWidget(self.buttonBox, 3, 4, 1, 1) + spacerItem1 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) + self.gridLayout.addItem(spacerItem1, 1, 0, 1, 1) + + self.retranslateUi(Dialog) + self.buttonBox.accepted.connect(Dialog.accept) + self.buttonBox.rejected.connect(Dialog.reject) + QtCore.QMetaObject.connectSlotsByName(Dialog) + + def retranslateUi(self, Dialog): + _translate = QtCore.QCoreApplication.translate + Dialog.setWindowTitle(_translate("Dialog", "Intervalo de Estacas")) + self.label_3.setText(_translate("Dialog", "Escolha as estacas de partida e final para criação do Diagrama de Bruckner")) + self.label.setText(_translate("Dialog", "Estaca Inicial:")) + self.label_2.setText(_translate("Dialog", "Estaca Final:")) + + diff --git a/app/view/ui/py/compor_curvas.ui.py b/app/view/ui/py/compor_curvas.ui.py old mode 100644 new mode 100755 index 6b4b245..1b3ab20 --- a/app/view/ui/py/compor_curvas.ui.py +++ b/app/view/ui/py/compor_curvas.ui.py @@ -1,58 +1,58 @@ -# -*- coding: utf-8 -*- - -# Form implementation generated from reading ui file 'compor_curvas.ui' -# -# Created by: PyQt5 UI code generator 5.12.2 -# -# WARNING! All changes made in this file will be lost! - -from PyQt5 import QtCore, QtGui, QtWidgets - - -class Ui_Dialog(object): - def setupUi(self, Dialog): - Dialog.setObjectName("Dialog") - Dialog.resize(613, 626) - Dialog.setMinimumSize(QtCore.QSize(580, 0)) - self.gridLayout = QtWidgets.QGridLayout(Dialog) - self.gridLayout.setObjectName("gridLayout") - self.btnAdd = QtWidgets.QPushButton(Dialog) - self.btnAdd.setObjectName("btnAdd") - self.gridLayout.addWidget(self.btnAdd, 0, 1, 1, 1) - self.comboBox = QtWidgets.QComboBox(Dialog) - self.comboBox.setObjectName("comboBox") - self.comboBox.addItem("") - self.comboBox.addItem("") - self.comboBox.addItem("") - self.comboBox.addItem("") - self.comboBox.addItem("") - self.gridLayout.addWidget(self.comboBox, 0, 0, 1, 1) - spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) - self.gridLayout.addItem(spacerItem, 0, 2, 1, 1) - self.listWidget = QtWidgets.QListWidget(Dialog) - self.listWidget.setObjectName("listWidget") - self.gridLayout.addWidget(self.listWidget, 1, 0, 1, 3) - self.buttonBox = QtWidgets.QDialogButtonBox(Dialog) - self.buttonBox.setOrientation(QtCore.Qt.Horizontal) - self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok) - self.buttonBox.setObjectName("buttonBox") - self.gridLayout.addWidget(self.buttonBox, 2, 2, 1, 1) - - self.retranslateUi(Dialog) - self.buttonBox.accepted.connect(Dialog.accept) - self.buttonBox.rejected.connect(Dialog.reject) - QtCore.QMetaObject.connectSlotsByName(Dialog) - - def retranslateUi(self, Dialog): - _translate = QtCore.QCoreApplication.translate - Dialog.setWindowTitle(_translate("Dialog", "Composição das Curvas")) - self.btnAdd.setWhatsThis(_translate("Dialog", "

Inserir tipo de curva definida a esquerda


")) - self.btnAdd.setText(_translate("Dialog", "Adicionar")) - self.comboBox.setWhatsThis(_translate("Dialog", "

Tipo de curva:

Circular: Curva com Raio Constante

Espiral: Clotóide ou Espiral de Cornu

")) - self.comboBox.setItemText(0, _translate("Dialog", "Circular")) - self.comboBox.setItemText(1, _translate("Dialog", "Circular com Transição Simétrica")) - self.comboBox.setItemText(2, _translate("Dialog", "Tangente")) - self.comboBox.setItemText(3, _translate("Dialog", "Espiral de Entrada")) - self.comboBox.setItemText(4, _translate("Dialog", "Espiral de Saída")) - - +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'compor_curvas.ui' +# +# Created by: PyQt5 UI code generator 5.12.2 +# +# WARNING! All changes made in this file will be lost! + +from PyQt5 import QtCore, QtGui, QtWidgets + + +class Ui_Dialog(object): + def setupUi(self, Dialog): + Dialog.setObjectName("Dialog") + Dialog.resize(613, 626) + Dialog.setMinimumSize(QtCore.QSize(580, 0)) + self.gridLayout = QtWidgets.QGridLayout(Dialog) + self.gridLayout.setObjectName("gridLayout") + self.btnAdd = QtWidgets.QPushButton(Dialog) + self.btnAdd.setObjectName("btnAdd") + self.gridLayout.addWidget(self.btnAdd, 0, 1, 1, 1) + self.comboBox = QtWidgets.QComboBox(Dialog) + self.comboBox.setObjectName("comboBox") + self.comboBox.addItem("") + self.comboBox.addItem("") + self.comboBox.addItem("") + self.comboBox.addItem("") + self.comboBox.addItem("") + self.gridLayout.addWidget(self.comboBox, 0, 0, 1, 1) + spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) + self.gridLayout.addItem(spacerItem, 0, 2, 1, 1) + self.listWidget = QtWidgets.QListWidget(Dialog) + self.listWidget.setObjectName("listWidget") + self.gridLayout.addWidget(self.listWidget, 1, 0, 1, 3) + self.buttonBox = QtWidgets.QDialogButtonBox(Dialog) + self.buttonBox.setOrientation(QtCore.Qt.Horizontal) + self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok) + self.buttonBox.setObjectName("buttonBox") + self.gridLayout.addWidget(self.buttonBox, 2, 2, 1, 1) + + self.retranslateUi(Dialog) + self.buttonBox.accepted.connect(Dialog.accept) + self.buttonBox.rejected.connect(Dialog.reject) + QtCore.QMetaObject.connectSlotsByName(Dialog) + + def retranslateUi(self, Dialog): + _translate = QtCore.QCoreApplication.translate + Dialog.setWindowTitle(_translate("Dialog", "Composição das Curvas")) + self.btnAdd.setWhatsThis(_translate("Dialog", "

Inserir tipo de curva definida a esquerda


")) + self.btnAdd.setText(_translate("Dialog", "Adicionar")) + self.comboBox.setWhatsThis(_translate("Dialog", "

Tipo de curva:

Circular: Curva com Raio Constante

Espiral: Clotóide ou Espiral de Cornu

")) + self.comboBox.setItemText(0, _translate("Dialog", "Circular")) + self.comboBox.setItemText(1, _translate("Dialog", "Circular com Transição Simétrica")) + self.comboBox.setItemText(2, _translate("Dialog", "Tangente")) + self.comboBox.setItemText(3, _translate("Dialog", "Espiral de Entrada")) + self.comboBox.setItemText(4, _translate("Dialog", "Espiral de Saída")) + + diff --git a/app/view/ui/py/curvaWidget.ui.py b/app/view/ui/py/curvaWidget.ui.py old mode 100644 new mode 100755 index 05fca1d..5292807 --- a/app/view/ui/py/curvaWidget.ui.py +++ b/app/view/ui/py/curvaWidget.ui.py @@ -1,154 +1,154 @@ -# -*- coding: utf-8 -*- - -# Form implementation generated from reading ui file 'curvaWidget.ui' -# -# Created by: PyQt5 UI code generator 5.12.2 -# -# WARNING! All changes made in this file will be lost! - -from PyQt5 import QtCore, QtGui, QtWidgets - - -class Ui_Form(object): - def setupUi(self, Form): - Form.setObjectName("Form") - Form.resize(513, 246) - self.gridLayout = QtWidgets.QGridLayout(Form) - self.gridLayout.setObjectName("gridLayout") - self.horizontalLayout = QtWidgets.QHBoxLayout() - self.horizontalLayout.setObjectName("horizontalLayout") - self.label = QtWidgets.QLabel(Form) - self.label.setObjectName("label") - self.horizontalLayout.addWidget(self.label) - self.k = QtWidgets.QLineEdit(Form) - self.k.setEnabled(False) - self.k.setMinimumSize(QtCore.QSize(150, 0)) - self.k.setMaximumSize(QtCore.QSize(150, 16777215)) - self.k.setReadOnly(True) - self.k.setObjectName("k") - self.horizontalLayout.addWidget(self.k) - spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) - self.horizontalLayout.addItem(spacerItem) - spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) - self.horizontalLayout.addItem(spacerItem1) - self.label_2 = QtWidgets.QLabel(Form) - self.label_2.setObjectName("label_2") - self.horizontalLayout.addWidget(self.label_2) - self.vmax = QtWidgets.QLineEdit(Form) - self.vmax.setEnabled(False) - self.vmax.setMinimumSize(QtCore.QSize(150, 0)) - self.vmax.setMaximumSize(QtCore.QSize(150, 16777215)) - self.vmax.setReadOnly(True) - self.vmax.setObjectName("vmax") - self.horizontalLayout.addWidget(self.vmax) - self.gridLayout.addLayout(self.horizontalLayout, 5, 0, 1, 3) - self.horizontalLayout_4 = QtWidgets.QHBoxLayout() - self.horizontalLayout_4.setObjectName("horizontalLayout_4") - spacerItem2 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) - self.horizontalLayout_4.addItem(spacerItem2) - self.nome = QtWidgets.QLabel(Form) - self.nome.setObjectName("nome") - self.horizontalLayout_4.addWidget(self.nome) - spacerItem3 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) - self.horizontalLayout_4.addItem(spacerItem3) - self.pushButton = QtWidgets.QPushButton(Form) - self.pushButton.setObjectName("pushButton") - self.horizontalLayout_4.addWidget(self.pushButton) - self.gridLayout.addLayout(self.horizontalLayout_4, 2, 0, 1, 3) - self.verticalLayout = QtWidgets.QVBoxLayout() - self.verticalLayout.setObjectName("verticalLayout") - self.horizontalLayout_2 = QtWidgets.QHBoxLayout() - self.horizontalLayout_2.setObjectName("horizontalLayout_2") - self.label_3 = QtWidgets.QLabel(Form) - self.label_3.setObjectName("label_3") - self.horizontalLayout_2.addWidget(self.label_3) - self.raio = QtWidgets.QDoubleSpinBox(Form) - self.raio.setDecimals(3) - self.raio.setMaximum(100000.0) - self.raio.setSingleStep(10.0) - self.raio.setProperty("value", 160.0) - self.raio.setObjectName("raio") - self.horizontalLayout_2.addWidget(self.raio) - spacerItem4 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) - self.horizontalLayout_2.addItem(spacerItem4) - self.label_5 = QtWidgets.QLabel(Form) - self.label_5.setObjectName("label_5") - self.horizontalLayout_2.addWidget(self.label_5) - self.deflexao = QtWidgets.QDoubleSpinBox(Form) - self.deflexao.setDecimals(3) - self.deflexao.setMinimum(-180.0) - self.deflexao.setMaximum(180.0) - self.deflexao.setSingleStep(5.0) - self.deflexao.setObjectName("deflexao") - self.horizontalLayout_2.addWidget(self.deflexao) - self.verticalLayout.addLayout(self.horizontalLayout_2) - self.horizontalLayout_3 = QtWidgets.QHBoxLayout() - self.horizontalLayout_3.setObjectName("horizontalLayout_3") - self.label_4 = QtWidgets.QLabel(Form) - self.label_4.setObjectName("label_4") - self.horizontalLayout_3.addWidget(self.label_4) - self.comprimento = QtWidgets.QDoubleSpinBox(Form) - self.comprimento.setDecimals(3) - self.comprimento.setMaximum(1000000.0) - self.comprimento.setSingleStep(10.0) - self.comprimento.setProperty("value", 60.0) - self.comprimento.setObjectName("comprimento") - self.horizontalLayout_3.addWidget(self.comprimento) - spacerItem5 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) - self.horizontalLayout_3.addItem(spacerItem5) - self.label_6 = QtWidgets.QLabel(Form) - self.label_6.setObjectName("label_6") - self.horizontalLayout_3.addWidget(self.label_6) - self.T = QtWidgets.QDoubleSpinBox(Form) - self.T.setDecimals(3) - self.T.setMaximum(100000.0) - self.T.setObjectName("T") - self.horizontalLayout_3.addWidget(self.T) - self.verticalLayout.addLayout(self.horizontalLayout_3) - self.horizontalLayout_5 = QtWidgets.QHBoxLayout() - self.horizontalLayout_5.setObjectName("horizontalLayout_5") - spacerItem6 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) - self.horizontalLayout_5.addItem(spacerItem6) - self.checkBox = QtWidgets.QCheckBox(Form) - self.checkBox.setObjectName("checkBox") - self.horizontalLayout_5.addWidget(self.checkBox) - self.verticalLayout.addLayout(self.horizontalLayout_5) - self.gridLayout.addLayout(self.verticalLayout, 3, 0, 2, 3) - spacerItem7 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) - self.gridLayout.addItem(spacerItem7, 0, 1, 1, 1) - self.line = QtWidgets.QFrame(Form) - self.line.setFrameShape(QtWidgets.QFrame.HLine) - self.line.setFrameShadow(QtWidgets.QFrame.Sunken) - self.line.setObjectName("line") - self.gridLayout.addWidget(self.line, 1, 0, 1, 3) - - self.retranslateUi(Form) - QtCore.QMetaObject.connectSlotsByName(Form) - - def retranslateUi(self, Form): - _translate = QtCore.QCoreApplication.translate - Form.setWindowTitle(_translate("Form", "Form")) - self.label.setWhatsThis(_translate("Form", "

Parâmetro da curva Espiral (K)

")) - self.label.setText(_translate("Form", "Parâmetro: ")) - self.k.setWhatsThis(_translate("Form", "

Parâmetro da curva Espiral (K)

")) - self.k.setText(_translate("Form", "0")) - self.label_2.setWhatsThis(_translate("Form", "

Velocidade Máxima para esse trecho de curva


")) - self.label_2.setText(_translate("Form", "Vmax: ")) - self.vmax.setWhatsThis(_translate("Form", "

Velocidade Máxima para esse trecho de curva


")) - self.vmax.setText(_translate("Form", "0")) - self.nome.setWhatsThis(_translate("Form", "

Tipo de elemento a ser adicionado


")) - self.nome.setText(_translate("Form", "ERRO")) - self.pushButton.setWhatsThis(_translate("Form", "

Remover esse elemento ou curva


")) - self.pushButton.setText(_translate("Form", "Excluir")) - self.label_3.setWhatsThis(_translate("Form", "

Raio da curva

")) - self.label_3.setText(_translate("Form", " Raio : ")) - self.raio.setWhatsThis(_translate("Form", "

Raio da curva

")) - self.label_5.setWhatsThis(_translate("Form", "

Deflexão da curva em graus


")) - self.label_5.setText(_translate("Form", " Deflexão: ")) - self.label_4.setWhatsThis(_translate("Form", "

Desenvolvimento da curva (L)

")) - self.label_4.setText(_translate("Form", "Comprimento: ")) - self.comprimento.setWhatsThis(_translate("Form", "

Desenvolvimento da curva (L)

")) - self.label_6.setText(_translate("Form", "Afastamento:")) - self.checkBox.setText(_translate("Form", "Centralizar")) - - +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'curvaWidget.ui' +# +# Created by: PyQt5 UI code generator 5.12.2 +# +# WARNING! All changes made in this file will be lost! + +from PyQt5 import QtCore, QtGui, QtWidgets + + +class Ui_Form(object): + def setupUi(self, Form): + Form.setObjectName("Form") + Form.resize(513, 246) + self.gridLayout = QtWidgets.QGridLayout(Form) + self.gridLayout.setObjectName("gridLayout") + self.horizontalLayout = QtWidgets.QHBoxLayout() + self.horizontalLayout.setObjectName("horizontalLayout") + self.label = QtWidgets.QLabel(Form) + self.label.setObjectName("label") + self.horizontalLayout.addWidget(self.label) + self.k = QtWidgets.QLineEdit(Form) + self.k.setEnabled(False) + self.k.setMinimumSize(QtCore.QSize(150, 0)) + self.k.setMaximumSize(QtCore.QSize(150, 16777215)) + self.k.setReadOnly(True) + self.k.setObjectName("k") + self.horizontalLayout.addWidget(self.k) + spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) + self.horizontalLayout.addItem(spacerItem) + spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) + self.horizontalLayout.addItem(spacerItem1) + self.label_2 = QtWidgets.QLabel(Form) + self.label_2.setObjectName("label_2") + self.horizontalLayout.addWidget(self.label_2) + self.vmax = QtWidgets.QLineEdit(Form) + self.vmax.setEnabled(False) + self.vmax.setMinimumSize(QtCore.QSize(150, 0)) + self.vmax.setMaximumSize(QtCore.QSize(150, 16777215)) + self.vmax.setReadOnly(True) + self.vmax.setObjectName("vmax") + self.horizontalLayout.addWidget(self.vmax) + self.gridLayout.addLayout(self.horizontalLayout, 5, 0, 1, 3) + self.horizontalLayout_4 = QtWidgets.QHBoxLayout() + self.horizontalLayout_4.setObjectName("horizontalLayout_4") + spacerItem2 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) + self.horizontalLayout_4.addItem(spacerItem2) + self.nome = QtWidgets.QLabel(Form) + self.nome.setObjectName("nome") + self.horizontalLayout_4.addWidget(self.nome) + spacerItem3 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) + self.horizontalLayout_4.addItem(spacerItem3) + self.pushButton = QtWidgets.QPushButton(Form) + self.pushButton.setObjectName("pushButton") + self.horizontalLayout_4.addWidget(self.pushButton) + self.gridLayout.addLayout(self.horizontalLayout_4, 2, 0, 1, 3) + self.verticalLayout = QtWidgets.QVBoxLayout() + self.verticalLayout.setObjectName("verticalLayout") + self.horizontalLayout_2 = QtWidgets.QHBoxLayout() + self.horizontalLayout_2.setObjectName("horizontalLayout_2") + self.label_3 = QtWidgets.QLabel(Form) + self.label_3.setObjectName("label_3") + self.horizontalLayout_2.addWidget(self.label_3) + self.raio = QtWidgets.QDoubleSpinBox(Form) + self.raio.setDecimals(3) + self.raio.setMaximum(100000.0) + self.raio.setSingleStep(10.0) + self.raio.setProperty("value", 160.0) + self.raio.setObjectName("raio") + self.horizontalLayout_2.addWidget(self.raio) + spacerItem4 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) + self.horizontalLayout_2.addItem(spacerItem4) + self.label_5 = QtWidgets.QLabel(Form) + self.label_5.setObjectName("label_5") + self.horizontalLayout_2.addWidget(self.label_5) + self.deflexao = QtWidgets.QDoubleSpinBox(Form) + self.deflexao.setDecimals(3) + self.deflexao.setMinimum(-180.0) + self.deflexao.setMaximum(180.0) + self.deflexao.setSingleStep(5.0) + self.deflexao.setObjectName("deflexao") + self.horizontalLayout_2.addWidget(self.deflexao) + self.verticalLayout.addLayout(self.horizontalLayout_2) + self.horizontalLayout_3 = QtWidgets.QHBoxLayout() + self.horizontalLayout_3.setObjectName("horizontalLayout_3") + self.label_4 = QtWidgets.QLabel(Form) + self.label_4.setObjectName("label_4") + self.horizontalLayout_3.addWidget(self.label_4) + self.comprimento = QtWidgets.QDoubleSpinBox(Form) + self.comprimento.setDecimals(3) + self.comprimento.setMaximum(1000000.0) + self.comprimento.setSingleStep(10.0) + self.comprimento.setProperty("value", 60.0) + self.comprimento.setObjectName("comprimento") + self.horizontalLayout_3.addWidget(self.comprimento) + spacerItem5 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) + self.horizontalLayout_3.addItem(spacerItem5) + self.label_6 = QtWidgets.QLabel(Form) + self.label_6.setObjectName("label_6") + self.horizontalLayout_3.addWidget(self.label_6) + self.T = QtWidgets.QDoubleSpinBox(Form) + self.T.setDecimals(3) + self.T.setMaximum(100000.0) + self.T.setObjectName("T") + self.horizontalLayout_3.addWidget(self.T) + self.verticalLayout.addLayout(self.horizontalLayout_3) + self.horizontalLayout_5 = QtWidgets.QHBoxLayout() + self.horizontalLayout_5.setObjectName("horizontalLayout_5") + spacerItem6 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) + self.horizontalLayout_5.addItem(spacerItem6) + self.checkBox = QtWidgets.QCheckBox(Form) + self.checkBox.setObjectName("checkBox") + self.horizontalLayout_5.addWidget(self.checkBox) + self.verticalLayout.addLayout(self.horizontalLayout_5) + self.gridLayout.addLayout(self.verticalLayout, 3, 0, 2, 3) + spacerItem7 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) + self.gridLayout.addItem(spacerItem7, 0, 1, 1, 1) + self.line = QtWidgets.QFrame(Form) + self.line.setFrameShape(QtWidgets.QFrame.HLine) + self.line.setFrameShadow(QtWidgets.QFrame.Sunken) + self.line.setObjectName("line") + self.gridLayout.addWidget(self.line, 1, 0, 1, 3) + + self.retranslateUi(Form) + QtCore.QMetaObject.connectSlotsByName(Form) + + def retranslateUi(self, Form): + _translate = QtCore.QCoreApplication.translate + Form.setWindowTitle(_translate("Form", "Form")) + self.label.setWhatsThis(_translate("Form", "

Parâmetro da curva Espiral (K)

")) + self.label.setText(_translate("Form", "Parâmetro: ")) + self.k.setWhatsThis(_translate("Form", "

Parâmetro da curva Espiral (K)

")) + self.k.setText(_translate("Form", "0")) + self.label_2.setWhatsThis(_translate("Form", "

Velocidade Máxima para esse trecho de curva


")) + self.label_2.setText(_translate("Form", "Vmax: ")) + self.vmax.setWhatsThis(_translate("Form", "

Velocidade Máxima para esse trecho de curva


")) + self.vmax.setText(_translate("Form", "0")) + self.nome.setWhatsThis(_translate("Form", "

Tipo de elemento a ser adicionado


")) + self.nome.setText(_translate("Form", "ERRO")) + self.pushButton.setWhatsThis(_translate("Form", "

Remover esse elemento ou curva


")) + self.pushButton.setText(_translate("Form", "Excluir")) + self.label_3.setWhatsThis(_translate("Form", "

Raio da curva

")) + self.label_3.setText(_translate("Form", " Raio : ")) + self.raio.setWhatsThis(_translate("Form", "

Raio da curva

")) + self.label_5.setWhatsThis(_translate("Form", "

Deflexão da curva em graus


")) + self.label_5.setText(_translate("Form", " Deflexão: ")) + self.label_4.setWhatsThis(_translate("Form", "

Desenvolvimento da curva (L)

")) + self.label_4.setText(_translate("Form", "Comprimento: ")) + self.comprimento.setWhatsThis(_translate("Form", "

Desenvolvimento da curva (L)

")) + self.label_6.setText(_translate("Form", "Afastamento:")) + self.checkBox.setText(_translate("Form", "Centralizar")) + + diff --git a/app/view/ui/py/progressBarDialog.ui.py b/app/view/ui/py/progressBarDialog.ui.py old mode 100644 new mode 100755 index 1f4f30d..e23b1f8 --- a/app/view/ui/py/progressBarDialog.ui.py +++ b/app/view/ui/py/progressBarDialog.ui.py @@ -1,39 +1,39 @@ -# -*- coding: utf-8 -*- - -# Form implementation generated from reading ui file 'progressBarDialog.ui' -# -# Created by: PyQt5 UI code generator 5.12.2 -# -# WARNING! All changes made in this file will be lost! - -from PyQt5 import QtCore, QtGui, QtWidgets - - -class Ui_Dialog(object): - def setupUi(self, Dialog): - Dialog.setObjectName("Dialog") - Dialog.resize(398, 153) - self.gridLayout = QtWidgets.QGridLayout(Dialog) - self.gridLayout.setObjectName("gridLayout") - self.progressBar = QtWidgets.QProgressBar(Dialog) - self.progressBar.setProperty("value", 0) - self.progressBar.setObjectName("progressBar") - self.gridLayout.addWidget(self.progressBar, 2, 0, 1, 1) - self.label = QtWidgets.QLabel(Dialog) - self.label.setText("") - self.label.setWordWrap(True) - self.label.setObjectName("label") - self.gridLayout.addWidget(self.label, 0, 0, 1, 1) - self.label_2 = QtWidgets.QLabel(Dialog) - self.label_2.setObjectName("label_2") - self.gridLayout.addWidget(self.label_2, 1, 0, 1, 1) - - self.retranslateUi(Dialog) - QtCore.QMetaObject.connectSlotsByName(Dialog) - - def retranslateUi(self, Dialog): - _translate = QtCore.QCoreApplication.translate - Dialog.setWindowTitle(_translate("Dialog", "Aguarde")) - self.label_2.setText(_translate("Dialog", "Por favor aguarde....")) - - +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'progressBarDialog.ui' +# +# Created by: PyQt5 UI code generator 5.12.2 +# +# WARNING! All changes made in this file will be lost! + +from PyQt5 import QtCore, QtGui, QtWidgets + + +class Ui_Dialog(object): + def setupUi(self, Dialog): + Dialog.setObjectName("Dialog") + Dialog.resize(398, 153) + self.gridLayout = QtWidgets.QGridLayout(Dialog) + self.gridLayout.setObjectName("gridLayout") + self.progressBar = QtWidgets.QProgressBar(Dialog) + self.progressBar.setProperty("value", 0) + self.progressBar.setObjectName("progressBar") + self.gridLayout.addWidget(self.progressBar, 2, 0, 1, 1) + self.label = QtWidgets.QLabel(Dialog) + self.label.setText("") + self.label.setWordWrap(True) + self.label.setObjectName("label") + self.gridLayout.addWidget(self.label, 0, 0, 1, 1) + self.label_2 = QtWidgets.QLabel(Dialog) + self.label_2.setObjectName("label_2") + self.gridLayout.addWidget(self.label_2, 1, 0, 1, 1) + + self.retranslateUi(Dialog) + QtCore.QMetaObject.connectSlotsByName(Dialog) + + def retranslateUi(self, Dialog): + _translate = QtCore.QCoreApplication.translate + Dialog.setWindowTitle(_translate("Dialog", "Aguarde")) + self.label_2.setText(_translate("Dialog", "Por favor aguarde....")) + + diff --git a/app/view/ui/py/selectFeature.ui.py b/app/view/ui/py/selectFeature.ui.py old mode 100644 new mode 100755 index 6c04bd9..43d5209 --- a/app/view/ui/py/selectFeature.ui.py +++ b/app/view/ui/py/selectFeature.ui.py @@ -1,51 +1,51 @@ -# -*- coding: utf-8 -*- - -# Form implementation generated from reading ui file 'selectFeature.ui' -# -# Created by: PyQt5 UI code generator 5.12.2 -# -# WARNING! All changes made in this file will be lost! - -from PyQt5 import QtCore, QtGui, QtWidgets - - -class Ui_Dialog(object): - def setupUi(self, Dialog): - Dialog.setObjectName("Dialog") - Dialog.resize(640, 480) - self.gridLayout = QtWidgets.QGridLayout(Dialog) - self.gridLayout.setObjectName("gridLayout") - self.buttonBox = QtWidgets.QDialogButtonBox(Dialog) - self.buttonBox.setOrientation(QtCore.Qt.Horizontal) - self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok) - self.buttonBox.setObjectName("buttonBox") - self.gridLayout.addWidget(self.buttonBox, 5, 0, 1, 1) - self.groupBox = QtWidgets.QGroupBox(Dialog) - self.groupBox.setObjectName("groupBox") - self.gridLayout_2 = QtWidgets.QGridLayout(self.groupBox) - self.gridLayout_2.setObjectName("gridLayout_2") - self.tableWidget = QtWidgets.QTableWidget(self.groupBox) - self.tableWidget.setObjectName("tableWidget") - self.tableWidget.setColumnCount(0) - self.tableWidget.setRowCount(0) - self.gridLayout_2.addWidget(self.tableWidget, 1, 0, 1, 1) - self.gridLayout.addWidget(self.groupBox, 2, 0, 1, 1) - self.checkBox = QtWidgets.QCheckBox(Dialog) - self.checkBox.setChecked(False) - self.checkBox.setObjectName("checkBox") - self.gridLayout.addWidget(self.checkBox, 4, 0, 1, 1) - - self.retranslateUi(Dialog) - self.buttonBox.accepted.connect(Dialog.accept) - self.buttonBox.rejected.connect(Dialog.reject) - QtCore.QMetaObject.connectSlotsByName(Dialog) - - def retranslateUi(self, Dialog): - _translate = QtCore.QCoreApplication.translate - Dialog.setWindowTitle(_translate("Dialog", "Selecionar Linha")) - self.groupBox.setTitle(_translate("Dialog", "Selecione a linha de interesse:")) - self.tableWidget.setWhatsThis(_translate("Dialog", "

Lista de "Features"/Geometrias individuais que estão presentes nessa layer.

Esse diálogo serve para selecionar qual delas será utilizada no cálculo das estacas horizontais.

As linhas estão listadas na ordem em que foram criadas na layer selecionada.

")) - self.checkBox.setWhatsThis(_translate("Dialog", "

Colocar todas as linhas na ordem em que foram criadas

")) - self.checkBox.setText(_translate("Dialog", "Conectar todas as linhas")) - - +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'selectFeature.ui' +# +# Created by: PyQt5 UI code generator 5.12.2 +# +# WARNING! All changes made in this file will be lost! + +from PyQt5 import QtCore, QtGui, QtWidgets + + +class Ui_Dialog(object): + def setupUi(self, Dialog): + Dialog.setObjectName("Dialog") + Dialog.resize(640, 480) + self.gridLayout = QtWidgets.QGridLayout(Dialog) + self.gridLayout.setObjectName("gridLayout") + self.buttonBox = QtWidgets.QDialogButtonBox(Dialog) + self.buttonBox.setOrientation(QtCore.Qt.Horizontal) + self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok) + self.buttonBox.setObjectName("buttonBox") + self.gridLayout.addWidget(self.buttonBox, 5, 0, 1, 1) + self.groupBox = QtWidgets.QGroupBox(Dialog) + self.groupBox.setObjectName("groupBox") + self.gridLayout_2 = QtWidgets.QGridLayout(self.groupBox) + self.gridLayout_2.setObjectName("gridLayout_2") + self.tableWidget = QtWidgets.QTableWidget(self.groupBox) + self.tableWidget.setObjectName("tableWidget") + self.tableWidget.setColumnCount(0) + self.tableWidget.setRowCount(0) + self.gridLayout_2.addWidget(self.tableWidget, 1, 0, 1, 1) + self.gridLayout.addWidget(self.groupBox, 2, 0, 1, 1) + self.checkBox = QtWidgets.QCheckBox(Dialog) + self.checkBox.setChecked(False) + self.checkBox.setObjectName("checkBox") + self.gridLayout.addWidget(self.checkBox, 4, 0, 1, 1) + + self.retranslateUi(Dialog) + self.buttonBox.accepted.connect(Dialog.accept) + self.buttonBox.rejected.connect(Dialog.reject) + QtCore.QMetaObject.connectSlotsByName(Dialog) + + def retranslateUi(self, Dialog): + _translate = QtCore.QCoreApplication.translate + Dialog.setWindowTitle(_translate("Dialog", "Selecionar Linha")) + self.groupBox.setTitle(_translate("Dialog", "Selecione a linha de interesse:")) + self.tableWidget.setWhatsThis(_translate("Dialog", "

Lista de "Features"/Geometrias individuais que estão presentes nessa layer.

Esse diálogo serve para selecionar qual delas será utilizada no cálculo das estacas horizontais.

As linhas estão listadas na ordem em que foram criadas na layer selecionada.

")) + self.checkBox.setWhatsThis(_translate("Dialog", "

Colocar todas as linhas na ordem em que foram criadas

")) + self.checkBox.setText(_translate("Dialog", "Conectar todas as linhas")) + + diff --git a/app/view/ui/py/setEscala.ui.py b/app/view/ui/py/setEscala.ui.py old mode 100644 new mode 100755 index 5d97d33..be818d0 --- a/app/view/ui/py/setEscala.ui.py +++ b/app/view/ui/py/setEscala.ui.py @@ -1,77 +1,77 @@ -# -*- coding: utf-8 -*- - -# Form implementation generated from reading ui file 'setEscala.ui' -# -# Created by: PyQt5 UI code generator 5.12.2 -# -# WARNING! All changes made in this file will be lost! - -from PyQt5 import QtCore, QtGui, QtWidgets - - -class Ui_Dialog(object): - def setupUi(self, Dialog): - Dialog.setObjectName("Dialog") - Dialog.resize(328, 181) - Dialog.setMaximumSize(QtCore.QSize(480, 300)) - self.gridLayout = QtWidgets.QGridLayout(Dialog) - self.gridLayout.setObjectName("gridLayout") - self.buttonBox = QtWidgets.QDialogButtonBox(Dialog) - self.buttonBox.setOrientation(QtCore.Qt.Horizontal) - self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok) - self.buttonBox.setObjectName("buttonBox") - self.gridLayout.addWidget(self.buttonBox, 2, 0, 1, 1) - self.verticalLayout_3 = QtWidgets.QVBoxLayout() - self.verticalLayout_3.setObjectName("verticalLayout_3") - self.horizontalLayout = QtWidgets.QHBoxLayout() - self.horizontalLayout.setObjectName("horizontalLayout") - self.verticalLayout = QtWidgets.QVBoxLayout() - self.verticalLayout.setObjectName("verticalLayout") - self.label = QtWidgets.QLabel(Dialog) - self.label.setObjectName("label") - self.verticalLayout.addWidget(self.label) - self.x = QtWidgets.QDoubleSpinBox(Dialog) - self.x.setMinimum(0.01) - self.x.setMaximum(9999.99) - self.x.setSingleStep(0.1) - self.x.setProperty("value", 1.0) - self.x.setObjectName("x") - self.verticalLayout.addWidget(self.x) - self.horizontalLayout.addLayout(self.verticalLayout) - spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) - self.horizontalLayout.addItem(spacerItem) - self.verticalLayout_2 = QtWidgets.QVBoxLayout() - self.verticalLayout_2.setObjectName("verticalLayout_2") - self.label_2 = QtWidgets.QLabel(Dialog) - self.label_2.setObjectName("label_2") - self.verticalLayout_2.addWidget(self.label_2) - self.y = QtWidgets.QDoubleSpinBox(Dialog) - self.y.setMinimum(0.01) - self.y.setMaximum(9999.99) - self.y.setSingleStep(0.1) - self.y.setProperty("value", 1.0) - self.y.setObjectName("y") - self.verticalLayout_2.addWidget(self.y) - self.horizontalLayout.addLayout(self.verticalLayout_2) - self.verticalLayout_3.addLayout(self.horizontalLayout) - self.zoomBtn = QtWidgets.QPushButton(Dialog) - self.zoomBtn.setObjectName("zoomBtn") - self.verticalLayout_3.addWidget(self.zoomBtn) - self.gridLayout.addLayout(self.verticalLayout_3, 1, 0, 1, 1) - spacerItem1 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) - self.gridLayout.addItem(spacerItem1, 0, 0, 1, 1) - - self.retranslateUi(Dialog) - self.buttonBox.accepted.connect(Dialog.accept) - self.buttonBox.rejected.connect(Dialog.reject) - QtCore.QMetaObject.connectSlotsByName(Dialog) - - def retranslateUi(self, Dialog): - _translate = QtCore.QCoreApplication.translate - Dialog.setWindowTitle(_translate("Dialog", "Escala")) - self.label.setText(_translate("Dialog", "Eixo X")) - self.label_2.setText(_translate("Dialog", "Eixo Y")) - self.zoomBtn.setWhatsThis(_translate("Dialog", "

Enquadra o desenho em toda área disponível

")) - self.zoomBtn.setText(_translate("Dialog", "Restaurar Zoom")) - - +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'setEscala.ui' +# +# Created by: PyQt5 UI code generator 5.12.2 +# +# WARNING! All changes made in this file will be lost! + +from PyQt5 import QtCore, QtGui, QtWidgets + + +class Ui_Dialog(object): + def setupUi(self, Dialog): + Dialog.setObjectName("Dialog") + Dialog.resize(328, 181) + Dialog.setMaximumSize(QtCore.QSize(480, 300)) + self.gridLayout = QtWidgets.QGridLayout(Dialog) + self.gridLayout.setObjectName("gridLayout") + self.buttonBox = QtWidgets.QDialogButtonBox(Dialog) + self.buttonBox.setOrientation(QtCore.Qt.Horizontal) + self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok) + self.buttonBox.setObjectName("buttonBox") + self.gridLayout.addWidget(self.buttonBox, 2, 0, 1, 1) + self.verticalLayout_3 = QtWidgets.QVBoxLayout() + self.verticalLayout_3.setObjectName("verticalLayout_3") + self.horizontalLayout = QtWidgets.QHBoxLayout() + self.horizontalLayout.setObjectName("horizontalLayout") + self.verticalLayout = QtWidgets.QVBoxLayout() + self.verticalLayout.setObjectName("verticalLayout") + self.label = QtWidgets.QLabel(Dialog) + self.label.setObjectName("label") + self.verticalLayout.addWidget(self.label) + self.x = QtWidgets.QDoubleSpinBox(Dialog) + self.x.setMinimum(0.01) + self.x.setMaximum(9999.99) + self.x.setSingleStep(0.1) + self.x.setProperty("value", 1.0) + self.x.setObjectName("x") + self.verticalLayout.addWidget(self.x) + self.horizontalLayout.addLayout(self.verticalLayout) + spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) + self.horizontalLayout.addItem(spacerItem) + self.verticalLayout_2 = QtWidgets.QVBoxLayout() + self.verticalLayout_2.setObjectName("verticalLayout_2") + self.label_2 = QtWidgets.QLabel(Dialog) + self.label_2.setObjectName("label_2") + self.verticalLayout_2.addWidget(self.label_2) + self.y = QtWidgets.QDoubleSpinBox(Dialog) + self.y.setMinimum(0.01) + self.y.setMaximum(9999.99) + self.y.setSingleStep(0.1) + self.y.setProperty("value", 1.0) + self.y.setObjectName("y") + self.verticalLayout_2.addWidget(self.y) + self.horizontalLayout.addLayout(self.verticalLayout_2) + self.verticalLayout_3.addLayout(self.horizontalLayout) + self.zoomBtn = QtWidgets.QPushButton(Dialog) + self.zoomBtn.setObjectName("zoomBtn") + self.verticalLayout_3.addWidget(self.zoomBtn) + self.gridLayout.addLayout(self.verticalLayout_3, 1, 0, 1, 1) + spacerItem1 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) + self.gridLayout.addItem(spacerItem1, 0, 0, 1, 1) + + self.retranslateUi(Dialog) + self.buttonBox.accepted.connect(Dialog.accept) + self.buttonBox.rejected.connect(Dialog.reject) + QtCore.QMetaObject.connectSlotsByName(Dialog) + + def retranslateUi(self, Dialog): + _translate = QtCore.QCoreApplication.translate + Dialog.setWindowTitle(_translate("Dialog", "Escala")) + self.label.setText(_translate("Dialog", "Eixo X")) + self.label_2.setText(_translate("Dialog", "Eixo Y")) + self.zoomBtn.setWhatsThis(_translate("Dialog", "

Enquadra o desenho em toda área disponível

")) + self.zoomBtn.setText(_translate("Dialog", "Restaurar Zoom")) + + diff --git a/app/view/ui/py/setTransPtsIndexes.ui.py b/app/view/ui/py/setTransPtsIndexes.ui.py old mode 100644 new mode 100755 index 0aa903e..14eacf9 --- a/app/view/ui/py/setTransPtsIndexes.ui.py +++ b/app/view/ui/py/setTransPtsIndexes.ui.py @@ -1,60 +1,60 @@ -# -*- coding: utf-8 -*- - -# Form implementation generated from reading ui file 'setTransPtsIndexes.ui' -# -# Created by: PyQt5 UI code generator 5.12.2 -# -# WARNING! All changes made in this file will be lost! - -from PyQt5 import QtCore, QtGui, QtWidgets - - -class Ui_Dialog(object): - def setupUi(self, Dialog): - Dialog.setObjectName("Dialog") - Dialog.resize(583, 160) - self.gridLayout = QtWidgets.QGridLayout(Dialog) - self.gridLayout.setObjectName("gridLayout") - self.horizontalLayout = QtWidgets.QHBoxLayout() - self.horizontalLayout.setObjectName("horizontalLayout") - self.verticalLayout_2 = QtWidgets.QVBoxLayout() - self.verticalLayout_2.setObjectName("verticalLayout_2") - self.label_2 = QtWidgets.QLabel(Dialog) - self.label_2.setObjectName("label_2") - self.verticalLayout_2.addWidget(self.label_2) - self.firstCb = QtWidgets.QComboBox(Dialog) - self.firstCb.setObjectName("firstCb") - self.verticalLayout_2.addWidget(self.firstCb) - self.horizontalLayout.addLayout(self.verticalLayout_2) - spacerItem = QtWidgets.QSpacerItem(10, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum) - self.horizontalLayout.addItem(spacerItem) - self.verticalLayout = QtWidgets.QVBoxLayout() - self.verticalLayout.setObjectName("verticalLayout") - self.label = QtWidgets.QLabel(Dialog) - self.label.setObjectName("label") - self.verticalLayout.addWidget(self.label) - self.secondCb = QtWidgets.QComboBox(Dialog) - self.secondCb.setObjectName("secondCb") - self.verticalLayout.addWidget(self.secondCb) - self.horizontalLayout.addLayout(self.verticalLayout) - self.gridLayout.addLayout(self.horizontalLayout, 0, 0, 1, 1) - self.buttonBox = QtWidgets.QDialogButtonBox(Dialog) - self.buttonBox.setOrientation(QtCore.Qt.Horizontal) - self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok) - self.buttonBox.setObjectName("buttonBox") - self.gridLayout.addWidget(self.buttonBox, 1, 0, 1, 1) - - self.retranslateUi(Dialog) - self.buttonBox.accepted.connect(Dialog.accept) - self.buttonBox.rejected.connect(Dialog.reject) - QtCore.QMetaObject.connectSlotsByName(Dialog) - - def retranslateUi(self, Dialog): - _translate = QtCore.QCoreApplication.translate - Dialog.setWindowTitle(_translate("Dialog", "Pontos de corte e aterro")) - self.label_2.setText(_translate("Dialog", "Aterro (esquerda)")) - self.firstCb.setToolTip(_translate("Dialog", "Número de pontos a se considerar no corte")) - self.label.setText(_translate("Dialog", "Corte (direita)")) - self.secondCb.setToolTip(_translate("Dialog", "Número de pontos a se considerar no aterro")) - - +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'setTransPtsIndexes.ui' +# +# Created by: PyQt5 UI code generator 5.12.2 +# +# WARNING! All changes made in this file will be lost! + +from PyQt5 import QtCore, QtGui, QtWidgets + + +class Ui_Dialog(object): + def setupUi(self, Dialog): + Dialog.setObjectName("Dialog") + Dialog.resize(583, 160) + self.gridLayout = QtWidgets.QGridLayout(Dialog) + self.gridLayout.setObjectName("gridLayout") + self.horizontalLayout = QtWidgets.QHBoxLayout() + self.horizontalLayout.setObjectName("horizontalLayout") + self.verticalLayout_2 = QtWidgets.QVBoxLayout() + self.verticalLayout_2.setObjectName("verticalLayout_2") + self.label_2 = QtWidgets.QLabel(Dialog) + self.label_2.setObjectName("label_2") + self.verticalLayout_2.addWidget(self.label_2) + self.firstCb = QtWidgets.QComboBox(Dialog) + self.firstCb.setObjectName("firstCb") + self.verticalLayout_2.addWidget(self.firstCb) + self.horizontalLayout.addLayout(self.verticalLayout_2) + spacerItem = QtWidgets.QSpacerItem(10, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum) + self.horizontalLayout.addItem(spacerItem) + self.verticalLayout = QtWidgets.QVBoxLayout() + self.verticalLayout.setObjectName("verticalLayout") + self.label = QtWidgets.QLabel(Dialog) + self.label.setObjectName("label") + self.verticalLayout.addWidget(self.label) + self.secondCb = QtWidgets.QComboBox(Dialog) + self.secondCb.setObjectName("secondCb") + self.verticalLayout.addWidget(self.secondCb) + self.horizontalLayout.addLayout(self.verticalLayout) + self.gridLayout.addLayout(self.horizontalLayout, 0, 0, 1, 1) + self.buttonBox = QtWidgets.QDialogButtonBox(Dialog) + self.buttonBox.setOrientation(QtCore.Qt.Horizontal) + self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok) + self.buttonBox.setObjectName("buttonBox") + self.gridLayout.addWidget(self.buttonBox, 1, 0, 1, 1) + + self.retranslateUi(Dialog) + self.buttonBox.accepted.connect(Dialog.accept) + self.buttonBox.rejected.connect(Dialog.reject) + QtCore.QMetaObject.connectSlotsByName(Dialog) + + def retranslateUi(self, Dialog): + _translate = QtCore.QCoreApplication.translate + Dialog.setWindowTitle(_translate("Dialog", "Pontos de corte e aterro")) + self.label_2.setText(_translate("Dialog", "Aterro (esquerda)")) + self.firstCb.setToolTip(_translate("Dialog", "Número de pontos a se considerar no corte")) + self.label.setText(_translate("Dialog", "Corte (direita)")) + self.secondCb.setToolTip(_translate("Dialog", "Número de pontos a se considerar no aterro")) + + diff --git a/app/view/ui/selectFeature.ui b/app/view/ui/selectFeature.ui old mode 100644 new mode 100755 index 4cc3865..7b3b474 --- a/app/view/ui/selectFeature.ui +++ b/app/view/ui/selectFeature.ui @@ -1,93 +1,93 @@ - - - Dialog - - - - 0 - 0 - 998 - 480 - - - - Selecionar Linha - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - <html><head/><body><p>Colocar todas as linhas na ordem em que foram criadas</p></body></html> - - - Conectar todas as linhas - - - false - - - - - - - Selecione a linha de interesse: - - - - - - <html><head/><body><p>Lista de &quot;Features&quot;/Geometrias individuais que estão presentes nessa layer.</p><p>Esse diálogo serve para selecionar qual delas será utilizada no cálculo das estacas horizontais.</p><p>As linhas estão listadas na ordem em que foram criadas na layer selecionada.</p></body></html> - - - - - - - - - - - - buttonBox - accepted() - Dialog - accept() - - - 244 - 435 - - - 157 - 274 - - - - - buttonBox - rejected() - Dialog - reject() - - - 312 - 435 - - - 286 - 274 - - - - - + + + Dialog + + + + 0 + 0 + 998 + 480 + + + + Selecionar Linha + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + <html><head/><body><p>Colocar todas as linhas na ordem em que foram criadas</p></body></html> + + + Conectar todas as linhas + + + false + + + + + + + Selecione a linha de interesse: + + + + + + <html><head/><body><p>Lista de &quot;Features&quot;/Geometrias individuais que estão presentes nessa layer.</p><p>Esse diálogo serve para selecionar qual delas será utilizada no cálculo das estacas horizontais.</p><p>As linhas estão listadas na ordem em que foram criadas na layer selecionada.</p></body></html> + + + + + + + + + + + + buttonBox + accepted() + Dialog + accept() + + + 244 + 435 + + + 157 + 274 + + + + + buttonBox + rejected() + Dialog + reject() + + + 312 + 435 + + + 286 + 274 + + + + + diff --git a/app/view/ui/setEscala.ui b/app/view/ui/setEscala.ui old mode 100644 new mode 100755 index c153ac5..1bd2d0f --- a/app/view/ui/setEscala.ui +++ b/app/view/ui/setEscala.ui @@ -1,171 +1,171 @@ - - - Dialog - - - - 0 - 0 - 328 - 181 - - - - - 480 - 300 - - - - Escala - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - - - - - - Eixo X - - - - - - - 0.010000000000000 - - - 9999.989999999999782 - - - 0.100000000000000 - - - 1.000000000000000 - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - Eixo Y - - - - - - - 0.010000000000000 - - - 9999.989999999999782 - - - 0.100000000000000 - - - 1.000000000000000 - - - - - - - - - - - <html><head/><body><p>Enquadra o desenho em toda área disponível</p></body></html> - - - Restaurar Zoom - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - zoomBtn - - - - - buttonBox - accepted() - Dialog - accept() - - - 248 - 224 - - - 157 - 244 - - - - - buttonBox - rejected() - Dialog - reject() - - - 316 - 230 - - - 286 - 244 - - - - - + + + Dialog + + + + 0 + 0 + 328 + 181 + + + + + 480 + 300 + + + + Escala + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + + + + + Eixo X + + + + + + + 0.010000000000000 + + + 9999.989999999999782 + + + 0.100000000000000 + + + 1.000000000000000 + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Eixo Y + + + + + + + 0.010000000000000 + + + 9999.989999999999782 + + + 0.100000000000000 + + + 1.000000000000000 + + + + + + + + + + + <html><head/><body><p>Enquadra o desenho em toda área disponível</p></body></html> + + + Restaurar Zoom + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + zoomBtn + + + + + buttonBox + accepted() + Dialog + accept() + + + 248 + 224 + + + 157 + 244 + + + + + buttonBox + rejected() + Dialog + reject() + + + 316 + 230 + + + 286 + 244 + + + + + diff --git a/app/view/ui/setTransPtsIndexes.ui b/app/view/ui/setTransPtsIndexes.ui old mode 100644 new mode 100755 index 752d005..5387634 --- a/app/view/ui/setTransPtsIndexes.ui +++ b/app/view/ui/setTransPtsIndexes.ui @@ -1,120 +1,120 @@ - - - Dialog - - - - 0 - 0 - 583 - 162 - - - - Pontos de corte e aterro - - - - - - - - - - Aterro (esquerda) - - - - - - - Número de pontos a se considerar no corte - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Minimum - - - - 10 - 20 - - - - - - - - - - Corte (direita) - - - - - - - Número de pontos a se considerar no aterro - - - - - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - - buttonBox - accepted() - Dialog - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - Dialog - reject() - - - 316 - 260 - - - 286 - 274 - - - - - + + + Dialog + + + + 0 + 0 + 583 + 162 + + + + Pontos de corte e aterro + + + + + + + + + + Aterro (esquerda) + + + + + + + Número de pontos a se considerar no corte + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Minimum + + + + 10 + 20 + + + + + + + + + + Corte (direita) + + + + + + + Número de pontos a se considerar no aterro + + + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + buttonBox + accepted() + Dialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + Dialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/app/view/ui/uiReader.py b/app/view/ui/uiReader.py old mode 100644 new mode 100755 index 6aeb15f..bcd67d2 --- a/app/view/ui/uiReader.py +++ b/app/view/ui/uiReader.py @@ -1,84 +1,84 @@ -# coding: utf-8 -import sys -from PyQt5 import QtWidgets -from PyQt5.QtWidgets import QApplication, QWidget, QInputDialog, QLineEdit, QFileDialog -from PyQt5.QtGui import QIcon - -PATH="src/main/python/ui/" - -def readUi(path): - with open(path,'r') as f: - R=[] - for line in f.readlines(): - l=line.strip() - if l[0:7]=="': - s=l[8:-2] - else: - s=l[8:-1] - s=s.replace('class="','').replace('name="','').split(' ') - cla=s[0][0:-1] - name=s[1][0:-1] - cla.replace('"','') - name.replace('"','') - #print('linstr(e: '+name+" "+cla) - if len(name)!=0 and len(cla)!=0: - R.append("self."+name+" : "+"QtWidgets."+cla) - c='' - R.sort() - for r in R: - print(r) - c+=r+'\n' - - cb = QtWidgets.QApplication.clipboard() - cb.clear(mode=cb.Clipboard ) - cb.setText(c, mode=cb.Clipboard) - return R - - -class QFile(QWidget): - - def __init__(self,app): - super().__init__() - self.title = 'UI FILE' - self.left = 10 - self.top = 10 - self.width = 640 - self.height = 480 - self.app=app - self.initUI() - - def initUI(self): - self.setWindowTitle(self.title) - self.setGeometry(self.left, self.top, self.width, self.height) - self.button=QtWidgets.QPushButton("ui file") - self.button.clicked.connect(self.openFileNameDialog) - self.button.show() - self.openFileNameDialog() - - def openFileNameDialog(self): - options = QFileDialog.Options() - options |= QFileDialog.DontUseNativeDialog - dialog=QFileDialog() - dialog.setDirectory(PATH) - fileName, _ = QFileDialog.getOpenFileName(self,"QFileDialog.getOpenFileName()", "","Designer Files (*.ui);;All Files (*)", options=options) - if fileName: - readUi(fileName) - self.close() - self.app.quit() - - -if __name__ == "__main__": - if len(sys.argv)==1: - app = QtWidgets.QApplication(sys.argv) - win=QFile(app) - sys.exit(app.exec_()) - elif len(sys.argv)>2: - print("Usage: "+str(sys.argv[0])+" + 'file_path'") - sys.exit() - else: - readUi(sys.argv[1]) - - - +# coding: utf-8 +import sys +from PyQt5 import QtWidgets +from PyQt5.QtWidgets import QApplication, QWidget, QInputDialog, QLineEdit, QFileDialog +from PyQt5.QtGui import QIcon + +PATH="src/main/python/ui/" + +def readUi(path): + with open(path,'r') as f: + R=[] + for line in f.readlines(): + l=line.strip() + if l[0:7]=="': + s=l[8:-2] + else: + s=l[8:-1] + s=s.replace('class="','').replace('name="','').split(' ') + cla=s[0][0:-1] + name=s[1][0:-1] + cla.replace('"','') + name.replace('"','') + #print('linstr(e: '+name+" "+cla) + if len(name)!=0 and len(cla)!=0: + R.append("self."+name+" : "+"QtWidgets."+cla) + c='' + R.sort() + for r in R: + print(r) + c+=r+'\n' + + cb = QtWidgets.QApplication.clipboard() + cb.clear(mode=cb.Clipboard ) + cb.setText(c, mode=cb.Clipboard) + return R + + +class QFile(QWidget): + + def __init__(self,app): + super().__init__() + self.title = 'UI FILE' + self.left = 10 + self.top = 10 + self.width = 640 + self.height = 480 + self.app=app + self.initUI() + + def initUI(self): + self.setWindowTitle(self.title) + self.setGeometry(self.left, self.top, self.width, self.height) + self.button=QtWidgets.QPushButton("ui file") + self.button.clicked.connect(self.openFileNameDialog) + self.button.show() + self.openFileNameDialog() + + def openFileNameDialog(self): + options = QFileDialog.Options() + options |= QFileDialog.DontUseNativeDialog + dialog=QFileDialog() + dialog.setDirectory(PATH) + fileName, _ = QFileDialog.getOpenFileName(self,"QFileDialog.getOpenFileName()", "","Designer Files (*.ui);;All Files (*)", options=options) + if fileName: + readUi(fileName) + self.close() + self.app.quit() + + +if __name__ == "__main__": + if len(sys.argv)==1: + app = QtWidgets.QApplication(sys.argv) + win=QFile(app) + sys.exit(app.exec_()) + elif len(sys.argv)>2: + print("Usage: "+str(sys.argv[0])+" + 'file_path'") + sys.exit() + else: + readUi(sys.argv[1]) + + + diff --git a/app/view/ui/volume.ui b/app/view/ui/volume.ui old mode 100644 new mode 100755 index 9f36cce..9a0c38b --- a/app/view/ui/volume.ui +++ b/app/view/ui/volume.ui @@ -1,127 +1,127 @@ - - - Dialog - - - - 0 - 0 - 299 - 172 - - - - Volume - - - - - - Aterro: - - - - - - - true - - - - - - - true - - - - - - - true - - - - - - - Corte: - - - - - - - Soma: - - - - - - - - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - - - - - - - - - - - - - - - - buttonBox - accepted() - Dialog - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - Dialog - reject() - - - 316 - 260 - - - 286 - 274 - - - - - + + + Dialog + + + + 0 + 0 + 299 + 172 + + + + Volume + + + + + + Aterro: + + + + + + + true + + + + + + + true + + + + + + + true + + + + + + + Corte: + + + + + + + Soma: + + + + + + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + + + + + + + + + + + + + + + buttonBox + accepted() + Dialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + Dialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + +