- {/*
-
-
*/}
+
this.onClickSearchBtn()}>搜索
{
diff --git a/src/webapp/routes/nav/Search/index.scss b/src/webapp/routes/nav/Search/index.scss
index f487641..f06d599 100644
--- a/src/webapp/routes/nav/Search/index.scss
+++ b/src/webapp/routes/nav/Search/index.scss
@@ -16,7 +16,7 @@ $exchange-size: 0;
.inputs-container{
position: absolute;
left: 15px;
- right: $exchange-size;
+ right: 70px;
top: 0;
height: 100%;
@@ -76,6 +76,17 @@ $exchange-size: 0;
line-height: $input-container-height * 2;
}
}
+
+ .search-btn{
+ position: absolute;
+ top: 29px;
+ right: 8px;
+ border: 1px solid $blue-color;
+ padding: 4px 8px;
+ border-radius: 20px;
+ font-size: 15px;
+ color: $blue-color;
+ }
}
.pois{
diff --git a/src/webapp/routes/nearby/Result/index.jsx b/src/webapp/routes/nearby/Result/index.jsx
index 856b89c..c0570c6 100644
--- a/src/webapp/routes/nearby/Result/index.jsx
+++ b/src/webapp/routes/nearby/Result/index.jsx
@@ -24,7 +24,9 @@ export default class Result extends RouteComponent {
total: 0,
pageIndex: 0,
location: null,
- pois: [],
+ // pois: [],
+ graphics: [],
+ highlightPoi: null,
list: true
};
}
@@ -33,6 +35,22 @@ export default class Result extends RouteComponent {
super.componentDidMount();
this.domNode.style.opacity = 1;
this.search(0);
+ globe.poiLayer.setHighlightListener((graphic) => {
+ this.setState({
+ highlightPoi: graphic
+ });
+ });
+ globe.poiLayer.setUnHighlightListener(() => {
+ this.setState({
+ highlightPoi: null
+ });
+ });
+ }
+
+ componentWillUnmount(){
+ super.componentWillUnmount();
+ globe.poiLayer.setHighlightListener(null);
+ globe.poiLayer.setUnHighlightListener(null);
}
onMap() {
@@ -47,9 +65,13 @@ export default class Result extends RouteComponent {
});
}
- onClickPoi(poi){
- if(typeof poi.pointx === 'number' && typeof poi.pointy === 'number'){
- globe.centerTo(poi.pointx, poi.pointy);
+ onClickPoi(graphic, index){
+ // const graphic = globe.poiLayer.children[index];
+ if(graphic){
+ globe.poiLayer.highlightPoi(graphic);
+ }
+ if(typeof graphic.attributes.pointx === 'number' && typeof graphic.attributes.pointy === 'number'){
+ globe.centerTo(graphic.attributes.pointx, graphic.attributes.pointy);
}
this.setState({
list: false
@@ -109,7 +131,8 @@ export default class Result extends RouteComponent {
total: response.info.total,
pageIndex: pageIndex,
location: response.location,
- pois: response.detail.pois
+ // pois: response.detail.pois
+ graphics: response.detail.graphics
});
}
});
@@ -122,7 +145,9 @@ export default class Result extends RouteComponent {
total,
pageIndex,
location,
- pois
+ // pois
+ graphics,
+ highlightPoi
} = this.state;
let {
@@ -151,21 +176,21 @@ export default class Result extends RouteComponent {
total > 0 && (
{
- this.state.pois.map((poi, index) => {
+ graphics.map((poi, index) => {
let distanceLabel = false;
if(location && location.length === 2){
const [lon, lat] = location;
- let distance = MathUtils.getRealArcDistanceBetweenLonLats(lon, lat, poi.pointx, poi.pointy);
+ let distance = MathUtils.getRealArcDistanceBetweenLonLats(lon, lat, poi.attributes.pointx, poi.attributes.pointy);
distanceLabel = distance > 1000 ? `${(distance/1000).toFixed(1)}公里` : `${Math.floor(distance)}米`;
}
return (
-
this.onClickPoi(poi)}>
+
this.onClickPoi(poi, index)}>
{index + 1}
-
{poi.name}
-
{poi.addr}
+
{poi.attributes.name}
+
{poi.attributes.addr}
{
distanceLabel && (
@@ -211,6 +236,14 @@ export default class Result extends RouteComponent {
) : (
+ {
+ highlightPoi && (
+
+
{highlightPoi.attributes.name}
+
{highlightPoi.attributes.addr}
+
+ )
+ }
)
}
diff --git a/src/webapp/routes/nearby/Result/index.scss b/src/webapp/routes/nearby/Result/index.scss
index f87d98c..495f183 100644
--- a/src/webapp/routes/nearby/Result/index.scss
+++ b/src/webapp/routes/nearby/Result/index.scss
@@ -144,4 +144,27 @@ $line: 1px solid #d3d3d3;
font-size: 12px;
}
}
+}
+
+.map{
+ .infowindow{
+ position: absolute;
+ left: 10px;
+ right: 10px;
+ bottom: 10px;
+ height: auto;
+ background: white;
+ border-radius: 5px;
+ border: 1px solid #ccc;
+ padding: 8px;
+ .name {
+ font-size: 15px;
+ color: #333;
+ }
+ .address {
+ font-size: 12px;
+ color: $main-color;
+ margin-top: 8px;
+ }
+ }
}
\ No newline at end of file
diff --git a/versions.md b/versions.md
index 30b4741..008fe99 100644
--- a/versions.md
+++ b/versions.md
@@ -6,7 +6,7 @@
- 0.0.4.7 新增了World.TiledLayer类型,取消掉了World.NokiaTile等类型,图层都继承自World.TiledLayer,并重写其中的getImageUrl方法,所有的切片都放到World.TiledLayer中进行管理,结构化明确,更加面向对象,因此将版本升级到0.0.4.7
-- 0.0.5.0 从0.0.4.7直接升级到0.0.5.0,在TiledLayer的基础上又增加了SubTiledLayer类,并在此基础上优化了诸多算法,包括通过添加isvisible判断是否渲染,完善了camera的getCurrentGeoExtent算法,结构更合理,访问速度更快,故升级到0.0.5.0
+ - 0.0.5.0 从0.0.4.7直接升级到0.0.5.0,在TiledLayer的基础上又增加了SubTiledLayer类,并在此基础上优化了诸多算法,包括通过添加isvisible判断是否渲染,完善了camera的getCurrentGeoExtent算法,结构更合理,访问速度更快,故升级到0.0.5.0
- 0.0.5.1 优化了各种TiledLayer的getImageUrl的算法
@@ -222,32 +222,46 @@
- MeshGraphic => MeshTextureGraphic
- 添加MeshColorGraphic
-- 0.4.24 RouteLayer基本可以实现固定宽度的Polyline
+ - 0.4.24 RouteLayer基本可以实现固定宽度的Polyline
-- 0.4.25 更新webpack.config.js
+ - 0.4.25 更新webpack.config.js
-- 0.4.26 Camera中添加centerTo和animateTo方法
+ - 0.4.26 Camera中添加centerTo和animateTo方法
-- 0.4.27 Camera中添加setExtent和animateToExtent方法
+ - 0.4.27 Camera中添加setExtent和animateToExtent方法
-- 0.4.28 通过判断道路拐点解决"箭头道路"的问题
+ - 0.4.28 通过判断道路拐点解决"箭头道路"的问题
-- 0.4.29 可以在nav/Paths页面中直接切换出行方式重新进行路线规划
+ - 0.4.29 可以在nav/Paths页面中直接切换出行方式重新进行路线规划
-- 0.4.30 在RouteComponent中添加getPreviousLocation()方法,并在nearyby/Result中使用
+ - 0.4.30 在RouteComponent中添加getPreviousLocation()方法,并在nearyby/Result中使用
-- 0.4.31 在公交导航中支持火车出行
+ - 0.4.31 在公交导航中支持火车出行
-- 0.4.32 通过http://fontello.com/ 自定义FontAwesome
+ - 0.4.32 通过http://fontello.com/ 自定义FontAwesome
-- 0.4.33 Globe构造函数支持pauseRendering参数,可以实现切片延迟加载
+ - 0.4.33 Globe构造函数支持pauseRendering参数,可以实现切片延迟加载
-- 0.4.34 searchByBuffer和searchByCity支持SearchType参数,可以智能判断类型,并且可以在查询无结果的情况下改变SearchType再次查询,优化查询体验
+ - 0.4.34 searchByBuffer和searchByCity支持SearchType参数,可以智能判断类型,并且可以在查询无结果的情况下改变SearchType再次查询,优化查询体验
-- 0.4.35 iOS系统中的浏览器不能访问类WebGLRenderingContext的静态常量,将所有用到WebGLRenderingContext的地方重新改成Kernel.gl的形式,用实例常量访问即可修复iOS中无法渲染的严重bug
+ - 0.4.35 iOS系统中的浏览器不能访问类WebGLRenderingContext的静态常量,将所有用到WebGLRenderingContext的地方重新改成Kernel.gl的形式,用实例常量访问即可修复iOS中无法渲染的严重bug
-- 0.4.36 更新webpack.config.js文件,在生产环境中配置new webpack.DefinePlugin,将NODE_ENV配置为production,使得压缩打包后的React体积减小88KB,参见https://facebook.github.io/react/docs/optimizing-performance.html#use-the-production-build
+ - 0.4.36 更新webpack.config.js文件,在生产环境中配置new webpack.DefinePlugin,将NODE_ENV配置为production,使得压缩打包后的React体积减小88KB,参见https://facebook.github.io/react/docs/optimizing-performance.html#use-the-production-build
-- 0.5.0 为搜索框添加搜索图标,方便搜索
+ - 0.5.0 为搜索框添加搜索图标,方便搜索
-- 0.5.1 更新README.md,发布新版本
\ No newline at end of file
+ - 0.5.1 更新README.md,发布新版本
+
+ - 0.5.5 修复了Camera中计算出的实际分辨率总是真实值的1.3倍的bug
+
+ - 0.5.6 可以点击拾取PoiLayer
+
+ - 0.5.7 Graphic支持attributes属性,优化PoiLayer拾取逻辑,修复Service.ts中Promise导致TypeScript报错的问题
+
+ - 0.5.8 重新修改了resolutionFactor1和resolutionFactor2的值,确保图片是256大小显示,并且确保getResolution()和getResolutionInWorld()方法用于让其他类调用获取实际的分辨率
+
+ - 0.5.9
+ - 使得Globe支持resolutionFactor参数,并且在webapp.html中设置值为1.2
+ - 优化了webapp.html搜索体验,支持“当前位置”
+
+ - 0.6.0 更新README.md和图片,发布新版本
\ No newline at end of file
diff --git a/webpack.config.js b/webpack.config.js
index 69b7e74..689bdd0 100755
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -83,7 +83,7 @@ module.exports = {
loader: extractPlugin.extract("css?modules&localIdentName=[name]__[local]___[hash:base64:5]!sass")
},
{
- test: /\.(png|jpeg|jpg)$/,
+ test: /\.(png|jpeg|jpg|gif)$/,
loader: "file-loader"
},
{
@@ -119,7 +119,8 @@ if (process.argv.indexOf("--ci") >= 0) {
console.log("");
console.log(chalk.red("----------------------------------------------------------------"));
errors.forEach(function(err) {
- var msg = chalk.red(`ERROR in ${err.module.userRequest},`);
+ var msg = '';
+ // var msg = chalk.red(`ERROR in ${err.module.userRequest},`);
// msg += chalk.blue(`(${err.location.line},${err.location.character}),`);
msg += chalk.red(err.message);
console.log(msg);
@@ -135,6 +136,7 @@ if (process.argv.indexOf("--ci") >= 0) {
if (PRODUCTION) {
module.exports.plugins.push(
+ //add DefinePlugin for production to save 88KB for React build
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify('production')