Skip to content

Commit 98e2f45

Browse files
committed
Implement 'maxlvlN' draw option for geometry
1 parent 37f0ed7 commit 98e2f45

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

scripts/JSRootCore.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
}
8787
} (function(JSROOT) {
8888

89-
JSROOT.version = "dev 12/01/2016";
89+
JSROOT.version = "dev 13/01/2016";
9090

9191
JSROOT.source_dir = "";
9292
JSROOT.source_min = false;

scripts/JSRootGeoPainter.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -954,6 +954,8 @@
954954
}
955955

956956
JSROOT.TGeoPainter.prototype.drawGeometry = function(opt) {
957+
if (typeof opt != 'string') opt = "";
958+
957959
var rect = this.select_main().node().getBoundingClientRect();
958960

959961
var w = rect.width, h = rect.height, size = 100;
@@ -962,8 +964,10 @@
962964

963965
var dom = this.select_main().node();
964966

965-
var maxlvl = opt=="all" ? 9999 : -1;
967+
var maxlvl = -1; // use only visible flag, set in ROOT when geometry is displayed
966968

969+
if (opt=="all") maxlvl = 9999; else
970+
if (opt.indexOf("maxlvl")==0) maxlvl = parseInt(opt.substr(6)); else
967971
if ((opt == 'count') || (opt == 'limit')) {
968972
var arr = [];
969973
for (var lvl=0;lvl<100;++lvl) arr.push(0);
@@ -981,16 +985,15 @@
981985
return this.DrawingReady();
982986
}
983987

988+
maxlvl = 9999;
984989
var sum = 0;
985990
for (var lvl=1;lvl<arr.length;++lvl) {
986991
sum += arr[lvl];
987992
if (sum > 10000) {
988993
maxlvl = lvl - 1;
989-
console.log('set level on ' + maxlvl);
990994
break;
991995
}
992996
}
993-
994997
}
995998

996999
// three.js 3D drawing
@@ -1333,7 +1336,7 @@
13331336
_title : volume.fTitle,
13341337
_parent : parent,
13351338
_volume : volume, // keep direct reference
1336-
_more : (typeof volume['fNodes'] != 'undefined') && (volume['fNodes']!=null),
1339+
_more : (volume['fNodes'] !== undefined) && (volume['fNodes'] !== null),
13371340
_menu : JSROOT.provideGeoMenu,
13381341
_icon_click : JSROOT.geoIconClick,
13391342
_get : function(item, itemname, callback) {
@@ -1435,7 +1438,7 @@
14351438
return true;
14361439
}
14371440

1438-
JSROOT.addDrawFunc({ name: "TGeoVolumeAssembly", icon: 'img_geoassembly', func: JSROOT.Painter.drawGeometry, expand: "JSROOT.expandGeoVolume", painter_kind : "base", opt : "all;count;limit;" });
1441+
JSROOT.addDrawFunc({ name: "TGeoVolumeAssembly", icon: 'img_geoassembly', func: JSROOT.Painter.drawGeometry, expand: "JSROOT.expandGeoVolume", painter_kind : "base", opt : "all;count;limit;maxlvl2" });
14391442

14401443

14411444
return JSROOT.Painter;

scripts/JSRootPainter.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8314,8 +8314,8 @@
83148314
JSROOT.addDrawFunc({ name: "TLine", icon: 'img_graph', prereq: "more2d", func: "JSROOT.Painter.drawLine" });
83158315
JSROOT.addDrawFunc({ name: "TArrow", icon: 'img_graph', prereq: "more2d", func: "JSROOT.Painter.drawArrow" });
83168316
JSROOT.addDrawFunc({ name: "TLegend", icon: "img_pavelabel", prereq: "more2d", func: "JSROOT.Painter.drawLegend" });
8317-
JSROOT.addDrawFunc({ name: "TGeoVolume", icon: 'img_histo3d', prereq: "geom", func: "JSROOT.Painter.drawGeometry", expand: "JSROOT.expandGeoVolume", painter_kind : "base", opt:"all;count;limit;" });
8318-
JSROOT.addDrawFunc({ name: "TEveGeoShapeExtract", icon: 'img_histo3d', prereq: "geom", func: "JSROOT.Painter.drawGeometry", painter_kind : "base", opt: ";count;limit" });
8317+
JSROOT.addDrawFunc({ name: "TGeoVolume", icon: 'img_histo3d', prereq: "geom", func: "JSROOT.Painter.drawGeometry", expand: "JSROOT.expandGeoVolume", painter_kind : "base", opt:"all;count;limit;maxlvl2;" });
8318+
JSROOT.addDrawFunc({ name: "TEveGeoShapeExtract", icon: 'img_histo3d', prereq: "geom", func: "JSROOT.Painter.drawGeometry", painter_kind : "base", opt: ";count;limit;maxlvl2" });
83198319
JSROOT.addDrawFunc({ name: "TGeoManager", icon: 'img_histo3d', prereq: "geom", expand: "JSROOT.expandGeoManagerHierarchy" });
83208320
// these are not draw functions, but provide extra info about correspondent classes
83218321
JSROOT.addDrawFunc({ name: "kind:Command", icon: "img_execute", execute: true });

0 commit comments

Comments
 (0)