GeoGeBra C1
这个提交包含在:
14
GeoGeBra.js
14
GeoGeBra.js
@ -37,18 +37,17 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|||||||
};
|
};
|
||||||
exports.__esModule = true;
|
exports.__esModule = true;
|
||||||
var Core = require("./Core");
|
var Core = require("./Core");
|
||||||
var GGB = require("node-geogebra");
|
|
||||||
var fs = require("fs");
|
var fs = require("fs");
|
||||||
|
var GGB = require("node-geogebra");
|
||||||
var Pool = new GGB.GGBPool({ plotters: 1, ggb: 'local' });
|
var Pool = new GGB.GGBPool({ plotters: 1, ggb: 'local' });
|
||||||
var PoolReady = false;
|
var PoolReady = false;
|
||||||
var Plotter;
|
var Plotter;
|
||||||
Pool.ready().then(function () { return __awaiter(void 0, void 0, void 0, function () {
|
Pool.ready().then(function () { return __awaiter(void 0, void 0, void 0, function () {
|
||||||
return __generator(this, function (_a) {
|
return __generator(this, function (_a) {
|
||||||
console.log('GGBReady');
|
|
||||||
switch (_a.label) {
|
switch (_a.label) {
|
||||||
case 0:
|
case 0:
|
||||||
PoolReady = true;
|
PoolReady = true;
|
||||||
return [4 /*yield*/, Pool.getGGBPlotter()];
|
return [4 /*yield*/, Pool.getGGBPlotter];
|
||||||
case 1:
|
case 1:
|
||||||
Plotter = _a.sent();
|
Plotter = _a.sent();
|
||||||
return [2 /*return*/];
|
return [2 /*return*/];
|
||||||
@ -60,14 +59,13 @@ Core.AddListener(function (c, i) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
console.log(Plotter);
|
|
||||||
console.log(GGB);
|
|
||||||
console.log(Pool);
|
|
||||||
var Command = i.message.replace("绘图", "");
|
var Command = i.message.replace("绘图", "");
|
||||||
Plotter.evalGGBScript([Command]);
|
Plotter.evalGGBScript([Command]);
|
||||||
Core.frame.SendMsg(c, i, "[GeoGeBra]执行完成,正在渲染。");
|
Core.frame.SendMsg(c, i, "[GeoGeBra]执行完成,正在渲染。");
|
||||||
Core.frame.SendImg(c, i, "");
|
Core.frame.SendImg(c, i, "");
|
||||||
Plotter.export("png").then(function (v) {
|
Plotter["export"]("png").then(function (v) {
|
||||||
fs.writeFile("/home/pi/AI/temp/img.png",v,()=>{ Core.frame.SendImg(c, i, "/home/pi/AI/temp/img.png");});
|
fs.writeFile("/home/pi/AI/temp/img.png", v, function () {
|
||||||
|
Core.frame.SendImg(c, i, "/home/pi/AI/temp/img.png");
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
15
GeoGeBra.ts
15
GeoGeBra.ts
@ -1,4 +1,5 @@
|
|||||||
import * as Core from "./Core"
|
import * as Core from "./Core"
|
||||||
|
import * as fs from "fs";
|
||||||
var GGB = require("node-geogebra")
|
var GGB = require("node-geogebra")
|
||||||
var Pool = new GGB.GGBPool({plotters:1,ggb:'local'});
|
var Pool = new GGB.GGBPool({plotters:1,ggb:'local'});
|
||||||
var PoolReady:Boolean = false;
|
var PoolReady:Boolean = false;
|
||||||
@ -11,9 +12,11 @@ Core.AddListener((c,i)=>{
|
|||||||
if(i.message.substring(0,2)!="绘图"){return};
|
if(i.message.substring(0,2)!="绘图"){return};
|
||||||
var Command = i.message.replace("绘图","");
|
var Command = i.message.replace("绘图","");
|
||||||
Plotter.evalGGBScript([Command]);
|
Plotter.evalGGBScript([Command]);
|
||||||
Core.frame.SendMsg(c,i,"[GeoGeBra]执行完成,正在渲染。");
|
Core.frame.SendMsg(c, i, "[GeoGeBra]执行完成,正在渲染。");
|
||||||
Core.frame.SendImg(c,i,``);
|
Core.frame.SendImg(c, i, "");
|
||||||
(Plotter.export64("png") as Promise<string>).then((v)=>{
|
(Plotter.export("png") as Promise<Buffer>).then(function (v) {
|
||||||
Core.frame.SendImg(c,i,`dara:image/png;${v}`);
|
fs.writeFile("/home/pi/AI/temp/img.png",v,()=>{
|
||||||
})
|
Core.frame.SendImg(c, i, "/home/pi/AI/temp/img.png");
|
||||||
})
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
在新工单中引用
屏蔽一个用户