개정판 47ad9a46
dev issue #589 : Flow Mark Modeling 기능 개발 완료
Change-Id: Ib66c43b7e616049b5b2426657b0d250f84888925
DTI_PID/SPPIDConverter/AutoModeling.cs | ||
---|---|---|
37 | 37 |
public string DocumentLabelText { get; set; } |
38 | 38 |
|
39 | 39 |
int CurrentCount; |
40 |
|
|
41 | 40 |
List <Tuple<string, Line, Line>> BranchLines = new List<Tuple<string, Line, Line>>(); |
41 |
|
|
42 | 42 |
public AutoModeling(SPPID_Document document, dynamic application, Ingr.RAD2D.Application radApp) |
43 | 43 |
{ |
44 | 44 |
this.document = document; |
... | ... | |
1929 | 1929 |
/// <param name="line"></param> |
1930 | 1930 |
private void FlowMarkModeling(Line line) |
1931 | 1931 |
{ |
1932 |
// 임시 |
|
1933 | 1932 |
if (line.FLOWMARK && !string.IsNullOrEmpty(line.SPPID.ModelItemId)) |
1934 | 1933 |
{ |
1934 |
SlopeType targetSlopeType = SPPIDUtil.CalcSlope(line.SPPID.START_X, line.SPPID.START_Y, line.SPPID.END_X, line.SPPID.END_Y); |
|
1935 | 1935 |
string mappingPath = _ETCSetting.FlowMarkSymbolPath; |
1936 |
double percent = line.FLOWMARK_PERCENT; |
|
1936 | 1937 |
double tempX = 0; |
1937 | 1938 |
double tempY = 0; |
1938 |
tempX = line.SPPID.END_X; |
|
1939 |
tempY = line.SPPID.END_Y; |
|
1940 | 1939 |
|
1941 |
double x = 0; |
|
1942 |
double y = 0; |
|
1940 |
double gapX; |
|
1941 |
double gapY; |
|
1942 |
// ID2 기준의 Gap을 구함 |
|
1943 |
if (percent == 0) |
|
1944 |
{ |
|
1945 |
gapX = 0; |
|
1946 |
gapY = 0; |
|
1947 |
} |
|
1948 |
else |
|
1949 |
{ |
|
1950 |
gapX = Math.Abs(line.SPPID.START_X - line.SPPID.END_X) / 100 * percent; |
|
1951 |
gapY = Math.Abs(line.SPPID.START_Y - line.SPPID.END_Y) / 100 * percent; |
|
1952 |
} |
|
1943 | 1953 |
|
1944 |
//if (line.FLOWMARK_PERCENT <= 10) |
|
1945 |
//{ |
|
1946 |
// x = line.SPPID.START_X; |
|
1947 |
// y = line.SPPID.START_Y; |
|
1948 |
//} |
|
1949 |
//else if (line.FLOWMARK_PERCENT >= 90) |
|
1950 |
//{ |
|
1951 |
// x = line.SPPID.END_X; |
|
1952 |
// y = line.SPPID.END_Y; |
|
1953 |
//} |
|
1954 |
//else |
|
1955 |
//{ |
|
1956 |
|
|
1957 |
//} |
|
1958 |
|
|
1959 |
double angle = 0; |
|
1960 |
//SlopeType slopeType = SPPIDUtil.CalcSlope(line.SPPID.START_X, line.SPPID.START_Y, line.SPPID.END_X, line.SPPID.END_Y); |
|
1961 |
//// 0 180 |
|
1962 |
//if (slopeType == SlopeType.HORIZONTAL) |
|
1963 |
//{ |
|
1964 |
// if (line.SPPID.START_X < line.SPPID.END_X) |
|
1965 |
// angle = 0; |
|
1966 |
// else |
|
1967 |
// angle = Math.PI; |
|
1968 |
//} |
|
1969 |
//// 90 270 |
|
1970 |
//else if (slopeType == SlopeType.VERTICAL) |
|
1971 |
//{ |
|
1972 |
// if (line.SPPID.START_Y < line.SPPID.END_Y) |
|
1973 |
// angle = 90 * Math.PI / 180; |
|
1974 |
// else |
|
1975 |
// angle = 270 * Math.PI / 180; |
|
1976 |
//} |
|
1954 |
if (line.SPPID.START_X < line.SPPID.END_X) |
|
1955 |
tempX = line.SPPID.START_X + gapX; |
|
1956 |
else |
|
1957 |
tempX = line.SPPID.START_X - gapX; |
|
1977 | 1958 |
|
1959 |
if (line.SPPID.START_Y < line.SPPID.END_Y) |
|
1960 |
tempY = line.SPPID.START_Y + gapY; |
|
1961 |
else |
|
1962 |
tempY = line.SPPID.START_Y - gapY; |
|
1978 | 1963 |
|
1964 |
|
|
1965 |
|
|
1979 | 1966 |
Dictionary<LMConnector, List<double[]>> connectorVertices = GetPipeRunVertices(line.SPPID.ModelItemId); |
1980 | 1967 |
LMConnector _TargetItem = null; |
1981 | 1968 |
double distance = double.MaxValue; |
1969 |
double[] startPoint = null; |
|
1970 |
double[] endPoint = null; |
|
1971 |
// ID2의 기준 Gap으로 제일 가까운 Line 찾음(Slope도 같은조건) |
|
1982 | 1972 |
foreach (var item in connectorVertices) |
1983 | 1973 |
{ |
1984 | 1974 |
for (int i = 0; i < item.Value.Count - 1; i++) |
... | ... | |
1988 | 1978 |
double[] point2 = points[i + 1]; |
1989 | 1979 |
|
1990 | 1980 |
SlopeType slopeType = SPPIDUtil.CalcSlope(point1[0], point1[1], point2[0], point2[1]); |
1991 |
|
|
1992 |
//double result = SPPIDUtil.CalcPointToPointdDistance(point1[0], point1[1], tempX, tempY); |
|
1993 |
//if (result < distance) |
|
1994 |
//{ |
|
1995 |
// distance = result; |
|
1996 |
// _TargetItem = item.Key; |
|
1997 |
|
|
1998 |
// if (slopeType == SlopeType.HORIZONTAL) |
|
1999 |
// { |
|
2000 |
// if (point1[0] < point2[0]) |
|
2001 |
// angle = 0; |
|
2002 |
// else |
|
2003 |
// angle = Math.PI; |
|
2004 |
// } |
|
2005 |
// // 90 270 |
|
2006 |
// else if (slopeType == SlopeType.VERTICAL) |
|
2007 |
// { |
|
2008 |
// if (point1[1] < point2[1]) |
|
2009 |
// angle = 90 * Math.PI / 180; |
|
2010 |
// else |
|
2011 |
// angle = 270 * Math.PI / 180; |
|
2012 |
// } |
|
2013 |
|
|
2014 |
// x = point1[0]; |
|
2015 |
// y = point2[0]; |
|
2016 |
//} |
|
2017 |
|
|
2018 |
double result = SPPIDUtil.CalcPointToPointdDistance(point2[0], point2[1], tempX, tempY); |
|
2019 |
if (result < distance) |
|
1981 |
if (slopeType == targetSlopeType) |
|
2020 | 1982 |
{ |
2021 |
distance = result; |
|
2022 |
_TargetItem = item.Key; |
|
2023 |
|
|
2024 |
if (slopeType == SlopeType.HORIZONTAL) |
|
1983 |
double result = SPPIDUtil.CalcPointToPointdDistance(point1[0], point1[1], tempX, tempY); |
|
1984 |
if (result < distance) |
|
2025 | 1985 |
{ |
2026 |
if (point1[0] < point2[0]) |
|
2027 |
angle = 0; |
|
2028 |
else |
|
2029 |
angle = Math.PI; |
|
1986 |
distance = result; |
|
1987 |
_TargetItem = item.Key; |
|
1988 |
|
|
1989 |
startPoint = point1; |
|
1990 |
endPoint = point2; |
|
2030 | 1991 |
} |
2031 |
// 90 270 |
|
2032 |
else if (slopeType == SlopeType.VERTICAL) |
|
1992 |
|
|
1993 |
result = SPPIDUtil.CalcPointToPointdDistance(point2[0], point2[1], tempX, tempY); |
|
1994 |
if (result < distance) |
|
2033 | 1995 |
{ |
2034 |
if (point1[1] < point2[1]) |
|
2035 |
angle = 90 * Math.PI / 180; |
|
2036 |
else |
|
2037 |
angle = 270 * Math.PI / 180; |
|
2038 |
} |
|
1996 |
distance = result; |
|
1997 |
_TargetItem = item.Key; |
|
2039 | 1998 |
|
2040 |
x = point2[0]; |
|
2041 |
y = point2[1]; |
|
1999 |
startPoint = point1; |
|
2000 |
endPoint = point2; |
|
2001 |
} |
|
2042 | 2002 |
} |
2043 | 2003 |
} |
2044 | 2004 |
} |
2045 | 2005 |
|
2046 | 2006 |
if (_TargetItem != null) |
2047 | 2007 |
{ |
2048 |
LMSymbol _LMSymbol = _placement.PIDPlaceSymbol(mappingPath, x, y, Mirror: 0, Rotation: angle, TargetItem: _TargetItem); |
|
2008 |
double x = 0; |
|
2009 |
double y = 0; |
|
2010 |
double angle = 0; |
|
2011 |
// SPPID 기준의 Gap으로 실 좌표를 구함 |
|
2012 |
if (percent == 0) |
|
2013 |
{ |
|
2014 |
gapX = 0; |
|
2015 |
gapY = 0; |
|
2016 |
} |
|
2017 |
else |
|
2018 |
{ |
|
2019 |
gapX = Math.Abs(startPoint[0] - endPoint[0]) / 100 * percent; |
|
2020 |
gapY = Math.Abs(startPoint[1] - endPoint[1]) / 100 * percent; |
|
2021 |
} |
|
2049 | 2022 |
|
2023 |
if (startPoint[0] < endPoint[0]) |
|
2024 |
x = startPoint[0] + gapX; |
|
2025 |
else |
|
2026 |
x = startPoint[0] - gapX; |
|
2027 |
|
|
2028 |
if (startPoint[1] < endPoint[1]) |
|
2029 |
y = startPoint[1] + gapY; |
|
2030 |
else |
|
2031 |
y = startPoint[1] - gapY; |
|
2032 |
|
|
2033 |
if (targetSlopeType == SlopeType.HORIZONTAL) |
|
2034 |
{ |
|
2035 |
if (startPoint[0] < endPoint[0]) |
|
2036 |
angle = 0; |
|
2037 |
else |
|
2038 |
angle = Math.PI; |
|
2039 |
} |
|
2040 |
// 90 270 |
|
2041 |
else if (targetSlopeType == SlopeType.VERTICAL) |
|
2042 |
{ |
|
2043 |
if (startPoint[1] < endPoint[1]) |
|
2044 |
angle = 90 * Math.PI / 180; |
|
2045 |
else |
|
2046 |
angle = 270 * Math.PI / 180; |
|
2047 |
} |
|
2048 |
|
|
2049 |
LMSymbol _LMSymbol = _placement.PIDPlaceSymbol(mappingPath, x, y, Mirror: 0, Rotation: angle, TargetItem: _TargetItem); |
|
2050 |
|
|
2050 | 2051 |
if (_LMSymbol != null) |
2051 | 2052 |
{ |
2052 | 2053 |
ReleaseCOMObjects(_LMSymbol); |
DTI_PID/SPPIDConverter/Form/SPPIDSplashScreen.cs | ||
---|---|---|
17 | 17 |
{ |
18 | 18 |
InitializeComponent(); |
19 | 19 |
this.labelControl1.Text = "Copyright © 2018-" + DateTime.Now.Year.ToString(); |
20 |
TopMost = true; |
|
21 | 20 |
} |
22 | 21 |
private void SPPIDSplashScreen_Load(object sender, EventArgs e) |
23 | 22 |
{ |
23 |
TopMost = true; |
|
24 | 24 |
//StartPosition = FormStartPosition.Manual; |
25 | 25 |
//Location = new Point(0, 0); |
26 | 26 |
} |
내보내기 Unified diff