Topographic Contours (custom style lines)

Topics: SharpMap Project, SharpMap v0.9 / v1.x, SharpMap v2.0
Aug 24, 2010 at 7:05 AM

 

Hi, how can I draw custom style lines, for displaing railways, highways and so on?

For example:

http://maps.nrcan.gc.ca/topo101/symbols_trans2_e.php

Coordinator
Aug 24, 2010 at 8:29 AM

Hello nigr0nyx,

you need to play with VectorStyle.Line and VectorStyle.Outline properties, explictly DashPattern and CompoundArray.

Hth FObermaier

Aug 24, 2010 at 9:10 AM

Hello FObermaier,

yes, I know this. But this is not enough. I need line styles like in MapInfo

http://www.dbxgeomatics.com/products/svgmapmaker/doc/images/svgmm_linestylesupport_en.gif

I thought, in Win32 API  function LineDDA allow to get whatever line style. Probably  System.Drawing.Graphics has somethink similar to LineDDA?

Coordinator
Aug 24, 2010 at 11:11 AM
Edited Aug 24, 2010 at 3:26 PM

As long as you don't go for the not supported ones, you should be fine using those, along with CustomStartCap and CustomEndCap.

I must admit, I have not tried though.

For the other ones you may want to try using a TextureBrush, providing the, e.g. triangles and placing them every once in a while.

As far as I know, there is no way to override Draw... functions of Graphics class.

Hth FObermaier.

Update: Using TextureBrush does not lead to the desired result.

Nov 4, 2010 at 12:44 PM
Edited Nov 4, 2010 at 12:45 PM

I have a partial solution of my problem. I divide the LineStrings to many short lines(using Bresenham's line algorithm) and draw every line using CustomStartCap.

Coordinator
Nov 5, 2010 at 10:37 AM
Edited Nov 5, 2010 at 10:57 AM

Good to hear, that you have found a way.

Dividing LineStrings to many short segments can also be achieved using NetTopologySuite (see this Thread)

Does your solution perform well?

Cheers FObermaier

 

Nov 9, 2010 at 6:59 AM
FObermaier wrote:

Good to hear, that you have found a way.

Dividing LineStrings to many short segments can also be achieved using NetTopologySuite (see this Thread)

Does your solution perform well?

Cheers FObermaier

 

Hello FObermaier.

Solution perfomance is not so good (MapInfo works much faster).

And thanks you for your example, it works faster aproximately on 15-20%.