froge viewer 加载时位移及缩放
const posOptions = {
placementTransform: (new THREE.Matrix4()).setPosition({x:1,y:100,z:1}).scale({x:2,y:2,z:
};
viewer.loadModel(path, posOptions);
const posOptions = {
placementTransform: (new THREE.Matrix4()).setPosition({x:1,y:100,z:1}).scale({x:2,y:2,z:
};
viewer.loadModel(path, posOptions);
如果url为: http://www.mysite.com/content/default.aspx?tabid=2&subtabid=3
以下下是条件,iis内置的变量
{URL} 匹配 content/default.aspx
{QUERY_STRING} 匹配 tabid=2&subtabid=3
{HTTP_HOST} 匹配 www.mysite.com
{SERVER_PORT} 匹配 80
{SERVER_PORT_SECUR} The SERVER_PORT_SECURE server variable contains 0 and HTTPS contains OFF.
{REQUEST_URI} 匹配 content/default.aspx?tabid=2&subtabid=3
参考:
CACHE_URL
DOCUMENT_ROOT
HTTP_URL
HTTP_HOST
PATH_INFO
PATH_TRANSLATED
QUERY_STRING
REQUEST_FILENAME
REQUEST_URI
SCRIPT_FILENAME
SCRIPT_NAME
SCRIPT_TRANSLATED
UNENCODED_URL
URL
URL_PATH_INFO
APP_POOL_ID
APPL_MD_PATH
APPL_PHYSICAL_PATH
GATEWAY_INTERFACE
SERVER_SOFTWARE
SSI_EXEC_DISABLED
SERVER_PORT
import { Component, ViewChild, ElementRef } from '@angular/core';
import { ConferenceData } from '../../providers/conference-data';
import { Dialogs } from 'ionic-native';
import { Platform } from 'ionic-angular';
import { Plus } from '../../providers/plus';
@Component({
selector: 'page-map',
templateUrl: 'map.html'
})
export class MapPage {
plus: any;
@ViewChild('mapCanvas') mapElement: ElementRef;/*通过模版变量注入,但类型是元素类型*/
constructor(public confData: ConferenceData, public platform: Platform, plus: Plus) {
this.platform.ready().then((readySource) => {
this.plus = plus.plus;
// Platform now ready, execute any required native code
});
}
mapEle: any;
ionViewDidLoad() {
//this.baidumap();
this.confData.getMap().subscribe(mapData => {
this.mapEle = this.mapElement.nativeElement;//*拿到原生dom元素,然后,开始干活*/
this.locate();
});
}
map: any;
locate() {
//let wo = ws.opener();
//高德地图坐标为(116.3974357341,39.9085574220), 百度地图坐标为(116.3975,39.9074)
let pcenter = new this.plus.maps.Point(116.3975, 39.9074);
setTimeout(() => {
this.map = new this.plus.maps.Map(this.mapEle.id);
this.map.centerAndZoom(pcenter, 12);
this.createMarker();
// 创建子窗口
//this.createSubview();
}, 1000);
}
createMarker() {
//高德地图坐标为(116.3406445236,39.9630878208), 百度地图坐标为(116.347292,39.968716
let marker = new this.plus.maps.Marker(new this.plus.maps.Point(116.347292, 39.968716));
//marker.setIcon("/logo.png");
marker.setLabel("HBuilder");
var bubble = new this.plus.maps.Bubble("打造最好的HTML5移动开发工具");
marker.setBubble(bubble);
this.map.addOverlay(marker);
}
//createSubview() {
// // 创建加载内容窗口
// let topoffset: string = '44px';
// if (plus.plus.navigator.isImmersedStatusbar()) {// 兼容immersed状态栏模式
// topoffset = (Math.round(plus.plus.navigator.getStatusbarHeight()) + 44) + 'px';
// }
// var wsub = plus.plus.webview.create('maps_map_sub.html', 'sub', { top: topoffset, height: '60px', position: 'absolute', scrollIndicator: 'none', background: 'transparent' });
// plus.plus.webview.currentWebview().append(wsub);
// }
}
import { Injectable } from '@angular/core';
declare var window: any;
@Injectable()
export class Plus {
plus: any;
constructor() {
**this.plus = window.plus == undefined ? null : window.plus;**
}
/**
* 消息提醒
* @param msg 消息
*/
toast(msg) {
**if (this.plus)** {
this.plus.nativeUI.toast(msg, { duration: "long" });
} else
{
alert(msg)
}
}
}
ionic2的模板,默认会被全部打包到www\build\main.js里,导致单文件过大。且无法实现按用户切换不同的模板。
默认Component装饰器写法
@Component(
{
templateUrl: 'tabs.html'
})