Ejemplo n.º 1
0
        /// <summary>
        /// KML読み込み
        /// </summary>
        /// <param name="fileContent"></param>
        private void LoadKml(string fileContent)
        {
            KmlLoaderImpl loader = new KmlLoaderImpl();

            coordinateList = loader.load(fileContent);

            labelMaxAltitude.Text = coordinateList.MaxAltitude.ToString();
            labelMinAltitude.Text = coordinateList.MinAltitude.ToString();
        }
Ejemplo n.º 2
0
        private void SetCoordinates(CoordinateList list, string coordinates)
        {
            string[] lines = coordinates.Split(new string[] { "\n" }, StringSplitOptions.None);
            foreach (string line in lines)
            {
                Coordinate coordinate = new Coordinate();
                string[]   colms      = line.Split(new string[] { "," }, StringSplitOptions.None);
                coordinate.Longitude = Double.Parse(colms[0]);
                coordinate.Latitude  = Double.Parse(colms[1]);
                coordinate.Altitude  = Int32.Parse(colms[2]);

                list.Add(coordinate);
            }
        }
Ejemplo n.º 3
0
        public CoordinateList load(string fileContent)
        {
            CoordinateList list = new CoordinateList();

            XNamespace ns = GetKmlNameSpace(fileContent);

            XDocument doc         = XDocument.Parse(fileContent);
            string    coordinates = "";

            foreach (var ele in doc.Descendants(ns + "coordinates"))
            {
                coordinates = ele.Value.Trim();
            }
            SetCoordinates(list, coordinates);
            return(list);
        }
Ejemplo n.º 4
0
        public void DrawAltitude(CoordinateList coordinateList)
        {
            this.coordinateList = coordinateList;
            maxAltitude         = (int)coordinateList.MaxAltitude;
            minAltitude         = (int)coordinateList.MinAltitude;
            xMagnification      = (double)picWidth / coordinateList.Count;
            yMagnification      = (double)picHeight / (maxAltitude - minAltitude);

            Bitmap newCanvas = new Bitmap(picWidth, picHeight);

            using (Graphics g = Graphics.FromImage(newCanvas))
            {
                DrawAltitudeGraph(g);
            }
            pictureBoxAltitude.Image = newCanvas;
            baseCanvas = newCanvas;
        }
Ejemplo n.º 5
0
        public void DrawMap(CoordinateList coordinateList)
        {
            currentIndex        = 0;
            this.coordinateList = coordinateList;
            maxLongitude        = coordinateList.MaxLongitude;
            minLongitude        = coordinateList.MinLongitude;
            maxLatitude         = coordinateList.MaxLatitude;
            minLatitude         = coordinateList.MinLatitude;

            xMagnification = (double)picWidth / (maxLongitude - minLongitude);
            yMagnification = (double)picHeight / (maxLatitude - minLatitude);

            Bitmap newCanvas = new Bitmap(picWidth, picHeight);

            using (Graphics g = Graphics.FromImage(newCanvas))
            {
                DrawMapGraph(g);
            }
            pictureBoxMap.Image = newCanvas;
            baseCanvas          = newCanvas;
        }