Skip to content

Commit

Permalink
v.in.redwg: Update to the latest libredwg (#839)
Browse files Browse the repository at this point in the history
  • Loading branch information
HuidaeCho committed Dec 23, 2022
1 parent 90ce5b7 commit 993d06c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
20 changes: 10 additions & 10 deletions src/vector/v.in.redwg/entity.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ void getEntTypeName(Dwg_Object *obj, char *name)
case DWG_TYPE_VIEWPORT:
strcpy(name, "VIEWPORT");
break;
case DWG_TYPE_3DSOLID:
case DWG_TYPE__3DSOLID:
strcpy(name, "SOLID3D");
break;
case DWG_TYPE_RAY:
Expand Down Expand Up @@ -233,7 +233,7 @@ int write_line(Dwg_Object * obj, int type, int level)
db_append_string(&sql, buf);

/* Weight */
sprintf(buf, ", %d", obj->tio.entity->lineweight);
sprintf(buf, ", %d", obj->tio.entity->linewt);
db_append_string(&sql, buf);

/* Layer name */
Expand All @@ -249,14 +249,14 @@ int write_line(Dwg_Object * obj, int type, int level)
if (_type == 51)
{
layer = obj->tio.entity->layer->obj->tio.object->tio.LAYER;
printf ("IS A LAYER! name = %s", layer->entry_name);
printf ("IS A LAYER! name = %s", layer->name);
}
else printf("NOT A LAYER!");
printf("\n");

if (layer) {
if (layer->entry_name) {
db_set_string(&str, layer->entry_name);
if (layer->name) {
db_set_string(&str, layer->name);
db_double_quote_string(&str);
sprintf(buf, ", '%s'", db_get_string(&str));
}
Expand Down Expand Up @@ -389,8 +389,8 @@ void write_entity(Dwg_Object *obj, Dwg_Object ** objects,
case DWG_TYPE_TEXT:
text = obj->tio.entity->tio.TEXT;
Txt = (char *)text->text_value;
Vect_append_point(Points, text->insertion_pt.x, text->insertion_pt.y,
0); // insertion_poin.z ??
Vect_append_point(Points, text->ins_pt.x, text->ins_pt.y,
0); // ins_pt.z ??
write_line(obj, GV_POINT, level);
break;

Expand Down Expand Up @@ -468,7 +468,7 @@ void write_entity(Dwg_Object *obj, Dwg_Object ** objects,
insert->ins_pt.y, insert->ins_pt.z);
G_debug(3, " xscale, yscale, zscale: %f, %f, %f", insert->scale.x,
insert->scale.y, insert->scale.z);
G_debug(3, " rotang: %f", insert->rotation_ang);
G_debug(3, " rotang: %f", insert->rotation);
/*
G_debug(3, " ncols, nrows: %d, %d", ent->insert.numcols,
ent->insert.numrows);
Expand All @@ -490,7 +490,7 @@ void write_entity(Dwg_Object *obj, Dwg_Object ** objects,
_obj = insert->block_header->obj;
_obj_obj = _obj->tio.object;
blockhdr = _obj_obj->tio.BLOCK_HEADER;
if (blockhdr->entry_name[0] == ((unsigned char)'*')) //PSPACE OR MSPACE
if (blockhdr->name[0] == ((unsigned char)'*')) //PSPACE OR MSPACE
{
printf("Skipping PSPACE or MSPACE block\n");
break;
Expand All @@ -512,7 +512,7 @@ void write_entity(Dwg_Object *obj, Dwg_Object ** objects,
Trans[level + 1].xscale = insert->scale.x;
Trans[level + 1].yscale = insert->scale.y;
Trans[level + 1].zscale = insert->scale.z;
Trans[level + 1].rotang = insert->rotation_ang;
Trans[level + 1].rotang = insert->rotation;
printf("Writing inserted entity. Level = %d\n", level+1);
write_entity(ent, objects, ent_counter, level+1);
ent = dwg_next_object(ent);
Expand Down
10 changes: 5 additions & 5 deletions src/vector/v.in.redwg/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,14 +197,14 @@ int main(int argc, char *argv[])
Trans[0].rotang = 0;


for(i=0; i < dwg_get_object_count(&dwg); i++)
for(i=0; i < dwg_get_num_objects(&dwg); i++)
{
fprintf(stdout, "Type: %u\n", dwg.object[i].type);
}
fprintf(stdout, "%lu objects\n", dwg_get_object_count(&dwg));
fprintf(stdout, "%lu objects\n", dwg_get_num_objects(&dwg));
fflush(stdout);

for (i = 0; i < dwg_get_object_count(&dwg); i++)
for (i = 0; i < dwg_get_num_objects(&dwg); i++)
{
if (import_object(&dwg.object[i]))
{
Expand Down Expand Up @@ -240,7 +240,7 @@ list_layers(Dwg_Data * dwg)
Dwg_Object_LAYER **layers = dwg_get_layers(dwg);

for (i=0; i<l_count; i++) {
fprintf(stdout, "NAME: %s COLOR: %lu STATE: ", layers[i]->entry_name,
fprintf(stdout, "NAME: %s COLOR: %lu STATE: ", layers[i]->name,
layers[i]->color.rgb);
if (layers[i]->on)
fprintf(stdout, "ON, ");
Expand Down Expand Up @@ -274,7 +274,7 @@ import_object(Dwg_Object * obj)
{
while (layers_opt->answers[i])
{
if (strcmp((char*)layer->entry_name, layers_opt->answers[i]) == 0)
if (strcmp((char*)layer->name, layers_opt->answers[i]) == 0)
{
layer_found = 1;
break;
Expand Down

0 comments on commit 993d06c

Please sign in to comment.