|
@@ -18,8 +18,8 @@ let highlightColor = new THREE.Color(config.measure.highlight.color);
|
|
|
|
|
|
let color = new THREE.Color(config.measure.color)
|
|
|
let textColor = new THREE.Color(config.measure.textColor)
|
|
|
-var markerMats;
|
|
|
-var lineMats;
|
|
|
+var markerMats = {}
|
|
|
+var lineMats ;
|
|
|
var planeMats
|
|
|
|
|
|
const lineDepthInfo = {
|
|
@@ -71,8 +71,8 @@ export class Measure extends ctrlPolygon{
|
|
|
|
|
|
|
|
|
this.name = this.measureType + this.constructor.counter //'Measure_' + this.constructor.counter;
|
|
|
-
|
|
|
-
|
|
|
+ //this.color = '#FF4399'
|
|
|
+ this.color = new THREE.Color(this.color)
|
|
|
|
|
|
this.markerLabels = [];
|
|
|
this.edgeLabels = [];
|
|
@@ -110,10 +110,10 @@ export class Measure extends ctrlPolygon{
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
- this.addEventListener('marker_dropped',(e)=>{
|
|
|
+ //这版应该没多数据集,不需要更新这个:
|
|
|
+ /* this.addEventListener('marker_dropped',(e)=>{
|
|
|
this.updateDatasetBelong(e.index)
|
|
|
- })
|
|
|
+ }) */
|
|
|
|
|
|
|
|
|
this.addEventListener('isVisible', ()=>{
|
|
@@ -672,8 +672,15 @@ export class Measure extends ctrlPolygon{
|
|
|
|
|
|
|
|
|
createEdgeLabel(name, hasHoverEvent){
|
|
|
+
|
|
|
+ mainLabelProp.backgroundColor = {r: this.color.r*255, g: this.color.g*255, b: this.color.b*255, a:config.measure.default.opacity}
|
|
|
+
|
|
|
+
|
|
|
const edgeLabel = new TextSprite(
|
|
|
- $.extend(hasHoverEvent ? mainLabelProp : subLabelProp,{sizeInfo: labelSizeInfo, name:name||'edgeLabel'})
|
|
|
+ $.extend(hasHoverEvent ? mainLabelProp : subLabelProp,{
|
|
|
+ sizeInfo: labelSizeInfo, name:name||'edgeLabel',
|
|
|
+
|
|
|
+ })
|
|
|
)
|
|
|
if(hasHoverEvent){
|
|
|
edgeLabel.addEventListener('mouseover',()=>{
|
|
@@ -728,26 +735,30 @@ export class Measure extends ctrlPolygon{
|
|
|
}
|
|
|
|
|
|
|
|
|
- getMarkerMaterial(type) {
|
|
|
- if(!markerMats){
|
|
|
- markerMats = {
|
|
|
- default: new DepthBasicMaterial($.extend({},lineDepthInfo,{
|
|
|
- transparent: !0,
|
|
|
- opacity: 1,
|
|
|
- map: texLoader.load(Potree.resourcePath+'/textures/pic_point_s32.png' ),
|
|
|
- useDepth:true
|
|
|
- })),
|
|
|
- select: new THREE.MeshBasicMaterial({
|
|
|
- transparent: !0,
|
|
|
- opacity: 1,
|
|
|
- depthTest:false,
|
|
|
- map: texLoader.load(Potree.resourcePath+'/textures/pic_point32.png'/* , null, null, { antialias: false } */),
|
|
|
-
|
|
|
- }),
|
|
|
- }
|
|
|
- Measure.markerMats = markerMats
|
|
|
- }
|
|
|
- return markerMats[type]
|
|
|
+ getMarkerMaterial(type){
|
|
|
+ let color = this.color.getHexString()
|
|
|
+ if(!markerMats[type + color]){
|
|
|
+
|
|
|
+ markerMats['default' + color] = new DepthBasicMaterial($.extend({},lineDepthInfo,{
|
|
|
+ transparent: !0,
|
|
|
+ opacity: 1,
|
|
|
+ map: texLoader.load(Potree.resourcePath+'/textures/pic_point_s32.png' ),
|
|
|
+ useDepth:true,
|
|
|
+ replaceColor:this.color,
|
|
|
+ beReplacedRed: 0.184, //0.18431372
|
|
|
+ mapColorReplace:true,
|
|
|
+ })),
|
|
|
+ markerMats['select' + color] = new DepthBasicMaterial($.extend({},lineDepthInfo,{
|
|
|
+ transparent: !0,
|
|
|
+ opacity: 1,
|
|
|
+ map: texLoader.load(Potree.resourcePath+'/textures/pic_point32.png' ),
|
|
|
+ useDepth:true ,
|
|
|
+ replaceColor:this.color,
|
|
|
+ beReplacedRed: 0.184, //0.18431372
|
|
|
+ mapColorReplace:true
|
|
|
+ }))
|
|
|
+ }
|
|
|
+ return markerMats[type + color]
|
|
|
|
|
|
}
|
|
|
|
|
@@ -755,39 +766,51 @@ export class Measure extends ctrlPolygon{
|
|
|
|
|
|
|
|
|
getLineMat(type) {
|
|
|
- if(!Measure.lineMats){
|
|
|
- Measure.lineMats = {
|
|
|
- edgeDefault: LineDraw.createFatLineMat({
|
|
|
- color: config.measure.default.color,
|
|
|
- lineWidth: config.measure.lineWidth,
|
|
|
- useDepth :true,
|
|
|
- dashWithDepth :true, // 只在被遮住的部分显示虚线,因为实线容易挡住label
|
|
|
- dashed :true,
|
|
|
- dashSize : 0.04,
|
|
|
- gapSize: 0.04,
|
|
|
- transparent: true,
|
|
|
- opacity: config.measure.default.opacity,
|
|
|
- depthTestWhenPick:true,
|
|
|
- }),
|
|
|
- edgeSelect: LineDraw.createFatLineMat({
|
|
|
- color: config.measure.highlight.color,//'#f0ff00',
|
|
|
- dashSize: 0.5,
|
|
|
- gapSize: 0.2,
|
|
|
- lineWidth: config.measure.lineWidth ,
|
|
|
- transparent: true,
|
|
|
- opacity: config.measure.highlight.opacity
|
|
|
- }),
|
|
|
- guide: LineDraw.createFatLineMat({
|
|
|
- color:config.measure.guide.color,
|
|
|
- dashSize: 0.1,
|
|
|
- gapSize: 0.02,
|
|
|
- dashed: true,
|
|
|
- lineWidth: config.measure.lineWidth
|
|
|
- })
|
|
|
-
|
|
|
- }
|
|
|
+
|
|
|
+ if(!lineMats) Measure.lineMats = lineMats = {
|
|
|
+ guide: LineDraw.createFatLineMat({
|
|
|
+ color:config.measure.guide.color,
|
|
|
+ dashSize: 0.1,
|
|
|
+ gapSize: 0.02,
|
|
|
+ dashed: true,
|
|
|
+ lineWidth: config.measure.lineWidth
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ let color = this.color.getHexString()
|
|
|
+ if(!lineMats['edgeDefault'+color]){
|
|
|
+ lineMats['edgeDefault'+color] = LineDraw.createFatLineMat({
|
|
|
+ color: this.color,
|
|
|
+ lineWidth: config.measure.lineWidth,
|
|
|
+ useDepth :true,
|
|
|
+ dashWithDepth :true, // 只在被遮住的部分显示虚线,因为实线容易挡住label
|
|
|
+ dashed :true,
|
|
|
+ dashSize : 0.04,
|
|
|
+ gapSize: 0.04,
|
|
|
+ transparent: true,
|
|
|
+ opacity: config.measure.default.opacity,
|
|
|
+ depthTestWhenPick:true,
|
|
|
+ })
|
|
|
+ lineMats['edgeSelect'+color] = LineDraw.createFatLineMat({
|
|
|
+ color: this.color,//'#f0ff00',
|
|
|
+ dashSize: 0.5,
|
|
|
+ gapSize: 0.2,
|
|
|
+ lineWidth: config.measure.lineWidth ,
|
|
|
+ transparent: true,
|
|
|
+ opacity: config.measure.highlight.opacity
|
|
|
+ })
|
|
|
}
|
|
|
- return Measure.lineMats[type]
|
|
|
+
|
|
|
+
|
|
|
+ if(type != 'guide'){
|
|
|
+ return Measure.lineMats[type+color]
|
|
|
+ }else return Measure.lineMats[type]
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
}
|
|
|
|
|
@@ -1059,7 +1082,7 @@ export class Measure extends ctrlPolygon{
|
|
|
|
|
|
|
|
|
function setLabelHightState(label, state){
|
|
|
- if(state){
|
|
|
+ /* if(state){
|
|
|
label.backgroundColor = {r: highlightColor.r*255, g: highlightColor.g*255, b: highlightColor.b*255, a:config.measure.highlight.opacity},
|
|
|
label.backgroundColor.a = config.measure.highlight.opacity
|
|
|
label.sprite.material.useDepth = false;
|
|
@@ -1069,7 +1092,21 @@ function setLabelHightState(label, state){
|
|
|
label.backgroundColor.a = config.measure.default.opacity
|
|
|
label.sprite.material.useDepth = true
|
|
|
|
|
|
+ } */
|
|
|
+
|
|
|
+ if(state){
|
|
|
+ //label.backgroundColor = {r: this.color[0]*255, g: this.color[1]*255, b: this.color[2]*255, a:config.measure.highlight.opacity},
|
|
|
+ label.backgroundColor.a = config.measure.highlight.opacity
|
|
|
+ label.sprite.material.useDepth = false;
|
|
|
+
|
|
|
+ }else{
|
|
|
+ //label.backgroundColor = {r: this.color[0]*255, g: this.color[1]*255, b: this.color[2]*255
|
|
|
+ label.backgroundColor.a = config.measure.default.opacity
|
|
|
+ label.sprite.material.useDepth = true
|
|
|
+
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
label.updateTexture()
|
|
|
//label.sprite.material.needsUpdate = true
|
|
|
}
|
|
@@ -1235,7 +1272,7 @@ function createCircle(){
|
|
|
return line;
|
|
|
|
|
|
}
|
|
|
-
|
|
|
+Measure.markerMats = markerMats;
|
|
|
/* function createAzimuth(){
|
|
|
|
|
|
const azimuth = {
|