public void WriteXml(XmlWriter writer) { writer.WriteAttributeString("MinX", MinX.ToInvariantString()); writer.WriteAttributeString("MinY", MinY.ToInvariantString()); writer.WriteAttributeString("MaxX", MaxX.ToInvariantString()); writer.WriteAttributeString("MaxY", MaxY.ToInvariantString()); }
/// <summary>Indicates whether the current object is equal to another object of the same type.</summary> /// <returns><c>true</c> if the current object is equal to the <paramref name="other" /> parameter; otherwise, <c>false</c>.</returns> /// <param name="other">An object to compare with this object.</param> public bool Equals(StatisticsCalculationResult other) { //check for null if (other is null) { return(false); } //check for same reference if (ReferenceEquals(this, other)) { return(true); } //check for same values return(MinX.Equals(other.MinX) && MinY.Equals(other.MinY) && MaxX.Equals(other.MaxX) && MaxY.Equals(other.MaxY) && UsedAreaWidth.Equals(other.UsedAreaWidth) && UsedAreaHeight.Equals(other.UsedAreaHeight) && UsedTiles.Equals(other.UsedTiles) && MinTiles.Equals(other.MinTiles) && Efficiency.Equals(other.Efficiency)); }
private void MenuItemFileSave_Click(object sender, RoutedEventArgs e) { MenuItem menuItem = (MenuItem)sender; CheckIfSaveFileIsPossible(menuItem); string Map = string.Empty; Map += MaxX.ToString(); Map += Environment.NewLine + MaxY.ToString(); Map += Environment.NewLine + StartNode.ToString(); Map += Environment.NewLine + EndNode.ToString(); foreach (Node node in AllNodes) { if (node.IsObstacle) { Map += Environment.NewLine + node.ToString(); } } if (menuItem.Name == MenuItemFileSaveAs.Name || FilePath == string.Empty) { FileSave(menuItem, Map); } else if (menuItem.Name == MenuItemFileSave.Name) { FileSave(menuItem, Map); } }
public override int GetHashCode() { unchecked { int hashCode = (int)Type; hashCode = (hashCode * 397) ^ (int)Strategy; if (Type == SpatialFieldType.Geography) { hashCode = (hashCode * 397) ^ Units.GetHashCode(); } if (Strategy != SpatialSearchStrategy.BoundingBox) { hashCode = (hashCode * 397) ^ MaxTreeLevel; if (Type == SpatialFieldType.Cartesian) { hashCode = (hashCode * 397) ^ MinX.GetHashCode(); hashCode = (hashCode * 397) ^ MaxX.GetHashCode(); hashCode = (hashCode * 397) ^ MinY.GetHashCode(); hashCode = (hashCode * 397) ^ MaxY.GetHashCode(); } } return(hashCode); } }
/// <summary> /// Normalize lat and lon values to their boundary values /// O(1) /// </summary> public void Normalize() { MinX = MinX.NormalizeLongitude(); MaxX = MaxX.NormalizeLongitude(); MinY = MinY.NormalizeLatitude(); MaxY = MaxY.NormalizeLatitude(); }
public bool Search(string str) { if (ID.ToString().Contains(str) || MinX.ToString().Contains(str) || MinY.ToString().Contains(str) || MinZ.ToString().Contains(str) || MaxX.ToString().Contains(str) || MaxY.ToString().Contains(str) || MaxZ.ToString().Contains(str)) { return(true); } else { return(false); } }
/// <summary> /// Hashcode method /// </summary> /// <returns></returns> public override int GetHashCode() { int hashCode = -1838259446; hashCode = hashCode * -1521134295 + MinX.GetHashCode(); hashCode = hashCode * -1521134295 + MinY.GetHashCode(); hashCode = hashCode * -1521134295 + MinZ.GetHashCode(); hashCode = hashCode * -1521134295 + MaxX.GetHashCode(); hashCode = hashCode * -1521134295 + MaxY.GetHashCode(); hashCode = hashCode * -1521134295 + MaxZ.GetHashCode(); return(hashCode); }
public override string ToString() { return(StrScan + " " + Id + "," + MinX.ToString(System.Globalization.CultureInfo.InvariantCulture) + "," + MaxX.ToString(System.Globalization.CultureInfo.InvariantCulture) + "," + MinY.ToString(System.Globalization.CultureInfo.InvariantCulture) + "," + MaxY.ToString(System.Globalization.CultureInfo.InvariantCulture) + "," + (UseSlopePresel ? "true" : "false") + "," + MinSX.ToString(System.Globalization.CultureInfo.InvariantCulture) + "," + MaxSX.ToString(System.Globalization.CultureInfo.InvariantCulture) + "," + MinSY.ToString(System.Globalization.CultureInfo.InvariantCulture) + "," + MaxSY.ToString(System.Globalization.CultureInfo.InvariantCulture) + "," + OutputFile); }
public override void WriteXml(XmlWriter writer) { writer.WriteAttributeString("CRS", CRS); writer.WriteAttributeString("minx", MinX.ToString(NumberFormatInfo.InvariantInfo)); writer.WriteAttributeString("maxx", MaxX.ToString(NumberFormatInfo.InvariantInfo)); writer.WriteAttributeString("miny", MinY.ToString(NumberFormatInfo.InvariantInfo)); writer.WriteAttributeString("maxy", MaxY.ToString(NumberFormatInfo.InvariantInfo)); if (ResX.HasValue) { writer.WriteAttributeString("resx", ResX.Value.ToString(NumberFormatInfo.InvariantInfo)); } if (ResY.HasValue) { writer.WriteAttributeString("resy", ResY.Value.ToString(NumberFormatInfo.InvariantInfo)); } }
protected override void WriteDataXML(XElement ele, ElderScrollsPlugin master) { XElement subEle; ele.TryPathTo("Divisor", true, out subEle); subEle.Value = Divisor.ToString(); ele.TryPathTo("MaxDistance/X", true, out subEle); subEle.Value = MaxDistanceX.ToString("G15"); ele.TryPathTo("MaxDistance/Y", true, out subEle); subEle.Value = MaxDistanceY.ToString("G15"); ele.TryPathTo("Min/X", true, out subEle); subEle.Value = MinX.ToString("G15"); ele.TryPathTo("Min/Y", true, out subEle); subEle.Value = MinY.ToString("G15"); ele.TryPathTo("Min/Z", true, out subEle); subEle.Value = MinZ.ToString("G15"); ele.TryPathTo("Max/X", true, out subEle); subEle.Value = MaxX.ToString("G15"); ele.TryPathTo("Max/Y", true, out subEle); subEle.Value = MaxY.ToString("G15"); ele.TryPathTo("Max/Z", true, out subEle); subEle.Value = MaxZ.ToString("G15"); ele.TryPathTo("Cell", true, out subEle); foreach (List <short> list in Cell) { XElement cell = new XElement("Row"); foreach (short num in list) { cell.Add(new XElement("Triangle", num)); } subEle.Add(cell); } }
public override XElement ToXElement(string nameSpace) { var attributes = new List <XAttribute> { new XAttribute("CRS", CRS), new XAttribute("minx", MinX.ToString(NumberFormatInfo.InvariantInfo)), new XAttribute("maxx", MaxX.ToString(NumberFormatInfo.InvariantInfo)), new XAttribute("miny", MinY.ToString(NumberFormatInfo.InvariantInfo)), new XAttribute("maxy", MaxY.ToString(NumberFormatInfo.InvariantInfo)) }; if (ResX.HasValue) { attributes.Add(new XAttribute("resx", ResX.Value.ToString(NumberFormatInfo.InvariantInfo))); } if (ResY.HasValue) { attributes.Add(new XAttribute("resy", ResY.Value.ToString(NumberFormatInfo.InvariantInfo))); } return(new XElement(XName.Get("BoundingBox", nameSpace), attributes.ToArray())); }
protected bool Equals(SpatialOptions other) { var result = Type == other.Type && Strategy == other.Strategy; if (Type == SpatialFieldType.Geography) { result = result && Units == other.Units; } if (Strategy != SpatialSearchStrategy.BoundingBox) { result = result && MaxTreeLevel == other.MaxTreeLevel; if (Type == SpatialFieldType.Cartesian) { result = result && MinX.Equals(other.MinX) && MaxX.Equals(other.MaxX) && MinY.Equals(other.MinY) && MaxY.Equals(other.MaxY); } } return(result); }
/// <summary> /// TBD ?!? /// </summary> public override string WfsXmlRepresentation() { string strTemplate = "<gml:Envelope xmlns:gml=\"http://www.opengis.net/gml\" srsName=\"{0}\"><gml:lowerCorner>{1} {2}</gml:lowerCorner><gml:upperCorner>{3} {4}</gml:upperCorner></gml:Envelope>"; string str = string.Format(strTemplate, SrsName, MinX.ToString(CultureInfo.InvariantCulture), MinY.ToString(CultureInfo.InvariantCulture), MaxX.ToString(CultureInfo.InvariantCulture), MaxY.ToString(CultureInfo.InvariantCulture)); return(str); }
/// <summary> /// TBD ?!? /// </summary> public override string FormulaRepresentation() { string strTemplate = "BBox={0},{1} {2},{3}"; string str = string.Format(strTemplate, MinX.ToString(CultureInfo.InvariantCulture), MinY.ToString(CultureInfo.InvariantCulture), MaxX.ToString(CultureInfo.InvariantCulture), MaxY.ToString(CultureInfo.InvariantCulture)); return(str); }
public override int GetHashCode() { return(MinX.GetHashCode() ^ MinY.GetHashCode() ^ MaxX.GetHashCode() ^ MaxY.GetHashCode()); }
public XmlDocument GetTileSets(Models.Layer layer) { var doc = new XmlDocument(); var root = doc.CreateElement(String.Empty, "TileMap", String.Empty); doc.AppendChild(root); var versionAttribute = doc.CreateAttribute("version"); versionAttribute.Value = TileMapServiceVersion; root.Attributes.Append(versionAttribute); var tilemapservice = $"{this.baseUrl}/tms/{TileMapServiceVersion}/"; var tilemapserviceAttribute = doc.CreateAttribute("tilemapservice"); tilemapserviceAttribute.Value = tilemapservice; root.Attributes.Append(tilemapserviceAttribute); var titleNode = doc.CreateElement("Title"); titleNode.AppendChild(doc.CreateTextNode(layer.Title)); root.AppendChild(titleNode); var srs = doc.CreateElement("SRS"); srs.AppendChild(doc.CreateTextNode(EPSG3857)); root.AppendChild(srs); // GoogleMapsCompatible tile grid const double MinX = -20037508.342789; const double MinY = -20037508.342789; const double MaxX = 20037508.342789; const double MaxY = 20037508.342789; var boundingBox = doc.CreateElement("BoundingBox"); var minxAttribute = doc.CreateAttribute("minx"); minxAttribute.Value = MinX.ToString("F6", CultureInfo.InvariantCulture); boundingBox.Attributes.Append(minxAttribute); var minyAttribute = doc.CreateAttribute("miny"); minyAttribute.Value = MinY.ToString("F6", CultureInfo.InvariantCulture); boundingBox.Attributes.Append(minyAttribute); var maxxAttribute = doc.CreateAttribute("maxx"); maxxAttribute.Value = MaxX.ToString("F6", CultureInfo.InvariantCulture); boundingBox.Attributes.Append(maxxAttribute); var maxyAttribute = doc.CreateAttribute("maxy"); maxyAttribute.Value = MaxY.ToString("F6", CultureInfo.InvariantCulture); boundingBox.Attributes.Append(maxyAttribute); root.AppendChild(boundingBox); var origin = doc.CreateElement("Origin"); var yAttribute = doc.CreateAttribute("y"); yAttribute.Value = MinY.ToString("F6", CultureInfo.InvariantCulture); origin.Attributes.Append(yAttribute); var xAttribute = doc.CreateAttribute("x"); xAttribute.Value = MinX.ToString("F6", CultureInfo.InvariantCulture); origin.Attributes.Append(xAttribute); root.AppendChild(origin); var tileFormat = doc.CreateElement("TileFormat"); var extensionAttribute = doc.CreateAttribute("extension"); extensionAttribute.Value = layer.Format; // TODO: jpg/jpeg ? tileFormat.Attributes.Append(extensionAttribute); var mimetypeAttribute = doc.CreateAttribute("mime-type"); mimetypeAttribute.Value = layer.ContentType; tileFormat.Attributes.Append(mimetypeAttribute); var heightAttribute = doc.CreateAttribute("height"); heightAttribute.Value = TileHeight.ToString(CultureInfo.InvariantCulture); tileFormat.Attributes.Append(heightAttribute); var widthAttribute = doc.CreateAttribute("width"); widthAttribute.Value = TileWidth.ToString(CultureInfo.InvariantCulture); tileFormat.Attributes.Append(widthAttribute); root.AppendChild(tileFormat); var tileSets = doc.CreateElement("TileSets"); root.AppendChild(tileSets); for (var level = layer.MinZoom; level <= layer.MaxZoom; level++) { var tileSet = doc.CreateElement("TileSet"); var href = $"{this.baseUrl}/tms/{TileMapServiceVersion}/{layer.Identifier}/{level}"; var hrefAttribute = doc.CreateAttribute("href"); hrefAttribute.Value = href; tileSet.Attributes.Append(hrefAttribute); var orderAttribute = doc.CreateAttribute("order"); orderAttribute.Value = $"{level}"; tileSet.Attributes.Append(orderAttribute); // TODO: ? units-per-pixel = 78271.516 / 2^n // TODO: ? an initial zoom level that consists of four 256x256 pixel tiles covering the whole earth var unitsperpixel = (MaxX - MinX) / (((double)TileWidth) * Math.Pow(2, level)); var unitsperpixelAttribute = doc.CreateAttribute("units-per-pixel"); unitsperpixelAttribute.Value = unitsperpixel.ToString(CultureInfo.InvariantCulture); tileSet.Attributes.Append(unitsperpixelAttribute); tileSets.AppendChild(tileSet); } return(doc); }
private bool IsFormValid() { try { if (textMinX.Text == null || textMinX.Text.Trim() == "") { return(false); } if (textMaxX.Text == null || textMaxX.Text.Trim() == "") { return(false); } if (textMinY.Text == null || textMinY.Text.Trim() == "") { return(false); } if (textMaxY.Text == null || textMaxY.Text.Trim() == "") { return(false); } MinX = Convert.ToDouble(textMinX.Text, System.Globalization.CultureInfo.InvariantCulture); MaxX = Convert.ToDouble(textMaxX.Text, System.Globalization.CultureInfo.InvariantCulture); MinY = Convert.ToDouble(textMinY.Text, System.Globalization.CultureInfo.InvariantCulture); MaxY = Convert.ToDouble(textMaxY.Text, System.Globalization.CultureInfo.InvariantCulture); if ((MinX > MaxX) || (MinY > MaxY)) { throw new Exception("area not valid"); } InterruptString = Convert.ToString("Zone " + MinX.ToString() + " " + MaxX.ToString() + " " + MinY.ToString() + " " + MaxY.ToString()); System.Text.RegularExpressions.Match mz = ZoneEx.Match(InterruptString); if (mz.Success == false) { InterruptString = null; MessageBox.Show("area string not valid"); return(false); } } catch (Exception x) { InterruptString = null; MessageBox.Show(x.Message, "Error"); return(false); } return(true); }
public void Redraw() { //graphics.FillRectangle(new SolidBrush(Color.White), 0, 0, bitmap.Width, bitmap.Height); Recalc(); Pen LinePen = new Pen(Color.LightSteelBlue); LinePen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash; LinePen.DashOffset = 5; int[] y1 = new int[Funcs.Length]; int[] y2 = new int[Funcs.Length]; //-------------------- // Drawing part //-------------------- string str = MinY.ToString(FloatGraphFormat); SizeF str_size = graphics.MeasureString(str, TextFont); graphics.DrawString(str, TextFont, TextBrush, AxisX - str_size.Width - fontDx, border.Top + border.Height - str_size.Height / 2); str = MaxY.ToString(FloatGraphFormat); str_size = graphics.MeasureString(str, TextFont); graphics.DrawString(str, TextFont, TextBrush, AxisX - str_size.Width - fontDx, border.Top - str_size.Height / 2); int tx, ty; for (int i = 0; i < Points.Count; i++) { tx = (int)Math.Round((Points[i].X - X1) / ScaleX + border.Left); ty = border.Top + border.Height - (int)Math.Round(MinY * ScaleY); //graphics.DrawLine(LinePen, tx, AxisY, tx, border.Top + border.Height - (int)Math.Round((Funcs[0].Func(Points[i].X) - MinY) * ScaleY)); graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; graphics.FillEllipse(new SolidBrush(Color.Red), tx - 3, border.Top + border.Height - (int)Math.Round((Funcs[0].Func(Points[i].X) - MinY) * ScaleY) - 3, 6, 6); graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.Default; str = Points[i].X.ToString(FloatGraphFormat); //graphics.DrawString(str, TextFont, TextBrush, tx - graphics.MeasureString(str, TextFont).Width / 2, AxisY + fontDy); } double dtx, dty; if (DrawGrid) { if (gridXCount != 0) { double gridXStep = (X2 - X1) / gridXCount; dtx = X1; for (int i = 0; i <= gridXCount; i++) { tx = (int)Math.Round((dtx - X1) / ScaleX) + border.Left; graphics.DrawLine(GridPen, tx, border.Top, tx, border.Top + border.Height); str = dtx.ToString(FloatGraphFormat); graphics.DrawString(str, TextFont, TextBrush, tx - graphics.MeasureString(str, TextFont).Width / 2, border.Top + border.Height + fontDy); dtx += gridXStep; } } if (gridYCount != 0) { double gridYStep = (MaxY - MinY) / gridYCount; dty = MinY; for (int i = 0; i <= gridXCount; i++) { ty = border.Top + border.Height - (int)Math.Round((dty - MinY) * ScaleY); graphics.DrawLine(GridPen, border.Left, ty, border.Left + border.Width, ty); str = dty.ToString(FloatGraphFormat); graphics.DrawString(str, TextFont, TextBrush, border.Left - graphics.MeasureString(str, TextFont).Width - fontDx, ty - graphics.MeasureString(str, TextFont).Height / 2); dty += gridYStep; } } } if (DrawAxis) { graphics.DrawLine(AxisPen, border.Left, AxisY, border.Left + border.Width, AxisY); graphics.DrawLine(AxisPen, AxisX, border.Top + border.Height, AxisX, border.Top); } /* str_size = graphics.MeasureString("0", TextFont); * graphics.DrawString("0", TextFont, TextBrush, border.Left - str_size.Width - fontDx, * border.Top + border.Height + (int)Math.Round(MinY * ScaleY) - str_size.Height / 2);*/ for (int j = 0; j < Funcs.Length; j++) { y1[j] = border.Top + border.Height - (int)Math.Round((Funcs[j].Func(X1) - MinY) * ScaleY); } for (int i = 0; i < border.Width - 1; i++) { for (int j = 0; j < Funcs.Length; j++) { if (Funcs[j].Visible) { y2[j] = border.Top + border.Height - (int)Math.Round((Funcs[j].Func(i * ScaleX + X1) - MinY) * ScaleY); graphics.DrawLine(Funcs[j].Pen, i + border.Left, y1[j], i + border.Left + 1, y2[j]); y1[j] = y2[j]; } } } /*graphics.DrawLine(TextPen, (int)Math.Round((X0 - X1) / ScaleX + AxisX), * border.Top + border.Height + (int)Math.Round(MinY * ScaleY), * (int)Math.Round((X0 - X1) / ScaleX + AxisX), * border.Top + border.Height - (int)Math.Round((Funcs[1].Func(X0) - MinY) * ScaleY)); * * str = X0.ToString(FloatGraphFormat); * graphics.DrawString(str, TextFont, TextBrush, (int)Math.Round((X0 - X1) / ScaleX + AxisX) - graphics.MeasureString(str, TextFont).Width / 2, * border.Top + border.Height + (int)Math.Round(MinY * ScaleY) - graphics.MeasureString(str, TextFont).Height - fontDy);*/ pictBox.Refresh(); }
public override int GetHashCode() { return(MinX.GetHashCode() >> 3 ^ MaxX.GetHashCode() << 3 ^ MinY.GetHashCode() >> 2 ^ MaxY.GetHashCode() << 2); }
public override string ToString() { return("(" + MinX.ToString() + ',' + MaxX.ToString() + ',' + MinY.ToString() + ',' + MaxY.ToString() + ')'); }