Files
apt-nl-map/static/Magic4/Sketch/HMI_Sketch_Left_RemovePath_Main.html
2024-12-04 10:21:04 +08:00

195 lines
7.2 KiB
HTML

<!DOCTYPE html>
<html lang="en" id="container" onmousedown="startDrag(event)" onmouseup="stopDrag(event)" onmousemove="dragging(event)" style="overflow-x: hidden;
overflow-y: hidden; ">
<head>
<meta charset="UTF-8">
<!--<script type="text/javascript" src="../roslib.min.js"></script>-->
<script type="text/javascript">
var RemovePath_Sch=0;
var StartNode=0;
var EndNode=0;
//var IP=window.location.host;
/*
var ros = new ROSLIB.Ros({
//url : 'ws://'+IP+':9290'
url : 'ws://localhost:9190'
});
ros.on('connection', function() {
console.log('Connected to websocket server.');
});
ros.on('error', function(error) {
console.log('Error connecting to websocket server: ', error);
});
ros.on('close', function() {
console.log('Connection to websocket server closed.');
});
*/
function SketchLeftRemovePathMainPostMessage(str){
parent.window.postMessage(
str,
"*" //or "www.parentpage.com"
);
}
function RemovePath_Main_Init(){
RemovePath_Sch=0;
StartNode=0;
EndNode=0;
}
function client_request_left_removepath_main(str){
window.parent.parent.postMessage(
{
event_id: 'client_request_left_removepath_main',
data: {
v1: str
}
},
"*" //or "www.parentpage.com"
);
}
/*
function client(str){
var client_LearnString=new ROSLIB.Service({
ros:ros,
name:'/Service_LearnString',
serviceType:'lu_ps20l_msgs/Srv_LearnString'
});
var request = new ROSLIB.ServiceRequest({
Learn_String_Input:str
});
client_LearnString.callService(request,function(result) {
document.getElementById('LeftRemovePathIframe').contentWindow.postMessage(
{
event_id: 'client_response',
data: {
v1: result.result,
v2: result.ROS_String_Output,
v3: result.Rec_Learn_String_Input
}
},
"*" //or "www.parentpage.com"
);
//console.log("AAA");
//console.log(result.result);
//console.log(result.ROS_String_Output);
//console.log("BBB");
});
}*/
function receiveMessage(event){
//console.log(event);
if(event.data.event_id=="client_response_left_removepath_main"){
document.getElementById('LeftRemovePathIframe').contentWindow.postMessage(
event.data
);
return;
}
var frame=event.data.split('#');
var head=frame[0].split(':');
switch(head[0]) {
case 'RemoveSinglePath': {
RemovePath_Sch = 1;
window.open('HMI_Sketch_Left_RemovePath_Sch1_RemoveSinglePath.html', 'LeftRemovePathIframe');
}
break;
case 'RemoveDualPath':{
RemovePath_Sch = 1;
window.open('HMI_Sketch_Left_RemovePath_Sch1_RemoveDualPath.html', 'LeftRemovePathIframe');
}
break;
case 'RemoveAllPath':{
RemovePath_Sch = 1;
window.open('HMI_Sketch_Left_RemovePath_Sch1_RemoveAllPath.html', 'LeftRemovePathIframe');
}
break;
case 'RemovePathSch1_RemoveSinglePath': {
var data = head[1].split(',');
StartNode = parseInt(data[0]);
EndNode = parseInt(data[1]);
var str = "CheckPath:" +
StartNode + ";" +
EndNode + ";"
//client(str);
client_request_left_removepath_main(str);
}
break;
case 'RemovePathSch1_RemoveDualPath':{
var data = head[1].split(',');
StartNode = parseInt(data[0]);
EndNode = parseInt(data[1]);
var str = "CheckDualPath:" +
StartNode + ";" +
EndNode + ";"
//client(str);
client_request_left_removepath_main(str);
}
break;
case 'RemovePathSch1_RemoveSinglePath_CheckPathOK':{
RemovePath_Sch=2;
window.open('HMI_Sketch_Left_RemovePath_Sch2_RemoveSinglePath.html', 'LeftRemovePathIframe');
}
break;
case 'RemovePathSch1_RemoveDualPath_CheckPathOK':{
RemovePath_Sch=2;
window.open('HMI_Sketch_Left_RemovePath_Sch2_RemoveDualPath.html', 'LeftRemovePathIframe');
}
break;
case 'RemovePathSch2_RemoveSinglePath':{
var data=head[1];
if(data=="OK"){
var str="RemoveSinglePath:" +
StartNode + ";" +
EndNode + ";"
//client(str);
client_request_left_removepath_main(str);
}
RemovePath_Main_Init();
SketchLeftRemovePathMainPostMessage("Main");
}
break;
case 'RemovePathSch2_RemoveDualPath':{
var data=head[1];
if(data=="OK"){
var str="RemoveDualPath:" +
StartNode + ";" +
EndNode + ";"
//client(str);
client_request_left_removepath_main(str);
}
RemovePath_Main_Init();
SketchLeftRemovePathMainPostMessage("Main");
}
break;
case 'RemovePathSch1_RemoveAllPath':{
var data=head[1];
if(data=="OK"){
var str="RemoveAllPath:OK#" ;
//client(str);
client_request_left_removepath_main(str);
}
RemovePath_Main_Init();
SketchLeftRemovePathMainPostMessage("Main");
}
break;
}
}
window.addEventListener("message", receiveMessage, false);
</script>
<title>Title</title>
</head>
<body>
RemovePath_Main
<div>
<iframe id="LeftRemovePathIframe" name="LeftRemovePathIframe" width=100% height=560 src="HMI_Sketch_Left_RemovePath_Sch0.html" frameborder="2" scrolling="auto"></iframe>
</div>
</body>
<script src="../js/drag.js"></script>
</html>