Go to the documentation of this file.
29 _egg2dxf(egg2dxf), _group(group)
39 _egg2dxf(copy._egg2dxf),
41 _layer_color(copy._layer_color)
51 _egg2dxf = copy._egg2dxf;
53 _layer_color = copy._layer_color;
65 int autocad_color = get_autocad_color(color);
67 ColorCounts::iterator cci;
68 cci = _color_counts.find(autocad_color);
69 if (cci == _color_counts.end()) {
71 _color_counts[autocad_color] = 1;
87 ColorCounts::iterator cci;
88 for (cci = _color_counts.begin(); cci != _color_counts.end(); ++cci) {
89 int count = (*cci).second;
90 if (count > max_count) {
91 _layer_color = (*cci).first;
106 <<
"2\n" << _group->get_name() <<
"\n"
108 <<
"62\n" << _layer_color <<
"\n"
109 <<
"6\nCONTINUOUS\n";
117 out <<
"0\nPOLYLINE\n"
118 <<
"8\n" << _group->get_name() <<
"\n"
121 <<
"62\n" << get_autocad_color(poly->
get_color()) <<
"\n";
125 EggPolygon::reverse_iterator vi;
126 for (vi = poly->rbegin(); vi != poly->rend(); ++vi) {
130 <<
"10\n" << pos[0] <<
"\n"
131 <<
"20\n" << pos[1] <<
"\n"
132 <<
"30\n" << pos[2] <<
"\n";
134 out <<
"0\nSEQEND\n";
142 if (poly->size() > 4) {
148 EggGroupNode::iterator ci;
149 for (ci = group->begin(); ci != group->end(); ++ci) {
151 if (child->
is_of_type(EggPolygon::get_class_type())) {
156 }
else if (poly->size() > 2) {
159 <<
"8\n" << _group->get_name() <<
"\n";
164 EggPolygon::reverse_iterator vi;
165 for (i = 0, vi = poly->rbegin(); vi != poly->rend(); ++i, ++vi) {
168 out << 10 + i <<
"\n" << pos[0] <<
"\n"
169 << 20 + i <<
"\n" << pos[1] <<
"\n"
170 << 30 + i <<
"\n" << pos[2] <<
"\n";
171 if (i == 2 && poly->size() == 3) {
173 out << 11 + i <<
"\n" << pos[0] <<
"\n"
174 << 21 + i <<
"\n" << pos[1] <<
"\n"
175 << 31 + i <<
"\n" << pos[2] <<
"\n";
187 EggGroupNode::iterator ci;
188 for (ci = _group->begin(); ci != _group->end(); ++ci) {
190 if (child->
is_of_type(EggPolygon::get_class_type())) {
192 if (_egg2dxf->_use_polyline) {
206 get_autocad_color(
const LColor &color) {
208 static ColorMap _map;
210 ColorMap::iterator cmi;
211 cmi = _map.find(color);
212 if (cmi != _map.end()) {
213 return (*cmi).second;
217 _map[color] = result;
void add_color(const LColor &color)
Records that one polygon is defined using the indicated color.
bool triangulate_into(EggGroupNode *container, bool convex_also) const
Subdivides the polygon into triangles and adds each one to the indicated container.
This is our own Panda specialization on the default STL map.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
const LMatrix4d & get_vertex_frame() const
Returns the coordinate frame of the vertices referenced by primitives at or under this node.
A program to read an egg file and write a DXF file.
A base class for nodes in the hierarchy that are not leaf nodes.
void write_polyline(EggPolygon *poly, std::ostream &out)
Writes a polygon as a POLYLINE entity.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void choose_overall_color()
After all polygons have been accounted for, chooses the polygon color that occurred most often as the...
LColor get_color() const
Returns the color set on this particular attribute.
static int find_color(double r, double g, double b)
Returns the index of the closest matching AutoCAD color to the indicated r, g, b.
void write_3d_face(EggPolygon *poly, std::ostream &out)
Writes a polygon as a 3DFACE entity.
void write_entities(std::ostream &out)
Writes out the "entities", e.g.
Any one-, two-, three-, or four-component vertex, possibly with attributes such as a normal.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void write_layer(std::ostream &out)
Writes the layer definition into the table at the beginning of the DXF file.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A single layer in the DXF file to be written by EggToDXF.
LVertexd get_pos3() const
Valid if get_num_dimensions() returns 3 or 4.
A base class for things that may be directly added into the egg hierarchy.
The main glue of the egg hierarchy, this corresponds to the <Group>, <Instance>, and <Joint> type nod...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
bool is_of_type(TypeHandle handle) const
Returns true if the current object is or derives from the indicated type.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.