mirror of
https://github.com/PhotonVision/photonvision
synced 2026-07-04 03:11:40 +00:00
Rename to PhotonVision
This commit is contained in:
66
photon-client/src/store/index.js
Normal file
66
photon-client/src/store/index.js
Normal file
@@ -0,0 +1,66 @@
|
||||
import Vue from 'vue'
|
||||
import Vuex from 'vuex'
|
||||
|
||||
import pipeline from "./modules/pipeline";
|
||||
import generalSettings from "./modules/generalSettings";
|
||||
import cameraSettings from "./modules/cameraSettings";
|
||||
import undoRedo from "./modules/undoRedo";
|
||||
|
||||
Vue.use(Vuex);
|
||||
|
||||
const set = key => (state, val) => {
|
||||
Vue.set(state, key, val);
|
||||
};
|
||||
|
||||
export default new Vuex.Store({
|
||||
modules: {
|
||||
pipeline: pipeline,
|
||||
settings: generalSettings,
|
||||
cameraSettings: cameraSettings,
|
||||
undoRedo: undoRedo
|
||||
},
|
||||
state: {
|
||||
resolutionList: [],
|
||||
port: 1181,
|
||||
currentCameraIndex: 0,
|
||||
currentPipelineIndex: 0,
|
||||
cameraList: [],
|
||||
pipelineList: [],
|
||||
point: {},
|
||||
saveBar: false
|
||||
},
|
||||
mutations: {
|
||||
settings: set('settings'),
|
||||
pipeline: set('pipeline'),
|
||||
cameraSettings: set('cameraSettings'),
|
||||
resolutionList: set('resolutionList'),
|
||||
port: set('port'),
|
||||
currentCameraIndex: set('currentCameraIndex'),
|
||||
currentPipelineIndex: set('currentPipelineIndex'),
|
||||
cameraList: set('cameraList'),
|
||||
pipelineList: set('pipelineList'),
|
||||
point: set('point'),
|
||||
driverMode: set('driverMode'),
|
||||
saveBar: set("saveBar")
|
||||
},
|
||||
getters: {
|
||||
streamAddress: state => {
|
||||
return "http://" + location.hostname + ":" + state.port + "/stream.mjpg";
|
||||
},
|
||||
targets: state => {
|
||||
return state.point['targets']
|
||||
},
|
||||
cameraList: state => {
|
||||
return state.cameraList
|
||||
},
|
||||
pipelineList: state => {
|
||||
return state.pipelineList
|
||||
},
|
||||
currentCameraIndex: state => {
|
||||
return state.currentCameraIndex
|
||||
},
|
||||
currentPipelineIndex: state => {
|
||||
return state.currentPipelineIndex
|
||||
}
|
||||
}
|
||||
})
|
||||
14
photon-client/src/store/modules/cameraSettings.js
Normal file
14
photon-client/src/store/modules/cameraSettings.js
Normal file
@@ -0,0 +1,14 @@
|
||||
export default {
|
||||
state: {
|
||||
calibration: [],
|
||||
fov: 0,
|
||||
resolution: 0,
|
||||
streamDivisor: 0,
|
||||
tilt: 0
|
||||
},
|
||||
getters: {
|
||||
cameraSettings: state => {
|
||||
return state
|
||||
}
|
||||
}
|
||||
}
|
||||
10
photon-client/src/store/modules/generalSettings.js
Normal file
10
photon-client/src/store/modules/generalSettings.js
Normal file
@@ -0,0 +1,10 @@
|
||||
export default {
|
||||
state:{
|
||||
teamNumber: 1577,
|
||||
connectionType: 0,
|
||||
ip: "",
|
||||
gateway: "",
|
||||
netmask: "",
|
||||
hostname: "chameleon-vision"
|
||||
}
|
||||
}
|
||||
45
photon-client/src/store/modules/pipeline.js
Normal file
45
photon-client/src/store/modules/pipeline.js
Normal file
@@ -0,0 +1,45 @@
|
||||
import Vue from 'vue'
|
||||
|
||||
export default {
|
||||
state: {
|
||||
exposure: 0,
|
||||
brightness: 0,
|
||||
gain: 0,
|
||||
rotationMode: 0,
|
||||
hue: [0, 15],
|
||||
saturation: [0, 15],
|
||||
value: [0, 25],
|
||||
erode: false,
|
||||
dilate: false,
|
||||
area: [0, 12],
|
||||
ratio: [0, 12],
|
||||
extent: [0, 12],
|
||||
speckle: 5,
|
||||
targetGrouping: 0,
|
||||
targetIntersection: 0,
|
||||
sortMode: 0,
|
||||
multiple: false,
|
||||
isBinary: 0,
|
||||
calibrationMode: 0,
|
||||
videoModeIndex: 0,
|
||||
streamDivisor: 0,
|
||||
is3D: false,
|
||||
targetRegion: 0,
|
||||
targetOrientation: 1
|
||||
},
|
||||
mutations: {
|
||||
isBinary: (state, value) => {
|
||||
state.isBinary = value
|
||||
},
|
||||
mutatePipeline: (state, {key, value}) => {
|
||||
Vue.set(state, key, value)
|
||||
}
|
||||
|
||||
},
|
||||
actions: {},
|
||||
getters: {
|
||||
pipeline: state => {
|
||||
return state
|
||||
}
|
||||
}
|
||||
};
|
||||
72
photon-client/src/store/modules/undoRedo.js
Normal file
72
photon-client/src/store/modules/undoRedo.js
Normal file
@@ -0,0 +1,72 @@
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
import Vue from 'vue'
|
||||
|
||||
export default {
|
||||
state: {
|
||||
done: [],
|
||||
undone: [],
|
||||
newMutation: true
|
||||
},
|
||||
mutations: {
|
||||
updatePipeline: (state, val) => {
|
||||
state.done.push(val)
|
||||
if (state.newMutation) {
|
||||
state.undone = []
|
||||
}
|
||||
},
|
||||
addUndone: (state, val) => {
|
||||
state.undone.push(val);
|
||||
},
|
||||
removeLastDone: state => {
|
||||
state.done.pop()
|
||||
},
|
||||
removeLastUnDone: state => {
|
||||
state.undone.pop()
|
||||
},
|
||||
updateStatus: (state, bool) => {
|
||||
state.newMutation = bool;
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
undo: (context, {vm}) => {
|
||||
let commit = context.getters.lastDone;
|
||||
context.commit('removeLastDone')
|
||||
context.commit('updateStatus', false)
|
||||
for (let key in commit) {
|
||||
if (commit.hasOwnProperty(key)) {
|
||||
context.commit('addUndone', {[key]: context.getters["pipeline"][key]});
|
||||
context.commit('mutatePipeline', {'key': key, 'value': commit[key]});
|
||||
vm.handleInput(key, commit[key]);
|
||||
}
|
||||
}
|
||||
context.commit('updateStatus', true)
|
||||
},
|
||||
redo: (context, {vm}) => {
|
||||
let commit = context.getters.lastUnDone;
|
||||
context.commit('removeLastUnDone');
|
||||
context.commit('updateStatus', false)
|
||||
for (let key in commit) {
|
||||
if (commit.hasOwnProperty(key)) {
|
||||
context.commit('mutatePipeline', {'key': key, 'value': commit[key]});
|
||||
vm.handleInput(key, commit[key]);
|
||||
}
|
||||
}
|
||||
context.commit('updateStatus', true)
|
||||
}
|
||||
},
|
||||
getters: {
|
||||
lastDone: state => {
|
||||
return state.done[state.done.length - 1]
|
||||
},
|
||||
lastUnDone: state => {
|
||||
return state.undone[state.undone.length - 1]
|
||||
},
|
||||
canUndo: state => {
|
||||
return state.done.length
|
||||
},
|
||||
canRedo: state => {
|
||||
return state.undone.length
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
Reference in New Issue
Block a user