This commit is contained in:
Bob 2019-12-11 10:09:14 +08:00
parent c28153cb3d
commit 025d2ec90b
5 changed files with 253 additions and 115 deletions

View File

@ -4,6 +4,9 @@
<list default="true" id="9cbc7ee8-e518-44ca-870c-9743cf0f1b98" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/dashboard/static/dashboard/js/index.js" beforeDir="false" afterPath="$PROJECT_DIR$/dashboard/static/dashboard/js/index.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/dashboard/templates/dashboard/index.html" beforeDir="false" afterPath="$PROJECT_DIR$/dashboard/templates/dashboard/index.html" afterDir="false" />
<change beforePath="$PROJECT_DIR$/dashboard/urls.py" beforeDir="false" afterPath="$PROJECT_DIR$/dashboard/urls.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/dashboard/views.py" beforeDir="false" afterPath="$PROJECT_DIR$/dashboard/views.py" afterDir="false" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="SHOW_DIALOG" value="false" />
@ -71,22 +74,11 @@
<component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/dashboard/static/dashboard/js/vector.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="3630">
<caret line="165" column="27" selection-start-line="165" selection-start-column="27" selection-end-line="165" selection-end-column="27" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/dashboard/static/dashboard/js/index.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="185">
<caret line="304" column="39" selection-start-line="304" selection-start-column="39" selection-end-line="304" selection-end-column="39" />
<state relative-caret-position="348">
<caret line="384" column="53" selection-start-line="384" selection-start-column="53" selection-end-line="384" selection-end-column="53" />
<folding>
<element signature="n#style#0;n#a#0;n#div#0;n#!!top" expanded="true" />
<element signature="n#style#0;n#a#1;n#div#0;n#!!top" expanded="true" />
<element signature="n#style#0;n#div#0;n#!!top" expanded="true" />
</folding>
</state>
@ -97,7 +89,7 @@
<entry file="file://$PROJECT_DIR$/import_points.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="110">
<caret line="11" lean-forward="true" selection-start-line="11" selection-end-line="11" />
<caret line="11" selection-start-line="11" selection-end-line="11" />
</state>
</provider>
</entry>
@ -105,8 +97,38 @@
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/dashboard/templates/dashboard/index.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="4708">
<caret line="214" column="77" selection-start-line="214" selection-start-column="77" selection-end-line="214" selection-end-column="77" />
<state relative-caret-position="-989">
<caret line="248" column="86" selection-start-line="248" selection-start-column="86" selection-end-line="248" selection-end-column="86" />
<folding>
<element signature="e#11579#11599#0#HTML" expanded="true" />
<element signature="e#11742#11777#0#HTML" expanded="true" />
<element signature="e#11890#11911#0#HTML" expanded="true" />
<element signature="e#14256#14292#0#HTML" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/dashboard/urls.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="154">
<caret line="7" column="88" selection-start-line="7" selection-start-column="88" selection-end-line="7" selection-end-column="88" />
<folding>
<element signature="e#0#19#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/dashboard/views.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="411">
<caret line="33" lean-forward="true" selection-start-line="33" selection-end-line="33" />
<folding>
<element signature="e#0#30#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
@ -141,6 +163,8 @@
<find>favicon</find>
<find>new WebSocket</find>
<find>-1</find>
<find>historical_route_submit</find>
<find>connect_websocket();</find>
</findStrings>
<dirStrings>
<dir>D:\python\p3\linbei</dir>
@ -180,12 +204,12 @@
<option value="$PROJECT_DIR$/dashboard/static/dashboard/css/popup.css" />
<option value="$PROJECT_DIR$/dashboard/static/dashboard/js/popup.js" />
<option value="$PROJECT_DIR$/dashboard/templates/dashboard/results_by_keywords.html" />
<option value="$PROJECT_DIR$/dashboard/urls.py" />
<option value="$PROJECT_DIR$/dashboard/views.py" />
<option value="$PROJECT_DIR$/dashboard/templates/dashboard/vector.html" />
<option value="$PROJECT_DIR$/dashboard/templates/dashboard/index.html" />
<option value="$PROJECT_DIR$/dashboard/static/dashboard/js/vector.js" />
<option value="$PROJECT_DIR$/dashboard/static/dashboard/js/index.js" />
<option value="$PROJECT_DIR$/dashboard/templates/dashboard/index.html" />
<option value="$PROJECT_DIR$/dashboard/urls.py" />
<option value="$PROJECT_DIR$/dashboard/views.py" />
</list>
</option>
</component>
@ -207,7 +231,6 @@
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="Scope" />
<pane id="ProjectPane">
<subPane>
<expand>
@ -215,10 +238,16 @@
<item name="linbei" type="b2602c69:ProjectViewProjectNode" />
<item name="linbei" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="linbei" type="b2602c69:ProjectViewProjectNode" />
<item name="linbei" type="462c0819:PsiDirectoryNode" />
<item name="dashboard" type="462c0819:PsiDirectoryNode" />
</path>
</expand>
<select />
</subPane>
</pane>
<pane id="Scope" />
</panes>
</component>
<component name="PropertiesComponent">
@ -228,7 +257,7 @@
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="database.console.LAST_STATE" value="false" />
<property name="editor.config.ad.shown" value="true" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/../linbeitest" />
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
<property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
<property name="nodejs_npm_path_reset_for_default_project" value="true" />
<property name="nodejs_package_manager_path" value="npm" />
@ -368,7 +397,8 @@
<workItem from="1575616042709" duration="903000" />
<workItem from="1575622080443" duration="636000" />
<workItem from="1575851747431" duration="2002000" />
<workItem from="1575862650399" duration="1899000" />
<workItem from="1575862650399" duration="3867000" />
<workItem from="1576027710663" duration="2218000" />
</task>
<task id="LOCAL-00001" summary="#creat">
<created>1567674653918</created>
@ -622,17 +652,24 @@
<option name="project" value="LOCAL" />
<updated>1575853736986</updated>
</task>
<option name="localTasksCounter" value="37" />
<task id="LOCAL-00037" summary="#index">
<created>1575875458769</created>
<option name="number" value="00037" />
<option name="presentableId" value="LOCAL-00037" />
<option name="project" value="LOCAL" />
<updated>1575875458769</updated>
</task>
<option name="localTasksCounter" value="38" />
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="255190000" />
<option name="totallyTimeSpent" value="259376000" />
</component>
<component name="ToolWindowManager">
<frame x="-8" y="-8" width="1936" height="1056" extended-state="6" />
<editor active="true" />
<layout>
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.2630458" />
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.2657082" />
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
<window_info id="Favorites" order="2" side_tool="true" />
<window_info anchor="bottom" id="Message" order="0" />
@ -880,26 +917,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/dashboard/views.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="66">
<caret line="10" column="4" selection-start-line="10" selection-start-column="4" selection-end-line="10" selection-end-column="4" />
<folding>
<element signature="e#0#30#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/dashboard/urls.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="66">
<caret line="4" column="10" selection-start-line="4" selection-start-column="10" selection-end-line="4" selection-end-column="10" />
<folding>
<element signature="e#0#19#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/dashboard/templates/dashboard/results_by_keywords.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="484">
@ -943,38 +960,62 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/dashboard/static/dashboard/js/vector.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="3630">
<caret line="165" column="27" selection-start-line="165" selection-start-column="27" selection-end-line="165" selection-end-column="27" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/dashboard/templates/dashboard/index.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="4708">
<caret line="214" column="77" selection-start-line="214" selection-start-column="77" selection-end-line="214" selection-end-column="77" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/import_points.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="110">
<caret line="11" lean-forward="true" selection-start-line="11" selection-end-line="11" />
<caret line="11" selection-start-line="11" selection-end-line="11" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/dashboard/static/dashboard/js/vector.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="242">
<caret line="113" column="21" selection-start-line="113" selection-start-column="17" selection-end-line="113" selection-end-column="21" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/dashboard/static/dashboard/js/index.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="185">
<caret line="304" column="39" selection-start-line="304" selection-start-column="39" selection-end-line="304" selection-end-column="39" />
<state relative-caret-position="348">
<caret line="384" column="53" selection-start-line="384" selection-start-column="53" selection-end-line="384" selection-end-column="53" />
<folding>
<element signature="n#style#0;n#a#0;n#div#0;n#!!top" expanded="true" />
<element signature="n#style#0;n#a#1;n#div#0;n#!!top" expanded="true" />
<element signature="n#style#0;n#div#0;n#!!top" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/dashboard/templates/dashboard/index.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-989">
<caret line="248" column="86" selection-start-line="248" selection-start-column="86" selection-end-line="248" selection-end-column="86" />
<folding>
<element signature="e#11579#11599#0#HTML" expanded="true" />
<element signature="e#11742#11777#0#HTML" expanded="true" />
<element signature="e#11890#11911#0#HTML" expanded="true" />
<element signature="e#14256#14292#0#HTML" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/dashboard/urls.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="154">
<caret line="7" column="88" selection-start-line="7" selection-start-column="88" selection-end-line="7" selection-end-column="88" />
<folding>
<element signature="e#0#19#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/dashboard/views.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="411">
<caret line="33" lean-forward="true" selection-start-line="33" selection-end-line="33" />
<folding>
<element signature="e#0#30#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</component>
</project>

View File

@ -4,15 +4,7 @@ $(function () {
var map = new ol.Map({
loadTilesWhileAnimating: true,
target: 'map',
layers: [
new ol.layer.Tile({
title: "天地图路网",
source: new ol.source.XYZ({
url: 'http://t0.tianditu.com/DataServer?T=img_w&X={x}&Y={y}&L={z}&tk=661147eab2db2ca4e3596de18a46929f'//Roadmap SATELLITE satellite
}),
}),
],
layers: [],
view: new ol.View({
projection: projection,
center: ol.proj.transform([107.55375, 34.91028], 'EPSG:4326', 'EPSG:3857'),
@ -23,6 +15,18 @@ $(function () {
});
var tianditu = new ol.layer.Tile({
title: "天地图路网",
source: new ol.source.XYZ({
url: 'http://t0.tianditu.com/DataServer?T=img_w&X={x}&Y={y}&L={z}&tk=661147eab2db2ca4e3596de18a46929f'//Roadmap SATELLITE satellite
}),
});
map.addLayer(tianditu);
var OSM = new ol.layer.Tile({
source: new ol.source.OSM()
});
//--------------------------------------------------------
//===================================页面加载完毕默认打开websocket======================================
@ -73,6 +77,83 @@ $(function () {
// });
var road = new ol.layer.Vector({
source: new ol.source.Vector({
projection: 'EPSG:4326',
url: '/static/dashboard/json/road.json',
format: new ol.format.GeoJSON()
}),
maxZoom: 20,
style: new ol.style.Style({
stroke: new ol.style.Stroke({
color: 'rgb(137,132,132,255)'
}),
fill: new ol.style.Fill({
color: 'rgb(137,132,132,255)'
})
})
});
// map.addLayer(road);
var grass = new ol.layer.Vector({
source: new ol.source.Vector({
projection: 'EPSG:4326',
url: '/static/dashboard/json/grass.json',
format: new ol.format.GeoJSON()
}),
maxZoom: 20,
style: new ol.style.Style({
stroke: new ol.style.Stroke({
color: 'rgb(51,160,44,255)'
}),
fill: new ol.style.Fill({
color: 'rgb(51,160,44,255)'
})
})
});
// map.addLayer(grass);
var build = new ol.layer.Vector({
source: new ol.source.Vector({
projection: 'EPSG:4326',
url: '/static/dashboard/json/build.json',
format: new ol.format.GeoJSON()
}),
maxZoom: 20,
style: new ol.style.Style({
stroke: new ol.style.Stroke({
color: 'rgb(173,164,164,255)'
}),
fill: new ol.style.Fill({
color: 'rgb(173,164,164,255)'
})
})
});
// map.addLayer(build);
var pipe = new ol.layer.Vector({
source: new ol.source.Vector({
projection: 'EPSG:4326',
url: '/static/dashboard/json/pipe.json',
format: new ol.format.GeoJSON()
}),
maxZoom: 20,
style: new ol.style.Style({
stroke: new ol.style.Stroke({
color: 'rgb(250,249,246,255)'
}),
fill: new ol.style.Fill({
color: 'rgb(250,249,246,255)'
})
})
});
// map.addLayer(pipe);
var GeoJsonLayer = new ol.layer.Vector({
source: new ol.source.Vector({
projection: projection,
@ -134,7 +215,7 @@ $(function () {
var socket;
var viewport = map.getViewport();
$(viewport).append('<div class="share" ><button id="coordinate_measurement_btn">坐标测量</button><button id="realtime_positioning_btn">实时定位</button><button id="historical_route_btn">历史轨迹</button><button id="zone_setting_btn">区域设置</button><a href="vector/mode/" style="color: black"><button>矢量</button></a><a href="/" style="color: black"><button>影像</button></a><button id="c">厂区</button><button id="m">煤场</button></div>');
$(viewport).append('<div class="share" ><button id="coordinate_measurement_btn">坐标测量</button><button id="realtime_positioning_btn">实时定位</button><button id="historical_route_btn">历史轨迹</button><button id="zone_setting_btn">区域设置</button><button id="vector">矢量</button><button id="image">影像</button><button id="c">厂区</button><button id="m">煤场</button></div>');
// $(viewport).append('<div class="scoket"><button id="connect_websocket">连接WebSocket</button><button id="close_websocket">关闭WebSocket</button></div>');
@ -148,6 +229,36 @@ $(function () {
map.removeInteraction(draw);
var view = map.getView();
view.setCenter(ol.proj.transform([107.55375, 34.91028], 'EPSG:4326', 'EPSG:3857'));
});
$("#vector").click(function () {
map.removeInteraction(draw);
map.removeLayer(tianditu);
map.removeLayer(w35Layer);
map.removeLayer(w3132Layer);
map.removeLayer(GeoJsonLayer);
map.addLayer(OSM);
map.addLayer(road);
map.addLayer(grass);
map.addLayer(build);
map.addLayer(pipe);
map.addLayer(GeoJsonLayer);
});
$("#image").click(function () {
map.removeInteraction(draw);
map.removeLayer(OSM);
map.removeLayer(road);
map.removeLayer(grass);
map.removeLayer(build);
map.removeLayer(pipe);
map.removeLayer(GeoJsonLayer);
map.addLayer(tianditu);
map.addLayer(w35Layer);
map.addLayer(w3132Layer);
map.addLayer(GeoJsonLayer);
});
var box_closer = document.getElementById('box-closer');
box_closer.onclick = function () {
@ -180,6 +291,7 @@ $(function () {
});
$("#people_btn").click(function () {
connect_websocket();
map.removeInteraction(draw);
$("#box").show();
$("#realtime_positioning").show();
@ -212,8 +324,8 @@ $(function () {
for (var i = 0; i < array.length; i++) {
// console.log(array[i].ID)
var x = array[i].y;
var y = array[i].x * -1.0;
var x = array[i].x;
var y = array[i].y;
lon = (x * Math.cos(38 * Math.PI / 180) + y * Math.sin(38 * Math.PI / 180)) / 91026.63 + 107.553186752;
lat = (y * Math.cos(38 * Math.PI / 180) - x * Math.sin(38 * Math.PI / 180)) / 111000 + 34.9092271939;
// console.log(lon, lat);
@ -271,10 +383,7 @@ $(function () {
});
$("#historical_route_submit").click(function () {
// socket = new WebSocket("ws://210.77.68.214:50332");
// socket.onopen = function () {
// console.log('WebSocket open');//成功连接上Websocket
// };
connect_websocket();
map.removeInteraction(draw);
var peoinfo = $("#peoinfo").val();
var peopleid = $("#peopleid").val();
@ -302,7 +411,7 @@ $(function () {
for (var i = 0; i < array.length; i++) {
// console.log(array[i])
var y = array[i].y;
var x = array[i].x ;
var x = array[i].x;
var lon = (x * Math.cos(38 * Math.PI / 180) + y * Math.sin(38 * Math.PI / 180)) / 91026.63 + 107.553186752;
var lat = (y * Math.cos(38 * Math.PI / 180) - x * Math.sin(38 * Math.PI / 180)) / 111000 + 34.9092271939;
@ -371,28 +480,21 @@ $(function () {
//-------------------------------------------------webscoket-------------------------------------------------------
$('.connect_websocket').click(function () {
console.log("6666");
var str;
var ws = $(".wsurl").val();
console.log(ws.length);
if (ws.length != 0) {
str = ws
} else {
str = "ws://111.21.80.34:9004"
}
function connect_websocket() {
console.log("6666");
var str = "ws://111.21.80.34:9004";
// if (window.s) {
// window.s.close()
// }
/*创建socket连接*/
socket = new WebSocket(str);
// if (window.s) {
// window.s.close()
// }
/*创建socket连接*/
socket = new WebSocket(str);
socket.onopen = function () {
console.log('WebSocket open');//成功连接上Websocket
};
});
socket.onopen = function () {
console.log('WebSocket open');//成功连接上Websocket
};
}
$('#close_websocket').click(function () {

View File

@ -124,10 +124,10 @@
{# <option value="人员查询">人员查询</option>#}
{# <option value="位置查询">位置查询</option>#}
{# </select>#}
ws<input type="text" name="ws" class="wsurl" id="ws"><br>
<button class="btn btn-primary btn-sm connect_websocket" type="button" id="">连接websocekt
</button>
<button class="btn btn-primary btn-sm" type="button" id="people_btn">人员查询</button>
{# ws<input type="text" name="ws" class="wsurl" id="ws"><br>#}
{# <button class="btn btn-primary btn-sm connect_websocket" type="button" id="">连接服务器#}
{# </button>#}
<button class="btn btn-primary btn-sm" type="button" id="people_btn">连接服务器</button>
<button class="btn btn-primary btn-sm" type="button" id="site_btn">位置查询</button>
</div>
@ -207,13 +207,13 @@
<div id="history_query">
<input type="text" style="width:230px;" id="peoinfo"
placeholder="人员编号例如0001"/><br>
<input type="text" style="width:230px;" id="peopleid"
<input type="text" style="width:230px;margin-top: 5px" id="peopleid"
placeholder="id:例如8001"/><br>
<input type="text" style="width:230px; " id="time"
<input type="text" style="width:230px;margin-top: 5px " id="time"
placeholder="时间(分钟)例如3"/><br>
<button type="button" class="btn btn-primary btn-sm connect_websocket"
style="margin-top: 20px;">连接websocket
</button>
{# <button type="button" class="btn btn-primary btn-sm connect_websocket"#}
{# style="margin-top: 20px;">连接websocket#}
{# </button>#}
<button type="button" class="btn btn-primary btn-sm"
style="margin-top: 20px;" id="historical_route_submit">查询
</button>
@ -246,7 +246,7 @@
<div id="" style="margin-top: 10px">
<input type="text" style="width:230px;" id="peoinfo"
placeholder="对象名称"/><br>
<input type="text" style="width:230px; " id="time"
<input type="text" style="width:230px; margin-top: 5px" id="time"
placeholder="时间范围"/><br>
<button type="button" class="btn btn-primary btn-sm"
style="margin-top: 20px;margin-left: 200px" id="btn">查询

View File

@ -6,7 +6,4 @@ urlpatterns = [
path('2/', views.index_2, name='index_2'),
path('points/search/by/keywords/', views.points_search_by_keywords, name='points-search-by-keywords'),
path('points/search/by/sn/', views.points_search_by_sn, name='points-search-by-sn'),
path('vector/mode/', views.vector_mode, name='vector-mode'),
]

View File

@ -30,8 +30,6 @@ def points_search_by_sn(request):
points = Points.objects.get(sn=sn)
return render(request,'dashboard/index.html',{'points':points})
def vector_mode(request):
return render(request,'dashboard/vector.html')