本文整理汇总了C#中GraphicsLayer.SetValue方法的典型用法代码示例。如果您正苦于以下问题:C# GraphicsLayer.SetValue方法的具体用法?C# GraphicsLayer.SetValue怎么用?C# GraphicsLayer.SetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GraphicsLayer
的用法示例。
在下文中一共展示了GraphicsLayer.SetValue方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetGeometryType
public static void SetGeometryType(GraphicsLayer graphicsLayer, GeometryType value)
{
if (graphicsLayer == null)
{
throw new ArgumentNullException("graphicsLayer");
}
graphicsLayer.SetValue(GeometryTypeProperty, value);
}
示例2: CreateGraphicsLayer
/// <summary>
/// Converts a single graphic "note" element into a graphics layer.
/// </summary>
/// <param name="name">The name to assign to the graphics layer.</param>
/// <param name="graphic">The graphic element to add to the graphics layer.</param>
/// <param name="map">The map to which the layer will eventually be added, to prevent name conflicts with existing layers.</param>
/// <returns>A graphics layer that contains the graphic element.</returns>
public static GraphicsLayer CreateGraphicsLayer(string name, Graphic graphic, Map map)
{
graphic.Attributes["Name"] = name;
GraphicsLayer graphicsLayer = new GraphicsLayer();
graphicsLayer.ID = name;
if (string.IsNullOrEmpty(graphicsLayer.ID) || (!string.IsNullOrEmpty(graphicsLayer.ID) && map.Layers[graphicsLayer.ID] != null))
graphicsLayer.ID = Guid.NewGuid().ToString("N");
graphicsLayer.Graphics.Add(graphic);
graphicsLayer.Renderer = new ESRI.ArcGIS.Mapping.Core.Symbols.HiddenRenderer();
graphicsLayer.SetValue(ESRI.ArcGIS.Client.Extensibility.MapApplication.LayerNameProperty, name);
Collection<FieldInfo> fields = new Collection<FieldInfo>();
fields.Add(new FieldInfo()
{
Name = "Name",
VisibleInAttributeDisplay = true,
DisplayName = "Name",
FieldType = FieldType.Text,
VisibleOnMapTip = false
});
ESRI.ArcGIS.Mapping.Core.LayerExtensions.SetFields(graphicsLayer, fields);
return graphicsLayer;
}
示例3: AddResultLayer
private void AddResultLayer(GraphicsLayer resultsLayer, bool isSelected, string displayName,
ESRI.ArcGIS.Mapping.Core.GeometryType geometryType, int? index)
{
resultsLayer.SetValue(ESRI.ArcGIS.Client.Extensibility.MapApplication.LayerNameProperty, displayName);
resultsLayer.ID = displayName;
resultsLayer.SetValue(ESRI.ArcGIS.Client.Extensibility.LayerExtensions.InitialUpdateCompletedProperty, true);
if (index == null || index.Value < 0 || index.Value >= Map.Layers.Count)
Map.Layers.Add(resultsLayer);
else
Map.Layers.Insert(index.Value, resultsLayer);
}
示例4: addInput
void addInput(ESRI.ArcGIS.Client.Geometry.Geometry geometry)
{
GraphicsLayer layer = getLayer();
#region Create layer if not already there and add to map
if (layer == null)
{
InputLayerID = Guid.NewGuid().ToString("N");
layer = new GraphicsLayer();
if (config.Layer != null)
{
layer.Renderer = config.Layer.Renderer;
Core.LayerExtensions.SetFields(layer, Core.LayerExtensions.GetFields(config.Layer));
Core.LayerExtensions.SetGeometryType(layer, Core.LayerExtensions.GetGeometryType(config.Layer));
Core.LayerExtensions.SetDisplayField(layer, Core.LayerExtensions.GetDisplayField(config.Layer));
Core.LayerExtensions.SetPopUpsOnClick(layer, Core.LayerExtensions.GetPopUpsOnClick(config.Layer));
LayerProperties.SetIsPopupEnabled(layer, LayerProperties.GetIsPopupEnabled(config.Layer));
}
layer.ID = InputLayerID;
layer.SetValue(MapApplication.LayerNameProperty,
string.IsNullOrEmpty(config.LayerName) ?
string.IsNullOrEmpty(config.Label) ? config.Name : config.Label
: config.LayerName);
layer.Opacity = config.Opacity;
Map.Layers.Add(layer);
}
#endregion
#region Add geometry to layer
if (config.GeometryType == Core.GeometryType.MultiPoint) // Special handling for MultiPoint geometry
{
if (layer.Graphics.Count == 0)
{
// Create a new MultiPoint geometry and add the passed-in point to it
var multipoint = new MultiPoint() { SpatialReference = geometry.SpatialReference };
multipoint.Points.Add((MapPoint)geometry);
var g = new Graphic() { Geometry = multipoint };
layer.Graphics.Add(g);
}
else
{
// Get the sketch graphic's MultiPoint geometry and add the passed-in point to it
var multipoint = (MultiPoint)layer.Graphics[0].Geometry;
multipoint.Points.Add((MapPoint)geometry);
layer.Refresh();
}
}
else
{
Graphic g = new Graphic() { Geometry = geometry };
layer.Graphics.Add(g);
}
#endregion
}
示例5: addInput
void addInput(ESRI.ArcGIS.Client.Geometry.Geometry geometry)
{
GraphicsLayer layer = getLayer();
#region Create layer if not already there and add to map
if (layer == null)
{
InputLayerID = Guid.NewGuid().ToString("N");
layer = new GraphicsLayer();
if (config.Layer != null)
{
layer.Renderer = config.Layer.Renderer;
Core.LayerExtensions.SetFields(layer, Core.LayerExtensions.GetFields(config.Layer));
Core.LayerExtensions.SetGeometryType(layer, Core.LayerExtensions.GetGeometryType(config.Layer));
Core.LayerExtensions.SetDisplayField(layer, Core.LayerExtensions.GetDisplayField(config.Layer));
Core.LayerExtensions.SetPopUpsOnClick(layer, Core.LayerExtensions.GetPopUpsOnClick(config.Layer));
LayerProperties.SetIsPopupEnabled(layer, LayerProperties.GetIsPopupEnabled(config.Layer));
}
layer.ID = InputLayerID;
layer.SetValue(MapApplication.LayerNameProperty,
string.IsNullOrEmpty(config.LayerName) ?
string.IsNullOrEmpty(config.Label) ? config.Name : config.Label
: config.LayerName);
layer.Opacity = config.Opacity;
Map.Layers.Add(layer);
}
#endregion
#region Add geometry to layer
Graphic g = new Graphic() { Geometry = geometry };
layer.Graphics.Add(g);
#endregion
}
示例6: SetIsMapTipDirty
public static void SetIsMapTipDirty(GraphicsLayer graphicsLayer, bool value)
{
graphicsLayer.SetValue(IsMapTipDirtyProperty, value);
}
示例7: SetDataset
/// <summary>
/// Sets the value of the Dataset attached property to a specified GraphicsLayer.
/// </summary>
/// <param name="layer">The GraphicsLayer to which the attached property is written.</param>
/// <param name="value">The needed Dataset value.</param>
public static void SetDataset(GraphicsLayer layer, string value)
{
if (layer == null)
{
throw new ArgumentNullException("element");
}
layer.SetValue(DatasetProperty, value);
}
示例8: SetRunLayerPostInitializationActions
public static void SetRunLayerPostInitializationActions(GraphicsLayer layer, bool value)
{
if (layer == null)
{
throw new ArgumentNullException("layer");
}
if (value)
layer.SetValue(RunLayerPostInitializationActionsProperty, value);
else
layer.ClearValue(RunLayerPostInitializationActionsProperty);
}
示例9: SetRendererAttributeDisplayName
/// <summary>
/// Sets the value of the RendererAttributeDisplayName attached property to a specified GraphicsLayer.
/// </summary>
/// <param name="element">The GraphicsLayer to which the attached property is written.</param>
/// <param name="value">The needed RendererAttributeDisplayName value.</param>
public static void SetRendererAttributeDisplayName(GraphicsLayer element, string value)
{
if (element == null)
{
throw new ArgumentNullException("element");
}
element.SetValue(RendererAttributeDisplayNameProperty, value);
}
示例10: SetGradientBrush
/// <summary>
/// Sets the value of the GradientBrush attached property to a specified GraphicsLayer.
/// </summary>
/// <param name="graphicsLayer">The GraphicsLayer to which the attached property is written.</param>
/// <param name="value">The needed GradientBrush value.</param>
public static void SetGradientBrush(GraphicsLayer graphicsLayer, LinearGradientBrush value)
{
if (graphicsLayer == null)
{
throw new ArgumentNullException("graphicsLayer");
}
graphicsLayer.SetValue(GradientBrushProperty, value);
}
示例11: SetDisplayField
public static void SetDisplayField(GraphicsLayer graphicsLayer, string value)
{
graphicsLayer.SetValue(DisplayFieldProperty, value);
SetIsMapTipDirty(graphicsLayer, true);
}
示例12: SetFields
public static void SetFields(GraphicsLayer graphicsLayer, Collection<FieldInfo> value)
{
graphicsLayer.SetValue(FieldsProperty, value);
SetIsMapTipDirty(graphicsLayer, true);
}
示例13: SetPopUpsOnClick
public static void SetPopUpsOnClick(GraphicsLayer layer, bool value)
{
if (layer == null)
{
throw new ArgumentNullException("layer");
}
layer.SetValue(PopUpsOnClickProperty, value);
}