/// <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);
        }
        /// <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);
        }
Beispiel #3
0
        public override string ToString()
        {
            NumberFormatInfo format = CultureInfo.InvariantCulture.NumberFormat;

            return(string.Format("{0},{1},{2},{3}", MinX.ToString(format), MinY.ToString(format), MaxX.ToString(format),
                                 MaxY.ToString(format)));
        }
Beispiel #4
0
        public void TxtIntoChart()
        {
            try
            {
                ChartForm chartForm = new ChartForm();
                var       myChart   = chartForm.chart1;
                //double minX = 10000;
                //double minY = 10000;
                foreach (var oneRowData in rowDatas)
                {
                    int getSeries = int.Parse(oneRowData.plan_value);
                    if (getSeries < 0 || getSeries > 20)
                    {
                        Console.WriteLine();
                    }
                    double getX = double.Parse(oneRowData.plan_x);
                    double getY = double.Parse(oneRowData.plan_y);
                    if (getX < MinX)
                    {
                        MinX = getX;
                    }
                    if (getY < MinY)
                    {
                        MinY = getX;
                    }
                    myChart.Series[getSeries].Points.AddXY(getX, getY);
                }
                SignofXY signofX = SignofXY.P;
                if (MinX < 0)
                {
                    signofX = SignofXY.N;
                    MinX    = -MinX;
                }
                SignofXY signofY = SignofXY.P;
                if (MinY < 0)
                {
                    signofY = SignofXY.N;
                    MinY    = -MinY;
                }

                myChart.ChartAreas[0].RecalculateAxesScale();

                string destFileSaveName = Path.GetFileNameWithoutExtension(SrcFileFullPath);
                destFileSaveName += "_" + signofX.ToString() + MinX.ToString("00000") + signofY.ToString() + MinY.ToString("00000");// + ".png";

                SaveNameWithShift = destFileSaveName;

                chartForm.ResetImageAndPb();

                chartForm.Show();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
            }
        }
        public void Interprete(string[] filetext)
        {
            UsedCulture = new CultureInfo("da-DK");
            string firstline = filetext[0].Trim();

            string[] metadata = firstline.Split('\t');
            YUnit = metadata[2];
            Count = filetext.Length - 1;
            X     = new DateTime[Count];
            Y     = new double[Count];

            string[] currentline;
            for (int i = 1; i < filetext.Length; i++)
            {
                currentline = filetext[i].Split('\t');
                string datetime = currentline[0].Trim().Replace('.', '/') + " " +
                                  currentline[1].Trim().Replace('.', ':');
                X[i - 1] = DateTime.Parse(datetime);
                Y[i - 1] = float.Parse(currentline[2].Trim());
                Note     = currentline[4];
            }

            Total = 0.0;
            foreach (double d in Y)
            {
                Total += d;
            }

            MinX = X[0];
            MaxX = X[Count - 1];

            MinY = Y[0];
            MaxY = Y[0];
            foreach (double f in Y)
            {
                if (f < MinY)
                {
                    MinY = f;
                }
                if (MaxY < f)
                {
                    MaxY = f;
                }
            }

            string newPathFormat;

            (XFormat, newPathFormat) = NumberFormatter.DefineDateTimeFormat(X);
            YFormat     = NumberFormatter.DefineFloatFormat(Y);
            XUnit       = "Dato/tid";
            Note        = metadata[4] + ": " + Note;
            NewFileName = NumberFormatter.DefineFilename(MinX, MaxX);
            NewFilepath = MinX.ToString(newPathFormat);
        }
Beispiel #6
0
 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);
     }
 }
Beispiel #7
0
        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);
        }
Beispiel #8
0
 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));
     }
 }
Beispiel #9
0
        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);
            }
        }
Beispiel #10
0
        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()));
        }
Beispiel #11
0
        protected override void WriteDataXML(XElement ele, ElderScrollsPlugin master)
        {
            XElement subEle;

            ele.TryPathTo("UsableSize/X", true, out subEle);
            subEle.Value = UsableXSize.ToString();

            ele.TryPathTo("UsableSize/Y", true, out subEle);
            subEle.Value = UsableYSize.ToString();

            ele.TryPathTo("MinX", true, out subEle);
            subEle.Value = MinX.ToString();

            ele.TryPathTo("MinY", true, out subEle);
            subEle.Value = MinY.ToString();

            ele.TryPathTo("MaxX", true, out subEle);
            subEle.Value = MaxX.ToString();

            ele.TryPathTo("MaxY", true, out subEle);
            subEle.Value = MaxY.ToString();
        }
        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);
        }
Beispiel #13
0
 public override string ToString()
 {
     return($"{MinX.ToString(CultureInfo.InvariantCulture)} - {MaxX.ToString(CultureInfo.InvariantCulture)}, {MinY.ToString(CultureInfo.InvariantCulture)} - {MaxY.ToString(CultureInfo.InvariantCulture)}");
 }
Beispiel #14
0
 public override string ToString()
 {
     return("(" + MinX.ToString() + ',' + MaxX.ToString() + ',' + MinY.ToString() + ',' + MaxY.ToString() + ')');
 }
Beispiel #15
0
 /// <summary>
 /// Show some debugging text
 /// </summary>
 private void ShowDebugText()
 {
     DebugText.Value = "pxs=" + PixelScale.ToString("0.0000") + Text.NewLine +
                       "minX=" + MinX.ToString("0.00") + Text.NewLine +
                       "missiles=" + alienMissiles.Count();
 }