/// <summary> /// Set specific map source to clone of map provider. /// </summary> /// <param name="clone">Clone of map provider.</param> /// <param name="uniqueId">Id of map source.</param> public virtual void SetMapSourceToClone(MapProviderBase clone, string uniqueId) { IMapSource source = clone.CurrentSource; if (source == null || source.UniqueId != uniqueId) { clone.SetMapSource(uniqueId); } }
/// <summary> /// Force map provider to use specific map source. /// </summary> /// <param name="uniqueId">Unique ID of the map source.</param> public void SetMapSource(string uniqueId) { IMapSource source = null; if (this.MapSources.TryGetValue(uniqueId, out source)) { string oldSourceId = this.CurrentSource != null ? this.CurrentSource.UniqueId : null; this.CurrentSource = source; } }
public GameBoard(IMapSource source) { map = new TileType[source.Rows, source.Columns]; for (int i = 0; i < source.Rows; i++) { for (int j = 0; j < source.Columns; j++) { map[i, j] = source[i, j]; } } }
void GetReferences() { // map source can be one of many just get it if (mapSource == null) { mapSource = GetComponent <IMapSource>(); } if (mapMeshGenerator == null) { mapMeshGenerator = GetComponent <MeshGenerator>(); } layerMask = LayerMask.GetMask("Map"); }
public static void SetZoomToPoint(Map map, Point point, int zoomAdjustment) { ICoordinateService coordinateService = CoordinateServiceProvider.GetService(map); Point center = map.SpatialReference.GeographicToLogical(map.Center); Location newCenter = map.Center; IMapSource mode = map.Provider.CurrentSource; Point sourceLogical = coordinateService.PixelToLogical(point); Location sourcePoint = coordinateService.PixelToGeographic(point); map.ZoomLevel += zoomAdjustment; Point currentLogical = coordinateService.PixelToLogical(point); Location currentPoint = coordinateService.PixelToGeographic(point); if (mode == map.Provider.CurrentSource) { Point shift = new Point(sourceLogical.X - currentLogical.X, sourceLogical.Y - currentLogical.Y); center.X += shift.X; center.Y += shift.Y; newCenter = map.SpatialReference.LogicalToGeographic(center); } else { if (map.Center.Longitude < sourcePoint.Longitude) { newCenter.Longitude = map.Center.Longitude + sourcePoint.Longitude - currentPoint.Longitude; } else { newCenter.Longitude = map.Center.Longitude - currentPoint.Longitude + sourcePoint.Longitude; } if (map.Center.Latitude < sourcePoint.Latitude) { newCenter.Latitude = map.Center.Latitude + sourcePoint.Latitude - currentPoint.Latitude; } else { newCenter.Latitude = map.Center.Latitude - currentPoint.Latitude + sourcePoint.Latitude; } } map.Center = newCenter; }
public MainForm() { InitializeComponent(); //Trackbar Range Change Events #region Range CollectionChanged Events tbPrice.Ranges.CollectionChanged += RangesOnCollectionChanged; tbBeds.Ranges.CollectionChanged += RangesOnCollectionChanged; tbBaths.Ranges.CollectionChanged += RangesOnCollectionChanged; tbAcres.Ranges.CollectionChanged += RangesOnCollectionChanged; tbGarages.Ranges.CollectionChanged += RangesOnCollectionChanged; tbSqFt.Ranges.CollectionChanged += RangesOnCollectionChanged; tbYear.Ranges.CollectionChanged += RangesOnCollectionChanged; tbTOM.Ranges.CollectionChanged += RangesOnCollectionChanged; #endregion //------------------------------------------------------------------------------------------------------------------------------------------ #region MapControl Properties and Setup this._mapControlA.Bearing = 0F; this._mapControlA.CanDragMap = true; this._mapControlA.Dock = System.Windows.Forms.DockStyle.Fill; this._mapControlA.EmptyTileColor = System.Drawing.Color.Navy; this._mapControlA.GrayScaleMode = false; this._mapControlA.HelperLineOption = GMap.NET.WindowsForms.HelperLineOptions.DontShow; this._mapControlA.LevelsKeepInMemmory = 5; this._mapControlA.Location = new System.Drawing.Point(0, 0); this._mapControlA.MarkersEnabled = true; this._mapControlA.MaxZoom = 17; this._mapControlA.MinZoom = 2; this._mapControlA.MouseWheelZoomType = GMap.NET.MouseWheelZoomType.MousePositionAndCenter; this._mapControlA.Name = "_mapControl"; this._mapControlA.NegativeMode = false; this._mapControlA.PolygonsEnabled = true; this._mapControlA.RetryLoadTile = 0; this._mapControlA.RoutesEnabled = true; this._mapControlA.ScaleMode = GMap.NET.WindowsForms.ScaleModes.Integer; this._mapControlA.SelectedAreaFillColor = System.Drawing.Color.FromArgb(((int)(((byte)(33)))), ((int)(((byte)(65)))), ((int)(((byte)(105)))), ((int)(((byte)(225))))); this._mapControlA.ShowTileGridLines = false; this._mapControlA.Size = new System.Drawing.Size(661, 665); this._mapControlA.TabIndex = 0; this._mapControlA.Zoom = 0D; this._mapControlA.MouseUp += MapControl_OnMouseUp; this._mapControlA.OnMapZoomChanged += MapControlA_MapZoomChanged; this._mapControlA.OnPositionChanged += MapControlA_PositionChanged; _mapControlA.MapProvider = GMapProviders.GoogleMap; _mapControlA.Position = new PointLatLng(48.037071, -121.927404); _mapControlA.DragButton = MouseButtons.Left; _mapControlA.MinZoom = 0; _mapControlA.MaxZoom = 24; _mapControlA.Zoom = 9; this._mapControlB.Bearing = 0F; this._mapControlB.CanDragMap = true; this._mapControlB.Dock = System.Windows.Forms.DockStyle.Fill; this._mapControlB.EmptyTileColor = System.Drawing.Color.Navy; this._mapControlB.GrayScaleMode = false; this._mapControlB.HelperLineOption = GMap.NET.WindowsForms.HelperLineOptions.DontShow; this._mapControlB.LevelsKeepInMemmory = 5; this._mapControlB.Location = new System.Drawing.Point(0, 0); this._mapControlB.MarkersEnabled = true; this._mapControlB.MaxZoom = 17; this._mapControlB.MinZoom = 2; this._mapControlB.MouseWheelZoomType = GMap.NET.MouseWheelZoomType.MousePositionAndCenter; this._mapControlB.Name = "_mapControl"; this._mapControlB.NegativeMode = false; this._mapControlB.PolygonsEnabled = true; this._mapControlB.RetryLoadTile = 0; this._mapControlB.RoutesEnabled = true; this._mapControlB.ScaleMode = GMap.NET.WindowsForms.ScaleModes.Integer; this._mapControlB.SelectedAreaFillColor = System.Drawing.Color.FromArgb(((int)(((byte)(33)))), ((int)(((byte)(65)))), ((int)(((byte)(105)))), ((int)(((byte)(225))))); this._mapControlB.ShowTileGridLines = false; this._mapControlB.Size = new System.Drawing.Size(661, 665); this._mapControlB.TabIndex = 0; this._mapControlB.Zoom = 0D; _mapControlB.MapProvider = GMapProviders.GoogleMap; _mapControlB.Position = new PointLatLng(48.037071, -121.927404); _mapControlB.DragButton = MouseButtons.Left; _mapControlB.MinZoom = 0; _mapControlB.MaxZoom = 24; _mapControlB.Zoom = 9; _mapControlB.OnPositionChanged += MapControlBOnOnPositionChanged; _mapControlB.OnMapZoomChanged += MapControlBOnOnMapZoomChanged; _mapControlB.MouseUp += MapControl_OnMouseUp; _mapControlB.MouseDown += MapControl_OnMouseDown; _mapControlB.MouseMove += MapControl_OnMouseMove; this.mapSplitter.Panel1.Controls.Add(this._mapControlA); this.mapSplitter.Panel2.Controls.Add(this._mapControlB); // Setup our map sources _mapSourceA = new ApiMapSource(new Uri(_settings.MapSourceA), _settings); _mapSourceB = new ApiMapSource(new Uri(_settings.MapSourceB), _settings); _mapControlA.Tag = _mapSourceA; _mapControlB.Tag = _mapSourceB; // Initialize them be establishing the necessary session contexts _mapSourceA.Initialize(); _mapSourceB.Initialize(); // Add the listing overlays _mapControlA.Overlays.Add(_listingsOverlayA); _mapControlB.Overlays.Add(_listingsOverlayB); #endregion //------------------------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------------------------ #region Control Tagging tbPrice.Tag = CriteriaType.Price; tbPrice.TrackBarElement.Tag = tbPrice.Tag; tbBeds.Tag = CriteriaType.Beds; tbBeds.TrackBarElement.Tag = tbBeds.Tag; tbBaths.Tag = CriteriaType.Baths; tbBaths.TrackBarElement.Tag = tbBaths.Tag; tbSqFt.Tag = CriteriaType.SqFt; tbSqFt.TrackBarElement.Tag = tbSqFt.Tag; tbAcres.Tag = CriteriaType.Acres; tbAcres.TrackBarElement.Tag = tbAcres.Tag; tbYear.Tag = CriteriaType.Year; tbYear.TrackBarElement.Tag = tbYear.Tag; tbGarages.Tag = CriteriaType.Garages; tbGarages.TrackBarElement.Tag = tbGarages.Tag; tbTOM.Tag = CriteriaType.TOM; tbTOM.TrackBarElement.Tag = tbTOM.Tag; listingStatusCheckedListBox.CheckedDropDownListElement.Tag = CriteriaType.ListingStatus; propertyTypeCheckedListBox.CheckedDropDownListElement.Tag = CriteriaType.PropertyType; searchOptionsCheckedListBox.CheckedDropDownListElement.Tag = CriteriaType.SearchOptions; #endregion //------------------------------------------------------------------------------------------------------------------------------------------ //Debug.WriteLine("Initialize - Year Max:{0}Year Min:{1}",tbYear.Maximum,tbYear.Minimum); tbYear.Maximum = DateTime.Now.Year; tbYear.Minimum = 1800; //Debug.WriteLine("Fixed? Year Max:{0}Year Min:{1}",tbYear.Maximum,tbYear.Minimum); //foreach (var item in listingStatusCheckedListBox.CheckedItems) //{ // Debug.WriteLine("Name:{0} Tag:{1} IsChecked:{2}",item.Text,item.Tag,item.Checked); //} //foreach (var item in listingStatusCheckedListBox.Items) //{ // Debug.WriteLine("Name:{0} Tag:{1}",item.Text,item.Tag); //} }
public void UpdateElement(int row, int col, IMapSource source) { map[row, col] = source[row, col]; }
/// <summary> /// Called after map provider switch to another map source. /// </summary> /// <param name="source">Map source is used.</param> protected virtual void OnPreviewSourceChanged(IMapSource source) { }
/// <summary> /// Called before map provider switch to another map source. /// </summary> /// <param name="source">Map source which will be used.</param> protected virtual bool OnPreviewSourceChange(IMapSource source) { return(true); }