summaryrefslogtreecommitdiff
path: root/src/main/python/shapes
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/python/shapes')
-rw-r--r--src/main/python/shapes/line.py37
-rw-r--r--src/main/python/shapes/rLGPlus.txt41
-rw-r--r--src/main/python/shapes/shapes.py38
3 files changed, 116 insertions, 0 deletions
diff --git a/src/main/python/shapes/line.py b/src/main/python/shapes/line.py
index 856869d..4e5271a 100644
--- a/src/main/python/shapes/line.py
+++ b/src/main/python/shapes/line.py
@@ -5,6 +5,18 @@ from PyQt5.QtCore import Qt, QPointF, QRectF, QLineF, pyqtSignal
from collections import defaultdict
+#For extending Lines for repositioned Rectangular Line Grips
+rLGPlus = {}
+f = open('./shapes/rLGPlus.txt','r')
+dataRead = f.readlines()[1:]
+for line in dataRead:
+
+ if not line.__contains__(',') :
+ rLGPlus[line.strip()] = []
+ else:
+ grips = line.strip().split(',')
+ rLGPlus[list(rLGPlus.keys())[-1]].append(grips)
+
class Grabber(QGraphicsPathItem):
"""
Extends QGraphicsPathItem to create grabber for line for moving a particular segment
@@ -796,6 +808,31 @@ class Line(QGraphicsPathItem):
def updatePath(self):
""" update path when svg item moves
"""
+ #Adjusting line for repositioned retangular grips
+ if self.startGripItem.parentItem().__class__.__name__ in list(rLGPlus.keys()):
+ for tgrip in rLGPlus[self.startGripItem.parentItem().__class__.__name__]:
+ if(float(tgrip[3]) == 0):
+ if self.startGripItem.m_location == tgrip[0]:
+ tempx,tempy = int(tgrip[1]),int(tgrip[2])
+ self.startPoint.setX(self.startPoint.x()+tempx)
+ self.startPoint.setY(self.startPoint.y()+tempy)
+ else:
+ if self.startGripItem.m_location == tgrip[0] and self.startGripItem.size == float(tgrip[3]):
+ tempx,tempy = int(tgrip[1]),int(tgrip[2])
+ self.startPoint.setX(self.startPoint.x()+tempx)
+ self.startPoint.setY(self.startPoint.y()+tempy)
+ if self.endGripItem.parentItem().__class__.__name__ in list(rLGPlus.keys()):
+ for tgrip in rLGPlus[self.endGripItem.parentItem().__class__.__name__]:
+ if(float(tgrip[3]) == 0):
+ if self.endGripItem.m_location == tgrip[0]:
+ tempx,tempy = int(tgrip[1]),int(tgrip[2])
+ self.endPoint.setX(self.endPoint.x()+tempx)
+ self.endPoint.setY(self.endPoint.y()+tempy)
+ else:
+ if self.endGripItem.m_location == tgrip[0] and self.endGripItems.size == float(tgrip[3]):
+ tempx,tempy = int(tgrip[1]),int(tgrip[2])
+ self.endPoint.setX(self.endPoint.x()+tempx)
+ self.endPoint.setY(self.endPoint.y()+tempy)
path = QPainterPath(self.startPoint)
self.updatePoints()
diff --git a/src/main/python/shapes/rLGPlus.txt b/src/main/python/shapes/rLGPlus.txt
new file mode 100644
index 0000000..4cf8534
--- /dev/null
+++ b/src/main/python/shapes/rLGPlus.txt
@@ -0,0 +1,41 @@
+#Contains data of the distance rectangular line grips were extended className:direction,x,y,width
+OilGasOrPulverizedFuelFurnace
+left,5,0,0
+right,-5,0,0
+bottom,0,-10,0
+SolidFuelFurnace
+left,5,0,0
+right,-5,0,0
+bottom,0,-10,0
+HorizontalVessel
+top,0,10,0
+bottom,0,-10,0
+PackedVessel
+left,10,0,0
+right,-10,0,0
+VerticalVessel
+left,10,0,0
+right,-10,0,0
+FixedRoofTank
+left,6,0,0
+right,-7,0,0
+bottom,0,-10,0
+FloatingRoofTank
+left,7,0,0
+right,-7,0,0
+bottom,0,-10,0
+SeparatorsForLiquidsDecanter
+top,0,10,0
+left,10,0,0
+right,-10,0,0
+bottom,0,-10,0
+OneCellFiredHeaterFurnace
+left,7,0,50
+right,-7,0,50
+bottom,0,-10,0
+TwoCellFiredHeaterFurnace
+left,5,0,66.66
+right,-5,0,66.66
+bottom,0,-10,33.33
+ContinuousDryer
+top,0,10,0 \ No newline at end of file
diff --git a/src/main/python/shapes/shapes.py b/src/main/python/shapes/shapes.py
index 20b17ad..20ca4a8 100644
--- a/src/main/python/shapes/shapes.py
+++ b/src/main/python/shapes/shapes.py
@@ -26,6 +26,18 @@ orientationEnum = [
Qt.Vertical
]
+#For extending Lines for repositioned Rectangular Line Grips
+rLGPlus = {}
+f = open('./shapes/rLGPlus.txt','r')
+dataRead = f.readlines()[1:]
+for line in dataRead:
+
+ if not line.__contains__(',') :
+ rLGPlus[line.strip()] = []
+ else:
+ grips = line.strip().split(',')
+ rLGPlus[list(rLGPlus.keys())[-1]].append(grips)
+
class ItemLabel(QGraphicsTextItem):
"""Extends PyQt5's QGraphicsPathItem to create text label for svg item
"""
@@ -409,6 +421,32 @@ class LineGripItem(QGraphicsPathItem):
if self.tempLine.startGripItem.parentItem() != self.tempLine.endGripItem.parentItem():
# update line with end point so it sets final path
self.tempLine.updateLine(endPoint=endPoint)
+ #Adjusting line for repositioned retangular grips
+ if self.parentItem().__class__.__name__ in list(rLGPlus.keys()):
+ for tgrip in rLGPlus[self.parentItem().__class__.__name__]:
+ if(float(tgrip[3]) == 0):
+ if self.m_location == tgrip[0]:
+ tempx,tempy = int(tgrip[1]),int(tgrip[2])
+ self.tempLine.startPoint.setX(self.tempLine.startPoint.x()+tempx)
+ self.tempLine.startPoint.setY(self.tempLine.startPoint.y()+tempy)
+ else:
+ if self.m_location == tgrip[0] and self.size == float(tgrip[3]):
+ tempx,tempy = int(tgrip[1]),int(tgrip[2])
+ self.tempLine.startPoint.setX(self.tempLine.startPoint.x()+tempx)
+ self.tempLine.startPoint.setY(self.tempLine.startPoint.y()+tempy)
+ if item.parentItem().__class__.__name__ in list(rLGPlus.keys()):
+ for tgrip in rLGPlus[item.parentItem().__class__.__name__]:
+ if(float(tgrip[3]) == 0):
+ if item.m_location == tgrip[0]:
+ tempx,tempy = int(tgrip[1]),int(tgrip[2])
+ self.tempLine.endPoint.setX(self.tempLine.endPoint.x()+tempx)
+ self.tempLine.endPoint.setY(self.tempLine.endPoint.y()+tempy)
+ else:
+ if item.m_location == tgrip[0] and item.size == float(tgrip[3]):
+ tempx,tempy = int(tgrip[1]),int(tgrip[2])
+ self.tempLine.endPoint.setX(self.tempLine.endPoint.x()+tempx)
+ self.tempLine.endPoint.setY(self.tempLine.endPoint.y()+tempy)
+
self.lines.append(self.tempLine)
item.lines.append(self.tempLine)
tag = 1