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

Last mile navigation feature #35

Open
wants to merge 9 commits into
base: develop
Choose a base branch
from
961 changes: 777 additions & 184 deletions app/controller/NavigationController.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion app/controller/sdl/FuncSwitcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ SDL.FuncSwitcher = Em.Object.create(
}.property('FLAGS.SimpleFunctionality'),
rev: function() {
var result = parseInt(FLAGS.SimpleFunctionality) === 1;
SDL.NavigationModel.set('poi', !result);
return result;
}.property('FLAGS.SimpleFunctionality'),
pan: function() {
Expand Down
1 change: 1 addition & 0 deletions app/controlls/Code.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ SDL.Code = Em.View.extend({
activate: function() {
this.editor = ace.edit(this._parentView.codeEditorId);
this.editor.setTheme('ace/theme/monokai');
this.editor.$blockScrolling = Infinity;
}
}
);
135 changes: 23 additions & 112 deletions app/model/NavigationModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,14 @@ SDL.NavigationModel = Em.Object.create({
appReqPull: [],

/**
* Start navigation point
* Initial location point
*/
startLoc: '98 Walker St, New York, NY 10013, USA',
initialLoc: '230 Canal St, New York, NY 10013, USA',

/**
* End navigation point
* WP list switcher flag
*/
endLoc: '128 Seaman Ave, New York, NY 10034, USA',

/**
* POI list switcher flag
*/
poi: true,
wp: false,

/**
* Content for code editor view to display current waypoint data
Expand All @@ -68,110 +63,26 @@ SDL.NavigationModel = Em.Object.create({
* Delay Time in ms
* used to set the delay of GetWayPoints response
*/
wpProcessTime: 4000,
wpProcessTime: 5,

LocationDetails: [
{
coordinate: {
latitudeDegrees: 0,
longitudeDegrees: 0
},
locationName: 'locationName',
addressLines: ['addressLines'],
locationDescription: 'locationDescription',
phoneNumber: 'phoneNumber',
locationImage: {
value: 'images/common/defaultButtonImage.png',
imageType: 'DYNAMIC'
},
searchAddress: {
countryName: 'countryName',
countryCode: 'countryCode',
postalCode: 'postalCode',
administrativeArea: 'administrativeArea',
subAdministrativeArea: 'subAdministrativeArea',
locality: 'locality',
subLocality: 'subLocality',
thoroughfare: 'thoroughfare',
subThoroughfare: 'subThoroughfare'
}
},
{
coordinate: {
latitudeDegrees: 0,
longitudeDegrees: 0
},
locationName: 'locationName',
addressLines: ['addressLines'],
locationDescription: 'locationDescription',
phoneNumber: 'phoneNumber',
locationImage: {
value: 'images/common/defaultButtonImage.png',
imageType: 'DYNAMIC'
},
searchAddress: {
countryName: 'countryName',
countryCode: 'countryCode',
postalCode: 'postalCode',
administrativeArea: 'administrativeArea',
subAdministrativeArea: 'subAdministrativeArea',
locality: 'locality',
subLocality: 'subLocality',
thoroughfare: 'thoroughfare',
subThoroughfare: 'subThoroughfare'
}
},
{
coordinate: {
latitudeDegrees: 0,
longitudeDegrees: 0
},
locationName: 'locationName',
addressLines: ['addressLines'],
locationDescription: 'locationDescription',
phoneNumber: 'phoneNumber',
locationImage: {
value: 'images/common/defaultButtonImage.png',
imageType: 'DYNAMIC'
},
searchAddress: {
countryName: 'countryName',
countryCode: 'countryCode',
postalCode: 'postalCode',
administrativeArea: 'administrativeArea',
subAdministrativeArea: 'subAdministrativeArea',
locality: 'locality',
subLocality: 'subLocality',
thoroughfare: 'thoroughfare',
subThoroughfare: 'subThoroughfare'
}
},
{
coordinate: {
latitudeDegrees: 0,
longitudeDegrees: 0
},
locationName: 'locationName',
addressLines: ['addressLines'],
locationDescription: 'locationDescription',
phoneNumber: 'phoneNumber',
locationImage: {
value: 'images/common/defaultButtonImage.png',
imageType: 'DYNAMIC'
},
searchAddress: {
countryName: 'countryName',
countryCode: 'countryCode',
postalCode: 'postalCode',
administrativeArea: 'administrativeArea',
subAdministrativeArea: 'subAdministrativeArea',
locality: 'locality',
subLocality: 'subLocality',
thoroughfare: 'thoroughfare',
subThoroughfare: 'subThoroughfare'
}
}
]
/**
* Current location of the vehicle
*/
vehicleLocationMarker: null,

/**
* Selected location
*/
selectedLocationMarker: null,

/**
* Saved waypoints array
*/
WayPointDetails: [],

/**
* Waypoint markers array
*/
WayPointMarkers: []
}
);
125 changes: 100 additions & 25 deletions app/view/navigationView.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,58 +39,108 @@ SDL.NavigationView = Em.ContainerView.create(
'SDL.States.navigation.active:active_state:inactive_state'
],
childViews: [
'POIList',
'WPList',
'codeEditor',
'POIButton',
'clearButton',
'WPButton',
'AddWP',
'map',
'navigate'
'navigate',
'animate'
],
POIList: SDL.List.extend(
WPList: SDL.List.extend(
{
elementId: 'poiList', //info_apps_list
elementId: 'wpList',
itemsOnPage: 5,
classNameBindings: ['SDL.NavigationModel.poi::hidden'],
classNameBindings: ['SDL.NavigationModel.wp::hidden'],
itemsBinding: 'this.itemGenerator',
itemGenerator: function() {
var items = [];
for (var i = 0; i < SDL.NavigationModel.LocationDetails.length; i++) {
for (var i = 0; i < SDL.NavigationModel.WayPointDetails.length; i++) {
var details = SDL.deepCopy(SDL.NavigationModel.WayPointDetails[i]);
items.push(
{
type: SDL.Button,
params: {
itemID: i,
className: 'button',
text: SDL.NavigationModel.LocationDetails[i].locationName,
text: details.locationDescription ? details.locationDescription : "Unknown waypoint",
disabled: false,
icon: SDL.NavigationModel.LocationDetails[i].locationImage.value,
templateName: SDL.NavigationModel.LocationDetails[i].locationImage
? '' : 'text',
action: 'openWayPoint',
icon: details.locationImage ? details.locationImage.value : null,
templateName: details.locationImage ? 'rightText' : 'text',
action: 'selectWayPoint',
target: 'SDL.NavigationController'
}
}
);
}
this.set('disableScrollbar', items.length <= this.itemsOnPage);
return items;
}.property('SDL.NavigationModel.LocationDetails.@each')
}.property('SDL.NavigationModel.WayPointDetails.@each')
}
),
codeEditor: SDL.CodeEditor.extend(
{
codeEditorId: 'navigationEditor',
contentBinding: 'SDL.NavigationModel.currentWayPointData'
contentBinding: 'SDL.NavigationModel.currentWayPointData',
childViews: [
'editor',
'buttonOk',
'buttonSelect',
'buttonDelete',
'backButton'
],
buttonSelect: SDL.Button.extend(
{
classNames: 'button ResetButton',
text: 'Select',
action: 'waypointSelected',
target: 'SDL.NavigationController',
onDown: false
}
)
}
),
clearButton: SDL.Button.extend(
{
isButtonDisabled: function() {
return SDL.NavigationModel.WayPointDetails.length == 0 ||
SDL.NavigationController.isAnimateStarted;
}.property('SDL.NavigationModel.WayPointDetails',
'SDL.NavigationController.isAnimateStarted'),
classNameBindings: 'SDL.FuncSwitcher.rev::is-disabled',
elementId: 'clearButton',
disabledBinding: 'isButtonDisabled',
classNames: 'clearButton button',
text: 'Clear',
action: 'clearRoutes',
target: 'SDL.NavigationController'
}
),
WPButton: SDL.Button.extend(
{
isButtonDisabled: function() {
return SDL.NavigationModel.WayPointDetails.length == 0 ||
SDL.NavigationController.isAnimateStarted;
}.property('SDL.NavigationModel.WayPointDetails',
'SDL.NavigationController.isAnimateStarted'),
classNameBindings: 'SDL.FuncSwitcher.rev::is-disabled',
disabledBinding: 'isButtonDisabled',
elementId: 'WPButton',
classNames: 'WPButton button',
text: 'Waypoints',
action: 'showWpList',
target: 'SDL.NavigationController'
}
),
POIButton: SDL.Button.extend(
AddWP: SDL.Button.extend(
{
classNameBindings: 'SDL.FuncSwitcher.rev::is-disabled',
elementId: 'POIButton',
disabledBinding: Em.Binding.oneWay(
'SDL.NavigationController.isRouteSet'
),
classNames: 'POIButton button',
text: 'POI',
action: 'showPoiList',
disabledBinding: 'SDL.NavigationController.isAnimateStarted',
elementId: 'AddWP',
classNames: 'AddWP button',
text: 'Add waypoint',
action: 'addWP',
target: 'SDL.NavigationController'
}
),
Expand All @@ -104,14 +154,39 @@ SDL.NavigationView = Em.ContainerView.create(
{
classNameBindings: 'SDL.FuncSwitcher.rev::is-disabled',
elementId: 'navigationButton',
disabledBinding: Em.Binding.oneWay(
'SDL.NavigationController.isRouteSet'
),
getDisabled: function() {
return SDL.NavigationController.isRouteSet ||
SDL.NavigationController.isAnimateStarted;
}
.property('SDL.NavigationController.isRouteSet',
'SDL.NavigationController.isAnimateStarted'),
disabledBinding: 'this.getDisabled',
classNames: 'navigationButton button',
text: 'Navigate',
action: 'setRoutes',
target: 'SDL.NavigationController'
}
),
animate: SDL.Button.extend(
{
classNameBindings: 'SDL.FuncSwitcher.rev::is-disabled',
elementId: 'animateButton',
classNames: 'animateButton button',
disabledBinding: 'getDisabled',
getDisabled: function() {
return !SDL.NavigationController.isRouteSet;
}
.property('SDL.NavigationController.isRouteSet'),
textBinding: 'getAnimateText',
getAnimateText: function() {
return !SDL.NavigationController.isAnimateStarted ?
'Start animation' :
'Stop animation';
}
.property('SDL.NavigationController.isAnimateStarted'),
action: 'startAnimation',
target: 'SDL.NavigationController'
}
)
}
);
Loading