Exemplo n.º 1
1
    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.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 = "GP1";
            GP1.Latitude = 43.65669;
            GP1.Longitude = -79.44268;
            GP1.InfoHTML = "This is point 1";
            GoogleMapForASPNet1.GoogleMapObject.Points.Add(GP1);

            GooglePoint GP2 = new GooglePoint();
            GP2.ID = "GP2";
            GP2.Latitude = 43.66619;
            GP2.Longitude = -79.44268;
            GP2.InfoHTML = "This is point 2";
            GoogleMapForASPNet1.GoogleMapObject.Points.Add(GP2);

            GooglePoint GP3 = new GooglePoint();
            GP3.ID = "GP3";
            GP3.Latitude = 43.67689;
            GP3.Longitude = -79.43270;
            GP3.InfoHTML = "This is point 3";
            GoogleMapForASPNet1.GoogleMapObject.Points.Add(GP3);

            //Create Polylines between points GP1, GP2 and GP3.
            GooglePolyline PL1 = new GooglePolyline();
            PL1.ID = "PL1";
            //Give Hex code for line color
            PL1.ColorCode = "#0000FF";
            //Specify width for line
            PL1.Width = 5;

            PL1.Points.Add(GP1);
            PL1.Points.Add(GP2);
            PL1.Points.Add(GP3);

            //Add polyline to GoogleMap object
            GoogleMapForASPNet1.GoogleMapObject.Polylines.Add(PL1);
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        //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 = "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.
        //In constructor of GooglePoint, First argument is ID of this pushpin. It must be unique for each pin. Type is string.
        //Second and third arguments are latitude and longitude.
        GoogleMapForASPNet1.GoogleMapObject.Points.Add(new GooglePoint("1", 43.65669, -79.45278));
        GoogleMapForASPNet1.GoogleMapObject.Points.Add(new GooglePoint("2", 43.66619, -79.44268));
        GoogleMapForASPNet1.GoogleMapObject.Points.Add(new GooglePoint("3", 43.67689, -79.43270));

        GooglePoint GP = new GooglePoint();
        GP.ID = "1";
        GP.Latitude = 43.65669;
        GP.Longitude = -79.43270;
        GoogleMapForASPNet1.GoogleMapObject.Points.Add(GP);
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        //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 = 5;

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

        //Load 500 icons
        for (int i = 0; i < 500; i++)
        {
            //Add pushpins for map.
            GooglePoint GP = new GooglePoint();
            GP.ID = i.ToString();
            GP.Latitude =(double)cCommon.RandomNumber(30.0m,48.0m);
            GP.Longitude =(double)cCommon.RandomNumber(-100.0m,-70.0m);
            //Specify bubble text here. You can use standard HTML tags here.
            GP.InfoHTML = "This is Pushpin "+i.ToString();

            //Specify random icon image..
            GP.IconImage = sIcons[Rand.Next(0, 3)];
            GoogleMapForASPNet1.GoogleMapObject.Points.Add(GP);
        }

        //Load vehicle pushpins
        GooglePoint GP1 = new GooglePoint();
        GP1.ID = "RedCar";
        GP1.Latitude = 32.65669;
        GP1.Longitude = -79.47268;  //+0.001
        //Specify bubble text here. You can use standard HTML tags here.
        GP1.InfoHTML = "This is Red car";

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

        GooglePoint GP2 = new GooglePoint();
        GP2.ID = "YellowCar";
        GP2.Latitude = 45.63619; //+0.001
        GP2.Longitude = -85.44268;
        GP2.InfoHTML = "This is Yellow car";
        GP2.IconImage = "icons/YellowCar.png";
        GoogleMapForASPNet1.GoogleMapObject.Points.Add(GP2);

        GooglePoint GP3 = new GooglePoint();
        GP3.ID = "SchoolBus";
        GP3.Latitude = 40.67689;
        GP3.Longitude = -95.43270;
        GP3.InfoHTML = "This is School Bus";
        GP3.IconImage = "icons/SchoolBus.png";
        GoogleMapForASPNet1.GoogleMapObject.Points.Add(GP3);
    }
Exemplo n.º 4
1
    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.
            GooglePoint GP = new GooglePoint();  //"1", ,
            GP.Latitude = 43.66619;
            GP.Longitude = -79.44268;
            GP.ToolTip = "Center Point";
            GP.InfoHTML = "This is center point";
            //Disable Automatic Boundary and Zoom to allow positioning map to a new point.
            GoogleMapForASPNet1.GoogleMapObject.AutomaticBoundaryAndZoom=false;
            GoogleMapForASPNet1.GoogleMapObject.CenterPoint = GP;
            GoogleMapForASPNet1.GoogleMapObject.Points.Add(GP);
        }
    }
Exemplo n.º 5
1
    protected void btnGeocode_Click(object sender, EventArgs e)
    {
        lblError.Text = "";
        if (txtAPIKey.Text == "")
        {
            lblError.Text = "Please provide Google API Key. To obtain google map api key, go to http://code.google.com/apis/maps/signup.html";
            return;
        }
        GooglePoint GP = new GooglePoint();
        GP.Address = txtAddress.Text;
        //GeocodeAddress() function will geocode address and set Latitude and Longitude of GP(GooglePoint) to it's respected value.
        if (GP.GeocodeAddress(txtAPIKey.Text))
        {
            //Once GP is geocoded, you can add it to google map.
            GP.InfoHTML = GP.Address;
            //Set GP as center point.
            GoogleMapForASPNet1.GoogleMapObject.CenterPoint = GP;

            //Clear any existing
            GoogleMapForASPNet1.GoogleMapObject.Points.Clear();
            //Add geocoded GP to GoogleMapObject
            GoogleMapForASPNet1.GoogleMapObject.Points.Add(GP);
            GoogleMapForASPNet1.GoogleMapObject.ZoomLevel = 15;
            //Recenter map to GP.
            GoogleMapForASPNet1.GoogleMapObject.RecenterMap = true;
        }
        else
        {
            lblError.Text = "Unable to geocode this address.";
        }
    }
Exemplo n.º 6
1
 //Add event handler for Map Click event
 void OnMapClicked(double dLat, double dLng)
 {
     //Print clicked map positions
     lblPushpin1.Text = "(" + dLat.ToString() + "," + dLng.ToString() + ")";
     //Generate new id for google point
     string sID = (GoogleMapForASPNet1.GoogleMapObject.Points.Count + 1).ToString();
     GooglePoint GP1 = new GooglePoint(sID, dLat, dLng);
     GoogleMapForASPNet1.GoogleMapObject.Points.Add(GP1);
 }
Exemplo n.º 7
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.
            GooglePoint GP = new GooglePoint();  //"1", ,
            GP.Latitude  = 43.67619;
            GP.Longitude = -79.45268;
            GP.ToolTip   = "Center Point";
            GP.InfoHTML  = "This is center point";
            //Disable Automatic Boundary and Zoom to allow positioning map to a new point.
            GoogleMapForASPNet1.GoogleMapObject.AutomaticBoundaryAndZoom = false;
            GoogleMapForASPNet1.GoogleMapObject.CenterPoint = GP;
            GoogleMapForASPNet1.GoogleMapObject.Points.Add(GP);
        }
    }
Exemplo n.º 8
0
    protected void btnGeocode_Click(object sender, EventArgs e)
    {
        GooglePoint GP = new GooglePoint();

        GP.Latitude  = cCommon.GetNumericValue(txtLatitude.Text);
        GP.Longitude = cCommon.GetNumericValue(txtLongitude.Text);

        //GeocodeAddress() function will geocode address and set Latitude and Longitude of GP(GooglePoint) to it's respected value.
        if (GP.ReverseGeocode())
        {
            //Once GP is geocoded, you can add it to google map.
            GP.InfoHTML     = GP.Address;
            txtAddress.Text = GP.Address;
            lblError.Text   = "";

            //Set GP as center point.
            GoogleMapForASPNet1.GoogleMapObject.CenterPoint = GP;

            //Clear any existing
            GoogleMapForASPNet1.GoogleMapObject.Points.Clear();
            //Add geocoded GP to GoogleMapObject
            GoogleMapForASPNet1.GoogleMapObject.Points.Add(GP);
            GoogleMapForASPNet1.GoogleMapObject.RecenterMap = true;

            //Recenter map to GP.
        }
        else
        {
            txtAddress.Text = "Unable to reverse geocode this lat/lng";
            lblError.Text   = "Unable to reverse geocode this lat/lng";
        }
    }
Exemplo n.º 9
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //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  = "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.
        //In constructor of GooglePoint, First argument is ID of this pushpin. It must be unique for each pin. Type is string.
        //Second and third arguments are latitude and longitude.
        GoogleMapForASPNet1.GoogleMapObject.Points.Add(new GooglePoint("1", 43.65669, -79.45278));
        GoogleMapForASPNet1.GoogleMapObject.Points.Add(new GooglePoint("2", 43.66619, -79.44268));
        GoogleMapForASPNet1.GoogleMapObject.Points.Add(new GooglePoint("3", 43.67689, -79.43270));

        GooglePoint GP = new GooglePoint();

        GP.ID        = "1";
        GP.Latitude  = 43.65669;
        GP.Longitude = -79.43270;
        GoogleMapForASPNet1.GoogleMapObject.Points.Add(GP);
    }
Exemplo n.º 10
0
    private void BindMap(float Citylat, float Citylon, string CityName)
    {
        div_Map.Visible = true;
        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  = "500px"; // You can also specify percentage(e.g. 80%) here
        GoogleMapForASPNet1.GoogleMapObject.Height = "300px";
        DataTable dat1 = new DataTable();

        GoogleMapForASPNet1.GoogleMapObject.ZoomLevel = 5;
        GooglePoint GP = new GooglePoint();

        dat1.Columns.Add("Lattitude", typeof(double));
        dat1.Columns.Add("Longitude", typeof(double));
        GooglePolyline PL1 = new GooglePolyline();

        PL1.Width     = 5;
        PL1.ColorCode = "Blue";

        GooglePoint[] Gpoint = new GooglePoint[1];
        List <string> City   = new List <string>();

        Gpoint[0]           = new GooglePoint();
        Gpoint[0].InfoHTML  = CityName;
        Gpoint[0].Latitude  = Citylat;
        Gpoint[0].Longitude = Citylon;
        GoogleMapForASPNet1.GoogleMapObject.Points.Add(Gpoint[0]);

        GoogleMapForASPNet1.GoogleMapObject.CenterPoint = new GooglePoint("1", Citylat, Citylon);
    }
Exemplo n.º 11
0
    static bool PointInPolygon(GooglePoint p, GooglePolygon[] poly)
    {
        bool inside = false;
        int  polyid = 0;

        try
        {
            if (poly == null || poly.Length == 0)
            {
                return(inside);
            }
            if (poly[polyid] == null || poly[polyid].Points.Count < 3)
            {
                return(inside);
            }
            int i, j, nvert = poly[polyid].Points.Count;
            for (i = 0, j = nvert - 1; i < nvert; j = i++)
            {
                if (((poly[polyid].Points[i].Latitude > p.Latitude) != (poly[polyid].Points[j].Latitude > p.Latitude)) &&
                    (p.Longitude < (poly[polyid].Points[j].Longitude - poly[polyid].Points[i].Longitude) * (p.Latitude - poly[polyid].Points[i].Latitude) / (poly[polyid].Points[j].Latitude - poly[polyid].Points[i].Latitude) + poly[polyid].Points[i].Longitude))
                {
                    inside = !inside;
                }
            }
        }
        catch { }
        return(inside);
    }
Exemplo n.º 12
0
    protected void btnGeocode_Click(object sender, EventArgs e)
    {
        GooglePoint GP = new GooglePoint();

        GP.Address = txtAddress.Text;
        //GeocodeAddress() function will geocode address and set Latitude and Longitude of GP(GooglePoint) to it's respected value.
        if (GP.GeocodeAddress())
        {
            //Once GP is geocoded, you can add it to google map.
            GP.InfoHTML = GP.Address;
            txtFormattedAddress.Text = GP.Address;
            txtLocation.Text         = "lat=" + GP.Latitude.ToString() + ", lng=" + GP.Longitude.ToString();
            lblError.Text            = "";

            //Set GP as center point.
            GoogleMapForASPNet1.GoogleMapObject.CenterPoint = GP;

            //Clear any existing
            GoogleMapForASPNet1.GoogleMapObject.Points.Clear();
            //Add geocoded GP to GoogleMapObject
            GoogleMapForASPNet1.GoogleMapObject.Points.Add(GP);
            GoogleMapForASPNet1.GoogleMapObject.RecenterMap = true;

            //Recenter map to GP.
        }
        else
        {
            txtFormattedAddress.Text = "Unable to geocode this address";
            txtLocation.Text         = "";
            lblError.Text            = "Unable to geocode this address.";
        }
    }
Exemplo n.º 13
0
    private void Place_Pins(String fetch_string, String image, String tooltip_message, String crime_ID)
    {
        string join_report = "empty";

        join_report = SQL_session.fetch_2params(fetch_string, "LOCATION_LAT", "LOCATION_LONG");

        string[] crime_array = join_report.Split('&');

        double lat, longi;

        int counter = 0;

        GooglePoint[] point = new GooglePoint[crime_array.Length / 2];

        if (crime_array.Length > 1)
        {
            for (int i = 0; i < crime_array.Length - 1; i++)
            {
                double.TryParse(crime_array[i], out lat);
                double.TryParse(crime_array[i + 1], out longi);

                point[counter]           = new GooglePoint();
                point[counter].ID        = crime_ID + (counter + 1);
                point[counter].Latitude  = lat;
                point[counter].Longitude = longi;
                point[counter].InfoHTML  = tooltip_message;
                point[counter].IconImage = image;
                GoogleMapForASPNet2.GoogleMapObject.Points.Add(point[counter]);

                i++;
                counter++;
            }    // end for loop
        }
    } // end void Place_Pins(String fetch_string, String crime_tripe, String image)
Exemplo n.º 14
0
 public void BindGermayMap()
 {
     GooglePoint GP0 = new GooglePoint();
         GP0.Latitude = 51.165691;
         GP0.Longitude = 10.451526;
         GoogleMapForASPNet1.GoogleMapObject.ZoomLevel = 5;
         GoogleMapForASPNet1.GoogleMapObject.CenterPoint = new GooglePoint("1", GP0.Latitude, GP0.Longitude);
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        //Add event handler for PushpinMoved event
        GoogleMapForASPNet1.PushpinMoved += new GoogleMapForASPNet.PushpinMovedHandler(OnPushpinMoved);
        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 = "1000px"; // You can also specify percentage(e.g. 80%) here
            GoogleMapForASPNet1.GoogleMapObject.Height = "500px";

            //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 push pins 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 = "FireTruck";
            GP1.Latitude = 43.65669;
            GP1.Longitude = -79.44268;
            //Specify bubble text here. You can use standard HTML tags here.
            GP1.InfoHTML = "This is a Fire Truck";
            GP1.Draggable = true;
            GP1.ToolTip = "Fire Truck";
            //Specify icon image. This should be relative to root folder.
            GP1.IconImage = "icons/FireTruck.png";
            GoogleMapForASPNet1.GoogleMapObject.Points.Add(GP1);

            GooglePoint GP2 = new GooglePoint();
            GP2.ID = "SimplePushpin";
            GP2.Latitude = 43.66619;
            GP2.Longitude = -79.44268;
            GP2.InfoHTML = "This is a Simple pushpin";
            GP2.Draggable = true;
            GP2.ToolTip = "Simple Pushpin";
            GoogleMapForASPNet1.GoogleMapObject.Points.Add(GP2);

            GooglePoint GP3 = new GooglePoint();
            GP3.ID = "Truck";
            GP3.Latitude = 43.67689;
            GP3.Longitude = -79.43270;
            GP3.InfoHTML = "This is a Truck";
            GP3.IconImage = "icons/Truck.png";
            GP3.Draggable = true;
            GP3.ToolTip = "Truck";
            GoogleMapForASPNet1.GoogleMapObject.Points.Add(GP3);
        }
    }
Exemplo n.º 16
0
    public static bool GeocodeAddress(GooglePoint GP)
    {
        string sURL = "http://maps.googleapis.com/maps/api/geocode/xml?address="+GP.Address+"&sensor=false";
        WebRequest request = WebRequest.Create(sURL);
        request.Timeout = 10000;
        // Set the Method property of the request to POST.
        request.Method = "POST";
        // Create POST data and convert it to a byte array.
        string postData = "";
        byte[] byteArray = Encoding.UTF8.GetBytes(postData);
        // Set the ContentType property of the WebRequest.
        request.ContentType = "application/x-www-form-urlencoded";
        // Set the ContentLength property of the WebRequest.
        request.ContentLength = byteArray.Length;
        // Get the request stream.
        Stream dataStream = request.GetRequestStream();

        // Write the data to the request stream.
        dataStream.Write(byteArray, 0, byteArray.Length);
        // Close the Stream object.
        dataStream.Close();
        // Get the response.
        WebResponse response = request.GetResponse();
        // Display the status.
        //Console.WriteLine(((HttpWebResponse)response).StatusDescription);
        // Get the stream containing content returned by the server.
        dataStream = response.GetResponseStream();
        // Open the stream using a StreamReader for easy access.
        StreamReader reader = new StreamReader(dataStream);
        // Read the content.
        string responseFromServer = reader.ReadToEnd();

        StringReader tx = new StringReader(responseFromServer) ;

        //return false;
        //System.Xml.XmlReader xr = new System.Xml.XmlReader();

        //return false;

        DataSet DS = new DataSet();
        DS.ReadXml(tx);
        //DS.ReadXml(dataStream);
        //DS.ReadXml(tx);

        string status = cCommon.GetStringValue(DS.Tables["GeocodeResponse"].Rows[0]["status"]);
        if (status == "OK")
        {
            GP.Latitude = cCommon.GetNumericValue(DS.Tables["location"].Rows[0]["lat"]);
            GP.Longitude = cCommon.GetNumericValue(DS.Tables["location"].Rows[0]["lng"]);
            if (DS.Tables["result"] != null)
            {
                GP.Address = cCommon.GetStringValue(DS.Tables["result"].Rows[0]["formatted_address"]);
            }
            return true;
        }
        return false;
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        //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  = "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 push pins 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        = "1";
        GP1.Latitude  = 43.65669;
        GP1.Longitude = -79.44268;
        //Specify bubble text here. You can use standard HTML tags here.
        GP1.InfoHTML = "This is Point 1";
        //Add tooltip for this point
        GP1.ToolTip = "Point 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        = "2";
        GP2.Latitude  = 43.66619;
        GP2.Longitude = -79.44268;
        GP2.InfoHTML  = "This is point 2";
        //Add tooltip for this point
        GP2.ToolTip   = "Point 2";
        GP2.IconImage = "icons/horse.png";
        GoogleMapForASPNet1.GoogleMapObject.Points.Add(GP2);


        GooglePoint GP3 = new GooglePoint();

        GP3.ID        = "3";
        GP3.Latitude  = 43.67689;
        GP3.Longitude = -79.43270;
        GP3.InfoHTML  = "This is point 3";
        //Add tooltip for this point
        GP3.ToolTip   = "Point 3";
        GP3.IconImage = "icons/recycle.png";
        GoogleMapForASPNet1.GoogleMapObject.Points.Add(GP3);
    }
Exemplo n.º 18
0
    protected void foo_OnClick_Click(object sender, EventArgs e)
    {
        GooglePoint GP2 = new GooglePoint();

        GP2.ID        = "salam";
        GP2.Latitude  = 11.5867151352197;
        GP2.Longitude = 43.1480500710693;
        GoogleMapForASPNet1.GoogleMapObject.Points.Add(GP2);
    }
Exemplo n.º 19
0
    public void  BindGermayMap()
    {
        GooglePoint GP0 = new GooglePoint();

        GP0.Latitude  = 51.165691;
        GP0.Longitude = 10.451526;
        GoogleMapForASPNet1.GoogleMapObject.ZoomLevel   = 5;
        GoogleMapForASPNet1.GoogleMapObject.CenterPoint = new GooglePoint("1", GP0.Latitude, GP0.Longitude);
    }
Exemplo n.º 20
0
    //Add event handler for Map Click event
    void OnMapClicked(double dLat, double dLng)
    {
        //Print clicked map positions
        lblPushpin1.Text = "(" + dLat.ToString() + "," + dLng.ToString() + ")";
        //Generate new id for google point
        string      sID = "Point1";
        GooglePoint GP1 = new GooglePoint(sID, dLat, dLng);

        GoogleMapForASPNet1.GoogleMapObject.Points.Add(GP1);
    }
Exemplo n.º 21
0
    public static bool GeocodeAddressV3(GooglePoint GP)
    {
        try
        {
            int  repeatcount = 0;
            bool result      = false;
            do
            {
                //repeat:

                string        postalAddress = String.Empty;
                string        serviceurl    = "https://maps.googleapis.com/maps/api/geocode/xml?sensor=false&key=AIzaSyADm_knOrgFhwfdrPJpuGQhJYbmTY3ylHg&address=" + GP.Address;
                XmlTextReader reader;
                reader = new XmlTextReader(serviceurl);
                //  ds.ReadXml(reader)
                DataSet DS = new DataSet();
                DS.ReadXml(reader);
                //DS.ReadXml(dataStream);
                //DS.ReadXml(tx);
                string StatusCode = DS.Tables["GeocodeResponse"].Rows[0]["status"].ToString();
                if (StatusCode == "OK")
                {
                    string sLat = DS.Tables["location"].Rows[0]["lat"].ToString();
                    string sLon = DS.Tables["location"].Rows[0]["lng"].ToString();
                    string addr = DS.Tables["result"].Rows[0]["formatted_address"].ToString();
                    GP.Latitude  = cCommon.GetNumericValue(sLat);
                    GP.Longitude = cCommon.GetNumericValue(sLon);
                    GP.Address   = addr;
                    result       = true;
                    break;
                }
                else if (StatusCode == "OVER_QUERY_LIMIT")
                {
                    /* repeatcount++;
                     * if (repeatcount > 5)
                     *       return false;
                     * else*/
                    repeatcount++;
                    Thread.Sleep(3000);

                    //    goto repeat;
                }
                else
                {
                    result = false;
                    break;
                }
            } while (repeatcount < 2);
            return(result);
        }
        catch (Exception)
        {
            return(false);
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        //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.66619, -79.44268);

        //Set Automatic Boundary and Zoom to true. This will recenter map and set zoom to a level where all pushpins are visible
        GoogleMapForASPNet1.GoogleMapObject.AutomaticBoundaryAndZoom = true;

        //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        = "RedCar";
        GP1.Latitude  = 43.65669;
        GP1.Longitude = -79.47268;  //+0.001
        //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/RedCar.png";
        //GP1.IconImageHeight = 5;
        //GP1.IconImageWidth = 5;
        GoogleMapForASPNet1.GoogleMapObject.Points.Add(GP1);

        GooglePoint GP2 = new GooglePoint();

        GP2.ID        = "YellowCar";
        GP2.Latitude  = 43.63619; //+0.001
        GP2.Longitude = -79.44268;
        GP2.InfoHTML  = "This is Pushpin 2";
        GP2.IconImage = "icons/YellowCar.png";
        GoogleMapForASPNet1.GoogleMapObject.Points.Add(GP2);

        GooglePoint GP3 = new GooglePoint();

        GP3.ID        = "SchoolBus";
        GP3.Latitude  = 43.67689;
        GP3.Longitude = -79.43270;
        GP3.InfoHTML  = "This is Pushpin 3";
        GP3.IconImage = "icons/SchoolBus.png";
        GoogleMapForASPNet1.GoogleMapObject.Points.Add(GP3);
    }
Exemplo n.º 23
0
    protected void btnAddPoint_Click(object sender, EventArgs e)
    {
        GooglePoint GP4 = new GooglePoint();
        GP4.ID = "GP4";
        GP4.Latitude = 43.66689;
        GP4.Longitude = -79.42470;
        GP4.InfoHTML = "This is point 4";
        GoogleMapForASPNet1.GoogleMapObject.Points.Add(GP4);

        GoogleMapForASPNet1.GoogleMapObject.Polylines["PL1"].Points.Add(GP4);
    }
Exemplo n.º 24
0
    public void Route_Ship()
    {
        GoogleMapForASPNet1.GoogleMapObject.Width  = "900px"; //   900 You can also specify percentage(e.g. 80%) here
        GoogleMapForASPNet1.GoogleMapObject.Height = "600px";



        int    shipno  = Convert.ToInt32(ddl_shipname.SelectedValue.ToString());
        string frmdate = ddl_frmdate.SelectedItem.Text.ToString();
        string todate  = ddl_todate.SelectedItem.Text.ToString();

        string[] frmVal = frmdate.Split(' ');
        string[] toVal  = todate.Split(' ');

        DataSet ds = new DataSet();

        ds = Get_ShipRoute(shipno, frmdate.ToString(), todate.ToString());

        GoogleMapForASPNet1.GoogleMapObject.AutomaticBoundaryAndZoom = false;
        GooglePoint[] gp = new GooglePoint[ds.Tables[0].Rows.Count];

        int i = 0;

        //string str = gp[1].ToString();
        string strInfoHtml = "";

        foreach (DataRow dr in ds.Tables[0].Rows)
        {
            gp[i]           = new GooglePoint();
            gp[i].IconImage = "smalship.png";

            string slatitude  = Conv_Deg2Decimal_new(Convert.ToDouble(dr["Latitude_Degrees"]), Convert.ToDouble(dr["Latitude_Minutes"]), Convert.ToDouble(dr["Latitude_Seconds"]), dr["LATITUDE_E_W"].ToString());
            string slongitude = Conv_Deg2Decimal_new(Convert.ToDouble(dr["Longitude_Degrees"]), Convert.ToDouble(dr["Longitude_Minutes"]), Convert.ToDouble(dr["Longitude_Seconds"]), dr["Longitude_N_S"].ToString());
            gp[i].Latitude  = double.Parse(slatitude.ToString());
            gp[i].Longitude = double.Parse(slongitude.ToString());
            string qstrn = "EditId," + dr[0].ToString();
            string link  = "Infrastructure/Vessel/VesselDetails.aspx?x=" + qstrn;

            //strInfoHtml = "<font name=arial; size=1;><a href=" + ddl_shipname.SelectedItem.Text.ToString() + ">" + ddl_shipname.SelectedItem.Text.ToString() + "</a>" + "<br>" + dr[1].ToString() + "" + "<br>Last Noon Report<br>Crew List";
            strInfoHtml = "<font name=arial; size=1;>" + ddl_shipname.SelectedItem.Text.ToString() + "<br>Telegram Date:" + dr["infodate"].ToString() + "<br>Location: " + dr["Name"].ToString() + "<br>Latitude: " + dr["Latitude_Degrees"].ToString() + " " + dr["Latitude_Minutes"].ToString() + " " + dr["Latitude_Seconds"].ToString() + " " + dr["LATITUDE_E_W"].ToString() + "<br>Longitude: " + dr["Longitude_Degrees"].ToString() + " " + dr["Longitude_Minutes"].ToString() + " " + dr["Longitude_Seconds"].ToString() + " " + dr["Longitude_N_S"].ToString() + "<br>Course: " + dr["Vessel_Course"].ToString() + "<br>Wind Direction/ Force: " + dr["Wind_Direction"].ToString() + "/" + dr["Wind_Force"].ToString() + "<br>Average speed: " + dr["AVERAGE_SPEED"].ToString() + "knts" + "<br>Next port/ETA: " + dr["Next_Port"].ToString() + " " + "<br>Cargo: " + dr["CARGO_NAME_1"].ToString();


            gp[i].InfoHTML = strInfoHtml.ToString();
            //gp[i].IconShadowWidth = 200;
            //gp[i].ToolTip = strInfoHtml.ToString();

            gp[i].ToolTip = gp[i].Address.ToString();



            GoogleMapForASPNet1.GoogleMapObject.Points.Add(gp[i]);
            i++;
        }
    }
Exemplo n.º 25
0
    void LIS(double lat, double lon)
    {
        GooglePoint GP = new GooglePoint();

        if (nom == "line")
        {
            GP.Latitude  = lat;
            GP.Longitude = lon;

            listP.Add(GP);
        }
    }
Exemplo n.º 26
0
    protected void btnAddPoint_Click(object sender, EventArgs e)
    {
        GooglePoint GP4 = new GooglePoint();

        GP4.ID        = "GP4";
        GP4.Latitude  = 43.66689;
        GP4.Longitude = -79.42470;
        GP4.InfoHTML  = "This is point 4";
        GoogleMapForASPNet1.GoogleMapObject.Points.Add(GP4);

        GoogleMapForASPNet1.GoogleMapObject.Polylines["PL1"].Points.Add(GP4);
    }
Exemplo n.º 27
0
    //Add event handler for Map Click event
    void OnMapClicked(double dLat, double dLng)
    {
        //Print clicked map positions
        lblPushpin1.Text = "(" + dLat.ToString() + "," + dLng.ToString() + ")";

        //Generate new id for object
        string      sID = (GoogleMapForASPNet1.GoogleMapObject.Points.Count + 1).ToString();
        GooglePoint GP1 = new GooglePoint(sID, dLat, dLng);

        GP1.Draggable = true;
        GoogleMapForASPNet1.GoogleMapObject.Points.Add(GP1);
    }
Exemplo n.º 28
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //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 = 5;

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

        //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        = "Toronto";
        GP1.Latitude  = 43.73935;
        GP1.Longitude = -79.36523;
        //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/sun.png";
        GoogleMapForASPNet1.GoogleMapObject.Points.Add(GP1);


        GooglePoint GP2 = new GooglePoint();

        GP2.ID        = "Montreal";
        GP2.Latitude  = 45.52174; //+0.001
        GP2.Longitude = -73.65234;
        GP2.InfoHTML  = "This is Pushpin 2";
        GP2.IconImage = "icons/snow.png";
        GoogleMapForASPNet1.GoogleMapObject.Points.Add(GP2);


        GooglePoint GP3 = new GooglePoint();

        GP3.ID        = "Halifax";
        GP3.Latitude  = 44.62175;
        GP3.Longitude = -63.58886;
        GP3.InfoHTML  = "This is Pushpin 3";
        GP3.IconImage = "icons/rain.png";
        GoogleMapForASPNet1.GoogleMapObject.Points.Add(GP3);
    }
Exemplo n.º 29
0
 private void BindGermanyMap()
 {
     try
     {
         GooglePoint GP0 = new GooglePoint();
         GP0.Latitude  = 51.165691;
         GP0.Longitude = 10.451526;
         GoogleMapForASPNet1.GoogleMapObject.ZoomLevel   = 5;
         GoogleMapForASPNet1.GoogleMapObject.CenterPoint = new GooglePoint("1", GP0.Latitude, GP0.Longitude);
     }
     catch (Exception ex)
     {}
 }
Exemplo n.º 30
0
 private void Remove()
 {
     try
     {
         GoogleMapForASPNet1.GoogleMapObject.Polylines.Clear();
         GooglePoint GP2 = new GooglePoint();
         GoogleMapForASPNet1.GoogleMapObject.Points.Clear();
         string startCity = string.Empty;
         string endCity   = string.Empty;
     }
     catch (Exception ex)
     {}
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        //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.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 = "RedCar";
        GP1.Latitude = 43.65669;
        GP1.Longitude = -79.47268;  //+0.001
        //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/RedCar.png";
        //GP1.IconImageHeight = 5;
        //GP1.IconImageWidth = 5;
        GoogleMapForASPNet1.GoogleMapObject.Points.Add(GP1);

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

        GooglePoint GP3 = new GooglePoint();
        GP3.ID = "SchoolBus";
        GP3.Latitude = 43.67689;
        GP3.Longitude = -79.43270;
        GP3.InfoHTML = "This is Pushpin 3";
        GP3.IconImage = "icons/SchoolBus.png";
        GoogleMapForASPNet1.GoogleMapObject.Points.Add(GP3);
    }
Exemplo n.º 32
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         GoogleMapForASPNet1.GoogleMapObject.APIKey = ConfigurationManager.AppSettings["GoogleAPIKey"];
         GoogleMapForASPNet1.GoogleMapObject.APIVersion = "2";
         GoogleMapForASPNet1.GoogleMapObject.Width = "590px";
         GoogleMapForASPNet1.GoogleMapObject.Height = "489px";
         GoogleMapForASPNet1.GoogleMapObject.ZoomLevel = 12;
         GoogleMapForASPNet1.GoogleMapObject.AutomaticBoundaryAndZoom = false;
         GooglePoint GP = new GooglePoint("1", 30.59, 114.30);
         GoogleMapForASPNet1.GoogleMapObject.CenterPoint = GP;
         GoogleMapForASPNet1.GoogleMapObject.Points.Add(GP);
     }
 }
Exemplo n.º 33
0
 private void BindGermanyMap()
 {
     try
     {
         GooglePoint GP0 = new GooglePoint();
         GP0.Latitude  = 51.165691;
         GP0.Longitude = 10.451526;
         GoogleMapForASPNet1.GoogleMapObject.ZoomLevel   = 3;
         GoogleMapForASPNet1.GoogleMapObject.CenterPoint = new GooglePoint("1", GP0.Latitude, GP0.Longitude);
     }
     catch (Exception ex)
     {
         Helper.Log(ex.Message, "Bind Google Map Default Germany ");
     }
 }
Exemplo n.º 34
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;
    }
Exemplo n.º 35
0
 public void Remove()
 {
     try
     {
         int            i      = Convert.ToInt32(grdStagePlan.Rows.Count.ToString()) + 1;
         GooglePoint[]  Gpoint = new GooglePoint[i + 1];
         GooglePolyline PL1    = new GooglePolyline();
         Array.Clear(Gpoint, 0, Gpoint.Length);
         PL1.Points.Clear();
         GoogleMapForASPNet1.GoogleMapObject.Polylines.Clear();
         GoogleMapForASPNet1.GoogleMapObject.Points.Clear();
         GooglePoint Gp = new GooglePoint();
     }
     catch (Exception)
     {}
 }
Exemplo n.º 36
0
    protected void btnRecenter_Click(object sender, EventArgs e)
    {
        //Note that buttons are placed inside an Ajax UpdatePanel. This is to prevent postback of the page.
        //Recenter Map to a new google point.
        GooglePoint GP = new GooglePoint();
        GP.Latitude = 43.67619;
        GP.Longitude = -79.45268;
        GP.IconImage = "icons/pushpin-yellow.png";
        GP.ToolTip = "New Center Point";
        GP.InfoHTML = "This is a new center point";
        GoogleMapForASPNet1.GoogleMapObject.CenterPoint = GP;
        GoogleMapForASPNet1.GoogleMapObject.Points.Add(GP);

        //You must set following property in order to Recenter a map.
        GoogleMapForASPNet1.GoogleMapObject.RecenterMap = true;
    }
Exemplo n.º 37
0
    private void Remove()
    {
        try
        {
            GoogleMapForASPNet1.GoogleMapObject.Polylines.Clear();
            GooglePoint GP2 = new GooglePoint();

            GoogleMapForASPNet1.GoogleMapObject.Points.Clear();
            string startCity = string.Empty;
            string endCity   = string.Empty;
        }
        catch (Exception ex)
        {
            Helper.Log(ex.Message, " Remove Point From Google Map ");
        }
    }
Exemplo n.º 38
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
Exemplo n.º 39
0
    public void show_selecport(int PortID)
    {
        string str_longitude;
        string str_latitude;
        //GoogleMapForASPNet1.GoogleMapObject.Points.Clear();

        DataTable dtPort = objPort.Get_PortDetailsByID(PortID);

        if (dtPort.Rows.Count > 0)
        {
            str_longitude = dtPort.Rows[0]["Port_Lon"].ToString();
            str_latitude  = dtPort.Rows[0]["Port_Lat"].ToString();

            string latitude;
            string longitude;

            try
            {
                GoogleMapForASPNet1.GoogleMapObject.APIKey    = ConfigurationManager.AppSettings["GoogleAPIKey"];
                GoogleMapForASPNet1.GoogleMapObject.ZoomLevel = 2;
                GoogleMapForASPNet1.GoogleMapObject.AutomaticBoundaryAndZoom = false;
                //GoogleMapForASPNet1.GoogleMapObject.MapType = GoogleMapType.NORMAL_MAP;

                GooglePoint gp = new GooglePoint();

                gp.IconImage       = "../Images/port.gif";
                gp.IconImageWidth  = 15;
                gp.IconImageHeight = 15;

                latitude  = convdegtodecimal_all(str_latitude);
                longitude = convdegtodecimal_all(str_longitude);

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

                gp.InfoHTML = "Port Name: " + dtPort.Rows[0]["Port_Name"].ToString() + "<br>Country: " + dtPort.Rows[0]["Port_Country"].ToString() + "<br>Longitude: " + str_longitude + "<br>Latitude: " + str_latitude;


                GoogleMapForASPNet1.GoogleMapObject.Points.Add(gp);
            }

            catch (Exception ex)
            {
            }
        }
    }
Exemplo n.º 40
0
    public void Remove()
    {
        try
        {
            int i = Convert.ToInt32(grdStagePlan.Rows.Count.ToString()) + 1;
            GooglePoint[] Gpoint = new GooglePoint[i + 1];
            GooglePolyline PL1 = new GooglePolyline();
            Array.Clear(Gpoint, 0, Gpoint.Length);
            PL1.Points.Clear();
            GoogleMapForASPNet1.GoogleMapObject.Polylines.Clear();
            GoogleMapForASPNet1.GoogleMapObject.Points.Clear();
            GooglePoint Gp = new GooglePoint();

        }
        catch (Exception)
        {}
    }
Exemplo n.º 41
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Organization
        string OrgName = Session["OrgNam"].ToString();
        string OrgLat  = Session["Orglat"].ToString();
        string OrgLng  = Session["Orglng"].ToString();
        // Block
        string BlockType = Session["Block_Typ"].ToString();
        string BlockDes  = Session["Block_Des"].ToString();
        string BlockLat  = Session["Block_lat"].ToString();
        string BlockLng  = Session["Block_lng"].ToString();


        GoogleMapForASPNet1.GoogleMapObject.APIKey = ConfigurationManager.AppSettings["GoogleAPIKey"];

        GoogleMapForASPNet1.GoogleMapObject.Width  = "940px";
        GoogleMapForASPNet1.GoogleMapObject.Height = "600px";

        GoogleMapForASPNet1.GoogleMapObject.ZoomLevel = 10;


        GoogleMapForASPNet1.GoogleMapObject.CenterPoint = new GooglePoint("1", 6.932817124836652, 79.86442565917969);// 6.276505 ...  43.66619, -79.44268

        // --- Organization ---
        GooglePoint GP1 = new GooglePoint();

        GP1.ID        = "1";
        GP1.Latitude  = Convert.ToDouble(OrgLat);
        GP1.Longitude = Convert.ToDouble(OrgLng);
        GP1.InfoHTML  = "<div style='font:bold 14px verdana;color:darkgreen;margin-left:2px;'>" + OrgName + "</div>" + "the Serivce Provider";
        GP1.ToolTip   = "the Service Provider";
        GP1.IconImage = "icons/FireTruck.png";
        GoogleMapForASPNet1.GoogleMapObject.Points.Add(GP1);

        // --- Block Point ---
        GooglePoint GP2 = new GooglePoint();

        GP2.ID        = "2";
        GP2.Latitude  = Convert.ToDouble(BlockLat);
        GP2.Longitude = Convert.ToDouble(BlockLng);
        GP2.InfoHTML  = "<div style='font:bold 14px verdana;color:darkgreen;margin-left:2px;'>" + BlockType + "</div>" + BlockDes;
        GP2.ToolTip   = BlockType;
        GP2.IconImage = "icons/pushpin-yellow.png";
        GoogleMapForASPNet1.GoogleMapObject.Points.Add(GP2);
    }
Exemplo n.º 42
0
    private void LoadMap(string add)
    {
        GooglePoint GP = new GooglePoint();
        GP.Address = add;

        if (GP.GeocodeAddress(ConfigurationManager.AppSettings["GoogleAPIKey"].ToString()))
        {
            GP.InfoHTML = GP.Address;
            GoogleMapForASPNet1.GoogleMapObject.CenterPoint = GP;
            txtKinhDo.Text = GP.Longitude;
            txtViDo.Text = GP.Latitude;
            GoogleMapForASPNet1.GoogleMapObject.Points.Clear();
            GP.Draggable = true;
            GoogleMapForASPNet1.GoogleMapObject.Points.Add(GP);
            GoogleMapForASPNet1.GoogleMapObject.ZoomLevel = 15;
            GoogleMapForASPNet1.GoogleMapObject.RecenterMap = true;
        }
    }
Exemplo n.º 43
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.
        GooglePoint p = obj as GooglePoint;

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

        // Return true if the fields match:
        return((InfoHTML == p.InfoHTML) && (IconImage == p.IconImage) && (p.ID == ID) && (p.Latitude == Latitude) && (p.Longitude == Longitude));
    }
Exemplo n.º 44
0
    private void populatePins2()
    {
        GoogleMapForASPNet2.GoogleMapObject.Points.Clear();

        DataTable dt = Filter_GetDataTable();
        int       i  = 0;

        foreach (DataRow r in dt.Rows)
        {
            string      event_type_name = Convert.ToString(r["EVENT_TYPE_NAME"]);
            GooglePoint p = new GooglePoint();
            p.ID        = event_type_name + i;
            p.Latitude  = Convert.ToDouble(r["LOCATION_LAT"]);
            p.Longitude = Convert.ToDouble(r["LOCATION_LONG"]);
            p.InfoHTML  = "This was a case of " + event_type_name;
            p.IconImage = Data_CrimeTypeIcons[event_type_name];

            GoogleMapForASPNet2.GoogleMapObject.Points.Add(p);
        }
    }
Exemplo n.º 45
0
    protected void Page_Load(object sender, EventArgs e)
    {
        HtmlAnchor b = (HtmlAnchor)this.Page.Master.FindControl("contactus");

        b.Style.Add("font-weight", "bold");
        b.Style.Add("color", "orange");

        GoogleMapForASPNet1.GoogleMapObject.APIKey     = "AIzaSyBsinKE8VhDmBbrlfjJsuGq9wNCWlsuIk0";
        GoogleMapForASPNet1.GoogleMapObject.APIVersion = "2";
        GoogleMapForASPNet1.GoogleMapObject.Width      = "745px";
        GoogleMapForASPNet1.GoogleMapObject.Height     = "205px";
        GoogleMapForASPNet1.GoogleMapObject.ZoomLevel  = 14;
        GooglePoint GP = new GooglePoint();

        GP.ID        = "1";
        GP.Latitude  = 23.0214418;
        GP.Longitude = 72.5545012;
        GoogleMapForASPNet1.GoogleMapObject.Points.Add(GP);
        Label1.Visible = false;
    }
Exemplo n.º 46
0
 public void Remove()
 {
     try
     {
         List<GooglePoint> Gp = new List<GooglePoint>();
         List<GooglePoint> Gp2 = new List<GooglePoint>();
         int i = Convert.ToInt32(grdStagePlan.Rows.Count.ToString());
         GooglePoint[] Gpoint = new GooglePoint[i];
         int i2 = Convert.ToInt32(grdStagePlan.Rows.Count.ToString());
         GooglePolyline PL1 = new GooglePolyline();
         GooglePoint[] Gpoint2 = new GooglePoint[i2];
         Array.Clear(Gpoint, 0, Gpoint.Length);
         Array.Clear(Gpoint2, 0, Gpoint.Length);
         Gp.Clear();
         Gp2.Clear();
         PL1.Points.Clear();
         GoogleMapForASPNet1.GoogleMapObject.Polylines.Clear();
         GoogleMapForASPNet1.GoogleMapObject.Points.Clear();
     }
     catch (Exception)
     {}
 }
Exemplo n.º 47
0
 public void Remove()
 {
     try
     {
         List <GooglePoint> Gp  = new List <GooglePoint>();
         List <GooglePoint> Gp2 = new List <GooglePoint>();
         int            i       = Convert.ToInt32(grdStagePlan.Rows.Count.ToString());
         GooglePoint[]  Gpoint  = new GooglePoint[i];
         int            i2      = Convert.ToInt32(grdStagePlan.Rows.Count.ToString());
         GooglePolyline PL1     = new GooglePolyline();
         GooglePoint[]  Gpoint2 = new GooglePoint[i2];
         Array.Clear(Gpoint, 0, Gpoint.Length);
         Array.Clear(Gpoint2, 0, Gpoint.Length);
         Gp.Clear();
         Gp2.Clear();
         PL1.Points.Clear();
         GoogleMapForASPNet1.GoogleMapObject.Polylines.Clear();
         GoogleMapForASPNet1.GoogleMapObject.Points.Clear();
     }
     catch (Exception)
     {}
 }
Exemplo n.º 48
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 = "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);
        }
    }
Exemplo n.º 49
0
    public static bool GeocodeAddress(GooglePoint GP,string GoogleAPIKey)
    {
        string sURL = "http://maps.google.com/maps/geo?q=" + GP.Address + "&output=xml&key=" + GoogleAPIKey;
        WebRequest request = WebRequest.Create(sURL);
        request.Timeout = 10000;
        // Set the Method property of the request to POST.
        request.Method = "POST";
        // Create POST data and convert it to a byte array.
        string postData = "This is a test that posts this string to a Web server.";
        byte[] byteArray = Encoding.UTF8.GetBytes(postData);
        // Set the ContentType property of the WebRequest.
        request.ContentType = "application/x-www-form-urlencoded";
        // Set the ContentLength property of the WebRequest.
        request.ContentLength = byteArray.Length;
        // Get the request stream.
        Stream dataStream = request.GetRequestStream();

        // Write the data to the request stream.
        dataStream.Write(byteArray, 0, byteArray.Length);
        // Close the Stream object.
        dataStream.Close();
        // Get the response.
        WebResponse response = request.GetResponse();
        // Display the status.
        //Console.WriteLine(((HttpWebResponse)response).StatusDescription);
        // Get the stream containing content returned by the server.
        dataStream = response.GetResponseStream();
        // Open the stream using a StreamReader for easy access.
        StreamReader reader = new StreamReader(dataStream);
        // Read the content.
        string responseFromServer = reader.ReadToEnd();

        StringReader tx = new StringReader(responseFromServer) ;

        //return false;
        //System.Xml.XmlReader xr = new System.Xml.XmlReader();

        //return false;

        DataSet DS = new DataSet();
        DS.ReadXml(tx);
        //DS.ReadXml(dataStream);
        //DS.ReadXml(tx);

        int StatusCode = cCommon.GetIntegerValue(DS.Tables["Status"].Rows[0]["code"]);
        if (StatusCode == 200)
        {
            string sLatLon = cCommon.GetStringValue(DS.Tables["Point"].Rows[0]["coordinates"]);
            string[] s = sLatLon.Split(',');
            if (s.Length > 1)
            {
                GP.Latitude = cCommon.GetNumericValue(s[1]);
                GP.Longitude = cCommon.GetNumericValue(s[0]);
            }
            if (DS.Tables["Placemark"] != null)
            {
                GP.Address = cCommon.GetStringValue(DS.Tables["Placemark"].Rows[0]["address"]);
            }
            if (DS.Tables["PostalCode"] != null)
            {
                GP.Address += " " + cCommon.GetStringValue(DS.Tables["PostalCode"].Rows[0]["PostalCodeNumber"]);
            }
            return true;
        }
        return false;
    }
Exemplo n.º 50
0
    private void BindMap()
    {
        try
        {
            Remove();
            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 = "700px"; // You can also specify percentage(e.g. 80%) here
            GoogleMapForASPNet1.GoogleMapObject.Height = "350px";
            //Specify initial Zoom level.
            GoogleMapForASPNet1.GoogleMapObject.ZoomLevel = 2;
            //Specify Center Point for map. Map will be centered on this point.
            // Run time you can ava of lat or long
            List<GooglePoint> Gp = new List<GooglePoint>();
            GooglePoint min = new GooglePoint();
            int i = Convert.ToInt32(grdStagePlan.Rows.Count.ToString());
            GooglePoint[] Gpoint = new GooglePoint[i];
            GooglePolyline PL1 = new GooglePolyline();
            List<GooglePoint> Gp2 = new List<GooglePoint>();
            int i2 = Convert.ToInt32(grdStagePlan.Rows.Count.ToString());
            GooglePoint[] Gpoint2 = new GooglePoint[i2];
            GooglePoint min1 = new GooglePoint();
            double centerlat;
            double ceterlong;
            DataTable dat1=new DataTable();
            dat1.Columns.Add("Lattitude", typeof(double));
            dat1.Columns.Add("Longitude", typeof(double));
            DataTable dat2 = new DataTable();
            dat2.Columns.Add("Lattitude", typeof(double));
            dat2.Columns.Add("Longitude", typeof(double));
            PL1.ColorCode = "#0000FF";
            PL1.Width = 5;
            for (int Count = 0; Count <= grdStagePlan.Rows.Count; Count++)
            {
                string FromCity = string.Empty;
                string ToCity = string.Empty;
                 FromCity = ((Label)grdStagePlan.Rows[Count].FindControl("lblFromCity")).Text;
                 ToCity = ((Label)grdStagePlan.Rows[Count].FindControl("lblToCity")).Text;
                if (FromCity != null)
                {
                    Gpoint[Count] = new GooglePoint();
                    Gp.Add(Gpoint[Count]);
                    Gpoint[Count].ID = "Gpoint[Count]";
                    string appId = "dj0yJmk9NUdkWVpoeGhPMHh1JmQ9WVdrOVZXRnFaa0poTm1zbWNHbzlNVEl6TURBek1UYzJNZy0tJnM9Y29uc3VtZXJzZWNyZXQmeD04Nw--";
                    string url = string.Format("http://where.yahooapis.com/geocode?location={0}&appid={1}", Server.UrlEncode(FromCity), appId);
                    HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url);
                    try
                    {
                        using (WebResponse response = request.GetResponse())
                        {
                            using (DataSet ds = new DataSet())
                            {
                                try
                                {
                                    ds.ReadXml(response.GetResponseStream());
                                    Gpoint[Count].Latitude = double.Parse(ds.Tables["Result"].Rows[0]["Latitude"].ToString(), System.Globalization.CultureInfo.InvariantCulture);
                                    Gpoint[Count].Longitude = double.Parse(ds.Tables["Result"].Rows[0]["Longitude"].ToString(), System.Globalization.CultureInfo.InvariantCulture);
                                    GoogleMapForASPNet1.GoogleMapObject.Points.Add(Gpoint[Count]);
                                    Gpoint[Count].InfoHTML=FromCity;
                                    Gpoint[Count].IconImage ="icons/sun.png";
                                    dat1.NewRow();
                                    dat1.Rows.Add(Gpoint[Count].Latitude, Gpoint[Count].Longitude);
                                    response.Close();
                                }
                                catch (Exception ex)
                                { }
                                finally
                                {
                                    ds.Dispose();
                                }

                            }
                        }
                    }
                    catch (Exception ex)
                    {
                    }

                }

                if (ToCity != null)
                {
                    Gpoint2[Count] = new GooglePoint();
                    Gp2.Add(Gpoint[Count]);
                    Gpoint2[Count].ID = "Gpoint2[Count]";
                    string appId = "{ConsumerKey}";
                    string url = string.Format("http://where.yahooapis.com/geocode?location={0}&appid={1}", Server.UrlEncode(ToCity), appId);
                    HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url);
                    using (WebResponse response = request.GetResponse())
                    {
                        using (DataSet ds = new DataSet())
                        {
                            try
                            {
                                ds.ReadXml(response.GetResponseStream());
                                Gpoint2[Count].Latitude = double.Parse(ds.Tables["Result"].Rows[0]["Latitude"].ToString(), System.Globalization.CultureInfo.InvariantCulture);
                                Gpoint2[Count].Longitude = double.Parse(ds.Tables["Result"].Rows[0]["Longitude"].ToString(), System.Globalization.CultureInfo.InvariantCulture);
                                GoogleMapForASPNet1.GoogleMapObject.Points.Add(Gpoint2[Count]);
                                Gpoint2[Count].InfoHTML =ToCity;
                                Gpoint[Count].IconImage = "icons/snow.png";
                                dat2.NewRow();
                                dat2.Rows.Add(Gpoint2[Count].Latitude, Gpoint2[Count].Longitude);
                                response.Close();
                            }
                            catch (Exception ex)
                            { }
                            finally
                            {
                                //ds.Clear();
                                ds.Dispose();
                            }

                        }
                    }
                }

                PL1.Points.Add(Gpoint[Count]);
                PL1.Points.Add(Gpoint2[Count]);
                GoogleMapForASPNet1.GoogleMapObject.Polylines.Add(PL1);

            }

            //Plyline Draw
           // GoogleMapForASPNet1.GoogleMapObject.Polylines.Add(PL1);
            //Google Map Certer
            Double MinLattitude = Double.MaxValue;
            Double MinLongitude = Double.MaxValue;
            foreach (DataRow dr in dat1.Rows)
            {
                double Lattitude = dr.Field<double>("Lattitude");
                double Longitude = dr.Field<double>("Longitude");
                MinLattitude = Math.Min(MinLattitude, Lattitude);
                MinLongitude = Math.Min(MinLongitude, Longitude);

            }

            GoogleMapForASPNet1.GoogleMapObject.CenterPoint = new GooglePoint("1", MinLattitude, MinLongitude);

        }
        catch (Exception ex)
        {
        }
    }
    protected void lbtImport_Click(object sender, EventArgs e)
    {
        int iOK = 0, iNOK = 0;
        DataTable tblLoi = new DataTable();
        tblLoi.Columns.Add("sTenCoSo", typeof(string));
        tblLoi.Columns.Add("sLoi", typeof(string));

        CosonuoitrongEntity oCSNT = new CosonuoitrongEntity();
        int FK_iQuanHuyenID;
        DataTable dtCSNT = GetDataFromExcelFile(Server.MapPath(ConfigurationManager.AppSettings["UploadPath"] + "\\" + ViewState["FileName"].ToString()));
        if (dtCSNT.Rows.Count > 0)
        {
            for (int i = 0; i < dtCSNT.Rows.Count; i++)
            {
                string loi = "";
                if ((dtCSNT.Rows[i]["FK_iUserID"] != null) && (dtCSNT.Rows[i]["FK_iQuanHuyenID"] != null) && (dtCSNT.Rows[i]["FK_iDoituongnuoiID"] != null) && (dtCSNT.Rows[i]["FK_iHinhthucnuoiID"] != null))
                {
                    try
                    {
                        try
                        {
                            FK_iQuanHuyenID = Convert.ToInt32(dtCSNT.Rows[i]["FK_iQuanHuyenID"]);
                            oCSNT.FK_iQuanHuyenID = FK_iQuanHuyenID;
                        }
                        catch
                        {
                            loi += "- FK_iQuanHuyenID phải là số <br/> ";
                        }
                        try
                        {
                            oCSNT.bDuyet = Convert.ToBoolean(dtCSNT.Rows[i]["bDuyet"]);
                        }
                        catch
                        {
                            loi += "- bDuyet sai định dạng true/false<br/> ";
                        }
                        try
                        {
                            string ngay = dtCSNT.Rows[i]["dNgaydangky"].ToString().Substring(0, 10);
                            oCSNT.dNgaydangky = DateTime.ParseExact(ngay, "dd/MM/yyyy", CultureInfo.InvariantCulture);
                        }
                        catch
                        {
                            loi += "- dNgaydangky sai định dạng dd/MM/yyyy<br/>";
                        }
                        try
                        {
                            oCSNT.fDientichAolang = float.Parse(dtCSNT.Rows[i]["fDientichAolang"].ToString());
                        }
                        catch
                        {
                            loi += "- fDientichAolang phải là số thực<br/>";
                        }
                        try
                        {
                            oCSNT.FK_iDoituongnuoiID = Convert.ToInt32(dtCSNT.Rows[i]["FK_iDoituongnuoiID"]);
                        }
                        catch
                        {
                            loi += "- FK_iDoituongnuoiID phải là số<br/>";
                        }
                        try
                        {
                            oCSNT.FK_iHinhthucnuoiID = Convert.ToInt32(dtCSNT.Rows[i]["FK_iHinhthucnuoiID"]);
                        }
                        catch
                        {
                            loi += "- FK_iHinhthucnuoiID phải là số<br/>";
                        }

                        try
                        {
                            oCSNT.FK_iUserID = Convert.ToInt32(dtCSNT.Rows[i]["FK_iUserID"]);
                        }
                        catch
                        {
                            loi += "- FK_iUserID phải là số <br/>";
                        }
                        try
                        {
                            oCSNT.fTongdientich = float.Parse(dtCSNT.Rows[i]["fTongdientich"].ToString());
                        }
                        catch
                        {
                            loi += "- fTongdientich phải là số thực<br/>";
                        }
                        try
                        {
                            oCSNT.fTongdientichmatnuoc = float.Parse(dtCSNT.Rows[i]["fTongdientichmatnuoc"].ToString());
                        }
                        catch
                        {
                            loi += "- fTongdientichmatnuoc phải là số thực<br/>";
                        }
                        try
                        {
                            oCSNT.iChukynuoi = Convert.ToInt32(dtCSNT.Rows[i]["iChukynuoi"]);
                        }
                        catch
                        {
                            loi += "- iChukynuoi phải là số<br/>";
                        }
                        try
                        {
                            oCSNT.iNamsanxuat = Convert.ToInt32(dtCSNT.Rows[i]["iNamsanxuat"]);
                        }
                        catch
                        {
                            loi += "- iNamsanxuat phải là số<br/>";
                        }
                        try
                        {
                            oCSNT.iSanluongdukien = Convert.ToInt32(dtCSNT.Rows[i]["iSanluongdukien"]);
                        }
                        catch
                        {
                            loi += "- iSanluongdukien phải là số<br/>";
                        }
                        oCSNT.sAp = dtCSNT.Rows[i]["sAp"].ToString();
                        oCSNT.sDienthoai = dtCSNT.Rows[i]["sDienthoai"].ToString();
                        oCSNT.sMaso_vietgap = dtCSNT.Rows[i]["sMaso_vietgap"].ToString();
                        oCSNT.sMasocoso = dtCSNT.Rows[i]["sMasocoso"].ToString();
                        oCSNT.sSodoaonuoi = dtCSNT.Rows[i]["sSodoaonuoi"].ToString();
                        oCSNT.sTencoso = dtCSNT.Rows[i]["sTencoso"].ToString();
                        oCSNT.sTenchucoso = dtCSNT.Rows[i]["sTenchucoso"].ToString();
                        oCSNT.sXa = dtCSNT.Rows[i]["sXa"].ToString();

                        if (QuanHuyenBRL.GetOne(oCSNT.FK_iQuanHuyenID) == null)
                        {
                            loi += "- (FK_iQuanHuyen) Quận huyện không tồn tại<br/> ";
                        }
                        if (DoituongnuoiBRL.GetOne(oCSNT.FK_iDoituongnuoiID) == null)
                        {
                            loi += "- (FK_iDoituongnuoiID) Đối tượng nuôi không tồn tại";
                        }
                        if (HinhthucnuoiBRL.GetOne(oCSNT.FK_iHinhthucnuoiID) == null)
                        {
                            loi += "- (FK_iHinhthucnuoiID) Hình thức nuôi không tồn tại<br/> ";
                        }
                        if (UserBRL.GetOne(Convert.ToInt32(oCSNT.FK_iUserID)) == null)
                        {
                            loi += "- (FK_iUserID) Người dùng hệ thống không tồn tại<br/> ";
                        }
                        string diachi = "";
                        if (oCSNT.sAp.Trim().Length > 0)
                        {
                            diachi += oCSNT.sAp + ", ";
                        }
                        if (oCSNT.sXa.Trim().Length > 0)
                        {
                            diachi += oCSNT.sXa + ", ";
                        }
                        QuanHuyenEntity oQuanHuyen = QuanHuyenBRL.GetOne(oCSNT.FK_iQuanHuyenID);
                        if (oQuanHuyen != null)
                        {
                            diachi += oQuanHuyen.sTen + ", ";
                            TinhEntity oTinh = TinhBRL.GetOne(oQuanHuyen.FK_iTinhThanhID);
                            diachi += oTinh.sTentinh;
                        }
                        GooglePoint GP = new GooglePoint();
                        GP.Address = diachi;
                        if (GP.GeocodeAddress(ConfigurationManager.AppSettings["GoogleAPIKey"].ToString()))
                        {
                            GP.InfoHTML = GP.Address;
                            ToadoEntity oToaDo = new ToadoEntity();
                            oToaDo.Latitude = GP.Latitude;
                            oToaDo.Longitude = GP.Longitude;
                            oCSNT.FK_iToadoID = ToadoBRL.Add(oToaDo);
                        }
                        if (oCSNT.FK_iToadoID == null)
                        {
                            loi += "- Không thể xác định tọa độ của địa chỉ trên<br/>";
                        }
                        //fu.SaveAs(Server.MapPath(Server.HtmlEncode(dtCSNT.Rows[i]["sSodoaonuoi"].ToString())));
                        if (loi.Trim().Length == 0)
                        {
                            CosonuoitrongBRL.Add(oCSNT);
                            iOK++;
                        }
                        else
                        {

                            iNOK++;
                        }
                    }
                    catch (Exception ex)
                    {
                        loi += "Lỗi khi thêm mới: " + ex.Message + "br/>";
                        iNOK++;
                    }
                    finally {
                        if (loi.Trim().Length > 0)
                        {
                            tblLoi.Rows.Add(oCSNT.sTencoso, loi);

                        }
                    }
                }
            }
            if (tblLoi.Rows.Count > 0)
            {
                pnLoi.Visible = true;
                rptLoi.DataSource = tblLoi;
                rptLoi.DataBind();
            }
            else
            {
                pnLoi.Visible = false;
            }

            lblThongbao.Text = "Có " + iOK.ToString() + " import thành công và " + iNOK.ToString() + " thất bại";
        }
    }
Exemplo n.º 52
0
    private void BindMap(string GpxFile, string FileName)
    {
        lblJourny.Text = FileName;
        div_GpxMap.Visible = true;
        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 = "960px"; // You can also specify percentage(e.g. 80%) here
        GoogleMapForASPNet1.GoogleMapObject.Height = "450px";
        DataTable dat1 = new DataTable();
        GoogleMapForASPNet1.GoogleMapObject.ZoomLevel = 15;
        GooglePoint GP = new GooglePoint();
        dat1.Columns.Add("Lattitude", typeof(double));
        dat1.Columns.Add("Longitude", typeof(double));
        GooglePolyline PL1 = new GooglePolyline();
        PL1.Width = 5;
        PL1.ColorCode = "Green";

        DataTable _dt = new DataTable();
        _dt = LoadGPXWaypoints(GpxFile);
        if (_dt != null && _dt.Rows.Count > 0)
        {
            int i = Convert.ToInt32(_dt.Rows.Count);
            GooglePoint[] Gpoint = new GooglePoint[i + 1];
            List<string> City = new List<string>();
            bool frmCity = false;
            bool toCity = false;
            int objCont = 0;

            int pointsCount = 20;
            if (i < pointsCount)
            {
                pointsCount = i;
            }
            int pointsInterval = i / 20;

            int pointsPloatted = 1;

            for (int Count = 0; Count < _dt.Rows.Count; Count++)
            {
                if (Count % (pointsInterval + 1) == 0 && pointsPloatted < 19)
                {
                    string FromCity, ToCity = string.Empty;
                    double FromCitylat, FromCitylon, ToCitylog, ToCitylat = 0;
                    try
                    {
                        FromCitylat = double.Parse(_dt.Rows[Count]["lat"].ToString(), System.Globalization.CultureInfo.InvariantCulture);
                        FromCitylon = double.Parse(_dt.Rows[Count]["lon"].ToString(), System.Globalization.CultureInfo.InvariantCulture);
                        ToCitylat = double.Parse(_dt.Rows[Count + 1]["lat"].ToString(), System.Globalization.CultureInfo.InvariantCulture);
                        ToCitylog = double.Parse(_dt.Rows[Count + 1]["lon"].ToString(), System.Globalization.CultureInfo.InvariantCulture);
                        if (FromCitylat != 0)
                        {
                            Gpoint[objCont] = new GooglePoint();
                            Gpoint[objCont].Latitude = FromCitylat;
                            Gpoint[objCont].Longitude = FromCitylon;
                            //GoogleMapForASPNet1.GoogleMapObject.Points.Add(Gpoint[objCont]);
                            dat1.NewRow();
                            dat1.Rows.Add(Gpoint[objCont].Latitude, Gpoint[objCont].Longitude);
                            PL1.Points.Add(Gpoint[objCont]);
                            frmCity = true;
                            objCont++;
                        }
                        if (ToCitylat != 0)
                        {
                            Gpoint[objCont] = new GooglePoint();
                            Gpoint[objCont].Latitude = ToCitylat;
                            Gpoint[objCont].Longitude = ToCitylog;
                            //GoogleMapForASPNet1.GoogleMapObject.Points.Add(Gpoint[objCont]);
                            dat1.NewRow();
                            dat1.Rows.Add(Gpoint[objCont].Latitude, Gpoint[objCont].Longitude);
                            PL1.Points.Add(Gpoint[objCont]);
                            frmCity = false;
                            objCont++;
                        }
                    }
                    catch (Exception ex)
                    { }
                    GoogleMapForASPNet1.GoogleMapObject.Polylines.Add(PL1);
                    pointsPloatted++;
                }
            }

            Double MinLattitude = Double.MaxValue;
            Double MinLongitude = Double.MaxValue;
            foreach (DataRow dr in dat1.Rows)
            {
                double Lattitude = dr.Field<double>("Lattitude");
                double Longitude = dr.Field<double>("Longitude");
                MinLattitude = Math.Min(MinLattitude, Lattitude);
                MinLongitude = Math.Min(MinLongitude, Longitude);
            }
            GoogleMapForASPNet1.GoogleMapObject.CenterPoint = new GooglePoint("1", MinLattitude, MinLongitude);
        }
        else
        {
            GooglePoint GP0 = new GooglePoint();
            GP0.Latitude = 51.165691;
            GP0.Longitude = 10.451526;
            GoogleMapForASPNet1.GoogleMapObject.ZoomLevel = 5;
            GoogleMapForASPNet1.GoogleMapObject.CenterPoint = new GooglePoint("1", GP0.Latitude, GP0.Longitude);
        }
    }
Exemplo n.º 53
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;
    }
Exemplo n.º 54
0
    private void BindMap()
    {
        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 = "620px"; // You can also specify percentage(e.g. 80%) here
        GoogleMapForASPNet1.GoogleMapObject.Height = "350px";
        DataTable dat1 = new DataTable();
        GoogleMapForASPNet1.GoogleMapObject.ZoomLevel = 5;
        GooglePoint GP = new GooglePoint();
        dat1.Columns.Add("Lattitude", typeof(double));
        dat1.Columns.Add("Longitude", typeof(double));
        GooglePolyline PL1 = new GooglePolyline();
        PL1.Width = 5;
        PL1.ColorCode = "Blue";
        int i = Convert.ToInt32(grdStagePlan.Rows.Count.ToString()) + 1;
        GooglePoint[] Gpoint = new GooglePoint[i + 1];
        List<string> City = new List<string>();
        bool frmCity = false;
        bool toCity = false;
        int objCont = 0;

        if (grdStagePlan.Rows.Count > 0)
        {
            for (int Count = 0; Count < grdStagePlan.Rows.Count; Count++)
            {
                string FromCity, ToCity = string.Empty;
                float FromCitylat, FromCitylon, ToCitylog, ToCitylat = 0;
                try
                {

                    FromCity = ((Label)grdStagePlan.Rows[Count].FindControl("lblFromCity")).Text;
                    ToCity = ((Label)grdStagePlan.Rows[Count].FindControl("lblToCity")).Text;
                    FromCitylat = float.Parse(grdStagePlan.Rows[Count].Cells[6].Text);
                    FromCitylon = float.Parse(grdStagePlan.Rows[Count].Cells[7].Text);
                    ToCitylat = float.Parse(grdStagePlan.Rows[Count].Cells[8].Text);
                    ToCitylog = float.Parse(grdStagePlan.Rows[Count].Cells[9].Text);
                    if (FromCity != null && !City.Contains(FromCity))
                    {

                        City.Add(FromCity);
                        Gpoint[objCont] = new GooglePoint();
                        Gpoint[objCont].InfoHTML = FromCity;
                        Gpoint[objCont].Latitude = FromCitylat;
                        Gpoint[objCont].Longitude = FromCitylon;
                        GoogleMapForASPNet1.GoogleMapObject.Points.Add(Gpoint[objCont]);
                        dat1.NewRow();
                        dat1.Rows.Add(Gpoint[objCont].Latitude, Gpoint[objCont].Longitude);
                        PL1.Points.Add(Gpoint[objCont]);
                        frmCity = true;
                        objCont++;
                    }
                    if (ToCity != null && !City.Contains(ToCity))
                    {

                        Gpoint[objCont] = new GooglePoint();
                        Gpoint[objCont].InfoHTML = ToCity;
                        Gpoint[objCont].Latitude = ToCitylat;
                        Gpoint[objCont].Longitude = ToCitylog;
                        GoogleMapForASPNet1.GoogleMapObject.Points.Add(Gpoint[objCont]);
                        dat1.NewRow();
                        City.Add(ToCity);
                        dat1.Rows.Add(Gpoint[objCont].Latitude, Gpoint[objCont].Longitude);
                        PL1.Points.Add(Gpoint[objCont]);
                        frmCity = false;
                        objCont++;

                    }

                }
                catch (Exception ex)
                { }
                GoogleMapForASPNet1.GoogleMapObject.Polylines.Add(PL1);

            }
            Double MinLattitude = Double.MaxValue;
            Double MinLongitude = Double.MaxValue;
            foreach (DataRow dr in dat1.Rows)
            {
                double Lattitude = dr.Field<double>("Lattitude");
                double Longitude = dr.Field<double>("Longitude");
                MinLattitude = Math.Min(MinLattitude, Lattitude);
                MinLongitude = Math.Min(MinLongitude, Longitude);
            }
            GoogleMapForASPNet1.GoogleMapObject.CenterPoint = new GooglePoint("1", MinLattitude, MinLongitude);
        }
        else
        {
            GooglePoint GP0 = new GooglePoint();
            GP0.Latitude = 51.165691;
            GP0.Longitude = 10.451526;
            GoogleMapForASPNet1.GoogleMapObject.ZoomLevel = 5;
            GoogleMapForASPNet1.GoogleMapObject.CenterPoint = new GooglePoint("1", GP0.Latitude, GP0.Longitude);
        }
    }
Exemplo n.º 55
0
        public TrackAndLabel(int LineWidth, double Lat, double Lon, string Track_ID, string Label_ID, // This has be a CALLSIGN or ModeA
                            string ModeC)
        {
            // Track data
            Track.Latitude = Lat;
            Track.Longitude = Lon;
            Track.ID = Track_ID;
            if (IconSwitcher == 0)
            Track.IconImage = "icons/Track_Blue.png";
            else
            Track.IconImage = "icons/Track_Pink.png";

            // Label Data
            TextToImage TI = new TextToImage();
            TI.GenerateAndStore(Label_ID + IconSwitcher.ToString(), Label_ID + Environment.NewLine + ModeC, Color.Green);
            Label.ID = Label_ID;
            Label.Draggable = true;
            Label.IconImage = "icons/labels/dynamic/" + Label_ID + IconSwitcher.ToString() + ".png";
            if (IconSwitcher == 0)
                IconSwitcher = 1;
            else
                IconSwitcher = 0;

            // Place the label close the the track symbol factoring in the zoom setting.
            Label.Latitude = Track.Latitude + (0.2 / CustomMap.GetScaleFactor(CurrentZoomLevel));
            Label.Longitude = Track.Longitude - (0.15 / CustomMap.GetScaleFactor(CurrentZoomLevel));

            // Leader line
            Color color = Color.FromName(Color.Green.Name);
            LeaderLine.ColorCode = String.Format("#{0:X2}{1:X2}{2:X2}", color.R, color.G, color.B);
            LeaderLine.Width = LineWidth;
            LeaderLine.ID = "L1";
            LeaderLine.Points.Add(Track);
            LeaderLine.Points.Add(Label);

            // Track prediction symbol and line 1
            if (PredictionEngine1_Enabled)
            {
                PredictionSymbol_1 = new GooglePoint();
                PredictionSymbol_1.Latitude = Track.Latitude + 0.050;
                PredictionSymbol_1.Longitude = Track.Longitude + 0.020;
                PredictionSymbol_1.ID = "P1";
                PredictionSymbol_1.IconImage = "icons/Track_Yellow.png";
                color = Color.FromName(Color.Yellow.Name);
                TrackToPredictionLine1.ColorCode = String.Format("#{0:X2}{1:X2}{2:X2}", color.R, color.G, color.B);
                TrackToPredictionLine1.ID = "L2";
                TrackToPredictionLine1.Width = LineWidth;
                TrackToPredictionLine1.Points.Add(Track);
                TrackToPredictionLine1.Points.Add(PredictionSymbol_1);
            }

            // Track prediction symbol and line 1
            if (PredictionEngine2_Enabled)
            {
                PredictionSymbol_2 = new GooglePoint();
                PredictionSymbol_2.Latitude = Track.Latitude + 0.060;
                PredictionSymbol_2.Longitude = Track.Longitude + 0.040;
                PredictionSymbol_2.ID = "P2";
                PredictionSymbol_2.IconImage = "icons/Track_Blue.png";
                color = Color.FromName(Color.Blue.Name);
                TrackToPredictionLine2.ColorCode = String.Format("#{0:X2}{1:X2}{2:X2}", color.R, color.G, color.B);
                TrackToPredictionLine2.ID = "L3";
                TrackToPredictionLine2.Width = LineWidth;
                TrackToPredictionLine2.Points.Add(Track);
                TrackToPredictionLine2.Points.Add(PredictionSymbol_2);
            }

            // Track prediction symbol and line 1
            if (PredictionEngine3_Enabled)
            {
                PredictionSymbol_3 = new GooglePoint();
                PredictionSymbol_3.Latitude = Track.Latitude + 0.070;
                PredictionSymbol_3.Longitude = Track.Longitude + 0.060;
                PredictionSymbol_3.ID = "P3";
                PredictionSymbol_3.IconImage = "icons/Track_Pink.png";
                color = Color.FromName(Color.Pink.Name);
                TrackToPredictionLine3.ColorCode = String.Format("#{0:X2}{1:X2}{2:X2}", color.R, color.G, color.B);
                TrackToPredictionLine3.ID = "L4";
                TrackToPredictionLine3.Width = LineWidth;
                TrackToPredictionLine3.Points.Add(Track);
                TrackToPredictionLine3.Points.Add(PredictionSymbol_3);
            }
        }
Exemplo n.º 56
0
 private void MapRecenter(GooglePoint point)
 {
     GoogleMapForASPNet1.GoogleMapObject.CenterPoint = point;
     GoogleMapForASPNet1.GoogleMapObject.RecenterMap = true;
 }
Exemplo n.º 57
0
    private void DispalyMap()
    {
        try
        {
            //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.66619, -79.44268);

            //Add push pins 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 = "1";
            GP1.Latitude = 43.65669;
            GP1.Longitude = -79.44268;
            //Specify bubble text here. You can use standard HTML tags here.
            GP1.InfoHTML = "This is Point 1";

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

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

            GooglePoint GP3 = new GooglePoint();
            GP3.ID = "3";
            GP3.Latitude = 43.67689;
            GP3.Longitude = -79.43270;
            GP3.InfoHTML = "This is point 3";
            GP1.IconImage = "../_images/RedCar.png";
           // GoogleMapForASPNet1.GoogleMapObject.Points.Add(GP3);
        }
        catch (Exception ex)
        {

        }
    }
Exemplo n.º 58
0
 public void Add(GooglePoint pPoint)
 {
     this.List.Add(pPoint);
 }
Exemplo n.º 59
0
    private void Place_Pins(String fetch_string, String image, String tooltip_message, String crime_ID)
    {        
            string join_report = "empty";
            join_report = SQL_session.fetch_2params(fetch_string, "LOCATION_LAT", "LOCATION_LONG");

            string[] crime_array = join_report.Split('&');

            double lat, longi;

            int counter = 0;
            GooglePoint[] point = new GooglePoint[crime_array.Length / 2];

            if (crime_array.Length > 1)
            {
                for (int i = 0; i < crime_array.Length - 1; i++)
                {
                    double.TryParse(crime_array[i], out lat);
                    double.TryParse(crime_array[i + 1], out longi);

                    point[counter] = new GooglePoint();
                    point[counter].ID = crime_ID + (counter + 1);
                    point[counter].Latitude = lat;
                    point[counter].Longitude = longi;
                    point[counter].InfoHTML = tooltip_message;
                    point[counter].IconImage = image;
                    GoogleMapForASPNet2.GoogleMapObject.Points.Add(point[counter]);

                    i++;
                    counter++;
                }// end for loop
            }
    } // end void Place_Pins(String fetch_string, String crime_tripe, String image)
Exemplo n.º 60
0
    private void populatePins2()
    {
        GoogleMapForASPNet2.GoogleMapObject.Points.Clear();

        DataTable dt = Filter_GetDataTable();
        int i = 0;
        foreach (DataRow r in dt.Rows)
        {
            string event_type_name = Convert.ToString(r["EVENT_TYPE_NAME"]);
            GooglePoint p = new GooglePoint();
            p.ID = event_type_name + i;
            p.Latitude  = Convert.ToDouble(r["LOCATION_LAT"]);
            p.Longitude = Convert.ToDouble(r["LOCATION_LONG"]);
            p.InfoHTML = "This was a case of " + event_type_name;
            p.IconImage = Data_CrimeTypeIcons[event_type_name];

            GoogleMapForASPNet2.GoogleMapObject.Points.Add(p);
        }
    }