~ubuntu-branches/ubuntu/wily/spatialite/wily-proposed

« back to all changes in this revision

Viewing changes to src/dxf/dxf_load_mixed.c

  • Committer: Package Import Robot
  • Author(s): Bas Couwenberg
  • Date: 2015-07-14 11:57:46 UTC
  • mfrom: (16.1.1 sid)
  • Revision ID: package-import@ubuntu.com-20150714115746-e2iljfmb5sq7o5hh
Tags: 4.3.0-1
Move from experimental to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
 dxf_load_mixed.c -- implements DXF support
4
4
 [loding features into the DB - mixed layers by geometry type]
5
5
 
6
 
 version 4.1, 2013 May 14
 
6
 version 4.3, 2015 June 29
7
7
 
8
8
 Author: Sandro Furieri a.furieri@lqt.it
9
9
 
25
25
 
26
26
The Initial Developer of the Original Code is Alessandro Furieri
27
27
 
28
 
Portions created by the Initial Developer are Copyright (C) 2008-2013
 
28
Portions created by the Initial Developer are Copyright (C) 2008-2015
29
29
the Initial Developer. All Rights Reserved.
30
30
 
31
31
Contributor(s): 
44
44
 
45
45
*/
46
46
 
 
47
/*
 
48
 
 
49
CREDITS:
 
50
 
 
51
inital development of the DXF module has been funded by:
 
52
Regione Toscana - Settore Sistema Informativo Territoriale ed Ambientale
 
53
 
 
54
*/
 
55
 
47
56
#include <stdlib.h>
48
57
#include <stdio.h>
49
58
#include <string.h>
1376
1385
                gaiaDxfPolylinePtr pg = lyr->first_polyg;
1377
1386
                while (pg != NULL)
1378
1387
                  {
 
1388
                      int unclosed = check_unclosed_polyg (pg, lyr->is3Dpolyg);
1379
1389
                      gaiaDxfHolePtr hole;
1380
1390
                      int num_holes;
1381
1391
                      int iv;
1400
1410
                            num_holes++;
1401
1411
                            hole = hole->next;
1402
1412
                        }
1403
 
                      gaiaAddPolygonToGeomColl (geom, pg->points, num_holes);
 
1413
                      gaiaAddPolygonToGeomColl (geom, pg->points + unclosed,
 
1414
                                                num_holes);
1404
1415
                      p_pg = geom->FirstPolygon;
1405
1416
                      p_rng = p_pg->Exterior;
1406
1417
                      for (iv = 0; iv < pg->points; iv++)
1417
1428
                                                *(pg->x + iv), *(pg->y + iv));
1418
1429
                              }
1419
1430
                        }
 
1431
                      if (unclosed)
 
1432
                        {
 
1433
                            /* forcing the Ring to be closed */
 
1434
                            if (lyr->is3Dpolyg)
 
1435
                              {
 
1436
                                  gaiaSetPointXYZ (p_rng->Coords, pg->points,
 
1437
                                                   *(pg->x + 0), *(pg->y + 0),
 
1438
                                                   *(pg->z + 0));
 
1439
                              }
 
1440
                            else
 
1441
                              {
 
1442
                                  gaiaSetPoint (p_rng->Coords, pg->points,
 
1443
                                                *(pg->x + 0), *(pg->y + 0));
 
1444
                              }
 
1445
                        }
1420
1446
                      num_holes = 0;
1421
1447
                      hole = pg->first_hole;
1422
1448
                      while (hole != NULL)
1423
1449
                        {
 
1450
                            int unclosed =
 
1451
                                check_unclosed_hole (hole, lyr->is3Dpolyg);
1424
1452
                            p_rng =
1425
1453
                                gaiaAddInteriorRing (p_pg, num_holes,
1426
 
                                                     hole->points);
 
1454
                                                     hole->points + unclosed);
1427
1455
                            for (iv = 0; iv < hole->points; iv++)
1428
1456
                              {
1429
1457
                                  if (lyr->is3Dpolyg)
1440
1468
                                                      *(hole->y + iv));
1441
1469
                                    }
1442
1470
                              }
 
1471
                            if (unclosed)
 
1472
                              {
 
1473
                                  /* forcing the Ring to be closed */
 
1474
                                  if (lyr->is3Dpolyg)
 
1475
                                    {
 
1476
                                        gaiaSetPointXYZ (p_rng->Coords,
 
1477
                                                         hole->points,
 
1478
                                                         *(hole->x + 0),
 
1479
                                                         *(hole->y + 0),
 
1480
                                                         *(hole->z + 0));
 
1481
                                    }
 
1482
                                  else
 
1483
                                    {
 
1484
                                        gaiaSetPoint (p_rng->Coords,
 
1485
                                                      hole->points,
 
1486
                                                      *(hole->x + 0),
 
1487
                                                      *(hole->y + 0));
 
1488
                                    }
 
1489
                              }
1443
1490
                            num_holes++;
1444
1491
                            hole = hole->next;
1445
1492
                        }