public void ShowMemberInText() { List <vdLine> list_lines = new List <vdLine>(); vdSelection gripset = GetGripSelection(false); //if (gripset.Count > 1) return; vdLine ln; foreach (vdFigure fig in gripset) { ln = fig as vdLine; if (ln != null) { list_lines.Add(ln); } } foreach (vdLine line in list_lines) { list_mem_No.Add(GetMemberNo(line)); } list_mem_No.Sort(); for (int i = 0; i < list_mem_No.Count; i++) { if (i == list_mem_No.Count - 1) { txt_member_nos.Text += list_mem_No[i].ToString(); } else { txt_member_nos.Text += list_mem_No[i].ToString() + ","; } } }
private vdSelection GetGripsCollection() { Childform frm = this.ActiveMdiChild as Childform; if (frm == null) { return(null); } string selsetname = "VDGRIPSET_" + frm.vdScrollableControl1.BaseControl.ActiveDocument.ActiveLayOut.Handle.ToStringValue() + (frm.vdScrollableControl1.BaseControl.ActiveDocument.ActiveLayOut.ActiveViewPort != null ? frm.vdScrollableControl1.BaseControl.ActiveDocument.ActiveLayOut.ActiveViewPort.Handle.ToStringValue() : ""); vdSelection gripset = frm.vdScrollableControl1.BaseControl.ActiveDocument.ActiveLayOut.Document.Selections.FindName(selsetname); if (gripset == null) { gripset = frm.vdScrollableControl1.BaseControl.ActiveDocument.ActiveLayOut.Document.Selections.Add(selsetname); } return(gripset); }
private static bool CATCHMENT_ProcessTerrainSurveyData(vdDocument vdoc) { vdoc.Prompt("Click Left and Right mouse button on River Centre Line Polyline :"); vdSelection sel = vdoc.ActionUtility.getUserSelection(); vdFigure vfig = sel[0]; vdPolyline pline = vfig as vdPolyline; if (pline != null) { frm_Process_Terrain_Survey_data frm = new frm_Process_Terrain_Survey_data(pline); frm.txt_select_survey_data.Text = sample_data; frm.ShowDialog(); } return(false); }
private void ClearAllGrips(vdSelection GripSelection) { Childform frm = this.ActiveMdiChild as Childform; if (frm == null) { return; } foreach (vdFigure fig in GripSelection) { fig.ShowGrips = false; } if (GripSelection.Count > 0) { GripSelection.RemoveAll(); frm.vdScrollableControl1.BaseControl.ActiveDocument.ActiveLayOut.RefreshGraphicsControl(frm.vdScrollableControl1.BaseControl.ActiveDocument.ActiveLayOut.ActiveActionRender.control); } }
static bool Poly_JoinLinesToPolyline(vdDocument vdoc) { vdoc.Prompt("Select Lines or Polylines to Join:"); vdSelection sel = vdoc.ActionUtility.getUserSelection(); vdFigure vfig; vdPolyline pline = new vdPolyline(); vdLine ln = null; vdPolyline pln = null; double d1, d2; d1 = d2 = 0.0; foreach (vdFigure fig in sel) { if (fig is vdLine) { ln = fig as vdLine; if (pline.VertexList.Count > 0) { d1 = pline.VertexList[pline.VertexList.Count - 1].Distance3D(ln.StartPoint); d2 = pline.VertexList[pline.VertexList.Count - 1].Distance3D(ln.EndPoint); } if (d2 >= d1) { if (pline.VertexList.FindVertexPoint(ln.StartPoint) == -1) { pline.VertexList.Add(ln.StartPoint); } if (pline.VertexList.FindVertexPoint(ln.EndPoint) == -1) { pline.VertexList.Add(ln.EndPoint); } } else { if (pline.VertexList.FindVertexPoint(ln.EndPoint) == -1) { pline.VertexList.Add(ln.EndPoint); } if (pline.VertexList.FindVertexPoint(ln.StartPoint) == -1) { pline.VertexList.Add(ln.StartPoint); } } ln.Deleted = true; //vdoc.ActiveLayOut.Entities.RemoveItem(ln); } else if (fig is vdPolyline) { pln = fig as vdPolyline; if (pline.VertexList.Count > 0) { d1 = pline.VertexList[pline.VertexList.Count - 1].Distance3D(pln.VertexList[0]); d2 = pline.VertexList[pline.VertexList.Count - 1].Distance3D(pln.VertexList[pln.VertexList.Count - 1]); if (d1 > d2) { pln.VertexList.Reverse(); } } pline.VertexList.AddRange(pln.VertexList); pln.Deleted = true; //vdoc.ActiveLayOut.Entities.RemoveItem(pln); } } if (pline.VertexList.Count > 1) { pline.SetUnRegisterDocument(vdoc); pline.setDocumentDefaults(); vdoc.ActiveLayOut.Entities.AddItem(pline); } vdoc.Redraw(true); return(true); }
public void SetAlign() { vdFigure vdFig = null; vdLine stln = null; vdLine endln = null; object ret = null; gPoint EPT, SPT; gPoint FSP; // First Start Point gPoint FDP; // First Destination Point gPoint SSP; // Second Start Point gPoint SDP; // Second Destination Point vdSelection vdSel = null; document.Prompt("Select Entities:"); ret = document.ActionUtility.getUserSelection(); document.Prompt(null); if (ret == null || !(ret is vdSelection)) { return; } vdSel = ret as vdSelection; document.Prompt("Enter First Source Point:"); ret = document.ActionUtility.getUserPoint(); document.Prompt(null); if (ret == null || !(ret is gPoint)) { return; } FSP = ret as gPoint; document.Prompt("Enter First Destination Point:"); ret = document.ActionUtility.getUserPoint(); document.Prompt(null); if (ret == null || !(ret is gPoint)) { return; } FDP = ret as gPoint; document.Prompt("Enter Second Source Point:"); ret = document.ActionUtility.getUserPoint(); document.Prompt(null); if (ret == null || !(ret is gPoint)) { return; } SSP = ret as gPoint; document.Prompt("Enter Second Destination Point:"); ret = document.ActionUtility.getUserPoint(); document.Prompt(null); if (ret == null || !(ret is gPoint)) { return; } SDP = ret as gPoint; //endln.StartPoint = FSP //stln.StartPoint = FDP //endln.EndPoint = SSP //stln.EndPoint = SDP FSP.z = 0.0; SSP.z = 0.0; FDP.z = 0.0; SDP.z = 0.0; stln = new vdLine(FDP, SDP); endln = new vdLine(FSP, SSP); double scaleFactor = stln.Length() / endln.Length(); document.CommandAction.CmdScale(vdSel, endln.StartPoint, scaleFactor); document.CommandAction.CmdMove(vdSel, endln.StartPoint, stln.StartPoint); double ang = stln.StartPoint.GetAngle(stln.EndPoint); double ang1 = endln.StartPoint.GetAngle(endln.EndPoint); ang = ang - ang1; document.CommandAction.CmdRotate(vdSel, stln.StartPoint, ang); }
void BaseControl_SelectionsAddItem(vdSelections sender, vdSelection item, ref bool cancel) { //if (pdg != null) // pdg.SelectedObject = item; vdScrollableControl1.Focus(); }
public void Get_Selected_Beams() { foreach (vdFigure fig in VDoc.ActiveLayOut.Entities) { fig.LineWeight = VectorDraw.Professional.Constants.VdConstLineWeight.LW_BYLAYER; fig.Update(); } vdSelection gripset = GetGripSelection(false); if (gripset == null) { return; } vdDocument VD = VDoc; List <int> members = new List <int>(); string kStr = ""; foreach (vdFigure fig in gripset) { if (fig is vdPolyline) { //if (gripset.Count > 1) // gripset.RemoveAt(0); fig.LineWeight = VectorDraw.Professional.Constants.VdConstLineWeight.LW_158; MyStrings ml = new MyStrings(fig.ToolTip.ToUpper(), ' '); if (ml.StringList[0].StartsWith("MEMBER")) { if (kStr == "") { kStr = ml.GetString(3); } else { kStr += " , " + ml.GetString(3); } Fill_Slab(ml.GetString(3)); //gripset.RemoveItem(fig); } fig.Update(); } else { fig.LineWeight = VectorDraw.Professional.Constants.VdConstLineWeight.LW_158; MyStrings ml = new MyStrings(fig.ToolTip.ToUpper(), ' '); if (ml.StringList[0].StartsWith("MEMBER")) { kStr += ml.GetInt(3) + " "; //if (!members.Contains(ml.GetInt(3))) // members.Add(ml.GetInt(3)); } fig.Update(); } } txt_beam_nos.Text = kStr; Show_Data(); VDoc.Redraw(true); }
void BaseControl_vdMouseDown(MouseEventArgs e, ref bool cancel) { Childform frm = this.ActiveMdiChild as Childform; if (frm == null) { return; } if (e.Button != MouseButtons.Left) { return; } if (frm.vdScrollableControl1.BaseControl.ActiveDocument.ActiveLayOut.OverAllActiveActions == null) { return; } if (frm.vdScrollableControl1.BaseControl.ActiveDocument.ActiveLayOut.OverAllActiveActions.Count > 1) { return; } if (frm.vdScrollableControl1.BaseControl.ActiveDocument.ActiveLayOut.ActiveAction is VectorDraw.Professional.CommandActions.ActionLine) { return; } vdSelection GripEntities = GetGripsCollection(); gPoint p1 = frm.vdScrollableControl1.BaseControl.ActiveDocument.ActiveLayOut.ActiveActionRender.World2Pixelmatrix.Transform(frm.vdScrollableControl1.BaseControl.ActiveDocument.ActiveLayOut.OverAllActiveAction.MouseLocation); gPoint p1viewCS = frm.vdScrollableControl1.BaseControl.ActiveDocument.ActiveLayOut.ActiveActionRender.CurrentMatrix.Transform(frm.vdScrollableControl1.BaseControl.ActiveDocument.ActiveLayOut.OverAllActiveAction.MouseLocation); Point location = new Point((int)p1.x, (int)p1.y); #region Grip Move Code if (System.Windows.Forms.Control.ModifierKeys == Keys.None) { Box box = new Box(); box.AddPoint(p1viewCS); box.AddWidth(frm.vdScrollableControl1.BaseControl.ActiveDocument.ActiveLayOut.ActiveActionRender.GlobalProperties.GripSize * frm.vdScrollableControl1.BaseControl.ActiveDocument.ActiveLayOut.ActiveActionRender.PixelSize / 2.0d); vdSelection selset = new vdSelection(); vdArray <Int32Array> indexesArray = new vdArray <Int32Array>(); gPoint pt = frm.vdScrollableControl1.BaseControl.ActiveDocument.ActiveLayOut.Document.World2UserMatrix.Transform(frm.vdScrollableControl1.BaseControl.ActiveDocument.ActiveLayOut.OverAllActiveAction.MouseLocation); foreach (vdFigure fig in GripEntities) { Int32Array indexes = frm.vdScrollableControl1.BaseControl.ActiveDocument.ActiveLayOut.getGripIndexes(fig, box); if (indexes.Count != 0) { selset.AddItem(fig, false, vdSelection.AddItemCheck.Nochecking); indexesArray.AddItem(indexes); } } if (selset.Count > 0) { VectorDraw.Professional.ActionUtilities.CmdMoveGripPoints MoveGrips = new VectorDraw.Professional.ActionUtilities.CmdMoveGripPoints(pt, frm.vdScrollableControl1.BaseControl.ActiveDocument.ActiveLayOut, selset, indexesArray); frm.vdScrollableControl1.BaseControl.ActiveDocument.ActiveLayOut.ActionAdd(MoveGrips); VectorDraw.Actions.StatusCode ret = MoveGrips.WaitToFinish(); cancel = true; return; } } #endregion #region One by One implementation vdFigure Fig = null; Fig = frm.vdScrollableControl1.BaseControl.ActiveDocument.ActiveLayOut.GetEntityFromPoint(location, frm.vdScrollableControl1.BaseControl.ActiveDocument.ActiveLayOut.ActiveActionRender.GlobalProperties.PickSize, false, vdDocument.LockLayerMethodEnum.EnableGetObjectGrip); frm.vdScrollableControl1.BaseControl.ActiveDocument.ActiveLayOut.Document.LockLayerMethodStack.Push(vdDocument.LockLayerMethodEnum.DisableAll | ((frm.vdScrollableControl1.BaseControl.ActiveDocument.ActiveLayOut.Document.LockLayerMethod & vdDocument.LockLayerMethodEnum.EnableGetObjectGrip) != 0 ? vdDocument.LockLayerMethodEnum.EnableAddToSelections : 0)); bool bShift = ((System.Windows.Forms.Control.ModifierKeys & Keys.Shift) == Keys.Shift); if (Fig != null) { ClearAllGrips(GripEntities); GripEntities.AddItem(Fig, true, vdSelection.AddItemCheck.RemoveInVisibleEntities); if (cancel) { Fig.ShowGrips = false; } else { Fig.ShowGrips = true; } frm.vdScrollableControl1.BaseControl.ActiveDocument.ActiveLayOut.RefreshGraphicsControl(frm.vdScrollableControl1.BaseControl.ActiveDocument.ActiveLayOut.ActiveActionRender.control); // DrawGrips(GripEntities); } frm.vdScrollableControl1.BaseControl.ActiveDocument.ActiveLayOut.Document.LockLayerMethodStack.Pop(); #endregion }