Revision: 75765
http://sourceforge.net/p/brlcad/code/75765
Author: d_rossberg
Date: 2020-05-12 12:03:28 +0000 (Tue, 12 May 2020)
Log Message:
-----------
made Pipe and Sketch live: read from and write to database
Modified Paths:
--------------
rt^3/trunk/src/coreInterface/ConstDatabase.cpp
rt^3/trunk/src/coreInterface/Database.cpp
rt^3/trunk/src/coreInterface/Pipe.cpp
rt^3/trunk/src/coreInterface/private.h
Modified: rt^3/trunk/src/coreInterface/ConstDatabase.cpp
===================================================================
--- rt^3/trunk/src/coreInterface/ConstDatabase.cpp 2020-05-11 23:37:51 UTC
(rev 75764)
+++ rt^3/trunk/src/coreInterface/ConstDatabase.cpp 2020-05-12 12:03:28 UTC
(rev 75765)
@@ -41,6 +41,7 @@
#include <brlcad/Halfspace.h>
#include <brlcad/Sphere.h>
#include <brlcad/NonManifoldGeometry.h>
+#include <brlcad/Pipe.h>
#include <brlcad/Particle.h>
#include <brlcad/ParabolicCylinder.h>
#include <brlcad/HyperbolicCylinder.h>
@@ -47,6 +48,7 @@
#include <brlcad/Paraboloid.h>
#include <brlcad/Hyperboloid.h>
#include <brlcad/EllipticalTorus.h>
+#include <brlcad/Sketch.h>
#include <brlcad/BagOfTriangles.h>
#include <brlcad/Combination.h>
#include <brlcad/Unknown.h>
@@ -297,6 +299,10 @@
callback(NonManifoldGeometry(m_resp, pDir,
&intern, m_rtip->rti_dbip));
break;
+ case ID_PIPE: // 15
+ callback(Pipe(m_resp, pDir, &intern,
m_rtip->rti_dbip));
+ break;
+
case ID_PARTICLE: // 16
callback(Particle(m_resp, pDir, &intern,
m_rtip->rti_dbip));
break;
@@ -321,6 +327,10 @@
callback(EllipticalTorus(m_resp, pDir, &intern,
m_rtip->rti_dbip));
break;
+ case ID_SKETCH: // 26
+ callback(Sketch(m_resp, pDir, &intern,
m_rtip->rti_dbip));
+ break;
+
case ID_BOT: // 30
callback(BagOfTriangles(m_resp, pDir, &intern,
m_rtip->rti_dbip));
break;
Modified: rt^3/trunk/src/coreInterface/Database.cpp
===================================================================
--- rt^3/trunk/src/coreInterface/Database.cpp 2020-05-11 23:37:51 UTC (rev
75764)
+++ rt^3/trunk/src/coreInterface/Database.cpp 2020-05-12 12:03:28 UTC (rev
75765)
@@ -42,6 +42,7 @@
#include <brlcad/Halfspace.h>
#include <brlcad/Sphere.h>
#include <brlcad/NonManifoldGeometry.h>
+#include <brlcad/Pipe.h>
#include <brlcad/Particle.h>
#include <brlcad/ParabolicCylinder.h>
#include <brlcad/HyperbolicCylinder.h>
@@ -48,6 +49,7 @@
#include <brlcad/Paraboloid.h>
#include <brlcad/Hyperboloid.h>
#include <brlcad/EllipticalTorus.h>
+#include <brlcad/Sketch.h>
#include <brlcad/BagOfTriangles.h>
#include <brlcad/Combination.h>
#include <brlcad/Database.h>
@@ -168,6 +170,15 @@
rtInternal = nmg_clone_model(nmg->Internal());
}
+ else if (object.Type() == Pipe::ClassName()) {
+ id = ID_PIPE; // 15
+
+ const Pipe* pipe = dynamic_cast<const Pipe*>(&object);
+
+ assert(pipe != 0);
+
+ rtInternal = ClonePipeInternal(*(pipe->Internal()));
+ }
else if (object.Type() == Particle::ClassName()) {
id = ID_PARTICLE; // 16
@@ -228,6 +239,15 @@
BU_GET(rtInternal, rt_eto_internal);
memcpy(rtInternal, ellipticalTorus->Internal(),
sizeof(rt_eto_internal));
}
+ else if (object.Type() == Sketch::ClassName()) {
+ id = ID_SKETCH; // 26
+
+ const Sketch* sketch = dynamic_cast<const Sketch*>(&object);
+
+ assert(sketch != 0);
+
+ rtInternal = rt_copy_sketch(sketch->Internal());
+ }
else if (object.Type() == BagOfTriangles::ClassName()) {
id = ID_BOT; // 30
Modified: rt^3/trunk/src/coreInterface/Pipe.cpp
===================================================================
--- rt^3/trunk/src/coreInterface/Pipe.cpp 2020-05-11 23:37:51 UTC (rev
75764)
+++ rt^3/trunk/src/coreInterface/Pipe.cpp 2020-05-12 12:03:28 UTC (rev
75765)
@@ -94,6 +94,23 @@
}
+rt_pipe_internal* ClonePipeInternal
+(
+ const rt_pipe_internal& pipe
+) {
+ rt_pipe_internal* ret = 0;
+
+ BU_GET(ret, rt_pipe_internal);
+ ret->pipe_magic = RT_PIPE_INTERNAL_MAGIC;
+ ret->pipe_count = 0;
+ BU_LIST_INIT(&(ret->pipe_segs_head));
+
+ PipeCopy(ret, &pipe);
+
+ return ret;
+}
+
+
Pipe::Pipe(void) : Object() {
if (!BU_SETJUMP) {
BU_GET(m_internalp, rt_pipe_internal);
@@ -114,11 +131,7 @@
const Pipe& original
) {
if (!BU_SETJUMP) {
- BU_GET(m_internalp, rt_pipe_internal);
- m_internalp->pipe_magic = RT_PIPE_INTERNAL_MAGIC;
- m_internalp->pipe_count = 0;
- BU_LIST_INIT(&(m_internalp->pipe_segs_head));
- PipeCopy(m_internalp, original.Internal());
+ m_internalp = ClonePipeInternal(*original.Internal());
}
else {
BU_UNSETJUMP;
Modified: rt^3/trunk/src/coreInterface/private.h
===================================================================
--- rt^3/trunk/src/coreInterface/private.h 2020-05-11 23:37:51 UTC (rev
75764)
+++ rt^3/trunk/src/coreInterface/private.h 2020-05-12 12:03:28 UTC (rev
75765)
@@ -27,9 +27,15 @@
#ifndef PRIVATE_INCLUDED
#define PRIVATE_INCLUDED
+struct rt_pipe_internal;
struct rt_bot_internal;
+rt_pipe_internal* ClonePipeInternal
+(
+ const rt_pipe_internal& pipe
+);
+
rt_bot_internal* CloneBotInternal
(
const rt_bot_internal& bot
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits