static List <AcDb.ObjectId> InsertAllParcel(BL blockLand, AcGe.Vector2d offset) { AcDb.Polyline2d curPolyline; AcGe.Point2dCollection points; List <AcDb.ObjectId> listObjectId = new List <AcDb.ObjectId>(); foreach (SR sr in blockLand.SR) { points = ServiceSimpleElements.Offset(ServiceIn4.GetPoints2dFromIn4Polygon(sr), offset); curPolyline = ServiceSimpleElements.CreatePolyline2d(points, true); listObjectId.Add(ServiceCAD.InsertObject(curPolyline)); } return(listObjectId); }
private void BtnSelectFile_Click(object sender, EventArgs e) { Stream myStream = null; OpenFileDialog openDialogIn4 = new OpenFileDialog { InitialDirectory = new LocalPath("LoSa_Land").FindFullPathFromXml("PathExpotrSDR"), Filter = "Файл обміну (*.in4)|*.in4|Усі файли (*.*)|*.*" }; if (openDialogIn4.ShowDialog() == DialogResult.OK) { try { if ((myStream = openDialogIn4.OpenFile()) != null) { PurgeFromElementsBlockLand(); } } catch (System.Exception ex) { MessageBox.Show("Помилка: " + ex.Message); } this.comboBoxNumberParcel.Items.Clear(); this.currentBlockLand = ServiceIn4.GetDataFromFileIN4(openDialogIn4.FileName); //int indexSR = 0; foreach (SR currentSR in this.currentBlockLand.SR) { if (currentSR.SC != null) { this.comboBoxNumberParcel.Items.Add(currentSR.SC); } else { MessageBox.Show(" !!!!!! currentSR.SC == null"); return; } //indexSR++; } this.comboBoxNumberParcel.SelectedIndex = 0; allIdBlockLandParcel = InsertAllParcel(currentBlockLand, this.offsetBlockLandView); ServiceCAD.ZoomExtents(); } }
private void ComboBoxNumberParcel_SelectedIndexChanged(object sender, EventArgs e) { this.Text = this.comboBoxNumberParcel.SelectedItem.ToString(); this.currentParcel = ServiceIn4.GetParcelForCadarstralNumber (this.currentBlockLand, this.comboBoxNumberParcel.SelectedItem.ToString()); if (!this.idCurrentHatchParcel.IsNull) { ServiceCAD.DeleteObject(this.idCurrentHatchParcel); ServiceCAD.DeleteObjects(this.idNeighborsCurrenParcel); } serviceParcel = new ServiceParcel(this.currentParcel, this.formSettings); AcGe.Point2dCollection pointsCurrentHatchParcel = ServiceSimpleElements.Offset(this.currentParcel.Points, this.offsetBlockLandView); AcDb.ObjectId idPolyline2d = ServiceCAD.InsertObject(ServiceSimpleElements.CreatePolyline2d(pointsCurrentHatchParcel, true)); AcDb.Hatch curHatch = ServiceSimpleElements.CreateHatch(new AcDb.ObjectIdCollection(new AcDb.ObjectId[] { idPolyline2d })); this.idCurrentHatchParcel = ServiceCAD.InsertObject(curHatch); ServiceCAD.DeleteObject(idPolyline2d); // ======================================================= if (this.currentParcel.StakeOutParcelPoints != null) { this.currentParcel.StakeOutParcelPoints.Clear(); } StakeOutParcelPoint stakeOutParcelPoint; this.dataGridView_StakeOut.ClearSelection(); this.dataGridView_StakeOut.Rows.Clear(); int indexPoint = 0; object[] row = new object[2]; foreach (AcGe.Point2d point in this.currentParcel.Points) { indexPoint++; stakeOutParcelPoint = new StakeOutParcelPoint { ScaleDrawing = this.drawingSettings.Scale.Value, Name = indexPoint.ToString(), Coordinates = point }; this.currentParcel.StakeOutParcelPoints.Add(stakeOutParcelPoint); row[0] = false; row[1] = indexPoint.ToString(); this.dataGridView_StakeOut.Rows.Add(row); } SetColPointStationAndOrientationItems(); AutoSearchingStationAndOrientationForAllPoints(); this.dataGridView_StakeOut.Update(); ReLoad_treeViewParcel(); }