Show line count in the details panel.
This commit is contained in:
parent
9e5ddaead7
commit
bd34c2a408
@ -22,6 +22,14 @@ export class Line
|
||||
return this;
|
||||
}
|
||||
|
||||
SegmentCount ()
|
||||
{
|
||||
if (this.vertices === null) {
|
||||
return 0;
|
||||
}
|
||||
return parseInt (this.vertices.length / 2, 10);
|
||||
}
|
||||
|
||||
Clone ()
|
||||
{
|
||||
let cloned = new Line ([...this.vertices]);
|
||||
|
||||
@ -38,6 +38,15 @@ export class Mesh extends ModelObject3D
|
||||
return this.lines.length;
|
||||
}
|
||||
|
||||
LineSegmentCount ()
|
||||
{
|
||||
let lineSegmentCount = 0;
|
||||
for (let line of this.lines) {
|
||||
lineSegmentCount += line.SegmentCount ();
|
||||
}
|
||||
return lineSegmentCount;
|
||||
}
|
||||
|
||||
TriangleCount ()
|
||||
{
|
||||
return this.triangles.length;
|
||||
|
||||
@ -70,6 +70,11 @@ export class MeshInstance extends ModelObject3D
|
||||
return this.mesh.LineCount ();
|
||||
}
|
||||
|
||||
LineSegmentCount ()
|
||||
{
|
||||
return this.mesh.LineSegmentCount ();
|
||||
}
|
||||
|
||||
TriangleCount ()
|
||||
{
|
||||
return this.mesh.TriangleCount ();
|
||||
|
||||
@ -102,6 +102,15 @@ export class Model extends ModelObject3D
|
||||
return count;
|
||||
}
|
||||
|
||||
LineSegmentCount ()
|
||||
{
|
||||
let count = 0;
|
||||
this.EnumerateMeshInstances ((meshInstance) => {
|
||||
count += meshInstance.LineSegmentCount ();
|
||||
});
|
||||
return count;
|
||||
}
|
||||
|
||||
TriangleCount ()
|
||||
{
|
||||
let count = 0;
|
||||
|
||||
@ -25,6 +25,16 @@ export class Object3D
|
||||
return 0;
|
||||
}
|
||||
|
||||
LineCount ()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
LineSegmentCount ()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
TriangleCount ()
|
||||
{
|
||||
return 0;
|
||||
|
||||
@ -53,7 +53,14 @@ export class SidebarDetailsPanel extends SidebarPanel
|
||||
let size = SubCoord3D (boundingBox.max, boundingBox.min);
|
||||
let unit = model.GetUnit ();
|
||||
this.AddProperty (table, new Property (PropertyType.Integer, 'Vertices', object3D.VertexCount ()));
|
||||
this.AddProperty (table, new Property (PropertyType.Integer, 'Triangles', object3D.TriangleCount ()));
|
||||
let lineSegmentCount = object3D.LineSegmentCount ();
|
||||
if (lineSegmentCount > 0) {
|
||||
this.AddProperty (table, new Property (PropertyType.Integer, 'Lines', lineSegmentCount));
|
||||
}
|
||||
let triangleCount = object3D.TriangleCount ();
|
||||
if (triangleCount > 0) {
|
||||
this.AddProperty (table, new Property (PropertyType.Integer, 'Triangles', triangleCount));
|
||||
}
|
||||
if (unit !== Unit.Unknown) {
|
||||
this.AddProperty (table, new Property (PropertyType.Text, 'Unit', UnitToString (unit)));
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user