[mapguide-commits] r8955 - in trunk/MgDev: . Common/MapGuideCommon/Controller 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 07:42:00 PDT 2016


Author: jng
Date: 2016-05-12 07:42:00 -0700 (Thu, 12 May 2016)
New Revision: 8955

Modified:
   trunk/MgDev/
   trunk/MgDev/Common/MapGuideCommon/Controller/HtmlController.cpp
   trunk/MgDev/Server/src/Services/Feature/SelectCommand.cpp
   trunk/MgDev/Server/src/Services/Feature/SelectCommand.h
   trunk/MgDev/Server/src/Services/Mapping/MappingUtil.cpp
   trunk/MgDev/Server/src/Services/Rendering/ServerRenderingService.cpp
   trunk/MgDev/Web/src/schemareport/displayschemafunctions.php
Log:
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.
........



Property changes on: trunk/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:8869-8871

Modified: trunk/MgDev/Common/MapGuideCommon/Controller/HtmlController.cpp
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/Controller/HtmlController.cpp	2016-05-11 12:52:52 UTC (rev 8954)
+++ trunk/MgDev/Common/MapGuideCommon/Controller/HtmlController.cpp	2016-05-12 14:42:00 UTC (rev 8955)
@@ -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: trunk/MgDev/Server/src/Services/Feature/SelectCommand.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/Feature/SelectCommand.cpp	2016-05-11 12:52:52 UTC (rev 8954)
+++ trunk/MgDev/Server/src/Services/Feature/SelectCommand.cpp	2016-05-12 14:42:00 UTC (rev 8955)
@@ -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: trunk/MgDev/Server/src/Services/Feature/SelectCommand.h
===================================================================
--- trunk/MgDev/Server/src/Services/Feature/SelectCommand.h	2016-05-11 12:52:52 UTC (rev 8954)
+++ trunk/MgDev/Server/src/Services/Feature/SelectCommand.h	2016-05-12 14:42:00 UTC (rev 8955)
@@ -80,6 +80,7 @@
     FdoPtr<FdoFilter> m_filter;
 
     MgFdoFilterCollection* GetSubFilters();
+    bool m_bUseExtendedSelect;
 };
 
 #endif

Modified: trunk/MgDev/Server/src/Services/Mapping/MappingUtil.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/Mapping/MappingUtil.cpp	2016-05-11 12:52:52 UTC (rev 8954)
+++ trunk/MgDev/Server/src/Services/Mapping/MappingUtil.cpp	2016-05-12 14:42:00 UTC (rev 8955)
@@ -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: trunk/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:6250-6326

Modified: trunk/MgDev/Server/src/Services/Rendering/ServerRenderingService.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/Rendering/ServerRenderingService.cpp	2016-05-11 12:52:52 UTC (rev 8954)
+++ trunk/MgDev/Server/src/Services/Rendering/ServerRenderingService.cpp	2016-05-12 14:42:00 UTC (rev 8955)
@@ -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: trunk/MgDev/Web/src/schemareport/displayschemafunctions.php
===================================================================
--- trunk/MgDev/Web/src/schemareport/displayschemafunctions.php	2016-05-11 12:52:52 UTC (rev 8954)
+++ trunk/MgDev/Web/src/schemareport/displayschemafunctions.php	2016-05-12 14:42:00 UTC (rev 8955)
@@ -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