Setting the background color of map.

Within this forum we want to offer discussions all around our .NET based Map control including all .Net-language specific questions concerning calls of the xServer-API. Attention: xServer-relevant concepts can be found in further forums such as xRoute or xTour.

Setting the background color of map.

Postby webdirekt » Tue Jan 10, 2017 5:12 am

- We have specific polygon colored in the light blue color.( ColoredRegion.png )
- We have collection of points in database for that colored region.
- We want to color the whole region outside the colored polygon as gray.
Attachments
ColoredRegion.png
Image of colored region polygon on map.
User avatar
webdirekt
 
Posts: 28
Joined: Wed Jul 15, 2015 10:18 am

Re: Setting the background color of map.

Postby Oliver Heilig » Wed May 17, 2017 12:23 pm

Hello webdirekt,

sorry for the late answer, but this is a tricky one. Of course you can set the opacity of the basemap layers to reduce the background, or you can draw a semi-opaque rectangle on-top of the basemap-layers.

But if you really want to highlight a distinct polygon against the background, you have to draw the "inverted polygon" in a different colour. This a bit complex, as you need to use topology operations, together with a custom canvas for the mapControl, as the standard MapPolygon of the Control cannot render this inverted polyon.

Here are the lines that show this practice.

https://github.com/ptv-logistics/xserve ... #L100-L117

You can download the code at the repository https://github.com/ptv-logistics/xservernet-bin

Regards
Oliver
Attachments
InvertedDonut.png
Oliver Heilig
Chief Developer Logistic Services
PTV GROUP - Germany

https://github.com/oliverheilig/
User avatar
Oliver Heilig
 
Posts: 122
Joined: Tue May 13, 2014 12:10 pm
Location: Karlsruhe, Germany

Re: Setting the background color of map.

Postby Bernd Welter » Wed May 17, 2017 3:40 pm

Proposal from my side:
How about describing the use case requirement so Oliver could give a technical approach? E.g. "we want to create a map where a user can recognize the reachable customers".
Your request is already focused on a specific technical approach...
Bernd Welter
Senior Technical Consultant Developer Components
PTV GROUP - Germany

Bernd at Youtube
User avatar
Bernd Welter
Site Admin
 
Posts: 1336
Joined: Mon Apr 14, 2014 10:28 am


Return to PTV xServer.NET (Admin=OH)

cron