survex icon indicating copy to clipboard operation
survex copied to clipboard

allow same name for station and survey

Open speleo3 opened this issue 5 years ago • 2 comments

Current survex allows the same name for a station and a survex using this syntax:

; no warnings
1       2       1.0     0.0     0.0
2       2.1     1.0     90.0    0.0
2.1     2.2     1.0     180.0   0.0

However, this syntax throws an error:

; error: "2" can't be both a station and a survey
1	2	1.0	0.0	0.0
2	2.1	1.0	90.0	0.0
*begin 2
1	2	1.0	180.0	0.0
*end 2

This PR allows the second syntax, both examples look the same in Aven.

speleo3 avatar Sep 05 '18 09:09 speleo3

It was a design decision that survey and station names live in a single namespace, so the first example really ought to give an error too.

I'm not keen to change this design decision - I don't really see how it's useful, and a lot of code was written assuming this to be the case so I bet there are lurking problems with allowing this.

In your first example, 2 isn't really a survey at all but rather you're using . as part of the station name. Better to be honest about that:

*set separator /
*set names _-.

1       2       1.0     0.0     0.0
2       2.1     1.0     90.0    0.0
2.1     2.2     1.0     180.0   0.0

It seems cavern currently fails to set the separator in the .3d file it creates, but once that's fixed you'll actually see 2.1 and 2.2 as station names in aven.

ojwb avatar Sep 05 '18 21:09 ojwb

Since this is exactly how we name our survey stations, I was very pleased to find out that Survex now accepts example 1. I know that it used to give an error, so I consider it a great improvement for us.

Not sure if we should care about whether 2 is a survey or . is part of the station name. But I can tell that Survex currently also works perfectly with this example:

1	2	1.0	0.0	0.0
2	2_.1	1.0	90.0	0.0
*begin 2_
1	2	1.0	180.0	0.0
*end 2_

It correctly considers 2_.1 and the station 1 inside survey 2_ to be the same. So not supporting example 2 really seems like an inconsistency to me.

speleo3 avatar Sep 06 '18 10:09 speleo3

It seems cavern currently fails to set the separator in the .3d file it creates, but once that's fixed you'll actually see 2.1 and 2.2 as station names in aven.

I've pushed a fix for that: 5d594775663b36fd3b6653bf9d36ef880c57735b

I was very pleased to find out that Survex now accepts example 1.

Looking into this more it's definitely meant to be an error, but it fails to fire in this particular case. If you reverse the order of the 3 legs to give

2.1     2.2     1.0     180.0   0.0
2       2.1     1.0     90.0    0.0
1       2       1.0     0.0     0.0

then you do get errors:

stationsurveynamecollision.svx:2: error: “2” can’t be both a station and a survey
 2       2.1     1.0     90.0    0.0
stationsurveynamecollision.svx:3: error: “2” can’t be both a station and a survey
 1       2       1.0     0.0     0.0

ojwb avatar Mar 05 '24 04:03 ojwb