User Tools

Site Tools


map_suite_predefined_styles

This is an old revision of the document!


Map Suite Predefined Style Guide

Overview

MapSuite contains many predefined styles, including the WorldMapKit Predifined Styles

Code

This code snippet will retrieve all of the AreaStyles returned by the methods in the WorldMapKitAreaStyles class, 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

WorldMapKitLineStyles

WorldMapKitTextStyles

map_suite_predefined_styles.1479326028.txt.gz · Last modified: 2016/11/16 19:53 by tomtaylor