public BeamData(double height, double width, double maxlength, _AcGe.Point3d p0, _AcGe.Point3d p1, _AcGe.Point3d pSide = new _AcGe.Point3d()) { BeamStartPoint = p0; BeamEndPoint = p1; BeamSidePoint = pSide; Height = height; Width = width; Length = BeamStartPoint.GetVectorTo(BeamEndPoint).Length; MaxLength = maxlength; if (Length > MaxLength) { MessageBox.Show("WARNING! - picked beam length is greater than maximum length for selected beam type."); } // // We need to check the incoming pSide var to see if we need to offset our beam to one side // or draw it on the centre line (the picked points form the centre line). // if (pSide.GetAsVector().Length == 0) { OffsetFactor = 0.5; // no offset so set offset factor to half width to draw on centre line } else { OffsetFactor = 1.0; // full offset required } }
/// <summary> /// Створює коллекцію мультітекстових обектів заголовку таблиці та заголовків колонок таблиці. /// </summary> /// <param name="titleTable">Заголовок таблиці.</param> /// <param name="settingTable">Налаштування таблиці.</param> /// <returns> /// Повертає <see cref="T:AcDb.DBObjectCollection"/>, що містить мультитекстові обекти заголовку таблиці та заголовків колонок таблиці /// </returns> internal static AcDb.DBObjectCollection GetCapTables(string titleTable, SettingTable settingTable) { AcDb.DBObjectCollection objects = new AcDb.DBObjectCollection(); AcDb.MText textValue; AcGe.Point3d insertPoint = AcGe.Point3d.Origin; /*Заголовок таблиці*/ textValue = new AcDb.MText(); textValue.TextHeight = settingTable.TextHeight; textValue.LineSpaceDistance = settingTable.TextHeight * 0.7; textValue.Attachment = AcDb.AttachmentPoint.BottomCenter; textValue.Contents = titleTable; textValue.Location = settingTable.BasePointDrawing .Add(new AcGe.Vector3d(settingTable.GetWidthTable() / 2, settingTable.TextHeight, 0)); objects.Add(textValue); /*Заголовоки колонок таблиці*/ double colWidth = 0; foreach (ColumnTable value in settingTable.Columns) { colWidth += value.Width; insertPoint = new AcGe.Point3d(colWidth - value.Width / 2, settingTable.TextHeight / 2 * -1, 0); textValue = new AcDb.MText(); textValue.TextHeight = settingTable.TextHeight; textValue.LineSpaceDistance = settingTable.TextHeight * 2; textValue.Attachment = AcDb.AttachmentPoint.TopCenter; textValue.Contents = value.Name; textValue.Location = settingTable.BasePointDrawing.Add(insertPoint.GetAsVector()); objects.Add(textValue); } return(objects); }
/// <summary> /// Створює коллекцію текстових обектів значень данних таблиці виносу внатуру меж земельної ділянки. /// </summary> /// <param name="polygon">Земельна ділянка.</param> /// <param name="settingTable">Налаштування таблиці.</param> /// <returns> /// Повертає <see cref="T:AcDb.DBObjectCollection"/>, що містить текстові значення данний таблиці виносу внатуру меж земельної ділянки. /// </returns> internal static AcDb.DBObjectCollection GetDataTableStakeOutParcelPoints(LandParcel polygon, SettingTable settingTable) { List <StakeOutParcelPoint> stakeoutPoints = polygon.StakeOutParcelPoints; //stakeoutPoints.Sort((x, y) => y.PointStation.Name.CompareTo(x.PointStation.Name)); AcDb.DBObjectCollection objects = new AcDb.DBObjectCollection(); AcDb.DBText textValue; AcGe.Point3d insertPoint; //AcGe.Point2d backPoint, stationPoint, parcelPoint; double heightTable = (settingTable.GetHeightCapTable() + settingTable.TextHeight) * -1; int index = -1; foreach (StakeOutParcelPoint stakeoutPoint in stakeoutPoints) { index++; double colWidth = 0; heightTable += settingTable.TextHeight * 2 * index; foreach (ColumnTable col in settingTable.Columns) { colWidth += col.Width; insertPoint = new AcGe.Point3d(); insertPoint = new AcGe.Point3d ( colWidth - col.Width / 2, (settingTable.GetHeightCapTable() + (index + 1) * settingTable.TextHeight * 2) * -1, 0 ); textValue = new AcDb.DBText(); textValue.Height = settingTable.TextHeight; textValue.Justify = AcDb.AttachmentPoint.BottomCenter; textValue.Position = settingTable.BasePointDrawing.Add(insertPoint.GetAsVector()); textValue.AlignmentPoint = textValue.Position; if (col.Format.IndexOf("Number") > -1) { textValue.TextString = stakeoutPoint.Name; } else if (col.Format.IndexOf("X") > -1) { textValue.TextString = stakeoutPoint.Coordinates.X.ToString("0.00"); } else if (col.Format.IndexOf("Y") > -1) { textValue.TextString = stakeoutPoint.Coordinates.Y.ToString("0.00"); } else if (col.Format.IndexOf("LengthLine") > -1) { textValue.TextString = stakeoutPoint.Distance.ToString("0.00"); } else if (col.Format.IndexOf("DirAngle") > -1) { textValue.TextString = stakeoutPoint.DirAngleToString(AcRx.AngularUnitFormat.DegreesMinutesSeconds); } else if (col.Format.IndexOf("InnerAngle") > -1) { textValue.TextString = stakeoutPoint.LeftlAngleToString(AcRx.AngularUnitFormat.DegreesMinutesSeconds); } else if (col.Format.IndexOf("BasePoints_dirAngle") > -1) { textValue.TextString = stakeoutPoint.PointStation.Name; } else if (col.Format.IndexOf("BasePoints_innerAngle") > -1) { textValue.TextString = stakeoutPoint.PointStation.Name + " -> " + stakeoutPoint.PointOrientation.Name; } else { textValue.TextString = "None"; } textValue.TextString = textValue.TextString.Replace(",", "."); textValue.TextString = FormatAngleValue(textValue.TextString); objects.Add(textValue); } } return(objects); }
/// <summary> /// Створює коллекцію текстових обектів значень данних таблиці межі земельної ділянки. /// </summary> /// <param name="polygon">Ділянка, що є вихідною для таблиці.</param> /// <param name="settingTable">Налаштування таблиці.</param> /// <returns> /// Повертає <see cref="T:AcDb.DBObjectCollection"/>, що містить текстові значення данний таблиці межі земельної ділянки. /// </returns> internal static AcDb.DBObjectCollection GetDataTableBorderPolygon(LandParcel polygon, SettingTable settingTable) { AcDb.DBObjectCollection objects = new AcDb.DBObjectCollection(); AcDb.DBText textValue; AcGe.Point3d insertPoint; AcGe.Point2d backPoint, currentPoint, frontPoint; double heightTable = (settingTable.GetHeightCapTable() + settingTable.TextHeight) * -1; for (int index = 0; index <= polygon.Points.Count; index++)//(Point2d point in polygon.Points) { double colWidth = 0; heightTable += settingTable.TextHeight * 2 * index; if (index == 0) { backPoint = polygon.Points.ToArray()[polygon.Points.Count - 1]; currentPoint = polygon.Points.ToArray()[index]; frontPoint = polygon.Points.ToArray()[index + 1]; } else if (index == polygon.Points.Count - 1) { backPoint = polygon.Points.ToArray()[index - 1]; currentPoint = polygon.Points.ToArray()[index]; frontPoint = polygon.Points.ToArray()[0]; } else if (index == polygon.Points.Count) { backPoint = polygon.Points.ToArray()[index - 1]; currentPoint = polygon.Points.ToArray()[0]; frontPoint = polygon.Points.ToArray()[1]; } else { backPoint = polygon.Points.ToArray()[index - 1]; currentPoint = polygon.Points.ToArray()[index]; frontPoint = polygon.Points.ToArray()[index + 1]; } foreach (ColumnTable col in settingTable.Columns) { colWidth += col.Width; insertPoint = new AcGe.Point3d(); insertPoint = new AcGe.Point3d(colWidth - col.Width / 2, (settingTable.GetHeightCapTable() + (index + 1) * settingTable.TextHeight * 2) * -1, 0); textValue = new AcDb.DBText(); textValue.Height = settingTable.TextHeight; textValue.Justify = AcDb.AttachmentPoint.BottomCenter; textValue.Position = settingTable.BasePointDrawing.Add(insertPoint.GetAsVector()); textValue.AlignmentPoint = textValue.Position; if (col.Format.IndexOf("Number") > -1) { if (index == polygon.Points.Count) { textValue.TextString = "1"; } else { textValue.TextString = Math.Abs(index + 1).ToString(); } } else if (col.Format.IndexOf("X") > -1) { textValue.TextString = currentPoint.X.ToString("0.00"); } else if (col.Format.IndexOf("Y") > -1) { textValue.TextString = currentPoint.Y.ToString("0.00"); } else if (col.Format.IndexOf("LengthLine") > -1) { if (index < polygon.Points.Count) { textValue.Position = textValue.Position.Add(new AcGe.Vector3d(0, settingTable.TextHeight * -1, 0)); textValue.AlignmentPoint = textValue.Position; textValue.TextString = currentPoint.GetDistanceTo(frontPoint).ToString("0.00"); } } else if (col.Format.IndexOf("DirAngle") > -1) { if (index < polygon.Points.Count) { textValue.Position = textValue.Position.Add(new AcGe.Vector3d(0, settingTable.TextHeight * -1, 0)); textValue.AlignmentPoint = textValue.Position; double angle = ServiceGeodesy.GetDirAngle(currentPoint, frontPoint); textValue.TextString = AcRx.Converter.AngleToString(angle, AcRx.AngularUnitFormat.DegreesMinutesSeconds, 3); } } else if (col.Format.IndexOf("InnerAngle") > -1) { double angle = ServiceGeodesy.GetRightAngle(backPoint, currentPoint, frontPoint); textValue.TextString = AcRx.Converter.AngleToString(angle, AcRx.AngularUnitFormat.DegreesMinutesSeconds, 3); } else { textValue.TextString = "None"; } textValue.TextString = textValue.TextString.Replace(",", "."); for (int i = 0; i < 10; i++) { textValue.TextString = textValue.TextString .Replace("°" + i.ToString() + "'", "°" + i.ToString("00") + "'"); } for (int i = 0; i < 10; i++) { textValue.TextString = textValue.TextString .Replace("'" + i.ToString() + "\"", "'" + i.ToString("00") + "\""); } objects.Add(textValue); } } return(objects); }