Click here to Skip to main content
14,424,458 members
   

C#

 
GeneralRe: best design for an responsibility system Pin
KhaledMohammad11-Dec-19 2:03
MemberKhaledMohammad11-Dec-19 2:03 
AnswerRe: best design for an responsibility system Pin
F-ES Sitecore10-Dec-19 23:35
mveF-ES Sitecore10-Dec-19 23:35 
GeneralRe: best design for an responsibility system Pin
KhaledMohammad11-Dec-19 2:04
MemberKhaledMohammad11-Dec-19 2:04 
QuestionC# VSTO Powerpoint add Text as Field Pin
Member 1357643710-Dec-19 20:10
MemberMember 1357643710-Dec-19 20:10 
QuestionSending Bulk SMS using Multi Threading Pin
meeram399-Dec-19 19:41
professionalmeeram399-Dec-19 19:41 
AnswerRe: Sending Bulk SMS using Multi Threading Pin
OriginalGriff9-Dec-19 21:50
communityengineerOriginalGriff9-Dec-19 21:50 
AnswerRe: Sending Bulk SMS using Multi Threading Pin
jkirkerx10-Dec-19 14:20
professionaljkirkerx10-Dec-19 14:20 
QuestionC# GMap: How to draw arc on a map Pin
Member 139442409-Dec-19 10:03
MemberMember 139442409-Dec-19 10:03 
Hello, how can I add a polygon to the map as in the picture below? From a certain point of coordinates should open a polygon long, for example, 1 kilometer and a 120-degree opening angle.

https://i.ibb.co/ZLKgvJs/image.png[^]
My code can only draw a circle. Can it be changed so that it can draw a polygon from a certain point of coordinates with an indication of the direction, distance of drawing and the angle of aperture?

private void CreateCircle(Double lat, Double lon, double radius, int ColorIndex)
    {
        GMapOverlay markers = new GMapOverlay(mygmap, "markers");
        PointLatLng point = new PointLatLng(lat, lon);
        int segments = 1080;

        List<PointLatLng> gpollist = new List<PointLatLng>();

        for (int i = 0; i < segments; i++)
        {
            gpollist.Add(FindPointAtDistanceFrom(point, i * (Math.PI / 180), radius / 1000));
        }

        GMapPolygon polygon = new GMapPolygon(gpollist, "Circle");
        switch (ColorIndex)
        {

            case 1:
                polygon.Fill = new SolidBrush(Color.FromArgb(80, Color.Red));
                break;
            case 2:
                polygon.Fill = new SolidBrush(Color.FromArgb(80, Color.Orange));
                break;
            case 3:
                polygon.Fill = new SolidBrush(Color.FromArgb(20, Color.Aqua));
                break;
            default:
                MessageBox.Show("No search zone found!");
                break;
        }

        polygon.Stroke = new Pen(Color.Red, 1);
        markers.Polygons.Add(polygon);
        mygmap.Overlays.Add(markers);
    }


    public static GMap.NET.PointLatLng FindPointAtDistanceFrom(GMap.NET.PointLatLng startPoint, double initialBearingRadians, double distanceKilometres)
    {
        const double radiusEarthKilometres = 6371.01;
        var distRatio = distanceKilometres / radiusEarthKilometres;
        var distRatioSine = Math.Sin(distRatio);
        var distRatioCosine = Math.Cos(distRatio);

        var startLatRad = DegreesToRadians(startPoint.Lat);
        var startLonRad = DegreesToRadians(startPoint.Lng);

        var startLatCos = Math.Cos(startLatRad);
        var startLatSin = Math.Sin(startLatRad);

        var endLatRads = Math.Asin((startLatSin * distRatioCosine) + (startLatCos * distRatioSine * Math.Cos(initialBearingRadians)));
        var endLonRads = startLonRad + Math.Atan2(Math.Sin(initialBearingRadians) * distRatioSine * startLatCos, distRatioCosine - startLatSin * Math.Sin(endLatRads));

        return new GMap.NET.PointLatLng(RadiansToDegrees(endLatRads), RadiansToDegrees(endLonRads));
    }

    public static double DegreesToRadians(double degrees)
    {
        const double degToRadFactor = Math.PI / 180;
        return degrees * degToRadFactor;
    }

    public static double RadiansToDegrees(double radians)
    {
        const double radToDegFactor = 180 / Math.PI;
        return radians * radToDegFactor;
    }

AnswerRe: C# GMap: How to draw arc on a map Pin
Luc Pattyn9-Dec-19 10:40
sitebuilderLuc Pattyn9-Dec-19 10:40 
QuestionWhich object's destructor is getting called in vector? Pin
_PitrakSarkar_9-Dec-19 2:59
Member_PitrakSarkar_9-Dec-19 2:59 
SuggestionRe: Which object's destructor is getting called in vector? Pin
Richard Deeming9-Dec-19 3:06
communityengineerRichard Deeming9-Dec-19 3:06 
AnswerRe: Which object's destructor is getting called in vector? Pin
Richard MacCutchan9-Dec-19 4:56
communityengineerRichard MacCutchan9-Dec-19 4:56 
QuestionWrite program Wpf C# calculator (OEE ) Pin
Member 146803725-Dec-19 22:39
MemberMember 146803725-Dec-19 22:39 
QuestionRe: Write program Wpf C# calculator (OEE ) Pin
Richard MacCutchan5-Dec-19 23:32
communityengineerRichard MacCutchan5-Dec-19 23:32 
AnswerRe: Write program Wpf C# calculator (OEE ) Pin
OriginalGriff5-Dec-19 23:41
communityengineerOriginalGriff5-Dec-19 23:41 
QuestionC# Passing password to Web API Pin
Kevin Marois5-Dec-19 10:00
professionalKevin Marois5-Dec-19 10:00 
AnswerRe: C# Passing password to Web API Pin
Richard Deeming5-Dec-19 10:06
communityengineerRichard Deeming5-Dec-19 10:06 
QuestionNaudio C# ASP.net Using MPG Video Pin
Member 1394308730-Nov-19 0:45
MemberMember 1394308730-Nov-19 0:45 
AnswerRe: Naudio C# ASP.net Using MPG Video Pin
Gerry Schmitz2-Dec-19 6:15
mveGerry Schmitz2-Dec-19 6:15 
AnswerRe: Naudio C# ASP.net Using MPG Video Pin
jkirkerx2-Dec-19 10:30
professionaljkirkerx2-Dec-19 10:30 
QuestionDrawString with opacity option not print properly Pin
Le@rner29-Nov-19 20:19
MemberLe@rner29-Nov-19 20:19 
AnswerRe: DrawString with opacity option not print properly Pin
OriginalGriff29-Nov-19 21:17
communityengineerOriginalGriff29-Nov-19 21:17 
GeneralRe: DrawString with opacity option not print properly Pin
Le@rner29-Nov-19 21:28
MemberLe@rner29-Nov-19 21:28 
AnswerRe: DrawString with opacity option not print properly Pin
OriginalGriff29-Nov-19 22:16
communityengineerOriginalGriff29-Nov-19 22:16 
GeneralRe: DrawString with opacity option not print properly Pin
Le@rner29-Nov-19 22:23
MemberLe@rner29-Nov-19 22:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.