private void createOneProjectBranch(string projType, ILabelStyle66 cLabelStyle) { //SKRailwayItem item; var sgworld = new SGWorld66(); //ITerraExplorerMessage66 cMessage = null; var parentID = sgworld.ProjectTree.FindItem("桥梁"); if (!(projType.Equals("特大桥") || projType.Equals("中桥") || projType.Equals("大桥") || projType.Equals("框构桥"))) { parentID = string.Empty; } var branch = sgworld.ProjectTree.CreateGroup(projType, parentID); foreach (CRailwayProject item in CRailwayScene.mProjectList) { // item = (SKRailwayItem)CRailwayScene.mProjectList.mProjectList.ElementAt(j); if (item.mProfessionalName.Equals(projType, StringComparison.InvariantCultureIgnoreCase)) { var cPos = sgworld.Creator.CreatePosition(item.mLongitude_Mid, item.mLatitude_Mid, 10, AltitudeTypeCode.ATC_TERRAIN_RELATIVE); item.mLabel = sgworld.Creator.CreateTextLabel(cPos, item.mProjectName, cLabelStyle, branch, item.mProjectName); item.mLabel.ImageFileName = item.mLabelImage; //string urlStr = "http://" + GlobalVar.gSTAT_SERVERIP + "/MNMIS/APP/ProjectMng.aspx?f=detail&sn=" + item.mSerialNo + // "&uacc=" + GlobalVar.gSTAT_USERACC + "&upwd=" + GlobalVar.gSTAT_USRPWD; //cMessage = sgworld.Creator.CreateMessage(MsgTargetPosition.MTP_POPUP, urlStr, MsgType.TYPE_URL, true); ////cMessage.Height = 100; ////MsgTargetPosition mtp = //item.mLabel.Message.MessageID = cMessage.ID; } } }
private void createLabelWithProject() { string[] sProjType = new string[] { "路基", "涵洞", "特大桥", "大桥", "中桥", "框构桥", "空心板桥梁", "预制", "铺架" };//, "大临", "站房工程" var sgworld = new SGWorld66(); IColor66 bgcolor = sgworld.Creator.CreateColor(255, 255, 255, 155); IColor66 forecolor = sgworld.Creator.CreateColor(0, 0, 0, 255); ILabelStyle66 cLabelStyle = sgworld.Creator.CreateLabelStyle(SGLabelStyle.LS_DEFAULT); { //uint nBGRValue = 0x00000000; // White //var cBackgroundColor = cLabelStyle.BackgroundColor; // Get label style background color //cBackgroundColor.FromBGRColor(nBGRValue); // Set background to blue //cBackgroundColor.SetAlpha(0.8); // Set transparency to 50% cLabelStyle.BackgroundColor = bgcolor; // Set label style background color cLabelStyle.TextColor = forecolor; cLabelStyle.FontName = "Arial"; // Set font name to Arial cLabelStyle.Italic = true; // Set label style font to italic cLabelStyle.Scale = 3; // Set label style scale cLabelStyle.TextOnImage = false; } var branch = sgworld.ProjectTree.CreateGroup("桥梁"); foreach (string str in sProjType) { createOneProjectBranch(str, cLabelStyle); } }
/// <summary> /// 测试铁路链 /// </summary> private void createMiddles() { var sgworld = new SGWorld66(); var branch = sgworld.ProjectTree.CreateGroup("进度"); ITerrainPolyline66 polyline; ILabelStyle66 cLabelStyle = sgworld.Creator.CreateLabelStyle(SGLabelStyle.LS_DEFAULT); { cLabelStyle.FontName = "Arial"; // Set font name to Arial cLabelStyle.Italic = true; // Set label style font to italic cLabelStyle.Scale = 3; // Set label style scale cLabelStyle.TextOnImage = false; } //CRailwayProject item = mSceneData.mProjectList[0]; foreach (CRailwayLine item in mSceneData.mMiddleLines.mLineList) { double[] x; double[] y; double[] z; double[] d; //CRailwayLineList oo=null; int pointNum = item.getSubLine(item.mStart, item.mEnd, 1, out x, out y, out z, out d); if (pointNum > 0) { double[] cVerticesArray = new double[pointNum * 3]; for (int i = 0; i < pointNum; i++) { cVerticesArray[3 * i] = x[i]; cVerticesArray[3 * i + 1] = y[i]; cVerticesArray[3 * i + 2] = z[i] + 10; } try { polyline = sgworld.Creator.CreatePolylineFromArray(cVerticesArray, sgworld.Creator.CreateColor(255, 215, 0, 255), AltitudeTypeCode.ATC_TERRAIN_ABSOLUTE, branch, item.mDKCode + "里程"); //polyline.Visibility.MinVisibilityDistance = 1250; //polyline.Spline = true; //polyline.LineStyle.Width = -5; polyline.Visibility.MaxVisibilityDistance = 10000000; polyline.LineStyle.Width = -3.0; polyline.Visibility.Show = true; } catch (Exception ex) { Console.WriteLine("Creation Failed" + item.mDKCode); } } } }
public ILabelStyle66 mLabelStyleL4; // 单位 20M 分辨率 墩,梁,百米标 public CRWTEStandard() { SGWorld66 sgworld = new SGWorld66(); mLabelStyleL1 = sgworld.Creator.CreateLabelStyle(SGLabelStyle.LS_DEFAULT); { mLabelStyleL1.FontName = "Arial"; // Set font name to Arial mLabelStyleL1.Italic = false; // Set label style font to italic mLabelStyleL1.Scale = 200; // Set label style scale mLabelStyleL1.TextOnImage = false; mLabelStyleL1.TextColor = sgworld.Creator.CreateColor(255, 255, 255, 255); mLabelStyleL1.SmallestVisibleSize = 7; mLabelStyleL1.FontSize = 12; } mLabelStyleL2 = sgworld.Creator.CreateLabelStyle(SGLabelStyle.LS_DEFAULT); { mLabelStyleL2.FontName = "Arial"; // Set font name to Arial mLabelStyleL2.Italic = false; // Set label style font to italic mLabelStyleL2.Scale = 50; // Set label style scale mLabelStyleL2.TextOnImage = false; mLabelStyleL2.TextColor = sgworld.Creator.CreateColor(0, 255, 0, 255); mLabelStyleL2.SmallestVisibleSize = 7; mLabelStyleL2.FontSize = 12; } mLabelStyleL3 = sgworld.Creator.CreateLabelStyle(SGLabelStyle.LS_DEFAULT); { mLabelStyleL3.FontName = "Arial"; // Set font name to Arial mLabelStyleL3.Italic = false; // Set label style font to italic mLabelStyleL3.Scale = 10; // Set label style scale mLabelStyleL3.TextOnImage = false; mLabelStyleL3.TextColor = sgworld.Creator.CreateColor(0, 255, 255, 255); mLabelStyleL3.SmallestVisibleSize = 7; mLabelStyleL3.FontSize = 12; } mLabelStyleL4 = sgworld.Creator.CreateLabelStyle(SGLabelStyle.LS_DEFAULT); { mLabelStyleL4.FontName = "Arial"; // Set font name to Arial mLabelStyleL4.Italic = false; // Set label style font to italic mLabelStyleL4.Scale = 1; // Set label style scale mLabelStyleL4.TextOnImage = false; mLabelStyleL4.TextColor = sgworld.Creator.CreateColor(0, 0, 255, 255); mLabelStyleL4.SmallestVisibleSize = 7; mLabelStyleL4.FontSize = 12; } }
public override void TECreate() { var sgworld = new SGWorld66(); if (string.IsNullOrEmpty(mGroupIDStatic)) { mGroupIDStatic = sgworld.ProjectTree.CreateGroup("KML"); } ILabelStyle66 cLabelStyle = mTEStandard.mLabelStyleL3; //= sgworld.Creator.CreateLabelStyle(SGLabelStyle.LS_DEFAULT); //{ // 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 // cLabelStyle.TextOnImage = false; //} foreach (CRailwayLine rl in mSceneData.mMiddleLines.mLineList) { double[] x, y, z, w; int[] f; int num; num = rl.getKML(true, out x, out y, out z, out w, out f); for (int i = 0; i < num; i++) { IPosition66 cp = sgworld.Creator.CreatePosition(x[i], y[i], z[i] + 1, AltitudeTypeCode.ATC_TERRAIN_ABSOLUTE, w[i]); sgworld.Creator.CreateTextLabel(cp, f[i] + "", cLabelStyle, mGroupIDStatic, rl.mDKCode + f[i]); } } //for (int i = 0; i < mSceneData.mMiddleLines.mPointNum; i += 100) //{ // //} }
/// <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); } }
private void createKML() { var sgworld = new SGWorld66(); var branch = sgworld.ProjectTree.CreateGroup("KML"); ILabelStyle66 cLabelStyle = sgworld.Creator.CreateLabelStyle(SGLabelStyle.LS_DEFAULT); { 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 cLabelStyle.TextOnImage = false; } for (int i = 0; i < CRailwayScene.mMiddleLine.mPointNum; i += 100) { sgworld.Creator.CreateTextLabel(CRailwayScene.mMiddleLine.findPositionbyIndex(i), (int)CRailwayScene.mMiddleLine.meter[i] + "", cLabelStyle, branch, (int)CRailwayScene.mMiddleLine.meter[i] + ""); } }
/// <summary> /// 添加桥梁、路基、隧道模型与标签,FIXME目前模型与工点表ProjectInof不一致(有些工点没有模型,有些工点应该对应多个模型),模型生成程序有一个单独的Excel表TEProj,不通过程序添加 /// </summary> /// <param name="groupID"></param> private void createProjectLabel() { var sgworld = new SGWorld66(); if (string.IsNullOrEmpty(mGroupIDStatic)) { mGroupIDStatic = sgworld.ProjectTree.CreateGroup("Project"); } double lat, lon, z, dir; double cx, cy; //IColor66 bgcolor = sgworld.Creator.CreateColor(255, 255, 255, 155); //IColor66 forecolor = sgworld.Creator.CreateColor(0, 0, 0, 255); ILabelStyle66 cLabelStyle = mTEStandard.mLabelStyleL3; //sgworld.Creator.CreateLabelStyle(SGLabelStyle.LS_DEFAULT); //{ // //uint nBGRValue = 0x00000000; // White // //var cBackgroundColor = cLabelStyle.BackgroundColor; // Get label style background color // //cBackgroundColor.FromBGRColor(nBGRValue); // Set background to blue // //cBackgroundColor.SetAlpha(0.8); // Set transparency to 50% // cLabelStyle.BackgroundColor = bgcolor; // Set label style background color // cLabelStyle.TextColor = forecolor; // cLabelStyle.FontName = "Arial"; // Set font name to Arial // cLabelStyle.Italic = true; // Set label style font to italic // cLabelStyle.Scale = 3; // Set label style scale // cLabelStyle.TextOnImage = false; //} foreach (CRailwayProject item in mSceneData.mBridgeList) { var cPos = sgworld.Creator.CreatePosition(item.CenterLongitude, item.CenterLatitude, 10, AltitudeTypeCode.ATC_TERRAIN_RELATIVE); sgworld.Creator.CreateLabel(cPos, item.ProjectName, CGisDataSettings.gDataPath + @"\Data\Textures\桥梁.png", cLabelStyle, mGroupIDStatic, item.ProjectName); if (!mSceneData.mMiddleLines.getPosbyDKCode(item.DKCode, item.CenterMileage, out lon, out lat, out z, out dir)) { //Console.WriteLine(item.ProjectName + " 工点 坐标错误"); continue; } CoordinateConverter.LatLonOffest(lat, lon, dir, 90, 150, out cy, out cx); var cPos2 = sgworld.Creator.CreatePosition(cx, cy, 30, AltitudeTypeCode.ATC_TERRAIN_RELATIVE, 0, -75, 0, 2000); sgworld.Creator.CreateCircle(cPos2, 140, sgworld.Creator.CreateColor(127, 127, 127, 127), sgworld.Creator.CreateColor(127, 127, 127, 127), mGroupIDStatic); } foreach (CRailwayProject item in mSceneData.mRoadList) { var cPos = sgworld.Creator.CreatePosition(item.CenterLongitude, item.CenterLatitude, 10, AltitudeTypeCode.ATC_TERRAIN_RELATIVE); sgworld.Creator.CreateLabel(cPos, item.ProjectName, CGisDataSettings.gDataPath + @"\Data\Textures\路基.png", cLabelStyle, mGroupIDStatic, item.ProjectName); if (!mSceneData.mMiddleLines.getPosbyDKCode(item.DKCode, item.CenterMileage, out lon, out lat, out z, out dir)) { //Console.WriteLine(item.ProjectName + " 工点 坐标错误"); continue; } CoordinateConverter.LatLonOffest(lat, lon, dir, 90, 150, out cy, out cx); var cPos2 = sgworld.Creator.CreatePosition(cx, cy, 30, AltitudeTypeCode.ATC_TERRAIN_RELATIVE, 0, -75, 0, 2000); sgworld.Creator.CreateCircle(cPos2, 140, sgworld.Creator.CreateColor(127, 127, 127, 127), sgworld.Creator.CreateColor(127, 127, 127, 127), mGroupIDStatic); } foreach (CRailwayProject item in mSceneData.mTunnelList) { var cPos = sgworld.Creator.CreatePosition(item.CenterLongitude, item.CenterLatitude, 10, AltitudeTypeCode.ATC_TERRAIN_RELATIVE); sgworld.Creator.CreateLabel(cPos, item.ProjectName, CGisDataSettings.gDataPath + @"\Data\Textures\涵洞.png", cLabelStyle, mGroupIDStatic, item.ProjectName); if (!mSceneData.mMiddleLines.getPosbyDKCode(item.DKCode, item.CenterMileage, out lon, out lat, out z, out dir)) { //Console.WriteLine(item.ProjectName + " 工点 坐标错误"); continue; } CoordinateConverter.LatLonOffest(lat, lon, dir, 90, 150, out cy, out cx); var cPos2 = sgworld.Creator.CreatePosition(cx, cy, 30, AltitudeTypeCode.ATC_TERRAIN_RELATIVE, 0, -75, 0, 2000); sgworld.Creator.CreateCircle(cPos2, 140, sgworld.Creator.CreateColor(127, 127, 127, 127), sgworld.Creator.CreateColor(127, 127, 127, 127), mGroupIDStatic); } //bool isValue = mSceneData.mMiddleLines.getPosbyMeter(item.Mileage_Start_Ds, out lat, out lon, out z, out dir); //CoordinateConverter.LatLonOffest(lat, lon, z, 270, 300, out latcen, out loncen); //CoordinateConverter.LatLonToUTMXY(latcen, loncen, out x, out y, out zone); //int ccount = Convert.ToInt32(Math.Ceiling(Convert.ToDecimal(item.AvgProgress * 180.0))); }
public static void Init() { SGWorld66 sgworld = new SGWorld66(); mLabelStyleL1 = sgworld.Creator.CreateLabelStyle(SGLabelStyle.LS_DEFAULT); { mLabelStyleL1.FontName = "Arial"; // Set font name to Arial mLabelStyleL1.Italic = false; // Set label style font to italic mLabelStyleL1.Scale = 200; // Set label style scale mLabelStyleL1.TextOnImage = false; mLabelStyleL1.TextColor = sgworld.Creator.CreateColor(255, 255, 255, 255); mLabelStyleL1.SmallestVisibleSize = 7; mLabelStyleL1.FontSize = 12; mLabelStyleL1.LineToGround = true; } mLabelStyleL2 = sgworld.Creator.CreateLabelStyle(SGLabelStyle.LS_DEFAULT); { mLabelStyleL2.FontName = "Arial"; // Set font name to Arial mLabelStyleL2.Italic = false; // Set label style font to italic mLabelStyleL2.Scale = 50; // Set label style scale mLabelStyleL2.TextOnImage = false; mLabelStyleL2.TextColor = sgworld.Creator.CreateColor(0, 255, 0, 255); mLabelStyleL2.SmallestVisibleSize = 7; mLabelStyleL2.FontSize = 12; mLabelStyleL2.LineToGround = true; } mLabelStyleL3 = sgworld.Creator.CreateLabelStyle(SGLabelStyle.LS_DEFAULT); { mLabelStyleL3.FontName = "Arial"; // Set font name to Arial mLabelStyleL3.Italic = false; // Set label style font to italic mLabelStyleL3.Scale = 10; // Set label style scale mLabelStyleL3.TextOnImage = false; mLabelStyleL3.TextColor = sgworld.Creator.CreateColor(0, 255, 255, 255); mLabelStyleL3.SmallestVisibleSize = 7; mLabelStyleL3.FontSize = 12; } mLabelStyleL4 = sgworld.Creator.CreateLabelStyle(SGLabelStyle.LS_DEFAULT); { mLabelStyleL4.FontName = "Arial"; // Set font name to Arial mLabelStyleL4.Italic = false; // Set label style font to italic mLabelStyleL4.Scale = 1; // Set label style scale mLabelStyleL4.TextOnImage = false; mLabelStyleL4.TextColor = sgworld.Creator.CreateColor(0, 0, 255, 255); mLabelStyleL4.SmallestVisibleSize = 7; mLabelStyleL4.FontSize = 12; } mLabelStyleL5 = sgworld.Creator.CreateLabelStyle(SGLabelStyle.LS_DEFAULT); { mLabelStyleL5.FontName = "Arial"; // Set font name to Arial mLabelStyleL5.Italic = false; // Set label style font to italic mLabelStyleL5.Scale = 2; // Set label style scale mLabelStyleL5.TextOnImage = false; mLabelStyleL5.TextColor = sgworld.Creator.CreateColor(255, 0, 0, 255); mLabelStyleL5.SmallestVisibleSize = 7; mLabelStyleL5.FontSize = 12; } mColor = new IColor66[6]; mColor[0] = sgworld.Creator.CreateColor(255, 0, 0, 255); mColor[1] = sgworld.Creator.CreateColor(0, 255, 0, 255); mColor[2] = sgworld.Creator.CreateColor(0, 0, 255, 255); mColor[3] = sgworld.Creator.CreateColor(0, 255, 255, 255); mColor[4] = sgworld.Creator.CreateColor(255, 0, 255, 255); mColor[5] = sgworld.Creator.CreateColor(255, 255, 0, 255); }
private void createStation() { var sgworld = new SGWorld66(); //var branch = sgworld.ProjectTree.FindItem("站房工程"); double xs, ys, zs, ds; double[] p = new double[] { -1, 1, 0, 1, 1, 0, 1, -1, 0, -1, -1, 0 }; IPosition66 cp; ITerrainImageLabel66 iLabel; //double t[10]; ILabelStyle66 cLabelStyle = sgworld.Creator.CreateLabelStyle(SGLabelStyle.LS_DEFAULT); { //cLabelStyle.BackgroundColor = bgcolor; // Set label style background color //cLabelStyle.TextColor = forecolor; cLabelStyle.FontName = "Arial"; // Set font name to Arial cLabelStyle.Italic = true; // Set label style font to italic cLabelStyle.Scale = 100; // Set label style scale //cLabelStyle.TextOnImage = false; } var branch = sgworld.ProjectTree.CreateGroup("站房工程"); try { foreach (CRailwayProject station in CRailwayScene.mStationList) { // item = (SKRailwayItem)CRailwayScene.mProjectList.mProjectList.ElementAt(j); if (station.mProfessionalName.Equals("站房工程", StringComparison.InvariantCultureIgnoreCase)) { //x = station.mLongitude_Mid; //y = station.mLatitude_Mid; //z = 10; CRailwayScene.mMiddleLine.findPosbyMeter(station.mMileage_Mid - 50, out xs, out ys, out zs, out ds); CoordinateConverter.LatLonOffest(ys, xs, ds, station.mDirection, 25, out p[1], out p[0]); //lat, lon CoordinateConverter.LatLonOffest(ys, xs, ds, station.mDirection, 75, out p[4], out p[3]); CRailwayScene.mMiddleLine.findPosbyMeter(station.mMileage_Mid + 50, out xs, out ys, out zs, out ds); CoordinateConverter.LatLonOffest(ys, xs, ds, station.mDirection, 25, out p[10], out p[9]); CoordinateConverter.LatLonOffest(ys, xs, ds, station.mDirection, 75, out p[7], out p[6]); cp = sgworld.Creator.CreatePosition((p[0] + p[3] + p[6] + p[9]) / 4, (p[1] + p[4] + p[7] + p[10]) / 4, 40, AltitudeTypeCode.ATC_TERRAIN_RELATIVE); iLabel = sgworld.Creator.CreateImageLabel(cp, station.mLabelImage, cLabelStyle, branch, station.mProjectName); iLabel.Message.MessageID = sgworld.Creator.CreateMessage(MsgTargetPosition.MTP_POPUP, station.mProjectName, MsgType.TYPE_TEXT, true).ID; //iLabel.Visibility.MaxVisibilityDistance = 1000000; IGeometry buildingShp = null; ILinearRing cSQRing = sgworld.Creator.GeometryCreator.CreateLinearRingGeometry(p); buildingShp = sgworld.Creator.GeometryCreator.CreatePolygonGeometry(cSQRing, null); var model = sgworld.Creator.CreateBuilding(buildingShp, 15, AltitudeTypeCode.ATC_TERRAIN_RELATIVE, branch, station.mProjectName); //fileName = GlobalVar.gDataPath + @"\Data\Textures\Sky_w_tan.jpg"; model.Sides.Texture.FileName = GlobalVar.gDataPath + @"Common\Textures\Sky_w_tan.jpg"; model.Roof.Texture.FileName = GlobalVar.gDataPath + @"Common\Textures\roof2.jpg"; } } } catch (Exception ex) { Console.WriteLine(ex.Message.ToString()); Console.WriteLine("Station Creation Error"); } }