Commit f77c7f79 by wanghao

同步代码

parent 159d6d16
......@@ -25,6 +25,7 @@ module.exports = {
Terraformer: "readonly",
AMap: "readonly",
kgUtil: "readonly",
shpUtil: "readonly",
netcdfjs: "readonly",
ol: "readonly",
olcs: "readonly"
......@@ -37,7 +38,7 @@ module.exports = {
"no-use-before-define": "off", // 允许 方法在未定义前使用
"multiline-ternary": "off",
"no-restricted-globals": "off",
"react-hooks/exhaustive-deps": "off", // 检查 effect 的依赖
"react-hooks/exhaustive-deps": "off", // 检查 effect 的依赖
"react-hooks/rules-of-hooks": "error", // 检查 Hook 的规则
// mars3d-react-example项目专用的配置(目的便于示例的开发调试) end
......@@ -49,7 +50,6 @@ module.exports = {
"@typescript-eslint/ban-ts-comment": "off", // ts: 禁止ts注释
"@typescript-eslint/no-unused-vars": "off", // ts:允许定义未引用使用的变量
camelcase: "off", // 强制驼峰命名规则
indent: "off", // 强制一致的缩进风格
eqeqeq: "error", // 是否使用 === 替代 ==
......
......@@ -5,7 +5,8 @@ export let map // mars3d.Map三维地图对象
// 需要覆盖config.json中地图属性参数(当前示例框架中自动处理合并)
export const mapOptions = function (option) {
option.control = {
geocoder: true
// geocoder: true // 用cesium原生
geocoder: "gaode" // 使用高德POI服务
}
return option
}
......
......@@ -77,11 +77,11 @@ export function bindLayerDemo() {
return attr.type + " 我是layer上绑定的Popup" + new Date().toLocaleTimeString()
// return new Promise((resolve) => {
// //这里可以进行后端接口请求数据,setTimeout测试异步
// // 这里可以进行后端接口请求数据,setTimeout测试异步
// setTimeout(() => {
// resolve("Promise异步回调显示的弹窗内容信息");
// }, 2000);
// });
// resolve("Promise异步回调显示的弹窗内容信息")
// }, 2000)
// })
},
{ timeRender: true, closeButton: false } // timeRender实时刷新
)
......
......@@ -11,7 +11,7 @@ export const mapOptions = {
infoBox: false,
vrButton: true,
fullscreenButton: true,
geocoder: true,
geocoder: "gaode",
baseLayerPicker: true,
clockAnimate: true, // 时钟动画控制(左下角)
timeline: true, // 是否显示时间线控件
......
.chartOne,
.chartTwo,
.chartThree {
width: 100%;
height: 300px;
margin-bottom: 20px;
position: relative;
border: 1px solid #17366c;
background: linear-gradient(to left, #3897cf, #3897cf) left top no-repeat, linear-gradient(to bottom, #3897cf, #3897cf) left top no-repeat,
linear-gradient(to left, #3897cf, #3897cf) right top no-repeat, linear-gradient(to bottom, #3897cf, #3897cf) right top no-repeat,
linear-gradient(to left, #3897cf, #3897cf) left bottom no-repeat, linear-gradient(to bottom, #3897cf, #3897cf) left bottom no-repeat,
linear-gradient(to left, #3897cf, #3897cf) right bottom no-repeat, linear-gradient(to left, #3897cf, #3897cf) right bottom no-repeat;
background-size: 1px 20px, 20px 1px, 1px 20px, 20px 1px;
background-color: rgba(0, 0, 0, 0.1);
h6 {
margin-top: 5px;
width: 10px;
height: 5px;
color: white;
line-height: 20px;
}
.chartTwo .chartTwo_ulgnhx,
.chartThree_ulhbtj {
height: 100%;
width: 91%;
float: left;
margin-top: 15px;
font-size: 15px;
}
.chartTwo_ulgnhx,
.chartThree_ulhbtj {
width: 84%;
height: 90%;
position: absolute;
left: 8%;
bottom: 5px;
}
}
.chartOne {
height: 96px;
}
._item_row {
display: flex;
align-items: center;
flex-wrap: wrap;
text-align: left;
}
._item_full_box_width {
width: 100%;
}
.right_title {
font-size: 1.4rem;
font-weight: bold;
color: #febc04;
line-height: 3rem;
background: linear-gradient(180deg, #e5be38 0%, #ff882e 100%);
-webkit-background-clip: text;
white-space: nowrap;
-webkit-text-fill-color: transparent;
font-family: "UnidreamLED", "Helvetica Neue", Helvetica, Arial, sans-serif;
}
.right_sub_title {
font-size: 0.85rem;
color: #d8d8d8;
line-height: 1;
white-space: nowrap;
background: linear-gradient(180deg, #e5be38 0%, #ff882e 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
.row1_right {
margin-left: 0.6rem;
text-align: left;
}
.row1 {
// width: 100px;
align-items: center;
display: flex;
margin-bottom: 1.15rem;
}
.icon {
margin-left: 28px;
}
h6 {
margin-left: 10px;
}
import { MarsPannel } from "@mars/components/MarsUI"
import { MarsButton, MarsIcon, MarsPannel } from "@mars/components/MarsUI"
import { useState } from "react"
import * as echarts from "echarts"
import * as mapWork from "./map.js"
import "./index.less"
function UIComponent() {
let route = [] // 国内机场航线数据
let flight = []
const airData = mapWork.getAirData()
const guonei = airData.guonei
const guoji = airData.guoji
route = airData.route
flight = airData.flight
setTimeout(() => {
initCharts_Two()
initCharts_Three()
}, 300)
function initCharts_Two() {
const GNHX = document.getElementById("ul_GNHX")
const airportData = [] // 机场数据
route.forEach((item) => {
airportData.push({
name: item.airport,
value: item.routeNum
})
})
console.log("aaa", echarts)
const myChart = echarts.init(GNHX)
const option = {
tooltip: {
trigger: "item",
formatter: "机场名:{b}<br/> 航线:{c}"
},
// legend: {
// orient: "horizontal",
// top: "0.1%",
// textStyle: {
// color: "#ffffff"
// }
// },
series: [
{
type: "pie",
radius: "50%",
label: {
show: true
},
data: airportData
}
]
}
myChart.setOption(option)
}
function initCharts_Three() {
const HBTJ = document.getElementById("ul_HBTJ")
const year = []
const domestic = [] // 国内航班
const international = [] // 国际航班
flight.forEach((item) => {
year.push(item.year)
domestic.push(item.domestic)
international.push(item.international)
})
const myChart = echarts.init(HBTJ)
const option = {
tooltip: {
trigger: "axis",
axisPointer: {
type: "shadow"
}
},
grid: {
left: "8%",
right: "0%",
bottom: "6%",
containLabel: true
},
xAxis: [
{
type: "category",
data: year,
axisTick: {
alignWithLabel: true
}
}
],
yAxis: [
{
type: "value"
}
],
series: [
{
name: "国内航班",
type: "bar",
barWidth: "30%",
data: domestic
},
{
name: "国际航班",
type: "bar",
barWidth: "30%",
data: international
}
]
}
myChart.setOption(option)
window.addEventListener("resize", function () {
myChart.resize()
})
}
return (
<>
<MarsPannel visible={true} top={10} right={10}>
<MarsPannel visible={true} top={10} right={10} width={340} height={787}>
<div className="chartOne" id="chartOne">
<h6>航线条数</h6>
<div className="hx">
<div className="_item_row _item_full_box_width justify-between">
<MarsIcon icon="airplane" width="30" className="icon" />
<div className="row1_right">
<div className="right_title">{ guonei }(条)</div>
<div className="right_sub_title">国内航班</div>
</div>
<MarsIcon icon="take-off" width="35" className="icon" />
{/* <airplane theme="outline" size="43" fill="#333" /> */}
<div className="row1_right">
<div className="right_title">{ guoji }(条)</div>
<div className="right_sub_title">国际航班</div>
</div>
</div>
</div>
</div>
<div className="chartTwo" id="chartTwo">
<h6>国内机场航线数</h6>
<div id="ul_GNHX" className="chartTwo_ulgnhx"></div>
</div>
<div className="chartThree" id="chartThree">
<h6>年度航班统计</h6>
<div id="ul_HBTJ" className="chartThree_ulhbtj"></div>
</div>
</MarsPannel>
</>
)
......
......@@ -2,7 +2,7 @@
/**
* 通过转geojson方式 加载kml和kmz文件。
* kgUtil使用需要引入 ../lib/kml/kml-geojson.js文件
* kgUtil使用需要引入 ../lib/geojson/kml-geojson.js文件
*/
class Kml2JsonLayer extends mars3d.layer.GeoJsonLayer {
/**
......@@ -39,7 +39,7 @@ class Kml2JsonLayer extends mars3d.layer.GeoJsonLayer {
this._load_data(data)
})
.catch(function (error) {
this.showError("服务出错", error)
console.error("服务出错", error)
})
} else if (this.options.data) {
kgUtil
......@@ -51,7 +51,7 @@ class Kml2JsonLayer extends mars3d.layer.GeoJsonLayer {
this._load_data(data)
})
.catch(function (error) {
this.showError("服务出错", error)
console.error("服务出错", error)
})
} else {
if (newOptions) {
......
......@@ -40,7 +40,7 @@ interface MarsAttrProps {
onChange?: (value?: any) => void
}
let newViewMaterials: any[] = []
export default function MarsStyle({ style, layerName, customType, graphicType, onChange = () => {} }: MarsAttrProps) {
export default function MarsStyle({ style, layerName, customType, graphicType, onChange = () => { } }: MarsAttrProps) {
const originStyles = useRef([]) // 完整的属性数据
const [styleValue, setStyleValue] = useState<any>(null) // 矢量数据样式属性对象
const [viewStyles, setViewStyles] = useState<any[]>([]) // 当前状态下显示的属性数组
......@@ -68,7 +68,7 @@ export default function MarsStyle({ style, layerName, customType, graphicType, o
// 设置初始化的默认值
function setDefault() {
const newStyleValue = cloneDeep(style)
const styleConfig = styleConfigAll[graphicType] || styleConfigAll[customType]
const styleConfig = styleConfigAll[customType] || styleConfigAll[graphicType]
if (!styleConfig) {
return
}
......
......@@ -29,7 +29,7 @@ const materialConfig = {
type: "number",
step: 1,
defval: 1,
show(style, allStyle, graphicType) {
show (style, allStyle, graphicType) {
return !style.axisY
}
},
......@@ -39,7 +39,7 @@ const materialConfig = {
type: "number",
step: 1,
defval: 1,
show(style, allStyle, graphicType) {
show (style, allStyle, graphicType) {
return style.axisY
}
},
......@@ -105,7 +105,7 @@ const materialConfig = {
max: 1,
step: 0.1,
defval: 1,
show(style, allStyle, graphicType) {
show (style, allStyle, graphicType) {
return style.transparent === true
}
},
......@@ -161,7 +161,7 @@ const materialConfig = {
label: "描边颜色",
type: "color",
defval: "#ffffff",
show(style, allStyle, graphicType) {
show (style, allStyle, graphicType) {
return style.stroke
}
},
......@@ -173,7 +173,7 @@ const materialConfig = {
max: 5,
step: 1,
defval: 1,
show(style, allStyle, graphicType) {
show (style, allStyle, graphicType) {
return style.stroke
}
},
......@@ -189,7 +189,7 @@ const materialConfig = {
label: "背景颜色",
type: "color",
defval: "#000000",
show(style, allStyle, graphicType) {
show (style, allStyle, graphicType) {
return style.background
}
},
......@@ -199,7 +199,7 @@ const materialConfig = {
type: "number",
step: 1,
defval: 5,
show(style, allStyle, graphicType) {
show (style, allStyle, graphicType) {
return style.background
}
}
......@@ -211,8 +211,8 @@ const materialConfig = {
{ name: "lineThickness", label: "网格宽度", type: "number", step: 1, defval: 2 }
],
Checkerboard: [
{ name: "lightColor", label: "主色", type: "color", defval: "#000000" },
{ name: "darkColor", label: "衬色", type: "color", defval: "#ffffff" },
{ name: "evenColor", label: "主色", type: "color", defval: "#000000" },
{ name: "oddColor", label: "衬色", type: "color", defval: "#ffffff" },
{ name: "repeat_x", label: "横向数量", type: "number", step: 1, defval: 10 },
{ name: "repeat_y", label: "纵向数量", type: "number", step: 1, defval: 10 }
],
......
......@@ -986,6 +986,16 @@ const styleConfig = {
style: [
{ name: "radius", label: "半径", type: "number", step: 1, defval: 0.0 },
{
name: "height",
label: "高度",
type: "number",
step: 1,
defval: 0.0,
show(style, allStyle, graphicType) {
return !style.clampToGround
}
},
{
name: "diffHeight",
label: "立体高度",
type: "number",
......@@ -2638,7 +2648,7 @@ const styleConfig = {
min: 0.0,
max: 360.0,
step: 0.01,
defval: 0.0,
defval: 0.0
},
{
name: "endAngle",
......@@ -2647,7 +2657,7 @@ const styleConfig = {
min: 0.0,
max: 360.0,
step: 0.01,
defval: 0.0,
defval: 0.0
},
{
name: "noCenter",
......@@ -2656,7 +2666,6 @@ const styleConfig = {
defval: false
},
{
name: "diffHeight",
label: "立体高度",
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论