프로젝트

일반

사용자정보

개정판 0636e3bb

ID0636e3bbced6e15c7ca48e2952209335b0ca34e8
상위 fdbfccef
하위 1ef48bfa

이윤호이(가) 4년 이상 전에 추가함

mm 만 변경 함 / 단위 변환 하는거 잘못쓰면 문제 되서 클래스 삭제

Change-Id: I04ce399794c9e54c6985517576c62a0339223a7c

차이점 보기:

DTI_PID/DTI_PID/DEXPI/ConvertToUnit.py
1
# coding: utf-8
2
""" This is Extent module """
3

  
4

  
5
class ConvertToUnit:
6
    def __init__(self):
7
        pass
8

  
9
    def pixel_to_mm(p_pixel: int):
10
        """https://mainia.tistory.com/4620"""
11
        DIP = 96
12
        value = p_pixel * 2.54 / DIP
13

  
14
        str_value = "0"
15

  
16
        
17

  
18
        if value == 0:
19
            str_value = str(0)
20
        else:
21
            str_value = str(value)
22

  
23
        return str_value
DTI_PID/DTI_PID/DEXPI/Extent.py
5 5
from PyQt5.QtWidgets import *
6 6
from SymbolSvgItem import SymbolSvgItem
7 7

  
8
from .ConvertToUnit import ConvertToUnit
9

  
10 8
class Extent:
11 9
    def __init__(self):
12 10
        pass
......
23 21
            rect = scene.itemsBoundingRect()
24 22

  
25 23
        _min = SubElement(_node, 'Min')
26
        _min_X = int(rect.left())
27
        _min_Y = int(rect.top())
28
        _min.attrib['X'] = ConvertToUnit.pixel_to_mm(_min_X)
29
        _min.attrib['Y'] = ConvertToUnit.pixel_to_mm(_min_Y)
24
        _min.attrib['X'] = str(rect.left())
25
        _min.attrib['Y'] = str(rect.top())
30 26
        _min.attrib['Z'] = '0'
31 27
        _max = SubElement(_node, 'Max')
32
        _max_X = int(rect.right())
33
        _max_Y = int(rect.bottom())
34
        _max.attrib['X'] = ConvertToUnit.pixel_to_mm(_max_X)
35
        _max.attrib['Y'] = ConvertToUnit.pixel_to_mm(_max_Y)
28
        _max.attrib['X'] =  str(rect.right())
29
        _max.attrib['Y'] = str(rect.bottom())
36 30
        _max.attrib['Z'] = '0'
37 31

  
38 32
        return _node
DTI_PID/DTI_PID/DEXPI/formatter.py
11 11
from .Extent import Extent
12 12
from .ShapeCatalogue import ShapeCatalogue
13 13
from .Equipment import Equipment
14
from .ConvertToUnit import ConvertToUnit
15 14

  
16 15
sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)), '..\\Shapes'))
17 16

  

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)