[mapguide-commits] r7472 - in sandbox/jng/queryfeatures_v2: Common/MapGuideCommon/Controller Web/src/HttpHandler

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Fri May 3 15:21:33 PDT 2013


Author: jng
Date: 2013-05-03 15:21:33 -0700 (Fri, 03 May 2013)
New Revision: 7472

Modified:
   sandbox/jng/queryfeatures_v2/Common/MapGuideCommon/Controller/HtmlController.cpp
   sandbox/jng/queryfeatures_v2/Web/src/HttpHandler/HttpQueryMapFeatures.cpp
   sandbox/jng/queryfeatures_v2/Web/src/HttpHandler/HttpResourceStrings.cpp
Log:
This submission contains the following changes:
 - Fix inline selection not working. We were feeding RenderDynamicOverlay a bad image format and had a bad query parameter
 - MgHtmlController: Call QueryFeatures() internally regardless of mask value, as all mask values require some part of the MgFeatureInformation that is returned.
 - MgHtmlController: Use MgMemoryStreamHelper to do the MgByteReader -> base64 string conversion.

Modified: sandbox/jng/queryfeatures_v2/Common/MapGuideCommon/Controller/HtmlController.cpp
===================================================================
--- sandbox/jng/queryfeatures_v2/Common/MapGuideCommon/Controller/HtmlController.cpp	2013-05-03 20:39:11 UTC (rev 7471)
+++ sandbox/jng/queryfeatures_v2/Common/MapGuideCommon/Controller/HtmlController.cpp	2013-05-03 22:21:33 UTC (rev 7472)
@@ -261,15 +261,8 @@
     // Create Proxy Rendering Service instance
     Ptr<MgRenderingService> service = (MgRenderingService*)(GetService(MgServiceType::RenderingService));
 
-    //Any of these bits requires a QueryFeatures() call
-    if (((requestData & REQUEST_INLINE_SELECTION) == REQUEST_INLINE_SELECTION) ||
-        ((requestData & REQUEST_TOOLTIP) == REQUEST_TOOLTIP) ||
-        ((requestData & REQUEST_HYPERLINK) == REQUEST_HYPERLINK))
-    {
-        // Call the C++ API
-        featureInfo = service->QueryFeatures(map, layerNames, selectionGeometry,
-            selectionVariant, featureFilter, maxFeatures, layerAttributeFilter);
-    }
+    // Call the C++ API, regardless of bitmask as any part of the mask will require information from this API
+    featureInfo = service->QueryFeatures(map, layerNames, selectionGeometry, selectionVariant, featureFilter, maxFeatures, layerAttributeFilter);
 
     if (persist)
     {
@@ -286,16 +279,9 @@
     // Render an image of this selection if requested
     if (((requestData & REQUEST_INLINE_SELECTION) == REQUEST_INLINE_SELECTION) && NULL != newSelection.p)
     {
-        try
-        {
-            Ptr<MgColor> selColor = new MgColor(selectionColor);
-            Ptr<MgRenderingOptions> renderOpts = new MgRenderingOptions(selectionFormat, MgRenderingOptions::RenderLayers | MgRenderingOptions::RenderSelection | MgRenderingOptions::KeepSelection, selColor);
-            inlineSelectionImg = service->RenderDynamicOverlay(map, newSelection, renderOpts);
-        }
-        catch (MgException* ex)
-        {
-            SAFE_RELEASE(ex);
-        }
+        Ptr<MgColor> selColor = new MgColor(selectionColor);
+        Ptr<MgRenderingOptions> renderOpts = new MgRenderingOptions(selectionFormat, MgRenderingOptions::RenderSelection | MgRenderingOptions::KeepSelection, selColor);
+        inlineSelectionImg = service->RenderDynamicOverlay(map, newSelection, renderOpts);
     }
 
     if ((requestData & REQUEST_ATTRIBUTES) == REQUEST_ATTRIBUTES)
@@ -362,12 +348,17 @@
     if (((requestData & REQUEST_INLINE_SELECTION) == REQUEST_INLINE_SELECTION) && NULL != inlineSelection)
     {
         xml.append(L"<InlineSelectionImage>\n");
-        Ptr<MgByteSink> imgSink = new MgByteSink(inlineSelection);
-        Ptr<MgByte> imgBuffer = imgSink->ToBuffer();
-        string b64;
-        b64.resize(len, '\0');
-        Base64::Encode((char*)b64.c_str(), (const unsigned char*)imgBuffer->Bytes(), imgBuffer->GetLength());
+        xml.append(L"<MimeType>\n");
+        xml.append(inlineSelection->GetMimeType());
+        xml.append(L"</MimeType>\n");
+        xml.append(L"<Content>\n");
+        MgByteSink sink(inlineSelection);
+        Ptr<MgByte> bytes = sink.ToBuffer();
+        Ptr<MgMemoryStreamHelper> streamHelper = new MgMemoryStreamHelper((INT8*) bytes->Bytes(), bytes->GetLength(), false);
+        std::string b64 = streamHelper->ToBase64();
         STRING wb64 = MgUtil::MultiByteToWideChar(b64);
+        xml.append(wb64);
+        xml.append(L"</Content>\n");
         xml.append(L"</InlineSelectionImage>\n");
     }
     else

Modified: sandbox/jng/queryfeatures_v2/Web/src/HttpHandler/HttpQueryMapFeatures.cpp
===================================================================
--- sandbox/jng/queryfeatures_v2/Web/src/HttpHandler/HttpQueryMapFeatures.cpp	2013-05-03 20:39:11 UTC (rev 7471)
+++ sandbox/jng/queryfeatures_v2/Web/src/HttpHandler/HttpQueryMapFeatures.cpp	2013-05-03 22:21:33 UTC (rev 7472)
@@ -74,9 +74,9 @@
     INT32 version = m_userInfo->GetApiVersion();
     if (version == MG_API_VERSION(2,6,0))
     {
-        m_requestData = 1 | 2 | 4 | 8;
+        m_requestData = 0;
         STRING strReqData = params->GetParameterValue(MgHttpResourceStrings::reqRenderingRequestData);
-        if (strReqData.empty())
+        if (!strReqData.empty())
             m_requestData = MgUtil::StringToInt32(strReqData);
         m_selectionFormat = params->GetParameterValue(MgHttpResourceStrings::reqRenderingSelectionFormat);
         m_selectionColor = params->GetParameterValue(MgHttpResourceStrings::reqRenderingSelectionColor);

Modified: sandbox/jng/queryfeatures_v2/Web/src/HttpHandler/HttpResourceStrings.cpp
===================================================================
--- sandbox/jng/queryfeatures_v2/Web/src/HttpHandler/HttpResourceStrings.cpp	2013-05-03 20:39:11 UTC (rev 7471)
+++ sandbox/jng/queryfeatures_v2/Web/src/HttpHandler/HttpResourceStrings.cpp	2013-05-03 22:21:33 UTC (rev 7472)
@@ -231,7 +231,7 @@
 const STRING MgHttpResourceStrings::reqRenderingGeometry = L"GEOMETRY";
 const STRING MgHttpResourceStrings::reqRenderingFeatureFilter = L"FEATUREFILTER";
 const STRING MgHttpResourceStrings::reqRenderingRequestData = L"REQUESTDATA";
-const STRING MgHttpResourceStrings::reqRenderingSelectionFormat = L"REQUESTDATA";
+const STRING MgHttpResourceStrings::reqRenderingSelectionFormat = L"SELECTIONFORMAT";
 
 const STRING MgHttpResourceStrings::reqRenderingBaseMapLayerGroupName = L"BASEMAPLAYERGROUPNAME";
 const STRING MgHttpResourceStrings::reqRenderingTileColumn = L"TILECOL";



More information about the mapguide-commits mailing list