| | |
| | | |
| | | if (angleCount % 3 == 2) |
| | | { |
| | | IPoint p1 = (IPoint)line.Points[0]; |
| | | IPoint p2 = (IPoint)line.Points[1]; |
| | | IPoint p3 = (IPoint)line.Points[2]; |
| | | var pos1 = SG.Creator.CreatePosition(p1.X, p1.Y); |
| | | var pos2 = SG.Creator.CreatePosition(p2.X, p2.Y); |
| | | var pos3 = SG.Creator.CreatePosition(p3.X, p3.Y); |
| | | |
| | | var first = SG.CoordServices.GetAimingAngles(pos1, pos2); |
| | | var sencod = SG.CoordServices.GetAimingAngles(pos2, pos3); |
| | | angleSize = getAngle(first, sencod); |
| | | angleSize = getAngle(line); |
| | | angleLabel.Text = angleSize.ToString() + "°"; |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | private double getAngle(IPosition71 first, IPosition71 sencod) |
| | | private double getAngle(ILineString line, bool getB = false) |
| | | { |
| | | /*double angle = 0; |
| | | if (sencod.Yaw > first.Yaw) |
| | | IPoint p1 = (IPoint)line.Points[0]; |
| | | IPoint p2 = (IPoint)line.Points[1]; |
| | | IPoint p3 = (IPoint)line.Points[2]; |
| | | var pos1 = SG.Creator.CreatePosition(p1.X, p1.Y); |
| | | var pos2 = SG.Creator.CreatePosition(p2.X, p2.Y); |
| | | var pos3 = SG.Creator.CreatePosition(p3.X, p3.Y); |
| | | |
| | | //var first = SG.CoordServices.GetAimingAngles(pos1, pos2); |
| | | var first = SG.CoordServices.GetAimingAngles(pos1, pos2); |
| | | var sencod = SG.CoordServices.GetAimingAngles(pos2, pos3); |
| | | if (getB) return Math.Round(sencod.Yaw, 2); |
| | | |
| | | double angle = 0; |
| | | if (first.Yaw >= 0 && first.Yaw < 180) |
| | | { |
| | | angle = sencod.Yaw - first.Yaw; |
| | | if (angle > 180) angle = 360 - sencod.Yaw + first.Yaw; |
| | | angle = first.Yaw + 180 - sencod.Yaw; |
| | | if (angle > 180) angle = 360 - angle; |
| | | if (angle < 0) angle = -angle; |
| | | } |
| | | else |
| | | { |
| | | angle = first.Yaw - sencod.Yaw; |
| | | if (angle > 180) angle = 360 + sencod.Yaw - first.Yaw; |
| | | }*/ |
| | | |
| | | double angle = sencod.Yaw > first.Yaw ? sencod.Yaw - first.Yaw : first.Yaw - sencod.Yaw; |
| | | angle = sencod.Yaw - (first.Yaw - 180); |
| | | if (angle > 180) angle = 360 - angle; |
| | | if (angle < 0) angle = -angle; |
| | | } |
| | | |
| | | return Math.Round(angle, 2); |
| | | } |
| | |
| | | |
| | | if (angleCount % 3 == 2) |
| | | { |
| | | IPoint secondPoint = (IPoint)line.Points[line.Points.Count - 2]; |
| | | //IPoint secondPoint = (IPoint)line.Points[line.Points.Count - 2]; |
| | | //var secondPos = SG.Creator.CreatePosition(secondPoint.X, secondPoint.Y); |
| | | IPoint nowPoint = (IPoint)line.Points[line.Points.Count - 1]; |
| | | var secondPos = SG.Creator.CreatePosition(secondPoint.X, secondPoint.Y); |
| | | var newPos = SG.Creator.CreatePosition(nowPoint.X, nowPoint.Y); |
| | | |
| | | bLabel = CreateLabel(newPos, GetGroupId(angleGroupName), "#00FFFF"); |
| | | bLabel.Text = Math.Round(SG.CoordServices.GetAimingAngles(secondPos, newPos).Yaw, 2) + "°"; |
| | | bLabel.Text = getAngle(line, true) + "°"; |
| | | |
| | | angleSize = getAngle(line); |
| | | angleLabel.Text = angleSize.ToString() + "°"; |
| | | } |
| | | angleCount++; |
| | |
| | | private void Save() |
| | | { |
| | | string emptyFly = Path.Combine(Application.StartupPath, "Resources", "empty.fly"); |
| | | if (emptyFly.Equals(this.fly)) |
| | | if (emptyFly.Contains("empty.fly")) //if (emptyFly.Equals(this.fly)) |
| | | { |
| | | SaveAs(); |
| | | return; |
| | |
| | | { |
| | | try |
| | | { |
| | | if (String.IsNullOrEmpty(fileName)) fileName = DateTime.Now.ToString("yyyyMMddHHmmss") + ".fly"; |
| | | if (String.IsNullOrEmpty(fileName) || "empty.fly".Equals(fileName)) fileName = DateTime.Now.ToString("yyyyMMddHHmmss") + ".fly"; |
| | | |
| | | SaveLocation(); |
| | | this.SG.Command.Execute(1019, 0); // Capture Tree State |