|
There are 2 standard algorithms for calculating if a given point falls inside a polygon (see here[^]) The ray casting is probably the simplest. You will need to read up on how to calculate the intersection points of lines. Watch out for the special cases, such as when the point falls exactly on one of the vertices or edges, or if the ray you cast exactly crosses a vertex.
.net 3.5 has a System.Windows.Shapes.Polygon class which contains a Points member, which holds a collection of System.Windows.Point objects which use 2 doubles to store the point. These classes are for WPF drawing though, so if you are only interested in the calculations and don't plan on drawing the shapes, it is probably way more complex (and larger) than you need.
Best bet is probably to define your own Vertex class which holds 2 double values and your own Polygon class which holds a collection of Vertex objects.
Simon
|
|
|
|
|
Look for the SQL Server 2008 Feature Pack - It contains a bunch of assemblies so you can use the new types in your .NET application (you don't need SQL Server to use the assemblies). Find the new SqlGeography object, create a polygon with it (It is OGC Standards compliant) and then perform an STIntersects with another SqlGeometry that represents your GPS point. It will tell you if your point is in the polygon or not. It also takes into account the curvature of the earth.
Something like this:
SqlGeometry polygon = SqlGeometry.STGeomFromText("POLYGON(( <polygon definition here> ))");
SqlGeometry point = SqlGeometry.STGeomFromTest("POINT( <point definition here> )");
if (polygon.STIntersects(point))
{
}
else
{
}
|
|
|
|
|
hi all,
i have a button control in normal windows form application and i have another application in which i placed a panel . I want to drag the button from one aplication and drop this button control to the panel of the another application.
can anybody help me to solve the problem.
Thanks & Regards
aiswarya.
|
|
|
|
|
You will have to look into dragging and dropping through Windows API.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my Blog
|
|
|
|
|
Hi all,
I can delete the selected rows from datagridview by selecting the rows and pressing the del key:
SqlCommandBuilder cb_imp = new SqlCommandBuilder(myda);
myconn.Open();
myda.Update(mydt);
Bud what's the way to delete all rows without selecting???
Thanx.
|
|
|
|
|
Hello,
Well if you do not want to select all rows and then delete, then you can
implement that in Button Click or some menu selection.
Use this code to delete all the rows. You will have to manually loop through
the rows and delete them one by one.
<br />
for (int i = this.dataGridView1.Rows.Count - 2; i > -1; i--)<br />
this.dataGridView1.Rows.RemoveAt(i);<br />
I hope this will help.
Regards,
Allen Smith
ComponentOne LLC
www.componentone.com
|
|
|
|
|
Hi Allen,
This works well. thanx a lot
|
|
|
|
|
Hi,
anyone famliar with nunit-console.exe?
running tests of a dll works fine, but after the test summary is printed, I don't come back to the cmd, except by typing ctrl+c. This behaviour always occurs , ignoring test results.
Any idea?
...................................
Tests run: 75, Failures: 1, Not run: 0, Time: 236.123 seconds
Failures:
1) #failure info#
#stack trace#
^C
D:\Profiles\myname>
thanks in advance.
|
|
|
|
|
using the /nothread option helped, but i still don't know why :/
|
|
|
|
|
I need to check the status of all the hardware device in C#, if the device is present it should display yes otherwise no, please please any help me..
its very urgent..
|
|
|
|
|
vinaykskvs wrote: its very urgent..
Not really,
vinaykskvs wrote: if the device is present it should display yes
How do you know what devices should be present?
The idea of CP is YOU write some code, then when it fails someone helps you.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
http://www.codeproject.com/KB/cs/HardwareHelper.aspx[^]
there is one sample application given above to enable/ disable the device based on the selection from the list. so that it will reflect in the device manager window.
but there is one more option "scan for hardware change" in device manager, i need to execute that command through c# code.
|
|
|
|
|
vinaykskvs wrote: I need to check the status of all the hardware device
What hardware device? Anything specific, or everything that anyone ever thought of hooking up to a computer?
vinaykskvs wrote: its very urgent
No, it's not. If it really was that urgent, you would pay someone to get the information instead of asking in a public forum.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
any device which are connected to computer through Serial port or parallel port.
see this link below.
http://www.codeproject.com/KB/cs/HardwareHelper.aspx[^]
for example i need to select any of the ports and execute the "scan for hardware changes" option provided in the device manager through C# code.
|
|
|
|
|
IMO this http://www.codeproject.com/KB/cs/HardwareHelper.aspx[^] article is clear enough, you just use your imagination to evolve it.
BTW, have you learn about Windows API? if not, i suggest you to learn it first.
dhaim
programming is a hobby that make some money as side effect
|
|
|
|
|
I am trying to view a section of a Word document from with a C# 2.0
program using the following:
ProcessStartInfo procInfo = new ProcessStartInfo("Word.exe");
procInfo.FileName = Path.GetDirectoryName(Application.ExecutablePath)
+ @"\Docs\Mydoc.doc #section1";
procInfo.UseShellExecute = true;
System.Diagnostics.Process.Start(procInfo);
I can view just the document, but if I include #section1, I get a
'can't find file' error. Is there any way round this.
thanks
|
|
|
|
|
Are you sure this is valid? Have you tried doing it from the command line to check?
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Its vaild from within Excel - but apparently not within C# using the code I supplied.
|
|
|
|
|
I am new with html help workshop
Please help me how we genrate Help file for VB6 Project
From Begining Full Procedure
Amit Battan Ror
battan20@gmail.com
|
|
|
|
|
Try using the Help in HTML Workshop - failing that, try Google - its too large a subject for a forum
Bob
Ashfield Consultants Ltd
|
|
|
|
|
try to use Shalom Help Maker, is lot more easy to be operated and make a help file if you haven't do anything similar before.
|
|
|
|
|
What does this have to do with C#?
|
|
|
|
|
|
Sorry guys...
Just realized there's a WCF Message Board, my bad.
I'll just post this there.
LZ
|
|
|
|
|
All you had to do was delete this thread before anyone responded. Now it's here forever.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|