addTableData(ObjectId idTable, List <POI> varpoi) { using (Transaction tr = BaseObjs.startTransactionDb()) { Table objTable = (Table)tr.GetObject(idTable, OpenMode.ForWrite); objTable.SuppressRegenerateTable(true); for (int i = 0; i < varpoi.Count; i++) { objTable.Cells[i + 2, 0].TextString = i.ToString(); objTable.Cells[i + 2, 1].TextString = varpoi[i].ClassObj; objTable.Cells[i + 2, 2].TextString = varpoi[i].Desc0; objTable.Cells[i + 2, 3].TextString = varpoi[i].DescX; objTable.Cells[i + 2, 4].TextString = string.Format("{0:###+##.00}", varpoi[i].Station); objTable.Cells[i + 2, 5].TextString = string.Format("{0:###.00}", System.Math.Round(varpoi[i].OFFSET, 3)); objTable.Cells[i + 2, 6].TextString = string.Format("{0:#####.000}", System.Math.Round(varpoi[i].Elevation, 3)); objTable.Cells[i + 2, 7].TextString = varpoi[i].ElevTOW.ToString(); objTable.Cells[i + 2, 8].TextString = varpoi[i].ElevTOF.ToString(); objTable.Cells[i + 2, 9].TextString = varpoi[i].Invert.ToString(); objTable.Cells[i + 2, 10].TextString = varpoi[i].Size.ToString(); objTable.Cells[i + 2, 11].TextString = varpoi[i].AngDelta.ToString(); objTable.Cells[i + 2, 12].TextString = varpoi[i].AngDir.ToString(); objTable.Cells[i + 2, 13].TextString = varpoi[i].AngChord.ToString(); objTable.Cells[i + 2, 14].TextString = varpoi[i].isRightHand.ToString(); objTable.Cells[i + 2, 15].TextString = varpoi[i].isClosed.ToString(); objTable.Cells[i + 2, 16].TextString = varpoi[i].isStep.ToString(); objTable.Cells[i + 2, 17].TextString = varpoi[i].CrossDesc; objTable.Cells[i + 2, 18].TextString = varpoi[i].CrossAlign; objTable.Cells[i + 2, 19].TextString = varpoi[i].CrossAlignInv.ToString(); objTable.Cells[i + 2, 20].TextString = varpoi[i].CrossAlignSta.ToString(); objTable.Cells[i + 2, 21].TextString = varpoi[i].CrossAlignSize.ToString(); objTable.Cells[i + 2, 22].TextString = varpoi[i].PntNum; objTable.Cells[i + 2, 23].TextString = varpoi[i].PntSource; objTable.Cells[i + 2, 24].TextString = varpoi[i].Type; objTable.Cells[i + 2, 25].TextString = varpoi[i].Bulge.ToString(); objTable.Cells[i + 2, 26].TextString = varpoi[i].Radius.ToString(); objTable.Cells[i + 2, 27].TextString = varpoi[i].Side.ToString(); objTable.Cells[i + 2, 28].TextString = varpoi[i].SlopeAhead.ToString(); objTable.Cells[i + 2, 29].TextString = varpoi[i].SlopeBack.ToString(); objTable.Cells[i + 2, 30].TextString = varpoi[i].SlopeH2H.ToString(); objTable.Cells[i + 2, 31].TextString = varpoi[i].CenterPnt.X.ToString(); objTable.Cells[i + 2, 32].TextString = varpoi[i].CenterPnt.Y.ToString(); } objTable.SuppressRegenerateTable(false); tr.Commit(); } }
updateTableData(ObjectId idTable, List <POI> varpoi) { using (Transaction tr = BaseObjs.startTransactionDb()) { Table objTable = (Table)tr.GetObject(idTable, OpenMode.ForWrite); int lngRows = objTable.Rows.Count - 3; //1 for Zero base and 2 for top two rows = 3 Debug.Print(lngRows.ToString()); int lngRowsDiff = varpoi.Count - lngRows; Debug.Print(lngRowsDiff.ToString()); if (lngRowsDiff < 0) { objTable.DeleteRows(lngRows + lngRowsDiff, System.Math.Abs(lngRowsDiff)); } else if (lngRowsDiff > 0) { objTable.InsertRows(lngRows, 5, lngRowsDiff); } objTable.SuppressRegenerateTable(true); for (int i = 2; i < objTable.Rows.Count; i++) { for (int j = 0; j < objTable.Columns.Count; j++) { objTable.Cells[i, j].DeleteContent(); } } tr.Commit(); } addTableData(idTable, varpoi); }
makeTable(ObjectId idAlign, List <POI> varpoi, AlgnData varAlignData = null, object varPntUpper = null) { Alignment objAlign = (Alignment)idAlign.getEnt(); string strLayerName = "TABLES"; Layer.manageLayers(strLayerName); Extents3d ext3d; Point3d pnt3dMin = Pub.pnt3dO, pnt3dMax = Pub.pnt3dO, pnt3dIns = Pub.pnt3dO; Table objTable = null; ObjectId idTable = ObjectId.Null; int numRows = varpoi.Count + 2; int numCols = 33; double rowHeight = 5; double colWidth = 30; if ((varAlignData == null)) { if ((varPntUpper == null)) { ProfileView objProfileView = (ProfileView)fStake.HandleProfileView.getEnt(); ext3d = (Extents3d)objProfileView.Bounds; pnt3dMin = ext3d.MinPoint; pnt3dMax = ext3d.MaxPoint; pnt3dIns = new Point3d(pnt3dMax.X + 10, pnt3dMax.Y, 0); idTable = Draw.addTable(pnt3dIns, numRows, numCols, rowHeight, colWidth); AlgnData algnData = new AlgnData(); algnData.AlignName = objAlign.Name; algnData.AlignHandle = objAlign.Handle; algnData.AlignLayer = objAlign.Layer; algnData.AlignID = objAlign.ObjectId; algnData.TableHandle = idTable.getHandle(); fStake.algnData.Add(algnData); } else //for WALL only { pnt3dIns = new Point3d(pnt3dMax.X + 10, pnt3dMax.Y, 0); idTable = Draw.addTable(pnt3dIns, numRows, numCols, rowHeight, colWidth); AlgnData algnData = new AlgnData(); algnData.AlignName = objAlign.Name; algnData.AlignHandle = objAlign.Handle; algnData.AlignLayer = objAlign.Layer; algnData.AlignID = objAlign.ObjectId; algnData.TableHandle = idTable.getHandle(); fStake.algnData.Add(algnData); } } else { ProfileView objProfileView = (ProfileView)fStake.HandleProfileView.getEnt(); ext3d = (Extents3d)objProfileView.Bounds; pnt3dMin = ext3d.MinPoint; pnt3dMax = ext3d.MaxPoint; pnt3dIns = new Point3d(pnt3dMax.X + 10, pnt3dMax.Y, 0); idTable = Draw.addTable(pnt3dIns, numRows, numCols, rowHeight, colWidth); varAlignData.TableHandle = idTable.getHandle(); } using (Transaction tr = BaseObjs.startTransactionDb()) { objTable = (Table)tr.GetObject(idTable, OpenMode.ForWrite); objTable.Layer = strLayerName; objTable.ColorIndex = 41; objTable.SuppressRegenerateTable(true); objTable.Cells[0, 0].TextString = objAlign.Name; objTable.Cells[1, 0].TextString = "INDEX"; objTable.Cells[1, 1].TextString = "CLASS"; objTable.Cells[1, 2].TextString = "DESCO"; objTable.Cells[1, 3].TextString = "DESCX"; objTable.Cells[1, 4].TextString = "STATION"; objTable.Cells[1, 5].TextString = "OFFSET"; objTable.Cells[1, 6].TextString = "ELEVATION"; objTable.Cells[1, 7].TextString = "TOW"; objTable.Cells[1, 8].TextString = "TOF"; objTable.Cells[1, 9].TextString = "INVERT"; objTable.Cells[1, 10].TextString = "SIZE"; objTable.Cells[1, 11].TextString = "ANGDELTA"; objTable.Cells[1, 12].TextString = "ANGDIR"; objTable.Cells[1, 13].TextString = "ANGCHORD"; objTable.Cells[1, 14].TextString = "ISRIGHTHAND"; objTable.Cells[1, 15].TextString = "ISCLOSED"; objTable.Cells[1, 16].TextString = "ISSTEP"; objTable.Cells[1, 17].TextString = "CROSSDESC"; objTable.Cells[1, 18].TextString = "CROSSALIGN"; objTable.Cells[1, 19].TextString = "CROSSALIGNINV"; objTable.Cells[1, 20].TextString = "CROSSALIGNSTA"; objTable.Cells[1, 21].TextString = "CROSSALIGNSIZE"; objTable.Cells[1, 22].TextString = "PNTNUM"; objTable.Cells[1, 23].TextString = "PNTSOURCE"; objTable.Cells[1, 24].TextString = "TYPE"; objTable.Cells[1, 25].TextString = "BULGE"; objTable.Cells[1, 26].TextString = "RADIUS"; objTable.Cells[1, 27].TextString = "SIDE"; objTable.Cells[1, 28].TextString = "SLOPEAHEAD"; objTable.Cells[1, 29].TextString = "SLOPEBACK"; objTable.Cells[1, 30].TextString = "SLOPEH2H"; objTable.Cells[1, 31].TextString = "XCEN"; objTable.Cells[1, 32].TextString = "YCEN"; objTable.Columns[0].Width = 18.0; objTable.Columns[1].Width = 18.0; objTable.Columns[4].Width = 18.0; objTable.Columns[5].Width = 18.0; objTable.Columns[6].Width = 18.0; objTable.Columns[9].Width = 18.0; objTable.Columns[10].Width = 18.0; for (int i = 0; i < objTable.Rows.Count; i++) { for (int j = 0; j < objTable.Columns.Count; j++) { objTable.Cells[i, j].TextHeight = 0.09 * Misc.getCurrAnnoScale(); objTable.Cells[i, j].Alignment = CellAlignment.MiddleCenter; } } objTable.SuppressRegenerateTable(false); tr.Commit(); } TypedValue[] tvs = new TypedValue[2] { new TypedValue(1001, "TABLE"), new TypedValue(1005, objTable.Handle) }; objAlign.ObjectId.setXData(tvs, "TABLE"); Stake_Dict.updateDictSTAKE(); return(objTable.ObjectId); }