import {CHANGE_MAIN_CATEGORY_ACTION,CHANGE_MAP_CAMERA_ACTION,CHANGE_BOOKMARK_LAYER_LIST_ACTION,
    CHANGE_CURRENT_LAYER_LIST_ACTION,CHANGE_CURRENT_FLY_ITEM_ID_ACTION,CHANGE_FLY_WAY_REFRESH_ACTION,
    CHANGE_CURRENT_RETURN_FIELDS_ACTION,CHANGE_CURRENT_RETURN_RESULT_ACTION,CHANGE_CURRENT_RETURN_CALCULATION_ACTION,
    CHANGE_CURRENT_DRAW_INFO_ACTION,CHANGE_COORDINATE_TRANSFORM_DATA_ACTION,CHANGE_COORDINATE_RESULT_HEADER_ACTION,
    CHANGE_SPACE_STATISTICS_FIELD_ACTION,CHANGE_RIGHT_TOOL_STATE_ACTION
} from "@/view/show-platform/store/action-constant";
import {CHANGE_MAIN_CATEGORY,CHANGE_MAP_CAMERA,CHANGE_BOOKMARK_LAYER_LIST,
    CHANGE_CURRENT_LAYER_LIST,CHANGE_CURRENT_FLY_ITEM_ID,CHANGE_FLY_WAY_REFRESH,
    CHANGE_CURRENT_RETURN_FIELDS,CHANGE_CURRENT_RETURN_RESULT,CHANGE_CURRENT_RETURN_CALCULATION,CHANGE_CURRENT_DRAW_INFO,
    CHANGE_COORDINATE_TRANSFORM_DATA,CHANGE_COORDINATE_RESULT_HEADER,CHANGE_SPACE_STATISTICS_FIELD,CHANGE_RIGHT_TOOL_STATE
} from "@/view/show-platform/store/mutation-constant";
export const platformStore = {
    namespaced:true,
    state:{
        mainCategory:'基础地理',
        camera:{     //当前视角
            heading:null,
            tilt:null,
            position:{
             x:null,
             y:null,
             z:null
            }
        },
        bookmarkLayerList:[],  //当前所选书签图层
        currentLayerList:[],  //当前图层

        currentFlyItemId:'',    //单条飞行路线的ID
        flyWayRefresh:false,  //判断是否刷新飞行列表的字段

        currentReturnFields:[],
        currentReturnResult:[],
        currentReturnCalculation:'',
        currentDrawInfo:{},
        coordinateResultHeader:{
        },
        coordinateTransformData:[],
        spaceStatisticsField:{
        },
        rightToolState:false,

    },
    mutations:{
        [CHANGE_MAIN_CATEGORY](state,payload){
            state.mainCategory = payload
        },
        [CHANGE_MAP_CAMERA](state,payload){
            state.camera.heading = payload.heading;
            state.camera.tilt = payload.tilt;
            state.camera.position.x = payload.x
            state.camera.position.y = payload.y
            state.camera.position.z = payload.z
        },
        [CHANGE_BOOKMARK_LAYER_LIST](state,payload){
            state.bookmarkLayerList = payload
        },
        [CHANGE_CURRENT_LAYER_LIST](state,payload){
            state.currentLayerList = payload
        },
        [CHANGE_CURRENT_FLY_ITEM_ID](state,payload){
            state.currentFlyItemId = payload
        },
        [CHANGE_FLY_WAY_REFRESH](state,payload){
            state.flyWayRefresh = payload
        },
        [CHANGE_CURRENT_RETURN_FIELDS](state,payload){
            state.currentReturnFields = payload
        },
        [CHANGE_CURRENT_RETURN_RESULT](state,payload){
            state.currentReturnResult = payload
        },
        [CHANGE_CURRENT_RETURN_CALCULATION](state,payload){
            state.currentReturnCalculation = payload
        },
        [CHANGE_CURRENT_DRAW_INFO](state,payload){
            state.currentDrawInfo = payload
        },
        [CHANGE_COORDINATE_RESULT_HEADER](state,payload){
            state.coordinateResultHeader = payload
        },
        [CHANGE_COORDINATE_TRANSFORM_DATA](state,payload){
            state.coordinateTransformData = payload
        },
        [CHANGE_SPACE_STATISTICS_FIELD](state,payload){
            state.spaceStatisticsField = payload
        },
        [CHANGE_RIGHT_TOOL_STATE](state,payload){
            state.rightToolState = payload
        },
    },
    actions:{
        [CHANGE_MAIN_CATEGORY_ACTION]({commit},payload){
            commit(CHANGE_MAIN_CATEGORY,payload)
        },
        [CHANGE_MAP_CAMERA_ACTION]({commit},payload){
            commit(CHANGE_MAP_CAMERA,payload)
        },
        [CHANGE_BOOKMARK_LAYER_LIST_ACTION]({commit},payload){
            commit(CHANGE_BOOKMARK_LAYER_LIST,payload)
        },
        [CHANGE_CURRENT_LAYER_LIST_ACTION]({commit},payload){
            commit(CHANGE_CURRENT_LAYER_LIST,payload)
        },
        [CHANGE_CURRENT_FLY_ITEM_ID_ACTION]({commit},payload){
            commit(CHANGE_CURRENT_FLY_ITEM_ID,payload)
        },
        [CHANGE_FLY_WAY_REFRESH_ACTION]({commit},payload){
            commit(CHANGE_FLY_WAY_REFRESH,payload)
        },
        [CHANGE_CURRENT_RETURN_FIELDS_ACTION]({commit},payload){
            commit(CHANGE_CURRENT_RETURN_FIELDS,payload)
        },
        [CHANGE_CURRENT_RETURN_RESULT_ACTION]({commit},payload){
            commit(CHANGE_CURRENT_RETURN_RESULT,payload)
        },
        [CHANGE_CURRENT_RETURN_CALCULATION_ACTION]({commit},payload){
            commit(CHANGE_CURRENT_RETURN_CALCULATION,payload)
        },
        [CHANGE_CURRENT_DRAW_INFO_ACTION]({commit},payload){
            commit(CHANGE_CURRENT_DRAW_INFO,payload)
        },
        [CHANGE_COORDINATE_RESULT_HEADER_ACTION]({commit},payload){
            commit(CHANGE_COORDINATE_RESULT_HEADER,payload)
        },
        [CHANGE_COORDINATE_TRANSFORM_DATA_ACTION]({commit},payload){
            commit(CHANGE_COORDINATE_TRANSFORM_DATA,payload)
        },
        [CHANGE_SPACE_STATISTICS_FIELD_ACTION]({commit},payload){
            commit(CHANGE_SPACE_STATISTICS_FIELD,payload)
        },
        [CHANGE_RIGHT_TOOL_STATE_ACTION]({commit},payload){
            commit(CHANGE_RIGHT_TOOL_STATE,payload)
        },
    }
}
