示例#1
0
 /// <summary>
 /// Initializes a new instance of the GradientTheme class
 /// </summary>
 /// <remarks>
 /// <para>The gradient theme interpolates linearly between two styles based on a numerical attribute in the datasource.
 /// This is useful for scaling symbols, line widths, line and fill colors from numerical attributes.</para>
 /// <para>Colors are interpolated between two colors, but if you want to interpolate through more colors (fx. a rainbow),
 /// set the <see cref="TextColorBlend"/>, <see cref="LineColorBlend"/> and <see cref="FillColorBlend"/> properties
 /// to a custom <see cref="ColorBlend"/>.
 /// </para>
 /// <para>The following properties are scaled (properties not mentioned here are not interpolated):
 /// <list type="table">
 ///		<listheader><term>Property</term><description>Remarks</description></listheader>
 ///		<item><term><see cref="System.Drawing.Color"/></term><description>Red, Green, Blue and Alpha values are linearly interpolated.</description></item>
 ///		<item><term><see cref="System.Drawing.Pen"/></term><description>The color, width, color of pens are interpolated. MiterLimit,StartCap,EndCap,LineJoin,DashStyle,DashPattern,DashOffset,DashCap,CompoundArray, and Alignment are switched in the middle of the min/max values.</description></item>
 ///		<item><term><see cref="System.Drawing.SolidBrush"/></term><description>SolidBrush color are interpolated. Other brushes are not supported.</description></item>
 ///		<item><term><see cref="SharpMap.Styles.VectorStyle"/></term><description>MaxVisible, MinVisible, Line, Outline, Fill and SymbolScale are scaled linearly. Symbol, EnableOutline and Enabled switch in the middle of the min/max values.</description></item>
 ///		<item><term><see cref="SharpMap.Styles.LabelStyle"/></term><description>FontSize, BackColor, ForeColor, MaxVisible, MinVisible, Offset are scaled linearly. All other properties use min-style.</description></item>
 /// </list>
 /// </para>
 /// <example>
 /// Creating a rainbow colorblend showing colors from red, through yellow, green and blue depicting
 /// the population density of a country.
 /// <code lang="C#">
 /// //Create two vector styles to interpolate between
 /// SharpMap.Styles.VectorStyle min = new SharpMap.Styles.VectorStyle();
 /// SharpMap.Styles.VectorStyle max = new SharpMap.Styles.VectorStyle();
 /// min.Outline.Width = 1f; //Outline width of the minimum value
 /// max.Outline.Width = 3f; //Outline width of the maximum value
 /// //Create a theme interpolating population density between 0 and 400
 /// SharpMap.Rendering.Thematics.GradientTheme popdens = new SharpMap.Rendering.Thematics.GradientTheme("PopDens", 0, 400, min, max);
 /// //Set the fill-style colors to be a rainbow blend from red to blue.
 /// popdens.FillColorBlend = SharpMap.Rendering.Thematics.ColorBlend.Rainbow5;
 /// myVectorLayer.Theme = popdens;
 /// </code>
 /// </example>
 /// </remarks>
 /// <param name="columnName">Name of column to extract the attribute</param>
 /// <param name="minValue">Minimum value</param>
 /// <param name="maxValue">Maximum value</param>
 /// <param name="minStyle">Color for minimum value</param>
 /// <param name="maxStyle">Color for maximum value</param>
 public GradientTheme(string columnName, double minValue, double maxValue, SharpMap.Styles.IStyle minStyle, SharpMap.Styles.IStyle maxStyle)
 {
     _ColumnName = columnName;
     _min        = minValue;
     _max        = maxValue;
     _maxStyle   = maxStyle;
     _minStyle   = minStyle;
 }
示例#2
0
 /// <summary>
 /// Returns the <see cref="System.Drawing.Color">color</see> based on an attribute value
 /// </summary>
 /// <returns>Style generated by GetStyle-Delegate</returns>
 public SharpMap.Styles.IStyle GetStyle(IFeature feature)
 {
     if (_getStyleDelegate == null)
     {
         return(_DefaultStyle);
     }
     SharpMap.Styles.IStyle style = _getStyleDelegate(feature);
     if (style != null)
     {
         return(style);
     }
     else
     {
         return(_DefaultStyle);
     }
 }
示例#3
0
 /// <summary>
 /// Initializes a new instance of the GradientTheme class
 /// </summary>
 /// <remarks>
 /// <para>The gradient theme interpolates linearly between two styles based on a numerical attribute in the datasource.
 /// This is useful for scaling symbols, line widths, line and fill colors from numerical attributes.</para>
 /// <para>Colors are interpolated between two colors, but if you want to interpolate through more colors (fx. a rainbow),
 /// set the <see cref="TextColorBlend"/>, <see cref="LineColorBlend"/> and <see cref="FillColorBlend"/> properties
 /// to a custom <see cref="ColorBlend"/>.
 /// </para>
 /// <para>The following properties are scaled (properties not mentioned here are not interpolated):
 /// <list type="table">
 ///		<listheader><term>Property</term><description>Remarks</description></listheader>
 ///		<item><term><see cref="System.Drawing.Color"/></term><description>Red, Green, Blue and Alpha values are linearly interpolated.</description></item>
 ///		<item><term><see cref="System.Drawing.Pen"/></term><description>The color, width, color of pens are interpolated. MiterLimit,StartCap,EndCap,LineJoin,DashStyle,DashPattern,DashOffset,DashCap,CompoundArray, and Alignment are switched in the middle of the min/max values.</description></item>
 ///		<item><term><see cref="System.Drawing.SolidBrush"/></term><description>SolidBrush color are interpolated. Other brushes are not supported.</description></item>
 ///		<item><term><see cref="SharpMap.Styles.VectorStyle"/></term><description>MaxVisible, MinVisible, Line, Outline, Fill and SymbolScale are scaled linearly. Symbol, EnableOutline and Enabled switch in the middle of the min/max values.</description></item>
 ///		<item><term><see cref="SharpMap.Styles.LabelStyle"/></term><description>FontSize, BackColor, ForeColor, MaxVisible, MinVisible, Offset are scaled linearly. All other properties use min-style.</description></item>
 /// </list>
 /// </para>
 /// <example>
 /// Creating a rainbow colorblend showing colors from red, through yellow, green and blue depicting 
 /// the population density of a country.
 /// <code lang="C#">
 /// //Create two vector styles to interpolate between
 /// SharpMap.Styles.VectorStyle min = new SharpMap.Styles.VectorStyle();
 /// SharpMap.Styles.VectorStyle max = new SharpMap.Styles.VectorStyle();
 /// min.Outline.Width = 1f; //Outline width of the minimum value
 /// max.Outline.Width = 3f; //Outline width of the maximum value
 /// //Create a theme interpolating population density between 0 and 400
 /// SharpMap.Rendering.Thematics.GradientTheme popdens = new SharpMap.Rendering.Thematics.GradientTheme("PopDens", 0, 400, min, max);
 /// //Set the fill-style colors to be a rainbow blend from red to blue.
 /// popdens.FillColorBlend = SharpMap.Rendering.Thematics.ColorBlend.Rainbow5;
 /// myVectorLayer.Theme = popdens;
 /// </code>
 /// </example>
 /// </remarks>
 /// <param name="columnName">Name of column to extract the attribute</param>
 /// <param name="minValue">Minimum value</param>
 /// <param name="maxValue">Maximum value</param>
 /// <param name="minStyle">Color for minimum value</param>
 /// <param name="maxStyle">Color for maximum value</param>
 public GradientTheme(string columnName, double minValue, double maxValue, SharpMap.Styles.IStyle minStyle, SharpMap.Styles.IStyle maxStyle)
 {
     _ColumnName = columnName;
     _min = minValue;
     _max = maxValue;
     _maxStyle = maxStyle;
     _minStyle = minStyle;
 }