[mapguide-commits] r6172 - in sandbox/adsk/2.2gp: .
Common/Stylization Server/src/Services/Feature
Server/src/Services/Mapping Web/src/mapviewernet
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Thu Oct 13 05:37:48 EDT 2011
Author: hubu
Date: 2011-10-13 02:37:48 -0700 (Thu, 13 Oct 2011)
New Revision: 6172
Modified:
sandbox/adsk/2.2gp/
sandbox/adsk/2.2gp/Common/Stylization/DefaultStylizer.cpp
sandbox/adsk/2.2gp/Common/Stylization/StylizationEngine.cpp
sandbox/adsk/2.2gp/Server/src/Services/Feature/ServerFeatureReader.cpp
sandbox/adsk/2.2gp/Server/src/Services/Mapping/MappingUtil.cpp
sandbox/adsk/2.2gp/Web/src/mapviewernet/legend.aspx
Log:
On behalf of Andy Zhang. Performance improvement.
Fix ticket http://trac.osgeo.org/mapguide/ticket/1069, http://trac.osgeo.org/mapguide/ticket/1766 and http://trac.osgeo.org/mapguide/ticket/1451 in 2.2gp sandbox.
Property changes on: sandbox/adsk/2.2gp
___________________________________________________________________
Deleted: svn:mergeinfo
- /trunk/MgDev:5552,5566,5616,5687
Modified: sandbox/adsk/2.2gp/Common/Stylization/DefaultStylizer.cpp
===================================================================
--- sandbox/adsk/2.2gp/Common/Stylization/DefaultStylizer.cpp 2011-10-10 09:37:38 UTC (rev 6171)
+++ sandbox/adsk/2.2gp/Common/Stylization/DefaultStylizer.cpp 2011-10-13 09:37:48 UTC (rev 6172)
@@ -318,14 +318,7 @@
try
{
- if (!features->IsNull(gpName))
- features->GetGeometry(gpName, lb, xformer);
- else
- {
- // just move on to the next feature
- LineBufferPool::FreeLineBuffer(&m_lbPool, spLB.release());
- continue;
- }
+ features->GetGeometry(gpName, lb, xformer);
}
catch (FdoException* e)
{
Modified: sandbox/adsk/2.2gp/Common/Stylization/StylizationEngine.cpp
===================================================================
--- sandbox/adsk/2.2gp/Common/Stylization/StylizationEngine.cpp 2011-10-10 09:37:38 UTC (rev 6171)
+++ sandbox/adsk/2.2gp/Common/Stylization/StylizationEngine.cpp 2011-10-13 09:37:48 UTC (rev 6172)
@@ -143,14 +143,7 @@
try
{
- if (!reader->IsNull(gpName))
- reader->GetGeometry(gpName, lb, xformer);
- else
- {
- // just move on to the next feature
- LineBufferPool::FreeLineBuffer(m_pool, spLB.release());
- continue;
- }
+ reader->GetGeometry(gpName, lb, xformer);
}
catch (FdoException* e)
{
Modified: sandbox/adsk/2.2gp/Server/src/Services/Feature/ServerFeatureReader.cpp
===================================================================
--- sandbox/adsk/2.2gp/Server/src/Services/Feature/ServerFeatureReader.cpp 2011-10-10 09:37:38 UTC (rev 6171)
+++ sandbox/adsk/2.2gp/Server/src/Services/Feature/ServerFeatureReader.cpp 2011-10-13 09:37:48 UTC (rev 6172)
@@ -679,16 +679,8 @@
MG_FEATURE_SERVICE_TRY()
- if(m_fdoReader->IsNull(propertyName.c_str()))
+ try
{
- MgStringCollection arguments;
- arguments.Add(propertyName);
-
- throw new MgNullPropertyValueException(L"MgServerFeatureReader.GetGeometry",
- __LINE__, __WFILE__, &arguments, L"", NULL);
- }
- else
- {
FdoInt32 len = 0;
const FdoByte* data = m_fdoReader->GetGeometry(propertyName.c_str(), &len);
@@ -700,7 +692,20 @@
retVal = bSource->GetReader();
}
}
+ catch(...)
+ {
+ if(m_fdoReader->IsNull(propertyName.c_str()))
+ {
+ MgStringCollection arguments;
+ arguments.Add(propertyName);
+ throw new MgNullPropertyValueException(L"MgServerFeatureReader.GetGeometry",
+ __LINE__, __WFILE__, &arguments, L"", NULL);
+ }
+ else
+ throw;
+ }
+
MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerFeatureReader.GetGeometry");
return retVal.Detach();
@@ -923,21 +928,26 @@
MG_FEATURE_SERVICE_TRY()
- if(m_fdoReader->IsNull(propertyName.c_str()))
+ try
{
- MgStringCollection arguments;
- arguments.Add(propertyName);
-
- throw new MgNullPropertyValueException(L"MgServerFeatureReader.GetGeometry",
- __LINE__, __WFILE__, &arguments, L"", NULL);
- }
- else
- {
FdoInt32 len = 0;
data = m_fdoReader->GetGeometry(propertyName.c_str(), &len);
length = len;
}
+ catch(...)
+ {
+ if(m_fdoReader->IsNull(propertyName.c_str()))
+ {
+ MgStringCollection arguments;
+ arguments.Add(propertyName);
+ throw new MgNullPropertyValueException(L"MgServerFeatureReader.GetGeometry",
+ __LINE__, __WFILE__, &arguments, L"", NULL);
+ }
+ else
+ throw;
+ }
+
MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerFeatureReader.GetGeometry");
return (BYTE_ARRAY_OUT)data;
Modified: sandbox/adsk/2.2gp/Server/src/Services/Mapping/MappingUtil.cpp
===================================================================
--- sandbox/adsk/2.2gp/Server/src/Services/Mapping/MappingUtil.cpp 2011-10-10 09:37:38 UTC (rev 6171)
+++ sandbox/adsk/2.2gp/Server/src/Services/Mapping/MappingUtil.cpp 2011-10-13 09:37:48 UTC (rev 6172)
@@ -375,10 +375,12 @@
// stylization operation.
TransformCacheMap transformCache;
- Ptr<MgStringCollection> layerIds = new MgStringCollection();
// Get the layers' resource content in a single request by adding them to a collection
for (int i = layers->GetCount()-1; i >= 0; i--)
{
+ auto_ptr<MdfModel::LayerDefinition> ldf;
+ RSMgFeatureReader* rsReader = NULL;
+
Ptr<MgLayerBase> mapLayer = layers->GetItem(i);
//don't send data if layer is not currently visible
@@ -399,54 +401,21 @@
continue;
}
- Ptr<MgResourceIdentifier> mapLayerId = mapLayer->GetLayerDefinition();
- layerIds->Add(mapLayerId->ToString());
- }
-
- // request the collection from resource service and add ResourceContent to the individual layers
- if(layerIds->GetCount() != 0)
- {
- Ptr<MgStringCollection> layerContents = svcResource->GetResourceContents(layerIds, NULL);
- for(int i = 0; i < layerIds->GetCount(); i ++)
- {
- for(int j = 0; j < layers->GetCount(); j ++)
- {
- Ptr<MgLayerBase> mapLayer = layers->GetItem(j);
- Ptr<MgResourceIdentifier> mapLayerId = mapLayer->GetLayerDefinition();
- if(mapLayerId->ToString() == layerIds->GetItem(i))
- {
- mapLayer->SetLayerResourceContent(layerContents->GetItem(i));
- break;
- }
- }
- }
- }
-
- // cycle over the layers and do stylization
- for (int i = layers->GetCount()-1; i >= 0; i--)
- {
- auto_ptr<MdfModel::LayerDefinition> ldf;
- RSMgFeatureReader* rsReader = NULL;
-
- Ptr<MgLayerBase> mapLayer = layers->GetItem(i);
-
#ifdef _DEBUG
printf(" StylizeLayers() **LAYERSTART** Name:%S VAS:%S\n", (mapLayer->GetName()).c_str(), mapLayer->IsVisibleAtScale(scale)? L"True" : L"False");
#endif
- if(mapLayer->GetLayerResourceContent() == L"")
- continue;
-
MG_SERVER_MAPPING_SERVICE_TRY()
- // get layer definition using SAX XML Parser
- ldf.reset(MgLayerBase::GetLayerDefinition(mapLayer->GetLayerResourceContent()));
+ //get layer definition
+ Ptr<MgResourceIdentifier> layerid = mapLayer->GetLayerDefinition();
+ ldf.reset(MgLayerBase::GetLayerDefinition(svcResource, layerid));
Ptr<MgLayerGroup> group = mapLayer->GetGroup();
MgLogDetail logDetail(MgServiceType::MappingService, MgLogDetail::InternalTrace, L"MgMappingUtil.StylizeLayers", mgStackParams);
logDetail.AddString(L"Map",map->GetName());
- Ptr<MgResourceIdentifier> layerid = mapLayer->GetLayerDefinition();
+
logDetail.AddResourceIdentifier(L"LayerId",layerid);
logDetail.Create();
Modified: sandbox/adsk/2.2gp/Web/src/mapviewernet/legend.aspx
===================================================================
--- sandbox/adsk/2.2gp/Web/src/mapviewernet/legend.aspx 2011-10-10 09:37:38 UTC (rev 6171)
+++ sandbox/adsk/2.2gp/Web/src/mapviewernet/legend.aspx 2011-10-13 09:37:48 UTC (rev 6172)
@@ -1,5 +1,5 @@
<%--
-Copyright (C) 2004-2010 by Autodesk, Inc.
+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.
@@ -20,6 +20,7 @@
<%@ Import Namespace="System.Collections" %>
<%@ Import Namespace="System.Collections.Specialized" %>
<%@ Import Namespace="System.Web" %>
+<%@ Import Namespace="System.Text" %>
<%@ Import Namespace="System.Globalization" %>
<%@ Import Namespace="System.Xml" %>
<%@ Import Namespace="OSGeo.MapGuide" %>
@@ -64,7 +65,7 @@
bool summary = false;
int layerCount = 0;
int intermediateVar = 0;
-String output = "\nvar layerData = new Array();\n";
+StringBuilder output = new StringBuilder("\nvar layerData = new Array();\n");
</script>
<%
@@ -122,7 +123,7 @@
//
String templ = LoadTemplate(Request, "../viewerfiles/legendupdate.templ");
String[] vals = { updateType.ToString(NumberFormatInfo.InvariantInfo),
- output,
+ output.ToString(),
GetSurroundVirtualPath(Request) + "legend.aspx"};
String outputString = Substitute(templ, vals);
@@ -282,7 +283,7 @@
if(node.children != null)
{
arrChildName = "c" + (intermediateVar++);
- output = output + "var " + arrChildName + " = new Array();\n";
+ output.Append("var " + arrChildName + " = new Array();\n");
}
else
{
@@ -292,7 +293,7 @@
MgLayerGroup rtLayerGroup = (MgLayerGroup)node.rtObject;
if(fulldata)
{
- output = output + String.Format("var {0} = new GroupItem(\"{1}\", {2}, {3}, {4},{5}, \"{6}\", \"{7}\", {8});\n",
+ output.Append(String.Format("var {0} = new GroupItem(\"{1}\", {2}, {3}, {4},{5}, \"{6}\", \"{7}\", {8});\n",
groupName,
StrEscape(rtLayerGroup.GetLegendLabel()),
rtLayerGroup.GetExpandInLegend()? "true": "false",
@@ -301,24 +302,24 @@
rtLayerGroup.GetDisplayInLegend() ? "true" : "false",
rtLayerGroup.GetObjectId(),
StrEscape(rtLayerGroup.GetName()),
- rtLayerGroup.GetLayerGroupType() == MgLayerGroupType.BaseMap? "true": "false");
+ rtLayerGroup.GetLayerGroupType() == MgLayerGroupType.BaseMap? "true": "false"));
}
else
{
- output = output + String.Format("var {0} = new GroupSummary(\"{1}\", \"{2}\", {3}, {4});\n",
+ output.Append(String.Format("var {0} = new GroupSummary(\"{1}\", \"{2}\", {3}, {4});\n",
groupName,
StrEscape(rtLayerGroup.GetName()),
rtLayerGroup.GetObjectId(),
arrChildName,
- parentName);
+ parentName));
}
- output = output + String.Format("{0}[{1}] = {2};\n", container, treeIndex, groupName);
+ output.Append(String.Format("{0}[{1}] = {2};\n", container, treeIndex, groupName));
++treeIndex;
if(node.children != null)
{
BuildClientSideTree(node.children, node, groupName, fulldata, arrChildName, resSrvc, null);
- output = output + String.Format("{0}.children = {1};\n", groupName, arrChildName);
+ output.Append(String.Format("{0}.children = {1};\n", groupName, arrChildName));
}
}
}
@@ -333,7 +334,7 @@
String layerData = node.layerData;
String layerName = "lyr" + (intermediateVar++);
String objectId = rtLayer.GetObjectId();
- output = output + String.Format("var {0} = new LayerItem(\"{1}\", \"{2}\", {3}, {4}, {5}, {6}, {7}, \"{8}\", \"{9}\", {10});\n",
+ output.Append(String.Format("var {0} = new LayerItem(\"{1}\", \"{2}\", {3}, {4}, {5}, {6}, {7}, \"{8}\", \"{9}\", {10});\n",
layerName,
rtLayer.GetLegendLabel(),
StrEscape(rtLayer.GetName()),
@@ -344,12 +345,12 @@
rtLayer.GetSelectable() ? "true" : "false",
resId.ToString(),
objectId,
- rtLayer.GetLayerType() == MgLayerType.BaseMap? "true": "false");
+ rtLayer.GetLayerType() == MgLayerType.BaseMap? "true": "false"));
- output = output + String.Format("{0}[{1}] = {2};\n",
+ output.Append(String.Format("{0}[{1}] = {2};\n",
container,
treeIndex,
- layerName);
+ layerName));
++treeIndex;
if(layerMap == null || !layerMap.ContainsKey(objectId))
@@ -359,12 +360,12 @@
}
else
{
- output = output + String.Format("{0}[{1}] = new LayerSummary(\"{2}\", \"{3}\", \"{4}\");\n",
+ output.Append(String.Format("{0}[{1}] = new LayerSummary(\"{2}\", \"{3}\", \"{4}\");\n",
container,
i,
rtLayer.GetName(),
rtLayer.GetObjectId(),
- rtLayer.GetLayerDefinition().ToString());
+ rtLayer.GetLayerDefinition().ToString()));
}
}
}
@@ -410,12 +411,12 @@
if(maxElt.Count > 0)
maxScale = maxElt[0].ChildNodes[0].Value;
String scaleRangeVarName = "sc" + (intermediateVar++);
- output = output + String.Format("var {0} = new ScaleRangeItem({1}, {2}, {3});\n",
+ output.Append(String.Format("var {0} = new ScaleRangeItem({1}, {2}, {3});\n",
scaleRangeVarName,
minScale,
maxScale,
- layerVarName);
- output = output + String.Format("{0}.children[{1}] = {2};\n", layerVarName, sc, scaleRangeVarName);
+ layerVarName));
+ output.Append(String.Format("{0}.children[{1}] = {2};\n", layerVarName, sc, scaleRangeVarName));
if(type != 0)
break;
@@ -447,18 +448,18 @@
if(filter != null && filter.Count > 0 && filter[0].ChildNodes.Count > 0)
filterText = filter[0].ChildNodes[0].Value;
- output = output + String.Format("{0}.children[{1}] = new StyleItem(\"{2}\", \"{3}\", {4}, {5});\n",
+ output.Append(String.Format("{0}.children[{1}] = new StyleItem(\"{2}\", \"{3}\", {4}, {5});\n",
scaleRangeVarName,
styleIndex++,
StrEscape(labelText.Trim()),
StrEscape(filterText.Trim()),
ts+1,
- catIndex++);
+ catIndex++));
}
}
}
}
- output = output + String.Format("{0}.lyrtype = {1};\n", layerVarName, type.ToString(NumberFormatInfo.InvariantInfo) );
+ output.Append(String.Format("{0}.lyrtype = {1};\n", layerVarName, type.ToString(NumberFormatInfo.InvariantInfo) ));
}
catch(Exception e)
{
More information about the mapguide-commits
mailing list