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

added checkboxes to Directions widget using current location ast start/stop points #158

Closed
wants to merge 2 commits into from

Conversation

friendde
Copy link
Contributor

The recently added right click functionality is handy. Look and feel is similar to Google which allows easy transition for new users. But some of the users may not know where they are going and therefore can't right-click the feature to obtain the route.

This addition allows the user to set the current location as a start/stop point before adding destinations. Logic will clear stops entered if trying to use current location for both the Start and Stop points.

It may be better to add logic to allow the above scenario if more than two addresses are entered.

Added checkboxes for using current location as the start/stop points in Directions widget.
Logic to handle checkboxes for using current location as start/stops points in Directions widget
@DavidSpriggs
Copy link
Member

@friendde I will review this tonight, thanks for contributing!

@DavidSpriggs
Copy link
Member

So I had a look and this PR is not functional. There is a missing function.
I actually added this functionality to the current build of CMV on master. You can access it with a map right click. I placed it there so as not to clutter up the Directions UI with extra stuff. Simple is always better. Have a look and see what you think: http://davidspriggs.github.io/ConfigurableViewerJSAPI/viewer/

@friendde
Copy link
Contributor Author

I apologize for wasting your time with a failed PR, obviously I did not complete the PR process correctly. I tested my additions prior to the PR and it works for me. I included the snippets below your convenience. As for keeping it simple I certainly agree in K.I.S.S. designs. I did note the usefulness of your addition and it works great for those transitioning from our old GIS viewer to the CMV.

For our use case though a simple design here is not an efficient one. In our use for this widget a Field Service Technician (or generally any field worker) may receive a call over the radio about an event such as a gas leak or other customer need. Various calls over the radio occur many times throughout the day.

In the current version of CMV the employee must know her current address and then enter it in the Directions widget, or activate the Location button to find current location on the map then place the cursor over the map and select Directions From Here, then enter the customer's address in the Geocoder widget, then place the cursor over the found address, then right click and select Directions To Here. That is many steps taking several times a day for our employees.

With the checkbox format the employee simply checks the box Use Current Location As Start Point then enters customers address.

My additions were added to the HTML file but I guess I could use CSS to clean up the cluttered look a bit.
checkbox

Directions.html

<div>
    <div style="text-align:right;font-size:11px;">
        <a href="#" data-dojo-attach-event="onclick:clearStops">clear stops</a> <!-- <a href="#" data-dojo-attach-event="onclick:clearMap">clear map</a> -->
    </div>
    <div data-dojo-attach-point="useCurrentLocationStartDom">
        <input type="checkbox" data-dojo-attach-event="onClick:useCurLocStart" data-dojo-attach-point="useCurrentLocationStart" data-dojo-type="dijit.form.CheckBox" /> <!-- data-dojo-props="class:'containsCheck'"/-->
        <label>Use Current Location As Start Point</label>
    </div>
    <div data-dojo-attach-point="useCurrentLocationEndDom">
        <input type="checkbox" data-dojo-attach-event="onClick:useCurLocEnd" data-dojo-attach-point="useCurrentLocationEnd" data-dojo-type="dijit.form.CheckBox" /> <!-- data-dojo-props="class:'containsCheck'"/-->
        <label>Use Current Location As End Point</label>
    </div>
    <div data-dojo-attach-point="directionsNode"/>

</div>

Directions.js

useCurLocStart: function() {
            if (this.useCurrentLocationStart.checked) {
                if (this.useCurrentLocationEnd.checked){
                    this.directions.reset();
                    this.useCurrentLocationEnd.checked= false;
                }
                this.getGeoLocation('directionsFrom');
            }
        },
        useCurLocEnd: function() {
            if (this.useCurrentLocationEnd.checked) {
                if (this.useCurrentLocationStart.checked){
                    this.directions.reset();
                    this.useCurrentLocationStart.checked= false;
                }
                this.getGeoLocation('directionsTo');
            }
        },

@DavidSpriggs
Copy link
Member

The current version of CMV has this feature added like so:
screen shot 2014-08-15 at 9 37 24 am
Does this work?

If you really want to have it in the widget I would do it like so:
screen shot 2014-08-15 at 9 42 10 am
Anytime you click the link it simply populates start or end with you location, like the map's right click menu currently does.

@tmcgee
Copy link
Member

tmcgee commented Aug 15, 2014

I think there is great value in having the option available directly in the widget UI. The most common use case for directions most likely is starting at my current location. I like the blue text links as they add the desired value with minimal clutter.

@friendde
Copy link
Contributor Author

I definitely like the clean look that David provided. Although the same functionality is in the right-click menu, my users complain about too many clicks to get to it just to start routing from current location. However, the right-click is very useful after the user has found something through the Find widget, such as a pole number. After they review the pole by Identifying, they can keep the cursor in same location to start routing.

@DavidSpriggs thanks for changing it to a clean look.

@DavidSpriggs
Copy link
Member

I will close this PR and include this in the widget. Its just simply adding the links. Good discussion!

@friendde
Copy link
Contributor Author

Thank you. The links are far better than the checkboxes.

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.

3 participants