Added parentitem title to geotiff, shape and temporal selected-item components.
Some checks failed
FarmMaps.Develop/FarmMapsLib/pipeline/head There was a failure building this commit

This commit is contained in:
2020-07-15 23:15:31 +02:00
parent 0f5a5251db
commit c0f689331e
10 changed files with 117 additions and 90 deletions

View File

@@ -44,9 +44,10 @@ export interface State {
panelCollapsed: boolean,
selectedFeature: Feature,
selectedItem:IItem,
parentItem:IItem,
clearEnabled: boolean,
searchCollapsed: boolean,
searchMinified: boolean,
searchMinified: boolean,
extent: number[],
baseLayers: Array<IItemLayer>
overlayLayers: Array<IItemLayer>,
@@ -81,7 +82,7 @@ export const initialState: State = {
panelVisible: false,
panelCollapsed: false,
selectedFeature: null,
selectedItem: null,
selectedItem: null,
clearEnabled: false,
searchCollapsed: true,
searchMinified:false,
@@ -99,7 +100,7 @@ export const initialState: State = {
replaceUrl:true
}
export function reducer(state = initialState, action: mapActions.Actions | commonActions.Actions | RouterNavigationAction): State {
export function reducer(state = initialState, action: mapActions.Actions | commonActions.Actions | RouterNavigationAction): State {
switch (action.type) {
case ROUTER_NAVIGATION: {
let a = action as RouterNavigationAction;
@@ -125,13 +126,13 @@ export function reducer(state = initialState, action: mapActions.Actions | commo
}
case mapActions.SETPARENT: {
let a = action as mapActions.SetParent;
return tassign(state, {
return tassign(state, {
parentCode : a.parentCode
});
}
case mapActions.STARTSEARCHSUCCESS: {
let a = action as mapActions.StartSearchSuccess;
return tassign(state, {
return tassign(state, {
features: a.features,
inSearch:false
});
@@ -141,8 +142,8 @@ export function reducer(state = initialState, action: mapActions.Actions | commo
return tassign(state, {
selectedFeature: state.selectedItem?state.selectedFeature: a.feature
});
}
case mapActions.SELECTITEM: {
}
case mapActions.SELECTITEM: {
let a = action as mapActions.SelectItem;
let itemCode = state.selectedItem ? state.selectedItem.code : "";
let inSearch = (a.itemCode != itemCode || state.setStateCount == 1)
@@ -160,11 +161,12 @@ export function reducer(state = initialState, action: mapActions.Actions | commo
itemLayer = new ItemLayer(a.item);
itemLayer.layerIndex = a.item.data.layers?a.item.data.layers[0].index:-1;
} else if (a.item && a.item.itemType == "vnd.farmmaps.itemtype.temporal") {
itemLayer = new TemporalItemLayer(a.item);
itemLayer = new TemporalItemLayer(a.item);
}
return tassign(state, {
inSearch:false,
selectedItem: a.item,
parentItem: a.parentItem,
selectedItemLayer: itemLayer,
panelVisible: a.item != null,
clearEnabled: a.item != null,
@@ -181,7 +183,7 @@ export function reducer(state = initialState, action: mapActions.Actions | commo
if(a.temporalItems.length>0) {
let item = a.temporalItems[a.temporalItems.length-1];
layerIndex = item.data.layers[0].index;
selectedItemLayer.selectedItemLayer = new ItemLayer(item,1,true,layerIndex);
selectedItemLayer.selectedItemLayer = new ItemLayer(item,1,true,layerIndex);
} else {
selectedItemLayer.selectedItemLayer = null;
}
@@ -189,9 +191,9 @@ export function reducer(state = initialState, action: mapActions.Actions | commo
selectedItemLayer.nextItemLayer = null;
if(selectedItemLayer.selectedItemLayer) {
let layerIndex = selectedItemLayer.selectedItemLayer.item.data.layers[0].index;
selectedItemLayer.layerIndex = layerIndex;
selectedItemLayer.layerIndex = layerIndex;
}
return tassign(state,{selectedItemLayer:tassign(state.selectedItemLayer,selectedItemLayer as ItemLayer)});
}
case mapActions.NEXTTEMPORAL: {
@@ -234,11 +236,11 @@ export function reducer(state = initialState, action: mapActions.Actions | commo
temporalLayer.nextItemLayer.opacity=0;
temporalLayer.nextItemLayer.layerIndex = temporalLayer.layerIndex;
}
temporalLayer.selectedItemLayer = temporalLayer.previousItemLayer;
temporalLayer.selectedItemLayer = temporalLayer.previousItemLayer;
if( temporalLayer.selectedItemLayer) {
temporalLayer.selectedItemLayer.opacity=1;
temporalLayer.selectedItemLayer.layerIndex = temporalLayer.layerIndex;
}
}
temporalLayer.previousItemLayer = index-2 >=0? new ItemLayer(temporalLayer.temporalItems[index-2],0,true,temporalLayer.layerIndex):null;
if( temporalLayer.previousItemLayer) {
temporalLayer.previousItemLayer.opacity=0;
@@ -289,7 +291,7 @@ export function reducer(state = initialState, action: mapActions.Actions | commo
});
}
case mapActions.UPDATEFEATURESUCCESS: {
let a = action as mapActions.UpdateFeatureSuccess;
let a = action as mapActions.UpdateFeatureSuccess;
let features: any[] = [];
var index = -1;
for (var i = 0; i < state.features.length; i++) {
@@ -311,9 +313,9 @@ export function reducer(state = initialState, action: mapActions.Actions | commo
return tassign(state, { searchCollapsed: state.panelVisible ? false: true,showLayerSwitcher:false});
}
case mapActions.SETEXTENT: {
let a = action as mapActions.SetExtent;
let a = action as mapActions.SetExtent;
return tassign(state, { extent: a.extent });
}
}
case mapActions.ADDLAYER: {
let a = action as mapActions.AddLayer;
let itemLayers = state.overlayLayers.slice(0);
@@ -326,7 +328,7 @@ export function reducer(state = initialState, action: mapActions.Actions | commo
} else {
return state;
}
}
case mapActions.REMOVELAYER: {
let a = action as mapActions.RemoveLayer;
@@ -356,7 +358,7 @@ export function reducer(state = initialState, action: mapActions.Actions | commo
}
case mapActions.SETLAYERINDEX: {
let a = action as mapActions.SetLayerIndex;
if (a.itemLayer == null) {
if (a.itemLayer == null) {
if(state.selectedItemLayer.item.itemType == "vnd.farmmaps.itemtype.temporal") {
var newItemlayer = tassign(state.selectedItemLayer,{layerIndex:a.layerIndex});
let tl = newItemlayer as ITemporalItemLayer;
@@ -384,7 +386,7 @@ export function reducer(state = initialState, action: mapActions.Actions | commo
} else {
var newItemlayer = new ItemLayer(state.selectedItemLayer.item);
newItemlayer.layerIndex = a.layerIndex;
}
return tassign(state, { selectedItemLayer: newItemlayer})
} else {
@@ -404,7 +406,7 @@ export function reducer(state = initialState, action: mapActions.Actions | commo
}
var selectedBaseLayer: IItemLayer = null;
var mapState = tassign(state.mapState);
let sb = baseLayers.filter(layer => layer.item.code === mapState.baseLayerCode)[0];
let sb = baseLayers.filter(layer => layer.item.code === mapState.baseLayerCode)[0];
if (baseLayers.length > 0 && mapState.baseLayerCode != "" && sb) {
selectedBaseLayer = sb;
selectedBaseLayer.visible = true;
@@ -460,7 +462,7 @@ export function reducer(state = initialState, action: mapActions.Actions | commo
case mapActions.SHOWLAYERSWITCHER:{
let a = action as mapActions.ShowLayerSwitcher;
return tassign(state,{showLayerSwitcher:a.show});
}
}
case mapActions.SETREPLACEURL: {
let a= action as mapActions.SetReplaceUrl;
return tassign(state,{replaceUrl:a.replaceUrl});
@@ -481,6 +483,7 @@ export const getPanelVisible = (state: State) => state.panelVisible;
export const getPanelCollapsed = (state: State) => state.panelCollapsed;
export const getSelectedFeature = (state: State) => state.selectedFeature;
export const getSelectedItem = (state: State) => state.selectedItem;
export const getParentItem = (state: State) => state.parentItem;
export const getQueryState = (state: State) => state.queryState;
export const getClearEnabled = (state: State) => state.clearEnabled;
export const getSearchCollapsed = (state: State) => state.searchCollapsed;
@@ -508,6 +511,7 @@ export const selectGetPanelVisible = createSelector(selectMapState, getPanelVisi
export const selectGetPanelCollapsed = createSelector(selectMapState, getPanelCollapsed);
export const selectGetSelectedFeature = createSelector(selectMapState, getSelectedFeature);
export const selectGetSelectedItem = createSelector(selectMapState, getSelectedItem);
export const selectGetParentItem = createSelector(selectMapState, getParentItem);
export const selectGetQueryState = createSelector(selectMapState, getQueryState);
export const selectGetClearEnabled = createSelector(selectMapState, getClearEnabled);
export const selectGetSearchCollapsed = createSelector(selectMapState, getSearchCollapsed);
@@ -518,7 +522,7 @@ export const selectGetBaseLayers = createSelector(selectMapState, getBaseLayers)
export const selectGetProjection = createSelector(selectMapState, getProjection);
export const selectGetSelectedBaseLayer = createSelector(selectMapState, getSelectedBaseLayer);
export const selectGetSelectedOverlayLayer = createSelector(selectMapState, getSelectedOverlayLayer);
export const selectGetQuery = createSelector(selectMapState, getQuery);
export const selectGetQuery = createSelector(selectMapState, getQuery);
export const selectGetSelectedItemLayer = createSelector(selectMapState, getSelectedItemLayer);
export const selectGetPeriod = createSelector(selectMapState, getPeriod);
export const selectGetStyles = createSelector(selectMapState, getStyles);