[mapguide-commits] r8957 - in branches/3.1/MgDev: . Common/MapGuideCommon/Controller Doc/devguide/source Server/src/Services/Feature Server/src/Services/Mapping Server/src/Services/Rendering Web/src/schemareport

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Thu May 12 08:01:09 PDT 2016


Author: jng
Date: 2016-05-12 08:01:09 -0700 (Thu, 12 May 2016)
New Revision: 8957

Modified:
   branches/3.1/MgDev/
   branches/3.1/MgDev/Common/MapGuideCommon/Controller/HtmlController.cpp
   branches/3.1/MgDev/Doc/devguide/source/revision_history.rst
   branches/3.1/MgDev/Doc/devguide/source/supplemental_development.rst
   branches/3.1/MgDev/Server/src/Services/Feature/SelectCommand.cpp
   branches/3.1/MgDev/Server/src/Services/Feature/SelectCommand.h
   branches/3.1/MgDev/Server/src/Services/Mapping/MappingUtil.cpp
   branches/3.1/MgDev/Server/src/Services/Rendering/ServerRenderingService.cpp
   branches/3.1/MgDev/Web/src/schemareport/displayschemafunctions.php
Log:
Merged revision(s) 8955-8956 from trunk/MgDev:
Merged revision(s) 8871, 8895, 8901, 8912-8913, 8921-8922, 8942 from sandbox/adsk/3.1n:
Fix #2585: the total entries is not correct with Oracle data source.

It is because the initial vale of total entries is -1. We should set it to 0.
........
Fix a bug introduced by RFC #151.
When we get a layer's watermark, we use layerWatermarks->OrphanAt(index). This modifies the watermark collection of the layer. So we cannot use layer definition cache for watermarks.
........
Fix a bug introduced by RFC #151.
The scale range will be changed in the method RenderForSelection if bOnlyVisibleLayers is false. So we cannot use the cached layer definition in this case.
........
Fix the issue that DateTime value cannot be displayed in selection panel.
........
Refine #8901
........
In some special FDO provider such as Autodesk RealDWG provider, the 'Geometry' property is already in property mappings. In method MgHtmlController::WriteSelectedFeatureAttributes(), we will first add all mapping properties, then add geometry property. We need to check if 'Geometry' is added to avoid adding it twice.
........
Some providers such as Sqlite provider, CreateCommand(FdoCommandType_Select) will return a extended select command. So we need to check if it is really a extended select command before using it. 
........
Fix the defect that zoom raster image results in server crash.
It is because if the displayed size of image is very small, the width or height may be 0. And we will use the width and height as the parameters of RESAMPLE. FDO Raster provider will crash in this case. I set width or height to 1 if its value is 0 to avoid the error.
........

........
devguide: Fix malformed revision history table and add a section about mapguide-rest in supplemental_development.rst
........



Property changes on: branches/3.1/MgDev
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/2.4/MgDev:6749-6756,6777-6783,6785-6787,6789,6791-6794,6796-6801,6954-6962,6986-7006
/branches/2.6/MgDev:8276-8286,8288-8292,8297,8299,8301,8303,8314-8315,8318,8335,8340,8354-8355,8365,8373
/branches/3.0/MgDev:8658,8705,8710
/sandbox/VC140:8684-8759
/sandbox/adsk/2.6l:8727
/sandbox/adsk/3.0m:8563,8584,8607,8625,8694-8695
/sandbox/jng/convenience_apis:8262-8268,8271-8363
/sandbox/jng/createruntimemap:7486-7555
/sandbox/jng/dwftk:8321-8324,8328-8329,8331,8352
/sandbox/jng/geos34x:8256-8259
/sandbox/jng/rfc155:8872-8884
/sandbox/jng/tiling:8174-8208
/sandbox/jng/v30:8212-8227
/sandbox/rfc94:5099-5163
/trunk/MgDev:8869-8871
   + /branches/2.4/MgDev:6749-6756,6777-6783,6785-6787,6789,6791-6794,6796-6801,6954-6962,6986-7006
/branches/2.6/MgDev:8276-8286,8288-8292,8297,8299,8301,8303,8314-8315,8318,8335,8340,8354-8355,8365,8373
/branches/3.0/MgDev:8658,8705,8710
/sandbox/VC140:8684-8759
/sandbox/adsk/2.6l:8727
/sandbox/adsk/3.0m:8563,8584,8607,8625,8694-8695
/sandbox/adsk/3.1n:8871,8895,8901,8912-8913,8921-8922,8942
/sandbox/jng/convenience_apis:8262-8268,8271-8363
/sandbox/jng/createruntimemap:7486-7555
/sandbox/jng/dwftk:8321-8324,8328-8329,8331,8352
/sandbox/jng/geos34x:8256-8259
/sandbox/jng/rfc155:8872-8884
/sandbox/jng/tiling:8174-8208
/sandbox/jng/v30:8212-8227
/sandbox/rfc94:5099-5163
/trunk/MgDev:8955-8956

Modified: branches/3.1/MgDev/Common/MapGuideCommon/Controller/HtmlController.cpp
===================================================================
--- branches/3.1/MgDev/Common/MapGuideCommon/Controller/HtmlController.cpp	2016-05-12 14:57:37 UTC (rev 8956)
+++ branches/3.1/MgDev/Common/MapGuideCommon/Controller/HtmlController.cpp	2016-05-12 15:01:09 UTC (rev 8957)
@@ -533,7 +533,8 @@
                     }
                 }
             }
-            propNames->Add(selLayer->GetFeatureGeometryName()); //Don't forget geometry
+            if (!propNames->Contains(selLayer->GetFeatureGeometryName()))
+                propNames->Add(selLayer->GetFeatureGeometryName()); //Don't forget geometry
             xmlOut.append(L"</LayerMetadata>\n");
             Ptr<MgReader> reader = selectionSet->GetSelectedFeatures(selLayer, selLayer->GetFeatureClassName(), propNames);
             while(reader->ReadNext())
@@ -612,7 +613,7 @@
                                 //ToXmlString() won't work with dates before Jan 1, 1970, so use yyyy-mm-dd hh:mm:ss
                                 STRING dateStr;
                                 STRING str;
-                                if (dt->IsDate())
+                                if (dt->GetYear() != -1)
                                 {
                                     MgUtil::Int32ToString(dt->GetYear(), str);
                                     dateStr += str;
@@ -625,9 +626,9 @@
                                     MgUtil::PadLeft(str, 2, L'0');
                                     dateStr += str;
                                 }
-                                if (dt->IsTime())
+                                if (dt->GetHour() != -1)
                                 {
-                                    if (dt->IsDate())
+                                    if (dt->GetYear() != -1)
                                     {
                                         dateStr += L" ";
                                     }

Modified: branches/3.1/MgDev/Doc/devguide/source/revision_history.rst
===================================================================
--- branches/3.1/MgDev/Doc/devguide/source/revision_history.rst	2016-05-12 14:57:37 UTC (rev 8956)
+++ branches/3.1/MgDev/Doc/devguide/source/revision_history.rst	2016-05-12 15:01:09 UTC (rev 8957)
@@ -10,9 +10,12 @@
 +---------+-----------------+-----------------+--------------------------------------------------------------+
 | Version | Authors         | Date            | Summary of Changes                                           |
 +=========+=================+=================+==============================================================+
+| 2.0.2   | Jackie Ng       | May 2016        | Fix malformed revision history table and add section about   |
+|         |                 |                 | mapguide-rest in supplemental development options            |
++---------+-----------------+-----------------+--------------------------------------------------------------+
 | 2.0.1   | Jackie Ng       | Jul 2014        | Updated code sample in section "Working with Feature Data"   |
 |         |                 |                 | to reflect the updated Sheboygan sample data set             |
-+=========+=================+=================+==============================================================+
++---------+-----------------+-----------------+--------------------------------------------------------------+
 | 2.0     | Jackie Ng       |                 | First version of developer's guide in source form            |
 |         |                 |                 |                                                              |
 |         |                 |                 | Added .net and Java code samples to match PHP examples       |

Modified: branches/3.1/MgDev/Doc/devguide/source/supplemental_development.rst
===================================================================
--- branches/3.1/MgDev/Doc/devguide/source/supplemental_development.rst	2016-05-12 14:57:37 UTC (rev 8956)
+++ branches/3.1/MgDev/Doc/devguide/source/supplemental_development.rst	2016-05-12 15:01:09 UTC (rev 8957)
@@ -35,4 +35,21 @@
 
 This library is used by the MapGuide Maestro application, and can be used in your own applications.
 
-Visit `the Maestro project homepage <http://trac.osgeo.org/mapguide/wiki/maestro>`_ for more information
\ No newline at end of file
+Visit `the Maestro project homepage <http://trac.osgeo.org/mapguide/wiki/maestro>`_ for more information
+
+.. _mapguiderest:
+
+mapguide-rest
+-------------
+
+mapguide-rest provides a REST API for MapGuide and includes a framework for easy publishing of spatial data.
+
+The REST API allows for any library capable of making HTTP request to work with MapGuide.
+
+mapguide-rest can be deployed on both Windows and Linux instances of MapGuide.
+
+Visit `the mapguide-rest homepage <https://github.com/jumpinjackie/mapguide-rest>`_ for more information
+
+.. note::
+
+    mapguide-rest requires a version of MapGuide that bundles PHP 5.3 or newer.
\ No newline at end of file

Modified: branches/3.1/MgDev/Server/src/Services/Feature/SelectCommand.cpp
===================================================================
--- branches/3.1/MgDev/Server/src/Services/Feature/SelectCommand.cpp	2016-05-12 14:57:37 UTC (rev 8956)
+++ branches/3.1/MgDev/Server/src/Services/Feature/SelectCommand.cpp	2016-05-12 15:01:09 UTC (rev 8957)
@@ -50,7 +50,7 @@
     // For SDF/SHP providers, they do not support ordering. But, they can support ordering through the FdoIExtendedSelect
     // command, provided that only a single property is being ordered on. So if it is the case that normal ordering is
     // not supported, we should try for extended select if the conditions are met.
-    bool bTryExtendedSelect = false;
+    m_bUseExtendedSelect = false;
     if (NULL != options)
     {
         Ptr<MgStringCollection> orderProps = options->GetOrderingProperties();
@@ -65,7 +65,7 @@
                 {
                     if (FdoCommandType_ExtendedSelect == cmds[i] && orderProps->GetCount() == 1)
                     {
-                        bTryExtendedSelect = true;
+                        m_bUseExtendedSelect = true;
                         break;
                     }
                 }
@@ -74,7 +74,7 @@
     }
 
     // Create FdoISelect command
-    if (bTryExtendedSelect)
+    if (m_bUseExtendedSelect)
         m_command = (FdoIExtendedSelect*)fdoConn->CreateCommand(FdoCommandType_ExtendedSelect);
     else
         m_command = (FdoISelect*)fdoConn->CreateCommand(FdoCommandType_Select);
@@ -219,7 +219,7 @@
 
     CHECKNULL((FdoISelect*)m_command, L"MgSelectCommand.Execute");
     FdoIExtendedSelect* extSelect = dynamic_cast<FdoIExtendedSelect*>(m_command.p);
-    if (NULL != extSelect)
+    if (m_bUseExtendedSelect && NULL != extSelect)
     {
         FdoPtr<FdoIScrollableFeatureReader> scReader = extSelect->ExecuteScrollable();
         CHECKNULL((FdoIScrollableFeatureReader*)scReader, L"MgSelectCommand.Execute");

Modified: branches/3.1/MgDev/Server/src/Services/Feature/SelectCommand.h
===================================================================
--- branches/3.1/MgDev/Server/src/Services/Feature/SelectCommand.h	2016-05-12 14:57:37 UTC (rev 8956)
+++ branches/3.1/MgDev/Server/src/Services/Feature/SelectCommand.h	2016-05-12 15:01:09 UTC (rev 8957)
@@ -80,6 +80,7 @@
     FdoPtr<FdoFilter> m_filter;
 
     MgFdoFilterCollection* GetSubFilters();
+    bool m_bUseExtendedSelect;
 };
 
 #endif

Modified: branches/3.1/MgDev/Server/src/Services/Mapping/MappingUtil.cpp
===================================================================
--- branches/3.1/MgDev/Server/src/Services/Mapping/MappingUtil.cpp	2016-05-12 14:57:37 UTC (rev 8956)
+++ branches/3.1/MgDev/Server/src/Services/Mapping/MappingUtil.cpp	2016-05-12 15:01:09 UTC (rev 8957)
@@ -732,6 +732,10 @@
                     double pixelsPerMapUnit = dr->GetMetersPerUnit() / METERS_PER_INCH * dr->GetDpi() / dr->GetMapScale();
                     int width = (int)(extent.width() * pixelsPerMapUnit + 0.5);
                     int height = (int)(extent.height() * pixelsPerMapUnit + 0.5);
+                    // if width or height is 0, raster provider will throw an exception. 
+                    // we set it to 1 to avoid the exception.
+                    if (0 == width) width = 1;
+                    if (0 == height) height = 1;
 
                     //perform the raster query
                     FdoPtr<FdoIFeatureReader> fdoReader;


Property changes on: branches/3.1/MgDev/Server/src/Services/Mapping/MappingUtil.cpp
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/2.4/MgDev/Server/src/Services/Mapping/MappingUtil.cpp:6738-6741,6749-6756,6777-6783,6785-6787,6789,6791-6794,6796-6801,6954-6962,6986-7006
/branches/2.6/MgDev/Server/src/Services/Mapping/MappingUtil.cpp:8365
/sandbox/adsk/2.4j/Server/src/Services/Mapping/MappingUtil.cpp:6327-6535
/sandbox/jng/createruntimemap/Server/src/Services/Mapping/MappingUtil.cpp:7486-7555
/sandbox/rfc94/Server/src/Services/Mapping/MappingUtil.cpp:5099-5163
/trunk/MgDev/Server/src/Services/Mapping/MappingUtil.cpp:6250-6326
   + /branches/2.4/MgDev/Server/src/Services/Mapping/MappingUtil.cpp:6738-6741,6749-6756,6777-6783,6785-6787,6789,6791-6794,6796-6801,6954-6962,6986-7006
/branches/2.6/MgDev/Server/src/Services/Mapping/MappingUtil.cpp:8365
/sandbox/adsk/2.4j/Server/src/Services/Mapping/MappingUtil.cpp:6327-6535
/sandbox/adsk/3.1n/Server/src/Services/Mapping/MappingUtil.cpp:8942
/sandbox/jng/createruntimemap/Server/src/Services/Mapping/MappingUtil.cpp:7486-7555
/sandbox/rfc94/Server/src/Services/Mapping/MappingUtil.cpp:5099-5163
/trunk/MgDev/Server/src/Services/Mapping/MappingUtil.cpp:8955-8956

Modified: branches/3.1/MgDev/Server/src/Services/Rendering/ServerRenderingService.cpp
===================================================================
--- branches/3.1/MgDev/Server/src/Services/Rendering/ServerRenderingService.cpp	2016-05-12 14:57:37 UTC (rev 8956)
+++ branches/3.1/MgDev/Server/src/Services/Rendering/ServerRenderingService.cpp	2016-05-12 15:01:09 UTC (rev 8957)
@@ -1574,14 +1574,23 @@
         if (maxFeatures <= 0)
             break;
 
-        //get the MDF layer definition
+        MdfModel::VectorLayerDefinition* vl = NULL;
+        auto_ptr<MdfModel::LayerDefinition> ldf;
         Ptr<MgResourceIdentifier> layerResId = layer->GetLayerDefinition();
-        MgCacheManager* cacheManager = MgCacheManager::GetInstance();
-        Ptr<MgResourceLayerDefinitionCacheItem> cacheItem = cacheManager->GetResourceLayerDefinitionCacheItem(layerResId);
-        MdfModel::LayerDefinition* layerDefinition = cacheItem->Get();
+        if (bOnlyVisibleLayers)
+        {
+            //get the MDF layer definition
+            MgCacheManager* cacheManager = MgCacheManager::GetInstance();
+            Ptr<MgResourceLayerDefinitionCacheItem> cacheItem = cacheManager->GetResourceLayerDefinitionCacheItem(layerResId);
+            MdfModel::LayerDefinition* layerDefinition = cacheItem->Get();
+            vl = dynamic_cast<MdfModel::VectorLayerDefinition*>(layerDefinition);
+        }
+        else
+        {
+            ldf.reset(MgLayerBase::GetLayerDefinition(m_svcResource, layerResId));
+            vl = dynamic_cast<MdfModel::VectorLayerDefinition*>(ldf.get());
+        }
 
-        MdfModel::VectorLayerDefinition* vl = dynamic_cast<MdfModel::VectorLayerDefinition*>(layerDefinition);
-
         //we can only do geometric query selection for vector layers
         if (vl)
         {
@@ -2043,11 +2052,9 @@
             continue;
 
         Ptr<MgResourceIdentifier> layerid = mapLayer->GetLayerDefinition();
-        MgCacheManager* cacheManager = MgCacheManager::GetInstance();
-        Ptr<MgResourceLayerDefinitionCacheItem> cacheItem = cacheManager->GetResourceLayerDefinitionCacheItem(layerid);
-        MdfModel::LayerDefinition* layerDefinition = cacheItem->Get();
+        ldf.reset(MgLayerBase::GetLayerDefinition(m_svcResource, layerid));
+        WatermarkInstanceCollection* layerWatermarks = ldf->GetWatermarks();
 
-        WatermarkInstanceCollection* layerWatermarks = layerDefinition->GetWatermarks();
         for (int j=layerWatermarks->GetCount()-1; j>=0; j--)
             tempWatermarkInstances.Adopt(layerWatermarks->OrphanAt(j));
         for (int j=tempWatermarkInstances.GetCount()-1; j>=0; j--)

Modified: branches/3.1/MgDev/Web/src/schemareport/displayschemafunctions.php
===================================================================
--- branches/3.1/MgDev/Web/src/schemareport/displayschemafunctions.php	2016-05-12 14:57:37 UTC (rev 8956)
+++ branches/3.1/MgDev/Web/src/schemareport/displayschemafunctions.php	2016-05-12 15:01:09 UTC (rev 8957)
@@ -120,7 +120,7 @@
     //
     //NOTE: If MapGuide supported scrollable readers like FDO, we'd have also tried 
     //that as well.
-    $totalEntries = -1;
+    $totalEntries = 0;
     $featureName = $schemaName . ":" . $className;
     $canCount = false;
     $gotCount = false;



More information about the mapguide-commits mailing list