Implement next and preious temporal
This commit is contained in:
parent
be885ce917
commit
60c741d935
@ -18,6 +18,9 @@ export const SELECTFEATURE = '[Map] SelectFeature';
|
|||||||
export const SELECTITEM = '[Map] SelectItem';
|
export const SELECTITEM = '[Map] SelectItem';
|
||||||
export const SELECTITEMSUCCESS = '[Map] SelectItemSuccess';
|
export const SELECTITEMSUCCESS = '[Map] SelectItemSuccess';
|
||||||
export const SELECTTEMPORALITEMSSUCCESS = '[Map] SelectTemporalItemsSuccess';
|
export const SELECTTEMPORALITEMSSUCCESS = '[Map] SelectTemporalItemsSuccess';
|
||||||
|
export const NEXTTEMPORAL = '[Map] NextTemporal';
|
||||||
|
export const PREVIOUSTEMPORAL = '[Map] PreviousTemporal';
|
||||||
|
export const SELECTTEMPORAL = '[Map] SelectTemporal';
|
||||||
export const ADDFEATURESUCCESS = '[Map] AddFeatureSuccess';
|
export const ADDFEATURESUCCESS = '[Map] AddFeatureSuccess';
|
||||||
export const UPDATEFEATURESUCCESS = '[Map] UpdateFeatureSuccess';
|
export const UPDATEFEATURESUCCESS = '[Map] UpdateFeatureSuccess';
|
||||||
export const EXPANDSEARCH = '[Map] ExpandSearch';
|
export const EXPANDSEARCH = '[Map] ExpandSearch';
|
||||||
@ -105,6 +108,24 @@ export class SelectTemporalItemsSuccess implements Action {
|
|||||||
constructor(public temporalItems: IItem[]) { }
|
constructor(public temporalItems: IItem[]) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class NextTemporal implements Action {
|
||||||
|
readonly type = NEXTTEMPORAL;
|
||||||
|
|
||||||
|
constructor() { }
|
||||||
|
}
|
||||||
|
|
||||||
|
export class PreviousTemporal implements Action {
|
||||||
|
readonly type = PREVIOUSTEMPORAL;
|
||||||
|
|
||||||
|
constructor() { }
|
||||||
|
}
|
||||||
|
|
||||||
|
export class SelectTemporal implements Action {
|
||||||
|
readonly type = SELECTTEMPORAL;
|
||||||
|
|
||||||
|
constructor(item:IItem) { }
|
||||||
|
}
|
||||||
|
|
||||||
export class AddFeatureSuccess implements Action {
|
export class AddFeatureSuccess implements Action {
|
||||||
readonly type = ADDFEATURESUCCESS;
|
readonly type = ADDFEATURESUCCESS;
|
||||||
|
|
||||||
@ -233,6 +254,9 @@ export type Actions = SetMapState
|
|||||||
| SelectItem
|
| SelectItem
|
||||||
| SelectItemSuccess
|
| SelectItemSuccess
|
||||||
| SelectTemporalItemsSuccess
|
| SelectTemporalItemsSuccess
|
||||||
|
| NextTemporal
|
||||||
|
| PreviousTemporal
|
||||||
|
| SelectTemporal
|
||||||
| AddFeatureSuccess
|
| AddFeatureSuccess
|
||||||
| UpdateFeatureSuccess
|
| UpdateFeatureSuccess
|
||||||
| ExpandSearch
|
| ExpandSearch
|
||||||
|
@ -186,6 +186,41 @@ export function reducer(state = initialState, action: mapActions.Actions | commo
|
|||||||
selectedItemLayer.nextItemLayer = null;
|
selectedItemLayer.nextItemLayer = null;
|
||||||
return tassign(state,{selectedItemLayer:tassign(state.selectedItemLayer,selectedItemLayer as ItemLayer)});
|
return tassign(state,{selectedItemLayer:tassign(state.selectedItemLayer,selectedItemLayer as ItemLayer)});
|
||||||
}
|
}
|
||||||
|
case mapActions.NEXTTEMPORAL: {
|
||||||
|
let temporalLayer = state.selectedItemLayer as ITemporalItemLayer;
|
||||||
|
if(temporalLayer.temporalItems && temporalLayer.temporalItems.length>0) {
|
||||||
|
let index = temporalLayer.temporalItems.indexOf(temporalLayer.selectedItemLayer.item);
|
||||||
|
if(index == (temporalLayer.temporalItems.length-1)) {
|
||||||
|
return state;
|
||||||
|
} else {
|
||||||
|
temporalLayer.previousItemLayer = temporalLayer.selectedItemLayer;
|
||||||
|
temporalLayer.selectedItemLayer = temporalLayer.nextItemLayer;
|
||||||
|
temporalLayer.nextItemLayer = index+1 < temporalLayer.temporalItems.length? new ItemLayer(temporalLayer.temporalItems[index+1]):null;
|
||||||
|
return tassign(state,{selectedItemLayer:tassign(state.selectedItemLayer,temporalLayer as ItemLayer)});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case mapActions.PREVIOUSTEMPORAL: {
|
||||||
|
let temporalLayer = state.selectedItemLayer as ITemporalItemLayer;
|
||||||
|
if(temporalLayer.temporalItems && temporalLayer.temporalItems.length>0) {
|
||||||
|
let index = temporalLayer.temporalItems.indexOf(temporalLayer.selectedItemLayer.item);
|
||||||
|
if(index == 0) {
|
||||||
|
return state;
|
||||||
|
} else {
|
||||||
|
temporalLayer.nextItemLayer = temporalLayer.selectedItemLayer;
|
||||||
|
temporalLayer.selectedItemLayer = temporalLayer.previousItemLayer;
|
||||||
|
temporalLayer.previousItemLayer = index-1 >=0? new ItemLayer(temporalLayer.temporalItems[index-1]):null;
|
||||||
|
return tassign(state,{selectedItemLayer:tassign(state.selectedItemLayer,temporalLayer as ItemLayer)});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case mapActions.SELECTTEMPORAL:{
|
||||||
|
//todo implement
|
||||||
|
}
|
||||||
case mapActions.STARTSEARCH: {
|
case mapActions.STARTSEARCH: {
|
||||||
let a = action as mapActions.StartSearch;
|
let a = action as mapActions.StartSearch;
|
||||||
return tassign(state, {
|
return tassign(state, {
|
||||||
|
Loading…
Reference in New Issue
Block a user