User Tools

Site Tools


map_suite_predefined_styles

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
map_suite_predefined_styles [2016/11/16 19:34]
tomtaylor [WorldMapKitAreaStyles]
map_suite_predefined_styles [2016/11/16 23:31] (current)
tomtaylor [Overview]
Line 2: Line 2:
  
 ===== Overview ===== ===== Overview =====
-MapSuite contains many predefined styles, including the WorldMapKit Predifined Styles+MapSuite contains many predefined styles, including the WorldMapKit Predifined Styles ​outlined below.
  
 +=== Code ===
 +This code snippet retrieves all of the AreaStyles returned by the methods in the WorldMapKitAreaStyles class using //​Reflection//,​ and saves them as images.
 +
 +            MethodInfo[] methodInfos = typeof(WorldMapKitAreaStyles).GetMethods(BindingFlags.Public | BindingFlags.Static);​
 +            PropertyInfo[] propertyInfos;​
 +            propertyInfos = typeof(WorldMapKitAreaStyles).GetProperties(BindingFlags.Public |
 +                                                          BindingFlags.Static);​
 +            AreaStyle areaStyle;
 +            foreach (MethodInfo methodInfo in methodInfos)
 +            {
 +                ParameterInfo[] parameterInfos = methodInfo.GetParameters();​
 +                if (parameterInfos.Length > 1)
 +                {
 +                    int parmLength = parameterInfos.Length;​
 +                }
 +                List<​object>​ parmList = new List<​object>​();​
 +                foreach (ParameterInfo parameterInfo in parameterInfos)
 +                {
 +                    if (parameterInfo.ParameterType == typeof(Single) || parameterInfo.ParameterType == typeof(int) || parameterInfo.ParameterType == typeof(float))
 +                    {
 +                        parmList.Add(25);​
 +                    }
 +                    else if (parameterInfo.ParameterType == typeof(String))
 +                    {
 +                        parmList.Add("​Test"​);​
 +                    }
 +                }
 +                object[] parms = new object[] { };
 +                if (parmList.Count > 0)
 +                {
 +                    parms = parmList.ToArray();​
 +                }
 +                areaStyle = (AreaStyle)methodInfo.Invoke(null,​ parms);
 +                Bitmap bitmap = new Bitmap(128, 128);
 +                GdiPlusGeoCanvas gdiPlusGeoCanvas = new GdiPlusGeoCanvas();​
 +                gdiPlusGeoCanvas.BeginDrawing(bitmap,​ new RectangleShape(-180,​ 90, 180, -90), GeographyUnit.DecimalDegree);​
 +                areaStyle.DrawSample(gdiPlusGeoCanvas);​
 +                gdiPlusGeoCanvas.EndDrawing();​
 +                bitmap.Save(@"​c:​\temp\AreaStyles\"​ + methodInfo.Name + "​.png",​ ImageFormat.Png);​
 +             }
 ==== WorldMapKitAreaStyles ==== ==== WorldMapKitAreaStyles ====
  
-{{:​worldmapkitareastyles.png|}}+{{::​worldmapkitareastyles.png|}
 +==== WorldMapKitLineStyles ==== 
 + 
 +The previous code can modified to produce these images, by changing **WorldMapKitAreaStyles** to **WorldMapKitLineStyles**,​ and **AreaStyle** to **LineStyle**. 
 + 
 +{{:​worldmapkitlinestyles.png}} 
 + 
 + 
 +==== WorldMapKitTextStyles ==== 
 + 
 +And by changing **WorldMapKitAreaStyles** to **WorldMapKitTextStyles** and **AreaStyle** to **TextStyle**,​ you can produce the images below. 
 + 
 +{{:​worldmapkittextstyles.png|}} 
 + 
 +==== PointStyle ==== 
 + 
 +=== WellPointStyle === 
 + 
 +Map Suite integrates 186 well points styles in the component. Here the following code will print out each of those style to a standalone bitmap.  
 + 
 +    for (int i = 1; i <= 186; i++) 
 +            { 
 +                WellPointStyle pointStyle = new WellPointStyle(i,​ GeoBrushes.Black,​ GeoPens.Black,​ 30); 
 +                Bitmap bitmap = new Bitmap(128, 128); 
 +                GdiPlusGeoCanvas gdiPlusGeoCanvas = new GdiPlusGeoCanvas();​ 
 +                gdiPlusGeoCanvas.BeginDrawing(bitmap,​ new RectangleShape(-180,​ 90, 180, -90), GeographyUnit.DecimalDegree);​ 
 +                pointStyle.DrawSample(gdiPlusGeoCanvas);​ 
 +                gdiPlusGeoCanvas.EndDrawing();​ 
 +                bitmap.Save(@"​C:​\WellStyles\Number_"​ + i.ToString() + "​.png",​ ImageFormat.Png);​ 
 +            ​}
  
 +Here are the icons generated from the code above. ​
 +{{wellpointstyles.png}}
 +            ​
 +            ​
  
map_suite_predefined_styles.1479324888.txt.gz · Last modified: 2016/11/16 19:34 by tomtaylor