当前位置: 首页>>代码示例>>C#>>正文


C# GraphicsLayer.GetDefaultSymbolClone方法代码示例

本文整理汇总了C#中GraphicsLayer.GetDefaultSymbolClone方法的典型用法代码示例。如果您正苦于以下问题:C# GraphicsLayer.GetDefaultSymbolClone方法的具体用法?C# GraphicsLayer.GetDefaultSymbolClone怎么用?C# GraphicsLayer.GetDefaultSymbolClone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GraphicsLayer的用法示例。


在下文中一共展示了GraphicsLayer.GetDefaultSymbolClone方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: createNewDefaultUniqueValueRenderer

 private static UniqueValueRenderer createNewDefaultUniqueValueRenderer(GraphicsLayer graphicsLayer, IEnumerable<object> uniqueValues, FieldInfo attributeField, LinearGradientBrush defaultColorRampGradientBrush, IEnumerable<Symbol> existingSymbolSet)
 {
     Symbol defaultSymbol = graphicsLayer.GetDefaultSymbol();
     UniqueValueRenderer uniqueValueRenderer = new UniqueValueRenderer()
     {
         Field = attributeField != null ? attributeField.Name : null,
         DefaultSymbol = defaultSymbol,
     };
     if (uniqueValues != null)
     {
         List<Symbol> symbols = new List<Symbol>();
         int i = 0;
         foreach (object uniqueValue in uniqueValues)
         {
             Symbol symbol = null;
             if (existingSymbolSet != null)
                 symbol = existingSymbolSet.ElementAtOrDefault(i);
             if (symbol == null)
                 symbol = graphicsLayer.GetDefaultSymbolClone();
             uniqueValueRenderer.Infos.Add(new UniqueValueInfoObj()
             {
                 Symbol = symbol,
                 SerializedValue = uniqueValue,
                 FieldType = attributeField.FieldType,
             });
             symbols.Add(symbol);
             i++;
         }
         if (defaultColorRampGradientBrush != null)
         {
             if (existingSymbolSet == null) // apply the gradient brush, only if symbols have not been pre-defined
             {
                 applyLinearGradientBrushToSymbolSet(symbols, defaultColorRampGradientBrush, defaultSymbol);
             }
         }
     }
     return uniqueValueRenderer;
 }
开发者ID:konglingjie,项目名称:arcgis-viewer-silverlight,代码行数:38,代码来源:LayerRendererHelper.cs

示例2: createNewDefaultSimpleRenderer

 private static SimpleRenderer createNewDefaultSimpleRenderer(GraphicsLayer graphicsLayer)
 {
     Symbol defaultSymbol = graphicsLayer.GetDefaultSymbolClone();
     SimpleRenderer rendererRenderer = new SimpleRenderer()
     {
         Symbol = defaultSymbol,
     };
     return rendererRenderer;
 }
开发者ID:konglingjie,项目名称:arcgis-viewer-silverlight,代码行数:9,代码来源:LayerRendererHelper.cs

示例3: createNewDefaultClassBreaksRenderer

        private static IRenderer createNewDefaultClassBreaksRenderer(GraphicsLayer graphicsLayer, FieldInfo attributeField, double min, double max, int numOfClassBreaks, LinearGradientBrush defaultColorRampGradientBrush, IEnumerable<Symbol> existingSymbolSet)
        {
            Symbol defaultSymbol = graphicsLayer.GetDefaultSymbolClone();
            ClassBreaksRenderer renderer = new ClassBreaksRenderer()
            {
                Field = attributeField != null ? attributeField.Name : null,
                DefaultSymbol = defaultSymbol,
            };
            List<Symbol> symbols = new List<Symbol>();
            if (numOfClassBreaks < 2) // classbreaks renderer must have atleast 2 classbreaks
                numOfClassBreaks = 2;
            double rangeSize = Math.Round((max - min) / numOfClassBreaks, 2);
            double rangeDelta = 1.0; // delta between 2 class ranges // we choose an integral size
            double lastRangeDeltaIncr = 1.0; // SL core api requires the last classbreak to be greater than max value of dataset
            bool fractionalIncrement = false;
            if (Math.Round(max, 0) != max)// we are dealing with a non-integeral values, so our delta's are in fractional increments
            {
                fractionalIncrement = true;
                rangeDelta = 0.01;
                lastRangeDeltaIncr = 0.01;
            }

            double startValue = min;
            for (int i = 0; i < numOfClassBreaks; i++)
            {
                Symbol symbol = null;
                if (existingSymbolSet != null)
                    symbol = existingSymbolSet.ElementAtOrDefault(i);
                if (symbol == null)
                    symbol = graphicsLayer.GetDefaultSymbolClone();
                double endValue = (startValue + rangeSize) - rangeDelta;
                ClassBreakInfo classBreak = new ClassBreakInfo()
                {
                    MinimumValue = fractionalIncrement ? startValue : Math.Floor(startValue),
                    MaximumValue = fractionalIncrement ? endValue : Math.Floor(endValue),
                    Symbol = symbol,
                };
                if (i == numOfClassBreaks - 1) // last class break
                {
                    classBreak.MaximumValue = max + lastRangeDeltaIncr;
                    if (max > 1000000) // SL has a limitation on values greater than a million http://msdn.microsoft.com/en-us/library/bb412393.aspx
                        classBreak.MaximumValue += 2.0;// the +2 is to workaround Silverlights limitation of single precision values
                }
                symbols.Add(symbol);
                renderer.Classes.Add(classBreak);
                startValue += rangeSize;
            }
            if (defaultColorRampGradientBrush != null)
            {
                if (existingSymbolSet == null) // apply the gradient brush, only if symbols have not been pre-defined
                {
                    applyLinearGradientBrushToSymbolSet(symbols, defaultColorRampGradientBrush, defaultSymbol);
                }
            }
            return renderer;
        }
开发者ID:konglingjie,项目名称:arcgis-viewer-silverlight,代码行数:56,代码来源:LayerRendererHelper.cs


注:本文中的GraphicsLayer.GetDefaultSymbolClone方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。