6 Replies - 4308 Views - Last Post: 11 January 2010 - 09:20 PM Rate Topic: -----

#1 Muthamizhselvan.ram  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 8
  • Joined: 26-December 09

nearest location finding simulation in C#.NET

Posted 10 January 2010 - 12:40 AM

hi, I am going to do a project related to location mapping of mobile number.
here i want to do a simulation like ,
I have a small Map drawn by me.In that I assume my location as Small point. and i also assume some other like hotels ,hospitals location as a small point in my map .I also store the distances between me and Others in my database.
When i receive a message from a particular hospital,then the map shows graphically Which hospital send a message and also show the distances between me and that hospital.

how can i do this in C#.NET?
plz reply immediately.........

I attched the image of the simulation i will want to do........

Is This A Good Question/Topic? 0
  • +

Replies To: nearest location finding simulation in C#.NET

#2 FlashM  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 382
  • View blog
  • Posts: 1,195
  • Joined: 03-December 09

Re: nearest location finding simulation in C#.NET

Posted 10 January 2010 - 05:29 AM

If you want to achieve this you don't really need to find the nearest location, because you know all the locations of hospitals, you know your location and you also know which hospital sent you a message. You just need to link this message with hospital and show those two points (hospital's and yours).
Was This Post Helpful? 0
  • +
  • -

#3 Muthamizhselvan.ram  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 8
  • Joined: 26-December 09

Re: nearest location finding simulation in C#.NET

Posted 10 January 2010 - 07:59 AM

View PostFlashM, on 10 Jan, 2010 - 04:29 AM, said:

If you want to achieve this you don't really need to find the nearest location, because you know all the locations of hospitals, you know your location and you also know which hospital sent you a message. You just need to link this message with hospital and show those two points (hospital's and yours).



Ok. I know this.But how i can implement this in C#.because i am very very new to the C#.NET.
plz help me.........
Was This Post Helpful? 0
  • +
  • -

#4 finaiized  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 84
  • Joined: 29-November 09

Re: nearest location finding simulation in C#.NET

Posted 10 January 2010 - 10:56 AM

I would use the Graphics object for this situation:

Create a new Windows Forms Application and add the following code:

In your public Form1() method, add
this.Paint += new PaintEventHandler(Form1_Paint);


Underneath your Form1() method, add:
void Form1_Paint(object sender, PaintEventArgs e)
		{
			Graphics g = e.Graphics;
			Pen p = new Pen(Color.Black);
			g.DrawLine(p, 0, 0, 100, 100);
			p.Dispose();
		}

This draws a line with Pen p at 0,0 to 100,100. Replace these values with your first point and the nearest hospital. As far as I'm concerned, you already have stored the distances in your database, so you can just bring these back up.

However, unless this is a virtual map or something, a straight line won't work. If it's a real life place, I recommend using an implementation of Google Maps or such.

This post has been edited by finaiized: 10 January 2010 - 10:58 AM

Was This Post Helpful? 0
  • +
  • -

#5 Muthamizhselvan.ram  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 8
  • Joined: 26-December 09

Re: nearest location finding simulation in C#.NET

Posted 11 January 2010 - 08:39 AM

View Postfinaiized, on 10 Jan, 2010 - 09:56 AM, said:

I would use the Graphics object for this situation:

Create a new Windows Forms Application and add the following code:

In your public Form1() method, add
this.Paint += new PaintEventHandler(Form1_Paint);


Underneath your Form1() method, add:
void Form1_Paint(object sender, PaintEventArgs e)
		{
			Graphics g = e.Graphics;
			Pen p = new Pen(Color.Black);
			g.DrawLine(p, 0, 0, 100, 100);
			p.Dispose();
		}

This draws a line with Pen p at 0,0 to 100,100. Replace these values with your first point and the nearest hospital. As far as I'm concerned, you already have stored the distances in your database, so you can just bring these back up.

However, unless this is a virtual map or something, a straight line won't work. If it's a real life place, I recommend using an implementation of Google Maps or such.





thank you.but how can i implement this in google map?
Was This Post Helpful? 0
  • +
  • -

#6 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1634
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: nearest location finding simulation in C#.NET

Posted 11 January 2010 - 10:42 AM

Sorry but we can not give you the entire code to solve your problem. We are here to assist in solving problems with code you have written, with any error messages you are getting or what isn't working the way that you expect it to, we would be more than happy to help you with those problems. If there is a topic that you don't understand we would be more than happy to help you with that as well. Make sure to post any code with in code tags like below.

:code:

Be sure to visit our tutorial and snippet areas or read the FAQS at the top of the forums. Also, take a moment to read the rules about posting topics.

Thank you for helping us to help you solve your problem.
Was This Post Helpful? 0
  • +
  • -

#7 finaiized  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 84
  • Joined: 29-November 09

Re: nearest location finding simulation in C#.NET

Posted 11 January 2010 - 09:20 PM

View PostMuthamizhselvan.ram, on 11 Jan, 2010 - 07:39 AM, said:

thank you.but how can i implement this in google map?


Using Google Maps is different. Google Maps has it's own thing with dealing with it. I mean, you CAN draw it though- first take a look at drawing a static map out with this:
http://www.codeproject.com/KB/aspnet/csharp-google-static-map.aspx
. Then draw a path with it (that is not covered in the article, but I think it's pretty easy. Here's Google Map's official site on drawing paths:
http://code.google.com/apis/maps/documentation/staticmaps/#Paths

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1