개정판 30a9ffce
dev issue #000 : edit Branch Line
Change-Id: I0be410caa0946918d4deec087517d3bbf437ab27
DTI_PID/SPPIDConverter/AutoModeling.cs | ||
---|---|---|
514 | 514 |
double[] point1 = points[i]; |
515 | 515 |
double[] point2 = points[i + 1]; |
516 | 516 |
|
517 |
double maxLineX = Math.Max(point1[0], point2[0]); |
|
518 |
double minLineX = Math.Min(point1[0], point2[0]); |
|
519 |
double maxLineY = Math.Max(point1[1], point2[1]); |
|
520 |
double minLineY = Math.Min(point1[1], point2[1]); |
|
521 |
|
|
522 | 517 |
// 두직선의 교차점 |
523 | 518 |
double[] crossingPoint = SPPIDUtil.CalcLineCrossingPoint(connX, connY, x2, y2, point1[0], point1[1], point2[0], point2[1]); |
524 | 519 |
if (crossingPoint != null) |
525 | 520 |
{ |
526 |
|
|
527 |
|
|
521 |
double distance = SPPIDUtil.CalcPointToPointdDistance(connX, connY, crossingPoint[0], crossingPoint[1]); |
|
522 |
if (length > distance) |
|
523 |
{ |
|
524 |
targetConnector = item.Key; |
|
525 |
length = distance; |
|
526 |
} |
|
528 | 527 |
} |
529 |
|
|
530 |
|
|
531 |
// 두직선의 교차점으로 구하면 될듯 그리고 교차점이 x y랑 제일 가까운것 |
|
532 |
|
|
533 |
//if ((minLineX <= x && maxLineX >= x) || |
|
534 |
// (minLineY <= y && maxLineY >= y)) |
|
535 |
//{ |
|
536 |
// double result = SPPIDUtil.CalcLineToPointDistance(point1[0], point1[1], point2[0], point2[1], connX, connY); |
|
537 |
// if (length > result) |
|
538 |
// { |
|
539 |
// targetConnector = item.Key; |
|
540 |
// length = result; |
|
541 |
// } |
|
542 |
//} |
|
543 | 528 |
} |
544 | 529 |
} |
545 | 530 |
|
DTI_PID/SPPIDConverter/ConverterForm.cs | ||
---|---|---|
515 | 515 |
private void btnRun_Click(object sender, EventArgs e) |
516 | 516 |
{ |
517 | 517 |
#if DEBUG |
518 |
SPPID_Document document = new SPPID_Document(@"Z:\HanKyouHo\temp\Isocynates\Temp\11111.xml"); |
|
519 |
//SPPID_Document document = new SPPID_Document(@"Z:\HanKyouHo\temp\Isocynates\Temp\zIsocynates-325_Page75.xml");
|
|
518 |
//SPPID_Document document = new SPPID_Document(@"Z:\HanKyouHo\temp\Isocynates\Temp\11111.xml");
|
|
519 |
SPPID_Document document = new SPPID_Document(@"Z:\HanKyouHo\temp\Isocynates\Temp\zIsocynates-325_Page75.xml"); |
|
520 | 520 |
document.SymbolMappings = symbolMappings; |
521 | 521 |
document.LineMappings = lineMappings; |
522 | 522 |
document.LineNumberMappings = lineNumberMappings; |
DTI_PID/SPPIDConverter/SPPIDConverter.csproj | ||
---|---|---|
5 | 5 |
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
6 | 6 |
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
7 | 7 |
<ProjectGuid>{B6757E78-6B59-40A3-A7BB-E73E8F81B6C3}</ProjectGuid> |
8 |
<OutputType>WinExe</OutputType>
|
|
8 |
<OutputType>Library</OutputType>
|
|
9 | 9 |
<AppDesignerFolder>Properties</AppDesignerFolder> |
10 | 10 |
<RootNamespace>Converter.SPPID</RootNamespace> |
11 | 11 |
<AssemblyName>SPPIDConverter</AssemblyName> |
DTI_PID/SPPIDConverter/Util/SPPIDUtil.cs | ||
---|---|---|
198 | 198 |
return new double[] { -(b1 - b2) / (a1 - a2), a1 * (-(b1 - b2) / (a1 - a2) + b1) }; |
199 | 199 |
} |
200 | 200 |
} |
201 |
public static double CalcPointToPointdDistance(double x1, double y1, double x2, double y2) |
|
202 |
{ |
|
203 |
return Math.Pow(Math.Pow(x1 - x2, 2) + Math.Pow(y1 - y2, 2), 0.5); |
|
204 |
} |
|
205 |
|
|
201 | 206 |
#region |
202 | 207 |
public static bool IsBranchLine(string UID, Line connectedLine) |
203 | 208 |
{ |
내보내기 Unified diff