Revision: 57143
http://sourceforge.net/p/brlcad/code/57143
Author: indianlarry
Date: 2013-08-26 16:52:00 +0000 (Mon, 26 Aug 2013)
Log Message:
-----------
Merging trunk into branch 'nurbs' r:57137:57142
Modified Paths:
--------------
brlcad/branches/nurbs/TODO
brlcad/branches/nurbs/doc/docbook/system/mann/en/attr.xml
brlcad/branches/nurbs/include/icv.h
brlcad/branches/nurbs/src/conv/step/g-step/ON_Brep.cpp
brlcad/branches/nurbs/src/libdm/dm-ogl.c
brlcad/branches/nurbs/src/libdm/dm-wgl.c
brlcad/branches/nurbs/src/libged/attr.c
brlcad/branches/nurbs/src/libged/dg_obj.c
brlcad/branches/nurbs/src/libged/draw.c
brlcad/branches/nurbs/src/mged/dodraw.c
Property Changed:
----------------
brlcad/branches/nurbs/
Index: brlcad/branches/nurbs
===================================================================
--- brlcad/branches/nurbs 2013-08-26 16:21:57 UTC (rev 57142)
+++ brlcad/branches/nurbs 2013-08-26 16:52:00 UTC (rev 57143)
Property changes on: brlcad/branches/nurbs
___________________________________________________________________
Modified: svn:ignore
## -1,2 +1,3 ##
bin
lib
+.project
Modified: brlcad/branches/nurbs/TODO
===================================================================
--- brlcad/branches/nurbs/TODO 2013-08-26 16:21:57 UTC (rev 57142)
+++ brlcad/branches/nurbs/TODO 2013-08-26 16:52:00 UTC (rev 57143)
@@ -1014,8 +1014,9 @@
need to left-pad a space conditionally, perhaps by supporting %*s
and sizeof(var).
-* add support for user-specified sorting for the attr command (case,
- case-insensitive, creation, value, etc.)
+* add additional support for user-specified sorting for the attr
+ command when new attribute attributes are added (e.g., creation
+ date)
* binary attributes, see binary-incompatible section for details.
Modified: brlcad/branches/nurbs/doc/docbook/system/mann/en/attr.xml
===================================================================
--- brlcad/branches/nurbs/doc/docbook/system/mann/en/attr.xml 2013-08-26
16:21:57 UTC (rev 57142)
+++ brlcad/branches/nurbs/doc/docbook/system/mann/en/attr.xml 2013-08-26
16:52:00 UTC (rev 57143)
@@ -24,6 +24,7 @@
<arg choice="opt" rep="norepeat">rm</arg>
<arg choice="opt" rep="norepeat">append</arg>
<arg choice="opt" rep="norepeat">show</arg>
+ <arg choice="opt" rep="norepeat">sort</arg>
<arg choice="req"
rep="norepeat"><replaceable>object_name</replaceable></arg>
<arg choice="opt" rep="norepeat"><replaceable>arguments</replaceable></arg>
</cmdsynopsis>
@@ -35,7 +36,8 @@
Used to create, change, retrieve, or view attributes of database
objects. The arguments for "set" and "append" subcommands are attribute
name/value pairs. The arguments for "get," "rm," and "show" subcommands are
- attribute names. The "set" subcommand sets the specified attributes for
the object.
+ attribute names. The arguments for the "sort" subcommand sets the sort
type for the
+ attributes of the object: 'case' (default), 'nocase', 'value', and
'value-nocase'.
The "append" subcommand appends the provided value to an existing
attribute, or
creates a new attribute if it does not already exist. The "get" subcommand
retrieves
and displays the specified attributes. The "rm" subcommand deletes the
specified
Modified: brlcad/branches/nurbs/include/icv.h
===================================================================
--- brlcad/branches/nurbs/include/icv.h 2013-08-26 16:21:57 UTC (rev 57142)
+++ brlcad/branches/nurbs/include/icv.h 2013-08-26 16:52:00 UTC (rev 57143)
@@ -253,14 +253,14 @@
} ICV_COLOR;
/**
- * converts image to single channel image by combining three weights
+ * converts image to single channel image by combining three weights
* based on NTSC primaries and 6500 white.
*/
#define icv_rgb2gray_ntsc(_a) icv_rgb2gray(_a, ICV_COLOR_RGB, 0.30, 0.59, 0.11)
/**
- * converts image to single channel image by combining three using
- * weights based on CRT phosphor and D6500 white.
+ * converts image to single channel image by combining three weights
+ * based on CRT phosphor and D6500 white.
*/
#define icv_rgb2gray_crt(_a) icv_rgb2gray(_a, ICV_COLOR_RGB, 0.26, 0.66, 0.08)
Modified: brlcad/branches/nurbs/src/conv/step/g-step/ON_Brep.cpp
===================================================================
--- brlcad/branches/nurbs/src/conv/step/g-step/ON_Brep.cpp 2013-08-26
16:21:57 UTC (rev 57142)
+++ brlcad/branches/nurbs/src/conv/step/g-step/ON_Brep.cpp 2013-08-26
16:52:00 UTC (rev 57143)
@@ -431,7 +431,7 @@
/* Defining a shape is necessary for at least some systems, but how
* this is done does not appear to be at all uniform between the
- * outputs from various systems. Rhino ouputs a shape definition representation
+ * outputs from various systems. Rhino outputs a shape definition
representation
* that does not directly reference the Brep, and instead uses a shape
* representation relationship. Creo, on the other hand, appears to reference
* the Brep directly in the shape definition representation and does not have
Modified: brlcad/branches/nurbs/src/libdm/dm-ogl.c
===================================================================
--- brlcad/branches/nurbs/src/libdm/dm-ogl.c 2013-08-26 16:21:57 UTC (rev
57142)
+++ brlcad/branches/nurbs/src/libdm/dm-ogl.c 2013-08-26 16:52:00 UTC (rev
57143)
@@ -1629,10 +1629,14 @@
register int first;
register int mflag = 1;
static float black[4] = {0.0, 0.0, 0.0, 0.0};
+ GLdouble pointsize = -1.0; /* initialize to unsavory point size */
if (dmp->dm_debugLevel)
bu_log("ogl_drawVList()\n");
+ /* get incoming point size to restore after drawing loop */
+ glGetDoublev(GL_POINT_SIZE, &pointsize);
+
/* Viewing region is from -1.0 to +1.0 */
first = 1;
for (BU_LIST_FOR(tvp, bn_vlist, &vp->l)) {
@@ -1734,7 +1738,7 @@
if (first == 0)
glEnd();
first = 0;
- glPointSize(1.0);
+ glPointSize((GLfloat)3.0);
glBegin(GL_POINTS);
glVertex3dv(dpt);
break;
@@ -1745,6 +1749,9 @@
if (first == 0)
glEnd();
+ /* restore incoming point size */
+ glPointSize((GLfloat)pointsize);
+
if (dmp->dm_light && dmp->dm_transparency)
glDisable(GL_BLEND);
Modified: brlcad/branches/nurbs/src/libdm/dm-wgl.c
===================================================================
--- brlcad/branches/nurbs/src/libdm/dm-wgl.c 2013-08-26 16:21:57 UTC (rev
57142)
+++ brlcad/branches/nurbs/src/libdm/dm-wgl.c 2013-08-26 16:52:00 UTC (rev
57143)
@@ -1114,10 +1114,14 @@
register int first;
register int mflag = 1;
float black[4] = {0.0, 0.0, 0.0, 0.0};
+ GLdouble pointsize = -1.0; /* initialize to unsavory point size */
if (dmp->dm_debugLevel)
bu_log("wgl_drawVList()\n");
+ /* get incoming point size to restore after drawing loop */
+ glGetDoublev(GL_POINT_SIZE, &pointsize);
+
/* Viewing region is from -1.0 to +1.0 */
first = 1;
for (BU_LIST_FOR(tvp, bn_vlist, &vp->l)) {
@@ -1218,6 +1222,14 @@
VMOVE(glpt, *pt);
glNormal3dv(glpt);
break;
+ case BN_VLIST_POINT_DRAW:
+ if (first == 0)
+ glEnd();
+ first = 0;
+ glPointSize((GLfloat)3.0);
+ glBegin(GL_POINTS);
+ glVertex3dv(dpt);
+ break;
}
}
}
@@ -1225,6 +1237,9 @@
if (first == 0)
glEnd();
+ /* restore incoming point size */
+ glPointSize((GLfloat)pointsize);
+
if (dmp->dm_light && dmp->dm_transparency)
glDisable(GL_BLEND);
Modified: brlcad/branches/nurbs/src/libged/attr.c
===================================================================
--- brlcad/branches/nurbs/src/libged/attr.c 2013-08-26 16:21:57 UTC (rev
57142)
+++ brlcad/branches/nurbs/src/libged/attr.c 2013-08-26 16:52:00 UTC (rev
57143)
@@ -40,16 +40,74 @@
((struct bu_attribute_value_pair *)p2)->name);
}
+int
+_ged_cmpattr_nocase(const void *p1, const void *p2)
+{
+ return bu_strcasecmp(((struct bu_attribute_value_pair *)p1)->name,
+ ((struct bu_attribute_value_pair *)p2)->name);
+}
int
+_ged_cmpattr_value(const void *p1, const void *p2)
+{
+ return bu_strcmp(((struct bu_attribute_value_pair *)p1)->value,
+ ((struct bu_attribute_value_pair *)p2)->value);
+}
+
+int
+_ged_cmpattr_value_nocase(const void *p1, const void *p2)
+{
+ return bu_strcasecmp(((struct bu_attribute_value_pair *)p1)->value,
+ ((struct bu_attribute_value_pair *)p2)->value);
+}
+
+int
+_ged_pretty_print(struct ged *gedp, struct directory *dp, const char *name)
+{
+ if (dp->d_flags & RT_DIR_COMB) {
+ if (dp->d_flags & RT_DIR_REGION) {
+ bu_vls_printf(gedp->ged_result_str, "%s region:\n", name);
+ } else {
+ bu_vls_printf(gedp->ged_result_str, "%s combination:\n", name);
+ }
+ } else if (dp->d_flags & RT_DIR_SOLID) {
+ struct rt_db_internal intern;
+ GED_DB_GET_INTERNAL(gedp, &intern, dp, (fastf_t *)NULL, &rt_uniresource,
GED_ERROR);
+ bu_vls_printf(gedp->ged_result_str, "%s %s:\n", name,
intern.idb_meth->ft_label);
+ rt_db_free_internal(&intern);
+
+ } else {
+ switch (dp->d_major_type) {
+ case DB5_MAJORTYPE_ATTRIBUTE_ONLY:
+ bu_vls_printf(gedp->ged_result_str, "%s global:\n", name);
+ break;
+ case DB5_MAJORTYPE_BINARY_MIME:
+ bu_vls_printf(gedp->ged_result_str, "%s binary(mime):\n", name);
+ break;
+ case DB5_MAJORTYPE_BINARY_UNIF:
+ bu_vls_printf(gedp->ged_result_str, "%s %s:\n", name,
+ binu_types[dp->d_minor_type]);
+ break;
+ }
+ }
+
+ return GED_OK;
+}
+
+int
ged_attr(struct ged *gedp, int argc, const char *argv[])
{
size_t i;
struct directory *dp;
struct bu_attribute_value_set avs;
struct bu_attribute_value_pair *avpp;
- static const char *usage = "{set|get|show|rm|append} object [key [value]
... ]";
+ static const char *usage = "{set|get|show|rm|append|sort} object [key
[value] ... ]";
+ const char CASE[] = "case";
+ const char NOCASE[] = "nocase";
+ const char VALUE[] = "value";
+ const char VALUE_NOCASE[] = "value-nocase";
+
GED_CHECK_DATABASE_OPEN(gedp, GED_ERROR);
GED_CHECK_ARGC_GT_0(gedp, argc, GED_ERROR);
@@ -85,11 +143,50 @@
return GED_ERROR;
}
- /* sort attribute-value set array by attribute name */
+ /* default: sort attribute-value set array by attribute name (case
sensitive) */
qsort(&avs.avp[0], avs.count, sizeof(struct bu_attribute_value_pair),
_ged_cmpattr);
- if (BU_STR_EQUAL(argv[1], "get")) {
+ if (BU_STR_EQUAL(argv[1], "sort")) {
+ int max_attr_name_len = 0;
+
+ /* pretty print */
+ if ((_ged_pretty_print(gedp, dp, argv[2])) != GED_OK)
+ return GED_ERROR;
+
+ for (i = 0, avpp = avs.avp; i < avs.count; i++, avpp++) {
+ int len = (int)strlen(avpp->name);
+ if (len > max_attr_name_len) {
+ max_attr_name_len = len;
+ }
+ }
+
if (argc == 3) {
+ /* just list the already sorted attribute-value pairs */
+ for (i = 0, avpp = avs.avp; i < avs.count; i++, avpp++) {
+ bu_vls_printf(gedp->ged_result_str, "\t%-*.*s %s\n",
+ max_attr_name_len, max_attr_name_len,
+ avpp->name, avpp->value);
+ }
+ } else {
+ /* argv[3] is the sort type: 'case', 'nocase', 'value',
'value-nocase' */
+ if (BU_STR_EQUAL(argv[3], NOCASE)) {
+ qsort(&avs.avp[0], avs.count, sizeof(struct
bu_attribute_value_pair), _ged_cmpattr_nocase);
+ } else if (BU_STR_EQUAL(argv[3], VALUE)) {
+ qsort(&avs.avp[0], avs.count, sizeof(struct
bu_attribute_value_pair), _ged_cmpattr_value);
+ } else if (BU_STR_EQUAL(argv[3], VALUE_NOCASE)) {
+ qsort(&avs.avp[0], avs.count, sizeof(struct
bu_attribute_value_pair), _ged_cmpattr_value_nocase);
+ } else if (BU_STR_EQUAL(argv[3], CASE)) {
+ ; /* don't need to do anything */
+ }
+ /* now list all the attributes */
+ for (i = 0, avpp = avs.avp; i < avs.count; i++, avpp++) {
+ bu_vls_printf(gedp->ged_result_str, "\t%-*.*s %s\n",
+ max_attr_name_len, max_attr_name_len,
+ avpp->name, avpp->value);
+ }
+ }
+ } else if (BU_STR_EQUAL(argv[1], "get")) {
+ if (argc == 3) {
/* just list all the attributes */
for (i = 0, avpp = avs.avp; i < avs.count; i++, avpp++) {
bu_vls_printf(gedp->ged_result_str, "%s {%s} ", avpp->name,
avpp->value);
@@ -167,7 +264,7 @@
} else if (BU_STR_EQUAL(argv[1], "append")) {
GED_CHECK_READ_ONLY(gedp, GED_ERROR);
- if ((argc-3)%2) {
+ if ((argc-3) % 2) {
bu_vls_printf(gedp->ged_result_str,
"Error: attribute names and values must be in
pairs!!!\n");
bu_avs_free(&avs);
@@ -207,32 +304,9 @@
int tabs1 = 0;
/* pretty print */
- if (dp->d_flags & RT_DIR_COMB) {
- if (dp->d_flags & RT_DIR_REGION) {
- bu_vls_printf(gedp->ged_result_str, "%s region:\n", argv[2]);
- } else {
- bu_vls_printf(gedp->ged_result_str, "%s combination:\n",
argv[2]);
- }
- } else if (dp->d_flags & RT_DIR_SOLID) {
- struct rt_db_internal intern;
- GED_DB_GET_INTERNAL(gedp, &intern, dp, (fastf_t *)NULL,
&rt_uniresource, GED_ERROR);
- bu_vls_printf(gedp->ged_result_str, "%s %s:\n", argv[2],
intern.idb_meth->ft_label);
- rt_db_free_internal(&intern);
+ if ((_ged_pretty_print(gedp, dp, argv[2])) != GED_OK)
+ return GED_ERROR;
- } else {
- switch (dp->d_major_type) {
- case DB5_MAJORTYPE_ATTRIBUTE_ONLY:
- bu_vls_printf(gedp->ged_result_str, "%s global:\n",
argv[2]);
- break;
- case DB5_MAJORTYPE_BINARY_MIME:
- bu_vls_printf(gedp->ged_result_str, "%s binary(mime):\n",
argv[2]);
- break;
- case DB5_MAJORTYPE_BINARY_UNIF:
- bu_vls_printf(gedp->ged_result_str, "%s %s:\n", argv[2],
- binu_types[dp->d_minor_type]);
- break;
- }
- }
if (argc == 3) {
/* just display all attributes */
for (i = 0, avpp = avs.avp; i < avs.count; i++, avpp++) {
Modified: brlcad/branches/nurbs/src/libged/dg_obj.c
===================================================================
--- brlcad/branches/nurbs/src/libged/dg_obj.c 2013-08-26 16:21:57 UTC (rev
57142)
+++ brlcad/branches/nurbs/src/libged/dg_obj.c 2013-08-26 16:52:00 UTC (rev
57143)
@@ -3319,6 +3319,8 @@
switch (*cmd) {
case BN_VLIST_POLY_START:
case BN_VLIST_POLY_VERTNORM:
+ case BN_VLIST_TRI_START:
+ case BN_VLIST_TRI_VERTNORM:
/* Has normal vector, not location */
break;
case BN_VLIST_LINE_MOVE:
@@ -3326,6 +3328,9 @@
case BN_VLIST_POLY_MOVE:
case BN_VLIST_POLY_DRAW:
case BN_VLIST_POLY_END:
+ case BN_VLIST_TRI_MOVE:
+ case BN_VLIST_TRI_DRAW:
+ case BN_VLIST_TRI_END:
V_MIN(xmin, (*pt)[X]);
V_MAX(xmax, (*pt)[X]);
V_MIN(ymin, (*pt)[Y]);
@@ -3333,6 +3338,14 @@
V_MIN(zmin, (*pt)[Z]);
V_MAX(zmax, (*pt)[Z]);
break;
+ case BN_VLIST_POINT_DRAW:
+ V_MIN(xmin, (*pt)[X]-1.0);
+ V_MAX(xmax, (*pt)[X]+1.0);
+ V_MIN(ymin, (*pt)[Y]-1.0);
+ V_MAX(ymax, (*pt)[Y]+1.0);
+ V_MIN(zmin, (*pt)[Z]-1.0);
+ V_MAX(zmax, (*pt)[Z]+1.0);
+ break;
default: {
struct bu_vls tmp_vls;
Modified: brlcad/branches/nurbs/src/libged/draw.c
===================================================================
--- brlcad/branches/nurbs/src/libged/draw.c 2013-08-26 16:21:57 UTC (rev
57142)
+++ brlcad/branches/nurbs/src/libged/draw.c 2013-08-26 16:52:00 UTC (rev
57143)
@@ -253,7 +253,6 @@
case BN_VLIST_TRI_MOVE:
case BN_VLIST_TRI_DRAW:
case BN_VLIST_TRI_END:
- case BN_VLIST_POINT_DRAW:
V_MIN(xmin, (*pt)[X]);
V_MAX(xmax, (*pt)[X]);
V_MIN(ymin, (*pt)[Y]);
@@ -261,6 +260,14 @@
V_MIN(zmin, (*pt)[Z]);
V_MAX(zmax, (*pt)[Z]);
break;
+ case BN_VLIST_POINT_DRAW:
+ V_MIN(xmin, (*pt)[X]-1.0);
+ V_MAX(xmax, (*pt)[X]+1.0);
+ V_MIN(ymin, (*pt)[Y]-1.0);
+ V_MAX(ymax, (*pt)[Y]+1.0);
+ V_MIN(zmin, (*pt)[Z]-1.0);
+ V_MAX(zmax, (*pt)[Z]+1.0);
+ break;
default:
bu_vls_printf(gedp->ged_result_str, "unknown vlist op
%d\n", *cmd);
}
@@ -1582,6 +1589,7 @@
int last_opt=0;
struct bu_vls vls = BU_VLS_INIT_ZERO;
static const char *usage = "<[-R -C#/#/# -s] objects> | <-o -A attribute
name/value pairs>";
+ int64_t elapsetime;
GED_CHECK_DATABASE_OPEN(gedp, GED_ERROR);
GED_CHECK_DRAWABLE(gedp, GED_ERROR);
@@ -1596,6 +1604,7 @@
return GED_HELP;
}
+ elapsetime = bu_gettime();
/* skip past cmd */
--argc;
++argv;
@@ -1763,7 +1772,19 @@
_ged_drawtrees(gedp, argc, argv, kind, (struct _ged_client_data
*)0);
}
}
+ elapsetime = bu_gettime() - elapsetime;
+ {
+ int seconds = elapsetime / 1000000;
+ int minutes = seconds / 60;
+ int hours = minutes / 60;
+ minutes = minutes % 60;
+ seconds = seconds %60;
+
+ bu_vls_printf(gedp->ged_result_str, "Elapse time:
%02d:%02d:%02d\n", hours, minutes,seconds);
+ return GED_HELP;
+ }
+
return GED_OK;
}
Modified: brlcad/branches/nurbs/src/mged/dodraw.c
===================================================================
--- brlcad/branches/nurbs/src/mged/dodraw.c 2013-08-26 16:21:57 UTC (rev
57142)
+++ brlcad/branches/nurbs/src/mged/dodraw.c 2013-08-26 16:52:00 UTC (rev
57143)
@@ -154,7 +154,6 @@
case BN_VLIST_TRI_MOVE:
case BN_VLIST_TRI_DRAW:
case BN_VLIST_TRI_END:
- case BN_VLIST_POINT_DRAW:
V_MIN(xmin, (*pt)[X]);
V_MAX(xmax, (*pt)[X]);
V_MIN(ymin, (*pt)[Y]);
@@ -162,6 +161,14 @@
V_MIN(zmin, (*pt)[Z]);
V_MAX(zmax, (*pt)[Z]);
break;
+ case BN_VLIST_POINT_DRAW:
+ V_MIN(xmin, (*pt)[X]-1.0);
+ V_MAX(xmax, (*pt)[X]+1.0);
+ V_MIN(ymin, (*pt)[Y]-1.0);
+ V_MAX(ymax, (*pt)[Y]+1.0);
+ V_MIN(zmin, (*pt)[Z]-1.0);
+ V_MAX(zmax, (*pt)[Z]+1.0);
+ break;
default:
{
struct bu_vls tmp_vls = BU_VLS_INIT_ZERO;
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Introducing Performance Central, a new site from SourceForge and
AppDynamics. Performance Central is your source for news, insights,
analysis and resources for efficient Application Performance Management.
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits