[mapguide-commits] r6296 - in sandbox/adsk/vik/Common: CoordinateSystem Geometry

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Mon Dec 5 17:10:39 EST 2011


Author: traianstanev
Date: 2011-12-05 14:10:39 -0800 (Mon, 05 Dec 2011)
New Revision: 6296

Modified:
   sandbox/adsk/vik/Common/CoordinateSystem/CoordSysMgrs.cpp
   sandbox/adsk/vik/Common/CoordinateSystem/CoordSysMgrs.h
   sandbox/adsk/vik/Common/Geometry/GeometricEntity.cpp
   sandbox/adsk/vik/Common/Geometry/GeometricEntity.h
   sandbox/adsk/vik/Common/Geometry/Geometry.cpp
   sandbox/adsk/vik/Common/Geometry/Geometry.h
   sandbox/adsk/vik/Common/Geometry/GeometryUtil.cpp
   sandbox/adsk/vik/Common/Geometry/GeometryUtil.h
   sandbox/adsk/vik/Common/Geometry/GeosUtil.cpp
   sandbox/adsk/vik/Common/Geometry/GeosUtil.h
   sandbox/adsk/vik/Common/Geometry/Region.cpp
   sandbox/adsk/vik/Common/Geometry/Region.h
   sandbox/adsk/vik/Common/Geometry/Ring.cpp
   sandbox/adsk/vik/Common/Geometry/Ring.h
Log:
Made linking with Geos optional by sprinkling ifdefs around code which needs it.

Modified: sandbox/adsk/vik/Common/CoordinateSystem/CoordSysMgrs.cpp
===================================================================
--- sandbox/adsk/vik/Common/CoordinateSystem/CoordSysMgrs.cpp	2011-12-05 21:46:03 UTC (rev 6295)
+++ sandbox/adsk/vik/Common/CoordinateSystem/CoordSysMgrs.cpp	2011-12-05 22:10:39 UTC (rev 6296)
@@ -375,9 +375,11 @@
     // Save the boundary.
     m_GridBoundary = SAFE_ADDREF (pGridBoundary);
 
+#if WANT_GEOS
     // Create a CCoordinateSystemOneGrid which is appropriate for generating
     // MGRS graticule requests.
     m_ZoneCollection = FrameBoundaryToZones (m_GridBoundary,m_pCsTarget,m_bUseFrameDatum);
+#endif
 }
 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 MgCoordinateSystemGridBoundary* CCoordinateSystemMgrs::GetBoundary(void)
@@ -916,6 +918,8 @@
 {
     m_bExceptionsOn = bOn;
 }
+
+#if WANT_GEOS
 ///////////////////////////////////////////////////////////////////////////////
 // This member returns a collection of CCoordinateSystemMgrsZone objects.
 // These objects derive from CCoordinateSystemOneGrid, so they have both
@@ -1235,6 +1239,9 @@
     MG_CATCH_AND_THROW(L"MgCoordinateSystemMgrs::FrameBoundaryToZones")
     return zoneCollection.Detach ();
 }
+#endif //WANT_GEOS
+
+
 STRING CCoordinateSystemMgrs::GridSquareDesignation (INT32 utmZoneNbr,double easting,
                                                                       double northing,
                                                                       INT8 letteringScheme)

Modified: sandbox/adsk/vik/Common/CoordinateSystem/CoordSysMgrs.h
===================================================================
--- sandbox/adsk/vik/Common/CoordinateSystem/CoordSysMgrs.h	2011-12-05 21:46:03 UTC (rev 6295)
+++ sandbox/adsk/vik/Common/CoordinateSystem/CoordSysMgrs.h	2011-12-05 22:10:39 UTC (rev 6296)
@@ -104,6 +104,7 @@
     INT32 ConvertToLonLat(CREFSTRING sMgrs, MgCoordinate* pLonLat, INT32 grdSqrPosition);
     INT32 ConvertToLonLat(CREFSTRING sMgrs, double& dLongitude, double& dLatitude, INT32 grdSqrPosition);
 
+#if WANT_GEOS
 protected:          // Still INTERNAL API only.
     // Given a frame/viewport boundary, and the coordinate system thereof,
     // this function will return a collection of CCoordinateSystemOneGrid
@@ -113,6 +114,7 @@
     CCoordinateSystemMgrsZoneCollection* FrameBoundaryToZones (MgCoordinateSystemGridBoundary* frameBoundary,
                                                                MgCoordinateSystem* frameCS,
                                                                bool useFrameDatum);
+#endif
 
     // Fulfillment of virtual member of MgDisposable
     void Dispose();

Modified: sandbox/adsk/vik/Common/Geometry/GeometricEntity.cpp
===================================================================
--- sandbox/adsk/vik/Common/Geometry/GeometricEntity.cpp	2011-12-05 21:46:03 UTC (rev 6295)
+++ sandbox/adsk/vik/Common/Geometry/GeometricEntity.cpp	2011-12-05 22:10:39 UTC (rev 6296)
@@ -50,6 +50,8 @@
     delete this;
 }
 
+#if WANT_GEOS
+
 ///////////////////////////////////////////////////////////////////////////
 ///<summary>
 /// Tests whether this entity is simple or not. Simple entities do not
@@ -104,7 +106,6 @@
     return MgGeosUtil::Length(this);
 }
 
-
 ///////////////////////////////////////////////////////////////////////////
 ///<summary>
 /// Calculates the centroid for this geometric entity
@@ -116,3 +117,5 @@
 {
     return MgGeosUtil::Centroid(this);
 }
+
+#endif //WANT_GEOS
\ No newline at end of file

Modified: sandbox/adsk/vik/Common/Geometry/GeometricEntity.h
===================================================================
--- sandbox/adsk/vik/Common/Geometry/GeometricEntity.h	2011-12-05 21:46:03 UTC (rev 6295)
+++ sandbox/adsk/vik/Common/Geometry/GeometricEntity.h	2011-12-05 22:10:39 UTC (rev 6296)
@@ -80,6 +80,7 @@
     ///
     virtual bool IsEmpty() = 0;
 
+#if WANT_GEOS
     ///////////////////////////////////////////////////////////////
     /// \brief
     /// Tests whether this entity is simple or not. Simple entities
@@ -104,6 +105,7 @@
     /// Optional for MapGuide.
     ///
     virtual bool IsSimple();
+#endif
 
     /////////////////////////////////////////////////////////
     /// \brief
@@ -125,6 +127,7 @@
     ///
     virtual bool IsClosed() = 0;
 
+#if WANT_GEOS
     ///////////////////////////////////////////////////////////////////////////
     /// \brief
     /// Tests whether the coordinates given to construct the entity represent
@@ -147,6 +150,7 @@
     /// True if the geometry is valid, false otherwise.
     ///
     virtual bool IsValid();
+#endif
 
     /////////////////////////////////////////////////////////////////
     /// \brief
@@ -213,6 +217,7 @@
     ///
     virtual MgGeometricEntity* Transform(MgTransform* transform) = 0;
 
+#if WANT_GEOS
     ////////////////////////////////////////////////////////////////
     /// \brief
     /// Returns the area for this geometric entity or zero for
@@ -278,6 +283,8 @@
     ///
     virtual MgPoint* GetCentroid();  /// __get
 
+#endif
+
 INTERNAL_API:
 
     ///////////////////////////////////////////////////////////////////////////

Modified: sandbox/adsk/vik/Common/Geometry/Geometry.cpp
===================================================================
--- sandbox/adsk/vik/Common/Geometry/Geometry.cpp	2011-12-05 21:46:03 UTC (rev 6295)
+++ sandbox/adsk/vik/Common/Geometry/Geometry.cpp	2011-12-05 22:10:39 UTC (rev 6296)
@@ -19,6 +19,7 @@
 #include "Buffer/buffer.h"
 #include "GeosUtil.h"
 
+#if WANT_GEOS
 ///////////////////////////////////////////////////////////////////////////
 // Tests whether this geometry spatially contains another geometry.
 //
@@ -127,31 +128,6 @@
 
 
 ///////////////////////////////////////////////////////////////////////////
-// Returns a geometry that represents all points whose distance from this
-// geometric entity is less than or equal to a given distance. By default
-// distance computation is done using a linear algorithm unless a custom
-// measure is supplied.
-//
-MgGeometry* MgGeometry::Buffer(double distance, MgMeasure* measure)
-{
-    if (distance == 0.0)
-    {
-        STRING buffer;
-        MgUtil::DoubleToString(distance, buffer);
-
-        MgStringCollection arguments;
-        arguments.Add(L"1");
-        arguments.Add(buffer);
-
-        throw new MgInvalidArgumentException(L"MgGeometry.Buffer",
-            __LINE__, __WFILE__, &arguments, L"MgValueCannotBeZero", NULL);
-    }
-
-    MgBuffer buffer;
-    return buffer.CreateBuffer(this, distance, measure);
-}
-
-///////////////////////////////////////////////////////////////////////////
 // Returns a geometry that represents the convex hull of this geometric
 // entity.
 //
@@ -240,6 +216,34 @@
     return MgGeosUtil::Union(this, other);
 }
 
+#endif //WANT_GEOS
+
+///////////////////////////////////////////////////////////////////////////
+// Returns a geometry that represents all points whose distance from this
+// geometric entity is less than or equal to a given distance. By default
+// distance computation is done using a linear algorithm unless a custom
+// measure is supplied.
+//
+MgGeometry* MgGeometry::Buffer(double distance, MgMeasure* measure)
+{
+    if (distance == 0.0)
+    {
+        STRING buffer;
+        MgUtil::DoubleToString(distance, buffer);
+
+        MgStringCollection arguments;
+        arguments.Add(L"1");
+        arguments.Add(buffer);
+
+        throw new MgInvalidArgumentException(L"MgGeometry.Buffer",
+            __LINE__, __WFILE__, &arguments, L"MgValueCannotBeZero", NULL);
+    }
+
+    MgBuffer buffer;
+    return buffer.CreateBuffer(this, distance, measure);
+}
+
+
 //////////////////////////////////////////////////////////////////
 // Get the unique identifier for the class
 //

Modified: sandbox/adsk/vik/Common/Geometry/Geometry.h
===================================================================
--- sandbox/adsk/vik/Common/Geometry/Geometry.h	2011-12-05 21:46:03 UTC (rev 6295)
+++ sandbox/adsk/vik/Common/Geometry/Geometry.h	2011-12-05 22:10:39 UTC (rev 6296)
@@ -79,6 +79,7 @@
     ///
     virtual INT32 GetGeometryType() = 0;  /// __get
 
+#if WANT_GEOS
     ////////////////////////////////////////////////////////////////////////////////////////////////////////
     /// \brief
     /// This is a convenience method. Given 2 geometries a and b,
@@ -445,41 +446,6 @@
     ///
     virtual MgGeometry* Boundary();
 
-    ////////////////////////////////////////////////////////////////////////////
-    /// \brief
-    /// Returns a geometry that represents all points whose distance
-    /// from this geometric entity is less than or equal to a given
-    /// distance. By default, the distance computation is done using
-    /// a linear algorithm unless a custom measure is supplied.
-    ///
-    /// \remarks
-    /// This method returns NULL when using a negative offset with
-    /// points, lines, and curves.  When using a negative offset with
-    /// polygons, the method returns NULL if the offset causes the
-    /// buffered polygon to shrink to zero area.
-    ///
-    /// <!-- Syntax in .Net, Java, and PHP -->
-    /// \htmlinclude DotNetSyntaxTop.html
-    /// virtual MgGeometry Buffer(double distance, MgMeasure measure);
-    /// \htmlinclude SyntaxBottom.html
-    /// \htmlinclude JavaSyntaxTop.html
-    /// virtual MgGeometry Buffer(double distance, MgMeasure measure);
-    /// \htmlinclude SyntaxBottom.html
-    /// \htmlinclude PHPSyntaxTop.html
-    /// virtual MgGeometry Buffer(double distance, MgMeasure measure);
-    /// \htmlinclude SyntaxBottom.html
-    ///
-    /// \param distance (double)
-    /// The distance from the geometry in units.  This value cannot be zero.
-    /// \param measure (MgMeasure)
-    /// The MgMeasure instance to use when computing the buffer. If null,
-    /// a linear distance algorithm is used.
-    ///
-    /// \return
-    /// An MgGeometry that represents the geometric entity's buffer, or
-    /// NULL if the geometry cannot be buffered.
-    ///
-    virtual MgGeometry* Buffer(double distance, MgMeasure* measure);
 
     /////////////////////////////////////////////////////////////////
     /// \brief
@@ -728,6 +694,45 @@
     ///
     virtual MgGeometry* Union(MgGeometry* other);
 
+
+#endif //WANT_GEOS
+
+    ////////////////////////////////////////////////////////////////////////////
+    /// \brief
+    /// Returns a geometry that represents all points whose distance
+    /// from this geometric entity is less than or equal to a given
+    /// distance. By default, the distance computation is done using
+    /// a linear algorithm unless a custom measure is supplied.
+    ///
+    /// \remarks
+    /// This method returns NULL when using a negative offset with
+    /// points, lines, and curves.  When using a negative offset with
+    /// polygons, the method returns NULL if the offset causes the
+    /// buffered polygon to shrink to zero area.
+    ///
+    /// <!-- Syntax in .Net, Java, and PHP -->
+    /// \htmlinclude DotNetSyntaxTop.html
+    /// virtual MgGeometry Buffer(double distance, MgMeasure measure);
+    /// \htmlinclude SyntaxBottom.html
+    /// \htmlinclude JavaSyntaxTop.html
+    /// virtual MgGeometry Buffer(double distance, MgMeasure measure);
+    /// \htmlinclude SyntaxBottom.html
+    /// \htmlinclude PHPSyntaxTop.html
+    /// virtual MgGeometry Buffer(double distance, MgMeasure measure);
+    /// \htmlinclude SyntaxBottom.html
+    ///
+    /// \param distance (double)
+    /// The distance from the geometry in units.  This value cannot be zero.
+    /// \param measure (MgMeasure)
+    /// The MgMeasure instance to use when computing the buffer. If null,
+    /// a linear distance algorithm is used.
+    ///
+    /// \return
+    /// An MgGeometry that represents the geometric entity's buffer, or
+    /// NULL if the geometry cannot be buffered.
+    ///
+    virtual MgGeometry* Buffer(double distance, MgMeasure* measure);
+
 INTERNAL_API:
 
     virtual INT32 GetEntityType();

Modified: sandbox/adsk/vik/Common/Geometry/GeometryUtil.cpp
===================================================================
--- sandbox/adsk/vik/Common/Geometry/GeometryUtil.cpp	2011-12-05 21:46:03 UTC (rev 6295)
+++ sandbox/adsk/vik/Common/Geometry/GeometryUtil.cpp	2011-12-05 22:10:39 UTC (rev 6296)
@@ -350,6 +350,7 @@
     return false;
 }
 
+#if WANT_GEOS
 //////////////////////////////////////////////
 // Compare two aggregate geometries
 //
@@ -389,3 +390,4 @@
     int unmatched = geometries->GetCount();
     return unmatched == 0;
 }
+#endif

Modified: sandbox/adsk/vik/Common/Geometry/GeometryUtil.h
===================================================================
--- sandbox/adsk/vik/Common/Geometry/GeometryUtil.h	2011-12-05 21:46:03 UTC (rev 6295)
+++ sandbox/adsk/vik/Common/Geometry/GeometryUtil.h	2011-12-05 22:10:39 UTC (rev 6296)
@@ -86,10 +86,12 @@
     ///
     static bool CurveSegmentsEqual(MgCurveSegmentCollection* segs1, MgCurveSegmentCollection* segs2);
 
+#if WANT_GEOS
     //////////////////////////////////////////////
     /// Compare two aggregate geometries
     ///
     static bool AggregatesEqual(MgAggregateGeometry* geom1, MgAggregateGeometry* geom2);
+#endif
 };
 /// \endcond
 

Modified: sandbox/adsk/vik/Common/Geometry/GeosUtil.cpp
===================================================================
--- sandbox/adsk/vik/Common/Geometry/GeosUtil.cpp	2011-12-05 21:46:03 UTC (rev 6295)
+++ sandbox/adsk/vik/Common/Geometry/GeosUtil.cpp	2011-12-05 22:10:39 UTC (rev 6296)
@@ -17,6 +17,8 @@
 
 #include "stdafx.h"
 
+#if WANT_GEOS
+
 // disable C4244 of io.h about int64 assigned to unsigned long
 #pragma warning(push)
 #pragma warning(disable: 4244)
@@ -968,3 +970,5 @@
     }
     return wktStr;
 }
+
+#endif //WANT_GEOS

Modified: sandbox/adsk/vik/Common/Geometry/GeosUtil.h
===================================================================
--- sandbox/adsk/vik/Common/Geometry/GeosUtil.h	2011-12-05 21:46:03 UTC (rev 6295)
+++ sandbox/adsk/vik/Common/Geometry/GeosUtil.h	2011-12-05 22:10:39 UTC (rev 6296)
@@ -18,6 +18,8 @@
 #ifndef _GEOUTIL_H_
 #define _GEOUTIL_H_
 
+#if WANT_GEOS
+
 /// \cond INTERNAL
 ///////////////////////////////////////////////////////////////////////////////
 /// \brief
@@ -56,4 +58,6 @@
 };
 /// \endcond
 
+#endif //WANT_GEOS
+
 #endif

Modified: sandbox/adsk/vik/Common/Geometry/Region.cpp
===================================================================
--- sandbox/adsk/vik/Common/Geometry/Region.cpp	2011-12-05 21:46:03 UTC (rev 6295)
+++ sandbox/adsk/vik/Common/Geometry/Region.cpp	2011-12-05 22:10:39 UTC (rev 6296)
@@ -26,9 +26,11 @@
     return m_cls_id;
 }
 
+#if WANT_GEOS
 ///////////////////////////////////////////////////////////////////////////
 /// Gets a point guaranteed to be within the region.
 MgPoint* MgRegion::GetPointInRegion()
 {
     return MgGeosUtil::GetPointInRegion(this);
 }
+#endif

Modified: sandbox/adsk/vik/Common/Geometry/Region.h
===================================================================
--- sandbox/adsk/vik/Common/Geometry/Region.h	2011-12-05 21:46:03 UTC (rev 6295)
+++ sandbox/adsk/vik/Common/Geometry/Region.h	2011-12-05 22:10:39 UTC (rev 6296)
@@ -38,6 +38,8 @@
     DECLARE_CLASSNAME(MgRegion)
 
 PUBLISHED_API:
+
+#if WANT_GEOS
     ///////////////////////////////////////////////////////////////////////////
     /// \brief
     /// Gets a point guaranteed to be within the region.
@@ -49,6 +51,7 @@
     /// An MgPoint that defines a point in the region.
     ///
     virtual MgPoint* GetPointInRegion();  /// __get
+#endif
 
     /////////////////////////////////////////////////////////////////
     /// \brief

Modified: sandbox/adsk/vik/Common/Geometry/Ring.cpp
===================================================================
--- sandbox/adsk/vik/Common/Geometry/Ring.cpp	2011-12-05 21:46:03 UTC (rev 6295)
+++ sandbox/adsk/vik/Common/Geometry/Ring.cpp	2011-12-05 22:10:39 UTC (rev 6296)
@@ -18,6 +18,7 @@
 #include "stdafx.h"
 #include "GeosUtil.h"
 
+#if WANT_GEOS
 ///////////////////////////////////////////////////////////////////////////
 // Returns an MgPoint that defines a point in the ring.
 //
@@ -25,3 +26,4 @@
 {
     return MgGeosUtil::GetPointInRing(this);
 }
+#endif
\ No newline at end of file

Modified: sandbox/adsk/vik/Common/Geometry/Ring.h
===================================================================
--- sandbox/adsk/vik/Common/Geometry/Ring.h	2011-12-05 21:46:03 UTC (rev 6295)
+++ sandbox/adsk/vik/Common/Geometry/Ring.h	2011-12-05 22:10:39 UTC (rev 6296)
@@ -32,6 +32,7 @@
 class MG_GEOMETRY_API MgRing : public MgGeometryComponent
 {
 PUBLISHED_API:
+#if WANT_GEOS
     ///////////////////////////////////////////////////////////////////////////
     /// \brief
     /// Gets a point guaranteed to be within the ring.
@@ -43,6 +44,7 @@
     /// An MgPoint that defines a point in the ring.
     ///
     virtual MgPoint* GetPointInRing();  /// __get
+#endif
 
     /////////////////////////////////////////////////////////////////
     /// \brief



More information about the mapguide-commits mailing list