예제 #1
0
 private void buttonCancel_Click(object sender, EventArgs e)
 {
     mLayer.RemoveAllFeature();
     mLayer.AddFeatures(mFeaturesOld);
     mGlobeControl.Refresh();
     this.Close();
 }
예제 #2
0
 /// <summary>
 /// 文字图层
 /// </summary>
 /// <param name="text">显示的文字</param>
 private void TextTitle(string text)
 {
     if (layerScreenText != null)
     {
         //清除其中所有要素
         layerScreenText.RemoveAllFeature();
         GSOGeoScreenText overlayTextTitle = new GSOGeoScreenText(); //创建屏幕文字
         GSOTextStyle     textStyle        = new GSOTextStyle();     //设置属性
         textStyle.ForeColor        = Color.White;
         textStyle.FontSize         = 36;
         overlayTextTitle.TextStyle = textStyle;
         overlayTextTitle.Align     = EnumAlign.TopLeft;        //设置文字对齐方式
         overlayTextTitle.PosAlign  = EnumAlign.BottomRight;    //设置文字位置
         overlayTextTitle.Name      = "ScreenTextTitle";
         overlayTextTitle.SetOffset(180, 60);                   //设置文字偏移量
         overlayTextTitle.Text = text;                          //设置文字
         GSOFeature feature_ScreenTextTitle = new GSOFeature(); //创建要素
         feature_ScreenTextTitle.Geometry = overlayTextTitle;   //赋予要素
         layerScreenText.AddFeature(feature_ScreenTextTitle);
         layerScreenText.Save();
     }
 }
예제 #3
0
        private void button2_Click(object sender, EventArgs e)
        {
            double dMinLon = 0, dMaxLon = 0, dMinLat = 0, dMaxLat = 0;
            string strLayerPath = saveFileDialog1.FileName;
            string path         = Application.StartupPath + "\\Resource\\image\\DefaultIcon.png";

            if (string.IsNullOrEmpty(saveFileDialog1.FileName))
            {
                MessageBox.Show("请选择存储目录");
                return;
            }
            globeControl1.Globe.MemoryLayer.SaveAs(strLayerPath);
            layerTemp = globeControl1.Globe.Layers.Add(strLayerPath);
            layerTemp.RemoveAllFeature();
            GSOGeoPolyline3D polyLine = new GSOGeoPolyline3D();
            GSOPoint3ds      pois     = new GSOPoint3ds();

            for (int i = 0; i < listView1.Items.Count; i++)
            {
                ListViewItem item = listView1.Items[i];
                double       lon, lat;
                if (!double.TryParse(item.SubItems[3].Text.ToString() == "" ? "0" : item.SubItems[3].Text.ToString(), out lon))
                {
                    MessageBox.Show("经度参数不合法");
                    return;
                }
                if (!double.TryParse(item.SubItems[4].Text.ToString() == "" ? "0" : item.SubItems[4].Text.ToString(), out lat))
                {
                    MessageBox.Show("纬度参数不合法");
                    return;
                }
                if (i == 0)
                {
                    dMaxLon = lon;
                    dMinLon = lon;
                    dMinLat = lat;
                    dMaxLat = lat;
                }
                GSOPoint3d node = new GSOPoint3d(lon, lat, 0);
                pois.Add(node);
                string strDescriptionPrefix = "<![CDATA[<!-- <BALLOON><CONTENT_CX>800</CONTENT_CX><CONTENT_CY>600</CONTENT_CY>"
                                              + "<CONTENT_TYPE>link</CONTENT_TYPE><SHOW_MODE>balloonex</SHOW_MODE>-->";

                string strDescription = strDescriptionPrefix + "file:\\\\" + Application.StartupPath + "\\Resource\\Page\\pic_route.html";
                strDescription += "?URL=" + item.SubItems[5].Text.ToString();
                //strDescription += "]]>";
                AddMarker(item.SubItems[1].Text.ToString(), lon, lat, path, strDescription, layerTemp);

                if (lon < dMinLon)
                {
                    dMinLon = lon;
                }
                else if (lon > dMaxLon)
                {
                    dMaxLon = lon;
                }
                if (lat < dMinLat)
                {
                    dMinLat = lat;
                }
                else if (lat > dMaxLat)
                {
                    dMaxLat = lat;
                }
            }
            if (layerTemp == null)
            {
                MessageBox.Show("没有生成轨迹的数据");
                return;
            }
            polyLine.AddPart(pois);
            GSOFeature feature = new GSOFeature();

            feature.Geometry = polyLine;
            layerTemp.AddFeature(feature);//添加线
            layerTemp.SaveAs(strLayerPath);
            globeControl1.Globe.FlyToFeature(feature);
        }
예제 #4
0
파일: MainFrm.cs 프로젝트: StarU/qkKL6Dgf12
 private GSOFeatures getFeatureByPolygon(GSOLayer layer,GSOFeatures features, GSOPoint3d point, double allowValue)
 {
     if (layer == null || point == null || allowValue <= 0)
     {
         return null;
     }
     GSOGeoPolyline3D bufferLine = new GSOGeoPolyline3D();
     GSOPoint3ds points = new GSOPoint3ds();
     points.Add(point);
     GSOPoint3d newPoint = new GSOPoint3d();
     newPoint.X = point.X + 0.00001;
     newPoint.Y = point.Y;
     newPoint.Z = point.Z;
     points.Add(newPoint);
     bufferLine.AddPart(points);
     GSOGeoPolygon3D polygon = bufferLine.CreateBuffer(allowValue, true, 12, false, false);
     layer.RemoveAllFeature();
     layer.AddFeatures(features);
     GSOFeatures featuresInPolygon = layer.FindFeaturesInPolygon(polygon, false);
     return featuresInPolygon;
 }