-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Isoline line, linecolors, and linewidths behave oddly #1944
Comments
@chaosphere2112 Why do you try to set a 'line object' such as 'blue' or 'red' to a place that should contain the 'line style' such as 'solid', 'dash', ... |
Nope, it shouldn't be an error (since the attribute is named "line", making it an error when you pass a line seems a bit rude). I'll get back to you more in depth later, I've got other stuff I'm working on. |
@chaosphere2112 The documentations says (isoline.py:297): Specify the isoline line style (or type): To me that means you should set there a line style not a line object. I think we should follow the documentation and only allow line styles (report an error if we try to set a line object). We could change the fileld name in the future if we want. |
@chaosphere2112 grepping through the vcs sources seems to show the same usage: we set line styles not line objects. |
@danlipsa it's supposed to accept a line object though. And use whatever line type is set on the object. |
@doutriaux1 Can we fix this? This is confusing and error prone. What if you set: Are you going to have red or green as the line color? |
Hey guys, so here is my suggestion: So the isoline object has these usable properties:
Whereas the line object has these:
Currently for most part, we have isoline which is a superset of line attributes (some has different names). I would suggest that
May be we can talk about it tomorrow but I prefer to keep the API simple unless there is a strong reason behind multiple ways of setting things up. |
what I would suggest is to create a linestyle object and then in the future we can use that for line and isoline. For instance ls = vcs.createlinestyle(color="red", pattern="dash") // here ls does not have any worldcoordinate, x, y, etc iso = vcs.createisoline() ln = vcs.createline() |
@danlipsa the |
@doutriaux1 So 'green' refers to a line object, isn't it? |
whichever was set last. The idea is that you use |
@doutriaux1 Why do we use a field ('line' = line style) set function to set several fields (line style, color and width)? I would say it would be a lot cleaner to have a separate function such as SetAttributesFromLine. What do you think? |
@doutriaux1 @danlipsa I don't think we should support passing the line style via line object. As a developer I think its very confusing and could be confusing for the user too. Currently the I agree with @danlipsa to have a method line |
@doutriaux1 @aashish24 Is the consensus that we should support copying of certain line attributes (style, color, width) to isoline through a function: CopyLineAttributes? |
@aashish24 the following already works and is used by scientists here: iso= x.createisoline()
l=x.createline("aashish")
l.type = "dot"
l.width=10
l.color=["red"]
iso.line = ["dot",l]
iso.list() There are some inconsistencies though the following will not work: l.color="red"
iso.line = ["dot","aashish"] |
@aashish24 also the |
Partially solved by #2005. |
Add separate function to set type, color and width from a line.
Add separate function to set type, color and width from a line.
Add separate function to set type, color and width from a line.
Add separate function to set type, color and width from a line.
Add separate function to set type, color and width from a line.
Add separate function to set type, color and width from a line.
Add separate function to set type, color and width from a line.
Add separate function to set type, color and width from a line.
Add separate function to set type, color and width from a line.
Add separate function to set type, color and width from a line.
So, there's some weirdness in the way we set up isoline objects.
If we do a .list(), we see our attributes:
If we set
.line
to the names of some line objects, some odd, but understandable behavior occurs:It harvests the
type
attribute from theblue
andred
line objects, and sets those inline
. It grabs thecolor
attribute from each of them and setslinecolors
. It grabs thewidth
attribute and setslinewidths
. All perfectly fine.Now let's watch the world burn.
Looks like...
linecolors
is exactly the same? Huh?I'll make my own line object just to drive the point home:
I've set width, type, and color to be different from what was in isoline's attributes...
OK, that's an extra bit of weird. Seems like instead of pulling the line's
type
, it pulled the line object'sname
... and still didn't updatelinecolors
orlinewidths
.These issues can be traced back to the
isoline
module, and the behaviors of the_setline
function. I think what happened is that at some point the default value oflinecolors
andlinewidths
changed fromNone
to[1]
, which makes it so it only replaces those values if you setlines
to a list that has more elements than you have inlinecolors
orlinewidths
. We should definitely alter that behavior; I think we probably should go toNone
triggering default values, rather than automatically filling in the defaults (that way we can "know" if a user has specified data, which we shouldn't automatically override when we set theline
attribute).There's one more issue, which is what happens when you do this:
which generates the below image:
As you can see, none of those lines have a width of 25, or a style of "dash-dot". That's because the "first" level is something like
[0, 0]
for the isoline, which is a very small chunk of the data, so it doesn't get displayed by VTK. We then pad out values for the rest of the levels, but we don't follow normal behavior for VCS. Every other place in VCS, when we pad out a list, we use the last value in the list, but in Isoline, we're using "solid" forline
and1.0
forlinewidths
(though we are using the lastcolor
forlinecolors
). This can be fixed inisofillpipeline
by replacing the default values.The text was updated successfully, but these errors were encountered: