Example #1
0
 public GenericPoint(GenericPoint gp)
 {
     this._id            = gp._id;
     this._x             = gp._x;
     this._y             = gp._y;
     this._isEndOfStroke = gp._isEndOfStroke;
 }
            public GenericPoint(GenericPoint gp)
            {
                GenericPoint temp = (GenericPoint)gp.Clone();

                this._id            = temp._id;
                this._x             = temp._x;
                this._y             = temp._y;
                this._isEndOfStroke = temp._isEndOfStroke;
            }
Example #3
0
    public void GenerateMarkers()
    {
        Response.Write("<script type=\"text/javascript\">\r\n");
        Response.Write("function addMarkers(){\r\n");
        foreach (Route r in Routes)
        {
            string url = r.GetRouteUrl(editMode);

            string gpxFile = PathFunctions.GetGpxPathFromRouteName(r.Name);

            GpxParser parser = Helper.GetGpxParser(gpxFile);
            if (parser == null)
            {
                continue;
            }

            //TrackPoint p = parser.Tracks[0].Segments[0].Points[0];
            GenericPoint p           = parser.MediumPoint;
            string       color       = r.Draft ? "red" : "blue";
            string       title       = r.Title.Replace("'", "\\'") + (r.Draft ? " (bozza)" : "");
            string       name        = r.Name;
            string       description = string.Format("<iframe scrolling=\"no\" frameborder=\"no\" src=\"/RouteData.aspx?name={0}\"/>", r.Name);
            string       icon        = r.Draft ? "/Images/draft_marker.png" : "";
            string       imageFolder = PathFunctions.GetImagePathFromGpx(gpxFile);
            string       imageFile   = Path.Combine(imageFolder, string.IsNullOrEmpty(r.Image) ? "" : r.Image);
            if (!File.Exists(imageFile))
            {
                string[] files = Directory.GetFiles(imageFolder, "*.jpg");
                if (files.Length > 0)
                {
                    imageFile = files[0];
                }
                else
                {
                    imageFile = "";
                }
            }
            string thumbFile = imageFile.Length == 0 ? "" : PathFunctions.GetThumbFile(imageFile);
            string photo     = thumbFile.Length == 0 ? "" : PathFunctions.GetUrlFromPath(thumbFile, false).Replace("'", "\\'");
            Response.Write(string.Format(
                               "GV_Draw_Marker({{ lat: {0}, lon: {1}, name: '{2}', desc: '{3}', color: '{4}', icon: '{5}', photo: '{6}', url: '{7}', route_name:'{8}', draw_track: true }});\r\n",
                               p.lat.ToString(System.Globalization.CultureInfo.InvariantCulture),
                               p.lon.ToString(System.Globalization.CultureInfo.InvariantCulture),
                               title,
                               description,
                               color,
                               icon,
                               photo,
                               url,
                               name));
        }


        Response.Write("}\r\n");
        Response.Write("</script>\r\n");
    }