- 积分
- 46
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2014-11-29
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
把图形转化为图层之后,图层的填充颜色却只有一种,求教大神怎么改变?代码如下!!!
public void addLary()
{
MessageBox.Show(layersLegend1.ActiveMapFrame.MapView.GraphicCollection.GraphicList.Count + "gggg");
VectorLayer pLayer = new VectorLayer(ShapeTypes.Polygon);
pLayer.LayerName = "rrrr";
pLayer.Visible = true;
pLayer.EditAddField("ID", typeof(double));
//layersLegend1.ActiveMapFrame.MapView.GraphicCollection.GraphicList.Add(g);
//int o = 0;
Graphic pGraphic = null;
Color[] color = new Color[5];
color[0] = Color.FromArgb(50, Color.Green);
color[1] = Color.FromArgb(50, Color.Red);
color[2] = Color.FromArgb(50, Color.Blue);
color[3] = Color.FromArgb(50, Color.Black);
color[4] = Color.FromArgb(50, Color.Red);
double[] var = new double[5];
for (int k = 0; k < (layersLegend1.ActiveMapFrame.MapView.GraphicCollection.GraphicList.Count); k++)
{
pGraphic = layersLegend1.ActiveMapFrame.MapView.GraphicCollection.GraphicList[k];
Shape pShape = pGraphic.Shape;
int shapNum = layersLegend1.ActiveMapFrame.GetLayerNodes().Count;
int shapeNum = pLayer.ShapeNum;
int i = 1;
if (pLayer.EditInsertShape(pShape, shapeNum))
{
pLayer.EditCellValue("ID", shapeNum, i);
}
i += 1;
pLayer.UpdateLegendScheme(LegendType.SingleSymbol, "ID");
PolygonBreak aPGB = (PolygonBreak)pLayer.LegendScheme.LegendBreaks[0];
aPGB.Color = color[k];
var[k] = k;
}
layersLegend1.ActiveMapFrame.AddLayer(pLayer);
pLayer.IsMaskout = true;
layersLegend1.ActiveMapFrame.MapView.PaintLayers();
|
-
|