private void AddAreaAndPerimetr() { AcDb.Polyline2d borderParcel = ServiceSimpleElements.CreatePolyline2d(this.Parcel.Points, true); AcDb.MText oMText = new AcDb.MText(); oMText.TextHeight = 2.5 * this.SettingsForm.ScaleDrawing; oMText.Attachment = AcDb.AttachmentPoint.MiddleCenter; if (SettingsForm.DisplayArea && SettingsForm.UnitArea) { oMText.Contents = borderParcel.Area.ToString("Площа ділянки: S=0.00") + " кв.м"; } else if (SettingsForm.DisplayArea && !SettingsForm.UnitArea) { oMText.Contents = (borderParcel.Area / 10000).ToString("Всього: 0.0000") + " га"; } if (SettingsForm.DisplayPerimeter) { oMText.Contents = oMText.Contents + "\n" + borderParcel.Length.ToString("Периметр: 0.00") + " м"; } if (SettingsForm.DisplayArea || SettingsForm.UnitArea) { oMText.Contents = oMText.Contents.Replace(',', '.'); } ServiceSimpleElements.ManualInsertMText(oMText); }
private void AddLengthLine() { //AcDb.DBText oText; AcDb.MText oMText; AcDb.Line lineCur = null; AcDb.ObjectId idLineCur; AcGe.Point2d startPoint = this.Parcel.Points.ToArray()[this.Parcel.Points.Count - 1]; AcGe.Point3d midPoint; foreach (AcGe.Point2d endPoint in this.Parcel.Points) { midPoint = new AcGe.Point3d((endPoint.X + startPoint.X) / 2, (endPoint.Y + startPoint.Y) / 2, 0); lineCur = new AcDb.Line(new AcGe.Point3d(startPoint.X, startPoint.Y, 0), new AcGe.Point3d(endPoint.X, endPoint.Y, 0)); lineCur.ColorIndex = 222; lineCur.LineWeight = AcDb.LineWeight.LineWeight030; idLineCur = ServiceCAD.InsertObject(lineCur); ServiceCAD.ZoomCenter(midPoint, 1); /* * oText = new AcDb.DBText(); * oText.Height = 2 * this.SettingsForm.ScaleDrawing; * oText.TextString = startPoint.GetDistanceTo(endPoint).ToString("0.00").Replace(",","."); * //oText.Layer = settingsDrawing.Plan.LengthLine.Layer; * * ServiceCAD.ManualInsertText(oText); */ oMText = new AcDb.MText(); oMText.TextHeight = 2 * this.SettingsForm.ScaleDrawing; oMText.Attachment = AcDb.AttachmentPoint.MiddleCenter; //oMText.Layer = settingsDrawing.Plan.LengthLine.Layer; oMText.Contents = startPoint.GetDistanceTo(endPoint).ToString("0.00").Replace(",", "."); ServiceCAD.ZoomCenter(midPoint, 1); ServiceSimpleElements.ManualInsertMText(oMText); ServiceCAD.DeleteObject(idLineCur); startPoint = endPoint; } }
private void AddNumdersPoints() { int iCurNumberPoint = 0; //AcDb.DBText oText; AcDb.MText oMText; AcDb.Circle circleCurPoint = null; AcDb.ObjectId idCircleCurPoint; foreach (AcGe.Point2d point in this.Parcel.Points) { iCurNumberPoint += 1; circleCurPoint = new AcDb.Circle( new AcGe.Point3d(point.X, point.Y, 0), new AcGe.Vector3d(0, 0, 1), 1.75 * this.SettingsForm.ScaleDrawing); circleCurPoint.ColorIndex = 222; circleCurPoint.LineWeight = AcDb.LineWeight.LineWeight030; idCircleCurPoint = ServiceCAD.InsertObject(circleCurPoint); /* * oText = new AcDb.DBText(); * oText.TextString = Convert.ToString(iCurNumberPoint); * oText.Height = settingsDrawing.Plan.NumberPoint.TextHeight * this.SettingsForm.ScaleDrawing; * //oText.Layer = settingsDrawing.Plan.NumberPoint.Layer; */ oMText = new AcDb.MText(); oMText.TextHeight = 2 * this.SettingsForm.ScaleDrawing; oMText.Attachment = AcDb.AttachmentPoint.MiddleCenter; //oMText.Layer = settingsDrawing.Plan.LengthLine.Layer; oMText.Contents = Convert.ToString(iCurNumberPoint); ServiceCAD.ZoomCenter(new AcGe.Point3d(point.X, point.Y, 0), 1); ServiceSimpleElements.ManualInsertMText(oMText); ServiceCAD.DeleteObject(idCircleCurPoint); } }
private void AddTextNeighbors() { AcDb.MText oMText = new AcDb.MText(); oMText.TextHeight = 2.5 * this.SettingsForm.ScaleDrawing; oMText.Width = 300; oMText.Height = 100; oMText.Attachment = AcDb.AttachmentPoint.MiddleLeft; //oMText.Layer = settingsDrawing.Plan.Neighbors.Layer; oMText.Contents = "\\L{\\fArial|b1|i0|c204|p34;Опис меж:}\\l\r\n"; int indexContentsNeighbors = -1; foreach (TextNeighbors textNeighbors in this.allTextNeighbors) { indexContentsNeighbors++; if (indexContentsNeighbors > 0) { oMText.Contents += "\r\n"; if (indexContentsNeighbors == 1) { oMText.Contents += "\r\n" + "\\L{\\fArial|b1|i0|c204|p34;Інші землекористувачі:}\\l" + ""; } if (this.allTextNeighbors.Count > 2) { oMText.Contents += "\r\n" + "{\\fArial|b1|i0|c204|p34;Контур №" + indexContentsNeighbors.ToString("0") + "}"; } oMText.Contents += "\r\n"; } foreach (string value in textNeighbors.ToListValue()) { oMText.Contents += "\r\n" + value; } } ServiceSimpleElements.ManualInsertMText(oMText); }