public async Task <ActionResult <LocationMarker> > PostLocationMarker(LocationMarker locationMarker) { _context.LocationMarker.Add(locationMarker); await _context.SaveChangesAsync(); return(CreatedAtAction("GetLocationMarker", new { id = locationMarker.LocationMarkerID }, locationMarker)); }
public async Task <IActionResult> PutLocationMarker(int id, LocationMarker locationMarker) { if (id != locationMarker.LocationMarkerID) { return(BadRequest()); } _context.Entry(locationMarker).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LocationMarkerExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public bool IsWinner(LocationMarker playerMarker) { for (int i = 0; i < 2; i++) { var rowOffset = i * 3; if (Board[rowOffset] == playerMarker && Board[rowOffset + 1] == playerMarker && Board[rowOffset + 2] == playerMarker) { return(true); } if (Board[i] == playerMarker && Board[3 + i] == playerMarker && Board[6 + i] == playerMarker) { return(true); } } if (Board[0] == playerMarker && Board[4] == playerMarker && Board[8] == playerMarker) { return(true); } if (Board[6] == playerMarker && Board[4] == playerMarker && Board[2] == playerMarker) { return(true); } return(false); }
public async Task SendLocationMarker(LocationMarker locationMarker) { var userId = Context.User.FindFirst(ClaimTypes.NameIdentifier).Value; var adminUIGroupName = string.Concat(userId, ApplicationTypes.AdminUI); await Clients.Group(adminUIGroupName).SendAsync("NewLocationMarker", locationMarker); }
private void generateButton_Click(object sender, RoutedEventArgs e) { if (lastPath != null) { mainPanel.Children.Remove(lastPath); } Path path; if ((bool)overflowEdgesCheckBox.IsChecked) { path = LocationMarker.GenerateCoverage(coords.ToArray(), 50, double.Parse(overflowBox.Text), double.Parse(wobbleBox.Text)); } else { path = LocationMarker.GenerateCoverage(coords.ToArray(), 50, double.Parse(overflowBox.Text), 16, 12, double.Parse(wobbleBox.Text)); } path.Stroke = new SolidColorBrush(Colors.Indigo); path.StrokeThickness = 2; path.Fill = new SolidColorBrush(Colors.Gold); path.Opacity = 0.8; lastPath = path; mainPanel.Children.Add(path); }
public static TicTacToePlayer NewTicTacToePlayer(Player player, LocationMarker marker, int turnOrder) { return(new TicTacToePlayer { Id = player.Id, Marker = marker, TurnOrder = turnOrder }); }
public override void ViewDidLoad() { base.ViewDidLoad(); // Add default base layer AddOnlineBaseLayer(CartoBaseMapStyle.CartoBasemapStyleVoyager); manager = new LocationManager(); marker = new LocationMarker(MapView); }
public void OnUpdate(FrameTime p0) { if (!hasFinishedLoading) { return; } if (locationScene == null) { // If our locationScene object hasn't been setup yet, this is a good time to do it // We know that here, the AR components have been initiated. locationScene = new LocationScene(this, this, arSceneView); // Now lets create our location markers. // First, a layout LocationMarker layoutLocationMarker = new LocationMarker(-0.119677, 51.478494, getExampleView()); // An example "onRender" event, called every frame // Updates the layout with the markers distance layoutLocationMarker.RenderEvent = this; // Adding the marker locationScene.MLocationMarkers.Add(layoutLocationMarker); } Frame frame = arSceneView.ArFrame; if (frame == null) { return; } if (frame.Camera.TrackingState != TrackingState.Tracking) { return; } if (locationScene != null) { locationScene.ProcessFrame(frame); } if (loadingMessageSnackbar != null) { foreach (Plane plane in frame.GetUpdatedTrackables(Java.Lang.Class.FromType(typeof(Plane)))) { if (plane.TrackingState == TrackingState.Tracking) { HideLoadingMessage(); } } } return; }
private async Task SendLocationMarker() { var location = await GetLocation(); var locationMarker = new LocationMarker { DeviceId = _deviceInfoService.DeviceBadge.Id, Colour = _deviceInfoService.DeviceBadge.Colour, Latitude = location.Latitude, Longitude = location.Longitude }; await _connection.InvokeAsync("SendLocationMarker", locationMarker); }
public bool MarkLocation(int row, int column, LocationMarker playerMarker) { if (row > 2 || column > 2 || playerMarker == LocationMarker.Empty) { return(false); } if (Board[row, column] != LocationMarker.Empty) { return(false); } Board[row, column] = playerMarker; return(true); }
private void SetMarker(Context context, LocationMarker marker) { if (context == Context.StartLocation) { startLocationButton.Set(marker); startLocationMarker = marker; } else { destinationButton.Set(marker); destinationMarker = marker; } Navigate(); }
private void Populate() { string list = ""; foreach (KeyValuePair <string, StoryCondition> condition in GameManager.Inst.QuestManager.StoryConditions) { list = list + condition.Value.ID + " (" + condition.Value.IsActive + ") = " + condition.Value.GetValue().ToString() + "\n"; } ConditionsList.text = list; list = ""; foreach (string topic in GameManager.Inst.PlayerProgress.DiscoveredTopics) { list = list + topic + "\n"; } TopicList.text = list; int y = 0; GameObject [] markers = GameObject.FindGameObjectsWithTag("LocMarker"); //remove existing loc entries foreach (GameObject locEntry in LocEntries) { GameObject.Destroy(locEntry); } LocEntries.Clear(); foreach (GameObject o in markers) { LocationMarker marker = o.GetComponent <LocationMarker>(); GameObject entry = GameObject.Instantiate(Resources.Load("LocationEntry")) as GameObject; entry.transform.parent = LocEntryAnchor; entry.transform.localPosition = Vector3.zero - new Vector3(0, y, 0); entry.transform.localScale = new Vector3(1, 1, 1); LocEntries.Add(entry); LocEntry loc = entry.GetComponent <LocEntry>(); loc.LocName.text = marker.Name; loc.Location = marker.transform.position; y += 45; } }
private void MarkByCursor() { if (cursor == null) { return; } Rect cursorRect = RectTransformToScreenSpace(cursor); Vector3 position = NavigationCamera.GetPosition(cursorRect.position); LocationMarker marker = new LocationMarker("Custom Marker", position); if (OnMark != null) { OnMark(marker); } }
public static string GetPrintText(LocationMarker marker) { switch (marker) { case LocationMarker.Empty: return(" "); case LocationMarker.O: return("O"); case LocationMarker.X: return("X"); default: return(string.Empty); } }
public bool MarkLocation(int row, int column, LocationMarker playerMarker) { if (row > 2 || column > 2 || playerMarker == LocationMarker.Empty) { return(false); } var index = row * 3 + column; if (Board[index] != LocationMarker.Empty) { return(false); } Board[index] = playerMarker; return(true); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); AddOnlineBaseLayer(CartoBaseMapStyle.CartoBasemapStyleVoyager); marker = new LocationMarker(MapView); if (((int)Build.VERSION.SdkInt) >= Marshmallow) { // Ask runtime location permission RequestLocationPermission(); } else { // Initialize the location manager to get the current position InitializeLocationManager(); } }
public T SetLocationMarker <T>(GameObject locationGo, GameObject orientationGo) where T : LocationMarker { // create a GameObject and add the templated Marker component to it GameObject markerObject = new GameObject("[location marker]"); markerObject.transform.parent = this.gameObject.transform; T marker = markerObject.AddComponent <T>(); locationGo.transform.parent = markerObject.transform; locationGo.transform.localPosition = Vector3.zero; if (orientationGo != null) { marker.OrientationMarker = orientationGo.transform; } // setup the marker marker.Map = this; if (useLocation && Input.location.status == LocationServiceStatus.Running) { marker.CoordinatesWGS84 = new double[2] { Input.location.lastData.longitude, Input.location.lastData.latitude } } ; else #if UNITY_4_0 { markerObject.SetActive(false); } #else { markerObject.SetActiveRecursively(false); } #endif // set the location marker locationMarker = marker; // tell the map to update IsDirty = true; return(marker); }
public static string GetDisplayText(LocationMarker marker) { var type = marker.GetType(); var memberInfo = type.GetMember(marker.ToString()); if (memberInfo == null || memberInfo.Length < 1) { return(marker.ToString()); } var attributes = memberInfo[0].GetCustomAttributes(typeof(PrintTextAttribute), false); if (attributes == null || attributes.Length < 1) { return(marker.ToString()); } return(((PrintTextAttribute)attributes[0]).Text); }
void mapTile_LocationUpdating(object sender, EventArgs e) { var map = Control; var mapTile = (MapTile)Element; var toRemove = new List <MapLayer>(); foreach (var item in map.Layers) { if (item.Count > 0) { if (item[0].Content is LocationMarker) { toRemove.Add(item); } } } foreach (var item in toRemove) { map.Layers.Remove(item); } var locationMarker = new LocationMarker(AppMobileService.Locaion.CurrentLocation); ///locationMarker.Tap += locationMarker_Tap; MapOverlay myOverlay = new MapOverlay() { GeoCoordinate = locationMarker.GeoCoordinate, PositionOrigin = new System.Windows.Point(0.5, 1.0), Content = locationMarker }; MapLayer layerLocation = new MapLayer(); layerLocation.Add(myOverlay); map.Layers.Add(layerLocation); }
// Update is called once per frame void Update() { if (!bDoLog) { return; } timeSinceLastCapture += Time.deltaTime; if (timeSinceLastCapture < 1.0f / limitFPS) { return; } timeSinceLastCapture -= (1.0f / limitFPS); string activity = car.GetActivity(); if (writer != null) { if (UdacityStyle) { string image_filename = GetUdacityStyleImageFilename(); float steering = car.GetSteering() / car.GetMaxSteering(); writer.WriteLine(string.Format("{0},{1},{2},{3},{4},{5},{6},{7}", image_filename, "none", "none", steering.ToString(), car.GetThrottle().ToString(), "0", "0", lapCounter)); } else if (DonkeyStyle || SharkStyle) { } else if (DonkeyStyle2) { DonkeyRecord mjson = new DonkeyRecord(); float steering = car.GetSteering() / car.GetMaxSteering(); float throttle = car.GetThrottle(); int loc = LocationMarker.GetNearestLocMarker(carObj.transform.position); //training code like steering clamped between -1, 1 steering = Mathf.Clamp(steering, -1.0f, 1.0f); mjson.Init(string.Format("{0}_cam-image_array_.jpg", frameCounter), throttle, steering, "user", lapCounter, loc); string json = mjson.AsString(); string filename = string.Format("record_{0}.json", frameCounter); var f = File.CreateText(GetLogPath() + filename); f.Write(json); f.Close(); } else { writer.WriteLine(string.Format("{0},{1},{2},{3}", frameCounter.ToString(), activity, car.GetSteering().ToString(), car.GetThrottle().ToString())); } } if (lidar != null) { LidarPointArray pa = lidar.GetOutput(); if (pa != null) { string json = JsonUtility.ToJson(pa); var filename = string.Format("lidar_{0}_{1}.txt", frameCounter.ToString(), activity); var f = File.CreateText(GetLogPath() + filename); f.Write(json); f.Close(); } } if (optionlB_CamSensor != null) { SaveCamSensor(camSensor, activity, "_a"); SaveCamSensor(optionlB_CamSensor, activity, "_b"); } else { SaveCamSensor(camSensor, activity, ""); } if (maxFramesToLog != -1 && frameCounter >= maxFramesToLog) { Shutdown(); this.gameObject.SetActive(false); } frameCounter = frameCounter + 1; if (logDisplay != null) { logDisplay.text = "Log:" + frameCounter; } }
public void Set(LocationMarker marker) { string displayedText = (marker == null ? "" : marker.displayedName); SetDisplayedText(displayedText); }
private void SetMarkerByContext(LocationMarker locationMarker) { SetMarker(context, locationMarker); Open(); }
void mapTile_LocationUpdating(object sender, EventArgs e) { var map = Control; var mapTile = (MapTile)Element; var toRemove = new List<MapLayer>(); foreach (var item in map.Layers) { if (item.Count > 0) if (item[0].Content is LocationMarker) toRemove.Add(item); } foreach (var item in toRemove) { map.Layers.Remove(item); } var locationMarker = new LocationMarker(AppMobileService.Locaion.CurrentLocation); ///locationMarker.Tap += locationMarker_Tap; MapOverlay myOverlay = new MapOverlay() { GeoCoordinate = locationMarker.GeoCoordinate, PositionOrigin = new System.Windows.Point(0.5, 1.0), Content = locationMarker }; MapLayer layerLocation = new MapLayer(); layerLocation.Add(myOverlay); map.Layers.Add(layerLocation); }