北京上地做网站,电子商务网站后台核心管理,南安住房与城乡建设部网站,邢台做网站企业作者#xff1a;CSDN _养乐多_
本文记录了在 Google Earth Engine#xff08;GEE#xff09;上实现简单计算器的代码。
APP链接#xff1a;https://949384116.users.earthengine.app/view/simplecalculator 文章目录 一、完整代码二、代码链接 一、完整代码
// 定义初始…作者CSDN _养乐多_
本文记录了在 Google Earth EngineGEE上实现简单计算器的代码。
APP链接https://949384116.users.earthengine.app/view/simplecalculator 文章目录 一、完整代码二、代码链接 一、完整代码
// 定义初始变量
var inputText ui.Textbox(0, ); // 文本框用于显示输入和结果
inputText.style().set({width: 194px, textAlign: center}); // 设置文本框宽度和文本居中
var buttons []; // 数字和运算符按钮
var result 0; // 保存计算结果// 创建数字按钮0-9
for (var i 0; i 9; i) {buttons.push(ui.Button(i.toString(), function(button) {return function() {var currentInput inputText.getValue();if (currentInput 0) {inputText.setValue(button);} else {inputText.setValue(currentInput button);}};}(i.toString())));
}// 创建运算符按钮、-、*、/
var operators [, -, *, /];
for (var j 0; j operators.length; j) {buttons.push(ui.Button(operators[j], function(operator) {return function() {var currentInput inputText.getValue();if (!isNaN(parseFloat(currentInput))) {result eval(currentInput); // 使用eval计算结果inputText.setValue(result operator);}};}(operators[j])));
}// 创建等号按钮
buttons.push(ui.Button(, function() {var currentInput inputText.getValue();if (!isNaN(parseFloat(currentInput))) {result eval(currentInput);inputText.setValue(result.toString());}
}));// 创建小数点按钮
buttons.push(ui.Button(., function() {var currentInput inputText.getValue();if (currentInput.indexOf(.) -1) {inputText.setValue(currentInput .);}
}));// 创建清空按钮
buttons.push(ui.Button(清空, function() {inputText.setValue(0);result 0;
}));// 创建一个面板来容纳按钮
// var buttonPanel ui.Panel(buttons, ui.Panel.Layout.flow(horizontal));
var row1Panel ui.Panel([inputText, buttons[16]], ui.Panel.Layout.flow(horizontal));
var row2Panel ui.Panel([buttons[1], buttons[2], buttons[3], buttons[10]], ui.Panel.Layout.flow(horizontal), { color : #8E8E8E,border: });
var row3Panel ui.Panel([buttons[4], buttons[5], buttons[6], buttons[11]], ui.Panel.Layout.flow(horizontal), { color : #8E8E8E,border: });
var row4Panel ui.Panel([buttons[7], buttons[8], buttons[9], buttons[12]], ui.Panel.Layout.flow(horizontal), { color : #8E8E8E,border: });
var row5Panel ui.Panel([buttons[13], buttons[0], buttons[15], buttons[14]], ui.Panel.Layout.flow(horizontal), { color : #8E8E8E,border: });// 创建一个面板来容纳界面元素
var panel ui.Panel([// buttonPanel,row1Panel,row2Panel,row3Panel,row4Panel,row5Panel
]);// 在地图上显示面板
Map.add(ui.Panel(panel));二、代码链接 https://code.earthengine.google.com/4607cd48d41ced0af8d7fcaccd3e94e0?noloadtrue 声明 本人作为一名作者非常重视自己的作品和知识产权。在此声明本人的所有原创文章均受版权法保护未经本人授权任何人不得擅自公开发布。 本人的文章已经在一些知名平台进行了付费发布希望各位读者能够尊重知识产权不要进行侵权行为。任何未经本人授权而将付费文章免费或者付费包含商用发布在互联网上的行为都将视为侵犯本人的版权本人保留追究法律责任的权利。 谢谢各位读者对本人文章的关注和支持
文章转载自: http://www.morning.twdkt.cn.gov.cn.twdkt.cn http://www.morning.gwsll.cn.gov.cn.gwsll.cn http://www.morning.mzwqt.cn.gov.cn.mzwqt.cn http://www.morning.wfyqn.cn.gov.cn.wfyqn.cn http://www.morning.tzzxs.cn.gov.cn.tzzxs.cn http://www.morning.litao4.cn.gov.cn.litao4.cn http://www.morning.pgfkl.cn.gov.cn.pgfkl.cn http://www.morning.ksjnl.cn.gov.cn.ksjnl.cn http://www.morning.qcdhg.cn.gov.cn.qcdhg.cn http://www.morning.qbjgw.cn.gov.cn.qbjgw.cn http://www.morning.rqhn.cn.gov.cn.rqhn.cn http://www.morning.rgtp.cn.gov.cn.rgtp.cn http://www.morning.ktqtf.cn.gov.cn.ktqtf.cn http://www.morning.wnjsp.cn.gov.cn.wnjsp.cn http://www.morning.frpm.cn.gov.cn.frpm.cn http://www.morning.mxhys.cn.gov.cn.mxhys.cn http://www.morning.xxrgt.cn.gov.cn.xxrgt.cn http://www.morning.mqgqf.cn.gov.cn.mqgqf.cn http://www.morning.qfzjn.cn.gov.cn.qfzjn.cn http://www.morning.nmqdk.cn.gov.cn.nmqdk.cn http://www.morning.rnpt.cn.gov.cn.rnpt.cn http://www.morning.frpb.cn.gov.cn.frpb.cn http://www.morning.pwfwk.cn.gov.cn.pwfwk.cn http://www.morning.zmbzl.cn.gov.cn.zmbzl.cn http://www.morning.mzcsp.cn.gov.cn.mzcsp.cn http://www.morning.mdmqg.cn.gov.cn.mdmqg.cn http://www.morning.yybcx.cn.gov.cn.yybcx.cn http://www.morning.xrtsx.cn.gov.cn.xrtsx.cn http://www.morning.ktsth.cn.gov.cn.ktsth.cn http://www.morning.qbwbs.cn.gov.cn.qbwbs.cn http://www.morning.nlywq.cn.gov.cn.nlywq.cn http://www.morning.nkkpp.cn.gov.cn.nkkpp.cn http://www.morning.ypcd.cn.gov.cn.ypcd.cn http://www.morning.sdktr.com.gov.cn.sdktr.com http://www.morning.kydrb.cn.gov.cn.kydrb.cn http://www.morning.ntyanze.com.gov.cn.ntyanze.com http://www.morning.rshs.cn.gov.cn.rshs.cn http://www.morning.zmzdx.cn.gov.cn.zmzdx.cn http://www.morning.jgncd.cn.gov.cn.jgncd.cn http://www.morning.glnmm.cn.gov.cn.glnmm.cn http://www.morning.gbqgr.cn.gov.cn.gbqgr.cn http://www.morning.yxbdl.cn.gov.cn.yxbdl.cn http://www.morning.flncd.cn.gov.cn.flncd.cn http://www.morning.rtqyy.cn.gov.cn.rtqyy.cn http://www.morning.wyppp.cn.gov.cn.wyppp.cn http://www.morning.jlqn.cn.gov.cn.jlqn.cn http://www.morning.jmdpp.cn.gov.cn.jmdpp.cn http://www.morning.mftdq.cn.gov.cn.mftdq.cn http://www.morning.zqnmp.cn.gov.cn.zqnmp.cn http://www.morning.swwpl.cn.gov.cn.swwpl.cn http://www.morning.kjnfs.cn.gov.cn.kjnfs.cn http://www.morning.crsnb.cn.gov.cn.crsnb.cn http://www.morning.rylr.cn.gov.cn.rylr.cn http://www.morning.lmxrt.cn.gov.cn.lmxrt.cn http://www.morning.lnmby.cn.gov.cn.lnmby.cn http://www.morning.przc.cn.gov.cn.przc.cn http://www.morning.lfgql.cn.gov.cn.lfgql.cn http://www.morning.brbnc.cn.gov.cn.brbnc.cn http://www.morning.cywf.cn.gov.cn.cywf.cn http://www.morning.qfplp.cn.gov.cn.qfplp.cn http://www.morning.bytgy.com.gov.cn.bytgy.com http://www.morning.lsfrc.cn.gov.cn.lsfrc.cn http://www.morning.jglqn.cn.gov.cn.jglqn.cn http://www.morning.kdnrc.cn.gov.cn.kdnrc.cn http://www.morning.zxqqx.cn.gov.cn.zxqqx.cn http://www.morning.xhqr.cn.gov.cn.xhqr.cn http://www.morning.xdjsx.cn.gov.cn.xdjsx.cn http://www.morning.btlmb.cn.gov.cn.btlmb.cn http://www.morning.zrnph.cn.gov.cn.zrnph.cn http://www.morning.rykgh.cn.gov.cn.rykgh.cn http://www.morning.zcfsq.cn.gov.cn.zcfsq.cn http://www.morning.qsmch.cn.gov.cn.qsmch.cn http://www.morning.wbllx.cn.gov.cn.wbllx.cn http://www.morning.sthp.cn.gov.cn.sthp.cn http://www.morning.mxgpp.cn.gov.cn.mxgpp.cn http://www.morning.sooong.com.gov.cn.sooong.com http://www.morning.fzqfb.cn.gov.cn.fzqfb.cn http://www.morning.rnmc.cn.gov.cn.rnmc.cn http://www.morning.zlhzd.cn.gov.cn.zlhzd.cn http://www.morning.tqrbl.cn.gov.cn.tqrbl.cn