public frmMapCar95() { InitializeComponent(); barButtonItem11.Alignment = DevExpress.XtraBars.BarItemLinkAlignment.Right; btFullScrean.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; barSubItem1.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; rMap1 = new RMap(); rMap1.MouseWheelZoomType = MouseWheelZoomType.MousePositionWithoutCenter; rMap1.Dock = DockStyle.Fill; Controls.Add(rMap1); mapview = rMap1; rMap1.Manager.Mode = GMap.NET.AccessMode.ServerOnly; GoogleChinaMap map = GoogleChinaMap.Instance; map.TryCorrectVersion = false; rMap1.MapProvider = map; //rMap1.Position = new PointLatLng(46.6, 130); rMap1.MaxZoom = 16; rMap1.MinZoom = 9; mapServer = ClientServer.PlatformServer.GetService<TONLI.MapCore.IMapServer>(); objects = new GMapOverlay(rMap1, "objects"); routes = new GMapOverlay(rMap1, "LineCode"); rMap1.Overlays.Add(routes); rMap1.Overlays.Add(objects); routes.Markers.CollectionChanged += new GMap.NET.ObjectModel.NotifyCollectionChangedEventHandler(Markers_CollectionChanged); oInstances = new OperationInstances(rMap1); curOperation = oInstances.LineOperation; curOperation.CanEditMarker = true; rMap1.OnMapZoomChanged += new MapZoomChanged(rMap1_OnMapZoomChanged); rMap1.MouseEnter += new EventHandler(rMap1_MouseEnter); rMap1.MouseMove += new MouseEventHandler(rMap1_MouseMove); rMap1.MouseMove += new MouseEventHandler(MainMap_MouseMove); rMap1.MouseDown += new MouseEventHandler(MainMap_MouseDown); rMap1.MouseUp += new MouseEventHandler(MainMap_MouseUp); rMap1.OnMarkerEnter += new MarkerEnter(MainMap_OnMarkerEnter); rMap1.OnMarkerLeave += new MarkerLeave(MainMap_OnMarkerLeave); rMap1.OnTileLoadStart += new TileLoadStart(MainMap_OnTileLoadStart); rMap1.OnTileLoadComplete += new TileLoadComplete(MainMap_OnTileLoadComplete); barButtonItem10.ButtonStyle = DevExpress.XtraBars.BarButtonStyle.Check; barButtonItem10.AllowAllUp = true; barButtonItem4.ButtonStyle = DevExpress.XtraBars.BarButtonStyle.Check; barButtonItem4.DownChanged += new DevExpress.XtraBars.ItemClickEventHandler(测距_DownChanged); barButtonItem10.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; //加载设备列表 ucLayerCar = new UCLayerCar(); ucLayerCar.Dock = DockStyle.Fill; dockPanel1_Container.Controls.Add(ucLayerCar); bxdh = new UCPJ_21gzbxdh(); bxdh.Dock = DockStyle.Fill; dockPanel2_Container.Controls.Add(bxdh); bxdh.OnBeginLocation += new ObjectEventHandler<PJ_21gzbxdh>(OnBeginLocation); bxdh.OnTQLocation += new ObjectEventHandler<PJ_21gzbxdh>(bxdh_OnTQLocation); this.WindowState = FormWindowState.Maximized; btGzdj.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; }
// /// <summary> // /// Holds a synchronization object for the timer elapsed event. // /// </summary> // private static object TimerElapsedSync = new object(); /// <summary> /// Creates a new MapView Animator. /// </summary> public MapViewAnimator(IMapView mapView) { if (mapView == null) { throw new ArgumentNullException("mapView"); } _mapView = mapView; _defaultTimeSpan = new TimeSpan(0, 0, 1); }
private void iniMapController() { this._map = new GMap(); this._mapView = (IMapView)this.gMapView1; this._layersView = (ILayersView)this.gLayersView1; this._mapViewController = new MapViewController(this._mapView, this._layersView, this._map); }
public MapViewController(IMapView map_view, IGMap map) { this._mapView = map_view; //this._layersView = layers_view; this._map = map; //this._layersView.SetMapBuddy(map_view.GetMapObject()); this._map.SetHook(map_view.GetMapObject()); }
public LandpriceDetailController(ILandpriceDetailView view, ILandpriceDetail model,IMapView map) { this._view = view; this._model = model; this._map = map; //_mapControl = mapControl; _view.AddRowClickEvent(grv_RowClick); }
private void initMap() { this._map = new GMap(); this._mapView = this.gMapView1 as IMapView; this._layersView = this.gLayersView1 as ILayersView; this._mapController = new MapViewController(this._mapView, this._layersView, this._map); this._mapView.SetController(this._mapController); }
public void SetActiveMap(IMapView view, Point center, int zoomLevel) { _mapView = view; if (_mapView != null) { _map = (MapView) _mapView.GetMapObject(); SetupMap(_map, center, zoomLevel); } }
public ThematicView2() { InitializeComponent(); this._map = new GMap(); this._mapView = (IMapView)this.gMapView1; this._layersView = (ILayersView)this.gLayersView1; this._mapView.SetParentDockControl(this.dockPanel1); this._mapViewController = new MapViewController(this._mapView, this._layersView, this._map); this.Load += new EventHandler(ThematicView2_Load); }
public GLandPriceView() { InitializeComponent(); _engine = new GLandprice(); _engine.SetView(this); _controller = new GLandpriceController(_engine,this); _mapView = this.gMapView1; //this._mapView.SetLandpriceView(this); _landpriceName = DataNameTemplate.Thua_Gia_Dat_Draft; this._inputParams = InputParams.CallMe(); }
/// <summary> /// Attach the specified Model and View. /// </summary> /// <param name="model">The model</param> /// <param name="view">The view</param> /// <param name="explorerPresenter">The parent explorer presenter</param> public void Attach(object model, object view, ExplorerPresenter explorerPresenter) { this.map = model as Map; this.view = view as MapView; this.explorerPresenter = explorerPresenter; // Tell the view to populate the axis. this.PopulateView(); this.view.Zoom = map.Zoom; this.view.Center = map.Center; this.view.ZoomChanged += OnZoomChanged; this.view.PositionChanged += OnPositionChanged; }
public void Split(out IMapView <TKey, TValue> firstPartition, out IMapView <TKey, TValue> secondPartition) { if (Count < 2) { firstPartition = null; secondPartition = null; return; } int pivot = (Int32)(((Int64)firstItemIndex + (Int64)lastItemIndex) / (Int64)2); firstPartition = new ConstantSplittableMap <TKey, TValue>(items, firstItemIndex, pivot); secondPartition = new ConstantSplittableMap <TKey, TValue>(items, pivot + 1, lastItemIndex); }
/// <summary> /// Attach the specified Model and View. /// </summary> /// <param name="model">The model</param> /// <param name="view">The view</param> /// <param name="explorerPresenter">The parent explorer presenter</param> public void Attach(object model, object view, ExplorerPresenter explorerPresenter) { this.map = model as Map; this.view = view as MapView; this.explorerPresenter = explorerPresenter; // Tell the view to populate the axis. this.PopulateView(); this.view.Zoom = this.map.Zoom; this.view.Center = this.map.Center; this.view.ViewChanged += this.OnViewChanged; this.view.PreviewDocs += OnPreviewDocs; explorerPresenter.CommandHistory.ModelChanged += OnModelChanged; }
internal bool TryGetValue <K, V>(K key, out V value) where K : object { if (key == null) { throw new ArgumentNullException(nameof(key)); } IMapView <K, V> _this = Unsafe.As <IMapView <K, V> >(this); // It may be faster to call HasKey then Lookup. On failure, we would otherwise // throw an exception from Lookup. if (!_this.HasKey(key)) { value = default !; // TODO-NULLABLE-GENERIC
public void Split(out IMapView <TKey, TValue> firstPartition, out IMapView <TKey, TValue> secondPartition) { if (this.Count < 2) { firstPartition = (IMapView <TKey, TValue>)null; secondPartition = (IMapView <TKey, TValue>)null; } else { int lastItemIndex = (int)(((long)this.firstItemIndex + (long)this.lastItemIndex) / 2L); firstPartition = (IMapView <TKey, TValue>) new ConstantSplittableMap <TKey, TValue>(this.items, this.firstItemIndex, lastItemIndex); secondPartition = (IMapView <TKey, TValue>) new ConstantSplittableMap <TKey, TValue>(this.items, lastItemIndex + 1, this.lastItemIndex); } }
internal void Split <K, V>(out IMapView <K, V> first, out IMapView <K, V> second) { IReadOnlyDictionary <K, V> data = JitHelpers.UnsafeCast <IReadOnlyDictionary <K, V> >((object)this); if (data.Count < 2) { first = (IMapView <K, V>)null; second = (IMapView <K, V>)null; } else { (data as ConstantSplittableMap <K, V> ?? new ConstantSplittableMap <K, V>(data)).Split(out first, out second); } }
// bool TryGetValue(TKey key, out TValue value) internal bool TryGetValue <K, V>(K key, [MaybeNullWhen(false)] out V value) where K : notnull { if (key == null) { throw new ArgumentNullException(nameof(key)); } IMapView <K, V> _this = Unsafe.As <IMapView <K, V> >(this); // It may be faster to call HasKey then Lookup. On failure, we would otherwise // throw an exception from Lookup. if (!_this.HasKey(key)) { value = default !;
public override void Execute() { base.Execute(); if (!(this.Hook is IDFApplication)) { return; } else { m_App = (IDFApplication)this.Hook; } m_MapView = m_App.Workbench.GetView(typeof(MapView)) as IMapView; if (m_MapView == null) { return; } m_MapView.CurrentTool = this; m_MapControl = m_App.CurrentMapControl; m_FocusMap = m_MapControl.ActiveView.FocusMap; m_pActiveView = (IActiveView)this.m_FocusMap; m_pDisplay = m_pActiveView.ScreenDisplay; m_pStatusBarService = m_App.StatusBarService; //获得状态服务 CurrentTool.m_CurrentToolName = CurrentTool.CurrentToolName.drawTraceLine; m_MapControl.MousePointer = esriControlsMousePointer.esriPointerCrosshair; CommonFunction.MapRefresh(m_pActiveView); frmFixLength formFixDist = new frmFixLength(); formFixDist.ShowDialog(); m_pStatusBarService.SetStateMessage("步骤:1.选择要素;2.右键/ENTER/SPACEBAR,结束选择;3.左键,确定跟踪的起点;4.左键,结束跟踪。(ESC: 取消/DEL:删除)"); //记录用户操作 clsUserLog useLog = new clsUserLog(); useLog.UserName = DFApplication.LoginUser; useLog.UserRoll = DFApplication.LoginSubSys; useLog.Operation = "绘制跟踪线"; useLog.LogTime = System.DateTime.Now; useLog.TableLog = (m_App.CurrentWorkspace as IFeatureWorkspace).OpenTable("WSGRI_LOG"); useLog.setUserLog(); }
private async void Nrequest(object sender, EventArgs e) { try { if (AppData.SyncInProgress) { await SplitView.DisplayAlert("Sync In Progress", "Please wait for the sync to finish before taking further actions.", "OK", null); } else if (!AppData.ConfigModel.IsNotEmpty) { await SplitView.DisplayAlert("No data", "Please download the data to proceed", "OK", null); } else { UserPosition = await SplitView.Fullmapview.GetCurrentLocation(); if (Reachability.InternetConnectionStatus() == ReachabilityNetworkStatus.NotReachable) { await SplitView.Instace().PushRightContent(NewCaseAddView = new AddNewCaseView()); } else { if (Device.OS == TargetPlatform.Android) { PointOnMapView = new AndroidMapView(); } else { PointOnMapView = new WindowsMapView(); } await SplitView.Instace().PushRightContent(AddNewCasePointOnMapView = new AddNewCasePointOnMapView(PointOnMapView, UserPosition)); } if (Device.OS != TargetPlatform.Android) { var t = Task.Run(async delegate { await Task.Delay(TimeSpan.FromSeconds(1)); AddNewCasePointOnMapView.MoveToPosition?.Invoke(); return(42); }); } } } catch (Exception ex) { LogTracking.LogTrace(ex.ToString()); } }
/// <summary> /// Creates a new route tracker animator. /// </summary> /// <param name="mapView">The mapview.</param> /// <param name="routeTracker">The tracker tracking the route.</param> /// <param name="restartAfterTouch">The time in second to wait before resuming tracking after the mapview is touched.</param> /// <param name="defaultZoom">The default zoom.</param> public RouteTrackerAnimator(IMapView mapView, RouteTracker routeTracker, Second restartAfterTouch, float defaultZoom) { this.MinZoom = 18; this.MaxZoom = 30; this.DefaultZoom = defaultZoom; _mapView = mapView; _animator = new MapViewAnimator(mapView); _routeTracker = routeTracker; _minimumTrackGap = new TimeSpan(0, 0, 0, 0, 500).Ticks; this.RestartAfterTouch = restartAfterTouch; _mapView.MapTouched += MapViewMapTouched; }
private static V Lookup <K, V>(IMapView <K, V> _this, K key) { try { return(_this.Lookup(key)); } catch (Exception ex) { if (-2147483637 == ex._HResult) { throw new KeyNotFoundException(Environment.GetResourceString("Arg_KeyNotFound")); } throw; } }
/// <summary> /// Extension method that applies values of the overlay to the current one -- effectively /// sets all the values of the current map to be corresponding to the one you pass in. /// </summary> /// <param name="self"> /// The current ISettableMapView. Never specified manually as this is an extension method. /// </param> /// <param name="overlay"> /// The data apply to the map. Must have identical dimensions to the current map. /// </param> public static void ApplyOverlay <T>(this ISettableMapView <T> self, IMapView <T> overlay) { if (self.Height != overlay.Height || self.Width != overlay.Width) { throw new ArgumentException("Overlay size must match current map size."); } for (int y = 0; y < self.Height; ++y) { for (int x = 0; x < self.Width; ++x) { self[x, y] = overlay[x, y]; } } }
public void DisposeActiveMapContext() { foreach (var layerViewModel in LayerViewModels) { layerViewModel.LayerRefreshed -= LayerViewModelOnLayerRefreshed; } LayerViewModels.Clear(); if (_map != null) { _map.Destroy(); _mapView = null; _map = null; } }
static bool IsPointByTwoWalls(IMapView <bool> map, Coord location) { var points = AdjacencyRule.CARDINALS.Neighbors(location); var area = new Rectangle(0, 0, map.Width, map.Height); var counter = 0; foreach (var point in points) { if (area.Contains(point) && map[point] == false) { counter++; } } return(counter == 2); }
/// <summary> /// Attach the specified Model and View. /// </summary> /// <param name="model">The model</param> /// <param name="view">The view</param> /// <param name="explorerPresenter">The parent explorer presenter</param> public void Attach(object model, object view, ExplorerPresenter explorerPresenter) { this.map = model as Map; this.view = view as MapView; this.explorerPresenter = explorerPresenter; propertyPresenter = new PropertyPresenter(); propertyPresenter.Attach(model, this.view.Grid, this.explorerPresenter); // Tell the view to populate the axis. this.PopulateView(); this.view.Zoom = this.map.Zoom; this.view.Center = this.map.Center; this.view.ViewChanged += this.OnViewChanged; explorerPresenter.CommandHistory.ModelChanged += OnModelChanged; }
/// <summary> /// Gets a random position in the map view, for which the selector returns true. Random /// positions will continuously be generated until one that qualifies is found. /// </summary> /// <typeparam name="T">Type of items being exposed by the MapView.</typeparam> /// <param name="mapView"> /// Map view to select from -- never specified manually as this is an extension method. /// </param> /// <param name="selector"> /// Function that takes a Coord and the value at that Coord, and returns true if it is an /// acceptable selection, and false if not. /// </param> /// <param name="rng">The rng to use. Defaults to SingletonRandom.DefaultRNG.</param> /// <returns>A random position in the MapView for which the selector returns true.</returns> public static Coord RandomPosition <T>(this IMapView <T> mapView, Func <Coord, T, bool> selector, IGenerator rng = null) { if (rng == null) { rng = SingletonRandom.DefaultRNG; } var c = new Coord(rng.Next(mapView.Width), rng.Next(mapView.Height)); while (!selector(c, mapView[c])) { c = new Coord(rng.Next(mapView.Width), rng.Next(mapView.Height)); } return(c); }
public frmMapNetwork() { InitializeComponent(); rMap1 = new RMap(); rMap1.MouseWheelZoomType = MouseWheelZoomType.MousePositionWithoutCenter; rMap1.Dock = DockStyle.Fill; Controls.Add(rMap1); mapview = rMap1; rMap1.Manager.Mode = GMap.NET.AccessMode.ServerOnly; GoogleChinaMap map = GoogleChinaMap.Instance; map.TryCorrectVersion = false; rMap1.MapProvider = map; //rMap1.Position = new PointLatLng(46.6, 130); rMap1.MaxZoom = 16; rMap1.MinZoom = 9; //mapServer = ClientServer.PlatformServer.GetService<TONLI.MapCore.IMapServer>(); objects = new GMapOverlay(rMap1, "objects"); routes = new GMapOverlay(rMap1, "LineCode"); rMap1.Overlays.Add(routes); rMap1.Overlays.Add(objects); routes.Markers.CollectionChanged += new GMap.NET.ObjectModel.NotifyCollectionChangedEventHandler(Markers_CollectionChanged); oInstances = new OperationInstances(rMap1); curOperation = oInstances.LineOperation; rMap1.OnMapZoomChanged += new MapZoomChanged(rMap1_OnMapZoomChanged); rMap1.MouseEnter += new EventHandler(rMap1_MouseEnter); rMap1.MouseMove += new MouseEventHandler(rMap1_MouseMove); rMap1.MouseMove += new MouseEventHandler(MainMap_MouseMove); rMap1.MouseDown += new MouseEventHandler(MainMap_MouseDown); rMap1.MouseUp += new MouseEventHandler(MainMap_MouseUp); rMap1.OnMarkerEnter += new MarkerEnter(MainMap_OnMarkerEnter); rMap1.OnMarkerLeave += new MarkerLeave(MainMap_OnMarkerLeave); rMap1.OnTileLoadStart += new TileLoadStart(MainMap_OnTileLoadStart); rMap1.OnTileLoadComplete += new TileLoadComplete(MainMap_OnTileLoadComplete); barButtonItem10.ButtonStyle = DevExpress.XtraBars.BarButtonStyle.Check; barButtonItem10.AllowAllUp = true; barButtonItem4.ButtonStyle = DevExpress.XtraBars.BarButtonStyle.Check; barButtonItem4.DownChanged += new DevExpress.XtraBars.ItemClickEventHandler(测距_DownChanged); barButtonItem10.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; ucLayer = ucMapLayer1; dockPanel1.Text = "网络图图纸库"; barSubItem1.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; }
// Initialize graph for control-case AStar, based on a GoRogue IMapView private static GraphReturn initGraph(IMapView <bool> map, Distance connectivity) { var returnVal = new GraphReturn(); returnVal.Graph = new CA.Graph(); returnVal.Nodes = new CA.Node[map.Width, map.Height]; // So we can add arcs easier for (int x = 0; x < map.Width; x++) { for (int y = 0; y < map.Height; y++) { if (map[x, y]) { returnVal.Nodes[x, y] = new CA.Node(x, y, 0); returnVal.Graph.AddNode(returnVal.Nodes[x, y]); } } } for (int x = 0; x < map.Width; x++) { for (int y = 0; y < map.Height; y++) { if (map[x, y]) { foreach (var neighbor in ((AdjacencyRule)connectivity).Neighbors(x, y)) { // Out of bounds of map if (neighbor.X < 0 || neighbor.Y < 0 || neighbor.X >= map.Width || neighbor.Y >= map.Height) { continue; } if (!map[neighbor]) // Not walkable, so no node exists for it { continue; } returnVal.Graph.AddArc(new CA.Arc(returnVal.Nodes[x, y], returnVal.Nodes[neighbor.X, neighbor.Y])); } } } } return(returnVal); }
private static V Lookup <K, V>(IMapView <K, V> _this, K key) { Contract.Requires(null != key); try { return(_this.Lookup(key)); } catch (Exception ex) { if (__HResults.E_BOUNDS == ex._HResult) { throw new KeyNotFoundException(Environment.GetResourceString("Arg_KeyNotFound")); } throw; } }
public override void Execute() { base.Execute(); if (!(this.Hook is IDFApplication)) { return; } else { m_App = (IDFApplication)this.Hook; } m_MapView = m_App.Workbench.GetView(typeof(MapView)) as IMapView; if (m_MapView == null) { return; } m_MapView.CurrentTool = this; m_MapControl = m_App.CurrentMapControl; m_FocusMap = m_MapControl.ActiveView.FocusMap; m_pActiveView = (IActiveView)this.m_FocusMap; m_CurrentLayer = m_App.CurrentEditLayer; m_pStatusBarService = m_App.StatusBarService; //获得状态服务 CurrentTool.m_CurrentToolName = CurrentTool.CurrentToolName.drawCircle3P; CommonFunction.MapRefresh(m_pActiveView); m_dblTolerance = CommonFunction.ConvertPixelsToMapUnits(m_MapControl.ActiveView, 4); m_MapControl.MousePointer = esriControlsMousePointer.esriPointerCrosshair; m_pStatusBarService.SetStateMessage("提示:依次指定圆周上三点。(A:绝对XY/R:相对XY/P:平行尺/ESC:取消/ENTER:结束/+shift:修改坐标)"); //向状态栏传送提示信息 //记录用户操作 clsUserLog useLog = new clsUserLog(); useLog.UserName = DFApplication.LoginUser; useLog.UserRoll = DFApplication.LoginSubSys; useLog.Operation = "绘制圆形"; useLog.LogTime = System.DateTime.Now; useLog.TableLog = (m_App.CurrentWorkspace as IFeatureWorkspace).OpenTable("WSGRI_LOG"); useLog.setUserLog(); }
private static V Lookup <K, V>(IMapView <K, V> _this, K key) { Contract.Requires(null != key); try { return(_this.Lookup(key)); } catch (Exception ex) { if (HResults.E_BOUNDS == ex._HResult) { throw new KeyNotFoundException(SR.Arg_KeyNotFound); } throw; } }
// Priority queue of the open nodes. /// <summary> /// Constructor. /// </summary> /// <param name="walkabilityMap"> /// Map used to determine whether or not a given location can be traversed -- true indicates /// walkable, false unwalkable. /// </param> /// <param name="distanceMeasurement"> /// Distance measurement used to determine the method of measuring distance between two /// points, the heuristic AStar uses when pathfinding, and whether locations are connected in /// a 4-way or 8-way manner. /// </param> public AStar(IMapView <bool> walkabilityMap, Distance distanceMeasurement) { WalkabilityMap = walkabilityMap; DistanceMeasurement = distanceMeasurement; int maxSize = walkabilityMap.Width * walkabilityMap.Height; nodes = new AStarNode[maxSize]; for (int i = 0; i < maxSize; i++) { nodes[i] = new AStarNode(Coord.ToCoord(i, walkabilityMap.Width), null); } nodesWidth = walkabilityMap.Width; nodesHeight = walkabilityMap.Height; openNodes = new FastPriorityQueue <AStarNode>(maxSize); }
//Initialize Model, view and Listeners private void Start() { model = new MapModel(); view = transform.GetChild(5).GetComponent <MapView>(); // Listen to input from the view ZoomToMapPin.OnMapObject += HandlePOIInput; view.OnPOI += POItoQuery; // Listen to changes in the model model.GeneratePinMap += GeneratePinMaps; model.MapVisibility += MainMenuStatusVisibility; model.OnPOIGetter += SendPOIListToMapMenu; }
private static V Lookup <K, V>(IMapView <K, V> _this, K key) { Debug.Assert(null != key); try { return(_this.Lookup(key)); } catch (Exception ex) { if (HResults.E_BOUNDS == ex.HResult) { throw new KeyNotFoundException(SR.Format(SR.Arg_KeyNotFoundWithKey, key.ToString())); } throw; } }
public override void Execute() { base.Execute(); if (!(this.Hook is IDFApplication)) { return; } else { m_App = (IDFApplication)this.Hook; } m_MapView = m_App.Workbench.GetView(typeof(MapView)) as IMapView; if (m_MapView == null) { return; } m_MapView.CurrentTool = this; m_MapControl = m_App.CurrentMapControl; m_FocusMap = m_MapControl.ActiveView.FocusMap; m_pActiveView = (IActiveView)this.m_FocusMap; m_CurrentLayer = m_App.CurrentEditLayer; m_pStatusBarService = m_App.StatusBarService; //获得状态服务 CurrentTool.m_CurrentToolName = CurrentTool.CurrentToolName.drawRectRelative2P; CommonFunction.MapRefresh(m_pActiveView); m_dblTolerance = CommonFunction.ConvertPixelsToMapUnits(m_MapControl.ActiveView, 4); m_MapControl.MousePointer = esriControlsMousePointer.esriPointerCrosshair; m_pStatusBarService.SetStateMessage("依次指定:1.对角线上两点;2.宽度。(U:回退/F:长度+方向/D:长度/O:方位角/B:边长/A:绝对XY/R:相对XY/Enter:结束/ESC:取消)"); //记录用户操作 clsUserLog useLog = new clsUserLog(); useLog.UserName = DFApplication.LoginUser; useLog.UserRoll = DFApplication.LoginSubSys; useLog.Operation = "绘制矩形"; useLog.LogTime = System.DateTime.Now; useLog.TableLog = (m_App.CurrentWorkspace as IFeatureWorkspace).OpenTable("WSGRI_LOG"); useLog.setUserLog(); }
public MapGuideEditor(IEditorService edSvc, IMapGroup group, IMap map) { InitializeComponent(); _edSvc = edSvc; _map = map; _group = group; try { _init = true; cmbSelectionColor.ResetColors(); txtMapDefinition.Text = _map.GetMapDefinition(); _initialView = group.InitialView; chkSingleTiled.Checked = _map.SingleTile; chkOverride.Checked = (_initialView != null); if (_initialView == null) { _initialView = group.CreateInitialView(0.0, 0.0, 0.0); } txtViewX.Text = _initialView.CenterX.ToString(CultureInfo.InvariantCulture); txtViewY.Text = _initialView.CenterY.ToString(CultureInfo.InvariantCulture); txtViewScale.Text = _initialView.Scale.ToString(CultureInfo.InvariantCulture); var selOverlay = _map.GetValue("SelectionAsOverlay"); //NOXLATE var selColor = _map.GetValue("SelectionColor"); //NOXLATE if (!string.IsNullOrEmpty(selColor)) { cmbSelectionColor.CurrentColor = Utility.ParseHTMLColorRGBA(selColor.Substring(2)); //Strip the "0x" part } if (!string.IsNullOrEmpty(selOverlay)) { bool b = true; if (bool.TryParse(selOverlay, out b)) { chkSelectionAsOverlay.Checked = b; } } } finally { _init = false; } }
public static TimeSpan TimeForGoalMap(IMapView <bool> map, IEnumerable <Coord> goals, int iterations) { Stopwatch s = new Stopwatch(); var mapGoals = createGoalStateMap(map, goals); var mapBuilder = new GoalMap(mapGoals, Distance.CHEBYSHEV); mapBuilder.Update(); s.Start(); for (int i = 0; i < iterations; i++) { mapBuilder.Update(); } s.Stop(); return(s.Elapsed); }
public ToolPreviewOutcome Preview(IWorldView worldView, IEnumerable <Vector> inputPositions) { Contract.Requires(inputPositions != null); IMapView <int> terrainMap = worldView.GetTerrainMapView(); IMapView <int> buildingMap = worldView.GetBuildingMapView(); IZonableTerrain zonableTerrains = worldView.Rules.Zones.GetTypedComponents <IZonableTerrain>(Zones.ZonableTerrains)[this.Zone.Id]; PreviewOutcomeBuilder builder = ToolPreviewOutcome.Builder(); foreach (Vector pos in inputPositions) { bool possible = buildingMap[pos] == MapTypes.NoBuilding && zonableTerrains.IsZonable(terrainMap[pos]); builder.WithPositionOutcome(pos, possible ? ToolOutcome.Success : ToolOutcome.Failure); } return(builder.Build()); }
internal void Split <K, V>(out IMapView <K, V> first, out IMapView <K, V> second) { IReadOnlyDictionary <K, V> readOnlyDictionary = JitHelpers.UnsafeCast <IReadOnlyDictionary <K, V> >(this); if (readOnlyDictionary.Count < 2) { first = null; second = null; return; } ConstantSplittableMap <K, V> constantSplittableMap = readOnlyDictionary as ConstantSplittableMap <K, V>; if (constantSplittableMap == null) { constantSplittableMap = new ConstantSplittableMap <K, V>(readOnlyDictionary); } constantSplittableMap.Split(out first, out second); }
// Token: 0x060062B1 RID: 25265 RVA: 0x0014FE78 File Offset: 0x0014E078 internal ConstantSplittableMap(IMapView <TKey, TValue> data) { if (data == null) { throw new ArgumentNullException("data"); } if (2147483647U < data.Size) { Exception ex = new InvalidOperationException(Environment.GetResourceString("InvalidOperation_CollectionBackingDictionaryTooLarge")); ex.SetErrorCode(-2147483637); throw ex; } int size = (int)data.Size; this.firstItemIndex = 0; this.lastItemIndex = size - 1; this.items = this.CreateKeyValueArray(size, data.GetEnumerator()); }
internal void Split <K, V>(out IMapView <K, V>?first, out IMapView <K, V>?second) { IReadOnlyDictionary <K, V> _this = Unsafe.As <IReadOnlyDictionary <K, V> >(this); if (_this.Count < 2) { first = null; second = null; return; } if (!(_this is ConstantSplittableMap <K, V> splittableMap)) { splittableMap = new ConstantSplittableMap <K, V>(_this); } splittableMap.Split(out first, out second); }
private static IMapView <GoalState> createGoalStateMap(IMapView <bool> walkabilityMap, IEnumerable <Coord> goals) { var mapGoals = new ArrayMap <GoalState>(walkabilityMap.Width, walkabilityMap.Height); for (int x = 0; x < walkabilityMap.Width; x++) { for (int y = 0; y < walkabilityMap.Height; y++) { mapGoals[x, y] = walkabilityMap[x, y] ? GoalState.Clear : GoalState.Obstacle; } } foreach (var goal in goals) { mapGoals[goal] = GoalState.Goal; } return(mapGoals); }
private void DrawAction(IMapView map) { switch (_state) { case ActionState.None: GetShipsFromIMapView(map); if (map.MapCells[map.ChosenShip.X, map.ChosenShip.Y].Ship != null) _shipId = map.MapCells[map.ChosenShip.X, map.ChosenShip.Y].Ship.Id; else _shipId = -1; break; case ActionState.Rotating: Rotate(_shipId); break; case ActionState.Moving: Move(_shipId); break; case ActionState.Attack: Attack(_shipId); break; } if (_state == ActionState.None) { Game.Instance().IsResponding = true; } }
private void DrawField(IMapView map) { for (var i = 0; i < Consts.MAP_WIDTH; i++) for (var j = 0; j < Consts.MAP_HEIGHT; j++) { if (i%2 == 0) { CellCoors[i, j] = new PointF(Consts.MAP_START_POS.X + i/2*3*Consts.CELL_SIDE, Consts.MAP_START_POS.Y + j*(float) Math.Sqrt(3)*Consts.CELL_SIDE); Gl.glColor3f(1, 1, 0.3f); DrawCell(CellCoors[i, j]); } else { CellCoors[i, j] = new PointF(Consts.MAP_START_POS.X + (1.5f + (i - 1)/2*3)*Consts.CELL_SIDE, Consts.MAP_START_POS.Y + (float) (Math.Sqrt(3)*Consts.CELL_SIDE/2) + j*(float) Math.Sqrt(3)*Consts.CELL_SIDE); Gl.glColor3f(1, 1, 0.3f); DrawCell(CellCoors[i, j]); } if (map.MapCells[i, j].Object is Dock) DrawDock(new Point(i, j)); } Gl.glEnable(Gl.GL_BLEND); for (var i = 0; i < map.MapCells.GetLength(0); i++) for (var j = 0; j < map.MapCells.GetLength(1); j++) if (map.MapCells[i, j].IsLightened) { Gl.glColor3f(1, 0, 0); var t = CellToScreen(new Point(i, j)); DrawCell(t); } Gl.glDisable(Gl.GL_BLEND); Gl.glColor3f(0, 1, 0); Gl.glLineWidth(3); DrawCell(LightenedCell); Gl.glLineWidth(1); }
private void DrawMapObjects(IMapView map) { for (var j = 0; j < Consts.MAP_HEIGHT; j++) { for (var i = 0; i < Consts.MAP_WIDTH; i++) { if (!(map.MapCells[i, j].Object is Station)) continue; var coord = CellToScreen(new Point(i, j)); var rect = new[] { coord, new PointF(coord.X + 15 - 3, coord.Y - 3), new PointF(coord.X + 15 - 3, coord.Y + 15 - 3), new PointF(coord.X - 3, coord.Y + 15 - 3) }; Gl.glEnable(Gl.GL_BLEND); DrawTexture(12, rect); Gl.glDisable(Gl.GL_BLEND); switch ((map.MapCells[i, j].Object as Station).OwnerColor) { case PlayerColor.None: Gl.glColor4f(0, 0, 0, 0); break; case PlayerColor.Red: Gl.glColor3f(1, 0, 0); break; case PlayerColor.Blue: Gl.glColor3f(0, 0, 1); break; } Gl.glPointSize(7); Gl.glBegin(Gl.GL_POINTS); Gl.glVertex2f(coord.X + 15 - 4, coord.Y + 15 - 5); Gl.glEnd(); } } }
private void DrawShipStatus(IMapView map) { var ships = map.GetShips(Game.Instance().CurrentPlayer.Color); foreach (var ship in ships) { switch (ship.TurnState) { case TurnState.Ready: Gl.glColor3f(0.1f, 0.9f, 0.1f); break; case TurnState.InAction: Gl.glColor3f(0.8f, 0.8f, 0.1f); break; case TurnState.Finished: Gl.glColor3f(0.9f, 0.1f, 0.1f); break; } var pos = CellToScreen(ShipsInfo[ship.Id].Pos); Gl.glPointSize(5); Gl.glBegin(Gl.GL_POINTS); Gl.glVertex2f(pos.X, pos.Y); Gl.glEnd(); } }
void IAttributeQueryView.SetMapView(IMapView mapView) { this._mapView = mapView; }
public IncidentsGridViewController(IMapView mapViewer, IIncidentsGridViewPresenter presenter) { this.mapViewer = mapViewer; this.presenter = presenter; }
void IQueryThuaView.SetMapView(IMapView mapView) { this._mapView = mapView; }
/// <summary> /// Creates a new route tracker animator. /// </summary> /// <param name="mapView">The mapview.</param> /// <param name="routeTracker">The tracker tracking the route.</param> /// <param name="restartAfterTouch">The time in second to wait before resuming tracking after the mapview is touched.</param> public RouteTrackerAnimator(IMapView mapView, RouteTracker routeTracker, Second restartAfterTouch) { this.MinZoom = 16; this.MaxZoom = 30; this.DefaultZoom = 17.5f; _mapView = mapView; _animator = new MapViewAnimator(mapView); _routeTracker = routeTracker; _minimumTrackGap = new TimeSpan (0, 0, 0, 0, 500).Ticks; this.RestartAfterTouch = restartAfterTouch; _mapView.MapTouched += MapViewMapTouched; }
public void SetMapView(IMapView mapView) { _mapView = mapView; }
private void iniMapController() { this._map = new GMap() ; this._mapView = (IMapView)this.gMapView1; this._layersView = (ILayersView)this.gLayersView1; this._mapView.SetParentDockControl(this.dpnMap4Thua); //FrmLandPriceInfo frmLandPriceView = FrmLandPriceInfo.CallMe; _xemVungGiaDatTinh = FrmLandPriceInfo.CallMe.GetView(); _xemVungGiaDatTinh.Config = CurrentConfig.CallMe(); _xemVungGiaDatCongBo = FrmLandPriceInfoPublic.CallMe.GetView(); _xemVungGiaDatCongBo.Config = CurrentConfig.CallMe(); this._mapView.SetLandpriceView("giadatcongbo", _xemVungGiaDatCongBo); this._mapView.SetLandpriceView("giadatdatinh",_xemVungGiaDatTinh); this._mapView.SetCalcMethodBuilderView(FrmCalcMethodBuilder.CallMe.GetView()); _editPosView = FrmSetPositionParam.CallMe; _mapView.EditPosView = _editPosView; this._mapViewController = new MapViewController(this._mapView, this._layersView, this._map); this._mapControl=(IMapControl3)this._map.GetHook(); this._tocControl = this._layersView.GetTocControl(); //this._map4Thua = new GMap(); //this._mapView4thua = this.gMapView1 as IMapView; //this._mapView4thua.SetParentDockControl(this.dpnMap4Thua); //this._layersView4Thua = this.gLayersView1 as ILayersView; //this._mapController4Thua = new MapViewController(this._mapView4thua, this._layersView4Thua, this._map4Thua); //this._mapView4thua.SetController(this._mapController4Thua); //_landPriceTool = new Landprices(); //_landPriceTool.XemGiaDat += new Landprices.XemGiaDatEventHandler(landPriceTool_Changed); //_mapContextMenu = new MapContextMenu(_mapControl); //_mapContextMenu.AddItem(_landPriceTool, false, -1); //this._mapView.ContextMenu.AddItem(_landPriceTool,false,-1); }
/// <summary> /// Gets the Map property. /// </summary> public static MapViewModel getMapVMforView(IMapView view) { CreateMap(); _mapVM.View = view; return _mapVM; }
/// <summary> /// Maps the view map touched. /// </summary> /// <param name="mapView">Map view.</param> /// <param name="newZoom">New zoom.</param> /// <param name="newTilt">New tilt.</param> /// <param name="newCenter">New center.</param> private void MapViewMapTouched(IMapView mapView, float newZoom, Degree newTilt, GeoCoordinate newCenter) { if (newZoom > this.MinZoom) { this.DefaultZoom = System.Math.Min (newZoom, this.MaxZoom); } else { _lastTouch = DateTime.Now.Ticks; } }
//private int damageNumber = 0; public void Firing(IMapView map) { var attacker = CellToScreen(ShipsInfo[attackerId].Pos); var target = CellToScreen(ShipsInfo[_processingDecision.ShipIndex].Pos); target.X += 3/2*Consts.CELL_SIDE; target.Y += (float) Math.Sqrt(3) / 2 * Consts.CELL_SIDE; attacker.X += 3 / 2 * Consts.CELL_SIDE; attacker.Y += (float) Math.Sqrt(3) / 2 * Consts.CELL_SIDE; var delta = new PointF((target.X - attacker.X)/20, (target.Y - attacker.Y)/20); var battle = _processingDecision.Battle; //стрельба блядь поочередная сука var pause = 0; if (bullets.Count == 0) foreach (var step in battle) { bullets.Add(step.IsMineAttack ? new Bullet(true, attacker, pause, step.Damage) : new Bullet(false, target, pause, step.Damage)); pause += 10; } if (animationTick == 0) { bullets.Clear(); var shipPos = ShipsInfo[_processingDecision.ShipIndex].Pos; if (map.MapCells[shipPos.X, shipPos.Y].Ship == null) // стирание атакованного корабля { animation = "BOOM!"; animationTick = 30; animationPos = shipPos; ShipsInfo.Remove(_processingDecision.ShipIndex); } shipPos = ShipsInfo[attackerId].Pos; // стирание атакующего корабля if (map.MapCells[shipPos.X, shipPos.Y].Ship == null) { animation = "BOOM!"; animationTick = 30; animationPos = shipPos; ShipsInfo.Remove(attackerId); } } for (var i = 0; i < bullets.Count; i++) { if (bullets[i].Timeleft == 0) { if (bullets[i].IsMine) { if (!IsAround(bullets[i].Pos, target, 0.5f)) bullets[i].Pos = new PointF(bullets[i].Pos.X + delta.X, bullets[i].Pos.Y + delta.Y); else { bullets[i].Timeleft = 100; bullets[i].ShowTime = 8; var tmp = ShipsInfo.First(ship => ship.Value.Pos == ScreenToCell(target)); tmp.Value.HealthBar.CurrentHealth -= battle[i].Damage; } } else if (!IsAround(bullets[i].Pos, attacker, 0.5f)) bullets[i].Pos = new PointF(bullets[i].Pos.X - delta.X, bullets[i].Pos.Y - delta.Y); else { bullets[i].Timeleft = 100; bullets[i].ShowTime = 8; var tmp = ShipsInfo.First(ship => ship.Value.Pos == ScreenToCell(attacker)); tmp.Value.HealthBar.CurrentHealth -= battle[i].Damage; } DrawBullet(bullets[i].Pos); } else { bullets[i].Timeleft--; } if (bullets[i].ShowTime == 0) continue; UiElement.DrawString(bullets[i].Pos, bullets[i].Damage.ToString()); bullets[i].ShowTime--; } }
public void Animate(IMapView map) { switch (animation) { case "BOOM!": { Explosion(); break; } case "PewPew!": { Firing(map); break; } } if (animationTick != 0) { animationTick--; if (!Proxy.GetInstance().IsLocked) Proxy.GetInstance().IsLocked = true; } else { animation = "none"; Proxy.GetInstance().IsLocked = false; } }
void IAttributeView.SetMapView(IMapView mapview) { _mapView = mapview; IAttributeQueryView att = (IAttributeQueryView)_edit; att.SetMapView(mapview); }
private void GetShipsFromIMapView(IMapView map) { for (var i = 0; i < Consts.MAP_WIDTH; i++) for (var j = 0; j < Consts.MAP_HEIGHT; j++) { if (map.MapCells[i, j].Ship == null) continue; ShipAttributes tmp1; if (ShipsInfo.TryGetValue(map.MapCells[i, j].Ship.Id, out tmp1)) //сукасукасука! ShipsInfo[map.MapCells[i, j].Ship.Id].Pos = new Point(i, j); // = new ShipAttributes("Ship", "ShipColor", new Point(i, j), 0); //TODO: попровить этот хуец else { switch (map.MapCells[i,j].Ship.Name) { //TODO: переделать строки в enum или еще что-нибудь case "Fighter": ShipsInfo[map.MapCells[i, j].Ship.Id] = new ShipAttributes("Fighter", map.MapCells[i, j].Ship.Color, new Point(i, j), 0, new HealthBar(map.MapCells[i,j].Ship.MaxHealth, CellToScreen(new Point(i,j)))); break; case "Barge": ShipsInfo[map.MapCells[i, j].Ship.Id] = new ShipAttributes("Barge", map.MapCells[i, j].Ship.Color, new Point(i, j), 0, new HealthBar(map.MapCells[i,j].Ship.MaxHealth, CellToScreen(new Point(i,j)))); break; case "Healer": ShipsInfo[map.MapCells[i, j].Ship.Id] = new ShipAttributes("Healer", map.MapCells[i, j].Ship.Color, new Point(i, j), 0, new HealthBar(map.MapCells[i, j].Ship.MaxHealth, CellToScreen(new Point(i, j)))); break; case "Infestor": ShipsInfo[map.MapCells[i, j].Ship.Id] = new ShipAttributes("Infestor", map.MapCells[i, j].Ship.Color, new Point(i, j), 0, new HealthBar(map.MapCells[i, j].Ship.MaxHealth, CellToScreen(new Point(i, j)))); break; } } //ShipsInfo[map.MapCells[i, j].Ship.Id] = new ShipAttributes("Ship", // map.MapCells[i, j].Ship.Color, new Point(i, j), 0); } }
/// <summary> /// Creates a new MapView Animator. /// </summary> public MapViewAnimator(IMapView mapView) { _mapView = mapView; _defaultTimeSpan = new TimeSpan(0, 0, 1); }
void IToolBarView.SetBuddyView(IMapView mapView) { _mapView = mapView; _toolbarControl.SetBuddyControl(mapView.MapControl); }