Example #1
0
        public Form1()
        {
            InitializeComponent();

            // Uncomment the next line to add a status bar at the bottom of the display; however, it hides the copyright notice at present.
            // this.Controls.Add(m_status_bar);

            string map_file   = Application.StartupPath + "/../../../../../map/isle_of_wight.ctm1";
            string style_file = Application.StartupPath + "/../../../../../style/standard.ctstyle";
            string font_path  = Application.StartupPath + "/../../../../../font/";

            if (!System.IO.File.Exists(map_file)) // if we're running in an ordinary source tree, not an SDK
            {
                map_file   = Application.StartupPath + "/../../../../../../../map/isle_of_wight.ctm1";
                style_file = Application.StartupPath + "/../../../../../../../style/standard.ctstyle";
                font_path  = Application.StartupPath + "/../../../../../../../font/";
            }
            m_framework = new CartoType.Framework(map_file,
                                                  style_file,
                                                  font_path + "DejaVuSans.ttf",
                                                  this.ClientSize.Width,
                                                  this.ClientSize.Height);
            m_framework.LoadFont(font_path + "DejaVuSans-Bold.ttf");
            m_framework.LoadFont(font_path + "DejaVuSerif.ttf");
            m_framework.LoadFont(font_path + "DejaVuSerif-Italic.ttf");
            m_framework.SetResolutionDpi(144);
            m_framework.SetFollowMode(CartoType.FollowMode.LocationHeading);
            m_framework.EnableLegend(m_draw_legend);
            Text = m_framework.DataSetName();

            m_map_renderer          = new CartoType.MapRenderer(m_framework, Handle);
            m_graphics_acceleration = m_map_renderer.Valid();

            CreateLegend();

            // Sample code to insert a green pushpin.
            // String s = CartoType.Util.SetAttribute("", "_color", "green");
            // long id = 0;
            // double lon = -1.289708;
            // double lat = 50.655351;
            // m_framework.InsertPointMapObject(0, "pushpin", lon, lat, CartoType.CoordType.Degree, s, 0,ref id, false);
        }