private void lstValvesName_DoubleClick(object sender, EventArgs e)
        {
            int i = this.lstValvesName.SelectedIndex;

            if (i < 0)
            {
                return;
            }
            GSOFeature m_CloseValvesAnalyresFeature = m_CloseValvesAnalyResFeatures[i];

            globeControl1.Globe.FlyToFeature(m_CloseValvesAnalyresFeature, 1, 45, 5);
            GSOLabel newLabel = new GSOLabel();

            newLabel.Text               = "关闭此阀门";
            newLabel.Style              = new GSOLabelStyle();
            newLabel.Style.Opaque       = 0.8;
            newLabel.Style.OutlineColor = Color.Red;
            //newLabel.Style.TractionLineEndPos = new GSOPoint2d(150, 120);
            newLabel.Style.OutlineWidth       = 1;
            newLabel.Style.TracktionLineWidth = 1;
            newLabel.Style.BackBeginColor     = Color.Orange;
            newLabel.Style.BackEndColor       = Color.PaleGreen;

            m_CloseValvesAnalyresFeature.Label = newLabel;

            m_CloseValvesList.Add(m_CloseValvesAnalyresFeature);

            globeControl1.Refresh();
        }
Example #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            islabel     = !islabel;
            label3.Text = string.Format("标注:{0}", islabel ? "开" : "关");
            GSOLayer layer = globeControl1.Globe.MemoryLayer;

            for (int i = 0; i < layer.GetAllFeatures().Length; i++)
            {
                GSOFeature feature = layer.GetAt(i);
                GSOLabel   label   = new GSOLabel();
                label.Text         = feature.Name; //设置显示的文本信息
                label.Style        = new GSOLabelStyle();
                label.Style.Opaque = 0.8;          //设置标注的透明度,取值区间是0-1

                //设置引线的类型,可以是实线、虚线等。
                label.Style.TracktionLineType = EnumTracktionLineType.Dot;

                //设置字体大小
                label.Style.TextStyle.FontHeight = 20;

                //设置字体类型
                label.Style.TextStyle.FontName = "黑体";

                //设置标注的位置,默认标注在要素的正上方,下面80,60的单位是像素
                //label.Style.TractionLineEndPos = new GSOPoint2d(80, 60);
                label.Style.TractionLineEndPos = new GSOPoint2d(0, 60);

                //设置是否为斜体
                label.Style.TextStyle.Italic = true;

                //设置标注的边框颜色
                label.Style.OutlineColor = Color.Red;

                //设置标注的边框粗细
                label.Style.OutlineWidth = 1;

                //设置标注的引线粗细
                label.Style.TracktionLineWidth = 1;

                //设置标注矩形区的颜色渐变
                label.Style.BackBeginColor = Color.Orange;
                label.Style.BackEndColor   = Color.PaleGreen;

                //label.BKImage = @"D:\图片资源\国旗.jpg";

                ////该属性如果设置为空,标注只显示图片,如果不为空,那么在图片之上显示文字。
                //label.Text = "";

                feature.Label = islabel ? label : null;

                globeControl1.Globe.Refresh();
            }
        }
Example #3
0
        GSOLabel CreateLabel(string labelText)
        {
            GSOLabel      label      = new GSOLabel();
            GSOLabelStyle lableStyle = new GSOLabelStyle();

            lableStyle.Opaque             = 0.5;
            lableStyle.TextStyle.FontName = "宋体";
            lableStyle.TextStyle.FontSize = 12;
            lableStyle.TracktionLineType  = EnumTracktionLineType.Dot;
            label.Text    = labelText;
            label.Style   = lableStyle;
            label.Visible = true;
            return(label);
        }
        private void FlyToMenu_Click(object sender, EventArgs e)
        {
            int i = this.lstValvesName.SelectedIndex;
            if (i < 0)
            {
                return;
            }
            GSOFeature m_CloseValvesAnalyresFeature = m_CloseValvesAnalyResFeatures[i];
            globeControl1.Globe.FlyToFeature(m_CloseValvesAnalyresFeature, 1, 45, 5);
            GSOLabel newLabel = new GSOLabel();
            newLabel.Text = "关闭此阀门";
            newLabel.Style = new GSOLabelStyle();
            newLabel.Style.Opaque = 0.8;
            newLabel.Style.OutlineColor = Color.Red;
            //newLabel.Style.TractionLineEndPos = new GSOPoint2d(150, 120);
            newLabel.Style.OutlineWidth = 1;
            newLabel.Style.TracktionLineWidth = 1;
            newLabel.Style.BackBeginColor = Color.Orange;
            newLabel.Style.BackEndColor = Color.PaleGreen;

            m_CloseValvesAnalyresFeature.Label = newLabel;

            m_CloseValvesList.Add(m_CloseValvesAnalyresFeature);

            globeControl1.Refresh();
        }
Example #5
0
        private void btnCreateModel_Click(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(txtModelLayer.Text))
                {
                    MessageBox.Show("文件路径无效!", "提示");
                    return;
                }
                if (File.Exists(txtModelLayer.Text))
                {
                    MessageBox.Show("文件已存在!", "提示");
                    return;
                }

                GSOLayer sourceLayer = ctl.Globe.Layers[cmbLayer.SelectedIndex];

                GSOLayer layer = ctl.Globe.Layers.Add(txtModelLayer.Text);
                lgdFilePath = txtModelLayer.Text;
                if (layer != null)
                {
                    GSOFeatures features = sourceLayer.GetAllFeatures();

                    for (int j = 0; j < features.Length; j++)
                    {
                        GSOFeature f          = features[j];
                        GSOFeature newFeature = new GSOFeature();

                        string text = "";
                        if (combLabel.SelectedItem != null)
                        {
                            text = f.GetFieldAsString(combLabel.SelectedItem.ToString());
                        }
                        if (listFields.CheckedItems.Count > 0)
                        {
                            newFeature.Description = GetBubbleInfo(f, numWidth.Value.ToString(), numHeight.Value.ToString());
                        }

                        if (f.Geometry is GSOGeoPoint3D)
                        {
                            GSOGeoMarker marker = new GSOGeoMarker();
                            marker.Position = f.Geometry.GeoCenterPoint;
                            marker.Text     = text;
                            GSOMarkerStyle3D style = new GSOMarkerStyle3D();
                            style.IconPath      = Application.StartupPath + "\\Resource\\ddd.png";
                            marker.Style        = style;
                            newFeature.Geometry = marker;
                        }
                        else if (f.Geometry.Type == EnumGeometryType.GeoPolyline3D)
                        {
                            GSOGeoPolyline3D line  = (GSOGeoPolyline3D)f.Geometry.Clone();
                            GSOLabel         label = new GSOLabel();
                            label.Text = text;
                            GSOLabelStyle style = new GSOLabelStyle();
                            style.HasTracktionLine   = false;
                            style.OutlineColor       = Color.Transparent;
                            style.MaxVisibleDistance = 100000;
                            label.Style         = style;
                            line.Label          = label;
                            newFeature.Geometry = line;
                        }
                        else if (f.Geometry.Type == EnumGeometryType.GeoPolygon3D)
                        {
                            GSOGeoPolygon3D polygon = (GSOGeoPolygon3D)f.Geometry.Clone();
                            GSOLabel        label   = new GSOLabel();
                            label.Text = text;
                            GSOLabelStyle style = new GSOLabelStyle();
                            style.HasTracktionLine   = false;
                            style.OutlineColor       = Color.Transparent;
                            style.MaxVisibleDistance = 100000;
                            label.Style         = style;
                            polygon.Label       = label;
                            newFeature.Geometry = polygon;
                        }
                        newFeature.Name = text;
                        layer.AddFeature(newFeature);
                    }
                }
                ctl.Refresh();
                layer.Save();

                //ctl.Globe.Layers.Remove(layer);

                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #6
0
        private void btnCreateModel_Click(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(txtModelLayer.Text))
                {
                    MessageBox.Show("文件路径无效!", "提示");
                    return;
                }
                if (File.Exists(txtModelLayer.Text))
                {
                    MessageBox.Show("文件已存在!", "提示");
                    return;
                }

                GSOLayer sourceLayer = ctl.Globe.Layers[cmbLayer.SelectedIndex];

                GSOLayer layer = ctl.Globe.Layers.Add(txtModelLayer.Text);
                lgdFilePath = txtModelLayer.Text;
                if (layer != null)
                {
                    GSOFeatures features = sourceLayer.GetAllFeatures();

                    for (int j = 0; j < features.Length; j++)
                    {
                        GSOFeature f = features[j];
                        GSOFeature newFeature = new GSOFeature();

                        string text = "";
                        if (combLabel.SelectedItem != null)
                        {
                            text = f.GetFieldAsString(combLabel.SelectedItem.ToString());
                        }
                        if (listFields.CheckedItems.Count > 0)
                        {
                            newFeature.Description = GetBubbleInfo(f, numWidth.Value.ToString(), numHeight.Value.ToString());
                        }

                        if (f.Geometry is GSOGeoPoint3D)
                        {
                            GSOGeoMarker marker = new GSOGeoMarker();
                            marker.Position = f.Geometry.GeoCenterPoint;
                            marker.Text = text;
                            GSOMarkerStyle3D style = new GSOMarkerStyle3D();
                            style.IconPath = Application.StartupPath + "\\Resource\\ddd.png";
                            marker.Style = style;
                            newFeature.Geometry = marker;
                        }
                        else if(f.Geometry.Type == EnumGeometryType.GeoPolyline3D)
                        {
                            GSOGeoPolyline3D line = (GSOGeoPolyline3D)f.Geometry.Clone();
                            GSOLabel label = new GSOLabel();
                            label.Text = text;
                            GSOLabelStyle style = new GSOLabelStyle();
                            style.HasTracktionLine = false;
                            style.OutlineColor = Color.Transparent;
                            style.MaxVisibleDistance = 100000;
                            label.Style = style;
                            line.Label = label;
                            newFeature.Geometry = line;
                        }
                        else if (f.Geometry.Type == EnumGeometryType.GeoPolygon3D)
                        {
                            GSOGeoPolygon3D polygon = (GSOGeoPolygon3D)f.Geometry.Clone();
                            GSOLabel label = new GSOLabel();
                            label.Text = text;
                            GSOLabelStyle style = new GSOLabelStyle();
                            style.HasTracktionLine = false;
                            style.OutlineColor = Color.Transparent;
                            style.MaxVisibleDistance = 100000;
                            label.Style = style;
                            polygon.Label = label;
                            newFeature.Geometry = polygon;
                        }
                        newFeature.Name = text;
                        layer.AddFeature(newFeature);
                    }
                }
                ctl.Refresh();
                layer.Save();

                //ctl.Globe.Layers.Remove(layer);

                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #7
0
        //沿线运动对象
        private void addRouteObjectMenuItem_Click(object sender, EventArgs e)
        {
            if (globeControl1.Globe.SelectedObject==null)
            {
                MessageBox.Show("请先选择一条线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            GSOFeature lineFeature=globeControl1.Globe.SelectedObject;
            if(lineFeature.Geometry==null || lineFeature.Geometry.Type!=EnumGeometryType.GeoPolyline3D)
            {
                MessageBox.Show("请先选择一条线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            OpenFileDialog dlg = new OpenFileDialog();
            dlg.Filter = "*.3ds|*.3ds|*.gcm|*.gcm|*.gse|*.gse|*.obj|*.obj||";
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                GSOGeoModel model=new GSOGeoModel();
                model.FilePath = dlg.FileName;

                GSOGeoDynamicRoute dynamicRoute = new GSOGeoDynamicRoute();
                dynamicRoute.ActorGeometry = model;

                GSORoute route = new GSORoute();
                GSOGeoPolyline3D geoline = (GSOGeoPolyline3D)lineFeature.Geometry;
                for (int i = 0; i < geoline[0].Count; i++)
                {
                    route.Add(geoline[0][i]);
                }
                route.CircleRoute = false;
                route.Speed = 30;
                route.RotateSpeed = 50;
                route.AltitudeMode = geoline.AltitudeMode;
                dynamicRoute.Route = route;

                GSOFeature feature = new GSOFeature();

                dynamicRoute.Play();
                feature.Geometry = dynamicRoute;

                GSOLabel gsoLabel = new GSOLabel();
                gsoLabel.Text = "模型测试";
                feature.Label = gsoLabel;
                globeControl1.Globe.MinModelVisibleSize = 0;

                globeControl1.Globe.MemoryLayer.AddFeature(feature);
                globeControl1.Globe.Refresh();
            }
        }
Example #8
0
        private void MissileMenuItem_Click(object sender, EventArgs e)
        {
            GSORoute route = new GSORoute();

            route.Add(116.601, 39.902, 100);
            route.Add(116.602, 39.902, 150);
            route.Add(116.603, 39.902, 200);
            route.Add(116.603, 39.902, 200);
            route.Add(116.603, 39.902, 200);
            route.Add(116.603, 39.902, 200);
            route.Add(116.604, 39.902, 250);
            route.Add(116.605, 39.902, 300);
            route.Add(116.606, 39.902, 250);
            route.Add(116.607, 39.902, 200);
            route.Add(116.608, 39.902, 150);
            route.Add(116.609, 39.902, 100);
            route.Speed = 500;
            route.RotateSpeed = 200;
            route.AltitudeMode = EnumAltitudeMode.Absolute;
            route.CircleRoute=false;

            GSOGeoModel geoModel = new GSOGeoModel();
            geoModel.FilePath = Path.GetDirectoryName(Application.ExecutablePath) + "/Resource/model/aim9.3ds";
            geoModel.SetScale(30, 30, 30);

            GSOGeoDynamicRoute geoDynamicRoute = new GSOGeoDynamicRoute();
            geoDynamicRoute.TimerInterval = 20;
            geoDynamicRoute.Route = route;
            geoDynamicRoute.ActorGeometry = geoModel;
            geoDynamicRoute.Play();

            GSOFeature feature = new GSOFeature();
            feature.Geometry = geoDynamicRoute;
            GSOLabel gsoLabel = new GSOLabel();
            gsoLabel.Text = "爱国者";
            feature.Label = gsoLabel;

            globeControl1.Globe.MemoryLayer.AddFeature(feature);

            GSOCameraState cameraState = new GSOCameraState();
            cameraState.Longitude = 116.605;
            cameraState.Latitude = 39.902;
            cameraState.Altitude = 100;
            cameraState.Tilt = 85;
            cameraState.Heading = 0;
            globeControl1.Globe.FlyToCameraState(cameraState);
        }
Example #9
0
        private void DynamicCarMenuItem_Click(object sender, EventArgs e)
        {
            GSORoute route = new GSORoute();
            route.Add(116.601, 39.901, 0);
            route.Add(116.602, 39.901, 0);
            route.Add(116.603, 39.901, 0);
            route.Add(116.603, 39.902, 0);
            route.Add(116.603, 39.903, 0);
            route.Add(116.603, 39.904, 0);
            route.Speed = 50;
            route.RotateSpeed = 50;
            route.AltitudeMode = EnumAltitudeMode.ClampToGround;

            GSOGeoModel geoModel = new GSOGeoModel();
            geoModel.FilePath = Path.GetDirectoryName(Application.ExecutablePath) + "/Resource/model/tank.3ds";

            GSOGeoDynamicRoute geoDynamicRoute = new GSOGeoDynamicRoute();
            geoDynamicRoute.TimerInterval = 20;
            geoDynamicRoute.Route = route;
            geoDynamicRoute.ActorGeometry = geoModel;
            geoDynamicRoute.Play();

            GSOFeature feature = new GSOFeature();
            feature.Geometry = geoDynamicRoute;

            GSOLabel gsoLabel = new GSOLabel();
            gsoLabel.Text = "中-59";

            feature.Label = gsoLabel;

            globeControl1.Globe.MemoryLayer.AddFeature(feature);
            GSOCameraState cameraState = new GSOCameraState();
            cameraState.Longitude = 116.601;
            cameraState.Latitude = 39.901;
            cameraState.Altitude = 900;
            cameraState.Tilt = 0;
            cameraState.Heading = 0;
            globeControl1.Globe.FlyToCameraState(cameraState);
        }
Example #10
0
        private void CopterMenuItem_Click(object sender, EventArgs e)
        {
            GSORoute route = new GSORoute();
            route.Add(116.601, 39.901, 1000);
            route.Add(116.603, 39.901, 1000);
            route.Add(116.605, 39.901, 1000);
            route.Add(116.605, 39.901, 1000);
            route.Add(116.605, 39.901, 1000);
            route.Add(116.605, 39.901, 1000);
            route.Add(116.605, 39.903, 1000);
            route.Add(116.605, 39.905, 1000);
            route.Add(116.605, 39.907, 1000);
            route.Speed = 200;
            route.RotateSpeed = 50;
            route.AltitudeMode = EnumAltitudeMode.Absolute;
            route.CircleRoute = true;

            GSOGeoModel geoModel = new GSOGeoModel();
            geoModel.FilePath = Path.GetDirectoryName(Application.ExecutablePath) + "/Resource/model/客机.3ds";
            geoModel.RotateZ = -90;
            geoModel.SetScale(0.1, 0.1, 0.1);
            GSOGeoDynamicRoute geoDynamicRoute = new GSOGeoDynamicRoute();
            geoDynamicRoute.TimerInterval = 20;
            geoDynamicRoute.Route = route;
            geoDynamicRoute.ActorGeometry = geoModel;
            geoDynamicRoute.Play();

            GSOFeature feature = new GSOFeature();
            feature.Geometry = geoDynamicRoute;
            GSOLabel gsoLabel = new GSOLabel();
            gsoLabel.Text = "国航A9";
            feature.Label = gsoLabel;

            globeControl1.Globe.MemoryLayer.AddFeature(feature);

            GSOCameraState cameraState = new GSOCameraState();
            cameraState.Longitude = 116.601;
            cameraState.Latitude = 39.901;
            cameraState.Altitude = 2500;
            cameraState.Tilt = 0;
            cameraState.Heading = 0;
            globeControl1.Globe.FlyToCameraState(cameraState);
        }