public GMapMarkerTarget(PointLatLng p, GMapControl map, Bitmap icon)
     : base(p)
 {
     Size = SizeSt;
     MainMap = map;
     this.icon = icon;
 }
Example #2
0
 public FeedMarker(PointLatLng loc, Article art, GMapControl gmap)
 {
     location = loc;
     article = art;
     this.gmap = gmap;
     addPIN(location);
 }
Example #3
0
        public MapAdapter(GMapControl mapControl)
        {
            _context = new WindowsFormsSynchronizationContext();

            _mapControl = mapControl;

            IObservable<Unit> positionChanged = Observable
                .FromEvent<PositionChanged, PointLatLng>(
                    action => point => action(point),
                    handler => _mapControl.OnPositionChanged += handler,
                    handler => _mapControl.OnPositionChanged -= handler)
                .Select(i => Unit.Default);


            IObservable<Unit> mapZoom = Observable
                .FromEvent<MapZoomChanged, Unit>(
                    action => () => action(Unit.Default),
                    handler => _mapControl.OnMapZoomChanged += handler,
                    handler => _mapControl.OnMapZoomChanged -= handler);


            MapChanged = positionChanged
                .Merge(mapZoom)
                .ObserveOn(ThreadPoolScheduler.Instance);

            mapControl.OnMapDrag += MapControl_OnMapDrag;
            mapControl.OnPolygonClick += Control_OnPolygonClick;
        }
Example #4
0
        public static void Main(string[] args)
        {
            var layout   = new PatternLayout("%-4timestamp [%thread] %-5level %logger %ndc - %message%newline");
            var appender = new ConsoleAppender
            {
                Layout = layout
            };

            layout.ActivateOptions();
            appender.ActivateOptions();
            BasicConfigurator.Configure(appender);

            GDAL.ScanDirectory(Application.StartupPath);

            Form frm = new Form();

            GMap.NET.WindowsForms.GMapControl map = new GMap.NET.WindowsForms.GMapControl();
            map.Dock = DockStyle.Fill;
            frm.Controls.Add(map);
            map.MapProvider = GDALProvider.Instance;

            map.MaxZoom = 22;

            //map.Manager.Mode = AccessMode.ServerOnly;

            map.Invalidate();

            frm.ShowDialog();
        }
Example #5
0
 public PloyLineOverLay(GMapControl map, string layid)
     : base(map, layid) {
     control = map;
     map.OnMarkerEnter += new MarkerEnter(map_OnMarkerEnter);
     map.OnMarkerLeave += new MarkerLeave(map_OnMarkerLeave);
     map.OnMapZoomChanged += new MapZoomChanged(map_OnMapZoomChanged);
 }
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:

            #line 11 "..\..\MainWindow.xaml"
                ((PZ1.MainWindow)(target)).Loaded += new System.Windows.RoutedEventHandler(this.Window_Loaded);

            #line default
            #line hidden
                return;

            case 2:

            #line 25 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.prikaziSubstations);

            #line default
            #line hidden
                return;

            case 3:

            #line 27 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.prikaziNodes);

            #line default
            #line hidden
                return;

            case 4:

            #line 29 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.prikaziSwitches);

            #line default
            #line hidden
                return;

            case 5:

            #line 31 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.prikaziLines);

            #line default
            #line hidden
                return;

            case 6:
                this.txbXml = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 7:
                this.gmap = ((GMap.NET.WindowsForms.GMapControl)(target));
                return;
            }
            this._contentLoaded = true;
        }
Example #7
0
 public LineOverlay(GMapControl map, string lineCode)
     : base(map, lineCode) {
     map.OnMarkerEnter += new MarkerEnter(map_OnMarkerEnter);
     map.OnMarkerLeave += new MarkerLeave(map_OnMarkerLeave);
     map.OnMapZoomChanged += new MapZoomChanged(map_OnMapZoomChanged);
     this.Markers.CollectionChanged += new GMap.NET.ObjectModel.NotifyCollectionChangedEventHandler(Markers_CollectionChanged);
     control = map;
 }
Example #8
0
 public static void DrawPoint(GMapControl map, decimal latitude, decimal longitude)
 {
     GMapOverlay overlay = new GMapOverlay(map, "Stop");
     overlay.Markers.Add(new GMap.NET.WindowsForms.Markers.GMapMarkerGoogleGreen(new PointLatLng((double)latitude, (double)longitude)));
     map.Overlays.Add(overlay);
     map.ZoomAndCenterMarkers(overlay.Id);
     map.Zoom -= 2;
 }
 public OverlayProcessor(ref Map control, ref GridDataSetManager PointManager)
 {
     Control = control;
     GDSM = PointManager;
     Layers = new List<Bitmap>();
     mainOverlay = new GMapOverlay();
     Control.Overlays.Add(mainOverlay);
 }
Example #10
0
 public static void karte_initialisieren(GMap.NET.WindowsForms.GMapControl karte)
 {
     karte.ShowCenter   = true;
     karte.MapProvider  = BingMapProvider.Instance;
     karte.Zoom         = Convert.ToInt16(ConfigurationManager.AppSettings["Zoom"]);
     karte.Manager.Mode = AccessMode.ServerAndCache;
     karte.SetPositionByKeywords(ConfigurationManager.AppSettings["map_location"]);
 }
Example #11
0
        public static void DrawMarker(NET.WindowsForms.GMapControl gmap, double Lat, double Long) //Draws pointer based on 2 inputs (latitude & longitude)
        {
            GMapOverlay   markersOverlay = new GMapOverlay("markers");
            GMarkerGoogle marker         = new GMarkerGoogle(new PointLatLng(Lat, Long),
                                                             GMarkerGoogleType.green);

            markersOverlay.Markers.Add(marker);
            gmap.Overlays.Add(markersOverlay);
            UpdateMap(gmap);
        }
Example #12
0
            void display_current_position(double lat, double lon, GMap.NET.WindowsForms.GMapControl karte, GMapOverlay own_positions)
            {
                karte.Invoke(new Action(() => own_positions.Markers.Clear()));
                GMapMarker marker = new GMap.NET.WindowsForms.Markers.GMarkerGoogle(
                    new PointLatLng(lat, lon),
                    GMarkerGoogleType.red_small);

                karte.Invoke(new Action(() => karte.Overlays.Add(own_positions)));
                own_positions.Markers.Add(marker);
            }
Example #13
0
 public static void TogglePolygons(NET.WindowsForms.GMapControl gmap) //Toggle heatmaps on or off
 {
     if (gmap.PolygonsEnabled == true)
     {
         gmap.PolygonsEnabled = false;
     }
     else if (gmap.PolygonsEnabled == false)
     {
         gmap.PolygonsEnabled = true;
     }
     UpdateMap(gmap);
 }
Example #14
0
        private Main parent; // for SQL queries

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Constructors GoogleMap and sets gmap and the parent.
        /// Initialises the first overlay of the map.
        /// </summary>
        public GoogleMap(GMapControl gmap, Main parent)
        {
            if (gmap == null) throw new ArgumentNullException();
            if (parent == null) throw new ArgumentNullException();

            this.parent = parent;
            this.gmap = gmap;

            // overlay layer to add markers on the map
            GMapOverlay overlay = new GMapOverlay("first_layer");
            gmap.Overlays.Add(overlay);
        }
Example #15
0
 static void DoDebug()
 {
     polygons = new GMapOverlay("polygons");
     map = new GMapControl();
     var form = new Form() { Size = new Size(1024, 768), WindowState = FormWindowState.Maximized };
     map.Dock = DockStyle.Fill;
     map.MapProvider = GMapProviders.GoogleSatelliteMap;
     map.MaxZoom = 20;
     map.Overlays.Add(polygons);
     form.Controls.Add(map);
     form.Show();
 }
Example #16
0
      public GMapOverlay(GMapControl control, string id)
      {
         if(control == null)
         {
            throw new Exception("GMapControl in GMapOverlay can't be null");
         }

         Control = control;
         Id = id;
         Markers.CollectionChanged += new NotifyCollectionChangedEventHandler(Markers_CollectionChanged);
         Routes.CollectionChanged += new NotifyCollectionChangedEventHandler(Routes_CollectionChanged);
         Polygons.CollectionChanged += new NotifyCollectionChangedEventHandler(Polygons_CollectionChanged);
      }
Example #17
0
        public GMapOverlay(GMapControl control, string id)
        {
            if (control == null)
            {
                throw new Exception("GMapControl in GMapOverlay can't be null");
            }

            Control = control;
            Id      = id;
            Markers.CollectionChanged  += new NotifyCollectionChangedEventHandler(Markers_CollectionChanged);
            Routes.CollectionChanged   += new NotifyCollectionChangedEventHandler(Routes_CollectionChanged);
            Polygons.CollectionChanged += new NotifyCollectionChangedEventHandler(Polygons_CollectionChanged);
        }
        public override void OnLoad(GMapControl gMapControl)
        {
            _gMapControl = gMapControl;
            _gMapControl.Overlays.Add(_gMapOverlay);

            _points = new List<PointLatLng>();
            _gMapControl.Overlays.Add(_gMapOverlay);
            _gMapControl.Overlays.Add(_highLightOverlay);
            _start = false;
            _queryResultForm = new QueryResultForm();
            this._mapUrl = ((SuperMapProvider)gMapControl.MapProvider).ServiceUrl;
            this._mapName = ((SuperMapProvider)gMapControl.MapProvider).MapName;
            InitLayers();
            base.OnLoad(gMapControl);
        }
Example #19
0
        public StaticImage(GMapControl main)
        {
            InitializeComponent();

             this.MainMap = main;

             numericUpDown1.Maximum = MainMap.MaxZoom;
             numericUpDown1.Minimum = MainMap.MinZoom;
             numericUpDown1.Value = MainMap.Zoom;

             bg.WorkerReportsProgress = true;
             bg.WorkerSupportsCancellation = true;
             bg.DoWork += new DoWorkEventHandler(bg_DoWork);
             bg.ProgressChanged += new ProgressChangedEventHandler(bg_ProgressChanged);
             bg.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bg_RunWorkerCompleted);
        }
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:

            #line 12 "..\..\MainWindow.xaml"
                ((PredmetniZadatak2.MainWindow)(target)).Loaded += new System.Windows.RoutedEventHandler(this.LoadMapButton_Click);

            #line default
            #line hidden
                return;

            case 2:
                this.gmap = ((GMap.NET.WindowsForms.GMapControl)(target));
                return;

            case 3:
                this.Switches = ((System.Windows.Controls.CheckBox)(target));
                return;

            case 4:
                this.Nodes = ((System.Windows.Controls.CheckBox)(target));
                return;

            case 5:
                this.Substations = ((System.Windows.Controls.CheckBox)(target));
                return;

            case 6:
                this.Lines = ((System.Windows.Controls.CheckBox)(target));
                return;

            case 7:
                this.LoadButton = ((System.Windows.Controls.Button)(target));

            #line 23 "..\..\MainWindow.xaml"
                this.LoadButton.Click += new System.Windows.RoutedEventHandler(this.LoadButton_Click);

            #line default
            #line hidden
                return;
            }
            this._contentLoaded = true;
        }
        public MapPrintPreviewForm(GMapControl ctrlGMap)
            : this()
        {
            #region Create Map copied

            gMap.Manager.Mode = AccessMode.ServerOnly;
            gMap.MinZoom = ctrlGMap.MinZoom;
            gMap.MaxZoom = ctrlGMap.MaxZoom;
            gMap.Zoom = ctrlGMap.Zoom;
            gMap.Position = ctrlGMap.Position;
            gMap.MouseWheelZoomEnabled = ctrlGMap.MouseWheelZoomEnabled;
            gMap.MouseWheelZoomType = ctrlGMap.MouseWheelZoomType;
            gMap.EmptyTileColor = System.Drawing.Color.Aquamarine;
            gMap.GrayScaleMode = true;
            gMap.Manager.UsePlacemarkCache = false;
            gMap.ConnectionString = (ctrlGMap is CustomGMapControl)
                ? ((CustomGMapControl)ctrlGMap).ConnectionString
                : null;
            gMap.OnTileLoadComplete += GMap_OnTileLoadComplete;
            gMap.OnTileLoadStart += GMap_OnTileLoadStart;
            gMap.Manager.UseMemoryCache = true;

            //gMap.Manager.CancelTileCaching();

            foreach (GMapOverlay overlay in ctrlGMap.Overlays)
            {
                foreach (var marker in overlay.Markers)
                {
                    gMap.AddMarker(marker);
                }

                foreach (var route in overlay.Routes)
                {
                    var r = new GMapRoute(route.Name);
                    r.Points.AddRange(route.Points);
                    r.Stroke = route.Stroke;

                    gMap.AddRoute(r);
                }

                gMap.SetMapBound();
            }

            #endregion            
        }
Example #22
0
        public GMapMarkerWind(PointLatLng p, GMapControl map, float bearing, float speed)
            : base(p)
        {
            Size = SizeSt;
            MainMap = map;

            this.bearing = bearing;
            this.speed = speed;

            if (speed > ORANGE_SPEED_LIMIT)
            {
                icon = global::SeaScanUAV.Properties.Resources.Orange_N;
            }
            else if (speed > RED_SPEED_LIMIT)
            {
                icon = global::SeaScanUAV.Properties.Resources.Red_N;
            }
        }
Example #23
0
        public static void DrawMap(GMapControl map, List<Point> points, Color color, bool includeMarkers)
        {
            Pen pen = new Pen(color, 3.0f);

            List<PointLatLng> allMapPoints = points.Select(point => new PointLatLng(point.Latitude, point.Longitude)).ToList();
            GMapRoute route = new GMapRoute(allMapPoints, "Route");
            route.Stroke = pen;
            map.ZoomAndCenterRoute(route);

            GMapOverlay overlay = new GMapOverlay(map, "Overlay");
            if (includeMarkers)
            {
                overlay.Markers.Add(new GMap.NET.WindowsForms.Markers.GMapMarkerGoogleGreen(new PointLatLng(allMapPoints.First().Lat, allMapPoints.First().Lng)));
                overlay.Markers.Add(new GMap.NET.WindowsForms.Markers.GMapMarkerGoogleRed(new PointLatLng(allMapPoints.Last().Lat, allMapPoints.Last().Lng)));
            }
            overlay.Routes.Add(route);
            map.Overlays.Add(overlay);
        }
Example #24
0
        //This function is used to select and draw all polygon with type 'Wijk' or 'Deelgemeente' at once.
        public static void CheckAll(NET.WindowsForms.GMapControl gmap, Rotterdam Rdam, CheckBox wijkbox, CheckBox deelgembox, GMapOverlay Heatmaps, string selectedTable, string Year)
        {
            //Clears the map beforehand
            MapFunctions.Clear(gmap);
            Heatmaps.Clear();

            //If 'all areas' is selected.
            if (wijkbox.Checked)
            {
                //Checks every borough in the Rotterdam instance
                foreach (Borough gebied in Rdam.Deelgemeenten)
                {
                    //Checks every polygon in the Rotterdam instance
                    foreach (GMapPolygon polygon in Rdam.Polygons)
                    {
                        //If the polygon name is the name as the borough name and the type equals to "Wijk", add the polygon to the heatmap
                        if (polygon.Name == gebied.Name && gebied.Type == "Wijk")
                        {
                            Heatmaps.Polygons.Add(addFill(polygon, gebied.Name, selectedTable, Year));
                        }
                    }
                }
            }

            //else...
            else
            {
                foreach (Borough gebied in Rdam.Deelgemeenten)
                {
                    string new_name = gebied.Name;
                    foreach (GMapPolygon polygon in Rdam.Polygons)
                    {
                        if (polygon.Name == gebied.Name && gebied.Type == "Deelgemeente")
                        {
                            Heatmaps.Polygons.Add(addFill(polygon, gebied.Name, selectedTable, Year));
                        }
                    }
                }
            }
            //Adds newly created Heatmaps, which contains all the added polygons to the gmap.Overlay
            gmap.Overlays.Add(Heatmaps);
            //Updates the map
            MapFunctions.UpdateMap(gmap);
        }
Example #25
0
        public GMapRestImagery()
        {
            //_baseUri = baseUri;

            _levels = new RasterLevel[NumberOfLevels];
            _levelsCollection = new RasterLevelCollection(_levels);

            double deltaLongitude = LevelZeroDeltaLongitudeDegrees;
            double deltaLatitude = LevelZeroDeltaLatitudeDegrees;
            for (int i = 0; i < _levels.Length; ++i)
            {
                int longitudePosts = (int)Math.Round(360.0 / deltaLongitude) * TileLongitudePosts + 1;
                int latitudePosts = (int)Math.Round(180 / deltaLatitude) * TileLatitudePosts + 1;
                _levels[i] = new RasterLevel(this, i, _extent, longitudePosts, latitudePosts, TileLongitudePosts, TileLatitudePosts);
                deltaLongitude /= 2.0;
                deltaLatitude /= 2.0;
            }

            MainMap = new GMapControl();
            MainMap.MapType = GMap.NET.MapType.GoogleSatellite;

            MainMap.CacheLocation = Path.GetDirectoryName(Application.ExecutablePath) + "/gmapcache/";
        }
Example #26
0
        private void Form1_Load(object sender, EventArgs e)
        {
            MainMap = new GMapControl();
            MainMap.MapProvider = GMapProviders.OpenStreetMap;
            MainMap.Position = new PointLatLng(50.619900, 26.251617);
            MainMap.MinZoom = 3;
            MainMap.MaxZoom = 20;
            MainMap.Zoom = 9;
            MainMap.Dock = DockStyle.Fill;
            MainMap.MarkersEnabled = true;
            MainMap.PolygonsEnabled = true;
            MainMap.RoutesEnabled = true;
            MainMap.MouseClick += MainMap_MouseClick;
            MainMap.OnMarkerClick += MainMap_OnMarkerClick;
            //MainMap.OnPositionChanged += MainMap_OnPositionChanged;
            Controls.Add(MainMap);

            sl = new TrackBar();
            sl.Orientation = Orientation.Vertical;
            sl.TickStyle = TickStyle.Both;
            sl.TickFrequency = 10;
            sl.Maximum = 100;
            sl.Minimum = 1;
            sl.Value = (int)((MainMap.Zoom - MainMap.MinZoom)/ MainMap.MaxZoom * sl.Maximum);
            sl.Height = this.Height / 3;
            sl.Width = 50;
            sl.Location = new Point(MainMap.Width - sl.Width - 5, MainMap.Height - sl.Height -10);
            sl.ValueChanged += sl_ValueChanged;

            Controls.Add(sl);
            sl.BringToFront();

            markersOverlay = new GMapOverlay("markers");
            routeOverlay = new GMapOverlay("routes");
            isAddMarker = true;
        }
Example #27
0
        public FlightData()
        {
            log.Info("Ctor Start");

            InitializeComponent();

            log.Info("Components Done");

            instance = this;
            //    _serializer = new DockStateSerializer(dockContainer1);
            //    _serializer.SavePath = Application.StartupPath + Path.DirectorySeparatorChar + "FDscreen.xml";
            //    dockContainer1.PreviewRenderer = new PreviewRenderer();
            //
            mymap = gMapControl1;
            myhud = hud1;
            MainHcopy = MainH;

            mymap.Paint += mymap_Paint;

            //  mymap.Manager.UseMemoryCache = false;

            log.Info("Tunning Graph Settings");
            // setup default tuning graph
            if (MainV2.config["Tuning_Graph_Selected"] != null)
            {
                string line = MainV2.config["Tuning_Graph_Selected"].ToString();
                string[] lines = line.Split(new[] {'|'}, StringSplitOptions.RemoveEmptyEntries);
                foreach (string option in lines)
                {
                    using (var cb = new CheckBox {Name = option, Checked = true})
                    {
                        chk_box_CheckedChanged(cb, new EventArgs());
                    }
                }
            }
            else
            {
                using (var cb = new CheckBox {Name = "roll", Checked = true})
                {
                    chk_box_CheckedChanged(cb, new EventArgs());
                }
                using (var cb = new CheckBox {Name = "pitch", Checked = true})
                {
                    chk_box_CheckedChanged(cb, new EventArgs());
                }
                using (var cb = new CheckBox {Name = "nav_roll", Checked = true})
                {
                    chk_box_CheckedChanged(cb, new EventArgs());
                }
                using (var cb = new CheckBox {Name = "nav_pitch", Checked = true})
                {
                    chk_box_CheckedChanged(cb, new EventArgs());
                }
            }

            if (MainV2.config.ContainsKey("hudcolor"))
            {
                hud1.hudcolor = Color.FromName(MainV2.config["hudcolor"].ToString());
            }

            MainV2.comPort.MavChanged += comPort_MavChanged;

            log.Info("HUD Settings");
            foreach (string item in MainV2.config.Keys)
            {
                if (item.StartsWith("hud1_useritem_"))
                {
                    string selection = item.Replace("hud1_useritem_", "");

                    CheckBox chk = new CheckBox();
                    chk.Name = selection;
                    chk.Checked = true;

                    HUD.Custom cust = new HUD.Custom();
                    cust.Header = MainV2.config[item].ToString();
                    HUD.Custom.src = MainV2.comPort.MAV.cs;

                    addHudUserItem(ref cust, chk);
                }
            }


            List<string> list = new List<string>();

            {
                list.Add("LOITER_UNLIM");
                list.Add("RETURN_TO_LAUNCH");
                list.Add("PREFLIGHT_CALIBRATION");
                list.Add("MISSION_START");
                list.Add("PREFLIGHT_REBOOT_SHUTDOWN");
                //DO_SET_SERVO
                //DO_REPEAT_SERVO
            }


            CMB_action.DataSource = list;

            CMB_modes.DataSource = Common.getModesList(MainV2.comPort.MAV.cs);
            CMB_modes.ValueMember = "Key";
            CMB_modes.DisplayMember = "Value";

            //default to auto
            CMB_modes.Text = "Auto";

            CMB_setwp.SelectedIndex = 0;

            log.Info("Graph Setup");
            CreateChart(zg1);

            // config map      
            log.Info("Map Setup");
            gMapControl1.CacheLocation = Path.GetDirectoryName(Application.ExecutablePath) + Path.DirectorySeparatorChar +
                                         "gmapcache" + Path.DirectorySeparatorChar;
            gMapControl1.MapProvider = GMapProviders.GoogleSatelliteMap;
            gMapControl1.MinZoom = 0;
            gMapControl1.MaxZoom = 24;
            gMapControl1.Zoom = 3;

            gMapControl1.OnMapZoomChanged += gMapControl1_OnMapZoomChanged;

            gMapControl1.DisableFocusOnMouseEnter = true;

            gMapControl1.OnMarkerEnter += gMapControl1_OnMarkerEnter;
            gMapControl1.OnMarkerLeave += gMapControl1_OnMarkerLeave;

            gMapControl1.RoutesEnabled = true;
            gMapControl1.PolygonsEnabled = true;

            tfrpolygons = new GMapOverlay("tfrpolygons");
            gMapControl1.Overlays.Add(tfrpolygons);

            kmlpolygons = new GMapOverlay("kmlpolygons");
            gMapControl1.Overlays.Add(kmlpolygons);

            geofence = new GMapOverlay("geofence");
            gMapControl1.Overlays.Add(geofence);

            polygons = new GMapOverlay("polygons");
            gMapControl1.Overlays.Add(polygons);

            routes = new GMapOverlay("routes");
            gMapControl1.Overlays.Add(routes);

            rallypointoverlay = new GMapOverlay("rally points");
            gMapControl1.Overlays.Add(rallypointoverlay);

            gMapControl1.Overlays.Add(poioverlay);

            try
            {
                if (MainV2.getConfig("GspeedMAX") != "")
                {
                    Gspeed.MaxValue = float.Parse(MainV2.getConfig("GspeedMAX"));
                }
            }
            catch
            {
            }

            MainV2.comPort.ParamListChanged += FlightData_ParentChanged;

            MainV2.AdvancedChanged += MainV2_AdvancedChanged;

            // first run
            MainV2_AdvancedChanged(null, null);
        }
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.gmap = ((GMap.NET.WindowsForms.GMapControl)(target));
                return;

            case 2:

            #line 17 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.CheckBox)(target)).Checked += new System.Windows.RoutedEventHandler(this.CheckBox_Checked);

            #line default
            #line hidden

            #line 17 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.CheckBox)(target)).Unchecked += new System.Windows.RoutedEventHandler(this.CheckBox_Unchecked_3);

            #line default
            #line hidden
                return;

            case 3:

            #line 18 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.CheckBox)(target)).Checked += new System.Windows.RoutedEventHandler(this.CheckBox_Checked_1);

            #line default
            #line hidden

            #line 18 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.CheckBox)(target)).Unchecked += new System.Windows.RoutedEventHandler(this.CheckBox_Unchecked_2);

            #line default
            #line hidden
                return;

            case 4:

            #line 19 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.CheckBox)(target)).Checked += new System.Windows.RoutedEventHandler(this.CheckBox_Checked_2);

            #line default
            #line hidden

            #line 19 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.CheckBox)(target)).Unchecked += new System.Windows.RoutedEventHandler(this.CheckBox_Unchecked);

            #line default
            #line hidden
                return;

            case 5:

            #line 20 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.CheckBox)(target)).Unchecked += new System.Windows.RoutedEventHandler(this.CheckBox_Unchecked_1);

            #line default
            #line hidden

            #line 20 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.CheckBox)(target)).Checked += new System.Windows.RoutedEventHandler(this.CheckBox_Checked_3);

            #line default
            #line hidden
                return;
            }
            this._contentLoaded = true;
        }
Example #29
0
 public static void Clear(NET.WindowsForms.GMapControl gmap) //Erase all pointers and heatmaps
 {
     gmap.Overlays.Clear();
     UpdateMap(gmap);
 }
Example #30
0
        // ПРИМЕР РАБОТЫ С КАРТОЙ ! 
        // (данный код используйте по своему усмотрению!)
        void SetParamsMap()
        {
            // Создание элемента, отображающего карту !
            gMapControl1 = new GMapControl();
            // Растягивание элемента на все окно!
            gMapControl1.Dock = DockStyle.Fill;
            // Добавление элемента 
           this.Controls.Add(gMapControl1);

// ОБЩИЕ НАСТРОЙКИ КАРТЫ 
            //Указываем, что будем использовать карты OpenStreetMap.
            gMapControl1.MapProvider = GMap.NET.MapProviders.GMapProviders.OpenStreetMap;
            // Указываем источник данных карты (выбран: интренети или локальный кэш)
            GMap.NET.GMaps.Instance.Mode = GMap.NET.AccessMode.ServerAndCache;

           
            //Настройки для компонента GMap.
            gMapControl1.Bearing = 0;
    
      // МАСШТАБИРОВАНИЕ
            //Указываем значение максимального приближения.
            gMapControl1.MaxZoom = 18;

            //Указываем значение минимального приближения.
            gMapControl1.MinZoom = 2;

            //Указываем, что при загрузке карты будет использоваться 
            //16ти кратной приближение.
            gMapControl1.Zoom = 17;

            //Устанавливаем центр приближения/удаления
            //курсор мыши.
            gMapControl1.MouseWheelZoomType = GMap.NET.MouseWheelZoomType.MousePositionAndCenter;


  // НАВИГАЦИЯ ПО КАРТЕ 
            //CanDragMap - Если параметр установлен в True,
            //пользователь может перетаскивать карту  помощью правой кнопки мыши. 
            gMapControl1.CanDragMap = true;

            //Указываем что перетаскивание карты осуществляется 
            //с использованием левой клавишей мыши. По умолчанию - правая.
            gMapControl1.DragButton = MouseButtons.Left;

            //Указываем элементу управления, что необходимо при открытии карты
            // прейти по координатам 
            gMapControl1.Position = new GMap.NET.PointLatLng(53.902800, 27.561759);


// ОТОБРАЖЕНИЕ МАРКЕРОВ НА КАРТЕ 
            //MarkersEnabled - Если параметр установлен в True,
            //любые маркеры, заданные вручную будет показаны.
            //Если нет, они не появятся.
            gMapControl1.MarkersEnabled = true;
                  
            //Создаем новый список маркеров, с указанием компонента 
            //в котором они будут использоваться и названием списка.
            GMap.NET.WindowsForms.GMapOverlay markersOverlay =
                new GMap.NET.WindowsForms.GMapOverlay(gMapControl1, "marker");
            //Инициализация нового ЗЕЛЕНОГО маркера, с указанием его координат.
            GMap.NET.WindowsForms.Markers.GMapMarkerGoogleGreen markerG =
                new GMap.NET.WindowsForms.Markers.GMapMarkerGoogleGreen(
                //Указываем координаты 
                new GMap.NET.PointLatLng(53.902542, 27.561781));
            markerG.ToolTip =
                new GMap.NET.WindowsForms.ToolTips.GMapRoundedToolTip(markerG);
            //Текст отображаемый при наведении на маркер.
            markerG.ToolTipText = "Объект №1";

            //Инициализация нового КРАСНОГО маркера, с указанием его координат.
            GMap.NET.WindowsForms.Markers.GMapMarkerGoogleRed markerR =
                new GMap.NET.WindowsForms.Markers.GMapMarkerGoogleRed(
                //Указываем координаты 
                new GMap.NET.PointLatLng(53.902752, 27.561294));
            markerR.ToolTip =
                new GMap.NET.WindowsForms.ToolTips.GMapBaloonToolTip(markerR);
            //Текст отображаемый при наведении на маркер.
            markerR.ToolTipText = "Объект №2";

            //Добавляем маркеры в список маркеров.
            //Зеленый маркер
            markersOverlay.Markers.Add(markerG);
            //Красный маркет
            markersOverlay.Markers.Add(markerR);
            //Добавляем в компонент, список маркеров.
            gMapControl1.Overlays.Add(markersOverlay);

// СОБЯТИЯ ПО КАРТЕ !
            gMapControl1.MouseClick += gMapControl1_MouseClick;
        
        }
Example #31
0
 public ClassMap(GMap.NET.WindowsForms.GMapControl gm)
 {
     gMapControl = gm;
 }
        public FlightData()
        {
            InitializeComponent();

            instance = this;

            mymap = gMapControl1;
            myhud = hud1;
            MainHcopy = MainH;

            // setup default tuning graph
            if (MainV2.config["Tuning_Graph_Selected"] != null)
            {
                string line = MainV2.config["Tuning_Graph_Selected"].ToString();
                string[] lines = line.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
                foreach (string option in lines)
                {
                    chk_box_CheckedChanged((object)(new CheckBox() { Name = option, Checked = true }), new EventArgs());
                }
            }
            else
            {
                chk_box_CheckedChanged((object)(new CheckBox() { Name = "roll", Checked = true }), new EventArgs());
                chk_box_CheckedChanged((object)(new CheckBox() { Name = "pitch", Checked = true }), new EventArgs());
                chk_box_CheckedChanged((object)(new CheckBox() { Name = "nav_roll", Checked = true }), new EventArgs());
                chk_box_CheckedChanged((object)(new CheckBox() { Name = "nav_pitch", Checked = true }), new EventArgs());
            }

            List<string> list = new List<string>();

            //foreach (object obj in Enum.GetValues(typeof(MAVLink09.MAV_ACTION)))
            #if MAVLINK10
            {
                list.Add("LOITER_UNLIM");
                list.Add("RETURN_TO_LAUNCH");
                list.Add("PREFLIGHT_CALIBRATION");
            }
            #else
            {
                list.Add("RETURN");
                list.Add("HALT");
                list.Add("CONTINUE");
                list.Add("SET_MANUAL");
                list.Add("SET_AUTO");
                list.Add("STORAGE_READ");
                list.Add("STORAGE_WRITE");
                list.Add("CALIBRATE_RC");
                list.Add("NAVIGATE");
                list.Add("LOITER");
                list.Add("TAKEOFF");
                list.Add("CALIBRATE_GYRO");
            }
            #endif

            CMB_action.DataSource = list;

            CMB_modes.DataSource = Common.getModesList();
            CMB_modes.ValueMember = "Key";
            CMB_modes.DisplayMember = "Value";

            CMB_setwp.SelectedIndex = 0;

            zg1.Visible = true;

            CreateChart(zg1);

            // config map
            gMapControl1.MapType = MapType.GoogleSatellite;
            gMapControl1.MinZoom = 1;
            gMapControl1.CacheLocation = Path.GetDirectoryName(Application.ExecutablePath) + "/gmapcache/";

            gMapControl1.OnMapZoomChanged += new MapZoomChanged(gMapControl1_OnMapZoomChanged);

            gMapControl1.Zoom = 3;

            gMapControl1.RoutesEnabled = true;
            gMapControl1.PolygonsEnabled = true;

            kmlpolygons = new GMapOverlay(gMapControl1, "kmlpolygons");
            gMapControl1.Overlays.Add(kmlpolygons);

            geofence = new GMapOverlay(gMapControl1, "geofence");
            gMapControl1.Overlays.Add(geofence);

            polygons = new GMapOverlay(gMapControl1, "polygons");
            gMapControl1.Overlays.Add(polygons);

            routes = new GMapOverlay(gMapControl1, "routes");
            gMapControl1.Overlays.Add(routes);

            try
            {
                if (MainV2.getConfig("GspeedMAX") != "")
                {
                    Gspeed.MaxValue = float.Parse(MainV2.getConfig("GspeedMAX"));
                }
            }
            catch { }
        }
Example #33
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:

            #line 15 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.buttonClearMap_Click);

            #line default
            #line hidden
                return;

            case 2:

            #line 38 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.buttonLoadAll_Click);

            #line default
            #line hidden
                return;

            case 3:

            #line 61 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.buttonLoadSubstations_Click);

            #line default
            #line hidden
                return;

            case 4:

            #line 84 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.buttonLoadSwitches_Click);

            #line default
            #line hidden
                return;

            case 5:

            #line 107 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.buttonLoadNodes_Click);

            #line default
            #line hidden
                return;

            case 6:

            #line 130 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.buttonLoadLines_Click);

            #line default
            #line hidden
                return;

            case 7:

            #line 153 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.buttonExit_Click);

            #line default
            #line hidden
                return;

            case 8:
                this.gMap = ((GMap.NET.WindowsForms.GMapControl)(target));

            #line 178 "..\..\MainWindow.xaml"
                this.gMap.OnRouteClick += new GMap.NET.WindowsForms.RouteClick(this.gMap_OnRouteClick);

            #line default
            #line hidden

            #line 178 "..\..\MainWindow.xaml"
                this.gMap.Load += new System.EventHandler(this.gMap_Load);

            #line default
            #line hidden
                return;
            }
            this._contentLoaded = true;
        }
Example #34
0
 public GMapMarkerRover(PointLatLng p, float heading, float cog, float nav_bearing, float target, GMapControl map)
     : base(p)
 {
     this.heading = heading;
     this.cog = cog;
     this.target = target;
     this.nav_bearing = nav_bearing;
     Size = SizeSt;
     MainMap = map;
 }
Example #35
0
        private void BUT_clearcustommaps_Click(object sender, EventArgs e)
        {
            GMapControl MainMap = new GMapControl();
            MainMap.MapProvider = GMap.NET.MapProviders.GoogleSatelliteMapProvider.Instance;

            int removed = MainMap.Manager.PrimaryCache.DeleteOlderThan(DateTime.Now, Maps.Custom.Instance.DbId);

            CustomMessageBox.Show("Removed "+removed + " images");

            log.InfoFormat("Removed {0} images", removed);
        }
Example #36
0
 public static void PanMapCoord(NET.WindowsForms.GMapControl gmap, double Lat, double Long, double Zoom) //Pan to specific area, takes string input
 {
     gmap.Position = new PointLatLng(Lat, Long);
     gmap.Zoom     = Zoom;
 }
Example #37
0
 public static void PanMapKeyword(NET.WindowsForms.GMapControl gmap, object LocationIndex) //Pan to specific area, takes string input
 {
     gmap.SetPositionByKeywords(LocationIndex.ToString() + ", Rotterdam");
 }
Example #38
0
 public static void UpdateMap(NET.WindowsForms.GMapControl gmap) //Update map info
 {
     gmap.ReloadMap();
 }
        static void DoDebug()
        {
            if (map != null)
            {
                if (map.Overlays.Count != 0)
                {
                    while (polygons.Markers.Count > 7)
                        polygons.Markers.RemoveAt(0);
                    //polygons.Markers.Clear();
                    return;
                }
            }

            polygons = new GMapOverlay("polygons");
            map = new GMapControl();
            var form = new Form() { Size = new Size(1024, 768), WindowState = FormWindowState.Maximized };
            map.Dock = DockStyle.Fill;
            map.MapProvider = GMapProviders.GoogleSatelliteMap;
            map.MaxZoom = 20;
            map.Overlays.Add(polygons);
            form.Controls.Add(map);
            form.Show();
        }
Example #40
0
 public Calculator(GMap.NET.WindowsForms.GMapControl mapViewer)
 {
     this.mapViewer = mapViewer;
 }
Example #41
0
        private void BUT_geinjection_Click(object sender, EventArgs e)
        {
            GMapControl MainMap = new GMapControl();

            MainMap.MapProvider = GMap.NET.MapProviders.GoogleSatelliteMapProvider.Instance;

            MainMap.CacheLocation = Path.GetDirectoryName(Application.ExecutablePath) + "/gmapcache/";

            FolderBrowserDialog fbd = new FolderBrowserDialog();

            try
            {
                fbd.SelectedPath = @"C:\Users\hog\Documents\albany 2011\New folder";
            }
            catch { }

            if (fbd.ShowDialog() != System.Windows.Forms.DialogResult.OK)
                return;

            if (fbd.SelectedPath != "")
            {

                string[] files = Directory.GetFiles(fbd.SelectedPath,"*.jpg",SearchOption.AllDirectories);
                string[] files1 = Directory.GetFiles(fbd.SelectedPath, "*.png", SearchOption.AllDirectories);

                int origlength = files.Length;
                Array.Resize(ref files, origlength + files1.Length);
                Array.Copy(files1, 0, files, origlength, files1.Length);

                foreach (string file in files)
                {
                    log.Info(DateTime.Now.Millisecond +  " Doing "+ file);
                    Regex reg = new Regex(@"Z([0-9]+)\\([0-9]+)\\([0-9]+)");

                    Match mat = reg.Match(file);

                    if (mat.Success == false)
                        continue;

                    int temp = 1 << int.Parse(mat.Groups[1].Value);

                    GMap.NET.GPoint pnt = new GMap.NET.GPoint(int.Parse(mat.Groups[3].Value), int.Parse(mat.Groups[2].Value));

                    BUT_geinjection.Text = file;
                    BUT_geinjection.Refresh();

                    //MainMap.Projection.

                    MemoryStream tile = new MemoryStream();

                    Image Img = Image.FromFile(file);
                    Img.Save(tile,System.Drawing.Imaging.ImageFormat.Jpeg);

                    tile.Seek(0, SeekOrigin.Begin);
                    log.Info(pnt.X + " " + pnt.Y);

                    Application.DoEvents();

                    GMaps.Instance.PrimaryCache.PutImageToCache(tile.ToArray(), Maps.Custom.Instance.DbId, pnt, int.Parse(mat.Groups[1].Value));

                   // Application.DoEvents();
                }
            }
        }
Example #42
0
        public static void Warp(NET.WindowsForms.GMapControl gmap, object item, Rotterdam Rdam, GMapOverlay Heatmaps, string selectedTable, string Year) //checks dropdown for selected area, and pans to its coords
        {
            object LocationIndex = item;

            MapFunctions.Clear(gmap);
            Heatmaps.Clear();
            switch (Convert.ToString(LocationIndex))
            {
            case "Charlois":
                MapFunctions.PanMapCoord(gmap, 51.88507425958, 4.47864532470703, 14);
                break;

            case "Delfshaven":
                MapFunctions.PanMapCoord(gmap, 51.9106025028462, 4.43856239318848, 13);
                break;

            case "Feijenoord":
                MapFunctions.PanMapCoord(gmap, 51.8986875968913, 4.50267791748047, 13);
                break;

            case "Schiebroek":
                MapFunctions.PanMapCoord(gmap, 51.9588652250502, 4.48688507080078, 13);
                break;

            case "Hoek_van_Holland":
                MapFunctions.PanMapCoord(gmap, 51.9681731085283, 4.16072845458984, 12);
                break;

            case "Hoogvliet":
                MapFunctions.PanMapCoord(gmap, 51.8669520608064, 4.36723709106445, 13);
                break;

            case "IJsselmonde":
                MapFunctions.PanMapCoord(gmap, 51.8883587884291, 4.54473495483398, 13);
                break;

            case "Kralingen":
                MapFunctions.PanMapCoord(gmap, 51.9287071072723, 4.51297760009766, 13);
                break;

            case "Noord":
                MapFunctions.PanMapCoord(gmap, 51.9337348683824, 4.46843147277832, 14);
                break;

            case "Overschie":
                MapFunctions.PanMapCoord(gmap, 51.9461695415817, 4.43881988525391, 13);
                break;

            case "Pernis":
                MapFunctions.PanMapCoord(gmap, 51.8876436292015, 4.38830852508545, 15);
                break;

            case "Prins_Alexander":
                MapFunctions.PanMapCoord(gmap, 51.9612452655421, 4.5428466796875, 14);
                break;

            case "Rozenburg":
                MapFunctions.PanMapCoord(gmap, 51.9186498950804, 4.22698974609375, 13);
                break;

            case "Stadscentrum":
                MapFunctions.PanMapCoord(gmap, 51.9162146522532, 4.47752952575684, 14);
                break;
            }


            foreach (Borough deelgemeente in Rdam.Deelgemeenten)
            {
                string new_check = item.ToString().ToLower();
                foreach (GMapPolygon polygon in Rdam.Polygons)
                {
                    if (deelgemeente.Name.Contains("2"))
                    {
                        string new_check2 = new_check + "2";
                        if (deelgemeente.InDeelgemeente == new_check2 && deelgemeente.Type == "Wijk" && item.ToString().ToLower() == deelgemeente.InDeelgemeente)
                        {
                            Heatmaps.Polygons.Add(AreaFunctions.addFill(deelgemeente.Polygon, deelgemeente.Name, selectedTable, Year));
                        }
                    }
                    if (deelgemeente.Name.Contains("1"))
                    {
                        string new_check1 = new_check + "1";
                        if (deelgemeente.InDeelgemeente == new_check1 && deelgemeente.Type == "Wijk" && item.ToString().ToLower() == deelgemeente.InDeelgemeente)
                        {
                            Heatmaps.Polygons.Add(AreaFunctions.addFill(deelgemeente.Polygon, deelgemeente.Name, selectedTable, Year));
                        }
                    }

                    if (item.ToString().ToLower() == deelgemeente.InDeelgemeente && deelgemeente.Type == "Wijk" && polygon.Name == deelgemeente.Name) //Je kan hieraan toevoegen: && gebied.Type == "Wijk" of "Deelgemeente"
                    {
                        Heatmaps.Polygons.Add(AreaFunctions.addFill(deelgemeente.Polygon, deelgemeente.Name, selectedTable, Year));
                    }
                }
            }
            gmap.Overlays.Add(Heatmaps);
            MapFunctions.UpdateMap(gmap);
        }
Example #43
0
        public Simple()
        {
            InitializeComponent();

            instance = this;
            //    _serializer = new DockStateSerializer(dockContainer1);
            //    _serializer.SavePath = Application.StartupPath + Path.DirectorySeparatorChar + "FDscreen.xml";
            //    dockContainer1.PreviewRenderer = new PreviewRenderer();
            //
            mymap = gMapControl1;

            MainHcopy = MainH;

            // setup default tuning graph
            if (MainV2.config["Tuning_Graph_Selected"] != null)
            {
                string line = MainV2.config["Tuning_Graph_Selected"].ToString();
                string[] lines = line.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
                foreach (string option in lines)
                {
                    chk_box_CheckedChanged((object)(new CheckBox() { Name = option, Checked = true }), new EventArgs());
                }
            }
            else
            {
                chk_box_CheckedChanged((object)(new CheckBox() { Name = "roll", Checked = true }), new EventArgs());
                chk_box_CheckedChanged((object)(new CheckBox() { Name = "pitch", Checked = true }), new EventArgs());
                chk_box_CheckedChanged((object)(new CheckBox() { Name = "nav_roll", Checked = true }), new EventArgs());
                chk_box_CheckedChanged((object)(new CheckBox() { Name = "nav_pitch", Checked = true }), new EventArgs());
            }

            List<string> list = new List<string>();

            {
                list.Add("LOITER_UNLIM");
                list.Add("RETURN_TO_LAUNCH");
                list.Add("PREFLIGHT_CALIBRATION");
                list.Add("MISSION_START");
                list.Add("PREFLIGHT_REBOOT_SHUTDOWN");
                //DO_SET_SERVO
                //DO_REPEAT_SERVO
            }

            zg1.Visible = true;

            CreateChart(zg1);

            // config map
            gMapControl1.MapType = MapType.GoogleSatellite;
            gMapControl1.MinZoom = 1;
            gMapControl1.CacheLocation = Path.GetDirectoryName(Application.ExecutablePath) + "/gmapcache/";

            gMapControl1.OnMapZoomChanged += new MapZoomChanged(gMapControl1_OnMapZoomChanged);

            gMapControl1.Zoom = 3;

            gMapControl1.RoutesEnabled = true;
            gMapControl1.PolygonsEnabled = true;

            kmlpolygons = new GMapOverlay(gMapControl1, "kmlpolygons");
            gMapControl1.Overlays.Add(kmlpolygons);

            geofence = new GMapOverlay(gMapControl1, "geofence");
            gMapControl1.Overlays.Add(geofence);

            polygons = new GMapOverlay(gMapControl1, "polygons");
            gMapControl1.Overlays.Add(polygons);

            routes = new GMapOverlay(gMapControl1, "routes");
            gMapControl1.Overlays.Add(routes);

            MainV2.comPort.ParamListChanged += FlightData_ParentChanged;
        }
 public void assignMapToUpdate(GMapControl map)
 {
     _map = map;
 }
Example #45
0
File: GCS.cs Project: kkouer/PcGcs
        public GCS()
        {
            InitializeComponent();
            mymap = gMapControl1;
            //config map
            gMapControl1.CacheLocation = Path.GetDirectoryName(Application.ExecutablePath) + Path.DirectorySeparatorChar + "mapCache" + Path.DirectorySeparatorChar;
            gMapControl1.MapProvider = GMapProviders.AMap;
            gMapControl1.Manager.Mode = AccessMode.ServerAndCache;
            gMapControl1.MinZoom = 0;
            gMapControl1.MaxZoom = 24;
            gMapControl1.Zoom = 3;

            // setup main serial reader
            serialreaderthread = new Thread(SerialReader)
            {
                IsBackground = true,
                Name = "Main Serial reader",
                //Priority = ThreadPriority.BelowNormal
                Priority = ThreadPriority.AboveNormal
            };
            serialreaderthread.Start();

            thisthread = new Thread(mainloop)
            {
                Name = "Mainloop",
                IsBackground = true,
                // Priority = ThreadPriority.BelowNormal
            };
            thisthread.Start();


            //初始化端口控件
            this.comboBoxComPort.Items.AddRange(SerialPort.GetPortNames());
            comboBoxBoundrate.SelectedIndex = 0;

            // setup guids for droneshare
            if (!MainV2.config.ContainsKey("plane_guid"))
                MainV2.config["plane_guid"] = Guid.NewGuid().ToString();

            if (!MainV2.config.ContainsKey("copter_guid"))
                MainV2.config["copter_guid"] = Guid.NewGuid().ToString();

            if (!MainV2.config.ContainsKey("rover_guid"))
                MainV2.config["rover_guid"] = Guid.NewGuid().ToString();

            RegeneratePolygon();
            updateCMDParams();

            //map events
            gMapControl1.MouseUp += MainMap_MouseUp;
            gMapControl1.MouseDown += MainMap_MouseDown;
            gMapControl1.MouseMove += MainMap_MouseMove;
            gMapControl1.OnMarkerEnter += MainMap_OnMarkerEnter;
            gMapControl1.OnMarkerClick += MainMap_OnMarkerClick;
            gMapControl1.OnMarkerLeave += MainMap_OnMarkerLeave;
            gMapControl1.RoutesEnabled = true;
            

            routesoverlay = new GMapOverlay("routes");
            gMapControl1.Overlays.Add(routesoverlay);

            polygonsoverlay = new GMapOverlay("polygons");
            gMapControl1.Overlays.Add(polygonsoverlay);

            //airportsoverlay = new GMapOverlay("airports");
            //MainMap.Overlays.Add(airportsoverlay);

            objectsoverlay = new GMapOverlay("objects");
            gMapControl1.Overlays.Add(objectsoverlay);

            drawnpolygonsoverlay = new GMapOverlay("drawnpolygons");
            gMapControl1.Overlays.Add(drawnpolygonsoverlay);

            gMapControl1.Overlays.Add(poioverlay);


            objectsoverlay.Markers.Clear();

            gMapControl1.Position = new PointLatLng(36, 103);
            gMapControl1.Zoom = 4;
            currentMarker = new GMarkerGoogle(gMapControl1.Position, GMarkerGoogleType.red);
            this.Commands.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;


            comboBox1.SelectedIndex = 1;

            gMapControl1.ContextMenuStrip = this.contextMenuStrip1;
        }
Example #46
0
        //This function is called when you select 'Manual area' or 'Manual borough' and this function checks which areas are checked and draws them.
        public static void DrawAreas(NET.WindowsForms.GMapControl gmap, CheckedListBox checkedListBox1, Rotterdam Rdam, CheckBox wijkbox, CheckBox deelgembox, CheckBox manualareabox, CheckBox manualdeelbox, GMapOverlay Heatmaps, string selectedTable, string Year)
        {
            MapFunctions.Clear(gmap);
            Heatmaps.Clear();

            //if the 'All areas' is checked
            if (manualareabox.Checked)
            {
                //Checks which areas from the checkboxlist are checked
                foreach (string Check in checkedListBox1.CheckedItems)
                {
                    string new_check = Check.ToLower();

                    foreach (Borough wijk in Rdam.Deelgemeenten)
                    {
                        if (wijk.Name.Contains("3"))
                        {
                            string new_check3 = new_check + "3";
                            if (wijk.Name == new_check3 && wijk.Type == "Wijk")
                            {
                                Heatmaps.Polygons.Add(addFill(wijk.Polygon, wijk.Name, selectedTable, Year));
                            }
                        }

                        if (wijk.Name.Contains("2"))
                        {
                            string new_check2 = new_check + "2";
                            if (wijk.Name == new_check2 && wijk.Type == "Wijk")
                            {
                                Heatmaps.Polygons.Add(addFill(wijk.Polygon, wijk.Name, selectedTable, Year));
                            }
                        }
                        if (wijk.Name.Contains("1"))
                        {
                            string new_check1 = new_check + "1";
                            if (wijk.Name == new_check1 && wijk.Type == "Wijk")
                            {
                                Heatmaps.Polygons.Add(addFill(wijk.Polygon, wijk.Name, selectedTable, Year));
                            }
                        }
                        if (wijk.InDeelgemeente.ToLower() == new_check)
                        {
                            Debug.Write("1");
                            Heatmaps.Polygons.Add(addFill(wijk.Polygon, wijk.Name, selectedTable, Year));
                        }
                    }
                }
            }
            //else...
            else if (manualdeelbox.Checked)
            {
                foreach (string Check in checkedListBox1.CheckedItems)
                {
                    string new_check = Check.ToLower();

                    foreach (Borough deelgemeente in Rdam.Deelgemeenten)
                    {
                        if (deelgemeente.Name.Contains("2"))
                        {
                            string new_check2 = new_check + "2";
                            if (deelgemeente.Name == new_check2 && deelgemeente.Type == "Deelgemeente")
                            {
                                Heatmaps.Polygons.Add(addFill(deelgemeente.Polygon, deelgemeente.Name, selectedTable, Year));
                            }
                        }
                        if (deelgemeente.Name.Contains("1"))
                        {
                            string new_check1 = new_check + "1";
                            if (deelgemeente.Name == new_check1 && deelgemeente.Type == "Deelgemeente")
                            {
                                Heatmaps.Polygons.Add(addFill(deelgemeente.Polygon, deelgemeente.Name, selectedTable, Year));
                            }
                        }
                        if (new_check == deelgemeente.Name && deelgemeente.Type == "Deelgemeente") //Je kan hieraan toevoegen: && gebied.Type == "Wijk" of "Deelgemeente"
                        {
                            Heatmaps.Polygons.Add(addFill(deelgemeente.Polygon, deelgemeente.Name, selectedTable, Year));
                        }
                    }
                }
            }

            gmap.Overlays.Add(Heatmaps);
            MapFunctions.UpdateMap(gmap);
        }
Example #47
0
        private void BUT_geinjection_Click(object sender, EventArgs e)
        {
            GMapControl MainMap = new GMapControl();
            MainMap.MapType = GMap.NET.MapType.GoogleSatellite;

            MainMap.CacheLocation = Path.GetDirectoryName(Application.ExecutablePath) + "/gmapcache/";

            FolderBrowserDialog fbd = new FolderBrowserDialog();

            try
            {
                fbd.SelectedPath = @"C:\Users\hog\Documents\albany 2011\New folder";
            }
            catch { }

            fbd.ShowDialog();

            if (fbd.SelectedPath != "") {

                string[] files = Directory.GetFiles(fbd.SelectedPath,"*.jpg",SearchOption.AllDirectories);

                foreach (string file in files)
                {
                    log.Info(DateTime.Now.Millisecond +  " Doing "+ file);
                    Regex reg = new Regex(@"Z([0-9]+)\\([0-9]+)\\([0-9]+)");

                    Match mat = reg.Match(file);

                    int temp = 1 << int.Parse(mat.Groups[1].Value);

                    GMap.NET.GPoint pnt = new GMap.NET.GPoint(int.Parse(mat.Groups[3].Value), int.Parse(mat.Groups[2].Value));

                    BUT_geinjection.Text = file;
                    BUT_geinjection.Refresh();

                    //MainMap.Projection.

                    MemoryStream tile = new MemoryStream();

                    Image Img = Image.FromFile(file);
                    Img.Save(tile,System.Drawing.Imaging.ImageFormat.Jpeg);

                    tile.Seek(0, SeekOrigin.Begin);
                    log.Info(pnt.X + " " + pnt.Y);

                    Application.DoEvents();

                    MainMap.Manager.ImageCacheLocal.PutImageToCache(tile, GMap.NET.MapType.Custom, pnt, int.Parse(mat.Groups[1].Value));

                    Application.DoEvents();
                }
            }
        }
Example #48
0
        private void BUT_clearcustommaps_Click(object sender, EventArgs e)
        {
            GMapControl MainMap = new GMapControl();
            MainMap.MapType = GMap.NET.MapType.GoogleSatellite;

            MainMap.CacheLocation = Path.GetDirectoryName(Application.ExecutablePath) + "/gmapcache/";

            int removed =  ((GMap.NET.CacheProviders.SQLitePureImageCache)MainMap.Manager.ImageCacheLocal).DeleteOlderThan(DateTime.Now, GMap.NET.MapType.Custom);

            CustomMessageBox.Show("Removed "+removed + " images\nshrinking file next");

            GMap.NET.CacheProviders.SQLitePureImageCache.VacuumDb(MainMap.CacheLocation + @"\TileDBv3\en\Data.gmdb");

            log.InfoFormat("Removed {0} images", removed);
        }
Example #49
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.Window = ((DermsUI.View.HomeWindow)(target));
                return;

            case 6:
                this.GMapp = ((GMap.NET.WindowsForms.GMapControl)(target));

            #line 333 "..\..\..\View\HomeWindow.xaml"
                this.GMapp.MouseUp += new System.Windows.Forms.MouseEventHandler(this.GMapp_MouseUp);

            #line default
            #line hidden
                return;

            case 7:
                this.CheckBoxBreakerEntity = ((System.Windows.Controls.CheckBox)(target));
                return;

            case 8:
                this.CheckBoxEnergySourceEntity = ((System.Windows.Controls.CheckBox)(target));
                return;

            case 9:
                this.CheckBoxEnergyConsumerEntity = ((System.Windows.Controls.CheckBox)(target));
                return;

            case 10:
                this.CheckBoxSubstitutionEntuty = ((System.Windows.Controls.CheckBox)(target));
                return;

            case 11:
                this.CheckBoxAllEntity = ((System.Windows.Controls.CheckBox)(target));
                return;

            case 12:
                this.CheckBoxGeneratorEntity = ((System.Windows.Controls.CheckBox)(target));
                return;

            case 13:
                this.labelOptions = ((System.Windows.Controls.Label)(target));
                return;

            case 14:
                this.OptionsButton = ((System.Windows.Controls.Button)(target));

            #line 343 "..\..\..\View\HomeWindow.xaml"
                this.OptionsButton.Click += new System.Windows.RoutedEventHandler(this.OptionsButton_Click);

            #line default
            #line hidden
                return;

            case 15:
                this.OptionsButton_Copy = ((System.Windows.Controls.Button)(target));

            #line 344 "..\..\..\View\HomeWindow.xaml"
                this.OptionsButton_Copy.Click += new System.Windows.RoutedEventHandler(this.OptionsButton_Copy_Click);

            #line default
            #line hidden
                return;

            case 16:
                this.MainTreeView = ((System.Windows.Controls.TreeView)(target));
                return;
            }
            this._contentLoaded = true;
        }
Example #50
-1
        public FlightData()
        {
            log.Info("Ctor Start");

            InitializeComponent();

            log.Info("Components Done");

            instance = this;
            //    _serializer = new DockStateSerializer(dockContainer1);
            //    _serializer.SavePath = Application.StartupPath + Path.DirectorySeparatorChar + "FDscreen.xml";
            //    dockContainer1.PreviewRenderer = new PreviewRenderer();
            //
            mymap = gMapControl1;
            myhud = hud1;
            MainHcopy = MainH;

              //  mymap.Manager.UseMemoryCache = false;

            log.Info("Tunning Graph Settings");
            // setup default tuning graph
            if (MainV2.config["Tuning_Graph_Selected"] != null)
            {
                string line = MainV2.config["Tuning_Graph_Selected"].ToString();
                string[] lines = line.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
                foreach (string option in lines)
                {
                    chk_box_CheckedChanged((object)(new CheckBox() { Name = option, Checked = true }), new EventArgs());
                }
            }
            else
            {
                chk_box_CheckedChanged((object)(new CheckBox() { Name = "roll", Checked = true }), new EventArgs());
                chk_box_CheckedChanged((object)(new CheckBox() { Name = "pitch", Checked = true }), new EventArgs());
                chk_box_CheckedChanged((object)(new CheckBox() { Name = "nav_roll", Checked = true }), new EventArgs());
                chk_box_CheckedChanged((object)(new CheckBox() { Name = "nav_pitch", Checked = true }), new EventArgs());
            }

            log.Info("HUD Settings");
            foreach (string item in MainV2.config.Keys)
            {
                if (item.StartsWith("hud1_useritem_"))
                {
                    string selection = item.Replace("hud1_useritem_", "");

                    CheckBox chk = new CheckBox();
                    chk.Name = selection;
                    chk.Checked = true;

                    HUD.Custom cust = new HUD.Custom();
                    cust.Header = MainV2.config[item].ToString();
                    cust.src = MainV2.comPort.MAV.cs;

                    addHudUserItem(ref cust, chk);
                }
            }

            List<string> list = new List<string>();

            {
                list.Add("LOITER_UNLIM");
                list.Add("RETURN_TO_LAUNCH");
                list.Add("PREFLIGHT_CALIBRATION");
                list.Add("MISSION_START");
                list.Add("PREFLIGHT_REBOOT_SHUTDOWN");
                //DO_SET_SERVO
                //DO_REPEAT_SERVO
            }

            CMB_action.DataSource = list;

            CMB_modes.DataSource = Common.getModesList(MainV2.comPort.MAV.cs);
            CMB_modes.ValueMember = "Key";
            CMB_modes.DisplayMember = "Value";

            CMB_setwp.SelectedIndex = 0;

            log.Info("Graph Setup");
            CreateChart(zg1);

            // config map
            log.Info("Map Setup");
            gMapControl1.MapType = MapType.GoogleSatellite;
            gMapControl1.MinZoom = 1;
            gMapControl1.CacheLocation = Path.GetDirectoryName(Application.ExecutablePath) + "/gmapcache/";

            gMapControl1.OnMapZoomChanged += new MapZoomChanged(gMapControl1_OnMapZoomChanged);

            gMapControl1.Zoom = 3;

            gMapControl1.RoutesEnabled = true;
            gMapControl1.PolygonsEnabled = true;

            kmlpolygons = new GMapOverlay(gMapControl1, "kmlpolygons");
            gMapControl1.Overlays.Add(kmlpolygons);

            geofence = new GMapOverlay(gMapControl1, "geofence");
            gMapControl1.Overlays.Add(geofence);

            polygons = new GMapOverlay(gMapControl1, "polygons");
            gMapControl1.Overlays.Add(polygons);

            routes = new GMapOverlay(gMapControl1, "routes");
            gMapControl1.Overlays.Add(routes);

            try
            {
                if (MainV2.getConfig("GspeedMAX") != "")
                {
                    Gspeed.MaxValue = float.Parse(MainV2.getConfig("GspeedMAX"));
                }
            }
            catch { }

            MainV2.comPort.ParamListChanged += FlightData_ParentChanged;
        }