提交 a49cd4f1 authored 作者: 吴强's avatar 吴强

#添加了模型,增加了部分功能,如模型变颜色

上级 80920596
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
\ No newline at end of file
export default {
externals: {
jquery: 'jQuery',
EngineInit:'EngineInit',
AddModel: 'AddModel',
ZoomFitAll: 'ZoomFitAll',
SetModelColor:'SetModelColor',
SetClickMode:'SetClickMode',
},
extraBabelPlugins: [
["import", { "libraryName": "antd", "libraryDirectory": "es", "style": true }]
],
}
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
"precommit": "npm run lint" "precommit": "npm run lint"
}, },
"dependencies": { "dependencies": {
"antd": "^3.10.5", "antd": "^3.10.7",
"babel-plugin-import": "^1.11.0", "babel-plugin-import": "^1.11.0",
"dva": "^2.4.1", "dva": "^2.4.1",
"react": "^16.2.0", "react": "^16.2.0",
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
}, },
"devDependencies": { "devDependencies": {
"babel-plugin-dva-hmr": "^0.3.2", "babel-plugin-dva-hmr": "^0.3.2",
"babel-plugin-import": "^1.11.0",
"eslint": "^4.14.0", "eslint": "^4.14.0",
"eslint-config-umi": "^0.1.1", "eslint-config-umi": "^0.1.1",
"eslint-plugin-flowtype": "^2.34.1", "eslint-plugin-flowtype": "^2.34.1",
......
...@@ -3,13 +3,15 @@ ...@@ -3,13 +3,15 @@
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<title>Dva Demo</title> <title>BimView</title>
<link rel="stylesheet" href="index.css" /> <link rel="stylesheet" href="index.css" />
</head> </head>
<body> <body>
<div id="root"></div> <div id="root"></div>
<script src="3dEngine.js"></script>
<script src="index.js"></script> <script src="index.js"></script>
</body> </body>
</html> </html>
[
{
"model": "house118",
"type": 453
},
{
"model": "house113",
"type": 351
},
{
"model": "house117",
"type": 452
},
{
"model": "house115",
"type": 99
},
{
"model": "house114",
"type": 347
},
{
"model": "house112",
"type": 310
},
{
"model": "house110",
"type": 213
},
{
"model": "house119",
"type": 667
},
{
"model": "house18",
"type": 382
},
{
"model": "house10",
"type": 1184
},
{
"model": "house12",
"type": 1184
},
{
"model": "house14",
"type": 1184
},
{
"model": "house16",
"type": 1184
},
{
"model": "house120",
"type": 454
},
{
"model": "house11",
"type": 1184
},
{
"model": "house13",
"type": 1184
},
{
"model": "house15",
"type": 1184
},
{
"model": "house17",
"type": 1184
},
{
"model": "house111",
"type": 213
},
{
"model": "house116",
"type": 99
}
]
...@@ -14,6 +14,9 @@ export default { ...@@ -14,6 +14,9 @@ export default {
*fetch({ payload }, { call, put }) { // eslint-disable-line *fetch({ payload }, { call, put }) { // eslint-disable-line
yield put({ type: 'save' }); yield put({ type: 'save' });
}, },
*fetchBimData({ payload }) {
}
}, },
reducers: { reducers: {
......
const files = {
'模型相关': [
'添加模型',
'删除模型',
'清空场景',
'模型颜色设置',
'模型颜色恢复',
'模型半透明设置',
'模型半透明恢复',
'模型隐藏',
'模型显示',
'线框模式模型',
'恢复线框模型'
],
'点击相关': [
'查看模式',
'坐标拾取模式',
'ID拾取模式',
'坐标+ID拾取模式',
'距离测量模式',
'角度测量模式',
'平面面积测量模式',
'表面积测量模式',
'体积测量模式',
'重量测量模式',
'设置模型中心'
],
'视角相关': [
'顶视角',
'底视角',
'前视角',
'后视角',
'左视角',
'右视角',
'视角恢复',
],
'构件相关': [
'构件颜色设置',
'构件透明设置',
'构件隐藏',
'构件显示',
'构件状态恢复',
'整体状态恢复',
'构件选中漫游',
'爆炸',
'爆炸恢复',
'只显示特定构件',
'构件原始颜色设置'
],
'标签相关': [
'添加标签',
'删除标签',
'标签隐藏',
'标签显示'
],
'视点相关': [
'获取视点',
'设置视点',
'自动漫游'
],
'其它': [
'保存图片',
'背景色设置',
'背景图片设置',
'背景图片删除',
'裁剪',
'取消裁剪'
]
};
.normal { .webglContainer1{
font-family: Georgia, sans-serif; height: 85%;
margin-top: 3em; width:100%;
text-align: center;
}
.title {
font-size: 2.5rem;
font-weight: normal;
letter-spacing: -1px;
} }
.all{
.welcome { height: 100%;
height: 328px;
background: url(../assets/yay.jpg) no-repeat center 0;
background-size: 388px 328px;
} }
.title{
text-align: center;
font-size: 26px;
.list {
font-size: 1.2em;
margin-top: 1.8em;
list-style: none;
line-height: 1.5em;
} }
.list code {
background: #f7f7f7;
}
import React from 'react'; import React from 'react';
import { connect } from 'dva'; import { connect } from 'dva';
import styles from './IndexPage.css'; import styles from './IndexPage.css';
import EngineInit from 'EngineInit';
import AddModel from 'AddModel';
import SetModelColor from 'SetModelColor';
import SetClickMode from 'SetClickMode';
import { Button, Menu, Affix, Icon, Tooltip } from 'antd';
import '../utils/OnClickPosition';
function IndexPage() { const filesurl= '../../public/model/house1/house1List.json';
const SubMenu = Menu.SubMenu;
const MenuItemGroup = Menu.ItemGroup;
class IndexPage extends React.Component{
SetModelColor = () => {
SetModelColor('testtag1',0,0,255);
};
SetClickMode = (i) => {
SetClickMode(i);
};
componentDidMount() {
//初始化画布
EngineInit("webglContainer");
SetClickMode(0);
AddModel(filesurl, 'testtag1');
}
render() {
return ( return (
<div className={styles.normal}> <div className={ styles.all }>
<h1 className={styles.title}>Yay! Welcome to dva!</h1> <div className={styles.title}><label>BiM 测试平台</label></div>
<div className={styles.welcome} />
<ul className={styles.list}> <div id="webglContainer" className={styles.webglContainer1} ref={(node) => { this.container = node; }}>
<li>To get started, edit <code>src/index.js</code> and save to reload.</li> <Tooltip title="模型颜色设置">
<li><a href="https://github.com/dvajs/dva-docs/blob/master/v1/en-us/getting-started.md">Getting Started</a></li> <Button type="primary" onClick={this.SetModelColor}>
</ul> <Icon type="mail"></Icon>
</Button>
</Tooltip>
<Button type="primary" onClick={this.SetClickMode.bind(undefined,'0')}>查看模式</Button>
<Button type="primary" onClick={this.SetClickMode.bind(undefined,'1')}>坐标拾取模式</Button>
<Button type="primary" onClick={this.SetClickMode.bind(undefined,'2')}>ID拾取模式</Button>
</div> </div>
</div>
); );
}
} }
IndexPage.propTypes = { IndexPage.propTypes = {
}; };
export default connect()(IndexPage); export default connect()(IndexPage);
global.OnClickPosition=function OnClickPosition (position){
console.info(position);
};
global.OnSelectionChanged=function OnSelectionChanged(id){
// guids鼠标点击模型构件的id值,返回结果格式为"模型id_构件id"
var guid=id;
console.info('guid',id);
};
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论