public void Create() { try { if (this.tv == null) { IPoint tmpPos = new GeometryFactory().CreatePoint(gviVertexAttribute.gviVertexAttributeZ) as IPoint; tmpPos.SetCoords(0, 0, 0, 0, 0); tmpPos.SpatialCRS = new CRSFactory().CreateFromWKT(CommonUnity.RenderHelper.GetCurrentCrsWKT()) as ISpatialCRS; this.tv = CommonUnity.RenderHelper.ObjectManager.CreateTerrainVideo(tmpPos, _Guid); if (this.tv != null) { this.guidstr = this.tv.Guid; } } } catch (COMException ex) { System.Diagnostics.Trace.WriteLine(ex.Message); return; } }
void axRenderControl1_RcMouseClickSelect2(IPickResult PickResult, IPoint IntersectPoint, gviModKeyMask Mask, gviMouseSelectMode EventSender) { if (IntersectPoint == null) return; if (EventSender.Equals(gviMouseSelectMode.gviMouseSelectClick)) { this.axRenderControl1.InteractMode = gviInteractMode.gviInteractNormal; this.axRenderControl1.RcMouseClickSelect -= new Gvitech.CityMaker.Controls._IRenderControlEvents_RcMouseClickSelectEventHandler(axRenderControl1_RcMouseClickSelect2); ISimplePointSymbol ps = new SimplePointSymbol(); ps.Size = 20; ps.FillColor = System.Drawing.Color.Red; this.axRenderControl1.ObjectManager.CreateRenderPoint(IntersectPoint, ps, rootId); for (int i = 0; i < videoList.Count; i++) { ITerrainVideo v = videoList[i]; v.Unhighlight(); double wx, wy; bool isIn = v.WorldToScreen(IntersectPoint, 1, out wx, out wy); if (isIn) { v.Highlight(System.Drawing.Color.Red); IPoint poiInWorld = v.ScreenToWorld(wx, wy); if (poiInWorld != null) { this.axRenderControl1.InteractMode = gviInteractMode.gviInteractFocus; bool bFocus = this.axRenderControl1.Camera.SetFocus(poiInWorld); if (bFocus) MessageBox.Show("set focus success!"); } } } } }
private void toolStripButtonHideVideo_Click(object sender, EventArgs e) { if ((sender as ToolStripButton).Text.Equals("隐藏视频")) { for (int i = 0; i < videoList.Count; i++) { ITerrainVideo v = videoList[i]; v.VisibleMask = gviViewportMask.gviViewNone; } } else { for (int i = 0; i < videoList.Count; i++) { ITerrainVideo v = videoList[i]; v.VisibleMask = gviViewportMask.gviViewAllNormalView; } } if ((sender as ToolStripButton).Text.Equals("隐藏视频")) (sender as ToolStripButton).Text = "显示视频"; else (sender as ToolStripButton).Text = "隐藏视频"; }
private void toolStripButtonHideProjectionLines_Click(object sender, EventArgs e) { if ((sender as ToolStripButton).Text.Equals("隐藏投影线")) { for (int i = 0; i < videoList.Count; i++) { ITerrainVideo v = videoList[i]; v.DisplayMode = gviTVDisplayMode.gviTVShowPicture; } } else { for (int i = 0; i < videoList.Count; i++) { ITerrainVideo v = videoList[i]; v.DisplayMode = gviTVDisplayMode.gviTVShowAll; } } if ((sender as ToolStripButton).Text.Equals("隐藏投影线")) (sender as ToolStripButton).Text = "显示投影线"; else (sender as ToolStripButton).Text = "隐藏投影线"; }
bool axRenderControl1_RcKeyUp(uint Flags, uint Ch) { if (curVideoIndex < 0) return false; switch (Ch) { #region 按键调整 case (uint)Keys.Q: { curVideo = videoList[curVideoIndex]; cp.X += factor; vector.Set(cp.X, cp.Y, cp.Z); positionPoint.Position = vector; curVideo.Position = positionPoint; //this.axRenderControl1.Camera.SetCamera(vector, angle, gviSetCameraFlags.gviSetCameraNoFlags); DataRow dr = dt.Rows[curRowIndex]; dr["Location"] = cp; } break; case (uint)Keys.W: { curVideo = videoList[curVideoIndex]; cp.X -= factor; vector.Set(cp.X, cp.Y, cp.Z); positionPoint.Position = vector; curVideo.Position = positionPoint; //this.axRenderControl1.Camera.SetCamera(vector, angle, gviSetCameraFlags.gviSetCameraNoFlags); DataRow dr = dt.Rows[curRowIndex]; dr["Location"] = cp; } break; case (uint)Keys.E: { curVideo = videoList[curVideoIndex]; cp.Y += factor; vector.Set(cp.X, cp.Y, cp.Z); positionPoint.Position = vector; curVideo.Position = positionPoint; //this.axRenderControl1.Camera.SetCamera(vector, angle, gviSetCameraFlags.gviSetCameraNoFlags); DataRow dr = dt.Rows[curRowIndex]; dr["Location"] = cp; } break; case (uint)Keys.R: { curVideo = videoList[curVideoIndex]; cp.Y -= factor; vector.Set(cp.X, cp.Y, cp.Z); positionPoint.Position = vector; curVideo.Position = positionPoint; //this.axRenderControl1.Camera.SetCamera(vector, angle, gviSetCameraFlags.gviSetCameraNoFlags); DataRow dr = dt.Rows[curRowIndex]; dr["Location"] = cp; } break; case (uint)Keys.T: { curVideo = videoList[curVideoIndex]; cp.Z += factor; vector.Set(cp.X, cp.Y, cp.Z); positionPoint.Position = vector; curVideo.Position = positionPoint; //this.axRenderControl1.Camera.SetCamera(vector, angle, gviSetCameraFlags.gviSetCameraNoFlags); DataRow dr = dt.Rows[curRowIndex]; dr["Location"] = cp; } break; case (uint)Keys.Y: { curVideo = videoList[curVideoIndex]; cp.Z -= factor; vector.Set(cp.X, cp.Y, cp.Z); positionPoint.Position = vector; curVideo.Position = positionPoint; //this.axRenderControl1.Camera.SetCamera(vector, angle, gviSetCameraFlags.gviSetCameraNoFlags); DataRow dr = dt.Rows[curRowIndex]; dr["Location"] = cp; } break; case (uint)Keys.U: { curVideo = videoList[curVideoIndex]; cp.Heading += factor; angle.Set(cp.Heading, cp.Tilt, cp.Roll); curVideo.Angle = angle; //this.axRenderControl1.Camera.SetCamera(vector, angle, gviSetCameraFlags.gviSetCameraNoFlags); DataRow dr = dt.Rows[curRowIndex]; dr["Location"] = cp; } break; case (uint)Keys.I: { curVideo = videoList[curVideoIndex]; cp.Heading -= factor; angle.Set(cp.Heading, cp.Tilt, cp.Roll); curVideo.Angle = angle; //this.axRenderControl1.Camera.SetCamera(vector, angle, gviSetCameraFlags.gviSetCameraNoFlags); DataRow dr = dt.Rows[curRowIndex]; dr["Location"] = cp; } break; case (uint)Keys.O: { curVideo = videoList[curVideoIndex]; cp.Tilt += factor; vector.Set(cp.X, cp.Y, cp.Z); angle.Set(cp.Heading, cp.Tilt, cp.Roll); curVideo.Angle = angle; //this.axRenderControl1.Camera.SetCamera(vector, angle, gviSetCameraFlags.gviSetCameraNoFlags); DataRow dr = dt.Rows[curRowIndex]; dr["Location"] = cp; } break; case (uint)Keys.P: { curVideo = videoList[curVideoIndex]; cp.Tilt -= factor; angle.Set(cp.Heading, cp.Tilt, cp.Roll); curVideo.Angle = angle; //this.axRenderControl1.Camera.SetCamera(vector, angle, gviSetCameraFlags.gviSetCameraNoFlags); DataRow dr = dt.Rows[curRowIndex]; dr["Location"] = cp; } break; case (uint)Keys.D: { curVideo = videoList[curVideoIndex]; cp.Roll += factor; angle.Set(cp.Heading, cp.Tilt, cp.Roll); curVideo.Angle = angle; //this.axRenderControl1.Camera.SetCamera(vector, angle, gviSetCameraFlags.gviSetCameraNoFlags); DataRow dr = dt.Rows[curRowIndex]; dr["Location"] = cp; } break; case (uint)Keys.F: { curVideo = videoList[curVideoIndex]; cp.Roll -= factor; angle.Set(cp.Heading, cp.Tilt, cp.Roll); curVideo.Angle = angle; //this.axRenderControl1.Camera.SetCamera(vector, angle, gviSetCameraFlags.gviSetCameraNoFlags); DataRow dr = dt.Rows[curRowIndex]; dr["Location"] = cp; } break; case (uint)Keys.G: { curVideo = videoList[curVideoIndex]; cp.AspectRatio += factor; curVideo.AspectRatio = cp.AspectRatio; DataRow dr = dt.Rows[curRowIndex]; dr["Location"] = cp; } break; case (uint)Keys.H: { curVideo = videoList[curVideoIndex]; cp.AspectRatio -= factor; curVideo.AspectRatio = cp.AspectRatio; DataRow dr = dt.Rows[curRowIndex]; dr["Location"] = cp; } break; case (uint)Keys.J: { curVideo = videoList[curVideoIndex]; cp.FieldOfView += factor; curVideo.FieldOfView = cp.FieldOfView; DataRow dr = dt.Rows[curRowIndex]; dr["Location"] = cp; } break; case (uint)Keys.K: { curVideo = videoList[curVideoIndex]; cp.FieldOfView -= factor; curVideo.FieldOfView = cp.FieldOfView; DataRow dr = dt.Rows[curRowIndex]; dr["Location"] = cp; } break; case (uint)Keys.Z: { curVideo = videoList[curVideoIndex]; cp.VideoOpacity += factor; curVideo.VideoOpacity = cp.VideoOpacity; DataRow dr = dt.Rows[curRowIndex]; dr["Location"] = cp; } break; case (uint)Keys.X: { curVideo = videoList[curVideoIndex]; cp.VideoOpacity -= factor; curVideo.VideoOpacity = cp.VideoOpacity; DataRow dr = dt.Rows[curRowIndex]; dr["Location"] = cp; } break; case (uint)Keys.D1: { factor = 10; } break; case (uint)Keys.D2: { factor = 1; } break; case (uint)Keys.D3: { factor = 0.1; } break; case (uint)Keys.D4: { factor = 0.01; } break; #endregion case (uint)Keys.S: { String str = cp.PropertyStrings(); streamWriter.WriteLine(str); streamWriter.Flush(); } break; case (uint)Keys.C: { curVideo = videoList[curVideoIndex]; curVideo.VisibleMask = gviViewportMask.gviViewAllNormalView; } break; case (uint)Keys.V: { curVideo = videoList[curVideoIndex]; curVideo.VisibleMask = gviViewportMask.gviViewNone; } break; } return true; }