프로젝트

일반

사용자정보

개정판 b65a7e32

IDb65a7e32457997be1331ed7759707bd40fc5ec09
상위 1a3a74a8
하위 a3557cbc

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

dev issue #000 : ID2 text Item들 모델링 위치 설정 기능

Change-Id: I0018a7e84e16ea7b8080a7b503ef6a116d52b7ef

차이점 보기:

DTI_PID/SPPIDConverter/AutoModeling.cs
29 29
        LMADataSource dataSource;
30 30
        Ingr.RAD2D.Application radApp;
31 31
        SPPID_Document document;
32
        ETCSetting _ETCSetting;
32 33

  
33 34
        List<Tuple<string, Line, Line>> BranchLines = new List<Tuple<string, Line, Line>>();
34 35
        public AutoModeling(SPPID_Document document, Ingr.RAD2D.Application radApp)
35 36
        {
36 37
            this.document = document;
37 38
            this.radApp = radApp;
39
            this._ETCSetting = ETCSetting.GetInstance();
38 40
        }
39 41

  
40 42
        public void Run()
......
1133 1135
            LMConnector connectedLMConnector = FindTargetLMConnectorByPoint(connectorVertices, lineNumber.SPPID.ORIGINAL_X, lineNumber.SPPID.ORIGINAL_Y);
1134 1136
            if (connectedLMConnector != null)
1135 1137
            {
1136
                Array points = new double[] { 0, lineNumber.SPPID.ORIGINAL_X, lineNumber.SPPID.ORIGINAL_Y };
1138
                double x = 0;
1139
                double y = 0;
1140
                CalcLabelLocation(ref x, ref y, lineNumber.SPPID.ORIGINAL_X, lineNumber.SPPID.ORIGINAL_Y, lineNumber.SPPIDLabelLocation, _ETCSetting.LineNumberLocation);
1141

  
1142
                Array points = new double[] { 0, x, y };
1137 1143
                LMLabelPersist _LmLabelPresist = _placement.PIDPlaceLabel(lineNumber.SPPID.MAPPINGNAME, ref points, Rotation: lineNumber.ANGLE, LabeledItem: connectedLMConnector.AsLMRepresentation(), IsLeaderVisible: false);
1138 1144
                _LmLabelPresist.Commit();
1139 1145

  
......
1276 1282

  
1277 1283
                            if (mapping != null)
1278 1284
                            {
1279
                                Array array = null;
1280 1285
                                double x = 0;
1281 1286
                                double y = 0;
1282
                                if (mapping.Location == Location.None)
1283
                                {
1284
                                    x = text.SPPID.ORIGINAL_X;
1285
                                    y = text.SPPID.ORIGINAL_Y;
1286
                                }
1287
                                    
1288
                                if (mapping.Location.HasFlag(Location.Center))
1289
                                {
1290
                                    x = (text.SPPIDLabelLocation.X1 + text.SPPIDLabelLocation.X2) / 2;
1291
                                    y = (text.SPPIDLabelLocation.Y1 + text.SPPIDLabelLocation.Y2) / 2;
1292
                                }
1293

  
1294
                                if (mapping.Location.HasFlag(Location.Left))
1295
                                    x = text.SPPIDLabelLocation.X1;
1296
                                else if (mapping.Location.HasFlag(Location.Right))
1297
                                    x = text.SPPIDLabelLocation.X2;
1298 1287

  
1299
                                if (mapping.Location.HasFlag(Location.Down))
1300
                                    y = text.SPPIDLabelLocation.Y1;
1301
                                else if (mapping.Location.HasFlag(Location.Up))
1302
                                    y = text.SPPIDLabelLocation.Y2;
1303

  
1304
                                array = new double[] { 0, x, y };
1288
                                CalcLabelLocation(ref x, ref y, text.SPPID.ORIGINAL_X, text.SPPID.ORIGINAL_Y, text.SPPIDLabelLocation, mapping.Location);
1289
                                Array array = new double[] { 0, x, y };
1305 1290

  
1306 1291
                                LMLabelPersist _LMLabelPersist = _placement.PIDPlaceLabel(mapping.SPPIDSYMBOLNAME, ref array, Rotation: text.ANGLE, LabeledItem: _LMSymbol.AsLMRepresentation(), IsLeaderVisible: true);
1307 1292
                                if (_LMLabelPersist!=null)
......
1322 1307
                    LMItemNote _LMItemNote = null;
1323 1308
                    LMAAttribute _LMAAttribute = null;
1324 1309

  
1325
                    _LMSymbol = _placement.PIDPlaceSymbol(text.SPPID.MAPPINGNAME, text.SPPID.ORIGINAL_X, text.SPPID.ORIGINAL_Y);
1310
                    double x = 0;
1311
                    double y = 0;
1312

  
1313
                    CalcLabelLocation(ref x, ref y, text.SPPID.ORIGINAL_X, text.SPPID.ORIGINAL_Y, text.SPPIDLabelLocation, _ETCSetting.TextLocation);
1314

  
1315
                    _LMSymbol = _placement.PIDPlaceSymbol(text.SPPID.MAPPINGNAME, x, y);
1326 1316
                    _LMSymbol.Commit();
1327 1317
                    _LMItemNote = _placement.PIDDataSource.GetItemNote(_LMSymbol.ModelItemID);
1328 1318
                    _LMItemNote.Commit();
......
1355 1345

  
1356 1346
            try
1357 1347
            {
1358
                _LMSymbol = _placement.PIDPlaceSymbol(note.SPPID.MAPPINGNAME, note.SPPID.ORIGINAL_X, note.SPPID.ORIGINAL_Y);
1348
                double x = 0;
1349
                double y = 0;
1350

  
1351
                CalcLabelLocation(ref x, ref y, note.SPPID.ORIGINAL_X, note.SPPID.ORIGINAL_Y, note.SPPIDLabelLocation, _ETCSetting.NoteLocation);
1352

  
1353
                _LMSymbol = _placement.PIDPlaceSymbol(note.SPPID.MAPPINGNAME, x, y);
1359 1354
                _LMSymbol.Commit();
1360 1355
                _LMItemNote = _placement.PIDDataSource.GetItemNote(_LMSymbol.ModelItemID);
1361 1356
                _LMItemNote.Commit();
......
1388 1383
                    intNewRefCount = intNewRefCount + System.Runtime.InteropServices.Marshal.FinalReleaseComObject(obj);
1389 1384
            }
1390 1385
        }
1386

  
1387
        private void CalcLabelLocation(ref double x, ref double y, double originX, double originY, SPPIDLabelLocationInfo SPPIDLabelLocation, Location location)
1388
        {
1389
            if (location == Location.None)
1390
            {
1391
                x = originX;
1392
                y = originY;
1393
            }
1394
            else
1395
            {
1396
                if (location.HasFlag(Location.Center))
1397
                {
1398
                    x = (SPPIDLabelLocation.X1 + SPPIDLabelLocation.X2) / 2;
1399
                    y = (SPPIDLabelLocation.Y1 + SPPIDLabelLocation.Y2) / 2;
1400
                }
1401

  
1402
                if (location.HasFlag(Location.Left))
1403
                    x = SPPIDLabelLocation.X1;
1404
                else if (location.HasFlag(Location.Right))
1405
                    x = SPPIDLabelLocation.X2;
1406

  
1407
                if (location.HasFlag(Location.Down))
1408
                    y = SPPIDLabelLocation.Y1;
1409
                else if (location.HasFlag(Location.Up))
1410
                    y = SPPIDLabelLocation.Y2;
1411
            }
1412
        }
1391 1413
    }
1392 1414
}

내보내기 Unified diff

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