~ubuntu-branches/ubuntu/saucy/mapserver/saucy-security

« back to all changes in this revision

Viewing changes to mapgeos.c

  • Committer: Package Import Robot
  • Author(s): Francesco Paolo Lovergine
  • Date: 2011-12-23 14:02:06 UTC
  • mfrom: (26.1.2 sid)
  • Revision ID: package-import@ubuntu.com-20111223140206-n3h9t2hsa8hyslmu
Tags: 6.0.1-2
Added missed stuff for libmapscript-perl.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/******************************************************************************
2
 
 * $Id: mapgeos.c 9569 2009-11-27 21:16:01Z dmorissette $
 
2
 * $Id: mapgeos.c 11470 2011-04-05 20:11:33Z tamas $
3
3
 *
4
4
 * Project:  MapServer
5
5
 * Purpose:  MapServer-GEOS integration.
568
568
    return msGEOSGeometry2Shape_multipolygon(g);
569
569
    break;
570
570
  default:
571
 
    msSetError(MS_GEOSERR, "Unsupported GEOS geometry type (%d).", "msGEOSGeometry2Shape()", type);
 
571
    if (!GEOSisEmpty(g))
 
572
        msSetError(MS_GEOSERR, "Unsupported GEOS geometry type (%d).", "msGEOSGeometry2Shape()", type);
572
573
    return NULL;
573
574
  }
574
575
}
619
620
#endif
620
621
}
621
622
 
 
623
/* Return should be freed with msGEOSFreeWKT */
622
624
char *msGEOSShapeToWKT(shapeObj *shape)
623
625
{
624
626
#ifdef USE_GEOS
641
643
#endif
642
644
}
643
645
 
 
646
void msGEOSFreeWKT(char* pszGEOSWKT)
 
647
{
 
648
#ifdef USE_GEOS
 
649
#if GEOS_VERSION_MAJOR > 3 || (GEOS_VERSION_MAJOR == 3 && GEOS_VERSION_MINOR >= 2)
 
650
  GEOSFree(pszGEOSWKT);
 
651
#endif
 
652
#else
 
653
  msSetError(MS_GEOSERR, "GEOS support is not available.", "msGEOSFreeWKT()");
 
654
#endif
 
655
}
 
656
 
644
657
/*
645
658
** Analytical functions exposed to MapServer/MapScript.
646
659
*/
669
682
 
670
683
shapeObj *msGEOSSimplify(shapeObj *shape, double tolerance)
671
684
{
672
 
#if defined(USE_GEOS) && defined(GEOS_HAS_SIMPLIFY)
 
685
#ifdef USE_GEOS
673
686
  GEOSGeom g1, g2; 
674
687
 
675
688
  if(!shape) 
684
697
  g2 = GEOSSimplify(g1, tolerance);
685
698
  return msGEOSGeometry2Shape(g2);
686
699
#else
687
 
  msSetError(MS_GEOSERR, "GEOS Simplify support is not available.", "msGEOSTopologyPreservingSimplifier()");
 
700
  msSetError(MS_GEOSERR, "GEOS Simplify support is not available.", "msGEOSSimplify()");
688
701
  return NULL;
689
702
#endif
690
703
}
691
704
 
692
705
shapeObj *msGEOSTopologyPreservingSimplify(shapeObj *shape, double tolerance)
693
706
{
694
 
#if defined(USE_GEOS) && defined(GEOS_HAS_SIMPLIFY)
 
707
#ifdef USE_GEOS
695
708
  GEOSGeom g1, g2; 
696
709
 
697
710
  if(!shape) 
706
719
  g2 = GEOSTopologyPreserveSimplify(g1, tolerance);
707
720
  return msGEOSGeometry2Shape(g2);
708
721
#else
709
 
  msSetError(MS_GEOSERR, "GEOS Simplify support is not available.", "msGEOSTopologyPreservingSimplifier()");
 
722
  msSetError(MS_GEOSERR, "GEOS Simplify support is not available.", "msGEOSTopologyPreservingSimplify()");
710
723
  return NULL;
711
724
#endif
712
725
}