代码拉取完成,页面将自动刷新
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using GeoScene.Data;
using GeoScene.Engine;
using GeoScene.Globe;
namespace WorldGIS
{
public partial class FrmSetColor : Form
{
GSOGlobeControl globeControl1;
public FrmSetColor(GSOGlobeControl _globeControl1)
{
InitializeComponent();
globeControl1 = _globeControl1;
}
private void FrmSetColor_Load(object sender, EventArgs e)
{
for (int i = 0; i < globeControl1.Globe.Layers.Count; i++)
{
GSOLayer layer = globeControl1.Globe.Layers[i];
if (layer != null && layer.Type == EnumLayerType.FeatureLayer)
{
LayerString layerstring = new LayerString(layer);
comboBoxEx1.Items.Add(layerstring);
comboBoxEx2.Items.Add(layerstring);
}
}
}
private void buttonX1_Click(object sender, EventArgs e)
{
Color color1 = colorPickerButton1.SelectedColor;
Color color2 = colorPickerButton2.SelectedColor;
Color color3 = colorPickerButton3.SelectedColor;
Color color4 = colorPickerButton4.SelectedColor;
Color color5 = colorPickerButton5.SelectedColor;
Color color6 = colorPickerButton6.SelectedColor;
Color color7 = colorPickerButton7.SelectedColor;
Color color8 = colorPickerButton8.SelectedColor;
List<Color> listColors = new List<Color>();
for (int i = 0; i < 6; i++)
{
listColors.Add(color1);
listColors.Add(color2);
listColors.Add(color3);
listColors.Add(color4);
listColors.Add(color5);
listColors.Add(color6);
listColors.Add(color7);
listColors.Add(color8);
}
GSOLayer layerWaike = (comboBoxEx1.SelectedItem as LayerString).Layer;
GSOLayer layer = (comboBoxEx2.SelectedItem as LayerString).Layer;
for (int i = 0; i < layerWaike.GetAllFeatures().Length; i++)
{
GSOFeature f = layerWaike.GetAt(i);
GSOGeoModel modelWaike = f.Geometry as GSOGeoModel;
GSOEntityStyle3D style = new GSOEntityStyle3D();
style.UsingSingleColor = true;
style.EntityColor = Color.FromArgb(200, listColors[i]);
modelWaike.Style = style;
GSOFeatures fs = layer.GetFeatureByName(f.Name + "_", false);
for (int j = 0; j < fs.Length; j++)
{
GSOFeature feature = fs[j];
GSOGeoModel model = feature.Geometry as GSOGeoModel;
style = new GSOEntityStyle3D();
style.UsingSingleColor = true;
style.EntityColor = Color.FromArgb(122, ((i % 2 == 0) ? listColors[j] : listColors[j + 2]));
model.Style = style;
}
}
globeControl1.Refresh();
MessageBox.Show("成功!");
}
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。