Beispiel #1
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            var circle = new GoogleCircle {
                Center = new LatLng(42.1229, 24.7879),
                Radius = 200000
            };
            var polygon = new GooglePolygon {
                FillColor = Color.Red,
                FillOpacity = .5F,
                StrokeColor = Color.Black,
                StrokeWeight = 5,
                Paths = new List<LatLng> {
                    new LatLng(37.97918, 23.716647),
                    new LatLng(41.036501, 28.984895),
                    new LatLng(44.447924, 26.097879),
                    new LatLng(44.802416, 20.465601),
                    new LatLng(42.002411, 21.436097),
                    new LatLng(37.97918, 23.716647),
                    new LatLng(37.97918, 23.716647)
                }
            };
            var rectangle = new GoogleRectangle {
                FillColor = Color.Green,
                Bounds = new Bounds {
                    SouthWest = new LatLng(44.802416, 20.465601),
                    NorthEast = new LatLng(37.97918, 23.716647)
                }
            };
            GoogleMap1.Overlays.Add(circle);
            GoogleMap1.Overlays.Add(polygon);
            GoogleMap1.Overlays.Add(rectangle);
        }
Beispiel #2
0
    public static GooglePolygon GetBlankPoligon()
    {
        GooglePolygon BP = new GooglePolygon();

        GooglePoint GP1 = new GooglePoint();
        GP1.ID = "GP1";
        GP1.Latitude = 50.0;
        GP1.Longitude = 0.0;

        GooglePoint GP2 = new GooglePoint();
        GP2.ID = "GP2";
        GP2.Latitude = 50.0;
        GP2.Longitude = 50.0;

        GooglePoint GP3 = new GooglePoint();
        GP3.ID = "GP3";
        GP3.Latitude = 30.00;
        GP3.Longitude = 50.0;

        GooglePoint GP4 = new GooglePoint();
        GP4.ID = "GP4";
        GP4.Latitude = 30.0;
        GP4.Longitude = 0.0;

        GooglePoint GP5 = new GooglePoint();
        GP5.ID = "GP5";
        GP5.Latitude = 49.95;
        GP5.Longitude = 0.0;

        BP.ID = "BLANK";
        //Give Hex code for line color
        Color color = Color.FromName(Color.Black.Name);
        string ColorCode = String.Format("#{0:X2}{1:X2}{2:X2}", color.R, color.G, color.B);

        BP.FillColor = ColorCode;
        BP.FillOpacity = 1;
        BP.StrokeColor = ColorCode;
        BP.StrokeOpacity = 1;
        BP.StrokeWeight = 1;

        BP.Points.Add(GP5);
        BP.Points.Add(GP4);
        BP.Points.Add(GP3);
        BP.Points.Add(GP2);
        BP.Points.Add(GP1);

        return BP;
    }
Beispiel #3
0
    private void DrawPolygon()
    {
        GoogleMapForASPNet2.GoogleMapObject.Polygons.Clear();

        string report = SQL_session.fetch_polyPoints("SELECT * FROM SCHOOLS WHERE SCHOOL_ID = '" + (campus1_drop.SelectedIndex + 1) + "' ", "G1", "G2", "G3", "G4", "G5", "G6", "G7", "G8", "G9");

        string[] loc_array = report.Split('&');

        int GP_counter = 0;

        GooglePoint[] GooglePoint_array = new GooglePoint[loc_array.Length / 2];

        //Create Polygon using GooglePoint_array points
        GooglePolygon PG1 = new GooglePolygon();

        PG1.ID = "PG1";
        //Give Hex code for line color
        PG1.FillColor     = "#CCCCFF";
        PG1.FillOpacity   = 0.4;
        PG1.StrokeColor   = "#0000FF";
        PG1.StrokeOpacity = 1;
        PG1.StrokeWeight  = 2;

        for (int i = 0; i < loc_array.Length; i++)
        {
            string point_id = "GP" + (GP_counter + 1);
            GooglePoint_array[GP_counter]    = new GooglePoint();
            GooglePoint_array[GP_counter].ID = point_id + GP_counter;

            double lat, longi;
            double.TryParse(loc_array[i], out lat);
            double.TryParse(loc_array[i + 1], out longi);
            GooglePoint_array[GP_counter].Latitude  = lat;
            GooglePoint_array[GP_counter].Longitude = longi;

            // add points to polygon
            PG1.Points.Add(GooglePoint_array[GP_counter]);

            i++;
            GP_counter++;
        }

        PG1.Points.Add(GooglePoint_array[0]);

        //Add polygon to GoogleMap object
        GoogleMapForASPNet2.GoogleMapObject.Polygons.Add(PG1);
    } // end DrawPOlygon
Beispiel #4
0
    public override bool Equals(System.Object obj)
    {
        // If parameter is null return false.
        if (obj == null)
        {
            return(false);
        }

        // If parameter cannot be cast to Point return false.
        GooglePolygon p = obj as GooglePolygon;

        if ((System.Object)p == null)
        {
            return(false);
        }

        // Return true if the fields match:
        return((FillColor == p.FillColor) && (FillOpacity == p.FillOpacity) && (p.ID == ID) && (p.Status == Status) && (p.StrokeColor == StrokeColor) && (p.StrokeOpacity == StrokeOpacity) && (p.StrokeWeight == StrokeWeight) && (p.Points.Equals(Points)));
    }
Beispiel #5
0
    public static GooglePolygons CloneMe(GooglePolygons prev)
    {
        GooglePolygons p = new GooglePolygons();

        for (int i = 0; i < prev.Count; i++)
        {
            GooglePolygon GPL = new GooglePolygon();
            GPL.FillColor     = prev[i].FillColor;
            GPL.FillOpacity   = prev[i].FillOpacity;
            GPL.ID            = prev[i].ID;
            GPL.Status        = prev[i].Status;
            GPL.StrokeColor   = prev[i].StrokeColor;
            GPL.StrokeOpacity = prev[i].StrokeOpacity;
            GPL.StrokeWeight  = prev[i].StrokeWeight;
            GPL.Points        = GooglePoints.CloneMe(prev[i].Points);
            p.Add(GPL);
        }
        return(p);
    }
Beispiel #6
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            var circle = new GoogleCircle
            {
                Center = new LatLng(42.1229, 24.7879),
                Radius = 200000
            };
            var polygon = new GooglePolygon
            {
                FillColor    = Color.Red,
                FillOpacity  = .5F,
                StrokeColor  = Color.Black,
                StrokeWeight = 5,
                Paths        = new List <LatLng> {
                    new LatLng(37.97918, 23.716647),
                    new LatLng(41.036501, 28.984895),
                    new LatLng(44.447924, 26.097879),
                    new LatLng(44.802416, 20.465601),
                    new LatLng(42.002411, 21.436097),
                    new LatLng(37.97918, 23.716647),
                    new LatLng(37.97918, 23.716647)
                }
            };
            var rectangle = new GoogleRectangle
            {
                FillColor = Color.Green,
                Bounds    = new Bounds
                {
                    SouthWest = new LatLng(44.802416, 20.465601),
                    NorthEast = new LatLng(37.97918, 23.716647)
                }
            };

            GoogleMap1.Overlays.Add(circle);
            GoogleMap1.Overlays.Add(polygon);
            GoogleMap1.Overlays.Add(rectangle);
        }
Beispiel #7
0
    //protected void db_test2_btn_Click(object sender, EventArgs e)
    //{
    //    string join_report = "empty";
    //    join_report = SQL_session.fetch_2params("SELECT * FROM EVENT_DATA ed JOIN EVENT_DATA_TYPES edt ON ed.EVENT_ID = edt.EVENT_ID JOIN EVENT_TYPES et ON et.EVENT_TYPE_ID = edt.EVENT_TYPE_ID JOIN SCHOOLS s ON ed.LOCATION_LAT BETWEEN s.LAT_START AND s.LAT_END AND ed.LOCATION_LONG BETWEEN s.LONG_START AND s.LONG_END WHERE s.SCHOOL_ID = 1 AND edt.EVENT_TYPE_ID = '" + crime_drop.SelectedValue + "'", "LOCATION_LAT", "LOCATION_LONG");

    //    mb.ShowMessageBox("Query result is: " + join_report);
    //}

    private void showLoc_populatePushpins(Double lat, Double longi)
    {
        //Specify width and height for map. You can specify either in pixels or in percentage relative to it's container.
        GoogleMapForASPNet2.GoogleMapObject.Width  = "100%"; // You can also specify percentage(e.g. 80%) here
        GoogleMapForASPNet2.GoogleMapObject.Height = "100%";

        //Specify initial Zoom level.
        GoogleMapForASPNet2.GoogleMapObject.ZoomLevel = 20;

        //Specify Center Point for map. Map will be centered on this point.
        //GoogleMapForASPNet2.GoogleMapObject.CenterPoint = new GooglePoint("1", 43.69, -79.4042);
        GoogleMapForASPNet2.GoogleMapObject.CenterPoint = new GooglePoint("1", lat, longi);

        //Define Points for polygon
        GooglePoint GP1 = new GooglePoint();

        GP1.ID        = "GP1";
        GP1.Latitude  = 43.66675;
        GP1.Longitude = -79.4042;

        GooglePoint GP2 = new GooglePoint();

        GP2.ID        = "GP2";
        GP2.Latitude  = 43.67072;
        GP2.Longitude = -79.38677;

        GooglePoint GP3 = new GooglePoint();

        GP3.ID        = "GP3";
        GP3.Latitude  = 43.66706;
        GP3.Longitude = -79.37879;

        GooglePoint GP4 = new GooglePoint();

        GP4.ID        = "GP4";
        GP4.Latitude  = 43.66135;
        GP4.Longitude = -79.383;

        GooglePoint GP5 = new GooglePoint();

        GP5.ID        = "GP5";
        GP5.Latitude  = 43.65787;
        GP5.Longitude = -79.40016;

        GooglePoint GP6 = new GooglePoint();

        GP6.ID        = "GP6";
        GP6.Latitude  = 43.66066;
        GP6.Longitude = -79.40943;

        GooglePoint GP7 = new GooglePoint();

        GP7.ID        = "GP7";
        GP7.Latitude  = 43.66656;
        GP7.Longitude = -79.40445;

        //Create Polygon using above points
        GooglePolygon PG1 = new GooglePolygon();

        PG1.ID = "PG1";
        //Give Hex code for line color
        PG1.FillColor     = "#DDDDFF";
        PG1.FillOpacity   = 0.4;
        PG1.StrokeColor   = "#0000FF";
        PG1.StrokeOpacity = 1;
        PG1.StrokeWeight  = 2;

        PG1.Points.Add(GP1);
        PG1.Points.Add(GP2);
        PG1.Points.Add(GP3);
        PG1.Points.Add(GP4);
        PG1.Points.Add(GP5);
        PG1.Points.Add(GP6);
        PG1.Points.Add(GP7);

        //Add polygon to GoogleMap object
        GoogleMapForASPNet2.GoogleMapObject.Polygons.Add(PG1);

        // add pushpins
        GooglePoint GP10 = new GooglePoint();

        GP10.ID        = "Toronto";
        GP10.Latitude  = 43.668;
        GP10.Longitude = -79.385;
        //Specify bubble text here. You can use standard HTML tags here.
        GP10.InfoHTML = "This is Pushpin 1";

        //Specify icon image. This should be relative to root folder.
        //GP10.IconImage = "icons/Burglary.png";
        GoogleMapForASPNet2.GoogleMapObject.Points.Add(GP10);

        GooglePoint GP11 = new GooglePoint();

        GP11.ID        = "Montreal";
        GP11.Latitude  = 43.665; //+0.001
        GP11.Longitude = -79.39;
        GP11.InfoHTML  = "This is Pushpin 2";
        GP11.IconImage = "icons/Shooting.png";
        GoogleMapForASPNet2.GoogleMapObject.Points.Add(GP11);

        GooglePoint GP12 = new GooglePoint();

        GP12.ID        = "Halifax";
        GP12.Latitude  = 43.66;
        GP12.Longitude = -79.403;
        GP12.InfoHTML  = "This is Pushpin 3";
        GP12.IconImage = "icons/Arrest.png";

        GoogleMapForASPNet2.GoogleMapObject.Points.Add(GP12);
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            //Specify width and height for map. You can specify either in pixels or in percentage relative to it's container.
            GoogleMapForASPNet1.GoogleMapObject.Width  = "700px"; // You can also specify percentage(e.g. 80%) here
            GoogleMapForASPNet1.GoogleMapObject.Height = "400px";

            //Specify initial Zoom level.
            GoogleMapForASPNet1.GoogleMapObject.ZoomLevel = 14;

            //Specify Center Point for map. Map will be centered on this point.
            GoogleMapForASPNet1.GoogleMapObject.CenterPoint = new GooglePoint("1", 43.66619, -79.44268);

            //Add pushpins for map.
            //This should be done with intialization of GooglePoint class.
            //ID is to identify a pushpin. It must be unique for each pin. Type is string.
            //Other properties latitude and longitude.
            GooglePoint GP1 = new GooglePoint();
            GP1.ID        = "pushpin";
            GP1.Latitude  = 43.65669;
            GP1.Longitude = -79.44268;
            //Specify bubble text here. You can use standard HTML tags here.
            GP1.InfoHTML = "This is Pushpin 1";

            //Specify icon image. This should be relative to root folder.
            GP1.IconImage = "icons/pushpin-blue.png";
            GoogleMapForASPNet1.GoogleMapObject.Points.Add(GP1);

            GooglePoint GP2 = new GooglePoint();
            GP2.ID        = "horse";
            GP2.Latitude  = 43.66619;
            GP2.Longitude = -79.44268;
            GP2.InfoHTML  = "This is Pushpin 2";
            GP2.IconImage = "icons/horse.png";
            GoogleMapForASPNet1.GoogleMapObject.Points.Add(GP2);

            GooglePoint GP3 = new GooglePoint();
            GP3.ID        = "arrows";
            GP3.Latitude  = 43.67689;
            GP3.Longitude = -79.43270;
            GP3.InfoHTML  = "This is Pushpin 3";
            GP3.IconImage = "icons/recycle.png";
            GoogleMapForASPNet1.GoogleMapObject.Points.Add(GP3);

            GooglePolyline poly1 = new GooglePolyline();
            poly1.ID = "Poly1";
            poly1.Points.Add(GP1);
            poly1.Points.Add(GP2);
            poly1.Width = 3;
            GoogleMapForASPNet1.GoogleMapObject.Polylines.Add(poly1);

            GooglePolyline poly2 = new GooglePolyline();
            poly2.ID = "Poly2";
            poly2.Points.Add(GP2);
            poly2.Points.Add(GP3);
            poly2.Width = 3;
            GoogleMapForASPNet1.GoogleMapObject.Polylines.Add(poly2);

            GooglePolygon polygon1 = new GooglePolygon();
            polygon1.ID = "Polygon1";

            polygon1.Points.Add(new GooglePoint("p1", 43.67689, -79.42370));
            polygon1.Points.Add(new GooglePoint("p2", 43.66689, -79.42570));
            polygon1.Points.Add(new GooglePoint("p3", 43.65789, -79.41570));

            GoogleMapForASPNet1.GoogleMapObject.Polygons.Add(polygon1);
        }
    }
Beispiel #9
0
 public void Add(GooglePolygon pPolygon)
 {
     this.List.Add(pPolygon);
 }
Beispiel #10
0
 public static GooglePolygons CloneMe(GooglePolygons prev)
 {
     GooglePolygons p = new GooglePolygons();
     for (int i = 0; i < prev.Count; i++)
     {
         GooglePolygon GPL = new GooglePolygon();
         GPL.FillColor = prev[i].FillColor;
         GPL.FillOpacity = prev[i].FillOpacity;
         GPL.ID = prev[i].ID;
         GPL.Status = prev[i].Status;
         GPL.StrokeColor = prev[i].StrokeColor;
         GPL.StrokeOpacity = prev[i].StrokeOpacity;
         GPL.StrokeWeight = prev[i].StrokeWeight;
         GPL.Points = GooglePoints.CloneMe(prev[i].Points);
         p.Add(GPL);
     }
     return p;
 }
Beispiel #11
0
    public void mapLoad(bool isRoute)
    {
        string map_type         = "";
        int    i                = 0;
        string strInfoHtml      = "";
        int    Vessel_Count     = 0;
        int    Err_Vessel_Count = 0;

        string Err_Vessel_Msg = "<table>";

        lbtn_error.Visible = false;

        int Vessel_ID = int.Parse(ddl_veslist.SelectedValue);
        int Fleet_ID  = int.Parse(ddlTechmanager.SelectedValue);

        try
        {
            DataTable dtData = new DataTable();

            if (isRoute)
            {
                GoogleMapForASPNet1.GoogleMapObject.Points.Clear();
                dtData = BLL_OPS_DPL.Get_TelegramData_Route(Vessel_ID, Fleet_ID, Convert.ToDateTime(txtFromDT.Text), Convert.ToDateTime(txtTODT.Text), strReportType);

                // GoogleMapForASPNet1.GoogleMapObject.ZoomLevel = 5;
            }
            else
            {
                GoogleMapForASPNet1.GoogleMapObject.AutomaticBoundaryAndZoom = false;
                GoogleMapForASPNet1.GoogleMapObject.Points.Clear();
                dtData = BLL_OPS_DPL.Get_TelegramData(Vessel_ID, Fleet_ID, strReportType);
                GoogleMapForASPNet1.GoogleMapObject.ZoomLevel = 3;
            }

            //You must specify Google Map API Key for this component. You can obtain this key from http://code.google.com/apis/maps/signup.html
            //For samples to run properly, set GoogleAPIKey in Web.Config file

            //  GoogleMapForASPNet1.GoogleMapObject.APIKey = ConfigurationManager.AppSettings["GoogleAPIKey"];
            GoogleMapForASPNet1.GoogleMapObject.Width  = "100%"; // You can also specify percentage(e.g. 80%) here
            GoogleMapForASPNet1.GoogleMapObject.Height = "850px";


            map_type = htxt_sat_nor_hybrid.Text.ToString();

            if (map_type == "satmap")
            {
                GoogleMapForASPNet1.GoogleMapObject.MapType = GoogleMapType.SATELLITE_MAP;
            }

            if (map_type == "hybridmap")
            {
                GoogleMapForASPNet1.GoogleMapObject.MapType = GoogleMapType.HYBRID_MAP;
            }

            if (map_type == "normalmap")
            {
                GoogleMapForASPNet1.GoogleMapObject.MapType = GoogleMapType.NORMAL_MAP;
            }

            if (map_type == "")
            {
                GoogleMapForASPNet1.GoogleMapObject.MapType = GoogleMapType.NORMAL_MAP;
            }

            GoogleMapForASPNet1.GoogleMapObject.MapType = GoogleMapType.HYBRID_MAP;
            GoogleMapForASPNet1.GoogleMapObject.Polylines.Clear();

            if (dtData.Rows.Count > 0)
            {
                StringBuilder sb = new StringBuilder();


                GooglePoint[] gp = new GooglePoint[dtData.Rows.Count];


                int             AreaID     = 0;
                int             VertexID   = 0;
                GooglePolygon[] PiracyArea = new GooglePolygon[2];

                #region -- Draw Piracy Area --
                if (chkPiracyArea.Checked == true)
                {
                    GoogleMapForASPNet1.GoogleMapObject.Polygons.Clear();

                    DataTable dt = BLL_OPS_DPL.Get_PiracyArea();

                    if (dt.Rows.Count > 0)
                    {
                        GooglePolygon PG = new GooglePolygon();
                        PG.FillColor     = "#FF0000";
                        PG.FillOpacity   = 0.3;
                        PG.StrokeColor   = "#FF0000";
                        PG.StrokeOpacity = 1;
                        PG.StrokeWeight  = 1;

                        AreaID = UDFLib.ConvertToInteger(dt.Rows[0]["AreaID"].ToString());

                        GooglePoint GP1 = new GooglePoint();
                        GP1.ID        = "GP" + VertexID.ToString();
                        GP1.Latitude  = UDFLib.ConvertToDouble(dt.Rows[0]["Latitude"].ToString());
                        GP1.Longitude = UDFLib.ConvertToDouble(dt.Rows[0]["Longitude"].ToString());


                        foreach (DataRow dr in dt.Rows)
                        {
                            VertexID++;

                            if (AreaID != UDFLib.ConvertToInteger(dr["AreaID"].ToString()))
                            {
                                PG.ID = "PG" + AreaID.ToString();
                                PG.Points.Add(GP1);
                                GoogleMapForASPNet1.GoogleMapObject.Polygons.Add(PG);
                                PiracyArea[AreaID - 1] = PG;


                                PG               = new GooglePolygon();
                                PG.FillColor     = "#FF0000";
                                PG.FillOpacity   = 0.3;
                                PG.StrokeColor   = "#FF0000";
                                PG.StrokeOpacity = 1;
                                PG.StrokeWeight  = 1;

                                AreaID = UDFLib.ConvertToInteger(dr["AreaID"].ToString());

                                GP1           = new GooglePoint();
                                GP1.ID        = "GP" + VertexID.ToString();
                                GP1.Latitude  = UDFLib.ConvertToDouble(dr["Latitude"].ToString());
                                GP1.Longitude = UDFLib.ConvertToDouble(dr["Longitude"].ToString());
                            }

                            GooglePoint GP = new GooglePoint();
                            GP.ID        = "GP" + VertexID.ToString();
                            GP.Latitude  = UDFLib.ConvertToDouble(dr["Latitude"].ToString());
                            GP.Longitude = UDFLib.ConvertToDouble(dr["Longitude"].ToString());

                            PG.Points.Add(GP);
                        }

                        PG.ID = "PG" + AreaID.ToString();
                        PG.Points.Add(GP1);
                        GoogleMapForASPNet1.GoogleMapObject.Polygons.Add(PG);
                        PiracyArea[AreaID - 1] = PG;
                    }
                }
                else
                {
                    GoogleMapForASPNet1.GoogleMapObject.Polygons.Clear();
                }
                #endregion

                if (!isRoute)
                {
                    #region ---------Draw all vessels icons and baloons--------

                    foreach (DataRow dr in dtData.Rows)
                    {
                        Vessel_Count++;

                        gp[i] = new GooglePoint();

                        //string sangle = dr[5].ToString();
                        string sangle = dr["Vessel_Course"].ToString();


                        CreateImage(dr["Vessel_Short_Name"].ToString());



                        string  latitude = ""; string longitude = "";
                        string  longi_pos1; string longi_pos2; string lati_pos1; string lati_pos2;
                        decimal lat_degree = 0; decimal lat_min = 0; decimal lat_sec = 0; string slat_dir = "";
                        decimal long_degree = 0; decimal long_min = 0; decimal long_sec = 0; string slong_dir = "";


                        try
                        {
                            lat_degree = UDFLib.ConvertToDecimal(dr["Latitude_Degrees"].ToString());
                            lat_min    = UDFLib.ConvertToDecimal(dr["Latitude_Minutes"].ToString());
                            lat_sec    = UDFLib.ConvertToDecimal(dr["Latitude_Seconds"].ToString());
                            slat_dir   = dr["LATITUDE_N_S"].ToString();
                            if (slat_dir != "N" && slat_dir != "S")
                            {
                                slat_dir = "N";
                            }

                            latitude = Conv_Deg2Decimal_new(Convert.ToDouble(lat_degree), Convert.ToDouble(lat_min), Convert.ToDouble(lat_sec), slat_dir.ToString());

                            long_degree = UDFLib.ConvertToDecimal(dr["Longitude_Degrees"].ToString());
                            long_min    = UDFLib.ConvertToDecimal(dr["Longitude_Minutes"].ToString());
                            long_sec    = UDFLib.ConvertToDecimal(dr["Longitude_Seconds"].ToString());
                            slong_dir   = dr["Longitude_E_W"].ToString();
                            if (slong_dir != "E" && slong_dir != "W")
                            {
                                slat_dir = "E";
                            }

                            longitude = Conv_Deg2Decimal_new(Convert.ToDouble(long_degree), Convert.ToDouble(long_min), Convert.ToDouble(long_sec), slong_dir.ToString());

                            if (Convert.ToString(dr["Telegram_Type"]).ToUpper() == "N")
                            {
                                gp[i].IconImage = dr["Vessel_Short_Name"].ToString() + ".png";
                            }

                            else if (Convert.ToString(dr["Telegram_Type"]).ToUpper() == "P")
                            {
                                gp[i].IconImage = dr["Vessel_Short_Name"].ToString() + "-P" + ".png";
                            }


                            gp[i].Latitude  = double.Parse(latitude);
                            gp[i].Longitude = double.Parse(longitude);


                            // - check if in piracy area
                            bool iPointInPolygon = PointInPolygon(gp[i], PiracyArea);
                            if (iPointInPolygon == true)
                            {
                                GooglePoint shipInPiracy = new GooglePoint();
                                shipInPiracy.Latitude  = double.Parse(latitude);
                                shipInPiracy.Longitude = double.Parse(longitude);
                                shipInPiracy.IconImage = "../Images/star.gif";
                                //shipInPiracy.IconImageHeight = 20;
                                //shipInPiracy.IconImageWidth = 20;
                                GoogleMapForASPNet1.GoogleMapObject.Points.Add(shipInPiracy);
                            }



                            string simagename = "";
                            if (sangle == "" || sangle == null)
                            {
                                simagename = "boat_.png";
                            }

                            else
                            {
                                Double angle = Convert.ToDouble(sangle);

                                if ((angle >= 0) && (angle <= 90))
                                {
                                    simagename = "UpSide45_f_.png";
                                }

                                if ((angle >= 90) && (angle <= 180))
                                {
                                    simagename = "UpSide_135_.png";
                                }

                                if ((angle >= 180) && (angle <= 270))
                                {
                                    simagename = "Down_225_.png";
                                }

                                if ((angle >= 270) && (angle <= 360))
                                {
                                    simagename = "Down_315_.png";
                                }
                            }



                            strInfoHtml  = "<table border=0 cellspacing=0 cellpadding=0 style='font-size:10px;font-family:Verdana'>";
                            strInfoHtml += "<tr><td colspan=2 style='font-weight:bold;'>" + dr["Vessel_Name"].ToString() + "&nbsp;&nbsp;<img src='images/" + simagename + "'>" + "</td></tr>";
                            strInfoHtml += "<tr><td style='width:80px'>Report Date:</td><td style='color:blue;font-weight:bold'>" + dr["infodate"].ToString() + "</td></tr>";
                            strInfoHtml += "<tr><td style='width:80px'>Location:</td><td>" + dr["Location_Name"].ToString() + "</td></tr>";
                            strInfoHtml += "<tr><td style='width:80px'>Latitude:</td><td>" + dr["Latitude_Degrees"].ToString() + " " + dr["Latitude_Minutes"].ToString() + " " + dr["Latitude_Seconds"].ToString() + " " + dr["LATITUDE_N_S"].ToString() + "</td></tr>";
                            strInfoHtml += "<tr><td style='width:80px'>Longitude:</td><td>" + dr["Longitude_Degrees"].ToString() + " " + dr["Longitude_Minutes"].ToString() + " " + dr["Longitude_Seconds"].ToString() + " " + dr["Longitude_E_W"].ToString() + "</td></tr>";
                            strInfoHtml += "<tr><td style='width:80px'>Course:</td><td>" + sangle.ToString() + "</td></tr>";
                            strInfoHtml += "<tr><td style='width:80px'>Wind Direction/ Force:</td><td>" + dr["Wind_Direction"].ToString() + "/" + dr["Wind_Force"].ToString() + "</td></tr>";
                            strInfoHtml += "<tr><td style='width:80px'>Average speed:</td><td>" + dr["AVERAGE_SPEED"].ToString() + " knts</td></tr>";
                            strInfoHtml += "<tr><td style='width:80px'>Next port/<br>ETA:</td><td>" + dr["PORT_NAME"].ToString() + "<br>" + dr["etanextport"].ToString() + "</td></tr>";
                            strInfoHtml += "<tr><td style='width:80px'></td><td></td></tr>";

                            string CrewLink = "<a href='" + ConfigurationManager.AppSettings["APP_URL"].ToString() + "Crew/CrewList_PhotoView.aspx?vcode=" + dr["Vessel_Short_Name"].ToString() + "' target='_blank'>Crew List</a>";
                            string NoonLink = "<a href='" + ConfigurationManager.AppSettings["APP_URL"].ToString() + "Operations/NoonReport.aspx?LastNoon=" + dr["Vessel_Short_Name"].ToString() + "&ID=" + dr["PKID"].ToString() + "' target='_blank'>Last Noon</a>";



                            strInfoHtml += "<td>" + CrewLink + "</td><td>" + NoonLink + "</td>";
                            strInfoHtml += "</tr>";
                            strInfoHtml += "</table>";

                            gp[i].InfoHTML = strInfoHtml.ToString();

                            GoogleMapForASPNet1.GoogleMapObject.Points.Add(gp[i]);


                            i++;
                        }
                        catch
                        {
                            Err_Vessel_Count++;

                            lbtn_error.Visible = true;

                            lati_pos1  = "1";
                            lati_pos2  = "2";
                            longi_pos1 = "1";
                            longi_pos2 = "2";

                            gp[i].Latitude  = double.Parse(lati_pos1 + lati_pos2);
                            gp[i].Longitude = double.Parse(longi_pos1 + longi_pos2);

                            Err_Vessel_Msg += "<tr><td>" + dr[1].ToString() + "</td><td>" + dr[2].ToString() + "</td><td>Latitude:" + UDFLib.ConvertToInteger(latitude.ToString()) + "</td><td>Longitude:" + longitude.ToString() + "</td></tr>";


                            continue;
                        }
                    } //End For



                    if (Err_Vessel_Msg == "<table>")
                    {
                        Err_Vessel_Msg = "";
                    }
                    else
                    {
                        Err_Vessel_Msg += "</table>";
                    }

                    if (Err_Vessel_Count > 0)
                    {
                        lblVessels.ForeColor = System.Drawing.Color.Red;
                        lblVessels.Text      = "Total Ships: " + Vessel_Count.ToString() + " (" + Err_Vessel_Count.ToString() + " Ship(s) found with Error!!)";

                        lblLoadingIssues.Text = Err_Vessel_Msg;
                    }
                    else
                    {
                        lblVessels.ForeColor = System.Drawing.Color.Blue;
                        lblVessels.Text      = "Total Ships: " + Vessel_Count.ToString();
                    }
                    #endregion
                }
                else
                {
                    #region ---------------- Route----------


                    double lat_pos_g = 0;
                    double log_pos_g = 0;

                    GooglePolyline objPolyLine = new GooglePolyline();

                    if (strReportType == "N")
                    {
                        objPolyLine.ColorCode = "#7FFF00";
                    }
                    else
                    {
                        objPolyLine.ColorCode = "#FF00FF";
                    }

                    objPolyLine.Width    = 1;
                    objPolyLine.Geodesic = true;

                    foreach (DataRow dr in dtData.Rows)
                    {
                        Vessel_Count++;

                        gp[i] = new GooglePoint();

                        //string sangle = dr[5].ToString();
                        string sangle = dr["Vessel_Course"].ToString();

                        CreateImage(dr["Vessel_Short_Name"].ToString());


                        string  latitude = ""; string longitude = "";
                        string  longi_pos1; string longi_pos2; string lati_pos1; string lati_pos2;
                        decimal lat_degree = 0; decimal lat_min = 0; decimal lat_sec = 0; string slat_dir = "";
                        decimal long_degree = 0; decimal long_min = 0; decimal long_sec = 0; string slong_dir = "";

                        try
                        {
                            lat_degree = UDFLib.ConvertToDecimal(dr["Latitude_Degrees"].ToString());
                            lat_min    = UDFLib.ConvertToDecimal(dr["Latitude_Minutes"].ToString());
                            lat_sec    = UDFLib.ConvertToDecimal(dr["Latitude_Seconds"].ToString());
                            slat_dir   = dr["LATITUDE_N_S"].ToString();
                            if (slat_dir != "N" && slat_dir != "S")
                            {
                                slat_dir = "N";
                            }

                            latitude = Conv_Deg2Decimal_new(Convert.ToDouble(lat_degree), Convert.ToDouble(lat_min), Convert.ToDouble(lat_sec), slat_dir.ToString());

                            long_degree = UDFLib.ConvertToDecimal(dr["Longitude_Degrees"].ToString());
                            long_min    = UDFLib.ConvertToDecimal(dr["Longitude_Minutes"].ToString());
                            long_sec    = UDFLib.ConvertToDecimal(dr["Longitude_Seconds"].ToString());
                            slong_dir   = dr["Longitude_E_W"].ToString();
                            if (slong_dir != "E" && slong_dir != "W")
                            {
                                slat_dir = "E";
                            }

                            longitude = Conv_Deg2Decimal_new(Convert.ToDouble(long_degree), Convert.ToDouble(long_min), Convert.ToDouble(long_sec), slong_dir.ToString());

                            //else if (Convert.ToString(dr["Telegram_Type"]).ToUpper() == "P")
                            //    gp[i].IconImage = dr["Vessel_Short_Name"].ToString() + "-P" + ".png";

                            gp[i].Latitude  = double.Parse(latitude);
                            gp[i].Longitude = double.Parse(longitude);

                            string simagename = "";
                            if (sangle == "" || sangle == null)
                            {
                                simagename = "boat_.png";
                            }

                            else
                            {
                                Double angle = Convert.ToDouble(sangle);

                                if ((angle >= 0) && (angle <= 90))
                                {
                                    simagename = "UpSide45_f_.png";
                                }

                                if ((angle >= 90) && (angle <= 180))
                                {
                                    simagename = "UpSide_135_.png";
                                }

                                if ((angle >= 180) && (angle <= 270))
                                {
                                    simagename = "Down_225_.png";
                                }

                                if ((angle >= 270) && (angle <= 360))
                                {
                                    simagename = "Down_315_.png";
                                }
                            }

                            strInfoHtml  = "<table border=0 cellspacing=0 cellpadding=0 style='font-size:10px;font-family:Verdana'>";
                            strInfoHtml += "<tr><td colspan=2 style='font-weight:bold;'>" + dr["Vessel_Name"].ToString() + "&nbsp;&nbsp;<img src='images/" + simagename + "'>" + "</td></tr>";
                            strInfoHtml += "<tr><td style='width:80px'>Report Date:</td><td style='color:blue;font-weight:bold'>" + dr["infodate"].ToString() + "</td></tr>";
                            strInfoHtml += "<tr><td style='width:80px'>Location:</td><td>" + dr["Location_Name"].ToString() + "</td></tr>";
                            strInfoHtml += "<tr><td style='width:80px'>Latitude:</td><td>" + dr["Latitude_Degrees"].ToString() + " " + dr["Latitude_Minutes"].ToString() + " " + dr["Latitude_Seconds"].ToString() + " " + dr["LATITUDE_N_S"].ToString() + "</td></tr>";
                            strInfoHtml += "<tr><td style='width:80px'>Longitude:</td><td>" + dr["Longitude_Degrees"].ToString() + " " + dr["Longitude_Minutes"].ToString() + " " + dr["Longitude_Seconds"].ToString() + " " + dr["Longitude_E_W"].ToString() + "</td></tr>";
                            strInfoHtml += "<tr><td style='width:80px'>Course:</td><td>" + sangle.ToString() + "</td></tr>";
                            strInfoHtml += "<tr><td style='width:80px'>Wind Direction/ Force:</td><td>" + dr["Wind_Direction"].ToString() + "/" + dr["Wind_Force"].ToString() + "</td></tr>";
                            strInfoHtml += "<tr><td style='width:80px'>Average speed:</td><td>" + dr["AVERAGE_SPEED"].ToString() + " knts</td></tr>";
                            strInfoHtml += "<tr><td style='width:80px'>Next port/<br>ETA:</td><td>" + dr["PORT_NAME"].ToString() + "<br>" + dr["etanextport"].ToString() + "</td></tr>";
                            strInfoHtml += "<tr><td style='width:80px'></td><td></td></tr>";

                            string ReportName = rbtnNoonReport.Checked == true ? "Noon Report" : (rbtnPurpleReport.Checked == true ? "PurpleFinder" : "Noon Report");
                            string CrewLink   = "<a href='" + ConfigurationManager.AppSettings["APP_URL"].ToString() + "Crew/CrewListHistory.aspx?VesselID=" + dr["Vessel_ID"].ToString() + "&AsofDate=" + dr["Telegram_Date"].ToString() + "' target='_blank'>Crew List</a>";
                            string NoonLink   = "";

                            if (strReportType == "N")
                            {
                                NoonLink = "<a href='" + ConfigurationManager.AppSettings["APP_URL"].ToString() + "Operations/NoonReport.aspx?id=" + dr["PKID"].ToString() + "' target='_blank'>" + ReportName + "</a>";
                            }
                            else
                            {
                                NoonLink = "<a href='" + ConfigurationManager.AppSettings["APP_URL"].ToString() + "Operations/PurpleReport.aspx?id=" + dr["PKID"].ToString() + "' target='_blank'>" + ReportName + "</a>";
                            }

                            strInfoHtml += "<td>" + CrewLink + "</td><td>" + NoonLink + "</td>";
                            strInfoHtml += "</tr>";
                            strInfoHtml += "</table>";

                            gp[i].InfoHTML = strInfoHtml.ToString();

                            objPolyLine.Points.Add(gp[i]);

                            if (i == 0)
                            {
                                //gp[i].IconImage = "red-button.png";

                                lat_pos_g = double.Parse(latitude);
                                log_pos_g = double.Parse(longitude);
                                GoogleMapForASPNet1.GoogleMapObject.Points.Add(gp[i]);
                            }
                            else
                            {
                                gp[i].IconImage = "number_" + Convert.ToDateTime(dr["Telegram_Date"]).Day.ToString() + ".png";

                                GoogleMapForASPNet1.GoogleMapObject.Points.Add(gp[i]);
                            }

                            i++;
                        }
                        catch
                        {
                            Err_Vessel_Count++;

                            lbtn_error.Visible = true;

                            lati_pos1  = "1";
                            lati_pos2  = "2";
                            longi_pos1 = "1";
                            longi_pos2 = "2";

                            gp[i].Latitude  = double.Parse(lati_pos1 + lati_pos2);
                            gp[i].Longitude = double.Parse(longi_pos1 + longi_pos2);

                            Err_Vessel_Msg += "<tr><td>" + dr[1].ToString() + "</td><td>" + dr[2].ToString() + "</td><td>Latitude:" + UDFLib.ConvertToInteger(latitude.ToString()) + "</td><td>Longitude:" + longitude.ToString() + "</td></tr>";


                            continue;
                        }
                    }


                    GoogleMapForASPNet1.GoogleMapObject.Polylines.Add(objPolyLine);
                    GoogleMapForASPNet1.GoogleMapObject.CenterPoint.Latitude     = lat_pos_g;
                    GoogleMapForASPNet1.GoogleMapObject.CenterPoint.Longitude    = log_pos_g;
                    GoogleMapForASPNet1.GoogleMapObject.AutomaticBoundaryAndZoom = true;

                    #endregion
                }
            }
            else
            {
                lblVessels.Text = "Total Ships: " + Err_Vessel_Count.ToString();
            }
        }
        catch (Exception ex)
        {
            Response.Write(ex.Message);
        }
    }
Beispiel #12
0
    //protected void db_test2_btn_Click(object sender, EventArgs e)
    //{
    //    string join_report = "empty";
    //    join_report = SQL_session.fetch_2params("SELECT * FROM EVENT_DATA ed JOIN EVENT_DATA_TYPES edt ON ed.EVENT_ID = edt.EVENT_ID JOIN EVENT_TYPES et ON et.EVENT_TYPE_ID = edt.EVENT_TYPE_ID JOIN SCHOOLS s ON ed.LOCATION_LAT BETWEEN s.LAT_START AND s.LAT_END AND ed.LOCATION_LONG BETWEEN s.LONG_START AND s.LONG_END WHERE s.SCHOOL_ID = 1 AND edt.EVENT_TYPE_ID = '" + crime_drop.SelectedValue + "'", "LOCATION_LAT", "LOCATION_LONG");

    //    mb.ShowMessageBox("Query result is: " + join_report);
    //}

    private void showLoc_populatePushpins(Double lat, Double longi)
    {       

        //Specify width and height for map. You can specify either in pixels or in percentage relative to it's container.
        GoogleMapForASPNet2.GoogleMapObject.Width = "100%"; // You can also specify percentage(e.g. 80%) here
        GoogleMapForASPNet2.GoogleMapObject.Height = "100%";

        //Specify initial Zoom level.
        GoogleMapForASPNet2.GoogleMapObject.ZoomLevel = 20;

        //Specify Center Point for map. Map will be centered on this point.
        //GoogleMapForASPNet2.GoogleMapObject.CenterPoint = new GooglePoint("1", 43.69, -79.4042);
        GoogleMapForASPNet2.GoogleMapObject.CenterPoint = new GooglePoint("1", lat, longi);

        //Define Points for polygon
        GooglePoint GP1 = new GooglePoint();
        GP1.ID = "GP1";
        GP1.Latitude = 43.66675;
        GP1.Longitude = -79.4042;

        GooglePoint GP2 = new GooglePoint();
        GP2.ID = "GP2";
        GP2.Latitude = 43.67072;
        GP2.Longitude = -79.38677;

        GooglePoint GP3 = new GooglePoint();
        GP3.ID = "GP3";
        GP3.Latitude = 43.66706;
        GP3.Longitude = -79.37879;

        GooglePoint GP4 = new GooglePoint();
        GP4.ID = "GP4";
        GP4.Latitude = 43.66135;
        GP4.Longitude = -79.383;

        GooglePoint GP5 = new GooglePoint();
        GP5.ID = "GP5";
        GP5.Latitude = 43.65787;
        GP5.Longitude = -79.40016;

        GooglePoint GP6 = new GooglePoint();
        GP6.ID = "GP6";
        GP6.Latitude = 43.66066;
        GP6.Longitude = -79.40943;

        GooglePoint GP7 = new GooglePoint();
        GP7.ID = "GP7";
        GP7.Latitude = 43.66656;
        GP7.Longitude = -79.40445;

        //Create Polygon using above points
        GooglePolygon PG1 = new GooglePolygon();
        PG1.ID = "PG1";
        //Give Hex code for line color
        PG1.FillColor = "#DDDDFF";
        PG1.FillOpacity = 0.4;
        PG1.StrokeColor = "#0000FF";
        PG1.StrokeOpacity = 1;
        PG1.StrokeWeight = 2;

        PG1.Points.Add(GP1);
        PG1.Points.Add(GP2);
        PG1.Points.Add(GP3);
        PG1.Points.Add(GP4);
        PG1.Points.Add(GP5);
        PG1.Points.Add(GP6);
        PG1.Points.Add(GP7);

        //Add polygon to GoogleMap object
        GoogleMapForASPNet2.GoogleMapObject.Polygons.Add(PG1);

        // add pushpins
        GooglePoint GP10 = new GooglePoint();
        GP10.ID = "Toronto";
        GP10.Latitude = 43.668;
        GP10.Longitude = -79.385;
        //Specify bubble text here. You can use standard HTML tags here.
        GP10.InfoHTML = "This is Pushpin 1";

        //Specify icon image. This should be relative to root folder.
        //GP10.IconImage = "icons/Burglary.png";
        GoogleMapForASPNet2.GoogleMapObject.Points.Add(GP10);

        GooglePoint GP11 = new GooglePoint();
        GP11.ID = "Montreal";
        GP11.Latitude = 43.665; //+0.001
        GP11.Longitude = -79.39;
        GP11.InfoHTML = "This is Pushpin 2";
        GP11.IconImage = "icons/Shooting.png";
        GoogleMapForASPNet2.GoogleMapObject.Points.Add(GP11);

        GooglePoint GP12 = new GooglePoint();
        GP12.ID = "Halifax";
        GP12.Latitude = 43.66;
        GP12.Longitude = -79.403;
        GP12.InfoHTML = "This is Pushpin 3";
        GP12.IconImage = "icons/Arrest.png";

        GoogleMapForASPNet2.GoogleMapObject.Points.Add(GP12);
    }
Beispiel #13
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["fromWelcome"] == null)
        {
            Session["fromWelcome"] = "yes";
            GoogleMapForASPNet2.Visible = false;
            Response.Redirect("~/Default.aspx");
        }
        else
            GoogleMapForASPNet2.Visible = true;

        img01.Src="ashx/DrawIt.ashx?width=300&height=250&xaxis=pushes&yaxis=pulls&background=powderblue&piechart=40,10, 35, 15;&titles=stabbing,tickling, stabbing, burglary;&";

        if (!IsPostBack)
        {
            //You must specify Google Map API Key for this component. You can obtain this key from http://code.google.com/apis/maps/signup.html
            //For samples to run properly, set GoogleAPIKey in Web.Config file.
            GoogleMapForASPNet2.GoogleMapObject.APIKey = ConfigurationManager.AppSettings["AIzaSyAFdfLkydY34KobaHfiOGzLDbnG-niDhMU"];

            //Specify width and height for map. You can specify either in pixels or in percentage relative to it's container.
            GoogleMapForASPNet2.GoogleMapObject.Width = "800px"; // You can also specify percentage(e.g. 80%) here
            GoogleMapForASPNet2.GoogleMapObject.Height = "600px";

            //Specify initial Zoom level.
            GoogleMapForASPNet2.GoogleMapObject.ZoomLevel = 14;

            //Specify Center Point for map. Map will be centered on this point.
            GoogleMapForASPNet2.GoogleMapObject.CenterPoint = new GooglePoint("1", 43.69, -79.4042);

            //Define Points for polygon
            GooglePoint GP1 = new GooglePoint();
            GP1.ID = "GP1";
            GP1.Latitude = 43.66675;
            GP1.Longitude = -79.4042;

            GooglePoint GP2 = new GooglePoint();
            GP2.ID = "GP2";
            GP2.Latitude = 43.67072;
            GP2.Longitude = -79.38677;

            GooglePoint GP3 = new GooglePoint();
            GP3.ID = "GP3";
            GP3.Latitude = 43.66706;
            GP3.Longitude = -79.37879;

            GooglePoint GP4 = new GooglePoint();
            GP4.ID = "GP4";
            GP4.Latitude = 43.66135;
            GP4.Longitude = -79.383;

            GooglePoint GP5 = new GooglePoint();
            GP5.ID = "GP5";
            GP5.Latitude = 43.65787;
            GP5.Longitude = -79.40016;

            GooglePoint GP6 = new GooglePoint();
            GP6.ID = "GP6";
            GP6.Latitude = 43.66066;
            GP6.Longitude = -79.40943;

            GooglePoint GP7 = new GooglePoint();
            GP7.ID = "GP7";
            GP7.Latitude = 43.66656;
            GP7.Longitude = -79.40445;

            //Create Polygon using above points
            GooglePolygon PG1 = new GooglePolygon();
            PG1.ID = "PG1";
            //Give Hex code for line color
            PG1.FillColor = "#DDDDFF";
            PG1.FillOpacity = 0.4;
            PG1.StrokeColor = "#0000FF";
            PG1.StrokeOpacity = 1;
            PG1.StrokeWeight = 2;

            PG1.Points.Add(GP1);
            PG1.Points.Add(GP2);
            PG1.Points.Add(GP3);
            PG1.Points.Add(GP4);
            PG1.Points.Add(GP5);
            PG1.Points.Add(GP6);
            PG1.Points.Add(GP7);

            //Add polygon to GoogleMap object
            GoogleMapForASPNet2.GoogleMapObject.Polygons.Add(PG1);

            // add pushpins
            GooglePoint GP10 = new GooglePoint();
            GP10.ID = "Toronto";
            GP10.Latitude = 43.668;
            GP10.Longitude = -79.385;
            //Specify bubble text here. You can use standard HTML tags here.
            GP10.InfoHTML = "This is Pushpin 1";

            //Specify icon image. This should be relative to root folder.
            //GP10.IconImage = "icons/Burglary.png";
            GoogleMapForASPNet2.GoogleMapObject.Points.Add(GP10);


            GooglePoint GP11 = new GooglePoint();
            GP11.ID = "Montreal";
            GP11.Latitude = 43.665; //+0.001
            GP11.Longitude = -79.39;
            GP11.InfoHTML = "This is Pushpin 2";
            GP11.IconImage = "icons/Shooting.png";
            GoogleMapForASPNet2.GoogleMapObject.Points.Add(GP11);
            
            
            GP12.ID = "Halifax";
            GP12.Latitude = 43.66;
            GP12.Longitude = -79.403;
            GP12.InfoHTML = "This is Pushpin 3";
            GP12.IconImage = "icons/Arrest.png";

            GoogleMapForASPNet2.GoogleMapObject.Points.Add(GP12);

        } // end if (!IsPostBack)

    } // end Page_Load
Beispiel #14
0
    public static GooglePolygon GetStatePoligon()
    {
        GooglePolygon BP = new GooglePolygon();

        GooglePoint GP1 = new GooglePoint();
        GP1.ID = "SP1";
        GP1.Latitude = 42.51;
        GP1.Longitude = 18.51;

        GooglePoint GP2 = new GooglePoint();
        GP2.ID = "SP2";
        GP2.Latitude = 43.89;
        GP2.Longitude = 19.54;

        GooglePoint GP3 = new GooglePoint();
        GP3.ID = "SP3";
        GP3.Latitude = 45.03;
        GP3.Longitude = 19.14;

        GooglePoint GP4 = new GooglePoint();
        GP4.ID = "SP4";
        GP4.Latitude = 45.18;
        GP4.Longitude = 15.78;

        GooglePoint GP5 = new GooglePoint();
        GP5.ID = "SP5";
        GP5.Latitude = 42.89;
        GP5.Longitude = 17.52;

        GooglePoint GP6 = new GooglePoint();
        GP6.ID = "SP1";
        GP6.Latitude = 42.51;
        GP6.Longitude = 18.51;

        BP.ID = "BLANK";
        //Give Hex code for line color
        Color color = Color.FromName(Color.WhiteSmoke.Name);
        string ColorCode = String.Format("#{0:X2}{1:X2}{2:X2}", color.R, color.G, color.B);

        BP.FillColor = ColorCode;
        BP.FillOpacity = 0;
        BP.StrokeColor = ColorCode;
        BP.StrokeOpacity = 1;
        BP.StrokeWeight = 1;

        BP.Points.Add(GP1);
        BP.Points.Add(GP2);
        BP.Points.Add(GP3);
        BP.Points.Add(GP4);
        BP.Points.Add(GP5);
        BP.Points.Add(GP6);

        return BP;
    }
Beispiel #15
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["fromWelcome"] == null)
        {
            Session["fromWelcome"]      = "yes";
            GoogleMapForASPNet2.Visible = false;
            Response.Redirect("~/Default.aspx");
        }
        else
        {
            GoogleMapForASPNet2.Visible = true;
        }

        img01.Src = "ashx/DrawIt.ashx?width=300&height=250&xaxis=pushes&yaxis=pulls&background=powderblue&piechart=40,10, 35, 15;&titles=stabbing,tickling, stabbing, burglary;&";

        if (!IsPostBack)
        {
            //You must specify Google Map API Key for this component. You can obtain this key from http://code.google.com/apis/maps/signup.html
            //For samples to run properly, set GoogleAPIKey in Web.Config file.
            GoogleMapForASPNet2.GoogleMapObject.APIKey = ConfigurationManager.AppSettings["AIzaSyAFdfLkydY34KobaHfiOGzLDbnG-niDhMU"];

            //Specify width and height for map. You can specify either in pixels or in percentage relative to it's container.
            GoogleMapForASPNet2.GoogleMapObject.Width  = "800px"; // You can also specify percentage(e.g. 80%) here
            GoogleMapForASPNet2.GoogleMapObject.Height = "600px";

            //Specify initial Zoom level.
            GoogleMapForASPNet2.GoogleMapObject.ZoomLevel = 14;

            //Specify Center Point for map. Map will be centered on this point.
            GoogleMapForASPNet2.GoogleMapObject.CenterPoint = new GooglePoint("1", 43.69, -79.4042);

            //Define Points for polygon
            GooglePoint GP1 = new GooglePoint();
            GP1.ID        = "GP1";
            GP1.Latitude  = 43.66675;
            GP1.Longitude = -79.4042;

            GooglePoint GP2 = new GooglePoint();
            GP2.ID        = "GP2";
            GP2.Latitude  = 43.67072;
            GP2.Longitude = -79.38677;

            GooglePoint GP3 = new GooglePoint();
            GP3.ID        = "GP3";
            GP3.Latitude  = 43.66706;
            GP3.Longitude = -79.37879;

            GooglePoint GP4 = new GooglePoint();
            GP4.ID        = "GP4";
            GP4.Latitude  = 43.66135;
            GP4.Longitude = -79.383;

            GooglePoint GP5 = new GooglePoint();
            GP5.ID        = "GP5";
            GP5.Latitude  = 43.65787;
            GP5.Longitude = -79.40016;

            GooglePoint GP6 = new GooglePoint();
            GP6.ID        = "GP6";
            GP6.Latitude  = 43.66066;
            GP6.Longitude = -79.40943;

            GooglePoint GP7 = new GooglePoint();
            GP7.ID        = "GP7";
            GP7.Latitude  = 43.66656;
            GP7.Longitude = -79.40445;

            //Create Polygon using above points
            GooglePolygon PG1 = new GooglePolygon();
            PG1.ID = "PG1";
            //Give Hex code for line color
            PG1.FillColor     = "#DDDDFF";
            PG1.FillOpacity   = 0.4;
            PG1.StrokeColor   = "#0000FF";
            PG1.StrokeOpacity = 1;
            PG1.StrokeWeight  = 2;

            PG1.Points.Add(GP1);
            PG1.Points.Add(GP2);
            PG1.Points.Add(GP3);
            PG1.Points.Add(GP4);
            PG1.Points.Add(GP5);
            PG1.Points.Add(GP6);
            PG1.Points.Add(GP7);

            //Add polygon to GoogleMap object
            GoogleMapForASPNet2.GoogleMapObject.Polygons.Add(PG1);

            // add pushpins
            GooglePoint GP10 = new GooglePoint();
            GP10.ID        = "Toronto";
            GP10.Latitude  = 43.668;
            GP10.Longitude = -79.385;
            //Specify bubble text here. You can use standard HTML tags here.
            GP10.InfoHTML = "This is Pushpin 1";

            //Specify icon image. This should be relative to root folder.
            //GP10.IconImage = "icons/Burglary.png";
            GoogleMapForASPNet2.GoogleMapObject.Points.Add(GP10);


            GooglePoint GP11 = new GooglePoint();
            GP11.ID        = "Montreal";
            GP11.Latitude  = 43.665; //+0.001
            GP11.Longitude = -79.39;
            GP11.InfoHTML  = "This is Pushpin 2";
            GP11.IconImage = "icons/Shooting.png";
            GoogleMapForASPNet2.GoogleMapObject.Points.Add(GP11);


            GP12.ID        = "Halifax";
            GP12.Latitude  = 43.66;
            GP12.Longitude = -79.403;
            GP12.InfoHTML  = "This is Pushpin 3";
            GP12.IconImage = "icons/Arrest.png";

            GoogleMapForASPNet2.GoogleMapObject.Points.Add(GP12);
        } // end if (!IsPostBack)
    }     // end Page_Load
Beispiel #16
0
    public GoogleObject GetOptimizedGoogleObject()
    {
        GoogleObject objGoogleNew = (GoogleObject)System.Web.HttpContext.Current.Session["GOOGLE_MAP_OBJECT"];
        GoogleObject objGoogleOld = (GoogleObject)System.Web.HttpContext.Current.Session["GOOGLE_MAP_OBJECT_OLD"];
        GoogleObject objGoogle    = new GoogleObject();

        if (objGoogleOld != null)
        {
            for (int i = 0; i < objGoogleNew.Points.Count; i++)
            {
                string      pointStatus = "";
                GooglePoint NewPoint    = objGoogleNew.Points[i];
                GooglePoint OldPoint    = objGoogleOld.Points[NewPoint.ID];
                //if old point not found, means this is a new point.
                if (OldPoint == null)
                {
                    pointStatus = "N"; //New
                }
                else
                {
                    //If old point found and old not equal to new point, means it's value is changed.
                    if (!OldPoint.Equals(NewPoint))
                    {
                        pointStatus = "C"; //Changed
                    }
                    //Remove found point from old object. This is to reduce iteration in next loop.
                    objGoogleOld.Points.Remove(OldPoint.ID);
                }
                if (pointStatus != "")
                {
                    //If new point is changed, add it in list which is to be sent to client.
                    NewPoint.PointStatus = pointStatus;
                    objGoogle.Points.Add(NewPoint);
                }
            }
            //Loop through rest of old points to mark them as deleted.
            for (int i = 0; i < objGoogleOld.Points.Count; i++)
            {
                GooglePoint OldPoint = objGoogleOld.Points[i];
                OldPoint.PointStatus = "D";
                objGoogle.Points.Add(OldPoint);
            }

            //********************************************
            for (int i = 0; i < objGoogleNew.Polylines.Count; i++)
            {
                string         lineStatus = "";
                GooglePolyline NewLine    = objGoogleNew.Polylines[i];
                GooglePolyline OldLine    = objGoogleOld.Polylines[NewLine.ID];
                //if old point not found, means this is a new point.
                if (OldLine == null)
                {
                    lineStatus = "N"; //New
                }
                else
                {
                    //If old point found and old not equal to new point, means it's value is changed.
                    if (!OldLine.Equals(NewLine))
                    {
                        lineStatus = "C"; //Changed
                    }
                    //Remove found point from old object. This is to reduce iteration in next loop.
                    objGoogleOld.Polylines.Remove(OldLine.ID);
                }
                if (lineStatus != "")
                {
                    //If new point is changed, add it in list which is to be sent to client.
                    NewLine.LineStatus = lineStatus;
                    objGoogle.Polylines.Add(NewLine);
                }
            }
            //Loop through rest of old points to mark them as deleted.
            for (int i = 0; i < objGoogleOld.Polylines.Count; i++)
            {
                GooglePolyline OldPolyline = objGoogleOld.Polylines[i];
                OldPolyline.LineStatus = "D";
                objGoogle.Polylines.Add(OldPolyline);
            }

            //********************************************
            for (int i = 0; i < objGoogleNew.Polygons.Count; i++)
            {
                string        gonStatus = "";
                GooglePolygon NewGon    = objGoogleNew.Polygons[i];
                GooglePolygon OldGon    = objGoogleOld.Polygons[NewGon.ID];
                //if old point not found, means this is a new point.
                if (OldGon == null)
                {
                    gonStatus = "N"; //New
                }
                else
                {
                    //If old point found and old not equal to new point, means it's value is changed.
                    if (!OldGon.Equals(NewGon))
                    {
                        gonStatus = "C"; //Changed
                    }
                    //Remove found point from old object. This is to reduce iteration in next loop.
                    objGoogleOld.Polygons.Remove(OldGon.ID);
                }
                if (gonStatus != "")
                {
                    //If new point is changed, add it in list which is to be sent to client.
                    NewGon.Status = gonStatus;
                    objGoogle.Polygons.Add(NewGon);
                }
            }
            //Loop through rest of old points to mark them as deleted.
            for (int i = 0; i < objGoogleOld.Polygons.Count; i++)
            {
                GooglePolygon OldPolygon = objGoogleOld.Polygons[i];
                //        OldPolygon.Status = "D";
                objGoogle.Polygons.Add(OldPolygon);
            }
        }

        objGoogle.CenterPoint = objGoogleNew.CenterPoint;
        objGoogle.ZoomLevel   = objGoogleNew.ZoomLevel;
        objGoogle.ShowTraffic = objGoogleNew.ShowTraffic;
        objGoogle.RecenterMap = objGoogleNew.RecenterMap;
        objGoogle.MapType     = objGoogleNew.MapType;
        objGoogle.AutomaticBoundaryAndZoom = objGoogleNew.AutomaticBoundaryAndZoom;
        //Save new Google object state in session variable.
        //System.Web.HttpContext.Current.Session["GOOGLE_MAP_OBJECT_OLD"] = objGoogleNew;
        System.Web.HttpContext.Current.Session["GOOGLE_MAP_OBJECT_OLD"] = new GoogleObject(objGoogleNew);

        return(objGoogle);
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            //You must specify Google Map API Key for this component. You can obtain this key from http://code.google.com/apis/maps/signup.html
            //For samples to run properly, set GoogleAPIKey in Web.Config file.
            GoogleMapForASPNet1.GoogleMapObject.APIKey = ConfigurationManager.AppSettings["GoogleAPIKey"];

            //Specify width and height for map. You can specify either in pixels or in percentage relative to it's container.
            GoogleMapForASPNet1.GoogleMapObject.Width = "800px"; // You can also specify percentage(e.g. 80%) here
            GoogleMapForASPNet1.GoogleMapObject.Height = "600px";

            //Specify initial Zoom level.
            GoogleMapForASPNet1.GoogleMapObject.ZoomLevel = 14;

            //Specify Center Point for map. Map will be centered on this point.
            GoogleMapForASPNet1.GoogleMapObject.CenterPoint = new GooglePoint("1", 43.66675, -79.4042);

            //Define Points for polygon
            GooglePoint GP1 = new GooglePoint();
            GP1.ID = "GP1";
            GP1.Latitude = 43.66675;
            GP1.Longitude = -79.4042;

            GooglePoint GP2 = new GooglePoint();
            GP2.ID = "GP2";
            GP2.Latitude = 43.67072;
            GP2.Longitude = -79.38677;

            GooglePoint GP3 = new GooglePoint();
            GP3.ID = "GP3";
            GP3.Latitude = 43.66706;
            GP3.Longitude = -79.37879;

            GooglePoint GP4 = new GooglePoint();
            GP4.ID = "GP4";
            GP4.Latitude = 43.66135;
            GP4.Longitude = -79.383;

            GooglePoint GP5 = new GooglePoint();
            GP5.ID = "GP5";
            GP5.Latitude = 43.65787;
            GP5.Longitude = -79.40016;

            GooglePoint GP6 = new GooglePoint();
            GP6.ID = "GP6";
            GP6.Latitude = 43.66066;
            GP6.Longitude = -79.40943;

            GooglePoint GP7 = new GooglePoint();
            GP7.ID = "GP7";
            GP7.Latitude = 43.66656;
            GP7.Longitude = -79.40445;

            //Create Polygon using above points
            GooglePolygon PG1 = new GooglePolygon();
            PG1.ID = "PG1";
            //Give Hex code for line color
            PG1.FillColor = "#0000FF";
            PG1.FillOpacity = 0.4;
            PG1.StrokeColor = "#0000FF";
            PG1.StrokeOpacity = 1;
            PG1.StrokeWeight = 2;

            PG1.Points.Add(GP1);
            PG1.Points.Add(GP2);
            PG1.Points.Add(GP3);
            PG1.Points.Add(GP4);
            PG1.Points.Add(GP5);
            PG1.Points.Add(GP6);
            PG1.Points.Add(GP7);

            //Add polygon to GoogleMap object
            GoogleMapForASPNet1.GoogleMapObject.Polygons.Add(PG1);
        }
    }
Beispiel #18
0
    private void DrawPolygon()
    {
        GoogleMapForASPNet2.GoogleMapObject.Polygons.Clear();

        string report = SQL_session.fetch_polyPoints("SELECT * FROM SCHOOLS WHERE SCHOOL_ID = '" + (campus1_drop.SelectedIndex + 1) + "' ", "G1", "G2", "G3", "G4", "G5", "G6", "G7", "G8", "G9");
        string[] loc_array = report.Split('&');

        int GP_counter = 0;
        GooglePoint[] GooglePoint_array = new GooglePoint[loc_array.Length / 2];

        //Create Polygon using GooglePoint_array points
        GooglePolygon PG1 = new GooglePolygon();
        PG1.ID = "PG1";
        //Give Hex code for line color
        PG1.FillColor = "#CCCCFF";
        PG1.FillOpacity = 0.4;
        PG1.StrokeColor = "#0000FF";
        PG1.StrokeOpacity = 1;
        PG1.StrokeWeight = 2;

        for (int i = 0; i < loc_array.Length; i++)
        {
            string point_id = "GP" + (GP_counter + 1);
            GooglePoint_array[GP_counter] = new GooglePoint();
            GooglePoint_array[GP_counter].ID = point_id + GP_counter;

            double lat, longi;
            double.TryParse(loc_array[i], out lat);
            double.TryParse(loc_array[i + 1], out longi);
            GooglePoint_array[GP_counter].Latitude = lat;
            GooglePoint_array[GP_counter].Longitude = longi;

            // add points to polygon
            PG1.Points.Add(GooglePoint_array[GP_counter]);

            i++;
            GP_counter++;
        }

        PG1.Points.Add(GooglePoint_array[0]);

        //Add polygon to GoogleMap object
        GoogleMapForASPNet2.GoogleMapObject.Polygons.Add(PG1);
    } // end DrawPOlygon
Beispiel #19
0
 public void Add(GooglePolygon pPolygon)
 {
     this.List.Add(pPolygon);
 }
Beispiel #20
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            //You must specify Google Map API Key for this component. You can obtain this key from http://code.google.com/apis/maps/signup.html
            //For samples to run properly, set GoogleAPIKey in Web.Config file.
            GoogleMapForASPNet1.GoogleMapObject.APIKey = ConfigurationManager.AppSettings["GoogleAPIKey"];

            //Specify width and height for map. You can specify either in pixels or in percentage relative to it's container.
            GoogleMapForASPNet1.GoogleMapObject.Width  = "800px"; // You can also specify percentage(e.g. 80%) here
            GoogleMapForASPNet1.GoogleMapObject.Height = "400px";

            //Specify initial Zoom level.
            GoogleMapForASPNet1.GoogleMapObject.ZoomLevel = 14;

            //Specify Center Point for map. Map will be centered on this point.
            GoogleMapForASPNet1.GoogleMapObject.CenterPoint = new GooglePoint("1", 43.66675, -79.4042);

            //Define Points for polygon
            GooglePoint GP1 = new GooglePoint();
            GP1.ID        = "GP1";
            GP1.Latitude  = 43.66675;
            GP1.Longitude = -79.4042;

            GooglePoint GP2 = new GooglePoint();
            GP2.ID        = "GP2";
            GP2.Latitude  = 43.67072;
            GP2.Longitude = -79.38677;

            GooglePoint GP3 = new GooglePoint();
            GP3.ID        = "GP3";
            GP3.Latitude  = 43.66706;
            GP3.Longitude = -79.37879;

            GooglePoint GP4 = new GooglePoint();
            GP4.ID        = "GP4";
            GP4.Latitude  = 43.66135;
            GP4.Longitude = -79.383;

            GooglePoint GP5 = new GooglePoint();
            GP5.ID        = "GP5";
            GP5.Latitude  = 43.65787;
            GP5.Longitude = -79.40016;

            GooglePoint GP6 = new GooglePoint();
            GP6.ID        = "GP6";
            GP6.Latitude  = 43.66066;
            GP6.Longitude = -79.40943;

            GooglePoint GP7 = new GooglePoint();
            GP7.ID        = "GP7";
            GP7.Latitude  = 43.66656;
            GP7.Longitude = -79.40445;

            //Create Polygon using above points
            GooglePolygon PG1 = new GooglePolygon();
            PG1.ID = "PG1";
            //Give Hex code for line color
            PG1.FillColor     = "#0000FF";
            PG1.FillOpacity   = 0.4;
            PG1.StrokeColor   = "#0000FF";
            PG1.StrokeOpacity = 1;
            PG1.StrokeWeight  = 2;

            PG1.Points.Add(GP1);
            PG1.Points.Add(GP2);
            PG1.Points.Add(GP3);
            PG1.Points.Add(GP4);
            PG1.Points.Add(GP5);
            PG1.Points.Add(GP6);
            PG1.Points.Add(GP7);

            //Add polygon to GoogleMap object
            GoogleMapForASPNet1.GoogleMapObject.Polygons.Add(PG1);
        }
    }