ibcadmin 发表于 2019-8-13 18:05:35

winfrom 集成krpano 项目 添加折线

<p>C#.NET WinFrom开发之嵌入Google浏览器 (CefSharp) </p>
<p> </p>
<p><div align="center"></div></p>
<p> </p>
<p><div align="center"></div></p>
<p> </p>
<p>引入静态页面</p>
<p> CefWebBrowser = new ChromiumWebBrowser("http://" + Register.Host + ":" + Register.Port + "/Template/html/index.html");//浏览网址</p>
<p>效果图</p>
<p><div align="center"></div></p>
<p> </p>
<p> 全景绘制折线</p>
<p><div align="center"></div></p>
<p> var pointname = "";<br />            $("#" + pano).unbind("mousedown").bind("mousedown", function (event) {<br />                var parameter = XyYyKrp.Line.getHV();<br />                if (xmlData.Linename == "") {<br />                  xmlData.Linename = krpano.get("xml.scene") + "_" + XyYyKrp.Line.Hotspot_Code();<br />                  krpano.call("do_add_polyline('" + xmlData.Linename + "','dbxzxhotspot','折线'," + parameter.at_h + "," + parameter.at_v + ");");<br />                  pointname = krpano.get("hotspot[" + xmlData.Linename + "].point.name");</p>
<p>                  $("#" + pano).unbind("mousemove").bind("mousemove", function (e) {<br />                        parameter = XyYyKrp.Line.getHV();<br />                        krpano.call("do_removepoint('" + xmlData.Linename + "','" + pointname + "');");<br />                        krpano.call("do_add_polylinepoint('" + xmlData.Linename + "'," + parameter.at_h + "," + parameter.at_v + ");");<br />                        e.stopPropagation();<br />                  });</p>
<p>                } else {<br />                  krpano.call("do_add_polylinepoint('" + xmlData.Linename + "'," + parameter.at_h + "," + parameter.at_v + ");");<br />                  var tem = krpano.get("hotspot[" + xmlData.Linename + "].point.count");<br />                  pointname = krpano.get("hotspot[" + xmlData.Linename + "].point[" + (tem-1) + "].name");<br />                }</p>
<p><br />                event.stopPropagation();<br />            });</p>
<p> </p>
<p><krpano></p>
<p><br /><!--添加热门--><br /><action name="do_add_polyline" ><br />    set(schp_name,%1);<br />    addhotspot(get(schp_name));<br />    hotspot.loadstyle(%2);<br />    set(hotspot.hotspottitle,%3);<br />    set(hotspot.alpha,"0.5");<br />    set(hotspot.autoalpha,"false");<br />    <!--set(hotspot.fillcolor,"0xFFB6C1");--><br />    <!--set(hotspot.fillcolorhover,"0xDC143C");--><br />    <!--set(hotspot.fillalpha,"1");--><br />    set(hotspot.visible,"true");<br />    set(hotspot.hotspotstype,'polyline');<br />    set(hotspot.fillalphahover,"0.1");<br />    set(hotspot.borderwidth,"5");<br />    set(hotspot.borderwidthhover,"4.0");<br />    set(hotspot.bordercolor,"0x008000");<br />    set(hotspot.bdcolor,"0x008000");<br />    set(hotspot.bordercolorhover,"0x223322");<br />    set(hotspot.borderalpha,"0.5");<br />    set(hotspot.polyline,"true");<br />    set(hotspot.borderalphahover,"0.8");<br />    set(hotspot.point.ath,%4);<br />    set(hotspot.point.atv,%5);<br />    set(hotspot.onclick,"do_onclick_polyline();");<br />    set(hotspot.remark,"");<br />    hotspot[get(schp_name).updatepos();<br /></action></p>
<p><!--添加点位坐标--><br /><action name="do_add_polylinepoint" ><br />    set(index,get(hotspot[%1].point.count));<br />    <!--js(homeClass.saveSceneblend(get(index),'000'));--><br />    set(hotspot[%1].point.ath,%2);<br />    set(hotspot[%1].point.atv,%3);<br />    hotspot[%1].updatepos();<br /></action></p>
<p><!--移出点--><br /><action name="do_removepoint"><br />    if(%1!='' AND hotspot[%1].point !=null,<br />    set(count,calc(hotspot[%1].point.count-1));</p>
<p>    if(hotspot[%1].point.name !=%2,<br />       hotspot[%1].point.removearrayitem(get(count));<br />    <!--js(homeClass.saveSceneblend(get(hotspot[%1].point.name),'000'));--><br />    );</p>
<p>    hotspot[%1].updatepos();<br />    <!--hotspot[%1].point.removearrayitem(get(count));<br />    if(count LE 0,removehotspot(%1););<br />    hotspot[%1].updatepos();--><br />    );<br /></action><br /><br /></p>
<p><!--选中多线--><br /><action name="do_onclick_polyline"><br />    jsget(modify,"xmlData.modify");<br />    <!--js(homeClass.saveSceneblend(get(modify),'000'));--><br />    if(modify=='normal',<br />    for(set(i,0), i LT hotspot.count, inc(i),<br />    if(hotspot.visible==true AND hotspot.hotspotstype=='polyline',<br />    set(hotspot.bordercolor,get(hotspot.bdcolor)); );<br />    );<br />    js(XyYyKrp.Line.Xml_clickselected(get(name)));<br />    set(hotspot.bordercolor,"0x9370DB");<br />    );<br /></action></p>
<p><br /><layer name="polyline_container" keep="true" type="container" width="400" height.normal="410" height.mobile="180" align="center"bgcolor="0xFFFFFF"<br />   bgalpha="0.9" bgborder="get:skin_settings.design_bgborder" bgroundedge="get:skin_settings.design_bgroundedge"<br />   bgshadow="get:skin_settings.design_bgshadow" bgcapture="true" x="0" y="0"ondown="draglayer();"css="background: #fff;" visible="false"><br />    <layer name="polyline_title" style="h3" html="折线编辑" align="lefttop" x="0" y="0" width="100%" background="false" enabled="false"   /><br />    <layer name="polyline_container_close" style="btn_close"align="lefttop" x="360" y="15" width="16" height="16" background="false" enabled="true" alpha="0.75"<br />      onhover="tween(alpha,1.0);"onout="tween(alpha,0.75);" onclick="do_cancel('polyline_container','XyYyKrp.Line.Xml_Cancel','false');"/></p>
<p>    <layer name="polyline_scroller_container" type="container" align="lefttop" y="40" width="100%" height="-80" bgborder="1 0x00ACED 0.8" ><br />      <!--<layer name="textlink_logo_scroller" style="scrollarea" direction="v" width="100%" height="100" align="top" y="0"zorder="1"onloaded="setcenter(0,0);"/>--></p>
<p>      <layer name="edit_polyline_name" style="wordstext" html="名称" align="lefttop" y="11" x="25" background="false" enabled="false" zorder="0"/><br />      <layer name="edit_polyline_name_val" style="texttitle"align="lefttop" y="8" x="65" background="false"onloaded="delayedcall(0,add_textbox('', 230, 30,'edit_polyline_name_val','polyline_name'));" value="" zorder="0" /><br />      <plugin name="LineSwitchButton" devices="html5" keep="true"url="%SWFPATH%/plugins/switchbutton.js" x="300" y="10"width="43" height="23" value="true" onloaded="copy(lineswitchbutton, plugin);" zorder="0" /></p>
<p>      <layer name="edit_polyline_width"style="wordstext" html="线宽"   align="lefttop" x="25" y="50" background="false" enabled="false" zorder="0" /><br />      <!--<plugin name="SliderLineWidth" devices="html5" keep="true"url="%SWFPATH%/plugins/slider.js" align="lefttop" x="65" y="45" onloaded="copy(sliderlinewidth, plugin);" zorder="0" />--><br />      <layername="polyline_lwidth" style="texttitle" align="lefttop"x="65"y="50" onloaded="delayedcall(0,add_textbox('', 150, 30,'polyline_lwidth','polylinelwidth'));" value="" /><br />      <br />      <layer name="edit_polyline_lincolor"style="wordstext" html="线颜色"   align="lefttop" x="240" y="50" background="false" enabled="false" zorder="0" /><br />      <br />      <layer name="edit_polyline_linclview"type="container" align="lefttop" width="30" height="25" bgalpha="1.0" x="305"   y="50" background="true"bgcolor="0x008000"enabled="true"   value="0x008000" zorder="3" ><br />      <layer name="edit_polyline_lincliamge" type="iamge" parent="edit_polyline_linclview" url="%SWFPATH%/plugins/tool/current_color.png" align="lefttop" width="30" height="25" onclick="do_linecliamge();" ></layer><br />      </layer></p>
<p>      <layer name="edit_polyline_lin_cy"style="wordstext" html="线透明度"   align="lefttop" x="2" y="90" background="false" enabled="false" zorder="0" /><br />      <!--<plugin name="PLSliderLinecy" devices="html5" keep="true"url="%SWFPATH%/plugins/slider.js"onloaded="copy(plsliderlinecy, plugin);" zorder="0" />--><br />      <br />      <layername="polyline_lcy" style="texttitle" align="lefttop"x="65"y="90" onloaded="delayedcall(0,add_textbox('', 150, 30,'polyline_lcy','polylinelcy'));" value="" /><br />      <br />      <layer name="edit_polyline_remark" style="wordstext" html="备注" align="lefttop" y="135" x="25" background="false" enabled="false"zorder="0" /><br />      <layer name="edit_polyline_remark_val" style="texttitle"align="lefttop" y="135" x="65" background="false"onloaded="delayedcall(0,add_textarea('', 280, 150,'edit_polyline_remark_val','polyline_remark'));" value=""zorder="0" /><br />      <br />      <br />    </layer><br />    <layer name="polyline_apply" parent="polyline_container" style="label-primary"html="应 用" align="lefttop"x="105" y="372" onclick="do_polyline_apply('false');" /><br />    <layer name="polyline_ok" parent="polyline_container" style="label-success"html="确 定" align="lefttop"x="170" y="372" onclick="do_polyline_ok();" /><br />    <layer name="polyline_cancel" parent="polyline_container" style="label-info"html="取 消" align="lefttop"x="235" y="372" enabled="true"onclick="do_cancel('polyline_container','XyYyKrp.Line.Xml_Cancel','false');" /><br /></layer></p>
<p><br /><action name="do_loadpolylineslider" ><br />    <!--sliderlinewidth.initial_plugin('polylinewidth',150,'polyline_scroller_container',65,45);<br />    plsliderlinecy.initial_plugin('plsliderlinecy',150,'polyline_scroller_container',65,75);--><br /></action></p>
<p><br /><!--确定--><br /><action name="do_polyline_ok" ><br />    do_polyline_apply('true');<br /></action></p>
<p><br /><!--线填充颜色--><br /><action name="do_linecliamge"><br />    copy(cl,layer.value);<br />    colorpick_initial('edit_polyline_linclview',10,10,'edit_polyline_linclview',get(cl));<br /></action></p>
<p><!--开启编辑--><br /><action name="do_edit_polyline"><br />    if(%1!='' AND hotspot[%1] !=null,</p>
<p><br />    set(layer.visible,"true");<br />    set(layer.keep,"true");</p>
<p>    set(layer.value,%1);<br />    copy(hst,hotspot[%1]);<br />    set(layer.value,get(hst.hotspottitle));<br />    jscall(calc('document.getElementById("polyline_name").value="'+hst.hotspottitle+'"'));</p>
<p>    <!--slider_setvalue(polylinewidth,get(hst.borderwidth));--></p>
<p>    jscall(calc('document.getElementById("polylinelwidth").value="'+hst.borderwidth+'"'));</p>
<p>    set(layer.bgcolor,get(hst.bdcolor));<br />    set(color,get(hst.bdcolor));<br />    tohex(color,'0x',6);<br />    set(layer.value, get(color));</p>
<p>    jscall(calc('document.getElementById("polylinelcy").value="'+hst.borderalpha+'"'));<br />    set(layer.value,get(hst.remark));<br />    jscall(calc('document.getElementById("polyline_remark").value="'+hst.remark+'"'));<br />    <!--js(homeClass.saveSceneblend(get(layer.value),'000'));--><br />    );<br /></action></p>
<p> </p>
<p><!--应用--><br /><action name="do_polyline_apply"><br />    copy(ply,layer.value);<br />    if(get(ply)!=nullAND get(ply)!='',<br />    copy(hst,hotspot);<br />    <!--set(hst.hotspottitle,get(layer.value));--></p>
<p>    jsget(plname,"document.getElementById('polyline_name').value");<br />    set(hst.hotspottitle,get(plname));</p>
<p>    <!--slider_getvalue(polylinewidth,vl);--><br />    jsget(vl,"document.getElementById('polylinelwidth').value");<br />    set(hst.borderwidth,get(vl));<br />    set(hst.bdcolor, get(layer.value));<br />    set(hst.bordercolor, get(layer.value));</p>
<p>    jsget(dst,"document.getElementById('polylinelcy').value");<br />    set(hst.borderalpha,get(dst));<br />    set(hst.remark,get(layer.value));<br />    );</p>
<p><br />    if(%1=='true',<br />    set(hst.bordercolor,get(hst.bdcolor));<br />    set(layer.visible,"false");<br />    js(XyYyKrp.Line.Xml_PolylineSave(get(ply)));<br />    );</p>
<p><br />    <!--set(hst.bdcolor,get(layer.value));--></p>
<p></action></p>
<p><br /><!--删除多边形--><br /><action name="do_delete_polyline"><br />    if(%1!='' AND hotspot[%1] !=null,<br />    removehotspot(%1);<br />    );<br /></action><br /><br /></krpano></p>
<p> </p><br>来源:<a href="https://www.cnblogs.com/hucoke/p/11322450.html" target="_blank">https://www.cnblogs.com/hucoke/p/11322450.html</a><br>免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!

wwvv123 发表于 2019-8-27 20:41:12

顶顶顶顶顶顶顶顶
页: [1]
查看完整版本: winfrom 集成krpano 项目 添加折线