Survex question

Olly Betts olly at survex.com
Mon Jan 26 04:18:38 GMT 2015


On Fri, Jan 23, 2015 at 05:38:01PM +0000, Chris Smith wrote:
> I was wondering... how difficult would it be to get Aven/survex to export
> the centre line data as a colour coded vector graphic according to
> elevation?  It can already export the centre line data as a vector graphic,
> but the line vectors are all in black.
[...]
> Would adding this functionality, or backward engineering it for two centre
> line surveys be relatively easy for someone to do?

I assume you're wanting a plan view with the depth colouring?  Doing it
for an elevation view is probably easier, as you can just apply a colour
gradient to the whole centre-line (and for just two, you could do that
by hand in a drawing package).

To do it for a plan view probably depends on what format you're trying
to get it as, and how fussy you are about the colouring.

In the on-screen view with depth colouring, there's actually a colour
gradient along each leg.  This is done by telling OpenGL the colour of
each end and asking it to interpolate in between.  Legs which span depth
bands are treated specially by splitting them into multiple lines such
that there's a colour specified on every depth band boundary.

If you want that same effect, you'll need an output format which
supports lines with colour gradients, and it'll be simpler to implement
if it works like OpenGL does in this regard.  It looks like SVG is
very suitable, as this gives a line graduating between yellow and red:

<svg width="640" height="480">
  <defs>
    <linearGradient id="grad" x1="0%" y1="0%" x2="100%" y2="100%">
      <stop offset="0%" stop-color="rgb(255,255,0)" />
      <stop offset="100%" stop-color="rgb(255,0,0)" />
    </linearGradient>
  </defs>
  <g stroke-width="2">
    <line x1="0" y1="0" x2="200" y2="200" stroke="url(#grad)" />
  </g>
</svg>

You'll need to generate a suitable <linearGradient> element for every
leg.  Where a leg crosses depth bands, you should just be able to add
additional <stop> elements corresponding to where those are along the
leg.

Aven's export uses <path> elements rather than <line> because that gives
a significantly smaller file (I'm not sure why we use <path> rather than
<polyline>).  I think you'd need to generate line elements in this case
instead so you can attach the gradients to each.

Or if you don't want to have to mess around with generating gradients
you could just give lines the colour of the depth band they are in
(splitting legs into multiple lines when they span depth bands).  This
is how Survex 1.0.x worked - you can see the effect on this old
Mac screenshot:

http://survex.com/~olly/macosx.jpg

The posterising effect of giving a single colour to all the centre line
in each depth band range is more noticeable on some caves than others.

Cheers,
    Olly



More information about the Survex mailing list