[mapguide-commits] r6042 - in trunk/MgDev/Web/src/mapadmin: .
images profilingmapxml
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Mon Aug 8 02:19:51 EDT 2011
Author: hubu
Date: 2011-08-07 23:19:51 -0700 (Sun, 07 Aug 2011)
New Revision: 6042
Added:
trunk/MgDev/Web/src/mapadmin/images/ajax_loading.gif
trunk/MgDev/Web/src/mapadmin/images/close.png
trunk/MgDev/Web/src/mapadmin/images/mapDefinitionNameInfo.png
trunk/MgDev/Web/src/mapadmin/images/warning.png
trunk/MgDev/Web/src/mapadmin/performanceReport.php
trunk/MgDev/Web/src/mapadmin/performanceReport_Export.php
trunk/MgDev/Web/src/mapadmin/performanceReport_GetResult.php
trunk/MgDev/Web/src/mapadmin/performanceReport_MapViewer.php
trunk/MgDev/Web/src/mapadmin/profilingmapxml/
trunk/MgDev/Web/src/mapadmin/profilingmapxml/MapViewerTemplate.xml
Modified:
trunk/MgDev/Web/src/mapadmin/resizablepagecomponents.php
trunk/MgDev/Web/src/mapadmin/serverdatafunctions.php
Log:
On behalf of Ted Yang.
fix the ticket 1768: http://trac.osgeo.org/mapguide/ticket/1768
As the profiling API is not finished yet, this submission is only the partial implement of the UI. It includes:
1. Add a new php file "PerformanceReport?.php" under the site Admin
2. Add one link point to the PerformaceReport? page on the left menu items
3. implement the settings part of the UI, in this part users can input their settings to get the results.
4. use temp data to simulate the Profiling results, in this part users can view the profiling results in a visual way.
Added: trunk/MgDev/Web/src/mapadmin/images/ajax_loading.gif
===================================================================
(Binary files differ)
Property changes on: trunk/MgDev/Web/src/mapadmin/images/ajax_loading.gif
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/MgDev/Web/src/mapadmin/images/close.png
===================================================================
(Binary files differ)
Property changes on: trunk/MgDev/Web/src/mapadmin/images/close.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/MgDev/Web/src/mapadmin/images/mapDefinitionNameInfo.png
===================================================================
(Binary files differ)
Property changes on: trunk/MgDev/Web/src/mapadmin/images/mapDefinitionNameInfo.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/MgDev/Web/src/mapadmin/images/warning.png
===================================================================
(Binary files differ)
Property changes on: trunk/MgDev/Web/src/mapadmin/images/warning.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/MgDev/Web/src/mapadmin/performanceReport.php
===================================================================
--- trunk/MgDev/Web/src/mapadmin/performanceReport.php (rev 0)
+++ trunk/MgDev/Web/src/mapadmin/performanceReport.php 2011-08-08 06:19:51 UTC (rev 6042)
@@ -0,0 +1,1392 @@
+<?php
+//
+// 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
+//
+
+try
+{
+ include 'resizableadmin.php';
+
+ LoadSessionVars();
+
+ // Did the user logout?
+ CheckForLogout();
+
+ // Are we cancelling? If so, there is nothing to do.
+ CheckForCancel( 'performanceReport.php' );
+
+ // Define Local values
+ $menuCategory = PERFORMANCE_REPORT_MENU_ITEM;
+ $pageTitle = PERFORMANCE_REPORT_MENU_ITEM;
+ $helpPage = 'HelpDocs/performanceReport.htm';
+ $pageName = 'PerformanceReportPage';
+ $formName = 'PerformanceReportForm';
+ $homePage = NULL;
+ $confirmationMsg = "";
+ $errorMsg = "";
+ $mapProfileResult=new MapProfileResult();
+ $mapResources;
+ $mapResourceShortNames;
+ $displayManager= new DisplayProfileResultManager();
+
+ function GetAllMapResources()
+ {
+ try
+ {
+ global $site;
+ global $userInfo;
+ global $mapResources;
+ global $mapResourceShortNames;
+ $mapResourcesXml = "";
+
+ // Enumerates all maps in the library
+ $resourceID = new MgResourceIdentifier("Library://");
+ //connect to the site and get a resource service instance
+ $siteConn = new MgSiteConnection();
+ $siteConn->Open($userInfo);
+ $resourceService = $siteConn->CreateService(MgServiceType::ResourceService);
+
+ $byteReader = $resourceService->EnumerateResources($resourceID, -1, "MapDefinition");
+
+ $chunk = "";
+ do
+ {
+ $chunkSize = $byteReader->Read($chunk, 4096);
+ $mapResourcesXml = $mapResourcesXml . $chunk;
+ } while ($chunkSize != 0);
+
+ $resourceList = new DOMDocument();
+ $resourceList->loadXML($mapResourcesXml);
+
+ $resourceIdNodeList = $resourceList->documentElement->getElementsByTagName("ResourceId");
+
+ for ($i = 0; $i < $resourceIdNodeList->length; $i++)
+ {
+ $mapResourceID = $resourceIdNodeList->item($i)->nodeValue;
+ $shortMapName = strrchr($mapResourceID, '/');
+ $shortMapName = substr($shortMapName, 1, strlen($shortMapName) - 15);
+ $mapResources[$i] = $mapResourceID;
+ $mapResourceShortNames[$i] = $shortMapName;
+ }
+
+ array_multisort($mapResourceShortNames, $mapResources);
+ }
+ catch (Exception $exc)
+ {
+ $errorMsg = $exc->getMessage();
+ }
+ }
+
+ GetAllMapResources();
+}
+catch ( MgException $e )
+{
+ CheckForFatalMgException( $e );
+ $errorMsg = $e->GetExceptionMessage();
+}
+catch ( Exception $e )
+{
+ $errorMsg = $e->getMessage();
+}
+?>
+
+<!-- PAGE DEFINITION -->
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+ <?php OutputHeader( $pageTitle ); ?>
+<body>
+ <div id="bgDiv" class="bgDivStyle"></div>
+ <table cellspacing="0" cellpadding="0" border="0" class="main">
+ <tr>
+ <?php DisplaySiteHeader( false, true, true, true, $formName, $homePage ); ?>
+ </tr>
+ <tr>
+ <?php DisplayLefthandSash( $menuCategory ); ?>
+
+ <!-- Contents Area -->
+ <?php BeginContentArea( $formName ); ?>
+
+ <?php
+ DeclareHiddenVars( $pageName );
+ DisplayTitleBar( $pageTitle, $helpPage );
+ DisplayConfirmationMsg( $confirmationMsg );
+ DisplayErrorMsg( $errorMsg );
+ ?>
+
+ <style type="text/css">
+ .layerResultsHeaderStyle table,.layerResultsHeaderStyle td
+ {
+ font:100% Arial, Helvetica, sans-serif;
+ }
+
+ .layerResultsHeaderStyle table
+ {
+ width:100%;
+ border-collapse:collapse;
+ margin: 0px;
+ padding: 0px;
+ }
+
+ .layerResultsHeaderStyle th
+ {
+ text-align:center;
+ padding:.5em;
+ width: 20%;
+ border:1px solid #CCCCCC;
+ background-color:#EEEEEE;
+ border-bottom: none;
+ }
+
+ .layerResultsStyle table,.layerResultsStyle td
+ {
+ font:100% Arial, Helvetica, sans-serif;
+ }
+
+ .layerResultsStyle table
+ {
+ width:100%;
+ border-collapse:collapse;
+ margin:1em 0;
+ }
+
+ .layerResultsStyle th,.layerResultsStyle td
+ {
+ text-align:left;
+ padding:.5em;
+ border:1px solid #CCCCCC;
+ }
+
+ .layerResultsStyle th
+ {
+ background-color:#EEEEEE;
+ }
+
+ .layerResultsStyle tr.even td
+ {
+ background:#EEEEEE;
+ }
+
+ .layerResultsStyle tr.odd td
+ {
+ background:#FFFFFF;
+ }
+
+ .layerResultsStyle th.over, .layerResultsStyle tr.even th.over,.layerResultsStyle tr.odd th.over
+ {
+ background:#b4c6de;
+ }
+
+
+ .layerResultsStyle td.over,.layerResultsStyle tr.even td.over,.layerResultsStyle tr.odd td.over
+ {
+ background:#b4c6de;
+ }
+
+ /* use this if you want to apply different styleing to empty table cells*/
+ .layerResultsStyle td.empty,.layerResultsStyle tr.odd td.empty,.layerResultsStyle tr.even td.empty
+ {
+ background:#FFFFFF;
+ }
+
+ #layerBody
+ {
+ Height: 200px;
+ margin: 0px;
+ padding: 0px;
+ overFlow: auto;
+ }
+
+ .mapDefinitionResultTableStyle tr
+ {
+ height: 35px;
+ }
+ .mapDefinitionResultTableStyle td
+ {
+ text-align: left;
+ vertical-align: top;
+ }
+
+ .mapDefinitionResultTableStyle
+ {
+ font-size: medium;
+ }
+
+ .hideTooltip
+ {
+ display: none;
+ }
+
+ .showTooltip
+ {
+ position: absolute;
+ padding: 2px 4px 4px 4px;
+ background-color: #ffffee;
+ color: black;
+ border-top: 1px solid #999999;
+ border-right: 2px solid #666666;
+ border-bottom: 2px solid #666666;
+ border-left: 1px solid #666666;
+ z-index: 100;
+ line-height: 1.0;
+ white-space: normal;
+ font-weight: normal;
+ }
+
+ .mapNameStyle
+ {
+ background: #EEEEEE url('images/mapDefinitionNameInfo.png') no-repeat right;
+ padding-right: 20px;
+ cursor:default;
+ }
+
+ .warnMsgStyle
+ {
+ border-color: red;
+ }
+
+ .bgDivStyle
+ {
+ position:fixed;
+ left:0;
+ top:0;
+ background-color:#777777;
+ filter:alpha(Opacity=30);
+ opacity:0.6;
+ z-index:10000;
+ display: none;
+ }
+
+ .mapViewerDialogStyle
+ {
+ background-color:white;
+ border: 1px solid #000000;
+ padding: 0px;
+ margin: 0px;
+ position:absolute;
+ z-index:10000;
+ width:800px;
+ height:600px;
+ text-align:center;
+ line-height:25px;
+ display: none;
+ }
+
+ .mapSelectorBtnStyle
+ {
+ background-color:red;
+ border: 1px solid #000000;
+ padding: 0px;
+ margin: 0px;
+ position:absolute;
+ z-index:100001;
+ width:200px;
+ height:60px;
+ text-align:center;
+ line-height:25px;
+ top: 400px;
+ left: 400px;
+ }
+
+ </style>
+
+ <script type="text/javascript">
+ var Common = {
+ getItself: function(id)
+ {
+ return "string" == typeof id ? document.getElementById(id) : id;
+ },
+ getEvent: function()
+ {
+ if (document.all)
+ {
+ return window.event;
+ }
+ func = getEvent.caller;
+ while (func != null)
+ {
+ var arg0 = func.arguments[0];
+ if (arg0)
+ {
+ if ((arg0.constructor == Event || arg0.constructor == MouseEvent) || (typeof (arg0) == "object" && arg0.preventDefault && arg0.stopPropagation))
+ {
+ return arg0;
+ }
+ }
+ func = func.caller;
+ }
+ return null;
+ },
+ getMousePos: function(ev)
+ {
+ if (!ev)
+ {
+ ev = this.getEvent();
+ }
+ if (ev.pageX || ev.pageY)
+ {
+ return {x: ev.pageX , y: ev.pageY};
+ }
+
+ if (document.documentElement.scrollLeft && document.documentElement.scrollTop)
+ {
+ return {
+ x: ev.clientX + document.documentElement.scrollLeft - document.documentElement.clientLeft,
+ y: ev.clientY + document.documentElement.scrollTop - document.documentElement.clientTop
+ };
+ }
+ else if (document.body)
+ {
+ return {
+ x: ev.clientX + document.body.scrollLeft - document.body.clientLeft,
+ y: ev.clientY + document.body.scrollTop - document.body.clientTop
+ };
+ }
+ },
+ getElementPos: function(el)
+ {
+ el = this.getItself(el);
+ var _x = 0, _y = 0;
+ do
+ {
+ _x += el.offsetLeft;
+ _y += el.offsetTop;
+ } while ((el = el.offsetParent));
+
+ return { x: _x, y: _y };
+ }
+ }
+
+ function CollapsibleTabClick(tabId,contentId)
+ {
+ var collapseImage = document.getElementById(tabId);
+ var content = document.getElementById(contentId);
+
+ if (collapseImage.alt == "down")
+ {
+ collapseImage.alt = "left";
+ collapseImage.src = "images/testImages/left_18.jpg";
+ content.style.display = "none";
+ }
+ else
+ {
+ collapseImage.alt = "down";
+ collapseImage.src = "images/testImages/down_17.jpg";
+ content.style.display = "block";
+ }
+ }
+
+ function CollapseSettingTab()
+ {
+ var collapseImage = document.getElementById("settings_CollapseImage_ID");
+ var content = document.getElementById("settingsContent");
+
+ collapseImage.alt = "left";
+ collapseImage.src = "images/testImages/left_18.jpg";
+
+ content.style.display = "none";
+ }
+
+ function SetResultNotMatchWarningMsg(visible)
+ {
+ var wrnMsg=document.getElementById("ResultNotMatchWrn");
+ if(visible)
+ {
+ wrnMsg.style.display = "block";
+ }
+ else
+ {
+ wrnMsg.style.display = "none";
+ }
+ }
+
+ function ShowReportWarningMsg()
+ {
+ var reportTab=document.getElementById("resultsTab");
+ if(reportTab.style.display=="block")
+ {
+ SetResultNotMatchWarningMsg(true);
+ }
+ }
+
+ function ExpandResultsTab()
+ {
+ var content = document.getElementById("resultsTab");
+ content.style.display = "block";
+ }
+
+ function MapResoucesNameSelectChange()
+ {
+ var tipDiv=document.getElementById("mapResourceNameTip");
+ var mapDefinitonSelector=document.getElementById("mapSelector_DO_NOT_PERSIST");
+
+ var settingsBtn=document.getElementById("mapViewerBtn");
+ var centerPoint=document.getElementById("txtCenterPoint");
+ var scale=document.getElementById("txtScale");
+
+ //If another map is selected, then the center point and scale should be cleared of values,
+ //that is return to default values “enter center point” and “enter scale”.
+ if(centerPoint.value!="Enter center point")
+ {
+ centerPoint.value="Enter center point";
+ }
+
+ if( scale.value!="Enter scale")
+ {
+ scale.value="Enter scale";
+ }
+
+ //show the map definition ID by the side of the map selector
+ if(mapDefinitonSelector.selectedIndex>=0)
+ {
+ tipDiv.innerHTML=mapDefinitonSelector.options[mapDefinitonSelector.selectedIndex].value;
+ //clear warning message
+ var mapSelectorWarnMsg=document.getElementById("selectMapResourceWarningMessage");
+ mapSelectorWarnMsg.innerHTML = "";
+
+ //text input Controls in Step 2 are enabled once a map resource is selected in Step 1.
+ centerPoint.removeAttribute("disabled");
+ scale.removeAttribute("disabled");
+ settingsBtn.removeAttribute("disabled");
+
+ var visible=ValidateScale(false);
+ if(visible)
+ {
+ visible=ValidateCenterPoint(false);
+ }
+
+ SetRunButtonState(visible);
+ }
+ else
+ {
+ tipDiv.innerHTML="";
+ //when user clear the settings, the mapselector is not seleced and the text area is disabled
+ settingsBtn.setAttribute("disabled","disabled");
+ centerPoint.setAttribute("disabled", "disabled");
+ scale.setAttribute("disabled", "disabled");
+
+ SetRunButtonState(false);
+ }
+
+ ClearWrnMsg();
+ ShowReportWarningMsg();
+ }
+
+ function ValidateScale(needFormat)
+ {
+ var result=false;
+
+ var scale=document.getElementById("txtScale");
+ var scaleWarnMsg=document.getElementById("scaleWarnMessage");
+ var scaleValue=RemoveSpace(scale.value);
+
+ if("" == scaleValue)
+ {
+ result=false;
+ scaleWarnMsg.innerHTML = "A map scale was not entered.";
+ scale.className="warnMsgStyle";
+ }
+ else
+ {
+ //positive float
+ var regFloat =/^(\+)?\d+(\.(\d)+)?$/;
+ result = regFloat.test(scaleValue);
+
+ if(!result)
+ {
+ scaleWarnMsg.innerHTML = "Not a valid map scale.";
+ scale.className="warnMsgStyle";
+ }
+ else
+ {
+ if(needFormat)
+ {
+ scale.value=formatNumber(scaleValue,2);
+ }
+
+
+ scaleWarnMsg.innerHTML = "";
+ scale.className="";
+ }
+ }
+ return result;
+ }
+
+ function ValidateCenterPoint(needFormat)
+ {
+ var result=false;
+
+ var centerPoint=document.getElementById("txtCenterPoint");
+ var centerPointWarnMsg=document.getElementById("centerPointWarnMessage");
+ var centerPointValue=RemoveSpace(centerPoint.value);
+
+ if("" == centerPointValue)
+ {
+ result=false;
+ centerPointWarnMsg.innerHTML = "A center point was not entered.";
+ centerPoint.className="warnMsgStyle";
+ }
+ else
+ {
+ try
+ {
+ var point=centerPointValue.split("*");
+ if(point.length!=2)
+ {
+ result=false;
+ centerPointWarnMsg.innerHTML = "Not a valid center point.";
+ centerPoint.className="warnMsgStyle";
+ }
+ else
+ {
+ var x=point[0];
+ var y=point[1];
+
+ result=!(IsNotFloat(x)||IsNotFloat(y));
+
+ if(!result)
+ {
+ centerPointWarnMsg.innerHTML = "Not a valid center point.";
+ centerPoint.className="warnMsgStyle";
+ }
+ else
+ {
+ if(needFormat)
+ {
+ centerPoint.value=formatCenterPoint(x,y,2);
+ }
+
+ centerPointWarnMsg.innerHTML = "";
+ centerPoint.className="";
+ }
+ }
+ }
+ catch(e)
+ {
+ result=false;
+ centerPointWarnMsg.innerHTML = "Not a valid center point.";
+ centerPoint.className="warnMsgStyle";
+ }
+ }
+
+ return result;
+ }
+
+ function ScaleTxtKeyUp()
+ {
+ var visible=ValidateScale(false);
+
+ if(visible)
+ {
+ var mapDefinitonSelector=document.getElementById("mapSelector_DO_NOT_PERSIST");
+ if(mapDefinitonSelector.selectedIndex>=0)
+ {
+ visible=ValidateCenterPoint(false);
+ }
+ else
+ {
+ visible=false;
+ }
+ }
+
+ SetRunButtonState(visible);
+ }
+
+ function CenterPointTxtKeyUp()
+ {
+ var visible=ValidateCenterPoint(false);
+
+ if(visible)
+ {
+ var mapDefinitonSelector=document.getElementById("mapSelector_DO_NOT_PERSIST");
+ if(mapDefinitonSelector.selectedIndex>=0)
+ {
+ visible=ValidateScale(false);
+ }
+ else
+ {
+ visible=false;
+ }
+ }
+
+ SetRunButtonState(visible);
+ }
+
+ function ScaleFocus()
+ {
+ var scale=document.getElementById("txtScale");
+
+ if( scale.value=="Enter scale")
+ {
+ scale.value="";
+ }
+ }
+
+ function CenterPointFocus()
+ {
+ var centerPoint=document.getElementById("txtCenterPoint");
+
+ if( centerPoint.value=="Enter center point")
+ {
+ centerPoint.value="";
+ }
+ }
+
+ var checkMapFrameLoadedInterval = null;
+ function SelectMapSettings()
+ {
+ var mapFrame=document.getElementById("mapViewerFrame");
+ var mapDefinitonSelector=document.getElementById("mapSelector_DO_NOT_PERSIST");
+ if(mapDefinitonSelector.selectedIndex>=0)
+ {
+ mapFrame.src="performanceReport_MapViewer.php?mapDefinition="+mapDefinitonSelector.options[mapDefinitonSelector.selectedIndex].value;
+ }
+
+ var bgDiv=document.getElementById("bgDiv");
+ var mapViewerDiv=document.getElementById("mapViewerDialog");
+
+ bgDiv.style.display = "block";
+ SetBgDivSize(bgDiv);
+
+ mapViewerDiv.style.display = "block";
+ SetMapViewerLoaction(mapViewerDiv);
+
+ checkMapFrameLoadedInterval = setInterval(CheckMapFrameLoaded, 100);
+ }
+
+ function SetBgDivSize(bgDiv)
+ {
+ bgDiv.style.height = document.body.offsetHeight+"px";
+ bgDiv.style.width = document.body.offsetWidth+"px";
+ }
+
+ var mapViewerWidth=800;
+ var mapViewerHeight=600;
+ function SetMapViewerLoaction(mapViewerDiv)
+ {
+ if(document.body.clientHeight > mapViewerHeight)
+ {
+ mapViewerDiv.style.top=(document.body.clientHeight/2-mapViewerHeight/2)+"px";
+ }
+ else
+ {
+ mapViewerDiv.style.top="10px";
+ }
+
+ if(document.body.clientWidth > mapViewerWidth)
+ {
+ mapViewerDiv.style.left=(document.body.clientWidth/2-mapViewerWidth/2)+"px";
+ }
+ else
+ {
+ mapViewerDiv.style.left="10px";
+ }
+ }
+
+ window.onresize=WindowResized;
+
+ function WindowResized()
+ {
+ var mapViewerDiv=document.getElementById("mapViewerDialog");
+
+ if("block" == mapViewerDiv.style.display.toLowerCase())
+ {
+ SetMapViewerLoaction(mapViewerDiv);
+ }
+
+ var bgDiv=document.getElementById("bgDiv");
+ if("block" == bgDiv.style.display.toLowerCase())
+ {
+ SetBgDivSize(bgDiv);
+ }
+ }
+
+ function CheckMapFrameLoaded()
+ {
+ if(!IsMapFrameLoaded())
+ return;
+
+ clearInterval(checkMapFrameLoadedInterval);
+
+ CreateButtons();
+ }
+
+ function IsMapFrameLoaded()
+ {
+ var mainFrame = window.frames["mapViewerFrame"];
+
+ if (!mainFrame)
+ return false;
+
+ if (!mainFrame || !mainFrame.GetMapFrame)
+ return false;
+
+ var mapFrame = mainFrame.GetMapFrame();
+
+ return (mapFrame.ZoomToView != null);
+ }
+
+ function CloseMapViewer()
+ {
+ var bgDiv=document.getElementById("bgDiv");
+ var msgDiv=document.getElementById("mapViewerDialog");
+
+ bgDiv.style.display = "none";
+ msgDiv.style.display="none";
+
+ //must destory the old page, if not, the CheckMapFrameLoaded
+ //will get the old page's frame and then the buttons will not be displayed in new page
+ var mapFrame=document.getElementById("mapViewerFrame");
+ mapFrame.src="";
+ }
+
+ var messageShorterInterval = null;
+
+ function CreateButtons()
+ {
+ var mapViewerFrame=window.frames["mapViewerFrame"];
+
+ var mapFrame = mapViewerFrame.GetMapFrame();
+ var mapFrameDocument=mapFrame.document;
+
+ mapFrame.ShowMapMessage("Use the map controls in the toolbar above to specify the center point and scale.", "info");
+ //use setInterval to make sure that the message div has been created.
+ messageShorterInterval = window.setInterval(function(){ makeMessageShorter(mapFrame); }, 100);
+
+ mapSpace = mapFrameDocument.getElementById("mapSpace");
+ var buttonPanel = mapFrameDocument.createElement('div');
+ buttonPanel.style.backgroundColor="transparent";
+ buttonPanel.style.padding="0px";
+ buttonPanel.style.margin="0px";
+ buttonPanel.style.position="absolute";
+ buttonPanel.style.zIndex="10000";
+ buttonPanel.style.top="490px";
+ buttonPanel.style.left="660px";
+ buttonPanel.style.width="160px";
+
+ var buttonPanelInnerHtml="<table>";
+ buttonPanelInnerHtml+="<tr>";
+ buttonPanelInnerHtml+="<td>";
+ buttonPanelInnerHtml+='<button type="button" style="width: 57px; height: 22px; border-style:none;border: 1px solid #000000;" onclick="window.parent.parent.MapViewerBtnOKClicked()">OK</button>';
+ buttonPanelInnerHtml+="</td>";
+ buttonPanelInnerHtml+="<td>";
+ buttonPanelInnerHtml+='<button type="button" style="width: 57px; height: 22px; border-style:none;border: 1px solid #000000;margin-left:10px;" onclick="window.parent.parent.MapViewerBtnCloseClicked()">Cancel</button>';
+ buttonPanelInnerHtml+="</td>";
+ buttonPanelInnerHtml+="</tr>";
+ buttonPanelInnerHtml+="</table>";
+
+ buttonPanel.innerHTML = buttonPanelInnerHtml;
+ mapSpace.appendChild(buttonPanel);
+ }
+
+ function MapViewerBtnCloseClicked()
+ {
+ CloseMapViewer();
+ }
+
+ function MapViewerBtnOKClicked()
+ {
+ var mapViewerFrame=window.frames["mapViewerFrame"];
+ var mapFrame = mapViewerFrame.GetMapFrame();
+ var center = mapFrame.GetCenter();
+ var scale = mapFrame.GetScale();
+
+ var centerPoint=document.getElementById("txtCenterPoint");
+ centerPoint.value=center.X+"*"+center.Y;
+ var centerPointValidate=ValidateCenterPoint(true);
+
+ var txtScale=document.getElementById("txtScale");
+ txtScale.value=scale;
+ var scaleValidate=ValidateScale(true);
+
+ var visible=centerPointValidate&&scaleValidate;
+ if(visible)
+ {
+ var mapDefinitonSelector=document.getElementById("mapSelector_DO_NOT_PERSIST");
+ if(mapDefinitonSelector.selectedIndex>=0)
+ {
+ visible=true;
+ }
+ else
+ {
+ visible=false;
+ }
+ }
+
+ SetRunButtonState(visible);
+
+ CloseMapViewer();
+ }
+
+ function makeMessageShorter(mapFrame)
+ {
+ if(!mapFrame.mapMessage || !mapFrame.mapMessage.container)
+ return;
+
+ window.clearInterval(messageShorterInterval);
+ // make it shorter
+ mapFrame.mapMessage.container.style.padding="1px";
+ }
+
+ function RemoveSpace(str)
+ {
+ var i=0,strWithoutSpace="";
+
+ if(null == str)
+ return strWithoutSpace;
+
+ if(0 == str.length)
+ return strWithoutSpace;
+
+ for(;i < str.length;i++)
+ {
+ c = str.charAt(i);
+ if(c!=' ')
+ {
+ strWithoutSpace+=c;
+ }
+ }
+ return strWithoutSpace;
+ }
+
+ function formatNumber(s, n)
+ {
+ var n = n > 0 && n <= 20 ? n : 2;
+
+ var s = parseFloat((s + "").replace(/[^\d\.-]/g, "")).toFixed(n) + "";
+
+ var l = s.split(".")[0].split("").reverse() , r = s.split(".")[1];
+
+ var t = "";
+
+ for(i = 0; i < l.length; i ++ )
+ {
+ t += l[i] + ((i + 1) % 3 == 0 && (i + 1) != l.length ? " " : "");
+ }
+
+ return t.split("").reverse().join("") + "." + r;
+ }
+
+ function formatCenterPoint(x,y,fractionDigits)
+ {
+ return parseFloat(x).toExponential(fractionDigits)+"*"+parseFloat(y).toExponential(fractionDigits);
+ }
+
+ function IsNotFloat(str)
+ {
+ str = RemoveSpace(str);
+
+ if("" == str)
+ return true;
+
+ var num=0;
+ if((num=str.indexOf('E'))!=-1||(num=str.indexOf('e'))!=-1)
+ {
+ var doubleStr=str.substring(0,num);
+ var eStr=str.substring(num+1);
+ var result=IsNotSimpleFloat(doubleStr)||IsNotInt(eStr);
+
+ return result;
+ }
+ else
+ {
+ return IsNotSimpleFloat(str);
+ }
+ }
+
+ function IsNotInt(str)
+ {
+ //remove the + or -
+ var firstChar=str.substring(0,1);
+ if("+" == firstChar || "-" == firstChar)
+ {
+ str=str.substring(1);
+ }
+
+ if ((str.length>1 && str.substring(0,1)=="0") || IsNotNum(str))
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ function IsNotNum(str)
+ {
+ if ("" == str)
+ return true;
+
+ for(var i = 0; i < str.length;i++)
+ {
+ var oneNum = str.substring(i,i+1);
+ if (oneNum < "0" || oneNum > "9")
+ return true;
+ }
+ return false;
+ }
+
+ function IsNotSimpleFloat(str)
+ {
+ var len = str.length;
+ var dotNum = 0;
+
+ if (0 == len)
+ {
+ return true;
+ }
+
+ //remove the + or -
+ var firstChar=str.substring(0,1);
+ if("+" == firstChar || "-" == firstChar)
+ {
+ str=str.substring(1);
+ len=str.length;
+ }
+
+ for(var i = 0;i < len;i++)
+ {
+ var oneNum = str.substring(i,i+1);
+
+ if ("." == oneNum)
+ dotNum++;
+
+ if ( ((oneNum < "0" || oneNum > "9") && oneNum != ".") || dotNum > 1)
+ return true;
+ }
+
+ if (len > 1 && "0" == str.substring(0,1))
+ {
+ if (str.substring(1,2) != ".")
+ return true;
+ }
+
+ return false;
+ }
+
+ function HighlightRow(tableRow)
+ {
+ for (var i = 0; i < tableRow.childNodes.length; i++)
+ {
+ var obj = tableRow.childNodes[i];
+ obj.className = "over";
+ }
+ }
+
+ function UnhighlightRow(tableRow)
+ {
+ for (var i = 0;i < tableRow.childNodes.length;i++)
+ {
+ var obj = tableRow.childNodes[i];
+ obj.className = "";
+ }
+ }
+
+ function ShowToopTip(linkObj,toolTipID,e)
+ {
+ var toolTip = document.getElementById(toolTipID);
+ toolTip.style.display = "none";
+
+ var ev = e || window.event;
+ var mosPos = Common.getMousePos(ev);
+ var elPos = Common.getElementPos(linkObj);
+ var downMouseLeft = 13,downMouseTop = 2;
+
+ //must before set opr to get offsetHeight...
+ //toolTip.style.display = "";
+ //set tooltip position
+ toolTip.style.top = elPos.y + linkObj.offsetHeight+ downMouseTop+ "px";
+ toolTip.style.left = mosPos.x + downMouseLeft + "px";
+
+ toolTip.style.display = "block";
+ toolTip.className = "showTooltip";
+ }
+
+ function HideToolTop(toolTipID)
+ {
+ var toolTip = document.getElementById(toolTipID);
+ toolTip.style.display = "none";
+ }
+
+ //AJAX part
+ var xmlHttp;
+
+ function GetXmlHttpObject()
+ {
+ var xmlHttp=null;
+
+ try
+ {
+ // Firefox, Opera 8.0+, Safari
+ xmlHttp=new XMLHttpRequest();
+ }
+ catch (e)
+ {
+ // Internet Explorer
+ try
+ {
+ xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
+ }
+ catch (e)
+ {
+ xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
+ }
+ }
+ return xmlHttp;
+ }
+
+ function GetResult()
+ {
+ var mapDefinitonSelector=document.getElementById("mapSelector_DO_NOT_PERSIST");
+
+ if(mapDefinitonSelector.selectedIndex<0)
+ {
+ var mapResourceWarningMessage=document.getElementById("selectMapResourceWarningMessage");
+ mapResourceWarningMessage.innerHTML="A map resource was not selected.";
+ return false;
+ }
+
+ if(!ValidateCenterPoint(true))
+ return false;
+
+ if(!ValidateScale(true))
+ return false;
+
+ SetResultNotMatchWarningMsg(false);
+
+ var ajax_loading_img=document.getElementById("ajax_loading_img");
+ ajax_loading_img.style.display="inline";
+
+ var btnClear=document.getElementById("btnClearSpan");
+ btnClear.style.display="none";
+
+ var runButton=document.getElementById("runBtn");
+ runButton.setAttribute("disabled", "disabled");
+
+ xmlHttp=GetXmlHttpObject();
+ if (xmlHttp==null)
+ {
+ alert ("Browser does not support HTTP Request!");
+ return;
+ }
+
+ var scale=document.getElementById("txtScale");
+ var mapSelector=document.getElementById("mapSelector_DO_NOT_PERSIST");
+ var url="performanceReport_GetResult.php";
+
+ url+="?scale="+scale.value;
+ url+="&mapDefinition="+mapSelector.value;
+ url+="&sid="+Math.random();
+ xmlHttp.onreadystatechange=stateChanged;
+ xmlHttp.open("POST",url,true);
+ xmlHttp.send(null);
+ }
+
+ function stateChanged()
+ {
+ if ((4 == xmlHttp.readyState || "complete" == xmlHttp.readyState)&& 200 == xmlHttp.status)
+ {
+ var profileResult=document.getElementById("resultsTab");
+ profileResult.innerHTML=xmlHttp.responseText;
+
+ var btnClear=document.getElementById("btnClearSpan");
+ btnClear.style.display="inline";
+
+ var ajax_loading_img=document.getElementById("ajax_loading_img");
+ ajax_loading_img.style.display="none";
+
+ CollapseSettingTab();
+ ExpandResultsTab();
+ SetRunButtonState(true);
+ }
+ }
+
+ //End AJAX part
+
+ function exportCSV()
+ {
+ var form=document.getElementById("getCSVFileForm");
+ form.submit();
+ }
+
+ function ClearSettings()
+ {
+ //When Clear button clicked, removes the settings from
+ //map selector, scale textbox and center point textbox.
+ //Also removes any validation messages that are visible.
+ var mapDefinitonSelector=document.getElementById("mapSelector_DO_NOT_PERSIST");
+
+ if(mapDefinitonSelector.selectedIndex>=0)
+ {
+ mapDefinitonSelector.selectedIndex=-1;
+ //change the selectedIndex valule by the js will not fire the event "onchange",
+ //so we manually do it.
+ MapResoucesNameSelectChange();
+ }
+
+ //Also removes any validation messages that are visible.
+ ClearWrnMsg();
+
+ var mapSelectorWarnMsg=document.getElementById("selectMapResourceWarningMessage");
+ mapSelectorWarnMsg.innerHTML = "";
+
+ SetRunButtonState(false);
+ }
+
+ function ClearWrnMsg()
+ {
+ var scale=document.getElementById("txtScale");
+ scale.className="";
+
+ var centerPoint=document.getElementById("txtCenterPoint");
+ centerPoint.className="";
+
+ var scaleWarnMsg=document.getElementById("scaleWarnMessage");
+ scaleWarnMsg.innerHTML = "";
+
+ var centerPointWarnMsg=document.getElementById("centerPointWarnMessage");
+ centerPointWarnMsg.innerHTML = "";
+ }
+
+ function SetRunButtonState(visible)
+ {
+ var runButton=document.getElementById("runBtn");
+
+ if(visible)
+ {
+ runButton.removeAttribute("disabled");
+ }
+ else
+ {
+ runButton.setAttribute("disabled", "disabled");
+ }
+ }
+ </script>
+
+ <div id="settingsTitle">
+ <table>
+ <tr>
+ <td style=" width: 20px;">
+ <img src="images/testImages/down_17.jpg" alt="down" style="cursor:pointer;"
+ id="settings_CollapseImage_ID" onclick="CollapsibleTabClick('settings_CollapseImage_ID','settingsContent')"/>
+ </td>
+ <td style=" font-size:22px; color: orange; text-align: left;" >
+ <span style="cursor:pointer;" onclick="CollapsibleTabClick('settings_CollapseImage_ID','settingsContent')">Settings</span>
+ </td>
+ </tr>
+ </table>
+ </div>
+ <div id="settingsContent">
+ <table style="width:100%;">
+ <tr>
+ <td style="width: 70%">
+ <div >
+ <table>
+ <tr>
+ <td colspan="2" style=" font-size:14px;">
+ Follow the Steps to create a new report or choose from the recent settings.
+ </td>
+ </tr>
+ </table>
+ </div>
+ <div id="settingContentLeft" style="border:solid 1px #FFFFFF; margin-top: 10px;">
+ <table style="text-align: left; vertical-align:text-top; width: 100%">
+ <tr>
+ <td>
+ <div style="font-size: 16px; margin-bottom: 5px; font-weight: bold;">Step 1</div>
+ <div style=" background-color: #EEEEEE; padding-top: 2px; padding-left: 15px; padding-bottom: 15px;">
+ <p> Select a map resource name.</p>
+ <span style=" font-weight: bold;"> Map Resource Name</span>
+ <table>
+ <tr>
+ <td>
+ <select name="mapSelector_DO_NOT_PERSIST" id="mapSelector_DO_NOT_PERSIST" style="width:180px; color: #2c4e56; padding: 5px;" size="5"
+ onchange="MapResoucesNameSelectChange()">
+ <?php
+ //<option value="Library://Samples/Sheboygan/Maps/Sheboygan.MapDefinition">Sheboygan</option>
+ for ($i = 0; $i < count($mapResources); $i++)
+ {
+ echo "<option value=";
+ echo "'$mapResources[$i]'";
+ echo ">";
+ echo $mapResourceShortNames[$i];
+ echo "</option>";
+ }
+ ?>
+ </select>
+ </td>
+ <td style=" padding: 2px 10px; text-align: left; vertical-align: top;">
+ <div id="mapResourceNameTip">
+ </div>
+ <div id="selectMapResourceWarningMessage" style="color:#F03136;">
+ </div>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </td>
+ </tr>
+ <tr>
+ <td style="padding-top: 15px;">
+ <div style="font-size: 16px; margin-bottom: 5px; font-weight: bold;">Step 2</div>
+ <div style=" background-color: #EEEEEE; padding-top: 10px; padding-left: 15px; padding-bottom: 15px;">
+ <table>
+ <tr>
+ <td colspan="2" style=" padding-bottom: 15px;">
+ <div style=" margin-bottom: 5px;">
+ Choose a center point and scale from the map viewer or enter the values manually.
+ </div>
+ <input type="button" id="mapViewerBtn" value="Select Settings" onClick="SelectMapSettings();" disabled="disabled" style="width:160px; height: 28px;font-weight: bold;">
+ <div id="mapViewerDialog" align="center" class="mapViewerDialogStyle">
+ <table width="100%" style="margin:0px; padding: 0px;" cellspacing="0" cellpadding="0">
+ <tr>
+ <td style="border-bottom:1px solid #000000; " >
+ <span id="msgTitle" style=" cursor: default;margin:0px; padding:3px; height:24px; text-align: left; font-weight: bold; vertical-align: middle;">
+ Select a Center Point and Map Scale
+ </span>
+ </td>
+ <td style=" text-align: right;border-bottom:1px solid #000000;">
+ <img alt="Close" src="images/close.png" onclick="CloseMapViewer();"/>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2">
+ <iframe name="mapViewerFrame" src="" width="800px" height="575px" scrolling="no"
+ id="mapViewerFrame" style="border:none;">
+ </iframe>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </td>
+ </tr>
+ <tr>
+ <td style="padding:5px;">
+ <div style=" margin-bottom: 5px; font-weight: bold;">
+ Center Point
+ </div>
+ <input type="textbox" name="txtCenterPoint" id="txtCenterPoint" style="width:220px;"
+ onFocus="CenterPointFocus();" onKeyUp="CenterPointTxtKeyUp();" value="Enter center point" disabled="disabled"/>
+ </td>
+ <td style="padding:5px; width: 60%">
+ <div style=" margin-bottom: 5px; font-weight: bold;">
+ Scale
+ </div>
+ <label for="txtScale">1: </label>
+ <input type="textbox" name="txtScale" id="txtScale" onFocus="ScaleFocus();"
+ onKeyUp="ScaleTxtKeyUp();" value="Enter scale" disabled="disabled"/>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <span id="centerPointWarnMessage" style="color: #F03136; padding-left: 5px;">
+ </span>
+ </td>
+ <td>
+ <span id="scaleWarnMessage" style="color: #F03136; padding-left: 5px;">
+ </span>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </td>
+ </tr>
+ <tr>
+ <td style=" padding-top: 80px;">
+ <table>
+ <tr>
+ <td style="padding-right:5px;">
+ <input id="runBtn" type="button" value="Run" style="width:80px; font-weight: bold;height: 28px;"
+ onclick="GetResult();" disabled="disabled"/>
+ </td>
+ <td>
+ <span id="ajax_loading_img" style="display:none;">
+ <input type="image" src="images/ajax_loading.gif"></span>
+ </td>
+ <td>
+ <span style="margin-left: 25px;" id="btnClearSpan">
+ <input type="button" value="Clear" onclick="ClearSettings();"
+ name="Clear" style="width:80px; font-weight: bold;height: 28px;">
+ </span>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div id="ResultNotMatchWrn"
+ style="border: 3px solid #CCCCCC;background: #FFFEBB url('images/warning.png') no-repeat left top;padding:0px 0px 10px 20px; margin-top: 10px;display: none;">
+ <span style="font-size:12pt; font-weight: bold;">
+ The performance report results no longer match the settings found in Steps 1 and 2.
+ </span>
+ <br/>
+ Return the settings found in Steps 1 and 2 to the previous settings or run a new performance report.
+ </div>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </td>
+ <td style=" vertical-align: top; width: 30%;">
+ <h2>Recent Settings</h2>
+ <table style="padding: 5px;">
+ <tr>
+ <td>
+ CEVEK
+ <br>
+ MAY 12,2012 11:35:52
+ </td>
+ </tr>
+ <tr>
+ <td style=" background-color: #EEEEEE;">
+ CEVEK
+ <br>
+ MAY 12,2012 11:35:52
+ </td>
+ </tr>
+ <tr>
+ <td>
+ CEVEK
+ <br>
+ MAY 12,2012 11:35:52
+ </td>
+ </tr>
+ <tr>
+ <td style=" background-color: #EEEEEE;">
+ CEVEK
+ <br>
+ MAY 12,2012 11:35:52
+ </td>
+ </tr>
+ <tr>
+ <td>
+ CEVEK
+ <br>
+ MAY 12,2012 11:35:52
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </div>
+ <div id="resultsTab" style=" display: none;">
+ </div>
+ <?php EndContentArea( true, $formName, "" ); ?>
+ <!-- End of Contents Area -->
+ </tr>
+ </table>
+</body>
+</html>
Added: trunk/MgDev/Web/src/mapadmin/performanceReport_Export.php
===================================================================
--- trunk/MgDev/Web/src/mapadmin/performanceReport_Export.php (rev 0)
+++ trunk/MgDev/Web/src/mapadmin/performanceReport_Export.php 2011-08-08 06:19:51 UTC (rev 6042)
@@ -0,0 +1,9 @@
+<?php
+ $Date = date("Y-m-d_His");
+ $Filename = $Date.".csv";
+
+ header("Content-type:application/vnd.ms-excel");
+ header("Content-Disposition:filename=".$Filename);
+ echo "Layer,Render Time,Feature Class,Coordinate System,TypeLF";
+ //TODO: The real export data will be implemented in part2
+?>
\ No newline at end of file
Added: trunk/MgDev/Web/src/mapadmin/performanceReport_GetResult.php
===================================================================
--- trunk/MgDev/Web/src/mapadmin/performanceReport_GetResult.php (rev 0)
+++ trunk/MgDev/Web/src/mapadmin/performanceReport_GetResult.php 2011-08-08 06:19:51 UTC (rev 6042)
@@ -0,0 +1,215 @@
+<?php
+
+try
+{
+ include 'resizableadmin.php';
+
+ LoadSessionVars();
+
+ // Did the user logout?
+ CheckForLogout();
+
+ // Are we cancelling? If so, there is nothing to do.
+ CheckForCancel( 'performanceReport.php' );
+
+ // Define Local values
+ $confirmationMsg = "";
+ $errorMsg = "";
+ $mapProfileResult=new MapProfileResult();
+ $mapResources;
+ $mapResourceShortNames;
+ $displayManager= new DisplayProfileResultManager();
+
+ function GetProfilingResults()
+ {
+ global $mapProfileResult;
+ $resultSource=new DOMDocument();
+ //As the profiling API is not finished, now we just use a temp xml file to simulate it.
+ //we will change it in part 2.
+ $resultSource->load("profilingmapxml/profileResults.xml");
+ $mapProfileResult->ReadFromXML($resultSource);
+ }
+
+ GetProfilingResults();
+
+ $displayManager->mapProfileResult=$mapProfileResult;
+
+ //TODO: remove this in part 2
+ sleep(3);
+}
+catch ( MgException $e )
+{
+ CheckForFatalMgException( $e );
+ $errorMsg = $e->GetExceptionMessage();
+}
+catch ( Exception $e )
+{
+ $errorMsg = $e->getMessage();
+}
+?>
+
+<table style="width: 70%;">
+ <tr>
+ <td colspan="2" style=" padding-left: 18px;">
+ <br>
+ <span style=" font-size: large; font-weight: bold;">Results</span>
+ </td>
+ </tr>
+ <tr>
+ <td style=" padding-left: 18px;">
+ <span><?php echo date("F d ,Y h:i:s A"); ?></span>
+ </td>
+ <td style=" text-align: right;">
+ <input type="button" value="Export" style="width:80px; font-weight: bold;height: 28px;" onclick="exportCSV();" />
+ <form id="getCSVFileForm" action="performanceReport_Export.php" method="post" >
+ </form>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2">
+ <div style=" background-color: #EEEEEE; padding: 15px;">
+ <table style="width:100%;" class="mapDefinitionResultTableStyle">
+ <tr>
+ <td style="width:22%; font-weight: bold;">Resource Name:</td>
+ <td style="width:32%;">
+ <?php
+ $displayManager->OutputMapResourceNameWithToolTip($mapProfileResult->MapProfileData->MapResourceId);
+ ?>
+ </td>
+ <td style="width:18%;font-weight: bold;">
+ Data Extents:
+ </td>
+ <td style="width:27%;">
+ <?php
+ list($x1, $y1, $x2, $y2) = explode(",", $mapProfileResult->MapProfileData->DataExtents);
+ echo "X:" . $x1 . " Y:" . $y1;
+ echo "<br/>";
+ echo "X:" . $x2 . " Y:" . $y2;
+ ?>
+ </td>
+ </tr>
+ <tr>
+ <td style=" font-weight: bold;">Base Layers:</td>
+ <td>12</td>
+ <td style=" font-weight: bold;">Image Format:</td>
+ <td>
+ <?php
+ echo $mapProfileResult->MapProfileData->ImageFormat;
+ ?>
+ </td>
+ </tr>
+ <tr>
+ <td style=" font-weight: bold;">Center Point:</td>
+ <td>
+ X:23423.343E2
+ <br/>
+ Y:23423.23E5
+ </td>
+ <td style=" font-weight: bold;">Layers:</td>
+ <td>56</td>
+ </tr>
+ <tr>
+ <td style=" font-weight: bold;">Coordinate System:</td>
+ <td>
+ <?php
+ echo $mapProfileResult->MapProfileData->CoordinateSystem;
+ ?>
+ </td>
+ <td style=" font-weight: bold;">Renderer Type:</td>
+ <td>
+ <?php
+ echo $mapProfileResult->MapProfileData->RenderType;
+ ?>
+ </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td style=" font-weight: bold;">Scale:</td>
+ <td>
+ <?php
+ echo "1:" . number_format($mapProfileResult->MapProfileData->Scale,0,"."," ");
+ ?>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2" style="padding-top:20px; padding-left: 15px;">
+ <?php
+ echo "<span>";
+ echo "Total Generation Time: " . $mapProfileResult->MapProfileData->TotalMapRenderTime . " ms";
+ echo "</span>";
+ ?>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2">
+ <div>
+ <table style="width:100%; padding: 0px; text-align: center;" cellspacing="0" cellpadding="0">
+ <?php
+ $displayManager->OutputMapRenderTimeGraph();
+ ?>
+ <tr style="height:35px;">
+ <td colspan="4" style=" text-align: center;">
+ <span style="width: 11px; height: 11px; background-color:#E4C7AE; margin-right: 5px;">
+ </span>
+ <span style=" font-size: small; margin-right: 20px;">Layers</span>
+ <span style="width: 11px; height: 11px; background-color:#AECBE4;margin-right: 5px;">
+ </span>
+ <span style=" font-size: small; margin-right: 20px;">Labels</span>
+ <span style="width: 11px; height: 11px; background-color:#E79661; margin-right: 5px;">
+ </span>
+ <span style=" font-size: small; margin-right: 20px;">Watermarks</span>
+ <span style="width: 11px; height: 11px; background-color:#BE76EE; margin-right: 5px;">
+ </span>
+ <span style=" font-size: small; margin-right: 20px;">Images</span>
+ <span style="width: 11px; height: 11px; background-color:#999999; margin-right: 5px;">
+ </span>
+ <span style=" font-size: small;">Other</span>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </td>
+ </tr>
+</table>
+<div id="LayersResult">
+ <table style=" width:100%;">
+ <tr>
+ <td style="width:70%; padding-top: 15px;">
+ <div id="layerHeader" class="layerResultsHeaderStyle" style="margin:0px; padding: 0px;">
+ <table>
+ <thead>
+ <tr>
+ <th>Layer</th>
+ <th>Render Time</th>
+ <th>Feature Class</th>
+ <th>Coordinate System</th>
+ <th>Type</th>
+ </tr>
+ </thead>
+ </table>
+ </div>
+ <div id="layerBody" class="layerResultsStyle">
+ <table style="width:100%; text-align: center;margin:0px; padding: 0px;" id="layerResultsTable">
+ <tbody>
+ <?php
+ $displayManager->OutputLayerDefinitionData();
+ ?>
+ </tbody>
+ </table>
+ </div>
+ </td>
+ <td style="width:30%; padding-left:15px; vertical-align: top; padding-top: 15px;">
+ <?php
+ $displayManager->OutputLayerDetailData();
+ ?>
+ </td>
+ </tr>
+ </table>
+</div>
+
+
Added: trunk/MgDev/Web/src/mapadmin/performanceReport_MapViewer.php
===================================================================
--- trunk/MgDev/Web/src/mapadmin/performanceReport_MapViewer.php (rev 0)
+++ trunk/MgDev/Web/src/mapadmin/performanceReport_MapViewer.php 2011-08-08 06:19:51 UTC (rev 6042)
@@ -0,0 +1,42 @@
+<?php
+ include 'resizableadmin.php';
+
+ LoadSessionVars();
+
+ // Did the user logout?
+ CheckForLogout();
+
+ $mapDefiniton=$_GET["mapDefinition"];
+
+ $siteConn = new MgSiteConnection();
+ $siteConn->Open($userInfo);
+ $resourceSrvc = $siteConn->CreateService(MgServiceType::ResourceService);
+
+ $webLayoutName= "Session:" . $adminSession . "//" . "Map" .rand(). "." . MgResourceType::WebLayout;
+ $webLayOutId = new MgResourceIdentifier($webLayoutName);
+
+ // get contents of a file into a string
+ try
+ {
+ $filename = "profilingmapxml\\MapViewerTemplate.xml";
+ $handle = fopen($filename, "r");
+ $contents = fread($handle, filesize($filename));
+ fclose($handle);
+ }
+ catch (Exception $e)
+ {
+ echo $e->getMessage();
+ }
+
+ $contents= str_replace("{0}", $mapDefiniton, $contents);
+
+ $content_byteSource = new MgByteSource($contents,strlen($contents));
+ $content_byteSource->setMimeType("text/xml");
+ $content_byteReader = $content_byteSource->GetReader();
+
+ $resourceSrvc->SetResource($webLayOutId, $content_byteReader, null);
+
+ $webLayoutUrl="../mapviewerajax/?WEBLAYOUT=".urlencode($webLayoutName)."&LOCALE=en";
+
+ header('Location:'. $webLayoutUrl);
+?>
Added: trunk/MgDev/Web/src/mapadmin/profilingmapxml/MapViewerTemplate.xml
===================================================================
--- trunk/MgDev/Web/src/mapadmin/profilingmapxml/MapViewerTemplate.xml (rev 0)
+++ trunk/MgDev/Web/src/mapadmin/profilingmapxml/MapViewerTemplate.xml 2011-08-08 06:19:51 UTC (rev 6042)
@@ -0,0 +1,229 @@
+<?xml version="1.0" encoding="utf-8"?>
+<WebLayout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xsi:noNamespaceSchemaLocation="WebLayout-1.1.0.xsd">
+ <Title>Select a Center Point and Map Scale</Title>
+ <Map>
+ <ResourceId>{0}</ResourceId>
+ <HyperlinkTarget>TaskPane</HyperlinkTarget>
+ </Map>
+ <EnablePingServer>false</EnablePingServer>
+ <ToolBar>
+ <Visible>true</Visible>
+ <Button xsi:type="CommandItemType">
+ <Function>Command</Function>
+ <Command>Select</Command>
+ </Button>
+ <Button xsi:type="CommandItemType">
+ <Function>Command</Function>
+ <Command>Pan</Command>
+ </Button>
+ <Button xsi:type="CommandItemType">
+ <Function>Command</Function>
+ <Command>Zoom Rectangle</Command>
+ </Button>
+ <Button xsi:type="CommandItemType">
+ <Function>Command</Function>
+ <Command>Zoom In</Command>
+ </Button>
+ <Button xsi:type="CommandItemType">
+ <Function>Command</Function>
+ <Command>Zoom Out</Command>
+ </Button>
+ <Button xsi:type="CommandItemType">
+ <Function>Command</Function>
+ <Command>Initial Map View</Command>
+ </Button>
+ <Button xsi:type="CommandItemType">
+ <Function>Command</Function>
+ <Command>Previous View</Command>
+ </Button>
+ <Button xsi:type="CommandItemType">
+ <Function>Command</Function>
+ <Command>Next View</Command>
+ </Button>
+ </ToolBar>
+ <InformationPane>
+ <Visible>false</Visible>
+ <Width>200</Width>
+ <LegendVisible>false</LegendVisible>
+ <PropertiesVisible>false</PropertiesVisible>
+ </InformationPane>
+ <ContextMenu>
+ <Visible>true</Visible>
+ <MenuItem xsi:type="CommandItemType">
+ <Function>Command</Function>
+ <Command>Select</Command>
+ </MenuItem>
+ <MenuItem xsi:type="CommandItemType">
+ <Function>Command</Function>
+ <Command>Pan</Command>
+ </MenuItem>
+ <MenuItem xsi:type="CommandItemType">
+ <Function>Command</Function>
+ <Command>Zoom Rectangle</Command>
+ </MenuItem>
+ <MenuItem xsi:type="CommandItemType">
+ <Function>Command</Function>
+ <Command>Zoom In</Command>
+ </MenuItem>
+ <MenuItem xsi:type="CommandItemType">
+ <Function>Command</Function>
+ <Command>Zoom Out</Command>
+ </MenuItem>
+ <MenuItem xsi:type="CommandItemType">
+ <Function>Command</Function>
+ <Command>Initial Map View</Command>
+ </MenuItem>
+ <MenuItem xsi:type="CommandItemType">
+ <Function>Command</Function>
+ <Command>Previous View</Command>
+ </MenuItem>
+ <MenuItem xsi:type="CommandItemType">
+ <Function>Command</Function>
+ <Command>Next View</Command>
+ </MenuItem>
+ </ContextMenu>
+ <TaskPane>
+ <Visible>false</Visible>
+ <Width>250</Width>
+ <TaskBar>
+ <Visible>true</Visible>
+ <Home>
+ <Name>Home</Name>
+ <Tooltip>Return to home task page</Tooltip>
+ <Description>Return to home task page</Description>
+ <ImageURL>../stdicons/icon_home.gif</ImageURL>
+ <DisabledImageURL>../stdicons/icon_home_disabled.gif</DisabledImageURL>
+ </Home>
+ <Forward>
+ <Name>Forward</Name>
+ <Tooltip>Forward to next task page</Tooltip>
+ <Description>Forward to next task page</Description>
+ <ImageURL>../stdicons/icon_forward.gif</ImageURL>
+ <DisabledImageURL>../stdicons/icon_forward_disabled.gif</DisabledImageURL>
+ </Forward>
+ <Back>
+ <Name>Back</Name>
+ <Tooltip>Return to previous task page</Tooltip>
+ <Description>Return to previous task page</Description>
+ <ImageURL>../stdicons/icon_back.gif</ImageURL>
+ <DisabledImageURL>../stdicons/icon_back_disabled.gif</DisabledImageURL>
+ </Back>
+ <Tasks>
+ <Name>Tasks</Name>
+ <Tooltip>Task list</Tooltip>
+ <Description>View a list of available tasks</Description>
+ <ImageURL>../stdicons/icon_tasks.gif</ImageURL>
+ <DisabledImageURL>../stdicons/icon_tasks_disabled.gif</DisabledImageURL>
+ </Tasks>
+ </TaskBar>
+ <InitialTask />
+ </TaskPane>
+ <StatusBar>
+ <Visible>true</Visible>
+ </StatusBar>
+ <ZoomControl>
+ <Visible>true</Visible>
+ </ZoomControl>
+ <CommandSet>
+ <Command xsi:type="BasicCommandType">
+ <Name>Pan</Name>
+ <Label>Pan</Label>
+ <Tooltip>Pan mode</Tooltip>
+ <Description>Drag the map to view areas out of range</Description>
+ <ImageURL>../stdicons/icon_pan.gif</ImageURL>
+ <DisabledImageURL>../stdicons/icon_pan_disabled.gif</DisabledImageURL>
+ <TargetViewer>All</TargetViewer>
+ <Action>Pan</Action>
+ </Command>
+ <Command xsi:type="BasicCommandType">
+ <Name>Zoom</Name>
+ <Label>Zoom</Label>
+ <Tooltip>Zoom dynamic</Tooltip>
+ <Description>Zoom dynamically by clicking and dragging</Description>
+ <ImageURL>../stdicons/icon_zoom.gif</ImageURL>
+ <DisabledImageURL>../stdicons/icon_zoom_disabled.gif</DisabledImageURL>
+ <TargetViewer>Dwf</TargetViewer>
+ <Action>Zoom</Action>
+ </Command>
+ <Command xsi:type="BasicCommandType">
+ <Name>Zoom In</Name>
+ <Label>Zoom In</Label>
+ <Tooltip>Zoom in</Tooltip>
+ <Description>Zoom in by a preset increment</Description>
+ <ImageURL>../stdicons/icon_zoomin.gif</ImageURL>
+ <DisabledImageURL>../stdicons/icon_zoomin_disabled.gif</DisabledImageURL>
+ <TargetViewer>All</TargetViewer>
+ <Action>ZoomIn</Action>
+ </Command>
+ <Command xsi:type="BasicCommandType">
+ <Name>Zoom Out</Name>
+ <Label>Zoom Out</Label>
+ <Tooltip>Zoom out</Tooltip>
+ <Description>Zoom out by a preset increment</Description>
+ <ImageURL>../stdicons/icon_zoomout.gif</ImageURL>
+ <DisabledImageURL>../stdicons/icon_zoomout_disabled.gif</DisabledImageURL>
+ <TargetViewer>All</TargetViewer>
+ <Action>ZoomOut</Action>
+ </Command>
+ <Command xsi:type="BasicCommandType">
+ <Name>Zoom Rectangle</Name>
+ <Label>Zoom Rectangle</Label>
+ <Tooltip>Zoom rectangle</Tooltip>
+ <Description>Zoom in on an area</Description>
+ <ImageURL>../stdicons/icon_zoomrect.gif</ImageURL>
+ <DisabledImageURL>../stdicons/icon_zoomrect_disabled.gif</DisabledImageURL>
+ <TargetViewer>All</TargetViewer>
+ <Action>ZoomRectangle</Action>
+ </Command>
+ <Command xsi:type="BasicCommandType">
+ <Name>Zoom Selection</Name>
+ <Label>Zoom Selection</Label>
+ <Tooltip>Zoom to selection</Tooltip>
+ <Description>Zoom to extents of selected features</Description>
+ <ImageURL>../stdicons/icon_zoomselect.gif</ImageURL>
+ <DisabledImageURL>../stdicons/icon_zoomselect_disabled.gif</DisabledImageURL>
+ <TargetViewer>All</TargetViewer>
+ <Action>ZoomToSelection</Action>
+ </Command>
+ <Command xsi:type="BasicCommandType">
+ <Name>Initial Map View</Name>
+ <Label>Initial Map View</Label>
+ <Tooltip>Initial map view</Tooltip>
+ <Description>Fit the extents of the map to the window</Description>
+ <ImageURL>../stdicons/icon_fitwindow.gif</ImageURL>
+ <DisabledImageURL>../stdicons/icon_fitwindow_disabled.gif</DisabledImageURL>
+ <TargetViewer>All</TargetViewer>
+ <Action>FitToWindow</Action>
+ </Command>
+ <Command xsi:type="BasicCommandType">
+ <Name>Previous View</Name>
+ <Label>Previous View</Label>
+ <Tooltip>Previous view</Tooltip>
+ <Description>Go to previous view</Description>
+ <ImageURL>../stdicons/icon_zoomprev.gif</ImageURL>
+ <DisabledImageURL>../stdicons/icon_zoomprev_disabled.gif</DisabledImageURL>
+ <TargetViewer>All</TargetViewer>
+ <Action>PreviousView</Action>
+ </Command>
+ <Command xsi:type="BasicCommandType">
+ <Name>Next View</Name>
+ <Label>Next View</Label>
+ <Tooltip>Next view</Tooltip>
+ <Description>Go to next view</Description>
+ <ImageURL>../stdicons/icon_zoomnext.gif</ImageURL>
+ <DisabledImageURL>../stdicons/icon_zoomnext_disabled.gif</DisabledImageURL>
+ <TargetViewer>All</TargetViewer>
+ <Action>NextView</Action>
+ </Command>
+ <Command xsi:type="BasicCommandType">
+ <Name>Select</Name>
+ <Label>Select</Label>
+ <Tooltip>Select mode</Tooltip>
+ <Description>Select features by clicking and dragging</Description>
+ <ImageURL>../stdicons/icon_select.gif</ImageURL>
+ <DisabledImageURL>../stdicons/icon_select_disabled.gif</DisabledImageURL>
+ <TargetViewer>All</TargetViewer>
+ <Action>Select</Action>
+ </Command>
+ </CommandSet>
+</WebLayout>
\ No newline at end of file
Modified: trunk/MgDev/Web/src/mapadmin/resizablepagecomponents.php
===================================================================
--- trunk/MgDev/Web/src/mapadmin/resizablepagecomponents.php 2011-08-05 14:21:46 UTC (rev 6041)
+++ trunk/MgDev/Web/src/mapadmin/resizablepagecomponents.php 2011-08-08 06:19:51 UTC (rev 6042)
@@ -61,6 +61,9 @@
define( 'CONFIGURE_WFS_MENU_ITEM', "Configure WFS" );
$wfsMenuGroup[ CONFIGURE_WFS_MENU_ITEM ] = 'wfsproperties.php';
+ define('PERFORMANCE_REPORT_MENU_ITEM',"Performance Report");
+ $performanceMenuGroup[PERFORMANCE_REPORT_MENU_ITEM]='performanceReport.php';
+
define( 'ADD_SERVER_TITLE', "Add Server" );
define( 'CONFIGURE_SERVER_TITLE', "Configure Server" );
define( 'CONFIGURE_LOGS_TITLE', "Configure Logs" );
@@ -374,6 +377,7 @@
global $usersMenuGroup;
global $rolesMenuGroup;
global $packagesMenuGroup;
+ global $performanceMenuGroup;
global $wmsMenuGroup;
global $wfsMenuGroup;
global $unmanagedDataMenuGroup;
@@ -391,6 +395,8 @@
echo "<tr><td><hr></td></tr>\n";
DisplayMenuGroup( $currMenuItem, PACKAGE_MANAGEMENT_MENU_ITEM, $packagesMenuGroup );
echo "<tr><td><hr></td></tr>\n";
+ DisplayMenuGroup( $currMenuItem, PERFORMANCE_REPORT_MENU_ITEM, $performanceMenuGroup);
+ echo "<tr><td><hr></td></tr>\n";
DisplayMenuGroup( $currMenuItem, CONFIGURE_WMS_MENU_ITEM, $wmsMenuGroup );
echo "<tr><td><hr></td></tr>\n";
DisplayMenuGroup( $currMenuItem, CONFIGURE_WFS_MENU_ITEM, $wfsMenuGroup );
@@ -2155,4 +2161,107 @@
echo ' </td>',"\n";
}
+
+ class DisplayProfileResultManager
+ {
+ public $mapProfileResult;
+
+ public function OutputMapDefinitionData()
+ {
+ //TODO: will be implemented in part2
+ }
+
+ public function OutputLayerDefinitionData()
+ {
+ $rowNumber=1;
+ foreach ($this->mapProfileResult->LayerProfileData->LayerProfileDataCollection as $layerProfileData)
+ {
+ if(0 == $rowNumber%2)
+ {
+ echo '<tr class="even" onmouseover="HighlightRow(this);" onmouseout="UnhighlightRow(this);">',"\n";
+ }
+ else
+ {
+ echo '<tr class="odd" onmouseover="HighlightRow(this);" onmouseout="UnhighlightRow(this);">',"\n";
+ }
+
+ echo "<td style='width:20%;'>".$layerProfileData->GetLayerName()."</td>","\n";
+ echo "<td style='width:20%;'>".$layerProfileData->TotalRenderTime."</td>","\n";
+ echo "<td style='width:20%;'>"."Class Info Goes here"."</td>","\n";
+ echo "<td style='width:20%;'>".$layerProfileData->CoordinateSystem."</td>","\n";
+ echo "<td style='width:20%;'>".$layerProfileData->LayerType."</td>","\n";
+ echo "</tr>","\n";
+
+ $rowNumber++;
+ }
+ }
+
+ public function OutputLayerDetailData()
+ {
+ $layerDetail=$this->mapProfileResult->LayerProfileData->LayerProfileDataCollection["Library://Buildings.LayerDefinition"];
+
+ echo '<div style="padding-bottom: 8px; padding-top: 7px; width: 80%;">' . $layerDetail->GetLayerName() . '</div>', "\n";
+ echo '<div style=" border: 1px solid #cccccc; width: 80%">';
+ echo '<div style="padding: 10px;">';
+ echo "<b>Filter</b>";
+ echo "<br/><br/>";
+ echo $layerDetail->Filters;
+ echo "</div>";
+ echo '<div style=" background-color: #EEEEEE;padding: 10px;">';
+ echo "<b>Scale Range</b>";
+ echo "<br/><br/>";
+ echo $layerDetail->ScaleRange;
+ echo "</div>", "\n";
+ echo "</div>", "\n";
+ }
+
+ public function OutputMapRenderTimeGraph()
+ {
+ echo "<tr style='height: 25px;'>","\n";
+
+ echo '<td style="width:'.$this->mapProfileResult->MapProfileData->GetLayerRenderPercent() .'%; background-color: #E4C7AE;font-size:80%;">',"\n";
+ echo $this->mapProfileResult->MapProfileData->TotalLayerRenderTime." ms ";
+ echo "(" . $this->mapProfileResult->MapProfileData->GetLayerRenderPercent() . "%)","\n";
+ echo '</td>',"\n";
+
+ echo '<td style="width: '.$this->mapProfileResult->MapProfileData->GetLabelRenderPercent().'%; background-color: #AECBE4;font-size:80%;">',"\n";
+ echo $this->mapProfileResult->MapProfileData->TotalLabelRenderTime." ms ";
+ echo "(".$this->mapProfileResult->MapProfileData->GetLabelRenderPercent()."%)","\n";
+ echo "</td>","\n";
+
+ echo '<td style="width: '.$this->mapProfileResult->MapProfileData->GetWartermarkRenderPercent().'%; background-color: #E79661;font-size:80%;">',"\n";
+ echo $this->mapProfileResult->MapProfileData->TotalWatermarkRenderTime." ms ";
+ echo "(".$this->mapProfileResult->MapProfileData->GetWartermarkRenderPercent()."%)","\n";
+ echo "</td>","\n";
+
+ echo '<td style="width: '.$this->mapProfileResult->MapProfileData->GetImageRenderPercent().'%; background-color: #BE76EE;font-size:80%;">',"\n";
+ echo $this->mapProfileResult->MapProfileData->TotalImageRenderTime." ms ";
+ echo "(".$this->mapProfileResult->MapProfileData->GetImageRenderPercent()."%)","\n";
+ echo "</td>","\n";
+
+ echo '<td style="width: '.$this->mapProfileResult->MapProfileData->GetOthersRenderPercent().'%; background-color: #999999;font-size:80%;">',"\n";
+ //for "Other" we don't need the text, because the width of the td is always too small for the text
+ //echo $this->mapProfileResult->MapProfileData->GetOtherRenderTime()." ms ";
+ //echo "(".$this->mapProfileResult->MapProfileData->GetOthersRenderPercent()."%)","\n";
+ echo "</td>","\n";
+
+ echo "</tr>","\n";
+ }
+
+ public function OutputMapResourceNameWithToolTip($mapResourceID)
+ {
+ $tempMapName = strrchr($mapResourceID, '/');
+ $tempMapName = substr($tempMapName, 1, strlen($tempMapName) - 15);
+ $toolTipDivId="toolTip_".$tempMapName;
+
+ echo '<span onMouseOver="ShowToopTip(this,\''.$toolTipDivId.'\',event);" onmousemove="ShowToopTip(this,\''.$toolTipDivId.'\',event);" onmouseout="HideToolTop(\''.$toolTipDivId.'\');" class="mapNameStyle">';
+ echo "<b>".$tempMapName."</b></span>";
+
+ echo '<div id="'.$toolTipDivId.'" class="hideTooltip">',"\n";
+ echo $mapResourceID;
+ echo '</div>',"\n";
+ }
+ }
+
+
?>
Modified: trunk/MgDev/Web/src/mapadmin/serverdatafunctions.php
===================================================================
--- trunk/MgDev/Web/src/mapadmin/serverdatafunctions.php 2011-08-05 14:21:46 UTC (rev 6041)
+++ trunk/MgDev/Web/src/mapadmin/serverdatafunctions.php 2011-08-08 06:19:51 UTC (rev 6042)
@@ -2292,4 +2292,219 @@
}
}
+ class LayerDefinitionProfileData
+ {
+ public $LayerName;
+ public $LayerResuorceId;
+ public $TotalRenderTime;
+ public $FeatureClass;
+ public $CoordinateSystem;
+ public $LayerType;
+ public $Filters;
+ public $ScaleRange;
+
+ public function GetLayerName()
+ {
+ $shortLayerName = strrchr($this->LayerResuorceId, '/');
+ $shortLayerName = substr($shortLayerName, 1, strlen($shortLayerName) - 17);
+ return $shortLayerName;
+ }
+ }
+
+ class LayerDefinitionProfileResults
+ {
+ public $LayerProfileDataCollection;
+
+ public function Sort($columnName,$sortOrder)
+ {
+ //TODO: will be implemented in part2
+ }
+
+ public function Page()
+ {
+ //TODO: will be implemented in part2
+ }
+ }
+
+ class MapDefinitionProfileData
+ {
+ public $TotalLayerRenderTime;
+ public $TotalLabelRenderTime;
+ public $TotalWatermarkRenderTime;
+ public $TotalImageRenderTime;
+ public $TotalMapRenderTime;
+
+ public $MapResourceId;
+ public $BaseLayerCount;
+ public $LayerCount;
+ public $ImageFormat;
+ public $CenterPoint;
+ public $DataExtents;
+ public $CoordinateSystem;
+ public $Scale;
+ public $RenderType;
+
+ public function GetTotalRenderTime()
+ {
+ return $this->TotalLayerRenderTime+$this->TotalLabelRenderTime
+ +$this->TotalImageRenderTime+$this->TotalWatermarkRenderTime;
+ }
+
+ public function GetLayerRenderPercent()
+ {
+ return number_format($this->TotalLayerRenderTime/$this->TotalMapRenderTime*100,1);
+ }
+
+ public function GetLabelRenderPercent()
+ {
+ return number_format($this->TotalLabelRenderTime/$this->TotalMapRenderTime*100,1);
+ }
+
+ public function GetWartermarkRenderPercent()
+ {
+ return number_format($this->TotalWatermarkRenderTime/$this->TotalMapRenderTime*100,1);
+ }
+
+ public function GetImageRenderPercent()
+ {
+ return number_format($this->TotalImageRenderTime/$this->TotalMapRenderTime*100,1);
+ }
+
+ public function GetOtherRenderTime()
+ {
+ return $this->TotalMapRenderTime-$this->TotalLayerRenderTime-$this->TotalLabelRenderTime-$this->TotalWatermarkRenderTime-$this->TotalImageRenderTime;
+ }
+
+ public function GetOthersRenderPercent()
+ {
+ $other= $this->TotalMapRenderTime-$this->TotalLayerRenderTime-$this->TotalLabelRenderTime-$this->TotalWatermarkRenderTime-$this->TotalImageRenderTime;
+
+ return number_format($other/$this->TotalMapRenderTime*100,1);
+ }
+ }
+
+ class MapProfileResult
+ {
+ public $MapProfileData;
+ public $LayerProfileData;
+
+ public function ReadFromXML($resultSource)
+ {
+ $this->MapProfileData = new MapDefinitionProfileData();
+ $mapResultList = $resultSource->documentElement->getElementsByTagName("ProfileRenderMap");
+ $profileRenderMap = $mapResultList->item(0);
+ if ($profileRenderMap->hasChildNodes())
+ {
+ foreach ($profileRenderMap->childNodes as $node)
+ {
+ if (1 == $node->nodeType)
+ {
+ switch ($node->nodeName)
+ {
+ case "ResourceId":
+ $this->MapProfileData->MapResourceId = $node->nodeValue;
+ break;
+ case "CoordinateSystem":
+ $this->MapProfileData->CoordinateSystem = $node->nodeValue;
+ break;
+ case "Extent":
+ $this->MapProfileData->DataExtents = $node->nodeValue;
+ break;
+ case "Scale":
+ $this->MapProfileData->Scale = $node->nodeValue;
+ break;
+ case "ImageFormat":
+ $this->MapProfileData->ImageFormat = $node->nodeValue;
+ break;
+ case "RendererType":
+ $this->MapProfileData->RenderType = $node->nodeValue;
+ break;
+ case "RenderTime":
+ $this->MapProfileData->TotalMapRenderTime = $node->nodeValue;
+ break;
+ case "CreateImageTime":
+ $this->MapProfileData->TotalImageRenderTime = $node->nodeValue;
+ break;
+ case "ProfileRenderLabels":
+ foreach ($node->childNodes as $labelNode)
+ {
+ if ($labelNode->nodeType == 1 && $labelNode->nodeName == "RenderTime")
+ {
+ $this->MapProfileData->TotalLabelRenderTime = $labelNode->nodeValue;
+ }
+ }
+ break;
+ case "ProfileRenderLayers":
+ foreach ($node->childNodes as $layerNode)
+ {
+ if (1 == $layerNode->nodeType && "RenderTime" == $layerNode->nodeName)
+ {
+ $this->MapProfileData->TotalLayerRenderTime = $layerNode->nodeValue;
+ }
+ }
+ $this->ParseLayerResult($node);
+ break;
+ case "ProfileRenderWatermarks":
+ foreach ($node->childNodes as $watermarkNode)
+ {
+ if (1 == $watermarkNode->nodeType && "RenderTime" == $watermarkNode->nodeName)
+ {
+ $this->MapProfileData->TotalWatermarkRenderTime = $watermarkNode->nodeValue;
+ }
+ }
+ break;
+ default: break;
+ }
+ }
+ }
+ }
+ }
+
+ private function ParseLayerResult($LayerNodeList)
+ {
+ $this->LayerProfileData=new LayerDefinitionProfileResults();
+ $this->LayerProfileData->LayerProfileDataCollection=array();
+
+ foreach ($LayerNodeList->childNodes as $layerNode) {
+ if (1 == $layerNode->nodeType && "ProfileRenderLayer" == $layerNode->nodeName) {
+
+ $tempLayerProfileData = new LayerDefinitionProfileData();
+
+ foreach ($layerNode->childNodes as $node) {
+ if (1 == $node->nodeType) {
+ switch ($node->nodeName) {
+ case "ResourceId":
+ $tempLayerProfileData->LayerResuorceId = $node->nodeValue;
+ break;
+ case "LayerType":
+ $tempLayerProfileData->LayerType = $node->nodeValue;
+ break;
+ case "CoordinateSystem":
+ $tempLayerProfileData->CoordinateSystem = $node->nodeValue;
+ break;
+ case "RenderTime":
+ $tempLayerProfileData->TotalRenderTime = $node->nodeValue;
+ break;
+ case "ScaleRange":
+ $tempLayerProfileData->ScaleRange= $node->nodeValue;
+ break;
+ case "Filter":
+ $tempLayerProfileData->Filters= $node->nodeValue;
+ break;
+ default:break;
+ }
+ }
+ }
+ $this->LayerProfileData->LayerProfileDataCollection[$tempLayerProfileData->LayerResuorceId]=$tempLayerProfileData;
+ }
+ }
+ }
+
+ public function SaveAsCSV()
+ {
+ //TODO: will be implemented in part2
+ }
+ }
+
+
?>
More information about the mapguide-commits
mailing list