internal void InitializeDisplayString() { try { var sb = new StringBuilder(); var useSeparator = false; var quadrants = Quadrants.ToList(); quadrants.Reverse(); foreach (var q in quadrants) { if (useSeparator) { sb.Append(" | "); } sb.AppendFormat("{0}({1})", q.FullName, q.Abbreviation); useSeparator = true; } var quadrantInfo = sb.ToString(); DisplayString = $"{InternalName} - {quadrantInfo}"; } catch { DisplayString = $"{InternalName} - Information not available."; } }
private void DoSave() { try { // Is the item new and needs to be added to a quadrant? if (_MatrixTask.MatrixTaskId == 0) { var quadrant = Quadrants.Where(o => o.QuadrantId == _MatrixTask.QuadrantId).FirstOrDefault(); if (quadrant != null) { quadrant.MatrixTasks.Add(_MatrixTask); } _MatrixTask.CreatedUTC = DateTime.UtcNow; } _DataService.SaveChanges(); EditResultMessage msg = new EditResultMessage() { IsSaved = true }; Messenger.Default.Send <EditResultMessage>(msg); } catch (Exception ex) { // TODO: Display Error Message } }
public RoundTimePicker() { InitializeComponent(); Time = DateTime.Now; lastHourQuadrant = QuadrantFromAngle((Time.Hour % 12) * 30); Animate(); DataContext = this; }
/// <summary> /// Constructs a child node. /// </summary> /// <param name="parent">Parent node.</param> /// <param name="quadrant">Position index.</param> public QuadNode(QuadNode parent, Quadrants quadrant) : this(0, parent.maxHeight) { // Store values this.root = parent.root; this.parent = parent; this.parent.children[(int)quadrant] = this; this.parent.hasChildren = true; this.level = parent.level + 1; // Determine interior area of child if (quadrant == Quadrants.NW) { rectangle = new Rectangle( parent.Rectangle.X, parent.Rectangle.Y, parent.Rectangle.Width / 2, parent.Rectangle.Height / 2); } else if (quadrant == Quadrants.NE) { rectangle = new Rectangle( parent.rectangle.X + parent.Rectangle.Width / 2, parent.Rectangle.Y, parent.Rectangle.Width / 2, parent.Rectangle.Height / 2); } else if (quadrant == Quadrants.SW) { rectangle = new Rectangle( parent.Rectangle.X, parent.Rectangle.Y + parent.Rectangle.Height / 2, parent.Rectangle.Width / 2, parent.Rectangle.Height / 2); } else if (quadrant == Quadrants.SE) { rectangle = new Rectangle( parent.Rectangle.X + parent.Rectangle.Width / 2, parent.Rectangle.Y + parent.Rectangle.Height / 2, parent.Rectangle.Width / 2, parent.Rectangle.Height / 2); } // Calculate bounding box this.boundingBox = new BoundingBox( new Vector3(0, -maxHeight, 0), new Vector3(rectangle.Width, maxHeight, rectangle.Height)); // Set transform Vector3 origin = new Vector3(rectangle.X, 0, rectangle.Y); this.matrix = Matrix.CreateTranslation(origin); }
private void CalculateDistance(Quadrants quadrant, float dir, float candidatePlane, float origin, ref float maxT) { if ((quadrant != Quadrants.Middle) && (dir != 0.0f)) { maxT = (candidatePlane - origin) / dir; } else { maxT = -1.0f; } }
private void Init() { if (Quadrants.Count > 0) { Quadrants.Clear(); } foreach (Quadrant q in _DataService.GetQuadrants().OrderBy(o => o.QuadrantDescription)) { Quadrants.Add(q); } }
private void OnManipulationDeltaHours(object sender, ManipulationDeltaEventArgs e) { HoursAngle = GetAngle(e.ManipulationOrigin, ((Grid)sender).RenderSize); Quadrants quadrant = QuadrantFromAngle(HoursAngle); if (lastHourQuadrant == Quadrants.NorthWest && quadrant == Quadrants.NorthEast || lastHourQuadrant == Quadrants.NorthEast && quadrant == Quadrants.NorthWest) { AddTwelveToHours12 = !AddTwelveToHours12; } lastHourQuadrant = quadrant; }
public static SqlString GetStreet(SqlString address) { if (address.IsNull) { return(null); } if (string.IsNullOrWhiteSpace(address.Value)) { return(null); } try { var s = address.Value.Replace(".", ""); var la = s.Split(' ').ToList(); if (AllDigits(la[0])) { la.RemoveAt(0); } if (Quadrants.Contains(la[0].ToUpper())) { la.RemoveAt(0); } la.Reverse(); if (AllDigits(la[0])) { la.RemoveAt(0); } if (la[0].StartsWith("#")) { la.RemoveAt(0); } if (Apartments.Contains(la[0].ToUpper())) { la.RemoveAt(0); } if (StreetTypes.Contains(la[0].ToUpper())) { la.RemoveAt(0); } la.Reverse(); var street = string.Join(" ", la); return(street); } catch (Exception) { return(null); } }
private void FindCandidatePlanes( float origin, float minB, float maxB, ref bool bInside, out Quadrants quadrant, ref float candidatePlane) { if (origin < minB) { quadrant = Quadrants.Left; candidatePlane = minB; bInside = false; } else if (origin > maxB) { quadrant = Quadrants.Right; candidatePlane = maxB; bInside = false; } else { quadrant = Quadrants.Middle; } }
private void LoadWorkspace() { List <string> settings = File.ReadLines(@"Data\settings").ToList(); // Set map position: string[] mapPos = settings[0].Split(','); DefinedMapPosition = new PointLatLng(ParseDouble(mapPos[0]), ParseDouble(mapPos[1])); Map.Position = DefinedMapPosition; settings.RemoveAt(0); // Set map zoom: InitialZoom = ParseDouble(settings[0]); Map.Zoom = InitialZoom; settings.RemoveAt(0); // Set cell size and grid coordinates: string[] qSize = settings[0].Split(','); QSize = new SizeF(ParseFloat(qSize[0]), ParseFloat(qSize[1])); GPoint mapPixelPos = Map.MapProvider.Projection.FromLatLngToPixel(Map.Position, (int)Map.Zoom); PointLatLng bottomLeftPoint = Map.MapProvider.Projection.FromPixelToLatLng( new GPoint(mapPixelPos.X - Width / 2, mapPixelPos.Y + Height / 2), (int)Map.Zoom); PointLatLng topRightPoint = Map.MapProvider.Projection.FromPixelToLatLng( new GPoint(mapPixelPos.X + Width / 2, mapPixelPos.Y - Height / 2), (int)Map.Zoom); GridCoordinates = new double[] { bottomLeftPoint.Lat, topRightPoint.Lat, bottomLeftPoint.Lng, topRightPoint.Lng }; settings.RemoveAt(0); // Load quadrants of operation: List <string> quads = File.ReadLines(@"Data\areaofoperation").ToList(); foreach (var i in quads) { string[] info = i.Split(','); Quadrants.Add(new Tuple <double, double>( ParseDouble(info[0]), ParseDouble(info[1]) )); } _areaDefined = Quadrants.Count > 0; InitGrid(); // Load other settings: IsSupervisor = settings[0] == "1"; settings.RemoveAt(0); SupervisingPort = settings[0]; settings.RemoveAt(0); // Load UAVs and coordinators: List <string> conns = File.ReadLines(@"Data\connections").ToList(); foreach (var i in conns) { string[] info = i.Split(','); try { AddConnection(info[0], info[1], info[2], int.Parse(info[3]), Color.FromArgb(int.Parse(info[4])), info[5], info[6]); } catch (Exception) { } } }
public void DrawQuadrants(PDFPen pen, PDFPoint pos, PDFSize size, Quadrants sides) { this.DrawQuadrants(pen, pos.X, pos.Y, size.Width, size.Height, sides); }
public void DrawQuadrants(PDFPen pen, PDFUnit x, PDFUnit y, PDFUnit width, PDFUnit height, Quadrants sides) { if (pen == null) { throw new ArgumentNullException("pen"); } PDFRect bounds = new PDFRect(x, y, width, height); this.SaveGraphicsState(); pen.SetUpGraphics(this, bounds); OutputQuadrantPoints(x, y, width, height, sides); this.RenderStrokePathOp(); pen.ReleaseGraphics(this, bounds); this.RestoreGraphicsState(); }
private void OutputQuadrantPoints(PDFUnit x, PDFUnit y, PDFUnit width, PDFUnit height, Quadrants sides) { PDFReal left = x.RealValue; PDFReal right = (x + width).RealValue; PDFReal top = y.RealValue; PDFReal bottom = (y + height).RealValue; PDFReal hcentre = (left + (width.RealValue / (PDFReal)2.0)); PDFReal vcentre = (top + (height.RealValue / (PDFReal)2.0)); PDFReal xhandle = ((width.RealValue / (PDFReal)2.0) * (PDFReal)CircularityFactor); PDFReal yhandle = ((height.RealValue / (PDFReal)2.0) * (PDFReal)CircularityFactor); bool requiresmove; if ((sides & Quadrants.TopLeft) > 0) { this.RenderMoveTo(left, vcentre); //top left quadrant this.RenderBezierCurveTo(hcentre, top, left, vcentre - yhandle, hcentre - xhandle, top); requiresmove = false; } else { requiresmove = true; } if ((sides & Quadrants.TopRight) > 0) { if (requiresmove) { this.RenderMoveTo(hcentre, top); } //top right quadrant this.RenderBezierCurveTo(right, vcentre, hcentre + xhandle, top, right, vcentre - yhandle); requiresmove = false; } else { requiresmove = true; } if ((sides & Quadrants.BottomRight) > 0) { if (requiresmove) { this.RenderMoveTo(right, vcentre); } //bottom right quadrant this.RenderBezierCurveTo(hcentre, bottom, right, vcentre + yhandle, hcentre + xhandle, bottom); requiresmove = false; } else { requiresmove = true; } if ((sides & Quadrants.BottomLeft) > 0) { if (requiresmove) { this.RenderMoveTo(hcentre, bottom); } //bottom left quadrant this.RenderBezierCurveTo(left, vcentre, hcentre - xhandle, bottom, left, vcentre + yhandle); } }
/// <summary> /// Gets child node. /// </summary> /// <param name="quadrant">Index of child node.</param> /// <returns>QuadNode or null if child not present.</returns> public QuadNode GetChild(Quadrants quadrant) { return(children[(int)quadrant]); }
public void DrawQuadrants(PDFPen pen, PDFRect rect, Quadrants sides) { this.DrawQuadrants(pen, rect.Location, rect.Size, sides); }
private void OutputQuadrantShapes(PDFUnit x, PDFUnit y, PDFUnit width, PDFUnit height, Quadrants sides) { PDFReal left = x.RealValue; PDFReal right = (x + width).RealValue; PDFReal top = y.RealValue; PDFReal bottom = (y + height).RealValue; PDFReal hcentre = (left + (width.RealValue / (PDFReal)2.0)); PDFReal vcentre = (top + (height.RealValue / (PDFReal)2.0)); PDFReal xhandle = ((width.RealValue / (PDFReal)2.0) * (PDFReal)CircularityFactor); PDFReal yhandle = ((height.RealValue / (PDFReal)2.0) * (PDFReal)CircularityFactor); if ((sides & Quadrants.TopLeft) > 0) { this.RenderMoveTo(left, vcentre); //top left quadrant this.RenderBezierCurveTo(hcentre, top, left, vcentre - yhandle, hcentre - xhandle, top); this.RenderContinuationLine(hcentre, vcentre); this.RenderContinuationLine(left, vcentre); } if ((sides & Quadrants.TopRight) > 0) { this.RenderMoveTo(hcentre, top); //top right quadrant this.RenderBezierCurveTo(right, vcentre, hcentre + xhandle, top, right, vcentre - yhandle); this.RenderContinuationLine(hcentre, vcentre); this.RenderContinuationLine(hcentre, top); } if ((sides & Quadrants.BottomRight) > 0) { this.RenderMoveTo(right, vcentre); //bottom right quadrant this.RenderBezierCurveTo(hcentre, bottom, right, vcentre + yhandle, hcentre + xhandle, bottom); this.RenderContinuationLine(hcentre, vcentre); this.RenderContinuationLine(right, vcentre); } if ((sides & Quadrants.BottomLeft) > 0) { this.RenderMoveTo(hcentre, bottom); //bottom left quadrant this.RenderBezierCurveTo(left, vcentre, hcentre - xhandle, bottom, left, vcentre + yhandle); this.RenderContinuationLine(hcentre, vcentre); this.RenderContinuationLine(hcentre, bottom); } }
public void FillQuadrants(PDFBrush brush, PDFUnit x, PDFUnit y, PDFUnit width, PDFUnit height, Quadrants sides) { if (brush == null) { throw new ArgumentNullException("brush"); } PDFRect bounds = new PDFRect(x, y, width, height); this.SaveGraphicsState(); brush.SetUpGraphics(this, bounds); OutputQuadrantShapes(x, y, width, height, sides); this.RenderFillPathOp(); brush.ReleaseGraphics(this, bounds); this.RestoreGraphicsState(); }
public void FillQuadrants(PDFBrush brush, PDFPoint pos, PDFSize size, Quadrants sides) { this.FillQuadrants(brush, pos.X, pos.Y, size.Width, size.Height, sides); }
public void FillQuadrants(PDFBrush brush, PDFRect rect, Quadrants sides) { this.FillQuadrants(brush, rect.Location, rect.Size, sides); }