프로젝트

일반

사용자정보

개정판 1ba9c671

ID1ba9c671e25b6ad1cb042056bfe5e6a5abcda91d
상위 f7df92c0
하위 8a5ac6a1, 1f1b3a40

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

dev issue #000 : 도면 사이즈 적용 및 Attribute Label LeaderLine 적용

Change-Id: I991272aa8a7acbbf49edf23db5ac7737cee3828b

차이점 보기:

DTI_PID/SPPIDConverter/AutoModeling.cs
27 27
    {
28 28
        Placement _placement;
29 29
        LMADataSource dataSource;
30
        dynamic newDrawing;
30 31
        dynamic application;
31 32
        Ingr.RAD2D.Application radApp;
32 33
        SPPID_Document document;
......
41 42
            this._ETCSetting = ETCSetting.GetInstance();
42 43
        }
43 44

  
44
        public void Test()
45
        public void Run()
45 46
        {
46
            _placement = new Placement();
47
            dataSource = _placement.PIDDataSource;
48

  
49
            Ingr.RAD2D.Symbol2d symbol2d = radApp.ActiveSelectSet[0] as Ingr.RAD2D.Symbol2d;
50
            if (symbol2d != null)
47
            try
51 48
            {
52
                string modelID = symbol2d.AttributeSets[0][5].GetValue().ToString();
49
                _placement = new Placement();
50
                dataSource = _placement.PIDDataSource;
53 51

  
54
                LMModelItem modelItem = dataSource.GetModelItem(modelID);
55
                foreach (LMRepresentation rep in modelItem.Representations)
52
                newDrawing = application.Drawings.Add(document.Unit, document.Template, document.DrawingNumber, document.DrawingName);
53
                application.ActiveWindow.Fit();
54
                Thread.Sleep(500);
55
                application.ActiveWindow.Zoom = 2000;
56
                Thread.Sleep(1000);
57

  
58
                double maxX = 0;
59
                double maxY = 0;
60
                foreach (object drawingObj in radApp.ActiveDocument.ActiveSheet.DrawingObjects)
56 61
                {
57
                    if (rep.Attributes["RepresentationType"].get_Value() == "Symbol")
62
                    Ingr.RAD2D.SmartFrame2d smart = drawingObj as Ingr.RAD2D.SmartFrame2d;
63
                    if (smart != null)
58 64
                    {
59
                        LMSymbol symbol = dataSource.GetSymbol(rep.Id);
60

  
61
                        int rotateIndex = symbol.get_IsRotatableIndex();
62
                        int mirrorIndex = symbol.get_IsMirroredIndex();
63
                        
65
                        double x1 = 0;
66
                        double x2 = 0;
67
                        double y1 = 0;
68
                        double y2 = 0;
69
                        smart.Range(out x1, out y1, out x2, out y2);
70
                        maxX = Math.Max(x2, maxX);
71
                        maxY = Math.Max(y2, maxY);
64 72
                    }
65 73
                }
66
                    
67
                
68
                //symbol2d.AttributeSets[]
69
                //dataSource.GetSymbol()
70
            }
71
        }
72 74

  
73
        public void Run()
74
        {
75
            CloseOPCForm.Run();
76
            _placement = new Placement();
77
            dataSource = _placement.PIDDataSource;
78

  
79
            dynamic newDrawing = application.Drawings.Add(document.Unit, document.Template, document.DrawingNumber, document.DrawingName);
80
            application.ActiveWindow.Fit();
81
            Thread.Sleep(100);
82
            application.ActiveWindow.Zoom = 60;
83
            Thread.Sleep(100);
75
                document.SetSPPIDLocation(maxX, maxY);
84 76

  
85
            try
86
            {
87 77
                // Equipment Modeling
88 78
                foreach (Equipment equipment in document.Equipments)
89 79
                    EquipmentModeling(equipment);
......
220 210
            }
221 211
            finally
222 212
            {
213
                application.ActiveWindow.Fit();
214

  
215
                if (newDrawing != null)
216
                    ReleaseCOMObjects(newDrawing);
217

  
223 218
                ReleaseCOMObjects(dataSource);
224 219
                ReleaseCOMObjects(_placement);
225 220
            }
226

  
227
            CloseOPCForm.Stop();
228
            //System.Windows.Forms.MessageBox.Show("end");
229 221
        }
230 222

  
231 223
        private void LineModelingByRun(LineRun run)
......
1259 1251
                if (item.GetType() == typeof(Line))
1260 1252
                {
1261 1253
                    Line line = item as Line;
1262
                    if (modelItemId != line.SPPID.ModelItemId)
1263
                    {
1264
                        AutoJoinPipeRun(line.SPPID.ModelItemId);
1265
                        modelItemId = line.SPPID.ModelItemId;
1266
                    }
1254
                    AutoJoinPipeRun(line.SPPID.ModelItemId);
1255
                    modelItemId = line.SPPID.ModelItemId;
1256
                    //if (modelItemId != line.SPPID.ModelItemId)
1257
                    //{
1258
                        
1259
                    //}
1267 1260
                }
1268 1261
            }
1269 1262
        }
......
1657 1650
                                CalcLabelLocation(ref x, ref y, text.SPPID.ORIGINAL_X, text.SPPID.ORIGINAL_Y, text.SPPIDLabelLocation, mapping.Location);
1658 1651
                                Array array = new double[] { 0, x, y };
1659 1652

  
1660
                                LMLabelPersist _LMLabelPersist = _placement.PIDPlaceLabel(mapping.SPPIDSYMBOLNAME, ref array, Rotation: text.ANGLE, LabeledItem: _LMSymbol.AsLMRepresentation(), IsLeaderVisible: true);
1653
                                LMLabelPersist _LMLabelPersist = _placement.PIDPlaceLabel(mapping.SPPIDSYMBOLNAME, ref array, Rotation: text.ANGLE, LabeledItem: _LMSymbol.AsLMRepresentation(), IsLeaderVisible: mapping.LeaderLine);
1661 1654
                                if (_LMLabelPersist!=null)
1662 1655
                                {
1663 1656
                                    _LMLabelPersist.Commit();
DTI_PID/SPPIDConverter/ConverterDocking.Designer.cs
36 36
            this.layoutControlItem1 = new DevExpress.XtraLayout.LayoutControlItem();
37 37
            this.emptySpaceItem1 = new DevExpress.XtraLayout.EmptySpaceItem();
38 38
            this.defaultLookAndFeel = new DevExpress.LookAndFeel.DefaultLookAndFeel(this.components);
39
            this.simpleButton1 = new DevExpress.XtraEditors.SimpleButton();
40
            this.layoutControlItem2 = new DevExpress.XtraLayout.LayoutControlItem();
39 41
            ((System.ComponentModel.ISupportInitialize)(this.layoutControl1)).BeginInit();
40 42
            this.layoutControl1.SuspendLayout();
41 43
            ((System.ComponentModel.ISupportInitialize)(this.Root)).BeginInit();
42 44
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem1)).BeginInit();
43 45
            ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem1)).BeginInit();
46
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem2)).BeginInit();
44 47
            this.SuspendLayout();
45 48
            // 
46 49
            // layoutControl1
47 50
            // 
51
            this.layoutControl1.Controls.Add(this.simpleButton1);
48 52
            this.layoutControl1.Controls.Add(this.btnSPPIDConverter);
49 53
            this.layoutControl1.Dock = System.Windows.Forms.DockStyle.Fill;
50 54
            this.layoutControl1.Location = new System.Drawing.Point(0, 0);
......
71 75
            this.Root.GroupBordersVisible = false;
72 76
            this.Root.Items.AddRange(new DevExpress.XtraLayout.BaseLayoutItem[] {
73 77
            this.layoutControlItem1,
74
            this.emptySpaceItem1});
78
            this.emptySpaceItem1,
79
            this.layoutControlItem2});
75 80
            this.Root.Name = "Root";
76 81
            this.Root.Size = new System.Drawing.Size(150, 300);
77 82
            this.Root.TextVisible = false;
......
88 93
            // emptySpaceItem1
89 94
            // 
90 95
            this.emptySpaceItem1.AllowHotTrack = false;
91
            this.emptySpaceItem1.Location = new System.Drawing.Point(0, 40);
96
            this.emptySpaceItem1.Location = new System.Drawing.Point(0, 66);
92 97
            this.emptySpaceItem1.Name = "emptySpaceItem1";
93
            this.emptySpaceItem1.Size = new System.Drawing.Size(130, 240);
98
            this.emptySpaceItem1.Size = new System.Drawing.Size(130, 214);
94 99
            this.emptySpaceItem1.TextSize = new System.Drawing.Size(0, 0);
95 100
            // 
96 101
            // defaultLookAndFeel
97 102
            // 
98 103
            this.defaultLookAndFeel.LookAndFeel.SkinName = "Office 2019 Colorful";
99 104
            // 
105
            // simpleButton1
106
            // 
107
            this.simpleButton1.Location = new System.Drawing.Point(12, 52);
108
            this.simpleButton1.Name = "simpleButton1";
109
            this.simpleButton1.Size = new System.Drawing.Size(126, 22);
110
            this.simpleButton1.StyleController = this.layoutControl1;
111
            this.simpleButton1.TabIndex = 5;
112
            this.simpleButton1.Text = "simpleButton1";
113
            this.simpleButton1.Visible = false;
114
            this.simpleButton1.Click += new System.EventHandler(this.simpleButton1_Click);
115
            // 
116
            // layoutControlItem2
117
            // 
118
            this.layoutControlItem2.Control = this.simpleButton1;
119
            this.layoutControlItem2.Location = new System.Drawing.Point(0, 40);
120
            this.layoutControlItem2.Name = "layoutControlItem2";
121
            this.layoutControlItem2.Size = new System.Drawing.Size(130, 26);
122
            this.layoutControlItem2.TextSize = new System.Drawing.Size(0, 0);
123
            this.layoutControlItem2.TextVisible = false;
124
            // 
100 125
            // ConverterDocking
101 126
            // 
102 127
            this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
......
109 134
            ((System.ComponentModel.ISupportInitialize)(this.Root)).EndInit();
110 135
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem1)).EndInit();
111 136
            ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem1)).EndInit();
137
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem2)).EndInit();
112 138
            this.ResumeLayout(false);
113 139

  
114 140
        }
......
121 147
        private DevExpress.XtraLayout.LayoutControlItem layoutControlItem1;
122 148
        private DevExpress.XtraLayout.EmptySpaceItem emptySpaceItem1;
123 149
        private DevExpress.LookAndFeel.DefaultLookAndFeel defaultLookAndFeel;
150
        private DevExpress.XtraEditors.SimpleButton simpleButton1;
151
        private DevExpress.XtraLayout.LayoutControlItem layoutControlItem2;
124 152
    }
125 153
}
DTI_PID/SPPIDConverter/ConverterDocking.cs
16 16
using Converter.SPPID.Util;
17 17
using Converter.SPPID.Form;
18 18
using Converter.SPPID.Model;
19
using Plaice;
20
using Llama;
19 21

  
20 22
namespace Converter.SPPID.Wrapper
21 23
{
......
29 31
            application = Interaction.GetObject("", "PIDAutomation.Application");
30 32
            WrapperApplication wApp = new WrapperApplication(application.Application);
31 33
            radApp = wApp.RADApplication;
34

  
35
#if DEBUG
36
            simpleButton1.Visible = true;
37
#endif
32 38
        }
33 39

  
34 40
        private void btnConverter_Click(object sender, EventArgs e)
35 41
        {
36
            try
42
            ConverterForm converterForm = new ConverterForm();
43
            if (converterForm.ShowDialog() == DialogResult.OK)
37 44
            {
38
                ConverterForm converterForm = new ConverterForm();
39
                if (converterForm.ShowDialog() == DialogResult.OK)
45

  
46
                try
47
                {
48
                    CloseOPCForm.Run();
49
                    foreach (var document in converterForm.Documents)
50
                    {
51
                        if (document.SetSPPIDMapping() && document.Enable)
52
                        {
53
                            AutoModeling modeling = new AutoModeling(document, application, radApp);
54
                            modeling.Run();
55
                        }
56
                    }
57
                }
58
                catch (Exception ex)
59
                {
60
                    MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace);
61
                }
62
                finally
40 63
                {
64
                    CloseOPCForm.Stop();
65
                }
66

  
67
                MessageBox.Show(Msg.EndConvert, Msg.Information, MessageBoxButtons.OK, MessageBoxIcon.Information);
68
            }
69
        }
70

  
71
        private void simpleButton1_Click(object sender, EventArgs e)
72
        {
73
            Placement _placement = new Placement();
74
            LMADataSource dataSource = _placement.PIDDataSource;
41 75

  
76
            double maxX = 0;
77
            double maxY = 0;
78
            foreach (object drawingObj in radApp.ActiveDocument.ActiveSheet.DrawingObjects)
79
            {
80
                SmartFrame2d smart = drawingObj as SmartFrame2d;
81
                if (smart != null)
82
                {
83
                    double x1 = 0;
84
                    double x2 = 0;
85
                    double y1 = 0;
86
                    double y2 = 0;
87
                    smart.Range(out x1, out y1, out x2, out y2);
88
                    maxX = Math.Max(x2, maxX);
89
                    maxY = Math.Max(y2, maxY);
42 90
                }
43 91
            }
44
            catch (Exception ex)
92

  
93
            //DependencyObject drawingObject = radApp.ActiveSelectSet[0] as DependencyObject;
94
            //foreach (var attributes in drawingObject.AttributeSets)
95
            //{
96
            //    foreach (var attribute in attributes)
97
            //    {
98
            //        if (attribute.Name == "ModelID")
99
            //        {
100
            //            LMModelItem modelItem = dataSource.GetModelItem(attribute.GetValue());
101
            //            _LMAItem item = modelItem.AsLMAItem();
102
            //            try
103
            //            {
104
            //                string modelitemID = item.Id;
105
            //                _placement.PIDAutoJoin(item, AutoJoinEndConstants.AutoJoin_None, ref item);
106
            //                string afterModelItemID = item.Id;
107
            //                item.Commit();
108
            //            }
109
            //            catch (Exception ex)
110
            //            {
111
            //                System.Windows.Forms.MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace);
112
            //            }
113
            //        }
114
            //    }
115
            //}
116
            return;
117
            Ingr.RAD2D.Symbol2d symbol2d = radApp.ActiveSelectSet[0] as Ingr.RAD2D.Symbol2d;
118
            if (symbol2d != null)
45 119
            {
46
                MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace);
120
                string modelID = symbol2d.AttributeSets[0][5].GetValue().ToString();
121

  
122
                LMModelItem modelItem = dataSource.GetModelItem(modelID);
123
                foreach (LMRepresentation rep in modelItem.Representations)
124
                {
125
                    if (rep.Attributes["RepresentationType"].get_Value() == "Symbol")
126
                    {
127
                        LMSymbol symbol = dataSource.GetSymbol(rep.Id);
128

  
129
                        int rotateIndex = symbol.get_IsRotatableIndex();
130
                        int mirrorIndex = symbol.get_IsMirroredIndex();
131

  
132
                    }
133
                }
47 134
            }
135

  
136

  
137

  
48 138
        }
49 139
    }
50 140
}
DTI_PID/SPPIDConverter/ConverterForm.cs
327 327
                        Type = row["Type"] == null ? "" : row["Type"].ToString(),
328 328
                        SPPIDATTRIBUTENAME = row["SPPID_ATTRIBUTE"] == null ? "" : row["SPPID_ATTRIBUTE"].ToString(),
329 329
                        SPPIDSYMBOLNAME = row["SPPID_SYMBOL_PATH"] == null ? "" : row["SPPID_SYMBOL_PATH"].ToString(),
330
                        Location = DBNull.Value.Equals(row["LOCATION"]) ? Model.Location.None : (Location)row["LOCATION"]
330
                        Location = DBNull.Value.Equals(row["LOCATION"]) ? Model.Location.None : (Location)row["LOCATION"],
331
                        LeaderLine = DBNull.Value.Equals(row["LEADERLINE"]) ? false : (bool)row["LEADERLINE"]
331 332
                    });
332 333
                }
333 334
            }
DTI_PID/SPPIDConverter/Properties/Msg.Designer.cs
88 88
        }
89 89
        
90 90
        /// <summary>
91
        ///   Completed drawing conversion과(와) 유사한 지역화된 문자열을 찾습니다.
92
        /// </summary>
93
        internal static string EndConvert {
94
            get {
95
                return ResourceManager.GetString("EndConvert", resourceCulture);
96
            }
97
        }
98
        
99
        /// <summary>
91 100
        ///   Fail과(와) 유사한 지역화된 문자열을 찾습니다.
92 101
        /// </summary>
93 102
        internal static string Fail {
DTI_PID/SPPIDConverter/Properties/Msg.ko.resx
168 168
  <data name="SuccessSave" xml:space="preserve">
169 169
    <value>저장에 성공하였습니다!</value>
170 170
  </data>
171
  <data name="EndConvert" xml:space="preserve">
172
    <value>도면 변환을 완료하였습니다.</value>
173
  </data>
171 174
</root>
DTI_PID/SPPIDConverter/Properties/Msg.resx
168 168
  <data name="SuccessSave" xml:space="preserve">
169 169
    <value>Saved successfully</value>
170 170
  </data>
171
  <data name="EndConvert" xml:space="preserve">
172
    <value>Completed drawing conversion</value>
173
  </data>
171 174
</root>
DTI_PID/SPPIDConverter/SPPIDModel/AttributeMapping.cs
32 32
        private string _SPPIDATTRIBUTENAME;
33 33
        private string _SPPIDSYMBOLNAME;
34 34
        private Location _Location;
35
        private bool _LeaderLine;
35 36

  
36 37
        public string UID { get => _UID; set => _UID = value; }
37 38
        public string DisplayAttribute { get => _DisplayAttribute; set => _DisplayAttribute = value; }
......
39 40
        public string SPPIDATTRIBUTENAME { get => _SPPIDATTRIBUTENAME; set => _SPPIDATTRIBUTENAME = value; }
40 41
        public string SPPIDSYMBOLNAME { get => _SPPIDSYMBOLNAME; set => _SPPIDSYMBOLNAME = value; }
41 42
        public Location Location { get; set; }
43
        public bool LeaderLine { get => _LeaderLine; set => _LeaderLine = value; }
42 44
    }
43 45
}
DTI_PID/SPPIDConverter/SPPIDModel/SPPID_Document.cs
16 16
            
17 17
        }
18 18

  
19
        private double testX = 0.855;
20
        private double testY = 0.55;
21

  
22 19
        public List<SymbolMapping> SymbolMappings;
23 20
        public List<ChildSymbolMapping> ChildSymbolMappings;
24 21
        public List<LineMapping> LineMappings;
......
33 30
        public string Unit { get; set; }
34 31
        public string Template { get; set; }
35 32

  
36
        
37 33
        public void SetSPPIDInfo()
38 34
        {
39 35
            foreach (var item in SYMBOLS)
40 36
            {
41 37
                if (item.SPPID == null)
42 38
                    item.SPPID = new SPPIDSymbolInfo();
43
                double x = double.NaN;
44
                double y = double.NaN;
45
                SPPIDUtil.ConvertPointBystring(item.ORIGINALPOINT, ref x, ref y);
46
                SPPIDUtil.ConvertSPPIDPoint(ref x, ref y, SIZE_WIDTH, SIZE_HEIGHT, testX, testY);
47
                item.SPPID.ORIGINAL_X = x;
48
                item.SPPID.ORIGINAL_Y = y;
49 39

  
50 40
                foreach (var childSymbol in item.ChildSymbols)
51 41
                {
......
59 49
            {
60 50
                if (item.SPPID == null)
61 51
                    item.SPPID = new SPPIDLineInfo();
52
            }
53

  
54
            foreach (var item in Equipments)
55
            {
56
                if (item.SPPID == null)
57
                    item.SPPID = new SPPIDSymbolInfo();
58
            }
59

  
60
            foreach (var item in EndBreaks)
61
            {
62
                if (item.SPPID == null)
63
                    item.SPPID = new SPPIDSymbolInfo();
64
            }
65

  
66
            foreach (var item in LINENUMBERS)
67
            {
68
                if (item.SPPID == null)
69
                    item.SPPID = new SPPIDSymbolInfo();
70
            }
71

  
72
            foreach (var item in TEXTINFOS)
73
            {
74
                if (item.SPPID == null)
75
                    item.SPPID = new SPPIDSymbolInfo();
76
            }
77

  
78
            foreach (var item in NOTES)
79
            {
80
                if (item.SPPID == null)
81
                    item.SPPID = new SPPIDSymbolInfo();
82
            }
83
        }
84

  
85
        public void SetSPPIDLocation(double SPPIDDocumentX, double SPPIDDocumentY)
86
        {
87
            foreach (var item in SYMBOLS)
88
            {
89
                double x = double.NaN;
90
                double y = double.NaN;
91
                SPPIDUtil.ConvertPointBystring(item.ORIGINALPOINT, ref x, ref y);
92
                SPPIDUtil.ConvertSPPIDPoint(ref x, ref y, SIZE_WIDTH, SIZE_HEIGHT, SPPIDDocumentX, SPPIDDocumentY);
93
                item.SPPID.ORIGINAL_X = x;
94
                item.SPPID.ORIGINAL_Y = y;
95
            }
96

  
97
            foreach (var item in LINES)
98
            {
62 99
                double x = double.NaN;
63 100
                double y = double.NaN;
64 101

  
65 102
                SPPIDUtil.ConvertPointBystring(item.STARTPOINT, ref x, ref y);
66
                SPPIDUtil.ConvertSPPIDPoint(ref x, ref y, SIZE_WIDTH, SIZE_HEIGHT, testX, testY);
103
                SPPIDUtil.ConvertSPPIDPoint(ref x, ref y, SIZE_WIDTH, SIZE_HEIGHT, SPPIDDocumentX, SPPIDDocumentY);
67 104
                item.SPPID.START_X = x;
68 105
                item.SPPID.START_Y = y;
69 106

  
70 107
                SPPIDUtil.ConvertPointBystring(item.ENDPOINT, ref x, ref y);
71
                SPPIDUtil.ConvertSPPIDPoint(ref x, ref y, SIZE_WIDTH, SIZE_HEIGHT, testX, testY);
108
                SPPIDUtil.ConvertSPPIDPoint(ref x, ref y, SIZE_WIDTH, SIZE_HEIGHT, SPPIDDocumentX, SPPIDDocumentY);
72 109
                item.SPPID.END_X = x;
73 110
                item.SPPID.END_Y = y;
74 111
            }
75 112

  
76 113
            foreach (var item in Equipments)
77 114
            {
78
                if (item.SPPID == null)
79
                    item.SPPID = new SPPIDSymbolInfo();
80 115
                double x = double.NaN;
81 116
                double y = double.NaN;
82 117
                SPPIDUtil.ConvertPointBystring(item.ORIGINALPOINT, ref x, ref y);
83
                SPPIDUtil.ConvertSPPIDPoint(ref x, ref y, SIZE_WIDTH, SIZE_HEIGHT, testX, testY);
118
                SPPIDUtil.ConvertSPPIDPoint(ref x, ref y, SIZE_WIDTH, SIZE_HEIGHT, SPPIDDocumentX, SPPIDDocumentY);
84 119
                item.SPPID.ORIGINAL_X = x;
85 120
                item.SPPID.ORIGINAL_Y = y;
86 121
            }
87 122

  
88 123
            foreach (var item in EndBreaks)
89 124
            {
90
                if (item.SPPID == null)
91
                    item.SPPID = new SPPIDSymbolInfo();
92 125
                double x = double.NaN;
93 126
                double y = double.NaN;
94 127
                SPPIDUtil.ConvertPointBystring(item.ORIGINALPOINT, ref x, ref y);
95
                SPPIDUtil.ConvertSPPIDPoint(ref x, ref y, SIZE_WIDTH, SIZE_HEIGHT, testX, testY);
128
                SPPIDUtil.ConvertSPPIDPoint(ref x, ref y, SIZE_WIDTH, SIZE_HEIGHT, SPPIDDocumentX, SPPIDDocumentY);
96 129
                item.SPPID.ORIGINAL_X = x;
97 130
                item.SPPID.ORIGINAL_Y = y;
98 131
            }
99 132

  
100 133
            foreach (var item in LINENUMBERS)
101 134
            {
102
                if (item.SPPID == null)
103
                    item.SPPID = new SPPIDSymbolInfo();
104 135
                double x = double.NaN;
105 136
                double y = double.NaN;
106 137
                SPPIDUtil.ConvertPointBystring(item.LOCATION, ref x, ref y);
107
                SPPIDUtil.ConvertSPPIDPoint(ref x, ref y, SIZE_WIDTH, SIZE_HEIGHT, testX, testY);
138
                SPPIDUtil.ConvertSPPIDPoint(ref x, ref y, SIZE_WIDTH, SIZE_HEIGHT, SPPIDDocumentX, SPPIDDocumentY);
108 139
                item.SPPID.ORIGINAL_X = x;
109 140
                item.SPPID.ORIGINAL_Y = y;
110 141

  
......
113 144
                double y1 = item.Y1;
114 145
                double x2 = item.X2;
115 146
                double y2 = item.Y2;
116
                SPPIDUtil.ConvertSPPIDPoint(ref x1, ref y1, SIZE_WIDTH, SIZE_HEIGHT, testX, testY);
117
                SPPIDUtil.ConvertSPPIDPoint(ref x2, ref y2, SIZE_WIDTH, SIZE_HEIGHT, testX, testY);
147
                SPPIDUtil.ConvertSPPIDPoint(ref x1, ref y1, SIZE_WIDTH, SIZE_HEIGHT, SPPIDDocumentX, SPPIDDocumentY);
148
                SPPIDUtil.ConvertSPPIDPoint(ref x2, ref y2, SIZE_WIDTH, SIZE_HEIGHT, SPPIDDocumentX, SPPIDDocumentY);
118 149
                item.SPPIDLabelLocation.X1 = Math.Min(x1, x2);
119 150
                item.SPPIDLabelLocation.Y1 = Math.Min(y1, y2);
120 151
                item.SPPIDLabelLocation.X2 = Math.Max(x1, x2);
......
123 154

  
124 155
            foreach (var item in TEXTINFOS)
125 156
            {
126
                if (item.SPPID == null)
127
                    item.SPPID = new SPPIDSymbolInfo();
128 157
                double x = double.NaN;
129 158
                double y = double.NaN;
130 159
                SPPIDUtil.ConvertPointBystring(item.LOCATION, ref x, ref y);
131
                SPPIDUtil.ConvertSPPIDPoint(ref x, ref y, SIZE_WIDTH, SIZE_HEIGHT, testX, testY);
160
                SPPIDUtil.ConvertSPPIDPoint(ref x, ref y, SIZE_WIDTH, SIZE_HEIGHT, SPPIDDocumentX, SPPIDDocumentY);
132 161
                item.SPPID.ORIGINAL_X = x;
133 162
                item.SPPID.ORIGINAL_Y = y;
134 163

  
......
137 166
                double y1 = item.Y1;
138 167
                double x2 = item.X2;
139 168
                double y2 = item.Y2;
140
                SPPIDUtil.ConvertSPPIDPoint(ref x1, ref y1, SIZE_WIDTH, SIZE_HEIGHT, testX, testY);
141
                SPPIDUtil.ConvertSPPIDPoint(ref x2, ref y2, SIZE_WIDTH, SIZE_HEIGHT, testX, testY);
169
                SPPIDUtil.ConvertSPPIDPoint(ref x1, ref y1, SIZE_WIDTH, SIZE_HEIGHT, SPPIDDocumentX, SPPIDDocumentY);
170
                SPPIDUtil.ConvertSPPIDPoint(ref x2, ref y2, SIZE_WIDTH, SIZE_HEIGHT, SPPIDDocumentX, SPPIDDocumentY);
142 171
                item.SPPIDLabelLocation.X1 = Math.Min(x1, x2);
143 172
                item.SPPIDLabelLocation.Y1 = Math.Min(y1, y2);
144 173
                item.SPPIDLabelLocation.X2 = Math.Max(x1, x2);
......
147 176

  
148 177
            foreach (var item in NOTES)
149 178
            {
150
                if (item.SPPID == null)
151
                    item.SPPID = new SPPIDSymbolInfo();
152 179
                double x = double.NaN;
153 180
                double y = double.NaN;
154 181
                SPPIDUtil.ConvertPointBystring(item.LOCATION, ref x, ref y);
155
                SPPIDUtil.ConvertSPPIDPoint(ref x, ref y, SIZE_WIDTH, SIZE_HEIGHT, testX, testY);
182
                SPPIDUtil.ConvertSPPIDPoint(ref x, ref y, SIZE_WIDTH, SIZE_HEIGHT, SPPIDDocumentX, SPPIDDocumentY);
156 183
                item.SPPID.ORIGINAL_X = x;
157 184
                item.SPPID.ORIGINAL_Y = y;
158 185

  
......
161 188
                double y1 = item.Y1;
162 189
                double x2 = item.X2;
163 190
                double y2 = item.Y2;
164
                SPPIDUtil.ConvertSPPIDPoint(ref x1, ref y1, SIZE_WIDTH, SIZE_HEIGHT, testX, testY);
165
                SPPIDUtil.ConvertSPPIDPoint(ref x2, ref y2, SIZE_WIDTH, SIZE_HEIGHT, testX, testY);
191
                SPPIDUtil.ConvertSPPIDPoint(ref x1, ref y1, SIZE_WIDTH, SIZE_HEIGHT, SPPIDDocumentX, SPPIDDocumentY);
192
                SPPIDUtil.ConvertSPPIDPoint(ref x2, ref y2, SIZE_WIDTH, SIZE_HEIGHT, SPPIDDocumentX, SPPIDDocumentY);
166 193
                item.SPPIDLabelLocation.X1 = Math.Min(x1, x2);
167 194
                item.SPPIDLabelLocation.Y1 = Math.Min(y1, y2);
168 195
                item.SPPIDLabelLocation.X2 = Math.Max(x1, x2);
......
248 275
            return true;
249 276
        }
250 277

  
278
        public void ConvertSPPIDPoint(ref double dX, ref double dY, double dDwgX, double dDwgY, double SPPID_Width, double SPPID_Height)
279
        {
280
            decimal calcX = 0;
281
            decimal calcY = 0;
282
            decimal tempX = Convert.ToDecimal(dX);
283
            decimal tempY = Convert.ToDecimal(dY);
284
            decimal tempWidth = Convert.ToDecimal(SPPID_Width);
285
            decimal tempHeight = Convert.ToDecimal(SPPID_Height);
286
            decimal tempDwgX = Convert.ToDecimal(dDwgX);
287
            decimal tempDwgY = Convert.ToDecimal(dDwgY);
288

  
289
            //calcX = (tempX * tempWidth) / tempDwgX;
290
            //calcX = Math.Truncate(calcX * 1000) / 1000;
291
            //calcY = tempHeight - ((tempY * tempHeight) / tempDwgY);
292
            //calcY = Math.Truncate(calcY * 1000) / 1000;
293
            //dX = Math.Round(Convert.ToDouble(calcX), 10);
294
            //dY = Math.Round(Convert.ToDouble(calcY), 10);
295

  
296
            calcX = (tempX * tempWidth) / tempDwgX;
297
            calcY = tempHeight - ((tempY * tempHeight) / tempDwgY);
298
            dX = Convert.ToDouble(calcX);
299
            dY = Convert.ToDouble(calcY);
300
        }
301

  
251 302
        private bool SetChildSymbolMapping(ChildSymbol item)
252 303
        {
253 304
            foreach (var childSymbol in item.ChildSymbols)
DTI_PID/SPPIDConverter/Wrapper/SPPIDConverterWrapper.cs
229 229
                            MessageBox.Show("Fail", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
230 230
                        }
231 231

  
232
                        if (application.ActiveDocument == null)
233
                            application.RunCommand(CommandConstants.igcmdFileNew);
234

  
232 235
                        #endregion
233 236
                    }
234 237
                }

내보내기 Unified diff

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