private void btnAdd_Click(object sender, EventArgs e) { vizcore3d.BeginUpdate(); VIZCore3D.NET.Data.TextDrawingItem item = vizcore3d.TextDrawing.Add( new VIZCore3D.NET.Data.Vertex3D(txtCenterX.Text, txtCenterY.Text, txtCenterZ.Text) , new VIZCore3D.NET.Data.Vertex3D(txtDirX.Text, txtDirY.Text, txtDirZ.Text) , new VIZCore3D.NET.Data.Vertex3D(txtUpX.Text, txtUpY.Text, txtUpZ.Text) , Convert.ToSingle(txtSize.Text) , btnFontColor.BackColor , txtText.Text ); AddList(item); vizcore3d.Object3D.Select(Data.Object3dSelectionModes.DESELECT_ALL); vizcore3d.EndUpdate(); }
private void AddList(VIZCore3D.NET.Data.TextDrawingItem item) { ListViewItem lvi = new ListViewItem( new string[] { item.ID.ToString() , "" , item.Text , item.Center.ToString() , item.Direction.ToString() , item.UpDirection.ToString() , item.Height.ToString() , item.FontColor.ToString() } ); lvi.Tag = item; lvItems.Items.Add(lvi); }
private void btnDelete_Click(object sender, EventArgs e) { if (lvItems.SelectedItems.Count == 0) { return; } if (lvItems.SelectedItems[0].Tag == null) { return; } VIZCore3D.NET.Data.TextDrawingItem item = (VIZCore3D.NET.Data.TextDrawingItem)lvItems.SelectedItems[0].Tag; vizcore3d.BeginUpdate(); vizcore3d.TextDrawing.Delete(item.ID); lvItems.Items.Remove(lvItems.SelectedItems[0]); vizcore3d.EndUpdate(); }
private void btnTest_Click(object sender, EventArgs e) { VIZCore3D.NET.Data.Vertex3D center = new VIZCore3D.NET.Data.Vertex3D(txtCenterX.Text, txtCenterY.Text, txtCenterZ.Text); VIZCore3D.NET.Data.Vector3D dir = new VIZCore3D.NET.Data.Vector3D(txtDirX.Text, txtDirY.Text, txtDirZ.Text); VIZCore3D.NET.Data.Vector3D up = new VIZCore3D.NET.Data.Vector3D(txtUpX.Text, txtUpY.Text, txtUpZ.Text); System.Drawing.Color fontColor = btnFontColor.BackColor; int heightStart = Convert.ToInt32(txtHeight1.Text); int heightEnd = Convert.ToInt32(txtHeight2.Text); int sizeStart = Convert.ToInt32(txtSize1.Text); int sizeEnd = Convert.ToInt32(txtSize2.Text); int offsetHeight = Convert.ToInt32(txtOffsetHeight.Text); int offsetSize = Convert.ToInt32(txtOffsetSize.Text); bool fixingHeight = rbFixingHeight.Checked; bool fixingSize = rbFixingSize.Checked; vizcore3d.BeginUpdate(); lvItems.BeginUpdate(); if (fixingHeight == true) { int step = (sizeEnd - sizeStart) / offsetSize; for (int i = 0; i < step; i++) { int itemSize = sizeStart + (i * offsetSize); VIZCore3D.NET.Data.Vertex3D itemCenter = new VIZCore3D.NET.Data.Vertex3D(center.X, center.Y - (heightStart * i), center.Z); string title = string.Format("Height: {0} / Size: {1}", heightStart, itemSize); VIZCore3D.NET.Data.TextDrawingItem item = vizcore3d.TextDrawing.Add( itemCenter , dir , up , heightStart , itemSize , fontColor , title ); //AddList(item); } } else { int step = (heightEnd - heightStart) / offsetHeight; for (int i = 0; i < step; i++) { int itemHeight = heightStart + (i * offsetHeight); VIZCore3D.NET.Data.Vertex3D itemCenter = new VIZCore3D.NET.Data.Vertex3D(center.X, center.Y - (itemHeight * i), center.Z); string title = string.Format("Height: {0} / Size: {1}", itemHeight, sizeStart); VIZCore3D.NET.Data.TextDrawingItem item = vizcore3d.TextDrawing.Add( itemCenter , dir , up , itemHeight , sizeStart , fontColor , title ); //AddList(item); } } lvItems.EndUpdate(); vizcore3d.EndUpdate(); }