Ticket Q572992
Visible to All Users
Duplicate

We have closed this ticket because another page addresses its subject:

WinForms - How to display geospatial information in XAF Views using Google, Bing or OpenStreet maps

Best way of displaying lines between points on MapControl in XAF

created 11 years ago

I have created the attached XAF app(sample DB included) which has a list of Locations, and a MapControl embedded in a DashboardView.

Firstly, have I embedded the MapControl correctly, in particular the activation/initalisation code in MapController.cs?

Next, on the map I wish to display lines between the locations.

What is the best way of acheiving this? Does it involve assigning the list of Locations to the VectorItemsLayer's Datasource, or adding each line individually?

Lastly, what if I wanted to display only selected Locations?

If I want to add a checkbox against each Location, would I define a new Business object that inherits from Location but adds a checkbox, then dispaly a list of those rather than the original Location object?

How do I then display only the selected Locations on the map?

Thanks

Comments (1)
Anatol (DevExpress) 11 years ago

    We need additional time to research your project and scenario. Your patience is highly appreciated.

    Answers approved by DevExpress Support

    created 11 years ago (modified 11 years ago)

    Hello Wade,
    > Firstly, have I embedded the MapControl correctly, in particular the activation/initalisation code in MapController.cs?
    I have investigated your sample and I do not see anything wrong in your approach.
    > If I want to add a checkbox against each Location, would I define a new Business object that inherits from Location but adds a checkbox, then dispaly a list of those rather than the original Location object?
    I think it is unnecessary to define a descendant from the Location class. You can add the Selected member directly into the Location class.
    > Does it involve assigning the list of Locations to the VectorItemsLayer's Datasource, or adding each line individually? .
    I think it is dependent on the MapControl specifics. You can find hints on the best techniques in the Map Control documentation. Please refer to the following article to get more details regarding the Map Control features.
    As an example, I have added the following code into the MapController.InitialiseMap method:

    C#
    IList<XAFWithMapControl.Module.BusinessObjects.Location> locations = ObjectSpace.GetObjects<XAFWithMapControl.Module.BusinessObjects.Location>(new BinaryOperator("Selected", true)); XAFWithMapControl.Module.BusinessObjects.Location location1 = null; foreach(XAFWithMapControl.Module.BusinessObjects.Location location in locations) { if(location1 == null) { location1 = location; } else { DrawLine(new GeoPoint(location1.Latitude, location1.Longitude), new GeoPoint(location.Latitude, location.Longitude)); location1 = location; } }

    It works fine for me.
    I hope you will find this answer helpful.
    Feel free to contact me if you need further assistance or have additional questions.

      Comments (2)

        Thanks for the answer.
        'I think it is unnecessary to define a descendant from the Location class. You can add the Selected member directly into the Location class.'
        The idea being that the original Location class would be used elsewhere in the application where the checkbox/displayed field would not be relevant. I will submit a new ticket to discuss this specific point.

        Aleksei M. (DevExpress) 11 years ago

          Hello Wade,
          It is very easy to create several differently customized views for the Location class. The list view with the checkbox column may be displayed only in specific scenarios. In other cases, the default list view without the checkbox column can be used.
          You are correct, a new ticket for the point is the right way, because there are a lot of other approaches to solve this problem.

          Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

          Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.