private void CreateLayout() { // Create a label for showing the load status for the public service var label1ViewFrame = new CoreGraphics.CGRect(10, 30, View.Bounds.Width-10, 20); _publicLayerLabel = new UILabel(label1ViewFrame); _publicLayerLabel.TextColor = UIColor.Gray; _publicLayerLabel.Font = _publicLayerLabel.Font.WithSize(12); _publicLayerLabel.Text = PublicLayerName; // Create a label to show the load status of the secured layer var label2ViewFrame = new CoreGraphics.CGRect(10, 55, View.Bounds.Width-10, 20); _secureLayerLabel = new UILabel(label2ViewFrame); _secureLayerLabel.TextColor = UIColor.Gray; _secureLayerLabel.Font = _secureLayerLabel.Font.WithSize(12); _secureLayerLabel.Text = SecureLayerName; // Setup the visual frame for the MapView var mapViewRect = new CoreGraphics.CGRect(0, 80, View.Bounds.Width, View.Bounds.Height - 80); // Create a map view with a basemap _myMapView = new MapView(); _myMapView.Frame = mapViewRect; // Add the map view and button to the page View.AddSubviews(_publicLayerLabel, _secureLayerLabel, _myMapView); }
public BoundedImage(MapView map, Uri imageUri, BasicGeoposition northWest, BasicGeoposition southEast) { _map = map; _northWest = northWest; _southEast = southEast; _img = new Image(); _img.Stretch = Stretch.Fill; _img.Source = new BitmapImage(imageUri); this.Children.Add(_img); _map.ViewChanged += (center, zoom, heading) => { UpdatePosition(); }; _map.SizeChanged += (s, a) => { this.Width = _map.ActualWidth; this.Height = _map.ActualHeight; UpdatePosition(); }; UpdatePosition(); }
// On tap, either get related records for the tapped well or find nearby wells if no well was tapped private async void mapView1_Tap(object sender, MapViewInputEventArgs e) { // Show busy UI BusyVisibility = Visibility.Visible; // Get the map if (m_mapView == null) m_mapView = (MapView)sender; // Create graphic and add to tap points var g = new Graphic() { Geometry = e.Location }; TapPoints.Add(g); // Buffer graphic by 100 meters, create graphic with buffer, add to buffers var buffer = GeometryEngine.Buffer(g.Geometry, 100); Buffers.Add(new Graphic() { Geometry = buffer }); // Find intersecting parcels and show them on the map var result = await doQuery(buffer); if (result != null && result.FeatureSet != null && result.FeatureSet.Features.Count > 0) { // Instead of adding parcels one-by-one, update the Parcels collection all at once to // allow the map to render the new features in one rendering pass. Parcels = new ObservableCollection<Graphic>(Parcels.Union(result.FeatureSet.Features)); } // Hide busy UI BusyVisibility = Visibility.Collapsed; }
protected override void OnClick() { activeMapView = ProSDKSampleModule.ActiveMapView; Camera activeCamera = activeMapView.Camera; if (activeMapView.Is2D) { // in 2D we are changing the scale double scaleStep = activeCamera.Scale / _zoomSteps; activeCamera.Scale = activeCamera.Scale - scaleStep; } else { // in 3D we are changing the Z-value and the pitch (for drama) double heightZStep = activeCamera.EyeXYZ.Z / _zoomSteps; double pitchStep = 90.0 / _zoomSteps; activeCamera.Pitch = activeCamera.Pitch - pitchStep; activeCamera.EyeXYZ.Z = activeCamera.EyeXYZ.Z - heightZStep; } // the heading changes the same in 2D and 3D activeCamera.Heading = HollywoodZoomUtils.StepHeading(activeCamera.Heading, 30); // assign the changed camera back to the view activeMapView.Camera = activeCamera; }
/// <summary> /// Initializes a new instance of the MainViewModel class. /// </summary> public MainViewModel() { if (IsInDesignMode) { // Code runs in Blend --> create design time data. } else { // Code runs "for real" ConfigService config = new ConfigService(); this.myModel = config.LoadJSON(); Messenger.Default.Register<Esri.ArcGISRuntime.Controls.MapView>(this, (mapView) => { this.mapView = mapView; this.mapView.MaxScale = 500; ArcGISLocalTiledLayer localTiledLayer = new ArcGISLocalTiledLayer(this.TilePackage); localTiledLayer.ID = "SF Basemap"; localTiledLayer.InitializeAsync(); this.mapView.Map.Layers.Add(localTiledLayer); this.CreateLocalServiceAndDynamicLayer(); this.CreateFeatureLayers(); }); } }
public SimplifierHandler(MapView mapView, Looper looper, IList<Point> points, IList<GeoPoint> data , int epsilon ) { this.mapView = mapView; _points = points; _data = data; _epsilon = epsilon; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Register license MapView.RegisterLicense(LICENSE, ApplicationContext); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); MapView = (MapView)FindViewById(Resource.Id.mapView); // Add base map CartoOnlineVectorTileLayer baseLayer = new CartoOnlineVectorTileLayer(CartoBaseMapStyle.CartoBasemapStyleDefault); MapView.Layers.Add(baseLayer); // Set projection Projection projection = MapView.Options.BaseProjection; // Set default position and zoom // Change projection of map so coordinates would fit on a mercator map MapPos berlin = MapView.Options.BaseProjection.FromWgs84(new MapPos(13.38933, 52.51704)); MapView.SetFocusPos(berlin, 0); MapView.SetZoom(10, 0); Marker marker = MapView.AddMarkerToPosition(berlin); // Add simple event listener that changes size and/or color on map click MapView.MapEventListener = new HelloMapEventListener(marker); }
/// <summary> /// /// </summary> /// <param name="mapView">Must not be null</param> /// <param name="tree"></param> public Tab(MapView mapView, PersistentTree tree) : base(mapView.Canvas) { Tree = tree; MapView = mapView; tree.DirtyChanged += Tree_DirtyChanged; }
protected override async void OnClick() { activeMapView = ProSDKSampleModule.ActiveMapView; Camera camera = await activeMapView.GetCameraAsync() ; bool is2D = false ; try { is2D = activeMapView.ViewMode == ViewMode.Map; } catch(System.ApplicationException) { return ; } if (is2D) { // in 2D we are changing the scale double scaleStep = camera.Scale / _zoomSteps; camera.Scale = camera.Scale + scaleStep; } else { // in 3D we are changing the Z-value and the pitch (for drama) double heightZStep = camera.Z / _zoomSteps; double pitchStep = 90.0 / _zoomSteps; camera.Pitch = camera.Pitch + pitchStep; camera.Z = camera.Z + heightZStep; } // the heading changes the same in 2D and 3D camera.Heading = HollywoodZoomUtils.StepHeading(camera.Heading, -30); // assign the changed camera back to the view activeMapView.ZoomToAsync(camera); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate (savedInstanceState); // Get a reference to the sensor manager sensor_manager = (SensorManager) GetSystemService (Context.SensorService); // Create our view var map_view = new MapView (this, "MapViewCompassDemo_DummyAPIKey"); rotate_view = new RotateView (this); rotate_view.AddView (map_view); SetContentView (rotate_view); // Create the location overlay location_overlay = new MyLocationOverlay (this, map_view); location_overlay.RunOnFirstFix (delegate { map_view.Controller.AnimateTo (location_overlay.MyLocation); }); map_view.Overlays.Add (location_overlay); map_view.Controller.SetZoom(18); map_view.Clickable = true; map_view.Enabled = true; }
internal void AttachToMapView(MapView mv) { if (m_mapView != null && m_mapView != mv) throw new InvalidOperationException("RestoreAutoPanMode can only be assigned to one mapview"); m_mapView = mv; m_mapView.PropertyChanged += m_mapView_PropertyChanged; }
// Perform identify when the map is tapped private async void mapView1_Tap(object sender, MapViewInputEventArgs e) { if (m_mapView == null) m_mapView = (MapView)sender; // Clear any previously displayed results clearResults(); // Get the point that was tapped and show it on the map GraphicsLayer identifyPointLayer = m_mapView.Map.Layers["IdentifyPointLayer"] as GraphicsLayer; identifyPointLayer.Graphics.Add(new Graphic() { Geometry = e.Location }); // Show activity progress.Visibility = Visibility.Visible; // Perform the identify operation List<DataItem> results = await doIdentifyAsync(e.Location); // Hide the activity indicator progress.Visibility = Visibility.Collapsed; // Show the results ResultsListPicker.ItemsSource = results; if (results.Count > 0) { ResultsListPicker.Visibility = Visibility.Visible; ShowAttributesButton.Visibility = Visibility.Visible; } }
public override void ViewDidLoad() { base.ViewDidLoad (); _MapView = new MapView(new RectangleF(0, 0, View.Frame.Width, View.Frame.Height)); _MapView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; View.AddSubview(_MapView); var home = new Place() { Name = "Home", Description = "Boring Home Town", Latitude = 32.725410, Longitude = -97.320840, }; var office = new Place() { Name = "Austin", Description = "Super Awesome Town", Latitude = 30.26710, Longitude = -97.744546, }; _MapView.ShowRouteFrom(office, home); }
// Invoked when the application is launched normally by the end user. protected override void OnLaunched(LaunchActivatedEventArgs e) { // Register CARTO license bool registered = MapView.RegisterLicense(License); if (registered) { Carto.Utils.Log.ShowDebug = true; } MapView = new MapView(); // Add base map // TODO: Crashes here for some reason CartoOnlineVectorTileLayer baseLayer = new CartoOnlineVectorTileLayer(CartoBaseMapStyle.CartoBasemapStyleDark); MapView.Layers.Add(baseLayer); // Set default location and zoom Projection projection = MapView.Options.BaseProjection; MapPos tallinn = projection.FromWgs84(new MapPos(24.646469, 59.426939)); MapView.AddMarkerToPosition(tallinn); MapView.SetFocusPos(tallinn, 0); MapView.SetZoom(3, 0); Window.Current.Content = MapView; Window.Current.Activate(); }
public async Task GetSearchCount_CountFeatures_NineFeatureFound() { // instantiate the locator so that our view model is created locator = new ViewModelLocator(); // get the MainViewModel MainViewModel mainViewModel = locator.MainViewModel; // create a MapView MapView mapView = new MapView(); // send the MapView to the MainViewModel Messenger.Default.Send<MapView>(mapView); // UNCOMMENT THE FOLLOWING LINES //// Arrange //// search string //mainViewModel.SearchText = "Lancaster"; //// run the search async //var task = mainViewModel.SearchRelayCommand.ExecuteAsync(4326); //task.Wait(); // wait //// Assert //Assert.IsNotNull(mainViewModel, "Null mainViewModel"); //Assert.IsNotNull(mainViewModel.GridDataResults, "Null GridDataResults"); //Assert.AreEqual(9, mainViewModel.GridDataResults.Count); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); /* * For Information on how to add you own keystore to the project read the README from the * old GoogleMaps sample: https://github.com/xamarin/monodroid-samples/tree/master/GoogleMaps * * */ // Remember to generate your own API key mapView = new MapView(this, "0Nd7w_yOI1NbUsBP_Mg2IosWa0Ns2j22r4meJnA"); mapView.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.FillParent); SetContentView(mapView); mapView.SetBuiltInZoomControls(true); mapView.Enabled = true; mapView.Clickable = true; //This has to be set to true to be able to navigate the map myLocationOverlay = new MyLocationOverlay(this, mapView); //this shows your current position on the map mapView.Overlays.Add(myLocationOverlay); Drawable marker = Resources.GetDrawable(Resource.Drawable.Icon); //these are the markers put on the map myItemizedOverlay = new MyItemizedOverlay(this, marker); mapView.Overlays.Add(myItemizedOverlay); myItemizedOverlay.AddItem(new GeoPoint((int)(55.816149 * 1E6),(int)(12.532868 * 1E6)), "BKSV", "Brüel & Kjær Sound & Vision"); mapView.PostInvalidate(); }
/// <summary> </summary> /// <param name="mapControl"></param> public MyVectorCanvas(MapView mapView) : base(mapView) { var myPolygon = new MapPolygon() { Points = new PointCollection{ new Point(20,40), new Point(20, 50), new Point(30,50), new Point(30,40) } }; myPolygon.Fill = new SolidColorBrush(Colors.Blue); myPolygon.Stroke = new SolidColorBrush(Colors.Black); myPolygon.InvariantStrokeThickness = 3; Children.Add(myPolygon); //// http://msdn.microsoft.com/en-us/library/system.windows.media.animation.coloranimation.aspx SolidColorBrush myAnimatedBrush = new SolidColorBrush(); myAnimatedBrush.Color = Colors.Blue; myPolygon.Fill = myAnimatedBrush; MapView.RegisterName("MyAnimatedBrush", myAnimatedBrush); ColorAnimation mouseEnterColorAnimation = new ColorAnimation(); mouseEnterColorAnimation.From = Colors.Blue; mouseEnterColorAnimation.To = Colors.Red; mouseEnterColorAnimation.Duration = TimeSpan.FromMilliseconds(250); mouseEnterColorAnimation.AutoReverse = true; Storyboard.SetTargetName(mouseEnterColorAnimation, "MyAnimatedBrush"); Storyboard.SetTargetProperty(mouseEnterColorAnimation, new PropertyPath(SolidColorBrush.ColorProperty)); Storyboard mouseEnterStoryboard = new Storyboard(); mouseEnterStoryboard.Children.Add(mouseEnterColorAnimation); myPolygon.MouseEnter += delegate(object msender, MouseEventArgs args) { mouseEnterStoryboard.Begin(MapView); }; }
protected override void OnCreate (Bundle bundle) { base.OnCreate (bundle); SetContentView (Resource.Layout.MapFragmentLayout); mapView = FindViewById<MapView> (Resource.Id.fragmentMapView); myLocation = new MyLocationOverlay (this, mapView); myLocation.RunOnFirstFix (() => { //mapView.Controller.AnimateTo (myLocation.MyLocation); var maxLat = Math.Max (myLocation.MyLocation.LatitudeE6, assignment.Latitude.ToIntE6 ()); var minLat = Math.Min (myLocation.MyLocation.LatitudeE6, assignment.Latitude.ToIntE6 ()); var maxLong = Math.Max (myLocation.MyLocation.LongitudeE6, assignment.Longitude.ToIntE6 ()); var minLong = Math.Min (myLocation.MyLocation.LongitudeE6, assignment.Longitude.ToIntE6 ()); mapView.Controller.ZoomToSpan (Math.Abs (maxLat - minLat), Math.Abs (maxLong - minLong)); mapView.Controller.AnimateTo (new GeoPoint ((maxLat + minLat) / 2, (maxLong + minLong) / 2)); }); mapView.Overlays.Add (myLocation); mapView.Controller.SetZoom (5); mapView.Clickable = true; mapView.Enabled = true; mapView.SetBuiltInZoomControls (true); }
/// <summary> /// Initializes a new instance of the CoordinateDisplayViewModel class. /// </summary> public CoordinateDisplayViewModel() { Messenger.Default.Register<Esri.ArcGISRuntime.Controls.MapView>(this, (mapView) => { this.mapView = mapView; this.mapView.MouseMove += mapView_MouseMove; }); }
/// <inheritdoc/> protected override void Initialize() { base.Initialize(); IsActive = true; this.mapView = MapView; Setup(); }
public MapWalkState() : base(GameStates.MapWalk) { _playerView = GameManager.Instance.PlayerView; _mapView = GameManager.Instance.MapView; _enemyController = GameObject.Find("EnemyController").GetComponent<EnemyController>(); }
public override void ViewDidLoad() { base.ViewDidLoad(); // Create a variable to hold the yOffset where the MapView control should start var yOffset = 60; // Create a new MapView control and provide its location coordinates on the frame MapView myMapView = new MapView(); myMapView.Frame = new CoreGraphics.CGRect(0, yOffset, View.Bounds.Width, View.Bounds.Height - yOffset); // Create a new Map instance with the basemap var myBasemap = Basemap.CreateStreets(); Map myMap = new Map(myBasemap); // Assign the Map to the MapView myMapView.Map = myMap; // Create a label to display the MapView rotation value UILabel rotationLabel = new UILabel(); rotationLabel.Frame = new CoreGraphics.CGRect(View.Bounds.Width - 60, 8, View.Bounds.Width, 24); rotationLabel.Text = string.Format("{0:0}°", myMapView.MapRotation); // Create a slider to control the MapView rotation UISlider rotationSlider = new UISlider() { MinValue = 0, MaxValue = 360, Value = (float)myMapView.MapRotation }; rotationSlider.Frame = new CoreGraphics.CGRect(10, 8, View.Bounds.Width - 100, 24); rotationSlider.ValueChanged += (Object s, EventArgs e) => { myMapView.SetViewpointRotationAsync(rotationSlider.Value); rotationLabel.Text = string.Format("{0:0}°", rotationSlider.Value); }; // Create a UIBarButtonItem where its view is the rotation slider UIBarButtonItem barButtonSlider = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace); barButtonSlider.CustomView = rotationSlider; // Create a UIBarButtonItem where its view is the rotation label UIBarButtonItem barButtonLabel = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace); barButtonLabel.CustomView = rotationLabel; // Create a toolbar on the bottom of the display UIToolbar toolbar = new UIToolbar(); toolbar.Frame = new CoreGraphics.CGRect(0, View.Bounds.Height - 40, View.Bounds.Width, View.Bounds.Height); toolbar.AutosizesSubviews = true; // Add the bar button items to an array of UIBarButtonItems UIBarButtonItem[] barButtonItems = new UIBarButtonItem[] { barButtonSlider, barButtonLabel }; // Add the UIBarButtonItems array to the toolbar toolbar.SetItems(barButtonItems, true); View.AddSubviews(myMapView, toolbar); }
public void SetActiveMap(IMapView view, Point center, int zoomLevel) { _mapView = view; if (_mapView != null) { _map = (MapView) _mapView.GetMapObject(); SetupMap(_map, center, zoomLevel); } }
public ContextMenuAttacher(ContextMenuStrip cm, MapView mapView) { MapView = mapView; ContextMenu = cm; MapView.Canvas.NodeRightClick += Canvas_NodeRightClick; MapView.Canvas.KeyDown += Canvas_KeyDown; MapView.NodeTextEditor.ContextMenu = ContextMenu; }
public CoordinateReadoutController(MapView mapView, MapViewModel mapViewModel) { _mapView = mapView; _mapViewModel = mapViewModel; _mapView.MouseMove += mapView_MouseMove; Mediator.Register(Constants.ACTION_COORDINATE_READOUT_FORMAT_CHANGED, OnCoordinateReadoutFormatChanged); }
/// <inheritdoc/> public override void UpdateShape(MapView mapView, UpdateMode mode, bool lazyUpdate) { ClipShape(mapView, mode, lazyUpdate); if (NeedsUpdate(lazyUpdate, mode)) base.UpdateShape(mapView, mode, lazyUpdate); this.StrokeThickness = mapView.CurrentScale; }
public void OnTap(GeoPoint p0, MapView p1) { int lastTouchedIndex = _overlay.LastFocusedIndex; if (lastTouchedIndex > -1) { var tapped = (OverlayItem)_overlay.GetItem(lastTouchedIndex); _annotationView.ShowAnnotationView(tapped); } }
public MapControl(DataControl dc, MapView mv) { dataControl = dc; mapView = mv; mapView.getInfoButton().IsEnabled = false; mapView.sightPinTapped += MapView_sightPinTapped; mapView.userPosChanged += MapView_userPosChanged; mapView.flyout.sightsListViewItemTapped += flyout_sightsListViewItemTapped; createSights(); }
public override void Draw(Canvas canvas, MapView mapView, bool shadow) { var beginDrawEventArgs = new OverlayDrawEventArgs(); OnBeginDraw(beginDrawEventArgs); if (beginDrawEventArgs.Cancel) return; var drawContext = new DrawContext(mapView.Context.Assets, mapView); ZoomLevelSet.Draw(FeatureSource, FeatureSource.GetBoundingBox(), canvas, drawContext, shadow); }
public SelectInteractor(MapView map, ObservableCollection<FrameworkElement> shapes) : base(map) { this.map = map; this.shapes = shapes; map.MouseLeftButtonUp += new MouseButtonEventHandler(map_MouseLeftButtonUp); map.MouseLeftButtonDown += new MouseButtonEventHandler(map_MouseLeftButtonDown); map.MouseMove += new MouseEventHandler(map_MouseMove); Canvas.SetZIndex(this, 999999999); SelectedElements.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(SelectedElements_CollectionChanged); }
private void CreateLayout() { // Create horizontal layouts for the buttons at the top LinearLayout buttonLayoutOne = new LinearLayout(this) { Orientation = Orientation.Horizontal }; LinearLayout buttonLayoutTwo = new LinearLayout(this) { Orientation = Orientation.Horizontal }; // Parameters for all of the buttons. Used to set buttons height and width. LinearLayout.LayoutParams param = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent, 1.0f ); // Button to sketch a selected geometry type on the map view Button sketchButton = new Button(this) { Text = "Sketch", LayoutParameters = param }; sketchButton.Click += OnSketchClicked; // Button to edit an existing graphic's geometry _editButton = new Button(this) { Text = "Edit", LayoutParameters = param }; _editButton.Click += OnEditClicked; _editButton.Enabled = false; // Buttons to Undo/Redo sketch and edit operations _undoButton = new Button(this) { Text = "Undo", LayoutParameters = param }; _undoButton.Click += OnUndoClicked; _undoButton.Enabled = false; _redoButton = new Button(this) { Text = "Redo", LayoutParameters = param }; _redoButton.Click += OnRedoClicked; _redoButton.Enabled = false; // Button to complete the sketch or edit _doneButton = new Button(this) { Text = "Done", LayoutParameters = param }; _doneButton.Click += OnCompleteClicked; _doneButton.Enabled = false; // Button to clear all graphics and sketches _clearButton = new Button(this) { Text = "Clear", LayoutParameters = param }; _clearButton.Click += OnClearClicked; _clearButton.Enabled = false; // Add all sketch controls (buttons) to the button bars buttonLayoutOne.AddView(sketchButton); buttonLayoutOne.AddView(_editButton); buttonLayoutOne.AddView(_clearButton); // Second button bar buttonLayoutTwo.AddView(_undoButton); buttonLayoutTwo.AddView(_redoButton); buttonLayoutTwo.AddView(_doneButton); // Create a new vertical layout for the app (buttons followed by map view) LinearLayout mainLayout = new LinearLayout(this) { Orientation = Orientation.Vertical }; // Add the button layouts mainLayout.AddView(buttonLayoutOne); mainLayout.AddView(buttonLayoutTwo); // Add the map view to the layout _myMapView = new MapView(this); mainLayout.AddView(_myMapView); // Show the layout in the app SetContentView(mainLayout); }
private void MapView_GeoViewTapped(object sender, Esri.ArcGISRuntime.UI.Controls.GeoViewInputEventArgs e) { _mainViewModel.Destination = MapView.ScreenToLocation(e.Position); }
public override void Draw(Canvas p0, MapView p1, bool p2) { }
/// <summary> /// Renders the map using current settings and editing stuff. /// </summary> public void RenderTo(Graphics g, bool ToImage = false) { PointF nwCorner, neCorner, seCorner, swCorner, center; bool DrawTextured = EditorSettings.Default.Edit_PreviewMode; bool DrawExtents3D = EditorSettings.Default.Draw_Extents_3D; bool DrawText = EditorSettings.Default.Draw_AllText; // optimizations g.CompositingQuality = CompositingQuality.HighSpeed; g.PixelOffsetMode = PixelOffsetMode.HighSpeed; g.InterpolationMode = InterpolationMode.Low; g.SmoothingMode = SmoothingMode.HighSpeed; proDefault = (!mapView.copyAreaMode && !mapView.pasteAreaMode && !mapView.wallBucket && !mapView.tileBucket && !mapView.picking && mapView.mapPanel.Cursor != Cursors.SizeAll && Form.ActiveForm == MainWindow.Instance); proHand = (!mapView.picking && !MapInterface.KeyHelper.ShiftKey && MapInterface.SelectedObjects.Items.Count > 1 && !mapView.contextMenuOpen); // expand clip rectangle a bit const int sqSize2 = squareSize * 2; Rectangle clip = new Rectangle((int)g.ClipBounds.X - sqSize2, (int)g.ClipBounds.Y - sqSize2, (int)g.ClipBounds.Width + sqSize2, (int)g.ClipBounds.Height + sqSize2); if (ToImage) { clip = new Rectangle(0, 0, 5880, 5880); updCanvasObjects = true; updCanvasTiles = true; } if (updCanvasObjects) { objectRenderer.UpdateCanvas(clip); updCanvasObjects = false; } if (teleCtrl) { objectRenderer.UpdateTele(); teleCtrl = false; } if (updCanvasTiles) { floorRenderer.UpdateCanvas(clip); if (mapView.pasteAreaMode) { floorRenderer.UpdateCanvasWithFakeTiles(clip); } updCanvasTiles = false; } // Paint it black Size size = mapView.mapPanel.Size; g.Clear(ColorLayout.Background); Point mouseLocation = mapView.mouseLocation; Pen pen; // Draw tiles and edges if (MapInterface.CurrentMode == EditMode.FLOOR_PLACE || EditorSettings.Default.Draw_FloorTiles || MapInterface.CurrentMode == EditMode.EDGE_PLACE) { floorRenderer.Render(g); } // Draw grid if (EditorSettings.Default.Draw_Grid) { using (pen = new Pen(Color.Gray, 1F)) { //draw the grid sloppily (an extra screen's worth of lines along either axis) for (int x = -squareSize * (size.Width / squareSize) - 3 * squareSize / 2 % (2 * squareSize); x < 2 * size.Width; x += 2 * squareSize) { int y = -3 * squareSize / 2 % (2 * squareSize); g.DrawLine(pen, new Point(x - 1, y), new Point(y, x - 1)); g.DrawLine(pen, new Point(x, y), new Point(size.Width + x, size.Width + y)); } } } if (MapInterface.CurrentMode >= EditMode.FLOOR_PLACE && MapInterface.CurrentMode <= EditMode.EDGE_PLACE && !MainWindow.Instance.imgMode) { // Draw the overlay to show tile location Point pt = new Point(mouseLocation.X, mouseLocation.Y); PointF tilePt = MapView.GetNearestTilePoint(pt); int squareSize2 = squareSize; int bs = (int)MainWindow.Instance.mapView.TileMakeNewCtrl.BrushSize.Value; if ((MapInterface.CurrentMode == EditMode.FLOOR_BRUSH || MapInterface.CurrentMode == EditMode.FLOOR_PLACE) && !mapView.picking) { squareSize2 *= bs; if (bs > 1) { tilePt.X -= (float)(-0.5 + 0.5 * bs); tilePt.Y -= (float)(1.5 + 0.5 * bs); //tilePt.Y -= 1; tilePt.Y -= ((bs - 1) + ((bs % 2 == 0) ? 1 : 0)); tilePt.Y += 2; } } // Change overlay color depending on editor EditMode Color tileOverlayCol = Color.Yellow; if (MapInterface.CurrentMode == EditMode.EDGE_PLACE) { tileOverlayCol = MainWindow.Instance.mapView.EdgeMakeNewCtrl.chkAutoEdge.Checked ? Color.Green : Color.Aqua; } if (MapInterface.CurrentMode == EditMode.FLOOR_BRUSH) { tileOverlayCol = Color.LawnGreen; } if (mapView.picking) { tileOverlayCol = Color.GhostWhite; } if (mapView.tileBucket) { tileOverlayCol = Color.DeepSkyBlue; } tilePt.X *= squareSize; tilePt.Y *= squareSize; center = new PointF(tilePt.X + squareSize / 2f, tilePt.Y + (3 / 2f) * squareSize); nwCorner = new PointF(tilePt.X - squareSize2 / 2f, tilePt.Y + (3 / 2f) * squareSize2); neCorner = new PointF(nwCorner.X + squareSize2, nwCorner.Y - squareSize2); swCorner = new PointF(nwCorner.X + squareSize2, nwCorner.Y + squareSize2); seCorner = new PointF(neCorner.X + squareSize2, neCorner.Y + squareSize2); g.DrawPolygon(new Pen(tileOverlayCol, 2), new PointF[] { nwCorner, neCorner, seCorner, swCorner }); } // Draw [BELOW] objects objectRenderer.RenderBelow(g); // Draw walls Pen destructablePen = new Pen(ColorLayout.WallsBreakable, 2); Pen windowPen = new Pen(ColorLayout.WallsWindowed, 2); Pen secretPen = new Pen(ColorLayout.WallsSecret, 2); Pen invisiblePen = new Pen(Color.DarkGray, 2); Pen fakeWallPen = new Pen(Color.LightGray, 2); Pen openPen = new Pen(Color.FromArgb(255, 110, 170, 110), 2); Pen wallPen = new Pen(ColorLayout.Walls, 2); if (EditorSettings.Default.Draw_Walls) { Map.Wall removing = mapView.GetWallUnderCursor(); Point highlightUndoRedo = mapView.highlightUndoRedo; if (MapInterface.CurrentMode == EditMode.WALL_BRUSH && !mapView.picking) { removing = null; } // Render simple preview walls (Wall drawing modes) if (FakeWalls.Count > 0 && !EditorSettings.Default.Edit_PreviewMode) { foreach (Map.Wall wall in FakeWalls.Values) { pen = invisiblePen; DrawSimpleWall(g, wall, pen, false); } } foreach (Map.Wall wall in Map.Walls.Values) { Point pt = wall.Location; int x = pt.X * squareSize, y = pt.Y * squareSize; Point txtPoint = new Point(x, y); if (clip.Contains(x, y)) { // Textured walls if (DrawTextured && !wall.Material.Contains("Invisible")) { DrawTexturedWall(g, wall, false, removing == wall); continue; } if (MainWindow.Instance.imgMode) { break; } // Simple walls pen = wallPen; if (EditorSettings.Default.Draw_ColorWalls || (MapInterface.CurrentMode == EditMode.WALL_CHANGE)) { if (wall.Secret) { pen = wall.Secret_WallState == 4 ? openPen : secretPen; } else if (wall.Destructable)//if (wall.Destructable || MapInterface.GetLastWalls(wall)) { pen = destructablePen; } else if (wall.Window) { pen = windowPen; } else if (wall.Material.Contains("Invisible")) { pen = invisiblePen; } else { pen = wallPen; } } if (removing == wall) { if (mapView.picking) { pen = new Pen(Color.Aqua, 3); } else if (MapInterface.CurrentMode == EditMode.WALL_CHANGE) { pen = new Pen(Color.Purple, 3); } } DrawSimpleWall(g, wall, pen, DrawText); } } } if (!MainWindow.Instance.imgMode) { RenderPostLineWalls(g); RenderPostWalls(g); RenderPostObjects(g); RenderPostSelRect(g); } // Draw objects objectRenderer.RenderNormal(g); RenderHelpMark(g); // Draw polygons if (EditorSettings.Default.Draw_Polygons) { foreach (Map.Polygon poly in Map.Polygons) { pen = Pens.PaleGreen; // Highlight the polygon being edited if (MapInterface.CurrentMode == EditMode.POLYGON_RESHAPE) { if (mapView.PolygonEditDlg.SelectedPolygon == poly || mapView.PolygonEditDlg.SuperPolygon == poly) { pen = Pens.PaleVioletRed; foreach (PointF pt in poly.Points) { center = new PointF(pt.X - MapView.objectSelectionRadius, pt.Y - MapView.objectSelectionRadius); Pen pen2 = MapInterface.SelectedPolyPoint == pt ? Pens.DodgerBlue : Pens.DeepPink; g.DrawEllipse(pen2, new RectangleF(center, new Size(2 * MapView.objectSelectionRadius, 2 * MapView.objectSelectionRadius))); } } } if (poly.Points.Count > 2) { poly.Points.Add(poly.Points[0]); if (MainWindow.Instance.mapView.PolygonEditDlg.ambientColors.Checked) { int alphaa = ((poly.AmbientLightColor.R + poly.AmbientLightColor.R + poly.AmbientLightColor.B + poly.AmbientLightColor.B + poly.AmbientLightColor.G + poly.AmbientLightColor.G) / 6); FillMode newFillMode = FillMode.Alternate; Color newColor = Color.FromArgb(Math.Abs(255 - alphaa), poly.AmbientLightColor); SolidBrush blueBrush = new SolidBrush(newColor); g.DrawPolygon(pen, poly.Points.ToArray()); g.FillPolygon(blueBrush, poly.Points.ToArray(), newFillMode); } if (mapView.PolygonEditDlg.SuperPolygon == poly && MapInterface.CurrentMode == EditMode.POLYGON_RESHAPE) { pen = new Pen(Color.PaleVioletRed, 2); } g.DrawLines(pen, poly.Points.ToArray()); poly.Points.RemoveAt(poly.Points.Count - 1); } } } // Draw copied selection if (MainWindow.Instance.mapView.selectionPoly.Count > 2) { var pen1 = new Pen(Brushes.DeepSkyBlue, 4); pen1.DashStyle = DashStyle.Dash; g.DrawLines(pen1, MainWindow.Instance.mapView.selectionPoly.ToArray()); } // Draw waypoints if (EditorSettings.Default.Draw_Waypoints) { foreach (Map.Waypoint wp in Map.Waypoints) { // Highlight selected waypoint pen = wp.Flags == 1 ? ColorLayout.WaypointNorm : ColorLayout.WaypointDis; pen = ((MapInterface.SelectedWaypoint == wp) || (MapInterface.SelectedWaypoints.Contains(wp))) ? ColorLayout.WaypointSel : pen; // Draw waypoint and related pathes center = new PointF(wp.Point.X - MapView.objectSelectionRadius, wp.Point.Y - MapView.objectSelectionRadius); g.DrawEllipse(pen, new RectangleF(center, new Size(2 * MapView.objectSelectionRadius, 2 * MapView.objectSelectionRadius))); pen = ColorLayout.WaypointDis; // Draw paths (code/idea from UndeadZeus) foreach (Map.Waypoint.WaypointConnection wpc in wp.connections) { g.DrawLine(pen, wp.Point.X, wp.Point.Y, wpc.wp.Point.X, wpc.wp.Point.Y); foreach (Map.Waypoint.WaypointConnection wpwp in wpc.wp.connections)//Checks if the waypoint connection is connecting to wp { if (wpwp.wp.Equals(wp)) { // Draw connections if ((MapInterface.SelectedWaypoint != null) && (wp == MapInterface.SelectedWaypoint)) { g.DrawLine(ColorLayout.WaypointSel, wp.Point.X, wp.Point.Y, wpc.wp.Point.X, wpc.wp.Point.Y); } else { g.DrawLine(ColorLayout.WaypointTwoPath, wp.Point.X, wp.Point.Y, wpc.wp.Point.X, wpc.wp.Point.Y); } break; } } } // Draw text if (DrawText && clip.Contains(center.ToPoint())) { if (wp.Name.Length > 0) { g.DrawString(wp.Number + ":" + wp.ShortName, drawFont, Brushes.YellowGreen, center); } else { g.DrawString(wp.Number.ToString(), drawFont, Brushes.MediumPurple, center); } } } } }
private void InitializeComponent() { this.mapView = new ThinkGeo.UI.WinForms.MapView(); this.panel1 = new System.Windows.Forms.Panel(); this.lengthResult = new System.Windows.Forms.TextBox(); this.label3 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label(); this.panel1.SuspendLayout(); this.SuspendLayout(); // // mapView // this.mapView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.mapView.BackColor = System.Drawing.Color.White; this.mapView.CurrentScale = 0D; this.mapView.Location = new System.Drawing.Point(0, 0); this.mapView.MapResizeMode = ThinkGeo.Core.MapResizeMode.PreserveScale; this.mapView.MaximumScale = 1.7976931348623157E+308D; this.mapView.MinimumScale = 200D; this.mapView.Name = "mapView"; this.mapView.RestrictExtent = null; this.mapView.RotatedAngle = 0F; this.mapView.Size = new System.Drawing.Size(819, 663); this.mapView.TabIndex = 0; this.mapView.MapClick += new System.EventHandler <ThinkGeo.Core.MapClickMapViewEventArgs>(this.mapView_MapClick); // // panel1 // this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Right))); this.panel1.BackColor = System.Drawing.Color.Gray; this.panel1.Controls.Add(this.lengthResult); this.panel1.Controls.Add(this.label3); this.panel1.Controls.Add(this.label2); this.panel1.Controls.Add(this.label1); this.panel1.Location = new System.Drawing.Point(819, 0); this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(314, 660); this.panel1.TabIndex = 1; // // lengthResult // this.lengthResult.Location = new System.Drawing.Point(77, 109); this.lengthResult.Name = "lengthResult"; this.lengthResult.Size = new System.Drawing.Size(206, 22); this.lengthResult.TabIndex = 3; // // label3 // this.label3.AutoSize = true; this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label3.ForeColor = System.Drawing.Color.White; this.label3.Location = new System.Drawing.Point(6, 109); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(65, 20); this.label3.TabIndex = 2; this.label3.Text = "Length:"; // // label2 // this.label2.AutoSize = true; this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label2.ForeColor = System.Drawing.Color.White; this.label2.Location = new System.Drawing.Point(4, 56); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(264, 40); this.label2.TabIndex = 1; this.label2.Text = "Click on a feature to get it\'s length\r\ndisplayed in the TextBox below."; // // label1 // this.label1.AutoSize = true; this.label1.BackColor = System.Drawing.Color.Gray; this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label1.ForeColor = System.Drawing.Color.White; this.label1.Location = new System.Drawing.Point(4, 21); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(239, 25); this.label1.TabIndex = 0; this.label1.Text = "Caculate Length Controls:"; // // CalculateLengthSample // this.Controls.Add(this.panel1); this.Controls.Add(this.mapView); this.Name = "CalculateLengthSample"; this.Size = new System.Drawing.Size(1133, 663); this.Load += new System.EventHandler(this.Form_Load); this.panel1.ResumeLayout(false); this.panel1.PerformLayout(); this.ResumeLayout(false); }
public RenderListener(Activity context, MapView map) { this.context = context; this.map = map; }
void GetMarkersAndPoints() { System.Threading.ThreadPool.QueueUserWorkItem(delegate { ShowLoadingView(PortableLibrary.Constants.MSG_LOADING_ALL_MARKERS); mEventMarker = GetAllMarkers(eventID); var trackPoints = GetTrackPoints(eventID); HideLoadingView(); InvokeOnMainThread(() => { var boundPoints = new List <CLLocationCoordinate2D>(); if (mEventMarker != null && mEventMarker.markers.Count > 0) { for (int i = 0; i < mEventMarker.markers.Count; i++) { var point = mEventMarker.markers[i]; var imgPin = GetPinIconByType(point.type); var pointLocation = new CLLocationCoordinate2D(point.lat, point.lng); boundPoints.Add(pointLocation); AddMapPin(pointLocation, imgPin, i); } } if (trackPoints != null && trackPoints.Count > 0) { if (trackPoints[0].Count > 0) { var startPoint = trackPoints[0][0]; var endPoint = trackPoints[trackPoints.Count - 1][trackPoints[trackPoints.Count - 1].Count - 1]; var startLocation = new CLLocationCoordinate2D(startPoint.Latitude, startPoint.Longitude); var endLocation = new CLLocationCoordinate2D(endPoint.Latitude, endPoint.Longitude); AddMapPin(startLocation, GetPinIconByType("pSTART"), -1); AddMapPin(endLocation, GetPinIconByType("pFINISH"), -1); } for (int i = 0; i < trackPoints.Count; i++) { var tPoints = trackPoints[i]; var path = new MutablePath(); var polyline = new Polyline(); for (int j = 0; j < tPoints.Count; j++) { var tPoint = tPoints[j]; var tLocation = new CLLocationCoordinate2D(tPoint.Latitude, tPoint.Longitude); if (j < tPoints.Count - 1) { var distance = DistanceAtoB(tPoint, tPoints[j + 1]); if (PortableLibrary.Constants.AVAILABLE_DISTANCE_MAP > distance) { var nPoint = tPoints[j + 1]; path.AddCoordinate(tLocation); } else { polyline.Path = path; polyline.StrokeColor = GetRandomColor(i); polyline.StrokeWidth = 5; polyline.Geodesic = true; polyline.Map = mMapView; path = new MutablePath(); polyline = new Polyline(); } } polyline.Path = path; polyline.StrokeColor = GetRandomColor(i); polyline.StrokeWidth = 5; polyline.Geodesic = true; polyline.Map = mMapView; boundPoints.Add(tLocation); } } } if (boundPoints.Count == 0) { var camera = CameraPosition.FromCamera(PortableLibrary.Constants.LOCATION_ISURAEL[0], PortableLibrary.Constants.LOCATION_ISURAEL[1], zoom: PortableLibrary.Constants.MAP_ZOOM_LEVEL); mMapView = MapView.FromCamera(RectangleF.Empty, camera); } else { var mapBounds = new CoordinateBounds(); foreach (var bound in boundPoints) { mapBounds = mapBounds.Including(bound); } mMapView.MoveCamera(CameraUpdate.FitBounds(mapBounds, 50.0f)); } }); }); }
private void CreateLayout() { // View for the input/output wkid labels. LinearLayout wkidLabelsStackView = new LinearLayout(this) { Orientation = Orientation.Horizontal }; wkidLabelsStackView.SetPadding(10, 10, 0, 10); // Create a label for the input spatial reference. _inWkidLabel = new TextView(this) { Text = "In WKID = ", TextAlignment = TextAlignment.ViewStart }; // Create a label for the output spatial reference. _outWkidLabel = new TextView(this) { Text = "Out WKID = ", TextAlignment = TextAlignment.ViewStart }; // Create some horizontal space between the labels. Space space = new Space(this); space.SetMinimumWidth(30); // Add the Wkid labels to the stack view. wkidLabelsStackView.AddView(_inWkidLabel); wkidLabelsStackView.AddView(space); wkidLabelsStackView.AddView(_outWkidLabel); // Create the 'use extent' switch. _useExtentSwitch = new Switch(this) { Checked = false, Text = "Use extent" }; // Handle the checked change event for the switch. _useExtentSwitch.CheckedChange += UseExtentSwitch_CheckedChange; // Create a picker (Spinner) for datum transformations. _transformationsPicker = new Spinner(this); _transformationsPicker.SetPadding(5, 10, 0, 10); // Handle the selection event to work with the selected transformation. _transformationsPicker.ItemSelected += TransformationsPicker_ItemSelected; // Create a text view to show messages. _messagesTextView = new TextView(this); // Create a new vertical layout for the app UI. LinearLayout mainLayout = new LinearLayout(this) { Orientation = Orientation.Vertical }; // Create a layout for the app tools. LinearLayout toolsLayout = new LinearLayout(this) { Orientation = Orientation.Vertical }; toolsLayout.SetPadding(10, 0, 0, 0); toolsLayout.SetMinimumHeight(320); // Add the transformation UI controls to the tools layout. toolsLayout.AddView(wkidLabelsStackView); toolsLayout.AddView(_useExtentSwitch); toolsLayout.AddView(_transformationsPicker); toolsLayout.AddView(_messagesTextView); // Add the tools layout and map view to the main layout. mainLayout.AddView(toolsLayout); _myMapView = new MapView(this); mainLayout.AddView(_myMapView); // Show the layout in the app. SetContentView(mainLayout); }
void Awake() { cardLevelSheets = new Dictionary <CardView, CardLevelSheet>(); basicMatchUIViewObj = (GameObject)Instantiate(BasicMatchUIViewPrefab); basicMatchUIView = (BasicMatchUIView)(basicMatchUIViewObj.GetComponent("BasicMatchUIView")); basicMatchUIView.transform.SetParent(Canvas.transform, false); map = new Map(); units = new Dictionary <UnitView, Unit>(); resultsText = (UnityEngine.UI.Text)ResultsText.GetComponent("Text"); resultsImage = (UnityEngine.UI.Image)ResultsImage.GetComponent("Image"); tilemap = (tk2dTileMap)Tilemap.GetComponent("tk2dTileMap"); mapView = (MapView)Tilemap.GetComponent("MapView"); mapView.TileViewEnter = TileOnMouseEnter; mapView.TileViewExit = TileOnMouseExit; mapView.TileViewOver = TileOnMouseOver; mapView.Initialize(); GameManager.Instance.CurrentMatchOpponentPlayerId = "ERROR_NO_PLAYER"; // player1 = new Unit("Kaiju1", // "Set1.1", // "Kaiju", // "Lizard", // "This is the level one lizard Kaiju.", // "This is the level two lizard Kaiju.", // "This is the level three lizard Kaiju.", // new Point(Player1StartX, Player1StartY)); // Vector3 player1Location = mapView.GetTileViewAt(player1.Location).GetPosition(); // UnitView player1UnitView = (UnitView)((GameObject)Instantiate (Player1Prefab)).GetComponent("UnitView"); // player1UnitView.MouseEnter = UnitViewEnter; // player1UnitView.MouseExit = UnitViewExit; // player1UnitView.MouseOver = UnitViewOver; // player1UnitView.SetPosition(player1Location); // player1UnitView.SetColor(Color.white); // unitViews[player1] = player1UnitView; // units[player1UnitView] = player1; // currentPlayer = player1; // code for UnityEngine.UI // Vector3 player1LocationNew = GetScreenPosition(Player1StartX, Player1StartY); // TODO: make Vector2D // player1UnitView.SetPosition(player1LocationNew); // player1UnitView.transform.SetParent(Canvas.transform, false); // player2 = new Unit("Mecha1", // "Set1.2", // "Mecha", // "Gundam", // "This is the level one Gundam Mecha.", // "This is the level two Gundam Mecha.", // "This is the level three Gundam Mecha.", // new Point(Player2StartX, Player2StartY)); // Vector3 player2Location = mapView.GetTileViewAt(player2.Location).GetPosition(); // UnitView player2UnitView = (UnitView)((GameObject)Instantiate (Player2Prefab)).GetComponent("UnitView"); // player2UnitView.MouseEnter = UnitViewEnter; // player2UnitView.MouseExit = UnitViewExit; // player2UnitView.MouseOver = UnitViewOver; // player2UnitView.SetPosition(player2Location); // player2UnitView.SetColor(Color.white); // unitViews[player2] = player2UnitView; // units[player2UnitView] = player2; // code for UnityEngine.UI // player2UnitView.transform.SetParent(Canvas.transform, false); if (GameManager.Instance.CurrentPlayerId == "thomas") { basicMatchUIView.SetSprite(Resources.Load <Sprite> ("thomas_selfie")); } else { basicMatchUIView.SetSprite(Resources.Load <Sprite> ("spongebob_selfie")); } basicMatchUIView.SetPlayerNameText(GameManager.Instance.CurrentPlayerId); basicMatchUIView.SetTimeText("Time: 90"); basicMatchUIView.SetManaText("0/10"); basicMatchUIView.SetManaMeter(0); Action <bool, TurnBasedMatch, string> cb = (success, match, errors) => { if (success) { string matchId = match.MatchId; Debug.Log("GridManager:Start() starting match: " + matchId); GameManager.Instance.CurrentMatchId = matchId; string status = match.Status; Debug.Log("GridManager:Start() status: " + status); GameManager.Instance.CurrentMatchStatus = status; string pendingParticipantId = match.PendingParticipantId; Debug.Log("GridManager:Awake() pendingParticipantId: " + pendingParticipantId); GameManager.Instance.CurrentPendingParticipantId = pendingParticipantId; foreach (TurnBasedMatchParticipant p in match.Participants) { string participantId = p.Player.ParticipantId; Debug.Log("GridManager:Start() participantId: " + participantId); if (participantId == GameManager.Instance.CurrentPlayerId) { GameManager.Instance.CurrentMatchPlayerId = p.Id; } else { // TODO: refactor for more than 2 players GameManager.Instance.CurrentMatchOpponentPlayerId = p.Player.ParticipantId; } } isPlayerTurn = (GameManager.Instance.CurrentMatchPlayerId == GameManager.Instance.CurrentPendingParticipantId); if (isPlayerTurn) { Debug.Log("GridManager:Awake() it's my turn!"); } else { Debug.Log("GridManager:Awake() it's the other player's turn!"); } GameManager.Instance.Hand = match.Data.Data.GetCardPile("hand"); GameManager.Instance.DrawPile = match.Data.Data.GetCardPile("draw_pile"); GameManager.Instance.DiscardPile = match.Data.Data.GetCardPile("discard_pile"); GameManager.Instance.Units = match.Data.Data.GetUnits("units"); // todo: update displayed units based on GameManager.Instance.Units data // create new UnitViews for any newly added Units // update the position of previously existing Units // index Units locally by MatchId cards = new List <CardView>(); cards.Clear(); List <Vector2> cardLocations = new List <Vector2>(); int y = -260; cardLocations.Add(new Vector2(-250, y)); cardLocations.Add(new Vector2(-140, y)); cardLocations.Add(new Vector2(0, y)); cardLocations.Add(new Vector2(120, y)); cardLocations.Add(new Vector2(250, y)); for (int i = 0; i < 5; i++) { GameObject cardGameObject = (GameObject)Instantiate(CardPrefab); CardLevelSheet card1 = new CardLevelSheet(GameManager.Instance.Hand.Get(i)); CardView cardView = (CardView)(cardGameObject.GetComponent("CardView")); cardView.Id = card1.ID; cardView.transform.SetParent(Canvas.transform, false); cardView.BeginDragDel = CardBeginDrag; cardView.EndDragDel = CardEndDrag; cardView.DragDel = CardDrag; cardView.PointerClickDel = CardPointerClick; cardView.PointerEnterDel = CardPointerEnter; cardView.PointerExitDel = CardPointerExit; cardView.SetCost(card1.Cost); cardView.SetLevel(card1.Level); cardView.SetType(card1.Type); cardView.SetSubtype(card1.Subtype); cardView.SetName(card1.Name); cardView.SetText(card1.Text); cardView.SetImage(Resources.Load <Sprite> (card1.Art)); cardView.SetRarity(card1.Rarity); cardView.SetFaction(card1.Faction); RectTransform cardRT = (RectTransform)cardGameObject.GetComponent("RectTransform"); cardRT.anchoredPosition = cardLocations[i]; cards.Add(cardView); cardLevelSheets[cardView] = card1; } } else { Debug.Log("WARN!!! match info null"); } }; StartCoroutine(Platform.Instance.GetMatchInfo(GameManager.Instance.CurrentMatchId, cb)); StartCoroutine(CheckMatchStatusLoop()); }
/// <summary> /// Get a web map from the selected portal item and display it in the app. /// </summary> private async void AddMapItem_Click(object sender, RoutedEventArgs e) { if (this.MapItemListBox.SelectedItem == null) { return; } // Clear status messages MessagesTextBlock.Text = string.Empty; var sb = new StringBuilder(); try { // Clear the current MapView control from the app MyMapGrid.Children.Clear(); // See if we're using the public or secured portal; get the appropriate object reference ArcGISPortal portal = null; if (_usingPublicPortal) { portal = _publicPortal; } else { portal = _iwaSecuredPortal; } // Throw an exception if the portal is null if (portal == null) { throw new Exception("Portal has not been instantiated."); } // Get the portal item ID from the selected listbox item (read it from the Tag property) var itemId = (this.MapItemListBox.SelectedItem as ListBoxItem).Tag.ToString(); // Use the item ID to create an ArcGISPortalItem from the appropriate portal var portalItem = await ArcGISPortalItem.CreateAsync(portal, itemId); // Create a WebMap from the portal item (all items in the list represent web maps) var webMap = await WebMap.FromPortalItemAsync(portalItem); if (webMap != null) { // Create a WebMapViewModel using the WebMap var myWebMapViewModel = await WebMapViewModel.LoadAsync(webMap, portal); // Create a new MapView control to display the WebMapViewModel's Map; add it to the app var mv = new MapView { Map = myWebMapViewModel.Map }; MyMapGrid.Children.Add(mv); } // Report success sb.AppendLine("Successfully loaded web map from item #" + itemId + " from " + portal.Uri.Host); } catch (Exception ex) { // Add an error message sb.AppendLine("Error accessing web map: " + ex.Message); } finally { // Show messages MessagesTextBlock.Text = sb.ToString(); } }
public static void LoadMap(MapView mapView) { LoadMap(TAMU_CENTER_POINT.X, TAMU_CENTER_POINT.Y, mapView); }
public void SetView(ViewBasic viewBasic) { mapView = viewBasic as MapView; }
public static void AnimateZoomTo(this MapView map, MapPos position) { position = map.Options.BaseProjection.FromWgs84(new MapPos(24.650415, 59.428773)); map.SetFocusPos(position, 2); map.Zoom = 14; }
/// <summary> /// MapView setter /// </summary> internal void SetMapView(MapView mapView) { MapView = mapView; }
public abstract void Handle(Window owner, MapView map, MenuItemMessage message);
private void InitializeComponent() { this.mapView = new ThinkGeo.UI.WinForms.MapView(); this.panel1 = new System.Windows.Forms.Panel(); this.SizedBasedPointStyle = new System.Windows.Forms.Button(); this.label2 = new System.Windows.Forms.Label(); this.TimeBasedPointStyle = new System.Windows.Forms.Button(); this.label1 = new System.Windows.Forms.Label(); this.panel1.SuspendLayout(); this.SuspendLayout(); // // mapView // this.mapView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.mapView.BackColor = System.Drawing.Color.White; this.mapView.CurrentScale = 0D; this.mapView.ForeColor = System.Drawing.Color.Black; this.mapView.Location = new System.Drawing.Point(0, 0); this.mapView.MapFocusMode = ThinkGeo.Core.MapFocusMode.Default; this.mapView.MapResizeMode = ThinkGeo.Core.MapResizeMode.PreserveScale; this.mapView.MaximumScale = 1.7976931348623157E+308D; this.mapView.MinimumScale = 200D; this.mapView.Name = "mapView"; this.mapView.RestrictExtent = null; this.mapView.RotatedAngle = 0F; this.mapView.Size = new System.Drawing.Size(1296, 599); this.mapView.TabIndex = 0; // // panel1 // this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Right))); this.panel1.BackColor = System.Drawing.Color.Gray; this.panel1.Controls.Add(this.SizedBasedPointStyle); this.panel1.Controls.Add(this.label2); this.panel1.Controls.Add(this.TimeBasedPointStyle); this.panel1.Controls.Add(this.label1); this.panel1.Location = new System.Drawing.Point(993, 0); this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(303, 599); this.panel1.TabIndex = 1; // // SizedBasedPointStyle // this.SizedBasedPointStyle.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F); this.SizedBasedPointStyle.Location = new System.Drawing.Point(18, 143); this.SizedBasedPointStyle.Name = "SizedBasedPointStyle"; this.SizedBasedPointStyle.Size = new System.Drawing.Size(267, 32); this.SizedBasedPointStyle.TabIndex = 3; this.SizedBasedPointStyle.Text = "Apply Style"; this.SizedBasedPointStyle.UseVisualStyleBackColor = true; this.SizedBasedPointStyle.Click += new System.EventHandler(this.SizedBasedPointStyle_Click); // // label2 // this.label2.AutoSize = true; this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F); this.label2.ForeColor = System.Drawing.Color.White; this.label2.Location = new System.Drawing.Point(14, 109); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(220, 20); this.label2.TabIndex = 2; this.label2.Text = "Capitol Population Point Style:"; // // TimeBasedPointStyle // this.TimeBasedPointStyle.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F); this.TimeBasedPointStyle.Location = new System.Drawing.Point(18, 56); this.TimeBasedPointStyle.Name = "TimeBasedPointStyle"; this.TimeBasedPointStyle.Size = new System.Drawing.Size(267, 32); this.TimeBasedPointStyle.TabIndex = 1; this.TimeBasedPointStyle.Text = "Apply Style"; this.TimeBasedPointStyle.UseVisualStyleBackColor = true; this.TimeBasedPointStyle.Click += new System.EventHandler(this.TimeBasedPointStyle_Click); // // label1 // this.label1.AutoSize = true; this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F); this.label1.ForeColor = System.Drawing.Color.White; this.label1.Location = new System.Drawing.Point(14, 23); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(149, 20); this.label1.TabIndex = 0; this.label1.Text = "Daylight Point Style:"; // // ExtendingStylesSample // this.Controls.Add(this.panel1); this.Controls.Add(this.mapView); this.Name = "ExtendingStylesSample"; this.Size = new System.Drawing.Size(1296, 599); this.Load += new System.EventHandler(this.Form_Load); this.panel1.ResumeLayout(false); this.panel1.PerformLayout(); this.ResumeLayout(false); }
public void DidSelectAnnotation(MapView mapView, IAnnotation annotation) { // Just show the user which one was pressed new UIAlertView("Annotation Tapped", "You tapped on: " + annotation.GetTitle(), null, "OK") .Show(); }
public void WaypointOverlay() { if (PN == null || TCA == null || !TCA.Available || !GUIWindowBase.HUD_enabled) { return; } if (SelectingTarget) { var coords = MapView.MapIsEnabled? Coordinates.GetAtPointer(vessel.mainBody) : Coordinates.GetAtPointerInFlight(); if (coords != null) { var t = new WayPoint(coords); Markers.DrawCBMarker(vessel.mainBody, coords, new Color(1.0f, 0.56f, 0.0f), WayPointMarker); DrawLabelAtPointer(coords.FullDescription(vessel), t.DistanceTo(vessel)); if (!clicked) { if (Input.GetMouseButtonDown(0)) { clicked = true; } else if (Input.GetMouseButtonDown(1)) { clicked_time = DateTime.Now; clicked = true; } } else { if (Input.GetMouseButtonUp(0)) { t.Update(VSL); t.Movable = true; if (select_single) { t.Name = "Target"; SelectingTarget = false; select_single = false; VSL.SetTarget(null, t); if (!was_in_map_view) { MapView.ExitMapView(); } } else { t.Name = "Waypoint " + (CFG.Path.Count + 1); AddTargetDamper.Run(() => CFG.Path.Enqueue(t)); } CFG.ShowPath = true; clicked = false; } if (Input.GetMouseButtonUp(1)) { SelectingTarget &= (DateTime.Now - clicked_time).TotalSeconds >= GLB.ClickDuration; clicked = false; } } } } bool current_target_drawn = false; var camera = Markers.CurrentCamera; if (CFG.ShowPath) { var i = 0; var num = (float)(CFG.Path.Count - 1); WayPoint wp0 = null; var total_dist = 0f; var dist2cameraF = Mathf.Pow(Mathf.Max((camera.transform.position - VSL.vessel.transform.position).magnitude, 1), GLB.CameraFadeinPower); foreach (var wp in CFG.Path) { current_target_drawn |= wp.Equals(CFG.Target); wp.UpdateCoordinates(vessel.mainBody); var dist = -1f; if (wp0 != null && wp != selected_waypoint) { total_dist += (float)wp.DistanceTo(wp0, VSL.Body) / dist2cameraF; dist = total_dist; } var r = Markers.DefaultIconSize; var c = marker_color(i, num, dist); if (wp0 == null) { DrawPath(vessel, wp, c); } else { DrawPath(vessel.mainBody, wp0, wp, c); } if (wp == edited_waypoint) { c = edited_color; r = Markers.DefaultIconSize * 2; } else if (wp.Land) { r = Markers.DefaultIconSize * 2; } if (DrawWayPoint(wp, c, size:r)) { DrawLabelAtPointer(wp.FullInfo(vessel), wp.DistanceTo(vessel)); select_waypoint(wp); } else if (wp == selected_waypoint) { DrawLabelAtPointer(wp.FullInfo(vessel), wp.DistanceTo(vessel)); } wp0 = wp; i++; } } //current target and anchor if (CFG.Anchor != null) { DrawWayPoint(CFG.Anchor, Color.cyan, "Anchor"); current_target_drawn |= CFG.Anchor.Equals(CFG.Target); } if (CFG.Target && !current_target_drawn && (!CFG.Target.IsVessel || CFG.Target.GetVessel().LandedOrSplashed)) { DrawWayPoint(CFG.Target, Color.magenta, "Target"); } //custom markers VSL.Info.CustomMarkersWP.ForEach(m => DrawWayPoint(m, Color.red, m.Name)); VSL.Info.CustomMarkersVec.ForEach(m => Markers.DrawWorldMarker(m, Color.red, "Custom WayPoint", WayPointMarker)); //modify the selected waypoint if (!SelectingTarget && selected_waypoint != null) { if (changing_altitude) { var dist2camera = (selected_waypoint.GetTransform().position - camera.transform.position).magnitude; var dy = (Input.mousePosition.y - last_mouse_y) / Screen.height * dist2camera * Math.Tan(camera.fieldOfView * Mathf.Deg2Rad) * 2; last_mouse_y = Input.mousePosition.y; selected_waypoint.Pos.Alt += dy; selected_waypoint.Update(VSL); } else { var coords = MapView.MapIsEnabled? Coordinates.GetAtPointer(vessel.mainBody) : Coordinates.GetAtPointerInFlight(); if (coords != null) { selected_waypoint.Pos = coords; selected_waypoint.Update(VSL); } } if (Input.GetMouseButtonUp(0) || (changing_altitude && Input.GetMouseButtonUp(2))) { if (changing_altitude) { selected_waypoint.Pos.Alt = Math.Max(selected_waypoint.Pos.Alt, selected_waypoint.Pos.SurfaceAlt(vessel.mainBody)); } selected_waypoint = null; orig_coordinates = null; changing_altitude = false; } else if (Input.GetMouseButtonDown(1)) { selected_waypoint.Pos = orig_coordinates; selected_waypoint.Update(VSL); selected_waypoint = null; orig_coordinates = null; changing_altitude = false; } } #if DEBUG // VSL.Engines.All.ForEach(e => e.engine.thrustTransforms.ForEach(t => DrawWorldMarker(t.position, Color.red, e.name))); // DrawWorldMarker(VSL.vessel.transform.position, Color.yellow, "Vessel"); // DrawWorldMarker(VSL.Physics.wCoM, Color.green, "CoM"); #endif }
private void CreateLayout() { // Create a new MapView control and add it to the main view. _myMapView = new MapView(); View.AddSubviews(_myMapView); }
public override void LoadView() { // Create the views. View = new UIView { BackgroundColor = UIColor.White }; _generateButton = new UIBarButtonItem(); _generateButton.Title = "Generate"; _generateButton.Enabled = false; _syncButton = new UIBarButtonItem(); _syncButton.Title = "Synchronize"; _syncButton.Enabled = false; UIToolbar toolbar = new UIToolbar(); toolbar.TranslatesAutoresizingMaskIntoConstraints = false; toolbar.Items = new[] { _generateButton, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), _syncButton }; _helpLabel = new UILabel { Text = "1. Tap 'Generate'.", AdjustsFontSizeToFitWidth = true, TextAlignment = UITextAlignment.Center, BackgroundColor = UIColor.FromWhiteAlpha(0, .6f), TextColor = UIColor.White, Lines = 1, TranslatesAutoresizingMaskIntoConstraints = false }; _myMapView = new MapView(); _myMapView.TranslatesAutoresizingMaskIntoConstraints = false; _progressBar = new UIProgressView(); _progressBar.TranslatesAutoresizingMaskIntoConstraints = false; _progressBar.Hidden = true; // Add the views. View.AddSubviews(_myMapView, _helpLabel, _progressBar, toolbar); // Lay out the views. NSLayoutConstraint.ActivateConstraints(new[] { _myMapView.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor), _myMapView.BottomAnchor.ConstraintEqualTo(toolbar.TopAnchor), _myMapView.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), _myMapView.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), _helpLabel.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor), _helpLabel.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), _helpLabel.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), _helpLabel.HeightAnchor.ConstraintEqualTo(40), toolbar.BottomAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.BottomAnchor), toolbar.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), toolbar.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), _progressBar.TopAnchor.ConstraintEqualTo(_helpLabel.BottomAnchor), _progressBar.LeadingAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.LeadingAnchor), _progressBar.TrailingAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TrailingAnchor), _progressBar.HeightAnchor.ConstraintEqualTo(8) }); }
protected virtual void RemoveAnnotationFor(object item) { var annotation = _annotations[item]; MapView.RemoveAnnotation(annotation); _annotations.Remove(item); }
public override void LoadView() { // Create the views. View = new UIView { BackgroundColor = ApplicationTheme.BackgroundColor }; _myMapView = new MapView(); _myMapView.TranslatesAutoresizingMaskIntoConstraints = false; _takeMapOfflineButton = new UIBarButtonItem(); _takeMapOfflineButton.Title = "Generate offline map"; UIToolbar toolbar = new UIToolbar(); toolbar.TranslatesAutoresizingMaskIntoConstraints = false; toolbar.Items = new[] { new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), _takeMapOfflineButton }; _statusLabel = new UILabel { Text = "Use the button to take the map offline.", AdjustsFontSizeToFitWidth = true, TextAlignment = UITextAlignment.Center, BackgroundColor = UIColor.FromWhiteAlpha(0, .6f), TextColor = UIColor.White, Lines = 1, TranslatesAutoresizingMaskIntoConstraints = false }; _loadingIndicator = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.WhiteLarge); _loadingIndicator.TranslatesAutoresizingMaskIntoConstraints = false; _loadingIndicator.BackgroundColor = UIColor.FromWhiteAlpha(0, .6f); // Add the views. View.AddSubviews(_myMapView, toolbar, _loadingIndicator, _statusLabel); // Lay out the views. NSLayoutConstraint.ActivateConstraints(new[] { _myMapView.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor), _myMapView.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), _myMapView.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), _myMapView.BottomAnchor.ConstraintEqualTo(toolbar.TopAnchor), toolbar.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), toolbar.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), toolbar.BottomAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.BottomAnchor), _statusLabel.TopAnchor.ConstraintEqualTo(_myMapView.TopAnchor), _statusLabel.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), _statusLabel.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), _statusLabel.HeightAnchor.ConstraintEqualTo(40), _loadingIndicator.TopAnchor.ConstraintEqualTo(_statusLabel.BottomAnchor), _loadingIndicator.BottomAnchor.ConstraintEqualTo(View.BottomAnchor), _loadingIndicator.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), _loadingIndicator.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor) }); }
protected virtual void AddAnnotationFor(object item) { var annotation = CreateAnnotation(item); _annotations[item] = annotation; MapView.AddAnnotation(annotation); }
private async void AddMapItemClick(object sender, RoutedEventArgs e) { // Get a web map from the selected portal item and display it in the map view. if (MapItemListBox.SelectedItem == null) { MessageBox.Show("No web map item is selected."); return; } // Clear status messages. MessagesTextBlock.Text = string.Empty; // Store status (or errors) when adding the map. var statusInfo = new StringBuilder(); try { // Clear the current MapView control from the app. MyMapGrid.Children.Clear(); // See if using the public or secured portal; get the appropriate object reference. ArcGISPortal portal = null; if (_usingPublicPortal) { portal = _publicPortal; } else { portal = _iwaSecuredPortal; } // Throw an exception if the portal is null. if (portal == null) { throw new Exception("Portal has not been instantiated."); } // Get the portal item ID from the selected list box item (read it from the Tag property). var itemId = (this.MapItemListBox.SelectedItem as ListBoxItem).Tag.ToString(); // Use the item ID to create a PortalItem from the portal. var portalItem = await PortalItem.CreateAsync(portal, itemId); if (portalItem != null) { // Create a Map using the web map (portal item). Map webMap = new Map(portalItem); // Create a new MapView control to display the Map. MapView myMapView = new MapView { Map = webMap }; // Add the MapView to the UI. MyMapGrid.Children.Add(myMapView); } // Report success. statusInfo.AppendLine("Successfully loaded web map from item #" + itemId + " from " + portal.Uri.Host); } catch (Exception ex) { // Add an error message. statusInfo.AppendLine("Error accessing web map: " + ex.Message); } finally { // Show messages. MessagesTextBlock.Text = statusInfo.ToString(); } }
public override void LoadView() { // Create the views. View = new UIView { BackgroundColor = UIColor.White }; _myMapView = new MapView(); _myMapView.TranslatesAutoresizingMaskIntoConstraints = false; UILabel decimalDegreesLabel = new UILabel(); decimalDegreesLabel.TranslatesAutoresizingMaskIntoConstraints = false; decimalDegreesLabel.Text = "Decimal degrees:"; UILabel dmsLabel = new UILabel(); dmsLabel.TranslatesAutoresizingMaskIntoConstraints = false; dmsLabel.Text = "Degrees, minutes, seconds:"; UILabel utmLabel = new UILabel(); utmLabel.TranslatesAutoresizingMaskIntoConstraints = false; utmLabel.Text = "UTM:"; UILabel usngLabel = new UILabel(); usngLabel.TranslatesAutoresizingMaskIntoConstraints = false; usngLabel.Text = "USNG:"; _ddEntry = new UITextField(); _dmsEntry = new UITextField(); _utmEntry = new UITextField(); _usngEntry = new UITextField(); // Uniformly configure the entries. foreach (UITextField tf in new[] { _ddEntry, _dmsEntry, _utmEntry, _usngEntry }) { tf.TranslatesAutoresizingMaskIntoConstraints = false; tf.BorderStyle = UITextBorderStyle.RoundedRect; } UIStackView formView = new UIStackView(new UIView[] { decimalDegreesLabel, _ddEntry, dmsLabel, _dmsEntry, utmLabel, _utmEntry, usngLabel, _usngEntry }); formView.TranslatesAutoresizingMaskIntoConstraints = false; formView.Axis = UILayoutConstraintAxis.Vertical; formView.Spacing = 4; formView.LayoutMarginsRelativeArrangement = true; formView.LayoutMargins = new UIEdgeInsets(8, 8, 8, 8); formView.SetContentHuggingPriority((float)UILayoutPriority.DefaultHigh, UILayoutConstraintAxis.Vertical); // Add the views. View.AddSubviews(formView, _myMapView); // Lay out the views. _portraitConstraints = new[] { formView.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor), formView.TrailingAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TrailingAnchor), formView.LeadingAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.LeadingAnchor), formView.BottomAnchor.ConstraintEqualTo(_myMapView.TopAnchor), _myMapView.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), _myMapView.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), _myMapView.BottomAnchor.ConstraintEqualTo(View.BottomAnchor) }; _landscapeConstraints = new[] { formView.LeadingAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.LeadingAnchor), formView.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor), formView.TrailingAnchor.ConstraintEqualTo(_myMapView.LeadingAnchor), formView.WidthAnchor.ConstraintGreaterThanOrEqualTo(280), _myMapView.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor), _myMapView.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), _myMapView.BottomAnchor.ConstraintEqualTo(View.BottomAnchor) }; ApplyConstraints(); }
private void InitializeComponent() { this.mapView = new ThinkGeo.UI.WinForms.MapView(); this.panel1 = new System.Windows.Forms.Panel(); this.shapeConvexHull = new System.Windows.Forms.Button(); this.label1 = new System.Windows.Forms.Label(); this.panel1.SuspendLayout(); this.SuspendLayout(); // // mapView // this.mapView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.mapView.BackColor = System.Drawing.Color.White; this.mapView.CurrentScale = 0D; this.mapView.Location = new System.Drawing.Point(0, 0); this.mapView.MapResizeMode = ThinkGeo.Core.MapResizeMode.PreserveScale; this.mapView.MaximumScale = 1.7976931348623157E+308D; this.mapView.MinimumScale = 200D; this.mapView.Name = "mapView"; this.mapView.RestrictExtent = null; this.mapView.RotatedAngle = 0F; this.mapView.Size = new System.Drawing.Size(941, 636); this.mapView.TabIndex = 0; // // panel1 // this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Right))); this.panel1.BackColor = System.Drawing.Color.Gray; this.panel1.Controls.Add(this.shapeConvexHull); this.panel1.Controls.Add(this.label1); this.panel1.Location = new System.Drawing.Point(944, 0); this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(300, 636); this.panel1.TabIndex = 1; // // shapeConvexHull // this.shapeConvexHull.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.shapeConvexHull.Location = new System.Drawing.Point(3, 54); this.shapeConvexHull.Name = "shapeConvexHull"; this.shapeConvexHull.Size = new System.Drawing.Size(294, 30); this.shapeConvexHull.TabIndex = 1; this.shapeConvexHull.Text = "Get Convex Hull"; this.shapeConvexHull.UseVisualStyleBackColor = true; this.shapeConvexHull.Click += new System.EventHandler(this.shapeConvexHull_Click); // // label1 // this.label1.AutoSize = true; this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label1.ForeColor = System.Drawing.Color.White; this.label1.Location = new System.Drawing.Point(3, 16); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(202, 25); this.label1.TabIndex = 0; this.label1.Text = "Convex Hull Controls:"; // // GetConvexHullSample // this.Controls.Add(this.panel1); this.Controls.Add(this.mapView); this.Name = "GetConvexHullSample"; this.Size = new System.Drawing.Size(1244, 636); this.Load += new System.EventHandler(this.Form_Load); this.panel1.ResumeLayout(false); this.panel1.PerformLayout(); this.ResumeLayout(false); }
private void CreateLayout() { // Vertical stack layout. LinearLayout layout = new LinearLayout(this) { Orientation = Orientation.Vertical }; // Search bar. _mySearchBox = new AutoCompleteTextView(this) { Text = "Coffee" }; layout.AddView(_mySearchBox); // Location search bar. _myLocationBox = new AutoCompleteTextView(this) { Text = "Current Location" }; layout.AddView(_myLocationBox); // Disable multi-line searches. _mySearchBox.SetMaxLines(1); _myLocationBox.SetMaxLines(1); // Search buttons; horizontal layout. LinearLayout.LayoutParams param = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent, 1.0f ); LinearLayout searchButtonLayout = new LinearLayout(this) { Orientation = Orientation.Horizontal }; _mySearchButton = new Button(this) { Text = "Search All", LayoutParameters = param }; _mySearchRestrictedButton = new Button(this) { Text = "Search View", LayoutParameters = param }; // Add the buttons to the layout. searchButtonLayout.AddView(_mySearchButton); searchButtonLayout.AddView(_mySearchRestrictedButton); // Progress bar. _myProgressBar = new ProgressBar(this) { Indeterminate = true, Visibility = Android.Views.ViewStates.Gone }; layout.AddView(_myProgressBar); // Add the layout to the view. layout.AddView(searchButtonLayout); // Add the mapview to the view. _myMapView = new MapView(this); layout.AddView(_myMapView); // Show the layout in the app. SetContentView(layout); // Disable the buttons and search bar until the geocoder is ready. _mySearchBox.Enabled = false; _myLocationBox.Enabled = false; _mySearchButton.Enabled = false; _mySearchRestrictedButton.Enabled = false; // Hook up the UI event handlers for suggestion & search. _mySearchBox.TextChanged += _mySearchBox_TextChanged; _myLocationBox.TextChanged += _myLocationBox_TextChanged; _mySearchButton.Click += _mySearchButton_Click; _mySearchRestrictedButton.Click += _mySearchRestrictedButton_Click; }
private void InitializeComponent() { this.mapView = new ThinkGeo.UI.WinForms.MapView(); this.panel1 = new System.Windows.Forms.Panel(); this.reprojectAndDisplayMultipleFeatures = new System.Windows.Forms.Button(); this.reprojectAndDisplayFeature = new System.Windows.Forms.Button(); this.label1 = new System.Windows.Forms.Label(); this.txtWkt = new System.Windows.Forms.TextBox(); this.panel1.SuspendLayout(); this.SuspendLayout(); // // mapView // this.mapView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.mapView.BackColor = System.Drawing.Color.White; this.mapView.CurrentScale = 0D; this.mapView.Location = new System.Drawing.Point(0, 0); this.mapView.MapResizeMode = ThinkGeo.Core.MapResizeMode.PreserveScale; this.mapView.MaximumScale = 1.7976931348623157E+308D; this.mapView.MinimumScale = 200D; this.mapView.Name = "mapView"; this.mapView.RestrictExtent = null; this.mapView.RotatedAngle = 0F; this.mapView.Size = new System.Drawing.Size(940, 587); this.mapView.TabIndex = 0; // // panel1 // this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Right))); this.panel1.BackColor = System.Drawing.Color.Gray; this.panel1.Controls.Add(this.txtWkt); this.panel1.Controls.Add(this.reprojectAndDisplayMultipleFeatures); this.panel1.Controls.Add(this.reprojectAndDisplayFeature); this.panel1.Controls.Add(this.label1); this.panel1.Location = new System.Drawing.Point(943, 0); this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(301, 587); this.panel1.TabIndex = 1; // // reprojectAndDisplayMultipleFeatures // this.reprojectAndDisplayMultipleFeatures.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.reprojectAndDisplayMultipleFeatures.ForeColor = System.Drawing.Color.Black; this.reprojectAndDisplayMultipleFeatures.Location = new System.Drawing.Point(3, 402); this.reprojectAndDisplayMultipleFeatures.Name = "reprojectAndDisplayMultipleFeatures"; this.reprojectAndDisplayMultipleFeatures.Size = new System.Drawing.Size(295, 34); this.reprojectAndDisplayMultipleFeatures.TabIndex = 3; this.reprojectAndDisplayMultipleFeatures.Text = "Reproject And Display Multiple Features"; this.reprojectAndDisplayMultipleFeatures.UseVisualStyleBackColor = true; this.reprojectAndDisplayMultipleFeatures.Click += new System.EventHandler(this.reprojectAndDisplayMultipleFeatures_Click); // // reprojectAndDisplayFeature // this.reprojectAndDisplayFeature.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.reprojectAndDisplayFeature.ForeColor = System.Drawing.Color.Black; this.reprojectAndDisplayFeature.Location = new System.Drawing.Point(3, 72); this.reprojectAndDisplayFeature.Name = "reprojectAndDisplayFeature"; this.reprojectAndDisplayFeature.Size = new System.Drawing.Size(295, 32); this.reprojectAndDisplayFeature.TabIndex = 1; this.reprojectAndDisplayFeature.Text = "Reproject and Display a Feature"; this.reprojectAndDisplayFeature.UseVisualStyleBackColor = true; this.reprojectAndDisplayFeature.Click += new System.EventHandler(this.reprojectAndDisplayFeature_Click); // // label1 // this.label1.AutoSize = true; this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label1.ForeColor = System.Drawing.Color.White; this.label1.Location = new System.Drawing.Point(20, 19); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(219, 50); this.label1.TabIndex = 0; this.label1.Text = "Reproject Features and \r\nCoordinates"; // // txtWkt // this.txtWkt.Location = new System.Drawing.Point(3, 124); this.txtWkt.Multiline = true; this.txtWkt.Name = "txtWkt"; this.txtWkt.Size = new System.Drawing.Size(295, 262); this.txtWkt.TabIndex = 4; // // ProjectLatLonCoordinatesSample // this.Controls.Add(this.panel1); this.Controls.Add(this.mapView); this.Name = "ProjectLatLonCoordinatesSample"; this.Size = new System.Drawing.Size(1244, 587); this.Load += new System.EventHandler(this.Form_Load); this.panel1.ResumeLayout(false); this.panel1.PerformLayout(); this.ResumeLayout(false); }