update heightmap lib
Signed-off-by: Stefan Dej <meteyou@gmail.com>
This commit is contained in:
parent
a37eb272ac
commit
184d2430c4
971
package-lock.json
generated
971
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -14,6 +14,7 @@
|
||||
"echarts": "^5.0.2",
|
||||
"echarts-gl": "^2.0.1",
|
||||
"object-assign-deep": "^0.4.0",
|
||||
"plotly.js": "^1.58.4",
|
||||
"prismjs": "^1.23.0",
|
||||
"vue": "^2.6.12",
|
||||
"vue-context": "^6.0.0",
|
||||
@ -25,7 +26,7 @@
|
||||
"vue-simple-upload": "^0.1.6",
|
||||
"vue-toast-notification": "^0.6.0",
|
||||
"vuetify": "^2.4.2",
|
||||
"vuex": "^3.6.0"
|
||||
"vuex": "^3.6.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@mdi/font": "^5.8.55",
|
||||
@ -45,7 +46,7 @@
|
||||
"vue-cli-plugin-vuetify": "^2.0.9",
|
||||
"vue-router": "^3.4.9",
|
||||
"vue-template-compiler": "^2.6.12",
|
||||
"vuetify-loader": "^1.6.0"
|
||||
"vuetify-loader": "^1.7.2"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"root": true,
|
||||
|
@ -1,53 +0,0 @@
|
||||
<template>
|
||||
<div id="heightmap" style="height: 400px; width: 100%;"></div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapState } from 'vuex'
|
||||
import * as echarts from 'echarts'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
|
||||
},
|
||||
data: function() {
|
||||
return {
|
||||
chart : null,
|
||||
chartOptions: {
|
||||
animation: false,
|
||||
series: []
|
||||
},
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState({
|
||||
intervalChartUpdate: state => state.gui.tempchart.intervalChartUpdate,
|
||||
intervalDatasetUpdate: state => state.gui.tempchart.intervalDatasetUpdate,
|
||||
}),
|
||||
series: {
|
||||
get () {
|
||||
return this.$store.state.printer.tempHistory.series
|
||||
}
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
createChart() {
|
||||
if (document.getElementById("tempchart") && this.chart === null) {
|
||||
this.chart = echarts.init(document.getElementById("tempchart"), null, {renderer: 'svg'})
|
||||
this.chart.setOption(this.chartOptions)
|
||||
} else setTimeout(() => {
|
||||
this.createChart()
|
||||
}, 500)
|
||||
}
|
||||
|
||||
},
|
||||
created() {
|
||||
window.addEventListener('resize', () => {
|
||||
if (this.chart) this.chart.resize()
|
||||
})
|
||||
},
|
||||
mounted: function() {
|
||||
this.createChart()
|
||||
}
|
||||
}
|
||||
</script>
|
@ -58,58 +58,6 @@
|
||||
<v-switch class="mr-3" v-model="colorbarType" label="Scale"></v-switch>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
<v-card>
|
||||
<v-toolbar flat dense>
|
||||
<v-toolbar-title>
|
||||
<span class="subheading">
|
||||
<v-icon left>mdi-grid</v-icon>
|
||||
Heightmap
|
||||
</span>
|
||||
<v-btn
|
||||
text
|
||||
color="primary"
|
||||
class="ml-1 d-none d-sm-inline-flex"
|
||||
@click="openRenameProfile()">{{ this.bed_mesh && this.bed_mesh.profile_name ? this.bed_mesh.profile_name : "" }}</v-btn>
|
||||
</v-toolbar-title>
|
||||
<v-spacer class=""></v-spacer>
|
||||
<v-btn
|
||||
text
|
||||
color="primary"
|
||||
class=" d-sm-none"
|
||||
@click="openRenameProfile()">{{ this.bed_mesh && this.bed_mesh.profile_name ? this.bed_mesh.profile_name : "" }}</v-btn>
|
||||
<v-item-group class="v-btn-toggle d-none d-sm-flex" name="controllers">
|
||||
<v-btn small class="px-2 minwidth-0" color="primary" @click="homePrinter" :loading="loadings.includes('homeAll')" title="Home All"><v-icon small>mdi-home</v-icon></v-btn>
|
||||
<v-btn small class="px-2 minwidth-0" color="primary" @click="clearBedMesh" :loading="loadings.includes('bedMeshClear')" v-if="this.bed_mesh && this.bed_mesh.profile_name" title="Clear bed mesh">Clear</v-btn>
|
||||
<v-btn small class="px-2 minwidth-0" color="primary" @click="calibrateDialog = true" :loading="loadings.includes('bedMeshCalibrate')" :disabled="is_printing" title="Calibrate new bed mesh">Calibrate</v-btn>
|
||||
</v-item-group>
|
||||
</v-toolbar>
|
||||
<v-card-text class="d-sm-none text-center pb-0">
|
||||
<v-item-group class="v-btn-toggle" name="controllers">
|
||||
<v-btn small class="px-2 minwidth-0" color="primary" @click="homePrinter" :loading="loadings.includes('homeAll')" title="Home All"><v-icon small>mdi-home</v-icon></v-btn>
|
||||
<v-btn small class="px-2 minwidth-0" color="primary" @click="clearBedMesh" :loading="loadings.includes('bedMeshClear')" v-if="this.bed_mesh && this.bed_mesh.profile_name" title="Clear bed mesh">Clear</v-btn>
|
||||
<v-btn small class="px-2 minwidth-0" color="primary" @click="calibrateDialog = true" :loading="loadings.includes('bedMeshCalibrate')" :disabled="is_printing" title="Calibrate new bed mesh">Calibrate</v-btn>
|
||||
</v-item-group>
|
||||
</v-card-text>
|
||||
<v-card-text v-if="!(this.bed_mesh && this.bed_mesh.profile_name)">
|
||||
No bed_mesh has been loaded yet.
|
||||
</v-card-text>
|
||||
<v-card-text class="px-0 py-0 content" v-if="this.bed_mesh && this.bed_mesh.profile_name">
|
||||
<v-container class="px-0 py-0">
|
||||
<v-row>
|
||||
<v-col class="pb-0 pt-5">
|
||||
<div id="heightmap" style="height: 400px; width: 100%;"></div>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
</v-card-text>
|
||||
<v-card-actions v-if="this.bed_mesh && this.bed_mesh.profile_name" class="py-0">
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn text :color="(this.showMeshType === 'probed' ? 'primary accent-4' : 'grey lighten-2')" @click="switchToProbed">Probed</v-btn>
|
||||
<v-btn text :color="(this.showMeshType === 'mesh' ? 'primary accent-4' : 'grey lighten-2')" @click="switchToMesh">Mesh</v-btn>
|
||||
<v-spacer></v-spacer>
|
||||
<v-switch class="mr-3" v-model="colorbarType" label="Scale"></v-switch>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-col>
|
||||
<v-col class="col-12 col-md-4">
|
||||
<v-card>
|
||||
@ -206,8 +154,6 @@
|
||||
<script>
|
||||
import {mapGetters, mapState} from 'vuex'
|
||||
import { Plotly } from 'vue-plotly'
|
||||
import * as echarts from "echarts"
|
||||
import 'echarts-gl'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@ -271,40 +217,6 @@
|
||||
calibrateDialog: false,
|
||||
newName: '',
|
||||
colorbarType: false,
|
||||
chart : null,
|
||||
chartOptions: {
|
||||
animation: false,
|
||||
visualMap: {
|
||||
show: false,
|
||||
dimension: 2,
|
||||
min: -1,
|
||||
max: 1,
|
||||
inRange: {
|
||||
color: ['#313695', '#4575b4', '#74add1', '#abd9e9', '#e0f3f8', '#ffffbf', '#fee090', '#fdae61', '#f46d43', '#d73027', '#a50026']
|
||||
}
|
||||
},
|
||||
xAxis3D: {
|
||||
type: 'value'
|
||||
},
|
||||
yAxis3D: {
|
||||
type: 'value'
|
||||
},
|
||||
zAxis3D: {
|
||||
type: 'value'
|
||||
},
|
||||
grid3D: {
|
||||
viewControl: {
|
||||
// projection: 'orthographic'
|
||||
}
|
||||
},
|
||||
series: [{
|
||||
type: 'surface',
|
||||
wireframe: {
|
||||
//show: false
|
||||
},
|
||||
data: []
|
||||
}]
|
||||
},
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@ -337,42 +249,24 @@
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
createChart() {
|
||||
if (document.getElementById("heightmap") && this.chart === null) {
|
||||
this.chart = echarts.init(document.getElementById("heightmap") )
|
||||
} else setTimeout(() => {
|
||||
this.createChart()
|
||||
}, 500)
|
||||
},
|
||||
showBedMesh: function() {
|
||||
const heightmapData = []
|
||||
window.console.log("showBedMesh")
|
||||
this.data[0].x = [];
|
||||
this.data[0].y = [];
|
||||
this.data[0].z = [];
|
||||
|
||||
if (this.bed_mesh && this.bed_mesh.profile_name !== "" && this.chart) {
|
||||
if (this.bed_mesh && this.bed_mesh.profile_name !== "") {
|
||||
const meshXmin = this.bed_mesh.mesh_min[0]
|
||||
const meshXmax = this.bed_mesh.mesh_max[0]
|
||||
const meshYmin = this.bed_mesh.mesh_min[1]
|
||||
const meshYmax = this.bed_mesh.mesh_max[1]
|
||||
window.console.log(this.config)
|
||||
|
||||
if ('stepper_x' in this.config && 'stepper_y' in this.config) {
|
||||
this.chartOptions.xAxis3D.min = this.config.stepper_x.position_min
|
||||
this.chartOptions.xAxis3D.max = this.config.stepper_x.position_max
|
||||
this.chartOptions.yAxis3D.min = this.config.stepper_y.position_min
|
||||
this.chartOptions.yAxis3D.max = this.config.stepper_y.position_max
|
||||
|
||||
this.layout.scene.xaxis.range = [this.config.stepper_x.position_min, this.config.stepper_x.position_max];
|
||||
this.layout.scene.yaxis.range= [this.config.stepper_y.position_min, this.config.stepper_y.position_max];
|
||||
this.layout.scene.xaxis.range = [this.config.stepper_x.position_min, this.config.stepper_x.position_max]
|
||||
this.layout.scene.yaxis.range= [this.config.stepper_y.position_min, this.config.stepper_y.position_max]
|
||||
} else {
|
||||
this.chartOptions.xAxis3D.min = meshXmin
|
||||
this.chartOptions.xAxis3D.max = meshXmax
|
||||
this.chartOptions.yAxis3D.min = meshYmin
|
||||
this.chartOptions.yAxis3D.max = meshYmax
|
||||
|
||||
this.layout.scene.xaxis.range = [this.bed_mesh.mesh_min[0], this.bed_mesh.mesh_max[0]];
|
||||
this.layout.scene.yaxis.range = [this.bed_mesh.mesh_min[1], this.bed_mesh.mesh_max[1]];
|
||||
this.layout.scene.xaxis.range = [meshXmin, meshXmax];
|
||||
this.layout.scene.yaxis.range = [meshYmin, meshYmax];
|
||||
}
|
||||
|
||||
const meshData = this.showMeshType === "probed" ? this.bed_mesh.probed_matrix : this.bed_mesh.mesh_matrix
|
||||
@ -393,16 +287,6 @@
|
||||
this.data[0].y.push(parseFloat(this.bed_mesh.mesh_min[1]) + parseFloat(y_step) * i);
|
||||
}
|
||||
|
||||
for (let y = 0; y < y_count; y++) {
|
||||
for (let x = 0; x < x_count; x++) {
|
||||
heightmapData.push([
|
||||
Math.round(meshXmin + (meshXmax-meshXmin) / (x_count - 1) * x * 1000) / 1000,
|
||||
Math.round(meshYmin + (meshYmax-meshYmin) / (y_count - 1) * y * 1000) / 1000,
|
||||
meshData[y][x]
|
||||
])
|
||||
}
|
||||
}
|
||||
|
||||
if(this.colorbarType) {
|
||||
this.data[0].cmin = min
|
||||
this.data[0].cmax = max
|
||||
@ -417,12 +301,6 @@
|
||||
if (max < 0.5) max = 0.5
|
||||
|
||||
this.layout.scene.zaxis.range = [min, max]
|
||||
this.chartOptions.zAxis3D.min = min
|
||||
this.chartOptions.zAxis3D.max = max
|
||||
|
||||
this.chartOptions.series[0].data = heightmapData
|
||||
window.console.log(this.chartOptions)
|
||||
this.chart.setOption(this.chartOptions)
|
||||
}
|
||||
|
||||
//this.$refs.heightmap.update();
|
||||
@ -479,12 +357,9 @@
|
||||
}
|
||||
},
|
||||
created() {
|
||||
window.addEventListener('resize', () => {
|
||||
if (this.chart) this.chart.resize()
|
||||
})
|
||||
|
||||
},
|
||||
mounted() {
|
||||
this.createChart()
|
||||
this.showBedMesh()
|
||||
},
|
||||
watch: {
|
||||
|
Loading…
x
Reference in New Issue
Block a user