public async Task CreateNewMeeting() { try { Microsoft.Graph.Event evt = new Microsoft.Graph.Event(); Location location = new Location(); location.DisplayName = tbLocation.Text; ItemBody body = new ItemBody(); body.Content = tbBody.Text; body.ContentType = BodyType.Html; List<Attendee> attendees = new List<Attendee>(); Attendee attendee = new Attendee(); EmailAddress email = new EmailAddress(); email.Address = tbToRecipients.Text; attendee.EmailAddress = email; attendee.Type = AttendeeType.Required; attendees.Add(attendee); evt.Subject = tbSubject.Text; evt.Body = body; evt.Location = location; evt.Attendees = attendees; DateTimeTimeZone dtStart = new DateTimeTimeZone(); dtStart.TimeZone = TimeZoneInfo.Local.Id; DateTime dts = dtpStartDate.Value.Date + dtpStartTime.Value.TimeOfDay; dtStart.DateTime = dts.ToString(); DateTimeTimeZone dtEnd = new DateTimeTimeZone(); dtEnd.TimeZone = TimeZoneInfo.Local.Id; DateTime dte = dtpEndDate.Value.Date + dtpEndTime.Value.TimeOfDay; dtEnd.DateTime = dte.ToString(); evt.Start = dtStart; evt.End = dtEnd; // log the request info sdklogger.Log(graphClient.Me.Events.Request().GetHttpRequestMessage().Headers.ToString()); sdklogger.Log(graphClient.Me.Events.Request().GetHttpRequestMessage().RequestUri.ToString()); // send the new message var createdEvent = await graphClient.Me.Events.Request().AddAsync(evt); // log the send and associated id sdklogger.Log("Meeting Sent : Id = " + createdEvent.Id); } catch (Exception ex) { sdklogger.Log("NewMeetingSend Failed: " + ex.Message); sdklogger.Log(ex.Message); } finally { // close the form Close(); } }
/// <summary> /// Initializes a new instance. /// </summary> public PixelException(Location location, string message, params object[] mesgArgs) : base(string.Format("Error at pixel {0}", location), string.Format(message, mesgArgs)) { }
public override void Reposition(Location pos) { EyePos = pos; InternalLights[0].NeedsUpdate = true; InternalLights[0].eye = ClientUtilities.ConvertD(EyePos); InternalLights[0].target = ClientUtilities.ConvertD(EyePos + Direction); }
public AStarNode(Location location, INode parent, decimal costFromStart, decimal costToGoal) : base(location, parent) { CostFromStart = costFromStart; CostToGoal = costToGoal; }
public static FlowBranching CreateBranching (FlowBranching parent, BranchingType type, Block block, Location loc) { switch (type) { case BranchingType.Exception: case BranchingType.Labeled: case BranchingType.Toplevel: case BranchingType.TryCatch: throw new InvalidOperationException (); case BranchingType.Switch: return new FlowBranchingBreakable (parent, type, SiblingType.SwitchSection, block, loc); case BranchingType.Block: return new FlowBranchingBlock (parent, type, SiblingType.Block, block, loc); case BranchingType.Loop: return new FlowBranchingBreakable (parent, type, SiblingType.Conditional, block, loc); case BranchingType.Embedded: return new FlowBranchingContinuable (parent, type, SiblingType.Conditional, block, loc); default: return new FlowBranchingBlock (parent, type, SiblingType.Conditional, block, loc); } }
public ParticleEffect AddEffect(ParticleEffectType type, Func<ParticleEffect, Location> start, Func<ParticleEffect, Location> end, Func<ParticleEffect, float> fdata, float ttl, Location color, Location color2, bool fades, Texture texture, float salpha = 1) { ParticleEffect pe = new ParticleEffect(TheClient) { Type = type, Start = start, End = end, FData = fdata, TTL = ttl, O_TTL = ttl, Color = color, Color2 = color2, Alpha = salpha, Fades = fades, texture = texture }; ActiveEffects.Add(pe); return pe; }
public IEnumerable<GoogleAddress> ReverseGeoCode(Location location) { if (location == null) throw new ArgumentNullException("location"); return ReverseGeoCode(location.Latitude, location.Longitude); }
public HasAssignmentsVisitor(string name, TypeReference type, Location startRange, Location endRange) { this.name = name; this.type = type; this.startRange = startRange; this.endRange = endRange; }
public Comment(CommentType commentType, string comment, bool commentStartsLine, Location startPosition, Location endPosition) : base(startPosition, endPosition) { this.CommentType = commentType; this.CommentText = comment; CommentStartsLine = commentStartsLine; }
private Assign(Location loc, string builtIn, LineId line) : base(line) { this.location = loc; this.value = null; this.builtIn = builtIn; }
public SearchStationViewModel(ITransportService transportService) { this.InitializeSearchStationCommand(transportService); this.Stations = new ObservableCollection<Station>(); this.stationPosition = LocationBern; }
public LocationFrm(Location location) { InitializeComponent(); this.location = location; tbName.Text = location.Name; }
public static void Add( Connection connection, NetworkMessage outMessage, Location fromLocation, Location toLocation ) { if (fromLocation.Y > toLocation.Y) { // north, for old x outMessage.AddByte((byte)ServerPacketType.MapSliceNorth); AddMapDescription(connection, outMessage, fromLocation.X - 8, toLocation.Y - 6, toLocation.Z, 18, 1); } else if (fromLocation.Y < toLocation.Y) { // south, for old x outMessage.AddByte((byte)ServerPacketType.MapSliceSouth); AddMapDescription(connection, outMessage, fromLocation.X - 8, toLocation.Y + 7, toLocation.Z, 18, 1); } if (fromLocation.X < toLocation.X) { // east, [with new y] outMessage.AddByte((byte)ServerPacketType.MapSliceEast); AddMapDescription(connection, outMessage, toLocation.X + 9, toLocation.Y - 6, toLocation.Z, 1, 14); } else if (fromLocation.X > toLocation.X) { // west, [with new y] outMessage.AddByte((byte)ServerPacketType.MapSliceWest); AddMapDescription(connection, outMessage, toLocation.X - 8, toLocation.Y - 6, toLocation.Z, 1, 14); } }
private string ComputeText(Location location) { var lineSpan = location.GetLineSpan(); var start = location.SourceTree.GetText().Lines[lineSpan.StartLinePosition.Line].Start; var end = location.SourceTree.GetText().Lines[lineSpan.EndLinePosition.Line].End; return location.SourceTree.GetText().GetSubText(TextSpan.FromBounds(start, end)).ToString(); }
public MapItem(string caption, Location location, double baseZoomLevel, ZoomRange zoomRange) { this.Caption = caption; this.Location = location; this.BaseZoomLevel = baseZoomLevel; this.ZoomRange = zoomRange; }
public void Explode(Location pos, float size, int dens = 200) { Location c1 = new Location(1, 0.7, 0); Location c2 = new Location(1); float spread = size * 0.25f; for (int i = 0; i < dens; i++) { Texture tex = Explosion[Utilities.UtilRandom.Next(Explosion.Length)]; Location forward = Utilities.ForwardVector_Deg(Utilities.UtilRandom.NextDouble() * 360, Utilities.UtilRandom.NextDouble() * 360 - 180); double ssize = Utilities.UtilRandom.NextDouble() * 0.5 + 0.5; float ttl = (float)Utilities.UtilRandom.NextDouble() * 5f + 5f; double speed = Utilities.UtilRandom.NextDouble(); Location loc = new Location(ssize); Location temp = forward * size * speed; double xoff = Utilities.UtilRandom.NextDouble() * spread - spread * 0.5; double yoff = Utilities.UtilRandom.NextDouble() * spread - spread * 0.5; double zoff = Utilities.UtilRandom.NextDouble() * spread - spread * 0.5; Location start = pos + new Location(xoff, yoff, zoff); Engine.AddEffect(ParticleEffectType.SQUARE, (o) => start + temp * (1 - o.TTL / o.O_TTL), (o) => loc, (o) => 0, ttl, c1, c2, true, tex); } for (int i = 0; i < dens / 2; i++) { double xoff = Utilities.UtilRandom.NextDouble() * spread - spread * 0.5; double yoff = Utilities.UtilRandom.NextDouble() * spread - spread * 0.5; double zoff = Utilities.UtilRandom.NextDouble() * spread - spread * 0.5; Location forward = Utilities.ForwardVector_Deg(Utilities.UtilRandom.NextDouble() * 360, Utilities.UtilRandom.NextDouble() * 360 - 180) * 2; SmokeyParticle(pos + new Location(xoff, yoff, zoff), size * 1.5f, new Location(0.5f), SmokeT, forward); } }
public LocationsPage() { this.InitializeComponent(); this.LocationMap.PointerPressedOverride += LocationMap_PointerPressedOverride; var localSettings = Windows.Storage.ApplicationData.Current.LocalSettings; if (localSettings.Values["CurrentLocName"] != null && localSettings.Values["CurrentLocLat"] != null && localSettings.Values["CurrentLocLon"] != null) { Location myLocation = new Location(); myLocation.Latitude = Convert.ToDouble(localSettings.Values["CurrentLocLat"]); myLocation.Longitude = Convert.ToDouble(localSettings.Values["CurrentLocLon"]); Pushpin myPoint = new Pushpin(); myPoint.SetValue(MapLayer.PositionProperty, myLocation); myPoint.Selected = true; this.LocationMap.Children.Add(myPoint); this.LocationMap.Center = myLocation; this.LocationMap.ZoomLevel = 10; this.LatBox.Text = myLocation.Latitude.ToString(); this.LonBox.Text = myLocation.Longitude.ToString(); this.NameBox.Text = localSettings.Values["CurrentLocName"].ToString(); } }
// used for comment tracking public void StartComment(CommentType commentType, bool commentStartsLine, Location startPosition) { this.currentCommentType = commentType; this.startPosition = startPosition; this.sb.Length = 0; this.commentStartsLine = commentStartsLine; }
public ActionResult Index(Location location) { if (!ModelState.IsValid) return View(location); ViewBag.Success = "Done!!!"; return View(location); }
public SymbolLocationNavigableItem( Solution solution, ISymbol symbol, Location location) { _solution = solution; _symbol = symbol; _location = location; _lazyDisplayName = new Lazy<string>(() => { var symbolDisplayService = this.Document.Project.LanguageServices.GetService<ISymbolDisplayService>(); switch (symbol.Kind) { case SymbolKind.NamedType: return symbolDisplayService.ToDisplayString(_symbol, s_shortFormatWithModifiers); case SymbolKind.Method: return _symbol.IsStaticConstructor() ? symbolDisplayService.ToDisplayString(_symbol, s_shortFormatWithModifiers) : symbolDisplayService.ToDisplayString(_symbol, s_shortFormat); default: return symbolDisplayService.ToDisplayString(_symbol, s_shortFormat); } }); }
public Token(TokenId tokenId, string data, Location startLocation, Location endLocation) { _tokenId = tokenId; _data = data; _startLocation = startLocation; _endLocation = endLocation; }
public MessageCollection CheckType(TypeDefinition type, Runner runner) { MessageCollection messageCollection = new MessageCollection(); foreach (MethodDefinition method in type.Methods) { if (!method.IsStatic) { return null; } } foreach (FieldDefinition field in type.Fields) { if (!field.IsStatic) { return null; } } foreach (MethodDefinition ctor in type.Constructors) { if (!ctor.IsStatic && (ctor.Attributes & MethodAttributes.Public) == MethodAttributes.Public) { Location location = new Location(type.Name, ctor.Name, 0); Message message = new Message(MessageString, location, MessageType.Error); messageCollection.Add(message); } } return messageCollection.Count > 0 ? messageCollection : null; }
private void addLocation() { try { lblMessage.Text = ""; using (CCSEntities db = new CCSEntities()) { Location newLocation = new Location(); // create a new food category with the specified name if (txtAddLocation.Text != "") { newLocation.RoomName = txtAddLocation.Text; db.Locations.Add(newLocation); // add the new food category record db.SaveChanges(); } else lblMessage.Text = "You must specify a location"; } } catch (Exception ex) { LogError.logError(ex); Response.Redirect("../errorpages/error.aspx"); } }
void window_Closed(object sender, EventArgs e) { String URL = window.getURL(); Debug.WriteLine("URL: " + URL); Location location = new Location(); if (this.mainPage.mainMap.TryViewportPointToLocation(this.mouseEvent.ViewportPoint, out location)) { /* Success */ Debug.WriteLine("Point (" + location.Longitude + "," + location.Latitude + ")"); MapImage image = new MapImage(URL); Debug.WriteLine("yabai: " + URL); image.setLocation(location); image.draw(mainPage.mainMap); this.mapData = image; } else { /* Fails */ Debug.WriteLine("Something wrong has happened in converting viewport to location."); } }
private static NonPlayerCharacter CreateNpc(ModelEnums.NpcType type, Race race, string name, Location location = null, int level = 1) { var npc = new NonPlayerCharacter() { Name = name, Type = type, Level = level, Race = race, Creature = race.Creature }; npc.SetTag(); if (location != null) { var now = DateTime.Now; var entryLocation = new EntryLocationCharacter { EntryInto = now, Arrival = now, Location = location, Character = npc }; npc.EntryLocations.Add(entryLocation); } return npc; }
public NullableType (TypeExpr underlying, Location l) { this.underlying = underlying; loc = l; eclass = ExprClass.Type; }
public Token(TokenId tokenId, string data, int lineIndex, int characterIndex, int length) { _tokenId = tokenId; _data = data; _startLocation = new Location(lineIndex, characterIndex); _endLocation = new Location(lineIndex, characterIndex + length); }
public void CursorIsJustBeforeChildEndElementEndTagAfterIndent() { int line = 3; int column = 2; Location expectedLocation = new Location(column, line); Assert.AreEqual(expectedLocation, textEditor.Caret.Position); }
public Location GetDeclarationLocation(Location keywordLocation) { if(location.IsEmpty) { return keywordLocation; } return location; }
public void HandleWheels() { if (!hasWheels) { Model mod = TheServer.Models.GetModel(model); if (mod == null) // TODO: mod should return a cube when all else fails? { return; } Model3D scene = mod.Original; if (scene == null) // TODO: Scene should return a cube when all else fails? { return; } SetOrientation(Quaternion.Identity); List <Model3DNode> nodes = GetNodes(scene.RootNode); List <VehiclePartEntity> frontwheels = new List <VehiclePartEntity>(); for (int i = 0; i < nodes.Count; i++) { string name = nodes[i].Name.ToLowerFast(); if (name.Contains("wheel")) { Matrix mat = nodes[i].MatrixA; Model3DNode tnode = nodes[i].Parent; while (tnode != null) { mat = tnode.MatrixA * mat; tnode = tnode.Parent; } Location pos = GetPosition() + new Location(mat.M14, mat.M34, mat.M24) + offset; // NOTE: wtf happened to this matrix? VehiclePartEntity wheel = new VehiclePartEntity(TheRegion, "vehicles/" + vehName + "_wheel", true); wheel.SetPosition(pos); wheel.SetOrientation(Quaternion.Identity); wheel.Gravity = Gravity; wheel.CGroup = CGroup; wheel.SetMass(30); wheel.mode = ModelCollisionMode.CONVEXHULL; TheRegion.SpawnEntity(wheel); wheel.SetPosition(pos); if (name.After("wheel").StartsWith("f")) { SteeringMotors.Add(ConnectWheel(wheel, false, true)); frontwheels.Add(wheel); } else if (name.After("wheel").StartsWith("b")) { DrivingMotors.Add(ConnectWheel(wheel, true, true)); } else { ConnectWheel(wheel, true, false); } wheel.Body.ActivityInformation.Activate(); } } if (frontwheels.Count == 2) { JointSpinner js = new JointSpinner(frontwheels[0], frontwheels[1], new Location(1, 0, 0)); TheRegion.AddJoint(js); } hasWheels = true; } }
internal VirtualClusterData(ResourceIdentifier id, string name, ResourceType type, IDictionary <string, string> tags, Location location, string subnetId, string family, IReadOnlyList <string> childResources, string maintenanceConfigurationId) : base(id, name, type, tags, location) { SubnetId = subnetId; Family = family; ChildResources = childResources; MaintenanceConfigurationId = maintenanceConfigurationId; }
public DiagnosticInfo(Location location, params object[] args) { Args = args; Location = location; }
public static Location ConvertToRadians(Location location) => new Location() { Latitude = UnitConverter.DegreesToRadians(location.Latitude), Longitude = UnitConverter.DegreesToRadians(location.Longitude) };
public void Update(Location entity, int LoggedInUserId, int LoggedInOrganizationId) { base.Update(entity); _unitOfWork.Save(); }
public IEnumerable <Hospital> GetHospitalByLocation(Location location) => GetAll().ToList().Where(hospital => hospital.Address == null ? false : hospital.Address.Location.Equals(location));
public void start() { new Thread(delegate () { Location lastKnownCoordinates = new Location(0,0); List<String> getMessages = new List<String>(); getMessages.Add("get /instrumentation/heading-indicator/indicated-heading-deg\r\n"); getMessages.Add("get /instrumentation/gps/indicated-vertical-speed\r\n"); getMessages.Add("get /instrumentation/gps/indicated-ground-speed-kt\r\n"); getMessages.Add("get /instrumentation/airspeed-indicator/indicated-speed-kt\r\n"); getMessages.Add("get /instrumentation/gps/indicated-altitude-ft\r\n"); getMessages.Add("get /instrumentation/attitude-indicator/internal-roll-deg\r\n"); getMessages.Add("get /instrumentation/attitude-indicator/internal-pitch-deg\r\n"); getMessages.Add("get /instrumentation/altimeter/indicated-altitude-ft\r\n"); getMessages.Add("get /position/latitude-deg\r\n"); getMessages.Add("get /position/longitude-deg\r\n"); while (!m_stop) { bool everythingsFine = true; //for dashbord for (int i = 0; i < 10; i++) { try { m_telnetClient.write(getMessages[i]); } catch (Exception) { //cant write get message, server closed ErrorMessage = connectionError; m_stop = true; break; } try { switch (i) { case 0: HeadingDeg = Double.Parse(m_telnetClient.read()); break; case 1: VerticalSpeed = Double.Parse(m_telnetClient.read()); break; case 2: GroundSpeed = Double.Parse(m_telnetClient.read()); break; case 3: Airspeed = Double.Parse(m_telnetClient.read()); break; case 4: Alttitude = Double.Parse(m_telnetClient.read()); break; case 5: RollDeg = Double.Parse(m_telnetClient.read()); break; case 6: PitchDeg = Double.Parse(m_telnetClient.read()); break; case 7: Altimeter = Double.Parse(m_telnetClient.read()); break; case 8: Latitude = Double.Parse(m_telnetClient.read()); if (Latitude >= 90) { Latitude = 90; everythingsFine = false; ErrorMessage = "Latitude out of range"; } else if (Latitude <= -90) { Latitude = 90; everythingsFine = false; ErrorMessage = "Latitude out of range"; } break; case 9: Longitude = Double.Parse(m_telnetClient.read()); if (Longitude >= 180) { Longitude = 180; everythingsFine = false; ErrorMessage = "Longitude out of range"; } else if (Longitude <= -180) { Longitude = -180; everythingsFine = false; ErrorMessage = "Longitude out of range"; } break; default: ErrorMessage = "shit pavel im sorry dont ruin my grade, something unexcepted happened :("; break; } } catch (FormatException) { //incorrect values switch (i) { case 0: ErrorMessage = "HeadingDeg value is incorrect\n"; break; case 1: ErrorMessage = "verticalSpeed value is incorrect\n"; break; case 2: ErrorMessage = "GroundSpeed value is incorrect\n"; break; case 3: ErrorMessage = "Airspeed value is incorrect\n"; break; case 4: ErrorMessage = "Alttitude value is incorrect\n"; break; case 5: ErrorMessage = "RollDeg value is incorrect\n"; break; case 6: ErrorMessage = "PitchDeg value is incorrect\n"; break; case 7: ErrorMessage = "Altimeter value is incorrect\n"; break; case 8: ErrorMessage = "Latitude value is incorrect\n"; everythingsFine = false; break; case 9: ErrorMessage = "Longitude value is incorrect\n"; everythingsFine = false; break; default: ErrorMessage = "shit\n"; break; } } catch (Exception) { // cant read values, server closed. ErrorMessage = connectionError; m_stop = true; break; } } if (everythingsFine) { lastKnownCoordinates = Cordinates; //Cordinates = Longitude.ToString() + "," + Latitude.ToString(); Cordinates = new Location(Latitude, Longitude); } else { Cordinates = lastKnownCoordinates; } while (commandsForServer.Count() > 0) { { try { m_telnetClient.write(commandsForServer.Peek()); m_telnetClient.read(); } catch (Exception) { ErrorMessage = connectionError; m_stop = true; break; } } commandsForServer.Dequeue(); } Thread.Sleep(250); } Console.WriteLine("finished get and set thread"); }).Start(); }
public Ignored(string value, Location location, Location locationAfter) : base(location, locationAfter, value.Length) { this.Value = value; }
public void SetDestination(Location destination) { navigation.Target(destination); }
public VirtualClusterData(Location location) : base(location) { ChildResources = new ChangeTrackingList <string>(); }
protected SourceFieldSymbolWithSyntaxReference(SourceMemberContainerTypeSymbol containingType, string name, SyntaxReference syntax, Location location) : base(containingType) { Debug.Assert(name != null); Debug.Assert(syntax != null); Debug.Assert(location != null); _name = name; _syntaxReference = syntax; _location = location; }
public Seat(PhysicsEntity seatHolder, Location posOffset) { SeatHolder = seatHolder; PositionOffset = posOffset; }
public static bool Send(Objects.Client client, uint creatureId, string creatureName, Location location, string text) { UpdateCreatureTextPacket p = new UpdateCreatureTextPacket(client); p.CreatureId = creatureId; p.CreatureName = creatureName; p.Location = location; p.Text = text; return(p.Send()); }
/// <summary> /// 执行 /// </summary> /// <param name="image">图像</param> /// <param name="outputs">输出结果</param> /// <returns>执行结果</returns> public void Execute(object image, out ItemCollection outputs) { HObject hImage = image as HObject; outputs = new ItemCollection(); stopwatch.Restart(); HObject ho_ImageReduced = null; HObject ho_R = null, ho_G = null, ho_B = null, ho_Hue = null, ho_Saturation = null; HObject ho_Intensity = null, ho_Regions = null, ho_RegionOpening = null; HObject ho_RegionClosing = null, ho_ImageReduced2 = null, ho_Regions1 = null; HObject ho_RegionOpening1 = null, ho_RegionClosing1 = null; HObject ho_ImageReduced3 = null, ho_Regions2 = null, ho_RegionOpening2 = null; HObject ho_RegionClosing2 = null, ho_RegionDifference = null; HObject ho_RegionOpening3 = null, ho_ConnectedRegions = null; HObject ho_RegionFillUp = null, ho_SelectedRegions = null, ho_Skeleton = null, ho_EndPoints = null; HObject ho_JuncPoints = null, ho_RegionDifference1 = null, ho_ConnectedRegions1 = null; HObject ho_SelectedRegions1 = null, ho_Rectangle = null, ho_Contours = null; HObject ho_SelectedXLD = null, ho_UnionContours = null, ho_SelectedXLD1 = null; HObject ho_Cross = null, ho_ObjectSelected = null; HTuple hv_Number = new HTuple(); HTuple hv_Row = new HTuple(), hv_Column = new HTuple(); HTuple hv_Phi = new HTuple(), hv_Length1 = new HTuple(); HTuple hv_Length2 = new HTuple(), hv_Row1 = new HTuple(); HTuple hv_Col1 = new HTuple(), hv_RowMedian = new HTuple(); HTuple hv_ColMedian = new HTuple(), hv_Exception = new HTuple(); HTuple hv_Length = new HTuple(); HOperatorSet.GenEmptyObj(out ho_ImageReduced); HOperatorSet.GenEmptyObj(out ho_R); HOperatorSet.GenEmptyObj(out ho_G); HOperatorSet.GenEmptyObj(out ho_B); HOperatorSet.GenEmptyObj(out ho_Hue); HOperatorSet.GenEmptyObj(out ho_Saturation); HOperatorSet.GenEmptyObj(out ho_Intensity); HOperatorSet.GenEmptyObj(out ho_Regions); HOperatorSet.GenEmptyObj(out ho_RegionOpening); HOperatorSet.GenEmptyObj(out ho_RegionClosing); HOperatorSet.GenEmptyObj(out ho_ImageReduced2); HOperatorSet.GenEmptyObj(out ho_Regions1); HOperatorSet.GenEmptyObj(out ho_RegionOpening1); HOperatorSet.GenEmptyObj(out ho_RegionClosing1); HOperatorSet.GenEmptyObj(out ho_ImageReduced3); HOperatorSet.GenEmptyObj(out ho_Regions2); HOperatorSet.GenEmptyObj(out ho_RegionOpening2); HOperatorSet.GenEmptyObj(out ho_RegionClosing2); HOperatorSet.GenEmptyObj(out ho_RegionDifference); HOperatorSet.GenEmptyObj(out ho_RegionOpening3); HOperatorSet.GenEmptyObj(out ho_ConnectedRegions); HOperatorSet.GenEmptyObj(out ho_RegionFillUp); HOperatorSet.GenEmptyObj(out ho_SelectedRegions); HOperatorSet.GenEmptyObj(out ho_Skeleton); HOperatorSet.GenEmptyObj(out ho_EndPoints); HOperatorSet.GenEmptyObj(out ho_JuncPoints); HOperatorSet.GenEmptyObj(out ho_RegionDifference1); HOperatorSet.GenEmptyObj(out ho_ConnectedRegions1); HOperatorSet.GenEmptyObj(out ho_SelectedRegions1); HOperatorSet.GenEmptyObj(out ho_Rectangle); HOperatorSet.GenEmptyObj(out ho_Contours); HOperatorSet.GenEmptyObj(out ho_SelectedXLD); HOperatorSet.GenEmptyObj(out ho_UnionContours); HOperatorSet.GenEmptyObj(out ho_SelectedXLD1); HOperatorSet.GenEmptyObj(out ho_Cross); HOperatorSet.GenEmptyObj(out ho_ObjectSelected); try { HTuple width, height; HOperatorSet.GetImageSize(hImage, out width, out height); //若未初始化,则进行初始化 if (!isInit) { isInit = true; ho_ROI_0?.Dispose(); HOperatorSet.GenRectangle1(out ho_ROI_0, 0, 0, height, width); } if (runningWindow == null) { try { runningWindow = (RunningWindow as HSmartWindowControlWPF).HalconWindow; } catch (Exception) { } } if (configWindow == null) { try { configWindow = (ConfigWindow as HSmartWindowControlWPF).HalconWindow; } catch (Exception) { } } if (runningWindow != null) { SetWindowPart(runningWindow, width, height); HOperatorSet.ClearWindow(runningWindow); HOperatorSet.DispObj(hImage, runningWindow); } if (configWindow != null) { SetWindowPart(configWindow, width, height); HOperatorSet.ClearWindow(configWindow); HOperatorSet.DispObj(hImage, configWindow); } //执行主任务 HOperatorSet.ReduceDomain(hImage, ho_ROI_0, out ho_ImageReduced); //转成HSV格式 ho_R.Dispose(); ho_G.Dispose(); ho_B.Dispose(); HOperatorSet.Decompose3(ho_ImageReduced, out ho_R, out ho_G, out ho_B); ho_Hue.Dispose(); ho_Saturation.Dispose(); ho_Intensity.Dispose(); HOperatorSet.TransFromRgb(ho_R, ho_G, ho_B, out ho_Hue, out ho_Saturation, out ho_Intensity, "hsv"); //提取背景区域 ho_Regions.Dispose(); HOperatorSet.Threshold(ho_Hue, out ho_Regions, new HTuple(Inputs["HMinThreshold"].Value), new HTuple(Inputs["HMaxThreshold"].Value)); ho_RegionOpening.Dispose(); HOperatorSet.OpeningCircle(ho_Regions, out ho_RegionOpening, new HTuple(Inputs["OpenRadius"].Value)); ho_RegionClosing.Dispose(); HOperatorSet.ClosingCircle(ho_RegionOpening, out ho_RegionClosing, new HTuple(Inputs["CloseRadius"].Value)); ho_ImageReduced2.Dispose(); HOperatorSet.ReduceDomain(ho_Saturation, ho_RegionClosing, out ho_ImageReduced2 ); ho_Regions1.Dispose(); HOperatorSet.Threshold(ho_ImageReduced2, out ho_Regions1, new HTuple(Inputs["SMinThreshold"].Value), new HTuple(Inputs["SMaxThreshold"].Value)); ho_RegionOpening1.Dispose(); HOperatorSet.OpeningCircle(ho_Regions1, out ho_RegionOpening1, new HTuple(Inputs["OpenRadius"].Value)); ho_RegionClosing1.Dispose(); HOperatorSet.ClosingCircle(ho_RegionOpening1, out ho_RegionClosing1, new HTuple(Inputs["CloseRadius"].Value)); ho_ImageReduced3.Dispose(); HOperatorSet.ReduceDomain(ho_Intensity, ho_RegionClosing1, out ho_ImageReduced3 ); ho_Regions2.Dispose(); HOperatorSet.Threshold(ho_ImageReduced3, out ho_Regions2, new HTuple(Inputs["IMinThreshold"].Value), new HTuple(Inputs["IMaxThreshold"].Value)); ho_RegionOpening2.Dispose(); HOperatorSet.OpeningCircle(ho_Regions2, out ho_RegionOpening2, new HTuple(Inputs["OpenRadius"].Value)); ho_RegionClosing2.Dispose(); HOperatorSet.ClosingCircle(ho_RegionOpening2, out ho_RegionClosing2, new HTuple(Inputs["CloseRadius"].Value)); //求出眼镜腿区域 ho_RegionDifference.Dispose(); HOperatorSet.Difference(ho_ROI_0, ho_RegionClosing2, out ho_RegionDifference ); ho_RegionOpening3.Dispose(); HOperatorSet.OpeningCircle(ho_RegionDifference, out ho_RegionOpening3, 8); ho_ConnectedRegions.Dispose(); HOperatorSet.Connection(ho_RegionOpening3, out ho_ConnectedRegions); ho_RegionFillUp.Dispose(); HOperatorSet.FillUp(ho_ConnectedRegions, out ho_RegionFillUp); ho_SelectedRegions.Dispose(); HOperatorSet.SelectShape(ho_RegionFillUp, out ho_SelectedRegions, ( (new HTuple("area")).TupleConcat("rect2_len1")).TupleConcat("rect2_len2"), "and", ((new HTuple(Inputs["MinArea"].Value)).TupleConcat(new HTuple(Inputs["MinLen1"].Value))).TupleConcat(new HTuple(Inputs["MinLen2"].Value)), ((new HTuple(Inputs["MaxArea"].Value)).TupleConcat( new HTuple(Inputs["MaxLen1"].Value))).TupleConcat(new HTuple(Inputs["MaxLen2"].Value))); //校验模板结果 HOperatorSet.CountObj(ho_SelectedRegions, out hv_Number); if (hv_Number.I > 0) { Location[] locations = new Location[hv_Number.I]; for (int i = 0; i < hv_Number.I; i++) { ho_ObjectSelected.Dispose(); HOperatorSet.SelectObj(ho_SelectedRegions, out ho_ObjectSelected, i + 1); //产生骨骼 ho_Skeleton.Dispose(); HOperatorSet.Skeleton(ho_ObjectSelected, out ho_Skeleton); //计算骨骼端点和关节点 ho_EndPoints.Dispose(); ho_JuncPoints.Dispose(); HOperatorSet.JunctionsSkeleton(ho_Skeleton, out ho_EndPoints, out ho_JuncPoints ); //从骨骼中去除关节点 ho_RegionDifference1.Dispose(); HOperatorSet.Difference(ho_Skeleton, ho_JuncPoints, out ho_RegionDifference1 ); //提取最长的骨骼 ho_ConnectedRegions1.Dispose(); HOperatorSet.Connection(ho_RegionDifference1, out ho_ConnectedRegions1 ); ho_SelectedRegions1.Dispose(); HOperatorSet.SelectShapeStd(ho_ConnectedRegions1, out ho_SelectedRegions1, "max_area", 70); HOperatorSet.SmallestRectangle2(ho_SelectedRegions1, out hv_Row, out hv_Column, out hv_Phi, out hv_Length1, out hv_Length2); ho_Rectangle.Dispose(); HOperatorSet.GenRectangle2(out ho_Rectangle, hv_Row, hv_Column, hv_Phi, hv_Length1, hv_Length2); //转成xld ho_Contours.Dispose(); HOperatorSet.GenContoursSkeletonXld(ho_Skeleton, out ho_Contours, 1, "filter"); ho_SelectedXLD.Dispose(); HOperatorSet.SelectShapeXld(ho_Contours, out ho_SelectedXLD, (new HTuple("rect2_phi")).TupleConcat( "rect2_phi"), "or", (((((hv_Phi.TupleDeg()) - new HTuple(Inputs["XLDPhi"].Value))).TupleRad())).TupleConcat( ((((hv_Phi.TupleDeg()) + 180) - new HTuple(Inputs["XLDPhi"].Value))).TupleRad()), (((((hv_Phi.TupleDeg() ) + new HTuple(Inputs["XLDPhi"].Value))).TupleRad())).TupleConcat(((((hv_Phi.TupleDeg()) + 180) + new HTuple(Inputs["XLDPhi"].Value))).TupleRad() )); ho_UnionContours.Dispose(); HOperatorSet.UnionAdjacentContoursXld(ho_SelectedXLD, out ho_UnionContours, 30, 1, "attr_keep"); //选择最长的xlds HTuple hv_SortIndex = new HTuple(); HOperatorSet.LengthXld(ho_UnionContours, out hv_Length); HOperatorSet.TupleSortIndex(hv_Length, out hv_SortIndex); ho_SelectedXLD1.Dispose(); HOperatorSet.SelectObj(ho_UnionContours, out ho_SelectedXLD1, hv_SortIndex[hv_SortIndex.Length - 1].I + 1); HOperatorSet.GetContourXld(ho_SelectedXLD1, out hv_Row1, out hv_Col1); ho_Cross.Dispose(); HOperatorSet.GenCrossContourXld(out ho_Cross, hv_Row1[hv_Row1.Length / 2], hv_Col1[hv_Col1.Length / 2], 100, ((new HTuple(45)).TupleRad()) + hv_Phi); if (runningWindow != null) { HOperatorSet.DispObj(ho_SelectedXLD1, runningWindow); HOperatorSet.DispObj(ho_Cross, runningWindow); } if (configWindow != null) { HOperatorSet.DispObj(ho_SelectedXLD1, configWindow); HOperatorSet.DispObj(ho_Cross, configWindow); } locations[i] = new Location(hv_Col1[hv_Col1.Length / 2].D, hv_Row1[hv_Row1.Length / 2].D, hv_Phi[0].D); } if ((bool)Inputs["AutoSave"].Value == true) { //保存文件到本地 HOperatorSet.WriteImage(hImage, "bmp", 0, new HTuple(Inputs["ImagePath"].Value)); } //封装有效结果 Outputs["ItemLocation"].Value = locations; stopwatch.Stop(); RunStatus = new RunStatus(stopwatch.Elapsed.TotalMilliseconds); } else { //没有有效的结果 Outputs["ItemLocation"].Value = new Location[0]; stopwatch.Stop(); RunStatus = new RunStatus(stopwatch.Elapsed.TotalMilliseconds, EResult.Warning, "没找到有效目标"); } outputs = new ItemCollection(Outputs); } catch (Exception ex) { stopwatch.Stop(); RunStatus = new RunStatus(stopwatch.Elapsed.TotalMilliseconds, EResult.Error, ex.Message, ex); throw; } finally { hImage.Dispose(); ho_ImageReduced.Dispose(); ho_R.Dispose(); ho_G.Dispose(); ho_B.Dispose(); ho_Hue.Dispose(); ho_Saturation.Dispose(); ho_Intensity.Dispose(); ho_Regions.Dispose(); ho_RegionOpening.Dispose(); ho_RegionClosing.Dispose(); ho_ImageReduced2.Dispose(); ho_Regions1.Dispose(); ho_RegionOpening1.Dispose(); ho_RegionClosing1.Dispose(); ho_ImageReduced3.Dispose(); ho_Regions2.Dispose(); ho_RegionOpening2.Dispose(); ho_RegionClosing2.Dispose(); ho_RegionDifference.Dispose(); ho_RegionOpening3.Dispose(); ho_ConnectedRegions.Dispose(); ho_RegionFillUp.Dispose(); ho_SelectedRegions.Dispose(); ho_Skeleton.Dispose(); ho_EndPoints.Dispose(); ho_JuncPoints.Dispose(); ho_RegionDifference1.Dispose(); ho_ConnectedRegions1.Dispose(); ho_SelectedRegions1.Dispose(); ho_Rectangle.Dispose(); ho_Contours.Dispose(); ho_SelectedXLD.Dispose(); ho_UnionContours.Dispose(); ho_SelectedXLD1.Dispose(); ho_Cross.Dispose(); ho_ObjectSelected.Dispose(); } }
/// <summary> /// Creates a new view model for a tour segment list entry /// </summary> /// <param name="location">location to display</param> /// <param name="segmentList">list of segments to display</param> /// <param name="isStartLocation">indicates if the location is the start location</param> public TourSegmentListEntryViewModel(Location location, List<Segment> segmentList, bool isStartLocation) { this.location = location; this.segmentList = segmentList; this.IsStartLocation = isStartLocation; }
private async void ShowLocation(object obj) { var location = new Location(Convert.ToDouble(Masjeed.Latitude), Convert.ToDouble(Masjeed.Longitude)); await Map.OpenAsync(location); }
protected override void setJSON(JObject obj, BaseClassIfc host, SetJsonOptions options) { base.setJSON(obj, host, options); obj["Location"] = Location.getJson(this, options); }
/// <summary> /// Calculate contours from given incumbent and parent incumbent locations /// </summary> /// <param name="sourceContour">portal contours</param> /// <returns>contours data</returns> private static string GetContourPoints(PortalContour sourceContour) { lock (portalContourLock) { Location stationLocation = new Location(sourceContour.Latitude, sourceContour.Longitude); Distance sameChannelKeyHoleDistance = new Distance(80, DistanceUnit.KM); // 80 km (outer keyhole) Distance sameChannelDistance = new Distance(8, DistanceUnit.KM); // 8 km (inner keyhole) Location parentLocation = new Location(sourceContour.ParentLatitude, sourceContour.ParentLongitude); var stationToParentTxBearing = GeoCalculations.CalculateBearing(stationLocation, parentLocation); // keyhole calculations var keyHoleArcStarting = stationToParentTxBearing - 30; var keyHoleArcEnding = stationToParentTxBearing + 30; if (keyHoleArcStarting > 360) { keyHoleArcStarting = keyHoleArcStarting - 360; } if (keyHoleArcEnding > 360) { keyHoleArcEnding = keyHoleArcEnding - 360; } if (keyHoleArcStarting < 0) { keyHoleArcStarting = keyHoleArcStarting + 360; } if (keyHoleArcEnding < 0) { keyHoleArcEnding = keyHoleArcEnding + 360; } List <Location> contourPoints = CalculateRadialContour(stationLocation, sameChannelDistance); List <Location> keyHolePoints = CalculateRadialContour(stationLocation, sameChannelKeyHoleDistance); if (keyHoleArcStarting < keyHoleArcEnding) { for (int i = (int)keyHoleArcStarting; i < (int)keyHoleArcEnding; i++) { contourPoints[i] = keyHolePoints[i]; } } else { for (int i = (int)keyHoleArcStarting; i <= 360; i++) { contourPoints[i] = keyHolePoints[i]; } for (int i = (int)0; i <= (int)keyHoleArcEnding; i++) { contourPoints[i] = keyHolePoints[i]; } } StringBuilder contourBuilder = new StringBuilder(); foreach (Location point in contourPoints) { contourBuilder.Append(point.Latitude); contourBuilder.Append(" "); contourBuilder.Append(point.Longitude); contourBuilder.Append(" "); } return(contourBuilder.ToString().Trim()); } }
public void OnProgressChange(Location p0, RouteProgress p1) { SetSpeed(p0); }
private void Analyze(SyntaxTreeAnalysisContext context) => context.ReportDiagnostic(Diagnostic.Create(Descriptor, Location.Create(context.Tree, TextSpan.FromBounds(1000, 2000))));
public static void ExecuteUseOnItem(Game game, Player player, Location fromLocation, byte fromStackPosition, Item item, Location toLocation, Item onItem) { if (actions.ContainsKey(item.Id)) { actions[item.Id].UseOnItem(game, player, fromLocation, fromStackPosition, item, toLocation, onItem); } }
public void OnLocationChanged(Location location) { MobileFront.Models.GpsLocationModel.Latitude = location.Latitude; MobileFront.Models.GpsLocationModel.Longitude = location.Longitude; MobileFront.Models.GpsLocationModel.Altitude = location.Altitude; }
public Location AsLocation(string path) { return Location.Create(path, new TextSpan(), new LinePositionSpan()); }
public int ModifyLocation(Location p_Location) { return(objLocationDBA.UpadateLocation(p_Location)); }
public void OnLocationChanged(Location location) { LocationFound(location); }
/// <summary> /// /// </summary> /// <param name="geomIndex"></param> public void PropagateSideLabels(int geomIndex) { // Since edges are stored in CCW order around the node, // As we move around the ring we move from the right to the left side of the edge Location startLoc = Location.Null; // initialize loc to location of last Curve side (if any) foreach (EdgeEnd e in Edges) { Label label = e.Label; if (label.IsArea(geomIndex) && label.GetLocation(geomIndex, Positions.Left) != Location.Null) { startLoc = label.GetLocation(geomIndex, Positions.Left); } } // no labelled sides found, so no labels to propagate if (startLoc == Location.Null) { return; } Location currLoc = startLoc; foreach (EdgeEnd e in Edges) { Label label = e.Label; // set null On values to be in current location if (label.GetLocation(geomIndex, Positions.On) == Location.Null) { label.SetLocation(geomIndex, Positions.On, currLoc); } // set side labels (if any) if (label.IsArea(geomIndex)) { Location leftLoc = label.GetLocation(geomIndex, Positions.Left); Location rightLoc = label.GetLocation(geomIndex, Positions.Right); // if there is a right location, that is the next location to propagate if (rightLoc != Location.Null) { if (rightLoc != currLoc) { throw new TopologyException("side location conflict", e.Coordinate); } if (leftLoc == Location.Null) { Assert.ShouldNeverReachHere("found single null side (at " + e.Coordinate + ")"); } currLoc = leftLoc; } else { /* RHS is null - LHS must be null too. * This must be an edge from the other point, which has no location * labelling for this point. This edge must lie wholly inside or outside * the other point (which is determined by the current location). * Assign both sides to be the current location. */ Assert.IsTrue(label.GetLocation(geomIndex, Positions.Left) == Location.Null, "found single null side"); label.SetLocation(geomIndex, Positions.Right, currLoc); label.SetLocation(geomIndex, Positions.Left, currLoc); } } } }
public static async Task <decimal> GetMarketStatAvgPriceAsync(string uniqueName, Location location) { using (var wc = new WebClient()) { var apiString = $"https://www.albion-online-data.com/api/v1/stats/charts/" + $"{uniqueName}?date={DateTime.Now:MM-dd-yyyy}?locations={Locations.GetName(location)}"; try { var itemString = await wc.DownloadStringTaskAsync(apiString); var values = JsonConvert.DeserializeObject <List <MarketStatChartResponse> >(itemString); return(values.FirstOrDefault()?.Data.PricesAvg.FirstOrDefault() ?? 0); } catch (Exception ex) { Debug.Print(ex.Message); return(0); } } }
public int AddLocation(Location p_Location) { return(objLocationDBA.InsertLocation(p_Location)); }
public int GetLocationInventory(Location location, Product product) { return inventory[new InventoryTuple(location, product)]; }
void LocationFound(Location location) { marker.ShowAt(location.Latitude, location.Longitude, location.Accuracy); }
public DebuggerTooltipControl(Location logicalPosition) { this.logicalPosition = logicalPosition; InitializeComponent(); Loaded += new RoutedEventHandler(OnLoaded); }