本文整理汇总了C#中GraphicsLayer.GetValue方法的典型用法代码示例。如果您正苦于以下问题:C# GraphicsLayer.GetValue方法的具体用法?C# GraphicsLayer.GetValue怎么用?C# GraphicsLayer.GetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GraphicsLayer
的用法示例。
在下文中一共展示了GraphicsLayer.GetValue方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetGeometryType
public static GeometryType GetGeometryType(GraphicsLayer graphicsLayer)
{
if (graphicsLayer == null)
{
throw new ArgumentNullException("graphicsLayer");
}
return (GeometryType)graphicsLayer.GetValue(GeometryTypeProperty);
}
示例2: buildAttributeNamesList
void buildAttributeNamesList(GraphicsLayer graphicsLayer, string rendererType)
{
if (graphicsLayer == null)
return;
Collection<FieldInfo> fields = graphicsLayer.GetValue(ESRI.ArcGIS.Mapping.Core.LayerExtensions.FieldsProperty) as Collection<FieldInfo>;
if (fields != null)
{
if (rendererType == Constants.ClassBreaksRenderer)
{
IEnumerable<FieldInfo> numericFields = fields.Where<FieldInfo>(f => f.FieldType == FieldType.Integer || f.FieldType == FieldType.DecimalNumber || f.FieldType == FieldType.Currency);
FieldInfo selectedField = null;
ClassBreaksRenderer classBreaksRenderer = graphicsLayer.Renderer as ClassBreaksRenderer;
if (classBreaksRenderer != null)
{
foreach (FieldInfo fieldInfo in numericFields)
{
if (string.Compare(fieldInfo.Name, classBreaksRenderer.Field) == 0)
{
selectedField = fieldInfo;
break;
}
}
}
AttributeName.ItemsSource = numericFields;
if (null != selectedField)
{
_ignoreAttributeChangedEvent = true;
AttributeName.SelectedItem = selectedField;
_ignoreAttributeChangedEvent = false;
}
}
else
{
if (rendererType == Constants.UniqueValueRenderer)
{
FieldInfo selectedField = null;
IEnumerable<FieldInfo> allowedFields = fields.Where<FieldInfo>(f => f.FieldType != FieldType.Attachment);
UniqueValueRenderer uniqueValueRenderer = graphicsLayer.Renderer as UniqueValueRenderer;
if (uniqueValueRenderer != null)
{
foreach (FieldInfo fieldInfo in allowedFields)
{
if (string.Compare(fieldInfo.Name, uniqueValueRenderer.Field) == 0)
{
selectedField = fieldInfo;
break;
}
}
}
AttributeName.ItemsSource = allowedFields;
if (null != selectedField)
{
_ignoreAttributeChangedEvent = true;
AttributeName.SelectedItem = selectedField;
_ignoreAttributeChangedEvent = false;
}
}
else
{
AttributeName.ItemsSource = null;
}
}
}
}
示例3: WriteGraphicsLayerElements
protected void WriteGraphicsLayerElements(GraphicsLayer layer)
{
GeometryType geomType = (GeometryType)layer.GetValue(LayerExtensions.GeometryTypeProperty);
if (geomType != default(GeometryType))
{
writer.WriteElementString(Constants.esriMappingPrefix, "LayerExtensions.GeometryType", Constants.esriMappingNamespace, geomType.ToString());
}
LinearGradientBrush defaultBrush = LayerExtensions.GetGradientBrush(layer);
if (defaultBrush != null)
{
writer.WriteStartElement(Constants.esriMappingPrefix, "LayerExtensions.GradientBrush", Constants.esriMappingNamespace);
BrushXamlWriter brushWriter = new BrushXamlWriter(writer, Namespaces);
brushWriter.WriteBrush(defaultBrush);
writer.WriteEndElement();
}
string rendererAttributeDisplayName = LayerExtensions.GetRendererAttributeDisplayName(layer);
if (!string.IsNullOrEmpty(rendererAttributeDisplayName))
{
writer.WriteElementString(Constants.esriMappingPrefix, "LayerExtensions.RendererAttributeDisplayName", Constants.esriMappingNamespace, rendererAttributeDisplayName);
}
//string geomServiceUrl = layer.GetValue(LayerExtensions.GeometryServiceUrlProperty) as string;
//if (!string.IsNullOrEmpty(geomServiceUrl))
//{
// writer.WriteElementString(Constants.esriMappingPrefix, "LayerExtensions.GeometryServiceUrl", Constants.esriMappingNamespace, geomServiceUrl);
//}
//SpatialReference mapSpatialRef = (SpatialReference)layer.GetValue(LayerExtensions.MapSpatialReferenceProperty);
//if (mapSpatialRef != null)
//{
// writer.WriteStartElement(Constants.esriMappingPrefix, "LayerExtensions.MapSpatialReference", Constants.esriMappingNamespace);
// WriteSpatialReference(writer, Namespaces, mapSpatialRef);
// writer.WriteEndElement();
//}
//SpatialReference layerSpatialRef = (SpatialReference)layer.GetValue(LayerExtensions.LayerSpatialReferenceProperty);
//if (layerSpatialRef != null)
//{
// writer.WriteStartElement(Constants.esriMappingPrefix, "LayerExtensions.LayerSpatialReference", Constants.esriMappingNamespace);
// WriteSpatialReference(writer, Namespaces, layerSpatialRef);
// writer.WriteEndElement();
//}
Collection<FieldInfo> fields = (Collection<FieldInfo>)layer.GetValue(LayerExtensions.FieldsProperty);
if (fields != null)
{
writer.WriteStartElement(Constants.esriMappingPrefix, "LayerExtensions.Fields", Constants.esriMappingNamespace);
FieldInfo.WriteFieldInfos(fields, writer);
writer.WriteEndElement();
}
string displayField = LayerExtensions.GetDisplayField(layer);
if (!string.IsNullOrEmpty(displayField))
{
writer.WriteElementString(Constants.esriMappingPrefix, "LayerExtensions.DisplayField", Constants.esriMappingNamespace, displayField);
}
if (LayerExtensions.GetPopUpsOnClick(layer))
writer.WriteElementString(Constants.esriMappingPrefix, "LayerExtensions.PopUpsOnClick", Constants.esriMappingNamespace, "True");
else
writer.WriteElementString(Constants.esriMappingPrefix, "LayerExtensions.PopUpsOnClick", Constants.esriMappingNamespace, "False");
//string mapTipContainerXaml = layer.GetValue(LayerExtensions.MapTipContainerXamlProperty) as string;
//if (!string.IsNullOrEmpty(mapTipContainerXaml))
//{
// writer.WriteElementString(Constants.esriMappingPrefix, "LayerExtensions.MapTipContainerXaml", Constants.esriMappingNamespace, mapTipContainerXaml);
// writer.WriteStartElement("GraphicsLayer.MapTip", Constants.esriNamespace);
// writer.WriteStartElement("ContentControl");
// writer.WriteRaw(mapTipContainerXaml);
// writer.WriteEndElement();
// writer.WriteEndElement();
//}
if (layer.Clusterer != null)
{
WriteLayerClusterer(layer.Clusterer);
}
if (layer.Renderer != null)
{
WriteRenderer(layer.Renderer);
}
if (layer.Graphics.Count > 0)
{
WriteGraphicsDataset(layer);
}
//if (layer.MapTip != null)
//{
//writer.WriteStartElement("GraphicsLayer.MapTip", Namespaces[Constants.esriPrefix]);
//if (LayerMapTipFormatting != null)
//{
// LayerMapTipFormattingEventArgs args = new LayerMapTipFormattingEventArgs
// {
// Layer = layer
// };
// LayerMapTipFormatting(this, args);
// string mapTipXaml = args.LayerMapTipXaml;
//.........这里部分代码省略.........
示例4: GetIsMapTipDirty
public static bool GetIsMapTipDirty(GraphicsLayer graphicsLayer)
{
return (bool)graphicsLayer.GetValue(IsMapTipDirtyProperty);
}
示例5: GetRendererAttributeDisplayName
/// <summary>
/// Gets the value of the RendererAttributeDisplayName attached property for a specified GraphicsLayer.
/// </summary>
/// <param name="element">The GraphicsLayer from which the property value is read.</param>
/// <returns>The RendererAttributeDisplayName property value for the GraphicsLayer.</returns>
public static string GetRendererAttributeDisplayName(GraphicsLayer element)
{
if (element == null)
{
throw new ArgumentNullException("element");
}
return element.GetValue(RendererAttributeDisplayNameProperty) as string;
}
示例6: GetDataset
/// <summary>
/// Gets the value of the Dataset attached property for a specified GraphicsLayer.
/// </summary>
/// <param name="layer">The GraphicsLayer from which the property value is read.</param>
/// <returns>The Dataset property value for the GraphicsLayer.</returns>
public static string GetDataset(GraphicsLayer layer)
{
if (layer == null)
{
throw new ArgumentNullException("element");
}
return layer.GetValue(DatasetProperty) as string;
}
示例7: GetGradientBrush
/// <summary>
/// Gets the value of the GradientBrush attached property for a specified GraphicsLayer.
/// </summary>
/// <param name="graphicsLayer">The GraphicsLayer from which the property value is read.</param>
/// <returns>The GradientBrush property value for the GraphicsLayer.</returns>
public static LinearGradientBrush GetGradientBrush(GraphicsLayer graphicsLayer)
{
if (graphicsLayer == null)
{
throw new ArgumentNullException("graphicsLayer");
}
return graphicsLayer.GetValue(GradientBrushProperty) as LinearGradientBrush;
}
示例8: GetDisplayField
public static string GetDisplayField(GraphicsLayer graphicsLayer)
{
return (string)graphicsLayer.GetValue(DisplayFieldProperty);
}
示例9: GetFields
public static Collection<FieldInfo> GetFields(GraphicsLayer graphicsLayer)
{
if (graphicsLayer == null)
{
throw new ArgumentNullException("graphicsLayer");
}
Collection<FieldInfo> fields = graphicsLayer.GetValue(FieldsProperty) as Collection<FieldInfo>;
if (fields == null)
{
// Initialize on demand
fields = new Collection<FieldInfo>();
SetFields(graphicsLayer, fields);
}
return fields;
}
示例10: GetPopUpsOnClick
public static bool GetPopUpsOnClick(GraphicsLayer layer)
{
if (layer == null)
{
throw new ArgumentNullException("layer");
}
return (bool)layer.GetValue(PopUpsOnClickProperty);
}
示例11: bindToGraphicsLayer
private void bindToGraphicsLayer(GraphicsLayer graphicsLayer)
{
object fields = graphicsLayer.GetValue(LayerExtensions.FieldsProperty);
if (fields is IEnumerable<FieldInfo>)
{
string displayField = LayerExtensions.GetDisplayField(graphicsLayer);
if (string.IsNullOrEmpty(displayField))
{
displayField = FieldInfo.GetDefaultDisplayField(fields as IEnumerable<FieldInfo>);
if (!string.IsNullOrEmpty(displayField))
LayerExtensions.SetDisplayField(graphicsLayer, displayField);
}
#region Set data context
MapTipsConfigInfo info = new MapTipsConfigInfo()
{
LayerSelectionVisibility = false,
PopUpsOnClick = LayerExtensions.GetPopUpsOnClick(graphicsLayer),
IsPopupEnabled = ESRI.ArcGIS.Client.Extensibility.LayerProperties.GetIsPopupEnabled(graphicsLayer),
Layer = graphicsLayer,
};
setFromWebMap(info);
info.SupportsOnClick = true;
info.Layers = new Collection<LayerInformation>();
LayerInformation item = new LayerInformation();
item.PopUpsEnabled = true;
item.ID = 0;
item.Name = LayerExtensions.GetTitle(Layer);
item.DisplayField = displayField;
item.Fields = fields as Collection<FieldInfo>;
if (graphicsLayer is FeatureLayer)
{
foreach (FieldInfo field in item.Fields)
{
if (field.DomainSubtypeLookup == DomainSubtypeLookup.NotDefined)
field.DomainSubtypeLookup = FieldInfo.GetDomainSubTypeLookup(graphicsLayer, field);
}
}
info.Layers.Add(item);
info.SelectedItem = item;
info.PropertyChanged += info_PropertyChanged;
this.DataContext = info;
#endregion
}
}