Skip to content
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

Bug/DES-2184: Add way to select overlapping layers. #86

Closed
wants to merge 13 commits into from

Conversation

duckonomy
Copy link
Contributor

Overview:

Implement a way to select point cloud layers that are overlapping through a context menu.

PR Status:

  • Ready.
  • Work in Progress.
  • Hold.

Related Jira tickets:

Summary of Changes:

Asset styling

Added indication for active assets (red) and added default styles for assets (as constants). I also added extra asset types in leafletUtils.js to include style default asset types. Also lowered opacity of Polygon assets as per Michael's request.

Handling overlapping layers

For now, I put Polygon assets in a lower z-index compared to the Point assets just in case that some Point assets are unselectable.

I installed leaflet-contextmenu (link) and added basic type definitions to get rid of errors.
I use this contextmenu to give the user a menu based on if there are overlapping Polygon layers in on the pointer position. If there is only one Polygon, we just select it.

The rendered asset at the top (highest implied z-index) should be at the top of the contextmenu.

Asset labels

As Michael suggested, I put on optional/toggleable labels for Polygon assets for clarification. I haven't figured out how we would use the Point cloud description for the names rather than just the featureId.

Testing Steps:

  1. Ensure that asset label toggling works for Polygon assets.
  2. Ensure that overlapping assets are correctly selected with the contextmenu.
  3. Ensure that selected assets (both Point and Polygon) change color on selection.

UI Photos:

Screen Shot 2022-03-09 at 3 02 15 PM

Notes:

@duckonomy duckonomy requested a review from nathanfranklin March 9, 2022 21:25
Copy link
Collaborator

@nathanfranklin nathanfranklin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. good solution on the overlapping point cloud and users not being able to select them! 👍

i have some questions and comments which mostly relate to the styling of active features.

and possibly stashing the label assets until a later time.

src/app/components/assets-panel/assets-panel.component.ts Outdated Show resolved Hide resolved
src/app/services/geo-data.service.ts Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
src/app/components/map/map.component.ts Outdated Show resolved Hide resolved
src/app/components/map/map.component.ts Outdated Show resolved Hide resolved
src/app/constants/styles.ts Outdated Show resolved Hide resolved
@@ -197,7 +228,36 @@ export class MapComponent implements OnInit, OnDestroy {
* @param ev
*/
featureClickHandler(ev: any): void {
const f = ev.layer.feature;
this.geoDataService.activeFeature = f;
if (ev.layer.feature.featureType() === 'point_cloud') {
Copy link
Collaborator

@nathanfranklin nathanfranklin Apr 19, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (ev.layer.feature.featureType() === 'point_cloud') {
if (ev.layer.feature.geometry.type !== 'Point') {

nonPointFeatures array consists of features where condition d.geometry.type === 'Point' is false.

what about generic polygons or lines. [ or do we want to handle only point clouds at this point. if so, maybe change the name (and condition) of the variable nonPointFeatures so its about point clouds. ]

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we add a follow on ticket for this?

collection.features.forEach(d => {
let feat: LayerGroup;
if (d.geometry.type === 'Polygon' && d.properties.style) {

d.properties.style = d.properties.customStyle
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

related to https://github.com/TACC-Cloud/hazmapper/pull/86/files#r852545813, I still don't think we should set the style on the feature collection as then its shown to the user but isn't reflective of the data.

@@ -76,7 +76,13 @@ export class GeoDataService {
this.setLoadFeatureData(true);
this.http.get<FeatureCollection>(this.envService.apiUrl + `/${projectRoute}/${projectId}/features/` + '?' + qstring)
.subscribe( (fc: FeatureCollection) => {
fc.features = fc.features.map( (feat: Feature) => new Feature(feat));
fc.features = fc.features.map( (feat: Feature) => {
if (feat.properties.style) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@duckonomy duckonomy marked this pull request as draft April 19, 2023 15:31
@nathanfranklin
Copy link
Collaborator

Closing as an alternative solution was implemented in #181

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants