-
-
Notifications
You must be signed in to change notification settings - Fork 278
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
New group folders for dynamic map services #747
New group folders for dynamic map services #747
Conversation
}, | ||
|
||
_getSubLayerNodes: function () { | ||
var layerIds = this.control.controlOptions.layerIds; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like this is a bug, if layerIds is not provided, it breaks on 176.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated line 161 to:
var layerIds = this.control.controlOptions.layerIds || [];
if (array.indexOf(this.sublayerInfo.subLayerIds, subLayerID) < 0) { | ||
return false; | ||
// is the sublayer included in layer's layerIds (if they are defined) | ||
} else if (layerIds.length && array.indexOf(layerIds, subLayerID) < 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
layerIds.length
throws an error when layerIds
is not defined
I think this is a good addition. I might've changed the folder icons to something a little bit darker, its a little hard to see on some screens I think because it is so light, white on white. Just my two cents. That being said, I don't think I can personally utilize this in my app at the moment because of the way my groups are set up. Essentially I start out with something like this, where each group layer is off, but several children are turned on in each group. No layers are displayed until the user turns on one or several groups. The users like to be able to turn on the group and get all of their related layers turned on. But I've also included some extra layers in the folder that don't get used regularly but are available for people who need them. Toggling the group now, turns on those extra layers. That's not a huge issue, I can move them to a different group or something else, there are a few ways to handle it, I just wanted it to be mentioned for future users to find. Which leads me to my second issue: |
…github.com:cmv/cmv-app into feature/new-group-folders-for-dynamic-map-services
Do you think we should attempt to support both approaches to group layers? That adds to the complexity but certainly is possible.
Did you find time to look into this? |
some code cleanup.
@roemhildtg Using the test Map Service you provided to me (thanks), I have corrected how sub layer visibility is determined from their check boxes. Please give it another test and let me know how it works for you. |
I'm not a big fan of this, the dynamic layers have already become pretty complex and having two different cases makes it more difficult. I think the better solution would be to configure our layer setup to benefit from the new style. That being said though, I know there are others who do this same style of set up where they might have extra layers in a group that are invisible by default and might not have control over how the default visibility is published.
It still looks like its having issues. Try this and let me know if you see the same thing: Turn on the "Sanitary System" group layer check box. This will check everything under sanitary system. (which is expected). But what also happens is all of the other sub layers in other groups become visible on the map also. I'll starting digging in deeper later today to figure out why this is. |
Ok, so here's the question. Take a layer that has a parent layer invisible by default. Do we want the sub layer visibility to be not checked by default if its parent group is off by default? (easier) Or do we want it to be checked, but excluded from the visible layers array when another layer's visibility changes? (harder) |
Maybe there's an issue with the group code since I am not as familiar with the data. But I think that part is working and there is a different issue that still needs to be resolved - one that has been around for a while when groups are included in Here's what I think I see: The map is being presented initially based on the group layer visibility set in your service. The layerControl and the map are out of sync at this point (same as with ImageParameters problem). Once you change the visibility of any layer in layerControl (or from elsewhere?), the correct layers are made visible and represented accurately in the layerControl (same as with ImageParameters problem). Please confirm that is what you see as well. Then we can discuss a solution. |
Yes, that's what I'm seeing |
Alternative to your 2 options: Refresh the dynamic layer once it is loaded in layerControl. This "fixes" the visibility based on what is displayed in layerControl. Obvious downside is a new request to the server. None of these options fix the ImageParameters "problem" if the layerControl widget is not included in the app. But is that a separate problem that needs code to "fix" or is it just a configuration challenge? |
FWIW: I do think this approach (tri-state check boxes for group layers) is a solution worth pursuing as it is more familiar to non-GIS users. The UI is quite common in other applications unlike the ArcGIS approach which is not at all common. Hopefully you agree and hopefully we can minimize any pain that might be inflicted along the way. 😄 |
This has been mentioned before, "fixing" the api's poor implementation. I think it would have negative side effects though, like if other widgets are using the event handlers for visible layers they would get different results if layer control is included or excluded. grrr, why did they make this so difficult?
I do too and agree with you! Maybe my app is just too big... How would you suggest improving my situation with the new controls? Maybe this is a side topic, and a pm would be more appropriate ? |
P.S. I am not liking the css I choose for the check boxes. They look oversized and the css does not work cleanly with other themes (like using calcite instead of flat). But that's a conversation for another day and another repo (cmv-themes?) |
@roemhildtg This is due for another review and discussion. I merged in the functionality from @duckblaster's branch many months ago before falling into abyss of the fire and parental care. |
…namic-map-services' into feature/new-group-folders-for-dynamic-map-services
Yeah, it appears to be good to go with several tests I was able to find online. I haven't revisited this in some time with the cities' layers but I remember the edge case had issues before where if I have a group layer turned off with sublayers turned on. I'll revisit and follow up. |
So...yes. That definitely still happens. I know you don't have a great way to test it though...every example I could find basically has everything visible by default. I also don't know how common of a practice it is with cmv's users to group sublayers in a "not checked" parent layer. |
We often use the scenario where sublayers are enabled, with parent layer off by default. It just means that when a user does enable the parent, the pertinent underlying layers are shown. Just adding my +1 for this desired behaviour. |
It has been awhile since I have thought about this too. If I recall correctly, I addressed this by adding the `ignoreDynamicGroupVisibility as a toggle. The intent of ignoreDynamicGroupVisibility: false is to restore the original Esri group layer behavior as you describe. This was merged from @duckblaster's branch Let me know if this works the way you would expect. |
Oh nice! Yeah that does work 👍 |
Anything remaining to do before this is pushed out within a 2.0 beta 3 release? |
I noticed that you |
@duckblaster Is that something you think should be added to CMV core for other purposes or is it specific to that widget only? |
It would be helpful to have the layer visibility as sent to esri, and as set by the user, and load them as appropriate |
It would need to be in core CMV, I don't know how you would get the info otherwise |
ok, though I suggest perhaps we consider it be done differently (and in a different PR?). I'm not a fan of functionality in one widget (AppSettings) dependent on functionality created by another widget (LayerControl). |
The other part of the code used for this is
The AppSettings widget probably should be talking directly to the LayerControl widget, rather than going via the layer, but I needed to just get something that worked (and I wan't that clear on exactly how everything hooked together) |
My changes to the AppSettings widget (for reference) |
@roemhildtg what are your thoughts on the connection between AppSettings and LayerControl? My feeling is whatever changes may come from that specific discussion, it should be handled in a separate PR as it is not directly related to the intent of this PR. thoughts? |
Sorry, forgot to get back to you on this...
Yes, I agree. I'm not a super big fan of my app setting implementation anyways, there's still some race conditions in there somewhere where the settings aren't loaded correctly at times. |
@roemhildtg I had good results moving Brian Bunker's MapNavigationHash widget to a mixin to address race conditions with that widget. Perhaps that approach would work for your Settings widget too. |
@roemhildtg @duckblaster @tr3vorm Any outstanding items/concerns in this PR? Would love to get it committed. |
Looks good to me |
Yup, lets merge this. |
@roemhildtg @duckblaster thanks! @roemhildtg please merge. 😄 |
I'm not sure this addresses all issues or scenarios.
Submitting for review to identify what has not been addressed.