示例#1
0
        private void FormMap_Load(object sender, EventArgs e)
        {
            menuItemSatellite.Checked = false;

            this.map.Manager.Mode = AccessMode.ServerOnly;
            this.map.MapType = MapType.GoogleMap;
            this.map.MaxZoom = 20;
            this.map.MinZoom = 1;
            this.map.Zoom = this.map.MinZoom + 5;

            // map events
            map.OnCurrentPositionChanged += new CurrentPositionChanged(Map_OnCurrentPositionChanged);

            // Overlay setup
            _overlay = new GMapOverlay(this.map, "_overlay");
            this.map.Overlays.Add(_overlay);

            this.map.CurrentPosition = _startPos;
            _centerCross = new GMapMarkerCross(this.map.CurrentPosition);
            _centerCross.Pen.Color = Color.Red;

            _radiusCircle = new GMapMarkerCircle(_startPos);
            _radiusCircle.Radius = _StartRadius;
            _radiusCircle.Fill = false;
            _radiusCircle.OutlinePen.Width = 2;
            _radiusCircle.OutlinePen.Color = Color.Red;

            // Add markers
            _overlay.Markers.Add(_centerCross);
            _overlay.Markers.Add(_radiusCircle);

            if (_hasStartPos) map.Zoom = 14;
        }
示例#2
0
文件: MainForm.cs 项目: ravcio/MapNet
        public MainForm()
        {
            InitializeComponent();

             pageGps = new GPS(this);
             pageTransport = new Transport(this);
             pageSearch = new Search(this);

            #if DEBUG
             MainMap.Manager.Mode = AccessMode.ServerAndCache;
             menuItemServerAndCache.Checked = true;
             menuItemEnableGrid.Checked = true;
             menuItemGPSenabled.Checked = false;
             MainMap.ShowTileGridLines = true;
            #else
             MainMap.Manager.Mode = AccessMode.CacheOnly;
             menuItemCacheOnly.Checked = true;
            #endif
             MainMap.MapType = MapType.MapsLT_Map;
             MainMap.MaxZoom = 11;
             MainMap.MinZoom = 1;
             MainMap.Zoom = MainMap.MinZoom + 1;
             MainMap.CurrentPosition = start;

             MainMap.OnMapTypeChanged += new MapTypeChanged(MainMap_OnMapTypeChanged);
             MainMap.OnCurrentPositionChanged += new CurrentPositionChanged(MainMap_OnCurrentPositionChanged);
             MainMap.OnMapZoomChanged += new MapZoomChanged(MainMap_OnMapZoomChanged);

             // add custom layers
             {
            routes = new GMapOverlay(MainMap, "routes");
            MainMap.Overlays.Add(routes);

            objects = new GMapOverlay(MainMap, "objects");
            MainMap.Overlays.Add(objects);

            top = new GMapOverlay(MainMap, "top");
            MainMap.Overlays.Add(top);
             }

             // map center
             center = new GMapMarkerCross(MainMap.CurrentPosition);
             top.Markers.Add(center);

            #if DEBUG
             // transparent marker test
             GMapMarkerTransparentGoogleGreen goo = new GMapMarkerTransparentGoogleGreen(MainMap.CurrentPosition);
             goo.ToolTipMode = MarkerTooltipMode.Always;
             goo.ToolTipText = "Welcome to Lithuania! ;}";
             objects.Markers.Add(goo);
            #endif

             UnregisterFunc1(0, 0x75); // VOLUME UP
             UnregisterFunc1(0, 0x76); // VOLUME DOWN
             msgW = new MsgWindow(this);
             RegisterHotKey(msgW.Hwnd, 3, 0, 0x75);
             RegisterHotKey(msgW.Hwnd, 4, 0, 0x76);

             // test performance
             if(PerfTestEnabled)
             {
            timer.Interval = 111;
            timer.Tick += new EventHandler(timer_Tick);
            timer.Enabled = true;
             }
        }