예제 #1
0
        private void polylineMiddleLine(CRailwayProject rw, IColor66 lineColor, SGWorld66 sgworld, string branch)
        {
            ITerrainPolyline66 polyline;

            //double[] x, y, z, dir;
            double[] mArray;
            int      count = rw.getSubLine(out mArray);

            //mSceneData.mMiddleLines.getSubLineByDKCode(rw.Mileage_Start_Discription, rw.Mileage_End_Discription, 10, out x, out y, out z, out dir);
            //double[] mArray = new double[count * 3];
            //for (int i = 0; i < count; i++)
            //{
            //     mArray[3 * i] = x[i];
            //     mArray[3 * i + 1] = y[i];
            //     mArray[3 * i + 2] = z[i] + 1;

            //}
            if (count > 1)
            {
                polyline        = sgworld.Creator.CreatePolylineFromArray(mArray, lineColor, AltitudeTypeCode.ATC_TERRAIN_ABSOLUTE, branch, rw.ProjectName);
                polyline.Spline = true;
                polyline.Visibility.MaxVisibilityDistance = 10000000;
                polyline.Visibility.MinVisibilityDistance = 1000;
                polyline.LineStyle.Width = -5.0;
                polyline.Visibility.Show = true;
            }
        }
예제 #2
0
        /// <summary>
        /// 路径漫游
        /// </summary>
        private void RouteRoam()
        {
            //绘制路径
            double[] cVerticesArray = null;
            cVerticesArray = new double[] {
                116.35, 27.98, 0,
                116.45, 28.98, 0,
                116.45, 28.11, 0,
                116.65, 28.45, 0,
            };

            ILineString pILineString  = sgWorld.Creator.GeometryCreator.CreateLineStringGeometry(cVerticesArray);
            IColor66    color         = sgWorld.Creator.CreateColor(255, 0, 0, 125);
            var         polyline      = sgWorld.Creator.CreatePolyline(pILineString, color);
            var         dynamicObject = this.sgWorld.Creator.CreateDynamicObject(0, DynamicMotionStyle.MOTION_GROUND_VEHICLE, DynamicObjectType.DYNAMIC_IMAGE_LABEL, @"F:\项目管理\智慧抚州\使用的Fly\data11\汽车图标\整车.png", 50, AltitudeTypeCode.ATC_TERRAIN_RELATIVE, "", "动态对象");
            var         wayPoint1     = this.sgWorld.Creator.CreateRouteWaypoint(116.35, 27.98, 0, 2000);
            var         wayPoint2     = this.sgWorld.Creator.CreateRouteWaypoint(116.45, 28.98, 0, 2000);
            var         wayPoint3     = this.sgWorld.Creator.CreateRouteWaypoint(116.55, 28.11, 0, 800);
            var         wayPoint4     = this.sgWorld.Creator.CreateRouteWaypoint(116.65, 28.45, 0, 800);

            dynamicObject.Waypoints.AddWaypoint(wayPoint1);
            dynamicObject.Waypoints.AddWaypoint(wayPoint2);
            dynamicObject.Waypoints.AddWaypoint(wayPoint3);
            dynamicObject.Waypoints.AddWaypoint(wayPoint4);
            dynamicObject.CircularRoute = false;
            dynamicObject.RestartRoute(0);
            //dynamicObject.MoveByTime = true;
            sgWorld.Navigate.FlyTo(dynamicObject.ID, ActionCode.AC_JUMP);
        }
예제 #3
0
        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);
            }
        }
예제 #4
0
        /// <summary>
        /// 创建箭头
        /// </summary>
        private void CreateArrow()
        {
            var cPos = CreatePosition();

            double   length      = 1000;
            int      style       = 4;
            IColor66 lineColor   = this.sgWorld.Creator.CreateColor(255, 0, 0, 0);
            IColor66 fillColor   = this.sgWorld.Creator.CreateColor(255, 0, 0, 0);
            string   groupID     = string.Empty;
            string   description = "箭头→";
            var      arrow       = this.sgWorld.Creator.CreateArrow(cPos, length, style, lineColor, fillColor, groupID, description);

            this.sgWorld.Navigate.FlyTo(arrow, ActionCode.AC_FLYTO);
        }
예제 #5
0
        public override void TECreate()
        {
            SGWorld66 sgworld = new SGWorld66();

            if (string.IsNullOrEmpty(mGroupIDStatic))
            {
                mGroupIDStatic = sgworld.ProjectTree.CreateGroup("MiddleLine");
            }
            IColor66 lineColorGreen      = sgworld.Creator.CreateColor(0, 255, 0, 255);     //工点进度前20%
            IColor66 lineColorYellow     = sgworld.Creator.CreateColor(255, 255, 0, 255);   //工点进度前60%
            IColor66 lineColorRed        = sgworld.Creator.CreateColor(255, 0, 0, 255);     //工点进度前20%
            IColor66 lineColorGray       = sgworld.Creator.CreateColor(100, 100, 100, 255); //未施工
            List <CRailwayProject> items = new List <CRailwayProject> (mSceneData.mBridgeList);

            items.AddRange(mSceneData.mRoadList);
            items.AddRange(mSceneData.mTunnelList);
            IEnumerable <CRailwayProject> itemsOrderAsc = items.OrderBy(p => p, new CRWProjectCompares());
            int number = 0;
            int start  = 1;

            foreach (CRailwayProject rw in itemsOrderAsc)
            {
                if (rw.AvgProgress == 0)
                {
                    number++;
                    polylineMiddleLine(rw, lineColorGray, sgworld, mGroupIDStatic);
                }
                else
                {
                    int end = (itemsOrderAsc.Count() - number);
                    if (start <= (int)(end * 0.2))
                    {
                        start++;
                        polylineMiddleLine(rw, lineColorRed, sgworld, mGroupIDStatic);
                    }
                    else if ((start >= (int)(end * 0.2 + 1)) & (start <= (int)(end * 0.6)))
                    {
                        start++;
                        polylineMiddleLine(rw, lineColorYellow, sgworld, mGroupIDStatic);
                    }
                    else if ((start <= (int)(end * 0.6 + 1)) & (start <= end))
                    {
                        start++;
                        polylineMiddleLine(rw, lineColorGreen, sgworld, mGroupIDStatic);
                    }
                }
            }
        }
예제 #6
0
        /// <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);
            }
        }
예제 #7
0
        public Facet(ref SGWorld66 inSgworld, TsData tsData, string facetName, string parentGroupID, IColor66 lineColor, IColor66 fillColor)
        {
            this.sgworld   = inSgworld;
            this.FacetName = facetName;
            this.FillColor = fillColor;
            this.LineColor = lineColor;


            foreach (var triLink in tsData.TriLinksList)
            {
                int intA = triLink.VertexA - 1;
                int intB = triLink.VertexB - 1;
                int intC = triLink.VertexC - 1;

                var vList = new List <double>
                {
                    tsData.VerticesList[intA].X,
                    tsData.VerticesList[intA].Y,
                    tsData.VerticesList[intA].Z,
                    tsData.VerticesList[intB].X,
                    tsData.VerticesList[intB].Y,
                    tsData.VerticesList[intB].Z,
                    tsData.VerticesList[intC].X,
                    tsData.VerticesList[intC].Y,
                    tsData.VerticesList[intC].Z,
                    tsData.VerticesList[intA].X,
                    tsData.VerticesList[intA].Y,
                    tsData.VerticesList[intA].Z
                };

                // 三角面片的三个顶点坐标列表
                var ring = this.sgworld.Creator.GeometryCreator.CreateLinearRingGeometry(vList.ToArray());
                this.ringsList.Add(ring);
            }


            this.GroupID = this.sgworld.ProjectTree.CreateLockedGroup(facetName, parentGroupID);
        }
예제 #8
0
        private void polylineMiddleLine(CRailwayProject rw, SGWorld66 sgworld, string branch, Dictionary <string, double> m)
        {
            ITerrainPolyline66 polyline1;
            ITerrainPolyline66 polyline2;
            ITerrainPolyline66 polyline3;
            ITerrainPolyline66 polyline4;
            IColor66           lineColor1 = sgworld.Creator.CreateColor(242, 174, 17, 255);
            IColor66           lineColor2 = sgworld.Creator.CreateColor(32, 183, 81, 255);
            IColor66           lineColor3 = sgworld.Creator.CreateColor(183, 9, 9, 255);
            IColor66           lineColor4 = sgworld.Creator.CreateColor(50, 50, 50, 255);

            double[] x, y, z, dir;
            int      count = mSceneData.mMiddleLines.getSubLineByDKCode(rw.Mileage_Start_Discription, rw.Mileage_End_Discription, 10, out x, out y, out z, out dir);

            double[] mArray1 = new double[count * 3];
            double[] mArray2 = new double[count * 3];
            double[] mArray3 = new double[count * 3];
            double[] mArray4 = new double[count * 3];
            for (int i = 0; i < count; i++)
            {
                mArray1[3 * i]     = x[i];
                mArray1[3 * i + 1] = y[i];
                mArray1[3 * i + 2] = z[i] + 10;

                mArray2[3 * i]     = x[i];
                mArray2[3 * i + 1] = y[i];
                mArray2[3 * i + 2] = z[i] + 20;

                mArray3[3 * i]     = x[i];
                mArray3[3 * i + 1] = y[i];
                mArray3[3 * i + 2] = z[i] + 30;

                mArray4[3 * i]     = x[i];
                mArray4[3 * i + 1] = y[i];
                mArray4[3 * i + 2] = z[i] + 40;
            }
            if (m.Count >= 4)
            {
                KeyValuePair <string, double> kvp = m.ElementAt(0);
                polyline1        = sgworld.Creator.CreatePolylineFromArray(mArray1, lineColor1, AltitudeTypeCode.ATC_TERRAIN_ABSOLUTE, branch, rw.ProjectName + "-" + kvp.Key);
                polyline1.Spline = true;
                polyline1.Visibility.MaxVisibilityDistance = 10000000;
                polyline1.Visibility.MinVisibilityDistance = 150;
                polyline1.LineStyle.Width = 50.0;
                polyline1.Visibility.Show = true;
                polyline1.LineStyle.Color.SetAlpha(kvp.Value);

                kvp              = m.ElementAt(1);
                polyline2        = sgworld.Creator.CreatePolylineFromArray(mArray2, lineColor2, AltitudeTypeCode.ATC_TERRAIN_ABSOLUTE, branch, rw.ProjectName + "-" + kvp.Key);
                polyline2.Spline = true;
                polyline2.Visibility.MaxVisibilityDistance = 10000000;
                polyline2.Visibility.MinVisibilityDistance = 150;
                polyline2.LineStyle.Width = 30.0;
                polyline2.Visibility.Show = true;
                polyline2.LineStyle.Color.SetAlpha(kvp.Value);
                kvp              = m.ElementAt(2);
                polyline3        = sgworld.Creator.CreatePolylineFromArray(mArray3, lineColor3, AltitudeTypeCode.ATC_TERRAIN_ABSOLUTE, branch, rw.ProjectName + "-" + kvp.Key);
                polyline3.Spline = true;
                polyline3.Visibility.MaxVisibilityDistance = 10000000;
                polyline3.Visibility.MinVisibilityDistance = 150;
                polyline3.LineStyle.Width = 15.0;
                polyline3.Visibility.Show = true;
                polyline3.LineStyle.Color.SetAlpha(kvp.Value);
                kvp              = m.ElementAt(3);
                polyline4        = sgworld.Creator.CreatePolylineFromArray(mArray4, lineColor4, AltitudeTypeCode.ATC_TERRAIN_ABSOLUTE, branch, rw.ProjectName + "-" + kvp.Key);
                polyline4.Spline = true;
                polyline4.Visibility.MaxVisibilityDistance = 10000000;
                polyline4.Visibility.MinVisibilityDistance = 150;
                polyline4.LineStyle.Width = 5;
                polyline4.Visibility.Show = true;
                polyline4.LineStyle.Color.SetAlpha(kvp.Value);
            }
        }
예제 #9
0
        /// <summary>
        /// 生成曲面
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonXBuild_Click(object sender, EventArgs e)
        {
            double attitudeL = this.doubleInputAttitudeLength.Value;
            double shapeR    = this.doubleInputShapeRadium.Value;

            // 生成产状数据集
            double       nx = 0.0, ny = 0.0, nz = 0.0;
            List <Point> sourceAttitudePoints = new List <Point>(this.targetMarkersList.Count * 4);

            foreach (var marker in this.targetMarkersList)
            {
                nx += Math.Sin(marker.MyDip * Math.PI / 180) * Math.Sin(marker.MyAngle * Math.PI / 180)
                      / this.targetMarkersList.Count;
                ny += Math.Cos(marker.MyDip * Math.PI / 180) * Math.Sin(marker.MyAngle * Math.PI / 180)
                      / this.targetMarkersList.Count;
                nz += Math.Cos(marker.MyAngle * Math.PI / 180) / this.targetMarkersList.Count;


                double dx         = -Math.Tan(marker.MyAngle * Math.PI / 180) * Math.Cos(marker.MyDip * Math.PI / 180);
                double dy         = -Math.Tan(marker.MyAngle * Math.PI / 180) * Math.Sin(marker.MyDip * Math.PI / 180);
                Point  northPoint = new Point(
                    marker.X,
                    marker.Y + attitudeL,
                    marker.Z + dy * attitudeL);
                Point southPoint = new Point(
                    marker.X,
                    marker.Y - attitudeL,
                    marker.Z - dy * attitudeL);
                Point eastPoint = new Point(
                    marker.X + attitudeL,
                    marker.Y,
                    marker.Z + dx * attitudeL);
                Point westPoint = new Point(
                    marker.X - attitudeL,
                    marker.Y,
                    marker.Z - dx * attitudeL);

                sourceAttitudePoints.AddRange(new[] { northPoint, southPoint, eastPoint, westPoint });
            }

            Point middlePoint = CurveAlgorithm.MiddlePointOfPoints(this.targetMarkersList);

            // 平均产状平面
            Vector3D n     = new Vector3D(nx, ny, nz);
            var      plane = new MathNet.Spatial.Euclidean.Plane(
                new Point3D(middlePoint.X, middlePoint.Y, middlePoint.Z),
                n.Normalize());

            double a0 = -plane.D / plane.C;
            double a1 = -plane.A / plane.C;
            double a2 = -plane.B / plane.C;

            // 插值点数据集
            List <Point> sourcePoints = new List <Point>(this.targetMarkersList);

            sourcePoints.AddRange(sourceAttitudePoints);

            SurfaceEquation surfaceEquation = new SurfaceEquation(a0, a1, a2, sourcePoints, shapeR);

            // 确定曲面区域
            List <Point> edgePoints = CurveAlgorithm.GetEdgePoints(sourcePoints, this.GridEdgeLength);

            // 区域内插加密点 GeoHelper.InsertPointsInPolygon
            List <Point> pointsList = GeoHelper.InsertPointsInPolygon(edgePoints, this.GridEdgeLength);

            // 生成网格 Triangulations
            Triangulations tris = new Triangulations(pointsList, new List <Point>());

            // 计算插值 SurfaceMesh
            tris.MeshSurface(surfaceEquation);

            // 绘制曲面
            IColor66 fillColor = this.sgworld.Creator.CreateColor(128, 128, 128, 128);
            IColor66 lineColor = this.sgworld.Creator.CreateColor(255, 255, 255, 0);

            var parentGid = GeoHelper.CreateGroup("产状地质曲面", ref this.sgworld);



            Facet facet = new Facet(ref this.sgworld, tris.TsData, "Test", parentGid, lineColor, fillColor);

            // facet.DrawFacet();

            // 保存三角网结果
            TsFile ts = new TsFile(
                tris.TsData,
                "TSurf",
                "M",
                "JGM",
                "Name",
                new List <string>());

            ts.WriteTsFile();
            ts.UpdateTsFile(ref this.db);

            ToastNotification.Show(this, "曲面模型已保存为模型部件", 2500, eToastPosition.MiddleCenter);
        }