[mapguide-commits] r7150 - in sandbox/jng/weblayout: Common/Schema Web/src/DotNetUnmanagedApi/Web Web/src/MapGuideApi Web/src/WebApp

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Mon Oct 22 01:19:48 PDT 2012


Author: jng
Date: 2012-10-22 01:19:48 -0700 (Mon, 22 Oct 2012)
New Revision: 7150

Added:
   sandbox/jng/weblayout/Web/src/WebApp/WebMeasureUnits.cpp
   sandbox/jng/weblayout/Web/src/WebApp/WebMeasureUnits.h
Modified:
   sandbox/jng/weblayout/Common/Schema/WebLayout-2.5.0.xsd
   sandbox/jng/weblayout/Web/src/DotNetUnmanagedApi/Web/WebConstants.xml
   sandbox/jng/weblayout/Web/src/MapGuideApi/Constants.xml
   sandbox/jng/weblayout/Web/src/WebApp/WebApp.h
   sandbox/jng/weblayout/Web/src/WebApp/WebApp.vcxproj
   sandbox/jng/weblayout/Web/src/WebApp/WebAppBuild.cpp
   sandbox/jng/weblayout/Web/src/WebApp/WebLayout.cpp
   sandbox/jng/weblayout/Web/src/WebApp/WebLayout.h
Log:
Expose the following properties in the new WebLayout schema and MgWebLayout:
 * UseUsEnglishUnits - Defines whether the viewer will default to imperial or metric units
 * MeasureUnits - Defines the default units for a measure command

Modified: sandbox/jng/weblayout/Common/Schema/WebLayout-2.5.0.xsd
===================================================================
--- sandbox/jng/weblayout/Common/Schema/WebLayout-2.5.0.xsd	2012-10-22 07:10:20 UTC (rev 7149)
+++ sandbox/jng/weblayout/Common/Schema/WebLayout-2.5.0.xsd	2012-10-22 08:19:48 UTC (rev 7150)
@@ -6,6 +6,8 @@
       <xs:element name="Title" type="xs:string"/>
       <xs:element name="Map" type="MapType"/>
       <xs:element name="EnablePingServer" type="xs:boolean" minOccurs="0" />
+      <xs:element name="UseUsEnglishUnits" type="xs:boolean" minOccurs="0" />
+      <xs:element name="MeasureUnits" type="xs:string" minOccurs="0" />
       <xs:element name="SelectionColor" type="xs:string" minOccurs="0" />
       <xs:element name="PointSelectionBuffer" type="xs:integer" minOccurs="0" />
       <xs:element name="MapImageFormat" type="xs:string" minOccurs="0" />

Modified: sandbox/jng/weblayout/Web/src/DotNetUnmanagedApi/Web/WebConstants.xml
===================================================================
--- sandbox/jng/weblayout/Web/src/DotNetUnmanagedApi/Web/WebConstants.xml	2012-10-22 07:10:20 UTC (rev 7149)
+++ sandbox/jng/weblayout/Web/src/DotNetUnmanagedApi/Web/WebConstants.xml	2012-10-22 08:19:48 UTC (rev 7150)
@@ -63,6 +63,7 @@
 
 <Classes>
   <Class name="MgWebWidgetType" />
+  <Class name="MgWebMeasureUnits" />
   <Class name="MgWebTaskButtonType" />
   <Class name="MgWebTargetType" />
   <Class name="MgWebTargetViewerType" />
@@ -77,6 +78,7 @@
 
     <!-- API -->
     <Header path="../../WebApp/WebActions.h" />
+    <Header path="../../WebApp/WebMeasureUnits.h" />
     <Header path="../../WebApp/WebTargetType.h" />
     <Header path="../../WebApp/WebTargetViewerType.h" />
     <Header path="../../WebApp/WebTaskButtonType.h" />

Modified: sandbox/jng/weblayout/Web/src/MapGuideApi/Constants.xml
===================================================================
--- sandbox/jng/weblayout/Web/src/MapGuideApi/Constants.xml	2012-10-22 07:10:20 UTC (rev 7149)
+++ sandbox/jng/weblayout/Web/src/MapGuideApi/Constants.xml	2012-10-22 08:19:48 UTC (rev 7150)
@@ -100,6 +100,7 @@
   <Class name="MgWebTargetType" />
   <Class name="MgWebTargetViewerType" />
   <Class name="MgWebActions" />
+  <Class name="MgWebMeasureUnits" />
   <Class name="MgConfigProperties" />
   <Class name="MgLogFileType" />
   <Class name="MgServerInformationProperties" />
@@ -188,6 +189,7 @@
     <Header path="../../../Common/MapGuideCommon/System/ConfigProperties.h" />
 
     <Header path="../WebApp/WebActions.h" />
+    <Header path="../WebApp/WebMeasureUnits.h" />
     <Header path="../WebApp/WebTargetType.h" />
     <Header path="../WebApp/WebTargetViewerType.h" />
     <Header path="../WebApp/WebTaskButtonType.h" />

Modified: sandbox/jng/weblayout/Web/src/WebApp/WebApp.h
===================================================================
--- sandbox/jng/weblayout/Web/src/WebApp/WebApp.h	2012-10-22 07:10:20 UTC (rev 7149)
+++ sandbox/jng/weblayout/Web/src/WebApp/WebApp.h	2012-10-22 08:19:48 UTC (rev 7150)
@@ -28,6 +28,7 @@
 #include "WebAppClassId.h"
 
 #include "WebActions.h"
+#include "WebMeasureUnits.h"
 #include "WebTargetType.h"
 #include "WebTargetViewerType.h"
 #include "WebCommand.h"

Modified: sandbox/jng/weblayout/Web/src/WebApp/WebApp.vcxproj
===================================================================
--- sandbox/jng/weblayout/Web/src/WebApp/WebApp.vcxproj	2012-10-22 07:10:20 UTC (rev 7149)
+++ sandbox/jng/weblayout/Web/src/WebApp/WebApp.vcxproj	2012-10-22 08:19:48 UTC (rev 7150)
@@ -209,6 +209,7 @@
     <ClInclude Include="WebInvokeUrlCommand.h" />
     <ClInclude Include="WebLayout.h" />
     <ClInclude Include="WebMeasureCommand.h" />
+    <ClInclude Include="WebMeasureUnits.h" />
     <ClInclude Include="WebPrintCommand.h" />
     <ClInclude Include="WebSearchCommand.h" />
     <ClInclude Include="WebSelectWithinCommand.h" />
@@ -316,6 +317,12 @@
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
     </ClCompile>
+    <ClCompile Include="WebMeasureUnits.cpp">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
+    </ClCompile>
     <ClCompile Include="WebPrintCommand.cpp">
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>

Modified: sandbox/jng/weblayout/Web/src/WebApp/WebAppBuild.cpp
===================================================================
--- sandbox/jng/weblayout/Web/src/WebApp/WebAppBuild.cpp	2012-10-22 07:10:20 UTC (rev 7149)
+++ sandbox/jng/weblayout/Web/src/WebApp/WebAppBuild.cpp	2012-10-22 08:19:48 UTC (rev 7150)
@@ -29,6 +29,7 @@
 #include "WebInvokeUrlCommand.cpp"
 #include "WebLayout.cpp"
 #include "WebMeasureCommand.cpp"
+#include "WebMeasureUnits.cpp"
 #include "WebPrintCommand.cpp"
 #include "WebSearchCommand.cpp"
 #include "WebSelectWithinCommand.cpp"

Modified: sandbox/jng/weblayout/Web/src/WebApp/WebLayout.cpp
===================================================================
--- sandbox/jng/weblayout/Web/src/WebApp/WebLayout.cpp	2012-10-22 07:10:20 UTC (rev 7149)
+++ sandbox/jng/weblayout/Web/src/WebApp/WebLayout.cpp	2012-10-22 08:19:48 UTC (rev 7150)
@@ -28,7 +28,9 @@
    m_pointPixelBuffer(2),
    m_mapImageFormat(MgImageFormats::Png),
    m_selectionImageFormat(MgImageFormats::Png),
-   m_startupScript(L"") //NOXLATE
+   m_startupScript(L""), //NOXLATE
+   m_defaultMeasureUnits(MgWebMeasureUnits::Miles), 
+   m_useUsEnglishUnits(true)
 {
     MG_TRY()
 
@@ -88,6 +90,30 @@
 
 ///////////////////////////////////////////////////////////////////////////
 /// <summary>
+/// Gets whether to use US english units for display of distances
+/// </summary>
+/// <returns>
+/// true if US english units are to be used. If false, metric units will be used instead
+/// </returns>
+bool MgWebLayout::GetUseUsEnglishUnits()
+{
+	return m_useUsEnglishUnits;
+}
+
+///////////////////////////////////////////////////////////////////////////
+/// <summary>
+/// Returns the unit of measurement that the Measure command will default to
+/// </summary>
+/// <returns>
+/// The unit of measurement that the Measure command will default to
+/// </returns>
+STRING MgWebLayout::GetDefaultMeasureUnit()
+{
+	return m_defaultMeasureUnits;
+}
+
+///////////////////////////////////////////////////////////////////////////
+/// <summary>
 /// Returns the selection color in HTML RGBA format
 /// </summary>
 /// <returns>
@@ -324,6 +350,14 @@
             {
                 m_enablePingServer = GetBooleanFromElement(elt);
             }
+			else if(strName == L"UseUsEnglishUnits") //NOXLATE
+            {
+                m_useUsEnglishUnits = GetBooleanFromElement(elt);
+            }
+			else if(strName == L"MeasureUnits") //NOXLATE
+            {
+				m_defaultMeasureUnits = GetStringFromElement(elt);
+            }
             else if(strName == L"SelectionColor") //NOXLATE
             {
                 m_selectionColor = GetStringFromElement(elt);

Modified: sandbox/jng/weblayout/Web/src/WebApp/WebLayout.h
===================================================================
--- sandbox/jng/weblayout/Web/src/WebApp/WebLayout.h	2012-10-22 07:10:20 UTC (rev 7149)
+++ sandbox/jng/weblayout/Web/src/WebApp/WebLayout.h	2012-10-22 08:19:48 UTC (rev 7150)
@@ -62,6 +62,24 @@
     /// </returns>
     bool GetEnablePingServer();
 
+	///////////////////////////////////////////////////////////////////////////
+    /// <summary>
+    /// Gets whether to use US english units for display of distances
+    /// </summary>
+    /// <returns>
+    /// true if US english units are to be used. If false, metric units will be used instead
+    /// </returns>
+	bool GetUseUsEnglishUnits();
+
+	///////////////////////////////////////////////////////////////////////////
+    /// <summary>
+    /// Returns the unit of measurement that the Measure command will default to
+    /// </summary>
+    /// <returns>
+    /// The unit of measurement that the Measure command will default to
+    /// </returns>
+	STRING GetDefaultMeasureUnit();
+
     ///////////////////////////////////////////////////////////////////////////
     /// <summary>
     /// Returns the selection color in HTML RGBA format
@@ -427,6 +445,8 @@
     STRING       m_title;
     STRING       m_mapDefinition;
     bool         m_enablePingServer;
+	bool		 m_useUsEnglishUnits;
+	STRING		 m_defaultMeasureUnits;
     STRING       m_mapImageFormat;
     STRING       m_selectionImageFormat;
     INT32        m_pointPixelBuffer;

Added: sandbox/jng/weblayout/Web/src/WebApp/WebMeasureUnits.cpp
===================================================================
--- sandbox/jng/weblayout/Web/src/WebApp/WebMeasureUnits.cpp	                        (rev 0)
+++ sandbox/jng/weblayout/Web/src/WebApp/WebMeasureUnits.cpp	2012-10-22 08:19:48 UTC (rev 7150)
@@ -0,0 +1,30 @@
+//
+//  Copyright (C) 2004-2011 by Autodesk, Inc.
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of version 2.1 of the GNU Lesser
+//  General Public License as published by the Free Software Foundation.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+//
+
+#include "WebApp.h"
+
+///////////////////////////////////////////////////////////////////////////////
+/// Image formats supported by the rendering service.
+///
+/// The exact list of supported formats is not defined yet.
+/// At least PNG will be supported.
+///
+const STRING MgWebMeasureUnits::Miles			= L"mi";
+const STRING MgWebMeasureUnits::Kilometers		= L"km";
+const STRING MgWebMeasureUnits::UsSurveyFeet	= L"usft";
+const STRING MgWebMeasureUnits::Feet			= L"ft";
+const STRING MgWebMeasureUnits::Meters			= L"m";

Added: sandbox/jng/weblayout/Web/src/WebApp/WebMeasureUnits.h
===================================================================
--- sandbox/jng/weblayout/Web/src/WebApp/WebMeasureUnits.h	                        (rev 0)
+++ sandbox/jng/weblayout/Web/src/WebApp/WebMeasureUnits.h	2012-10-22 08:19:48 UTC (rev 7150)
@@ -0,0 +1,37 @@
+//
+//  Copyright (C) 2004-2011 by Autodesk, Inc.
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of version 2.1 of the GNU Lesser
+//  General Public License as published by the Free Software Foundation.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+//
+
+#ifndef _MGWEBMEASUREUNITS_H_
+#define _MGWEBMEASUREUNITS_H_
+
+///////////////////////////////////////////////////////////
+/// \brief
+/// Measurement units supported by the AJAX Viewer Measure command
+///
+class MG_WEBAPP_API MgWebMeasureUnits
+{
+PUBLISHED_API:
+	/// \internal
+    /// The "value(xxx)" comments are used by SWIG to build constants.php.  Do not alter them.
+
+	static const STRING Miles;			/// \if INTERNAL value("mi") \endif
+	static const STRING Kilometers;		/// \if INTERNAL value("km") \endif
+	static const STRING UsSurveyFeet;	/// \if INTERNAL value("usft") \endif
+	static const STRING Feet;			/// \if INTERNAL value("ft") \endif
+	static const STRING Meters;			/// \if INTERNAL value("m") \endif
+};
+#endif
\ No newline at end of file



More information about the mapguide-commits mailing list