개정판 38eca06a
scale eq ongoing
Change-Id: Iee3463b92d2b6becd9947675617bdfe2f4362442
DTI_PID/DTI_PID/ItemPropertyTableWidget.py | ||
---|---|---|
703 | 703 |
def initContentsCell(self): |
704 | 704 |
from PyQt5 import QtGui |
705 | 705 |
from SymbolAttr import SymbolAttr |
706 |
from EngineeringEquipmentItem import QEngineeringEquipmentItem |
|
706 | 707 |
|
707 | 708 |
try: |
708 | 709 |
if self._item is not None and issubclass(type(self._item), SymbolSvgItem): |
709 |
scaleX = round(self._item.transform().m11() * 100) |
|
710 |
scaleY = round(self._item.transform().m22() * 100) |
|
711 |
scale = str(scaleX / 100.0) + ',' + str(scaleY / 100.0) |
|
710 |
scale = '1.0' |
|
711 |
if type(self._item) is QEngineeringEquipmentItem: |
|
712 |
scaleX = round(self._item.transform().m11() * 100) |
|
713 |
scaleY = round(self._item.transform().m22() * 100) |
|
714 |
scale = str(scaleX / 100.0) + ',' + str(scaleY / 100.0) |
|
715 |
else: |
|
716 |
scale = str(round(self._item.scale(), 2)) |
|
712 | 717 |
|
713 | 718 |
self.setItem(0, 3, QTableWidgetItem(str(self._item.uid))) |
714 | 719 |
self.setItem(1, 3, QTableWidgetItem(self._item.name)) |
DTI_PID/DTI_PID/QtImageViewerScene.py | ||
---|---|---|
233 | 233 |
for symbol in root.find('SYMBOLS').iter('SYMBOL'): |
234 | 234 |
item = SymbolSvgItem.fromXml(symbol) |
235 | 235 |
svg = QtImageViewer.createSymbolObject(item.name) |
236 |
#svg.setScale(item.scale()) |
|
237 |
transform = QTransform().translate(item.symbolOrigin[0], item.symbolOrigin[1]) |
|
238 |
transform.scale(item.transform().m11(), item.transform().m22()) |
|
239 |
transform.translate(-item.symbolOrigin[0], -item.symbolOrigin[1]) |
|
240 |
svg.setTransform(transform) |
|
236 |
if type(item) is QEngineeringEquipmentItem: |
|
237 |
transform = QTransform().translate(item.symbolOrigin[0], item.symbolOrigin[1]) |
|
238 |
transform.scale(item.transform().m11(), item.transform().m22()) |
|
239 |
transform.translate(-item.symbolOrigin[0], -item.symbolOrigin[1]) |
|
240 |
svg.setTransform(transform) |
|
241 |
else: |
|
242 |
svg.setScale(item.scale()) |
|
241 | 243 |
if not delta and not fixedPosition: |
242 | 244 |
delta = origin - QPointF(item.origin[0], item.origin[1]) |
243 | 245 |
delta2 = dxdy - QPointF(item.origin[0], item.origin[1]) |
DTI_PID/DTI_PID/Shapes/SymbolSvgItem.py | ||
---|---|---|
582 | 582 |
def toSql_Components(self): |
583 | 583 |
""" convert Components data to sql query """ |
584 | 584 |
from AppDocData import AppDocData |
585 |
from EngineeringEquipmentItem import QEngineeringEquipmentItem |
|
585 | 586 |
|
586 |
scaleX = round(self.transform().m11() * 100) |
|
587 |
scaleY = round(self.transform().m22() * 100) |
|
588 |
scale = str(scaleX / 100.0) + ',' + str(scaleY / 100.0) |
|
587 |
scale = '1.0' |
|
588 |
if type(self) is QEngineeringEquipmentItem: |
|
589 |
scaleX = round(self.transform().m11() * 100) |
|
590 |
scaleY = round(self.transform().m22() * 100) |
|
591 |
scale = str(scaleX / 100.0) + ',' + str(scaleY / 100.0) |
|
592 |
else: |
|
593 |
scale = str(round(self.scale(), 2)) |
|
589 | 594 |
|
590 | 595 |
cols = ['UID', 'Drawings_UID', 'Symbol_UID', 'X', 'Y', 'Width', 'Height', 'Rotation', 'Area', 'Owner', |
591 | 596 |
'Connected', '[Supplied By]', \ |
... | ... | |
709 | 714 |
''' |
710 | 715 |
|
711 | 716 |
def buildItem(self, name, _type, angle: float, loc, size, origin, connPts, parentSymbol, childSymbol, hasInstrumentLabel, |
712 |
dbUid=None, scale=[1.0, 1.0]):
|
|
717 |
dbUid=None, scale=1.0):
|
|
713 | 718 |
""" |
714 | 719 |
build symbol item |
715 | 720 |
:param name: |
... | ... | |
726 | 731 |
:return: |
727 | 732 |
""" |
728 | 733 |
from SpecialItemTypesDialog import SpecialItemTypes |
734 |
from EngineeringEquipmentItem import QEngineeringEquipmentItem |
|
729 | 735 |
|
730 | 736 |
try: |
731 | 737 |
app_doc_data = AppDocData.instance() |
... | ... | |
750 | 756 |
if convertOriginalPoint: |
751 | 757 |
convertOriginalPoint = convertOriginalPoint.split(',') |
752 | 758 |
self.symbolConvertingOrigin = [float(convertOriginalPoint[0]), float(convertOriginalPoint[1])] |
753 |
#self.setScale(scale)
|
|
754 |
#'''
|
|
755 |
transform = QTransform().translate(self.symbolOrigin[0], self.symbolOrigin[1])
|
|
756 |
transform.scale(scale[0], scale[1])
|
|
757 |
transform.translate(-self.symbolOrigin[0], -self.symbolOrigin[1])
|
|
758 |
self.setTransform(transform)
|
|
759 |
#'''
|
|
759 |
if type(self) is QEngineeringEquipmentItem:
|
|
760 |
transform = QTransform().translate(self.symbolOrigin[0], self.symbolOrigin[1])
|
|
761 |
transform.scale(scale[0], scale[1])
|
|
762 |
transform.translate(-self.symbolOrigin[0], -self.symbolOrigin[1])
|
|
763 |
self.setTransform(transform)
|
|
764 |
else:
|
|
765 |
self.setScale(scale)
|
|
760 | 766 |
|
761 | 767 |
# setting connectors |
762 | 768 |
connectionPoints = symbolInfo.getConnectionPoint().split('/') |
... | ... | |
1857 | 1863 |
""" |
1858 | 1864 |
from xml.etree.ElementTree import Element, SubElement, dump, ElementTree |
1859 | 1865 |
from SymbolAttr import SymbolAttr |
1866 |
from EngineeringEquipmentItem import QEngineeringEquipmentItem |
|
1860 | 1867 |
|
1861 | 1868 |
try: |
1862 | 1869 |
node = Element('SYMBOL') |
... | ... | |
1939 | 1946 |
node.append(angleNode) |
1940 | 1947 |
|
1941 | 1948 |
scaleNode = Element('SCALE') |
1942 |
scaleX = round(self.transform().m11() * 100) |
|
1943 |
scaleY = round(self.transform().m22() * 100) |
|
1944 |
scaleNode.text = str(scaleX / 100.0) + ',' + str(scaleY / 100.0) |
|
1945 |
#scaleNode.text = str(round(self.scale(), 2)) |
|
1949 |
if type(self) is QEngineeringEquipmentItem: |
|
1950 |
scaleX = round(self.transform().m11() * 100) |
|
1951 |
scaleY = round(self.transform().m22() * 100) |
|
1952 |
scaleNode.text = str(scaleX / 100.0) + ',' + str(scaleY / 100.0) |
|
1953 |
else: |
|
1954 |
scaleNode.text = str(round(self.scale(), 2)) |
|
1946 | 1955 |
node.append(scaleNode) |
1947 | 1956 |
|
1948 | 1957 |
parentSymbolNode = Element('PARENT') |
... | ... | |
2010 | 2019 |
import uuid |
2011 | 2020 |
from EngineeringSpecBreakItem import QEngineeringSpecBreakItem |
2012 | 2021 |
from EngineeringEndBreakItem import QEngineeringEndBreakItem |
2022 |
from EngineeringEquipmentItem import QEngineeringEquipmentItem |
|
2013 | 2023 |
from SymbolAttr import SymbolAttr |
2014 | 2024 |
item = None |
2015 | 2025 |
|
... | ... | |
2032 | 2042 |
name = dbData.sName |
2033 | 2043 |
_type = dbData.sType |
2034 | 2044 |
angle = float(component['Rotation']) |
2035 |
scale = [1.0, 1.0] |
|
2036 |
if component['Value']: |
|
2037 |
if ',' in component['Value']: |
|
2038 |
scale = [float(component['Value'].split(',')[0]), float(component['Value'].split(',')[1])] |
|
2039 |
else: |
|
2040 |
scale = [float(component['Value']), float(component['Value'])] |
|
2041 | 2045 |
|
2042 | 2046 |
origin = [float(x) for x in component['SceneOriginPoint'].split(',')] if component['SceneOriginPoint'] is not None else pt |
2043 | 2047 |
if grid == 1: |
... | ... | |
2077 | 2081 |
item = SymbolSvgItem.createItem(_type, name, svgFilePath, uid, owner=owner, flip=flipLabel) |
2078 | 2082 |
item.setVisible(False) |
2079 | 2083 |
|
2084 |
scale = None |
|
2085 |
if type(item) is QEngineeringEquipmentItem: |
|
2086 |
scale = [1.0, 1.0] |
|
2087 |
if component['Value']: |
|
2088 |
if ',' in component['Value']: |
|
2089 |
scale = [float(component['Value'].split(',')[0]), float(component['Value'].split(',')[1])] |
|
2090 |
else: |
|
2091 |
scale = [float(component['Value']), float(component['Value'])] |
|
2092 |
else: |
|
2093 |
scale = float(component['Value']) if component['Value'] else 1.0 |
|
2094 |
|
|
2080 | 2095 |
# if additional symbol was changed, change symbol info |
2081 | 2096 |
symbolInfo = None |
2082 | 2097 |
if dbUid is None: |
... | ... | |
2178 | 2193 |
import uuid |
2179 | 2194 |
from EngineeringSpecBreakItem import QEngineeringSpecBreakItem |
2180 | 2195 |
from EngineeringEndBreakItem import QEngineeringEndBreakItem |
2196 |
from EngineeringEquipmentItem import QEngineeringEquipmentItem |
|
2181 | 2197 |
from SymbolAttr import SymbolAttr |
2182 | 2198 |
item = None |
2183 | 2199 |
|
... | ... | |
2240 | 2256 |
ratioNode = node.find('RATIO') |
2241 | 2257 |
hit_ratio = float(ratioNode.text) if ratioNode is not None else None |
2242 | 2258 |
|
2243 |
scaleNode = node.find('SCALE') |
|
2244 |
scale = [1.0, 1.0] |
|
2245 |
if scaleNode is not None and scaleNode.text: |
|
2246 |
if ',' in scaleNode.text: |
|
2247 |
scale = [float(scaleNode.text.split(',')[0]), float(scaleNode.text.split(',')[1])] |
|
2248 |
else: |
|
2249 |
scale = [float(scaleNode.text), float(scaleNode.text)] |
|
2250 |
|
|
2251 | 2259 |
project = appDocData.getCurrentProject() |
2252 | 2260 |
svgFilePath = os.path.join(project.getSvgFilePath(), _type, name + '.svg') |
2253 | 2261 |
if os.path.isfile(svgFilePath): |
2254 | 2262 |
item = SymbolSvgItem.createItem(_type, name, svgFilePath, uid, owner=owner, flip=flipLabel) |
2255 | 2263 |
item.setVisible(False) |
2256 | 2264 |
|
2265 |
scaleNode = node.find('SCALE') |
|
2266 |
scale = None |
|
2267 |
if type(item) is QEngineeringEquipmentItem: |
|
2268 |
scale = [1.0, 1.0] |
|
2269 |
if scaleNode is not None and scaleNode.text: |
|
2270 |
if ',' in scaleNode.text: |
|
2271 |
scale = [float(scaleNode.text.split(',')[0]), float(scaleNode.text.split(',')[1])] |
|
2272 |
else: |
|
2273 |
scale = [float(scaleNode.text), float(scaleNode.text)] |
|
2274 |
else: |
|
2275 |
scale = float(scaleNode.text) if scaleNode is not None else 1.0 |
|
2276 |
|
|
2257 | 2277 |
# if additional symbol was changed, change symbol info |
2258 | 2278 |
symbolInfo = None |
2259 | 2279 |
if dbUid is None: |
내보내기 Unified diff