Make all points shown in the Property Browser into active links
This makes all points explorable/selectable and fixes #165 partially. This is a clean implementation that follows the style of the UI code for the text window. Previous unmerged attempts from the above issue are:eb3db32059
782a5bbbe6
a77cedbfd8
41e55b3d79
This commit is contained in:
parent
3d482f0d52
commit
3eaa99cb25
@ -69,12 +69,16 @@ void TextWindow::DescribeSelection() {
|
|||||||
Entity *e = SK.GetEntity(gs.points == 1 ? gs.point[0] : gs.entity[0]);
|
Entity *e = SK.GetEntity(gs.points == 1 ? gs.point[0] : gs.entity[0]);
|
||||||
Vector p;
|
Vector p;
|
||||||
|
|
||||||
#define COSTR(p) \
|
#define COSTR_NO_LINK(p) \
|
||||||
SS.MmToString((p).x).c_str(), \
|
SS.MmToString((p).x).c_str(), \
|
||||||
SS.MmToString((p).y).c_str(), \
|
SS.MmToString((p).y).c_str(), \
|
||||||
SS.MmToString((p).z).c_str()
|
SS.MmToString((p).z).c_str()
|
||||||
#define PT_AS_STR "(%Fi%s%E, %Fi%s%E, %Fi%s%E)"
|
#define PT_AS_STR_NO_LINK "(%Fi%s%Fd, %Fi%s%Fd, %Fi%s%Fd)"
|
||||||
#define PT_AS_NUM "(%Fi%3%E, %Fi%3%E, %Fi%3%E)"
|
#define PT_AS_NUM "(%Fi%3%E, %Fi%3%E, %Fi%3%E)"
|
||||||
|
#define COSTR(e, p) \
|
||||||
|
e->h, (&TextWindow::ScreenSelectEntity), (&TextWindow::ScreenHoverEntity), \
|
||||||
|
COSTR_NO_LINK(p)
|
||||||
|
#define PT_AS_STR "%Ll%D%f%h" PT_AS_STR_NO_LINK "%E"
|
||||||
switch(e->type) {
|
switch(e->type) {
|
||||||
case Entity::Type::POINT_IN_3D:
|
case Entity::Type::POINT_IN_3D:
|
||||||
case Entity::Type::POINT_IN_2D:
|
case Entity::Type::POINT_IN_2D:
|
||||||
@ -83,7 +87,7 @@ void TextWindow::DescribeSelection() {
|
|||||||
case Entity::Type::POINT_N_COPY:
|
case Entity::Type::POINT_N_COPY:
|
||||||
case Entity::Type::POINT_N_ROT_AA:
|
case Entity::Type::POINT_N_ROT_AA:
|
||||||
p = e->PointGetNum();
|
p = e->PointGetNum();
|
||||||
Printf(false, "%FtPOINT%E at " PT_AS_STR, COSTR(p));
|
Printf(false, "%FtPOINT%E at " PT_AS_STR, COSTR(e, p));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Entity::Type::NORMAL_IN_3D:
|
case Entity::Type::NORMAL_IN_3D:
|
||||||
@ -104,7 +108,7 @@ void TextWindow::DescribeSelection() {
|
|||||||
case Entity::Type::WORKPLANE: {
|
case Entity::Type::WORKPLANE: {
|
||||||
p = SK.GetEntity(e->point[0])->PointGetNum();
|
p = SK.GetEntity(e->point[0])->PointGetNum();
|
||||||
Printf(false, "%FtWORKPLANE%E");
|
Printf(false, "%FtWORKPLANE%E");
|
||||||
Printf(true, " origin = " PT_AS_STR, COSTR(p));
|
Printf(true, " origin = " PT_AS_STR, COSTR(SK.GetEntity(e->point[0]), p));
|
||||||
Quaternion q = e->Normal()->NormalGetNum();
|
Quaternion q = e->Normal()->NormalGetNum();
|
||||||
p = q.RotationN();
|
p = q.RotationN();
|
||||||
Printf(true, " normal = " PT_AS_NUM, CO(p));
|
Printf(true, " normal = " PT_AS_NUM, CO(p));
|
||||||
@ -114,10 +118,10 @@ void TextWindow::DescribeSelection() {
|
|||||||
Vector p0 = SK.GetEntity(e->point[0])->PointGetNum();
|
Vector p0 = SK.GetEntity(e->point[0])->PointGetNum();
|
||||||
p = p0;
|
p = p0;
|
||||||
Printf(false, "%FtLINE SEGMENT%E");
|
Printf(false, "%FtLINE SEGMENT%E");
|
||||||
Printf(true, " thru " PT_AS_STR, COSTR(p));
|
Printf(true, " thru " PT_AS_STR, COSTR(SK.GetEntity(e->point[0]), p));
|
||||||
Vector p1 = SK.GetEntity(e->point[1])->PointGetNum();
|
Vector p1 = SK.GetEntity(e->point[1])->PointGetNum();
|
||||||
p = p1;
|
p = p1;
|
||||||
Printf(false, " " PT_AS_STR, COSTR(p));
|
Printf(false, " " PT_AS_STR, COSTR(SK.GetEntity(e->point[1]), p));
|
||||||
Printf(true, " len = %Fi%s%E",
|
Printf(true, " len = %Fi%s%E",
|
||||||
SS.MmToString((p1.Minus(p0).Magnitude())).c_str());
|
SS.MmToString((p1.Minus(p0).Magnitude())).c_str());
|
||||||
break;
|
break;
|
||||||
@ -137,18 +141,18 @@ void TextWindow::DescribeSelection() {
|
|||||||
}
|
}
|
||||||
for(int i = 0; i < pts; i++) {
|
for(int i = 0; i < pts; i++) {
|
||||||
p = SK.GetEntity(e->point[i])->PointGetNum();
|
p = SK.GetEntity(e->point[i])->PointGetNum();
|
||||||
Printf((i==0), " p%d = " PT_AS_STR, i, COSTR(p));
|
Printf((i==0), " p%d = " PT_AS_STR, i, COSTR(SK.GetEntity(e->point[i]), p));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Entity::Type::ARC_OF_CIRCLE: {
|
case Entity::Type::ARC_OF_CIRCLE: {
|
||||||
Printf(false, "%FtARC OF A CIRCLE%E");
|
Printf(false, "%FtARC OF A CIRCLE%E");
|
||||||
p = SK.GetEntity(e->point[0])->PointGetNum();
|
p = SK.GetEntity(e->point[0])->PointGetNum();
|
||||||
Printf(true, " center = " PT_AS_STR, COSTR(p));
|
Printf(true, " center = " PT_AS_STR, COSTR(SK.GetEntity(e->point[0]), p));
|
||||||
p = SK.GetEntity(e->point[1])->PointGetNum();
|
p = SK.GetEntity(e->point[1])->PointGetNum();
|
||||||
Printf(true, " endpoints = " PT_AS_STR, COSTR(p));
|
Printf(true, " endpoints = " PT_AS_STR, COSTR(SK.GetEntity(e->point[1]), p));
|
||||||
p = SK.GetEntity(e->point[2])->PointGetNum();
|
p = SK.GetEntity(e->point[2])->PointGetNum();
|
||||||
Printf(false, " " PT_AS_STR, COSTR(p));
|
Printf(false, " " PT_AS_STR, COSTR(SK.GetEntity(e->point[2]), p));
|
||||||
double r = e->CircleGetRadiusNum();
|
double r = e->CircleGetRadiusNum();
|
||||||
Printf(true, " diameter = %Fi%s", SS.MmToString(r*2).c_str());
|
Printf(true, " diameter = %Fi%s", SS.MmToString(r*2).c_str());
|
||||||
Printf(false, " radius = %Fi%s", SS.MmToString(r).c_str());
|
Printf(false, " radius = %Fi%s", SS.MmToString(r).c_str());
|
||||||
@ -160,7 +164,7 @@ void TextWindow::DescribeSelection() {
|
|||||||
case Entity::Type::CIRCLE: {
|
case Entity::Type::CIRCLE: {
|
||||||
Printf(false, "%FtCIRCLE%E");
|
Printf(false, "%FtCIRCLE%E");
|
||||||
p = SK.GetEntity(e->point[0])->PointGetNum();
|
p = SK.GetEntity(e->point[0])->PointGetNum();
|
||||||
Printf(true, " center = " PT_AS_STR, COSTR(p));
|
Printf(true, " center = " PT_AS_STR, COSTR(SK.GetEntity(e->point[0]), p));
|
||||||
double r = e->CircleGetRadiusNum();
|
double r = e->CircleGetRadiusNum();
|
||||||
Printf(true, " diameter = %Fi%s", SS.MmToString(r*2).c_str());
|
Printf(true, " diameter = %Fi%s", SS.MmToString(r*2).c_str());
|
||||||
Printf(false, " radius = %Fi%s", SS.MmToString(r).c_str());
|
Printf(false, " radius = %Fi%s", SS.MmToString(r).c_str());
|
||||||
@ -175,7 +179,7 @@ void TextWindow::DescribeSelection() {
|
|||||||
p = e->FaceGetNormalNum();
|
p = e->FaceGetNormalNum();
|
||||||
Printf(true, " normal = " PT_AS_NUM, CO(p));
|
Printf(true, " normal = " PT_AS_NUM, CO(p));
|
||||||
p = e->FaceGetPointNum();
|
p = e->FaceGetPointNum();
|
||||||
Printf(false, " thru = " PT_AS_STR, COSTR(p));
|
Printf(false, " thru = " PT_AS_STR, COSTR(e, p));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Entity::Type::TTF_TEXT: {
|
case Entity::Type::TTF_TEXT: {
|
||||||
@ -315,12 +319,12 @@ void TextWindow::DescribeSelection() {
|
|||||||
} else if(gs.n == 2 && gs.points == 2) {
|
} else if(gs.n == 2 && gs.points == 2) {
|
||||||
Printf(false, "%FtTWO POINTS");
|
Printf(false, "%FtTWO POINTS");
|
||||||
Vector p0 = SK.GetEntity(gs.point[0])->PointGetNum();
|
Vector p0 = SK.GetEntity(gs.point[0])->PointGetNum();
|
||||||
Printf(true, " at " PT_AS_STR, COSTR(p0));
|
Printf(true, " at " PT_AS_STR, COSTR(SK.GetEntity(gs.point[0]), p0));
|
||||||
Vector p1 = SK.GetEntity(gs.point[1])->PointGetNum();
|
Vector p1 = SK.GetEntity(gs.point[1])->PointGetNum();
|
||||||
Printf(false, " " PT_AS_STR, COSTR(p1));
|
Printf(false, " " PT_AS_STR, COSTR(SK.GetEntity(gs.point[1]), p1));
|
||||||
Vector dv = p1.Minus(p0);
|
Vector dv = p1.Minus(p0);
|
||||||
Printf(true, " d = %Fi%s", SS.MmToString(dv.Magnitude()).c_str());
|
Printf(true, " d = %Fi%s", SS.MmToString(dv.Magnitude()).c_str());
|
||||||
Printf(false, " d(x, y, z) = " PT_AS_STR, COSTR(dv));
|
Printf(false, " d(x, y, z) = " PT_AS_STR_NO_LINK, COSTR_NO_LINK(dv));
|
||||||
} else if(gs.n == 2 && gs.points == 1 && gs.circlesOrArcs == 1) {
|
} else if(gs.n == 2 && gs.points == 1 && gs.circlesOrArcs == 1) {
|
||||||
Entity *ec = SK.GetEntity(gs.entity[0]);
|
Entity *ec = SK.GetEntity(gs.entity[0]);
|
||||||
if(ec->type == Entity::Type::CIRCLE) {
|
if(ec->type == Entity::Type::CIRCLE) {
|
||||||
@ -329,9 +333,9 @@ void TextWindow::DescribeSelection() {
|
|||||||
Printf(false, "%FtPOINT AND AN ARC");
|
Printf(false, "%FtPOINT AND AN ARC");
|
||||||
} else ssassert(false, "Unexpected entity type");
|
} else ssassert(false, "Unexpected entity type");
|
||||||
Vector p = SK.GetEntity(gs.point[0])->PointGetNum();
|
Vector p = SK.GetEntity(gs.point[0])->PointGetNum();
|
||||||
Printf(true, " pt at " PT_AS_STR, COSTR(p));
|
Printf(true, " pt at " PT_AS_STR, COSTR(SK.GetEntity(gs.point[0]), p));
|
||||||
Vector c = SK.GetEntity(ec->point[0])->PointGetNum();
|
Vector c = SK.GetEntity(ec->point[0])->PointGetNum();
|
||||||
Printf(true, " center = " PT_AS_STR, COSTR(c));
|
Printf(true, " center = " PT_AS_STR, COSTR(SK.GetEntity(ec->point[0]), c));
|
||||||
double r = ec->CircleGetRadiusNum();
|
double r = ec->CircleGetRadiusNum();
|
||||||
Printf(false, " diameter = %Fi%s", SS.MmToString(r*2).c_str());
|
Printf(false, " diameter = %Fi%s", SS.MmToString(r*2).c_str());
|
||||||
Printf(false, " radius = %Fi%s", SS.MmToString(r).c_str());
|
Printf(false, " radius = %Fi%s", SS.MmToString(r).c_str());
|
||||||
@ -340,19 +344,19 @@ void TextWindow::DescribeSelection() {
|
|||||||
} else if(gs.n == 2 && gs.faces == 1 && gs.points == 1) {
|
} else if(gs.n == 2 && gs.faces == 1 && gs.points == 1) {
|
||||||
Printf(false, "%FtA POINT AND A PLANE FACE");
|
Printf(false, "%FtA POINT AND A PLANE FACE");
|
||||||
Vector pt = SK.GetEntity(gs.point[0])->PointGetNum();
|
Vector pt = SK.GetEntity(gs.point[0])->PointGetNum();
|
||||||
Printf(true, " point = " PT_AS_STR, COSTR(pt));
|
Printf(true, " point = " PT_AS_STR, COSTR(SK.GetEntity(gs.point[0]), pt));
|
||||||
Vector n = SK.GetEntity(gs.face[0])->FaceGetNormalNum();
|
Vector n = SK.GetEntity(gs.face[0])->FaceGetNormalNum();
|
||||||
Printf(true, " plane normal = " PT_AS_NUM, CO(n));
|
Printf(true, " plane normal = " PT_AS_NUM, CO(n));
|
||||||
Vector pl = SK.GetEntity(gs.face[0])->FaceGetPointNum();
|
Vector pl = SK.GetEntity(gs.face[0])->FaceGetPointNum();
|
||||||
Printf(false, " plane thru = " PT_AS_STR, COSTR(pl));
|
Printf(false, " plane thru = " PT_AS_STR, COSTR(SK.GetEntity(gs.face[0]), pl));
|
||||||
double dd = n.Dot(pl) - n.Dot(pt);
|
double dd = n.Dot(pl) - n.Dot(pt);
|
||||||
Printf(true, " distance = %Fi%s", SS.MmToString(dd).c_str());
|
Printf(true, " distance = %Fi%s", SS.MmToString(dd).c_str());
|
||||||
} else if(gs.n == 3 && gs.points == 2 && gs.vectors == 1) {
|
} else if(gs.n == 3 && gs.points == 2 && gs.vectors == 1) {
|
||||||
Printf(false, "%FtTWO POINTS AND A VECTOR");
|
Printf(false, "%FtTWO POINTS AND A VECTOR");
|
||||||
Vector p0 = SK.GetEntity(gs.point[0])->PointGetNum();
|
Vector p0 = SK.GetEntity(gs.point[0])->PointGetNum();
|
||||||
Printf(true, " pointA = " PT_AS_STR, COSTR(p0));
|
Printf(true, " pointA = " PT_AS_STR, COSTR(SK.GetEntity(gs.point[0]), p0));
|
||||||
Vector p1 = SK.GetEntity(gs.point[1])->PointGetNum();
|
Vector p1 = SK.GetEntity(gs.point[1])->PointGetNum();
|
||||||
Printf(false, " pointB = " PT_AS_STR, COSTR(p1));
|
Printf(false, " pointB = " PT_AS_STR, COSTR(SK.GetEntity(gs.point[1]), p1));
|
||||||
Vector v = SK.GetEntity(gs.vector[0])->VectorGetNum();
|
Vector v = SK.GetEntity(gs.vector[0])->VectorGetNum();
|
||||||
v = v.WithMagnitude(1);
|
v = v.WithMagnitude(1);
|
||||||
Printf(true, " vector = " PT_AS_NUM, CO(v));
|
Printf(true, " vector = " PT_AS_NUM, CO(v));
|
||||||
@ -363,11 +367,11 @@ void TextWindow::DescribeSelection() {
|
|||||||
Vector lp0 = SK.GetEntity(ln->point[0])->PointGetNum(),
|
Vector lp0 = SK.GetEntity(ln->point[0])->PointGetNum(),
|
||||||
lp1 = SK.GetEntity(ln->point[1])->PointGetNum();
|
lp1 = SK.GetEntity(ln->point[1])->PointGetNum();
|
||||||
Printf(false, "%FtLINE SEGMENT AND POINT%E");
|
Printf(false, "%FtLINE SEGMENT AND POINT%E");
|
||||||
Printf(true, " ln thru " PT_AS_STR, COSTR(lp0));
|
Printf(true, " ln thru " PT_AS_STR, COSTR(SK.GetEntity(ln->point[0]), lp0));
|
||||||
Printf(false, " " PT_AS_STR, COSTR(lp1));
|
Printf(false, " " PT_AS_STR, COSTR(SK.GetEntity(ln->point[1]), lp1));
|
||||||
Entity *p = SK.GetEntity(gs.point[0]);
|
Entity *p = SK.GetEntity(gs.point[0]);
|
||||||
Vector pp = p->PointGetNum();
|
Vector pp = p->PointGetNum();
|
||||||
Printf(true, " point " PT_AS_STR, COSTR(pp));
|
Printf(true, " point " PT_AS_STR, COSTR(p, pp));
|
||||||
Printf(true, " pt-ln distance = %Fi%s%E",
|
Printf(true, " pt-ln distance = %Fi%s%E",
|
||||||
SS.MmToString(pp.DistanceToLine(lp0, lp1.Minus(lp0))).c_str());
|
SS.MmToString(pp.DistanceToLine(lp0, lp1.Minus(lp0))).c_str());
|
||||||
hEntity wrkpl = SS.GW.ActiveWorkplane();
|
hEntity wrkpl = SS.GW.ActiveWorkplane();
|
||||||
@ -400,12 +404,12 @@ void TextWindow::DescribeSelection() {
|
|||||||
Vector n0 = SK.GetEntity(gs.face[0])->FaceGetNormalNum();
|
Vector n0 = SK.GetEntity(gs.face[0])->FaceGetNormalNum();
|
||||||
Printf(true, " planeA normal = " PT_AS_NUM, CO(n0));
|
Printf(true, " planeA normal = " PT_AS_NUM, CO(n0));
|
||||||
Vector p0 = SK.GetEntity(gs.face[0])->FaceGetPointNum();
|
Vector p0 = SK.GetEntity(gs.face[0])->FaceGetPointNum();
|
||||||
Printf(false, " planeA thru = " PT_AS_STR, COSTR(p0));
|
Printf(false, " planeA thru = " PT_AS_STR, COSTR(SK.GetEntity(gs.face[0]), p0));
|
||||||
|
|
||||||
Vector n1 = SK.GetEntity(gs.face[1])->FaceGetNormalNum();
|
Vector n1 = SK.GetEntity(gs.face[1])->FaceGetNormalNum();
|
||||||
Printf(true, " planeB normal = " PT_AS_NUM, CO(n1));
|
Printf(true, " planeB normal = " PT_AS_NUM, CO(n1));
|
||||||
Vector p1 = SK.GetEntity(gs.face[1])->FaceGetPointNum();
|
Vector p1 = SK.GetEntity(gs.face[1])->FaceGetPointNum();
|
||||||
Printf(false, " planeB thru = " PT_AS_STR, COSTR(p1));
|
Printf(false, " planeB thru = " PT_AS_STR, COSTR(SK.GetEntity(gs.face[1]), p1));
|
||||||
|
|
||||||
double theta = acos(n0.Dot(n1));
|
double theta = acos(n0.Dot(n1));
|
||||||
Printf(true, " angle = %Fi%2%E degrees", theta*180/PI);
|
Printf(true, " angle = %Fi%2%E degrees", theta*180/PI);
|
||||||
|
Loading…
Reference in New Issue
Block a user