프로젝트

일반

사용자정보

개정판 1b261371

ID1b2613713d7e2dafeeb19c0a4a7cc8ba33e1551e
상위 5dfb8a24
하위 7af9b30c

gaqhf 이(가) 5년 이상 전에 추가함

dev issue #000 : 심볼 위치 보정 로직 추가

Change-Id: I0ac14a43b656372028ca1e74abab90e866a0723e

차이점 보기:

DTI_PID/BaseModel/Model/SPPID/SPPIDSymbolInfo.cs
9 9
    public class SPPIDSymbolInfo
10 10
    {
11 11
        public string MAPPINGNAME { get; set; }
12
        public double LOCATION_X { get; set; }
13
        public double LOCATION_Y { get; set; }
12
        public double ORIGINAL_X { get; set; }
13
        public double ORIGINAL_Y { get; set; }
14 14
        public object ITEMOBJECT { get; set; }
15 15
    }
16 16
}
DTI_PID/SPPIDConverter/AutoModeling.cs
44 44
                {
45 45
                    // Run 별로 Modeling
46 46
                    Symbol prevSymbol = null;
47
                    object prevItem = null;
48
                    foreach (object item in run.RUNITEMS)
47
                    // Symbol 먼저
48
                    foreach (var item in run.RUNITEMS)
49 49
                    {
50 50
                        if (item.GetType() == typeof(Symbol))
51 51
                        {
52 52
                            Symbol symbol = item as Symbol;
53 53
                            SymbolModeling(symbol, prevSymbol);
54
                            //// 바로 전 아이템이 Symbol
55
                            //if (prevItem != null && prevItem.GetType() == typeof(Symbol))
56
                            //{
57

  
58
                            //}
59
                            //// 바로 전 아이템 Line 예전 Item 이 Symbol
60
                            //else if (prevItem != null && prevSymbol != null)
61
                            //{
62

  
63
                            //}
64 54
                            prevSymbol = symbol;
65 55
                        }
66
                        else if (item.GetType() == typeof(Line))
56
                    }
57

  
58
                    object prevItem = null;
59
                    prevSymbol = null;
60
                    foreach (var item in run.RUNITEMS)
61
                    {
62
                        if (item.GetType() == typeof(Line))
67 63
                        {
68
                            Line line = item as Line;
69
                            LineModeling(item as Line);
64
                            
70 65
                        }
71 66

  
72 67
                        prevItem = item;
73 68
                    }
74 69

  
75 70

  
76

  
77 71
                }
78 72
            }
79 73

  
......
82 76
            System.Windows.Forms.MessageBox.Show("end");
83 77
        }
84 78

  
79

  
85 80
        private void TestSource()
86 81
        {
87 82

  
......
92 87
            LMSymbol _LMSymbol = null;
93 88

  
94 89
            string mappingPath = symbol.SPPID.MAPPINGNAME;
95
            double x = symbol.SPPID.LOCATION_X;
96
            double y = symbol.SPPID.LOCATION_Y;
90
            double x = symbol.SPPID.ORIGINAL_X;
91
            double y = symbol.SPPID.ORIGINAL_Y;
97 92
            int mirror = 0;
98 93
            double angle = symbol.ANGLE;
99 94
            LMSymbol _TargetItem = null;
100 95

  
101 96
            if (prevSymbol != null)
102 97
            {
103
                SlopeType slopeType = SPPIDUtil.CalcSlope(symbol.SPPID.LOCATION_X, symbol.SPPID.LOCATION_Y, prevSymbol.SPPID.LOCATION_X, prevSymbol.SPPID.LOCATION_Y);
98
                SlopeType slopeType = SPPIDUtil.CalcSlope(x, y, prevSymbol.SPPID.ORIGINAL_X, prevSymbol.SPPID.ORIGINAL_Y);
99
                LMADataSource dataSource = _placement.PIDDataSource;
100
                LMSymbol prevLMSymbol = dataSource.GetSymbol(prevSymbol.SPPID.ITEMOBJECT);
101
                double prevX = prevLMSymbol.get_XCoordinate();
102
                double prevY = prevLMSymbol.get_YCoordinate();
104 103
                if (slopeType == SlopeType.HORIZONTAL)
105
                {
106

  
107
                }
104
                    y = prevY;
108 105
                else if (slopeType == SlopeType.VERTICAL)
109
                {
106
                    x = prevX;
110 107

  
111
                }
112 108
            }
113 109
            else
114 110
            {
......
125 121

  
126 122
            if (_LMSymbol != null)
127 123
            {
128

  
124
                symbol.SPPID.ITEMOBJECT = _LMSymbol.AsLMRepresentation().Id;
129 125
            }
130 126

  
131 127
            ReleaseCOMObjects(_LMSymbol);
......
147 143
            ReleaseCOMObjects(_LMAItem);
148 144
        }
149 145

  
146
        private void LineModeling(List<Line> lines)
147
        {
148
            object DrwingID = "0";
149
            _LMAItem _LMAItem = _placement.PIDCreateItem(lines[0].SPPID.MAPPINGNAME, ref DrwingID);
150
            PlaceRunInputs placeRunInputs = new PlaceRunInputs();
151
            for (int i = 0; i < lines.Count; i++)
152
            {
153
                Line line = lines[i];
154
                placeRunInputs.AddPoint(line.SPPID.START_X, line.SPPID.START_Y);
155
                placeRunInputs.AddPoint(line.SPPID.END_X, line.SPPID.END_Y);
156
            }
157
            
158

  
159
            LMConnector lMConnector = _placement.PIDPlaceRun(_LMAItem, placeRunInputs);
160
            lMConnector.Commit();
161

  
162
            ReleaseCOMObjects(lMConnector);
163
            ReleaseCOMObjects(placeRunInputs);
164
            ReleaseCOMObjects(_LMAItem);
165
        }
166

  
150 167
        private void LineNumberModeling(LineNumber lineNumber)
151 168
        {
152 169

  
DTI_PID/SPPIDConverter/Model/SPPID_Document.cs
39 39
                    item.SPPID = new SPPIDSymbolInfo();
40 40
                double x = double.NaN;
41 41
                double y = double.NaN;
42
                SPPIDUtil.ConvertPointBystring(item.LOCATION, ref x, ref y);
42
                SPPIDUtil.ConvertPointBystring(item.ORIGINALPOINT, ref x, ref y);
43 43
                SPPIDUtil.ConvertSPPIDPoint(ref x, ref y, SIZE_WIDTH, SIZE_HEIGHT, testX, testY);
44
                item.SPPID.LOCATION_X = x;
45
                item.SPPID.LOCATION_Y = y;
44
                item.SPPID.ORIGINAL_X = x;
45
                item.SPPID.ORIGINAL_Y = y;
46 46
            }
47 47

  
48 48
            foreach (var item in LINES)
DTI_PID/SPPIDConverter/Util/SPPIDUtil.cs
95 95

  
96 96
        public static void ConvertSPPIDPoint(ref double dX, ref double dY, double dDwgX, double dDwgY, double SPPID_Width, double SPPID_Height)
97 97
        {
98
            double calcX = 0;
99
            double calcY = 0;
100
            calcX = (dX * SPPID_Width) / dDwgX;
98
            decimal calcX = 0;
99
            decimal calcY = 0;
100
            decimal tempX = Convert.ToDecimal(dX);
101
            decimal tempY = Convert.ToDecimal(dY);
102
            decimal tempWidth = Convert.ToDecimal(SPPID_Width);
103
            decimal tempHeight = Convert.ToDecimal(SPPID_Height);
104
            decimal tempDwgX = Convert.ToDecimal(dDwgX);
105
            decimal tempDwgY = Convert.ToDecimal(dDwgY);
106

  
107
            calcX = (tempX * tempWidth) / tempDwgX;
101 108
            calcX = Math.Truncate(calcX * 1000) / 1000;
102
            calcY = SPPID_Height - ((dY * SPPID_Height) / dDwgY);
109
            calcY = tempHeight - ((tempY * tempHeight) / tempDwgY);
103 110
            calcY = Math.Truncate(calcY * 1000) / 1000;
104
            dX = calcX;
105
            dY = calcY;
111
            dX = Convert.ToDouble(calcX);
112
            dY = Convert.ToDouble(calcY);
106 113
        }
107 114

  
108 115
        public static SlopeType CalcSlope(double x1, double y1, double x2, double y2)
......
114 121
            else
115 122
            {
116 123
                double angle = Math.Atan(Math.Abs(y2 - y1) / Math.Abs(x2 - x1)) * 180 / Math.PI;
117
                if (angle < 20)
124
                if (angle < 5)
118 125
                    return SlopeType.HORIZONTAL;
119
                else if (angle > 70)
126
                else if (angle > 85)
120 127
                    return SlopeType.VERTICAL;
121 128
                else
122 129
                    return SlopeType.Slope;

내보내기 Unified diff

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