/// <summary> /// 创建图片标签 /// </summary> private void CreateImageLabel() { IPosition66 cPos = CreatePosition(); string imageFileName = @"F:\项目管理\智慧抚州\使用的Fly\data11\汽车图标\汽车整车.png"; var imageLabel = this.sgWorld.Creator.CreateImageLabel(cPos, imageFileName, null, "", "1"); imageLabel.set_ClientData("id", "1"); imageLabel.SetParam(1, "汽车整车"); var cFlyToPos = cPos.Copy(); cFlyToPos.Pitch = -89.0; this.sgWorld.Navigate.FlyTo(cFlyToPos, ActionCode.AC_FLYTO); }
/// <summary> /// 创建圆 /// </summary> private void CreateCircle() { string msg = string.Empty; IPosition66 cPos = null; IColor66 cFillColor = null; ITerrainRegularPolygon66 cCircle = null; ITerraExplorerMessage66 cMessage = null; try { cPos = CreatePosition(); uint nLineColor = 0xFFFF0000; double dCircleRadius = 200; cCircle = this.sgWorld.Creator.CreateCircle(cPos, dCircleRadius, nLineColor, cFillColor, string.Empty, "Circle"); double dNewCircleRadius = 300; double dCurrentCircleRadius = cCircle.Radius; cCircle.Radius = dNewCircleRadius; uint nRGB_Red = 0xFF0000; double dAlpha = 0.2; var cFillStyle = cCircle.FillStyle; cFillStyle.Color.FromRGBColor(nRGB_Red); cFillStyle.Color.SetAlpha(dAlpha); MsgTargetPosition eMsgTarget = MsgTargetPosition.MTP_POPUP; string tMessage = "Hello Circle"; MsgType eMsgType = MsgType.TYPE_TEXT; bool bIsBringToFront = true; cMessage = this.sgWorld.Creator.CreateMessage(eMsgTarget, tMessage, eMsgType, bIsBringToFront); cCircle.Message.MessageID = cMessage.ID; var cFlyToPos = cPos.Copy(); cFlyToPos.Pitch = -89.0; this.sgWorld.Navigate.FlyTo(cFlyToPos, ActionCode.AC_FLYTO); } catch (Exception ex) { msg = String.Format("CreateCircleButton_Click Exception: {0}", ex.Message); MessageBox.Show(msg); } }
/// <summary> /// 创建TextLabel /// </summary> private void CreateLabel() { string msg = String.Empty; IPosition66 cPos = null; ILabelStyle66 cLabelStyle = null; ITerrainImageLabel66 cTextLabel = null; try { cPos = CreatePosition(); SGLabelStyle eLabelStyle = SGLabelStyle.LS_DEFAULT; cLabelStyle = this.sgWorld.Creator.CreateLabelStyle(eLabelStyle); uint nBGRValue = 0xFF0000; // Blue double dAlpha = 0.5; // 50% opacity var cBackgroundColor = cLabelStyle.BackgroundColor; // Get label style background color cBackgroundColor.FromBGRColor(nBGRValue); // Set background to blue cBackgroundColor.SetAlpha(dAlpha); // Set transparency to 50% cLabelStyle.BackgroundColor = cBackgroundColor; // Set label style background color cLabelStyle.FontName = "Arial"; // Set font name to Arial cLabelStyle.Italic = true; // Set label style font to italic cLabelStyle.Scale = 3; // Set label style scale string tText = "Skyline"; cTextLabel = this.sgWorld.Creator.CreateTextLabel(cPos, tText, cLabelStyle, string.Empty, "TextLabel"); //FlyTo text label var cFlyToPos = cPos.Copy(); cFlyToPos.Pitch = -89.0; this.sgWorld.Navigate.FlyTo(cFlyToPos, ActionCode.AC_FLYTO); } catch (Exception ex) { msg = String.Format("CreateLabelButton_Click Exception: {0}", ex.Message); MessageBox.Show(msg); } }