本文整理汇总了C#中GMap.NET.WindowsForms.GMapControl类的典型用法代码示例。如果您正苦于以下问题:C# GMapControl类的具体用法?C# GMapControl怎么用?C# GMapControl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GMapControl类属于GMap.NET.WindowsForms命名空间,在下文中一共展示了GMapControl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MapAdapter
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;
}
示例2: GMapMarkerTarget
public GMapMarkerTarget(PointLatLng p, GMapControl map, Bitmap icon)
: base(p)
{
Size = SizeSt;
MainMap = map;
this.icon = icon;
}
示例3: FeedMarker
public FeedMarker(PointLatLng loc, Article art, GMapControl gmap)
{
location = loc;
article = art;
this.gmap = gmap;
addPIN(location);
}
示例4: PloyLineOverLay
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);
}
示例5: LineOverlay
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;
}
示例6: DrawPoint
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;
}
示例7: DoDebug
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();
}
示例8: GoogleMap
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);
}
示例9: GMapOverlay
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);
}
示例10: OnLoad
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);
}
示例11: StaticImage
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);
}
示例12: MapPrintPreviewForm
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
}
示例13: DrawMap
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);
}
示例14: GMapMarkerWind
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;
}
}
示例15: GMapRestImagery
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/";
}