[mapguide-commits] r9008 - in branches/3.0/MgDev: . Web/src/mapviewerjava Web/src/mapviewernet Web/src/mapviewerphp
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Wed Jul 27 07:03:11 PDT 2016
Author: jng
Date: 2016-07-27 07:03:11 -0700 (Wed, 27 Jul 2016)
New Revision: 9008
Modified:
branches/3.0/MgDev/
branches/3.0/MgDev/Web/src/mapviewerjava/buffer.jsp
branches/3.0/MgDev/Web/src/mapviewerjava/common.jsp
branches/3.0/MgDev/Web/src/mapviewerjava/search.jsp
branches/3.0/MgDev/Web/src/mapviewerjava/selectwithin.jsp
branches/3.0/MgDev/Web/src/mapviewernet/buffer.aspx
branches/3.0/MgDev/Web/src/mapviewernet/common.aspx
branches/3.0/MgDev/Web/src/mapviewernet/search.aspx
branches/3.0/MgDev/Web/src/mapviewernet/selectwithin.aspx
branches/3.0/MgDev/Web/src/mapviewerphp/buffer.php
branches/3.0/MgDev/Web/src/mapviewerphp/common.php
branches/3.0/MgDev/Web/src/mapviewerphp/search.php
branches/3.0/MgDev/Web/src/mapviewerphp/selectwithin.php
Log:
Merged revision(s) 9004-9006 from trunk/MgDev:
#2732: Use explicit property lists where MgFeatureQueryOptions is used.
This is to ensure that a "select * from featureclass" query from relational FDO providers will have its column list bounded to what is recognized in the class definition returned by the provider. Some providers are known to produce "select * from table" queries that "leak" out column types that the provider does not know how to process. Using an explicit property list from its class definition will allow us to avoid such issues.
This is for the Java implementation of the AJAX viewer
........
#2732: Use explicit property lists where MgFeatureQueryOptions is used.
This is to ensure that a "select * from featureclass" query from relational FDO providers will have its column list bounded to what is recognized in the class definition returned by the provider. Some providers are known to produce "select * from table" queries that "leak" out column types that the provider does not know how to process. Using an explicit property list from its class definition will allow us to avoid such issues.
This is for the PHP implementation of the AJAX viewer
........
#2732: Use explicit property lists where MgFeatureQueryOptions is used.
This is to ensure that a "select * from featureclass" query from relational FDO providers will have its column list bounded to what is recognized in the class definition returned by the provider. Some providers are known to produce "select * from table" queries that "leak" out column types that the provider does not know how to process. Using an explicit property list from its class definition will allow us to avoid such issues.
This is for the ASP.net implementation of the AJAX viewer
........
Property changes on: branches/3.0/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
/sandbox/adsk/2.6l:8727
/sandbox/adsk/3.0m:8563,8584,8607,8625,8694-8695
/sandbox/adsk/3.1n:8871,8912,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/php56x:8975-8985
/sandbox/jng/rfc155:8874-8884
/sandbox/jng/tiling:8174-8208
/sandbox/jng/v30:8212-8227
/sandbox/rfc94:5099-5163
/trunk/MgDev:8595,8616-8618,8626,8682,8700,8728,8844,8956,8969,8980-8981,8996,9000
+ /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
/sandbox/adsk/2.6l:8727
/sandbox/adsk/3.0m:8563,8584,8607,8625,8694-8695
/sandbox/adsk/3.1n:8871,8912,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/php56x:8975-8985
/sandbox/jng/rfc155:8874-8884
/sandbox/jng/tiling:8174-8208
/sandbox/jng/v30:8212-8227
/sandbox/rfc94:5099-5163
/trunk/MgDev:8595,8616-8618,8626,8682,8700,8728,8844,8956,8969,8980-8981,8996,9000,9004-9006
Modified: branches/3.0/MgDev/Web/src/mapviewerjava/buffer.jsp
===================================================================
--- branches/3.0/MgDev/Web/src/mapviewerjava/buffer.jsp 2016-07-27 14:02:51 UTC (rev 9007)
+++ branches/3.0/MgDev/Web/src/mapviewerjava/buffer.jsp 2016-07-27 14:03:11 UTC (rev 9008)
@@ -274,7 +274,8 @@
if(filter == null || filter.length() == 0)
continue;
- MgFeatureQueryOptions query = new MgFeatureQueryOptions();
+ MgClassDefinition clsDef = selLayer.GetClassDefinition();
+ MgFeatureQueryOptions query = BuildFeatureQueryOptions(clsDef);
query.SetFilter(filter);
MgResourceIdentifier featureSource = new MgResourceIdentifier(selLayer.GetFeatureSourceId());
Modified: branches/3.0/MgDev/Web/src/mapviewerjava/common.jsp
===================================================================
--- branches/3.0/MgDev/Web/src/mapviewerjava/common.jsp 2016-07-27 14:02:51 UTC (rev 9007)
+++ branches/3.0/MgDev/Web/src/mapviewerjava/common.jsp 2016-07-27 14:03:11 UTC (rev 9008)
@@ -300,4 +300,54 @@
return validColorString;
}
+MgFeatureQueryOptions BuildFeatureQueryOptions(MgClassDefinition classDef) throws MgException
+{
+ MgFeatureQueryOptions query = new MgFeatureQueryOptions();
+ String geomPropName = classDef.GetDefaultGeometryPropertyName();
+ MgPropertyDefinitionCollection propertyList = classDef.GetProperties();
+ for (int i = 0; i < propertyList.GetCount(); i++)
+ {
+ MgPropertyDefinition propertyDef = propertyList.GetItem(i);
+ String property = propertyDef.GetName();
+
+ if ((!property.equals(geomPropName)) && (propertyDef.GetPropertyType() == MgFeaturePropertyType.DataProperty))
+ {
+ MgDataPropertyDefinition dp = (MgDataPropertyDefinition)propertyDef;
+ int propertyType = dp.GetDataType();
+ switch (propertyType) {
+ case MgPropertyType.Boolean:
+ query.AddFeatureProperty(property);
+ break;
+ case MgPropertyType.Byte:
+ query.AddFeatureProperty(property);
+ break;
+ case MgPropertyType.DateTime:
+ query.AddFeatureProperty(property);
+ break;
+ case MgPropertyType.Single:
+ query.AddFeatureProperty(property);
+ break;
+ case MgPropertyType.Double:
+ query.AddFeatureProperty(property);
+ break;
+ case MgPropertyType.Int16:
+ query.AddFeatureProperty(property);
+ break;
+ case MgPropertyType.Int32:
+ query.AddFeatureProperty(property);
+ break;
+ case MgPropertyType.Int64:
+ query.AddFeatureProperty(property);
+ break;
+ case MgPropertyType.String:
+ query.AddFeatureProperty(property);
+ break;
+ }
+ } else if (property.equals(geomPropName)) {
+ query.AddFeatureProperty(property);
+ }
+ }
+ return query;
+}
+
%>
Modified: branches/3.0/MgDev/Web/src/mapviewerjava/search.jsp
===================================================================
--- branches/3.0/MgDev/Web/src/mapviewerjava/search.jsp 2016-07-27 14:02:51 UTC (rev 9007)
+++ branches/3.0/MgDev/Web/src/mapviewerjava/search.jsp 2016-07-27 14:03:11 UTC (rev 9008)
@@ -114,10 +114,11 @@
boolean displayAll = (resProps.size() == 0);
//query the features
- MgFeatureQueryOptions opts = new MgFeatureQueryOptions();
+ MgClassDefinition clsDef = layer.GetClassDefinition();
+ MgFeatureQueryOptions opts = BuildFeatureQueryOptions(clsDef);
opts.SetFilter(filter);
String featureClassName = layer.GetFeatureClassName();
- features = layer.SelectFeatures( opts);
+ features = layer.SelectFeatures(opts);
boolean hasResult = features.ReadNext();
if(hasResult)
Modified: branches/3.0/MgDev/Web/src/mapviewerjava/selectwithin.jsp
===================================================================
--- branches/3.0/MgDev/Web/src/mapviewerjava/selectwithin.jsp 2016-07-27 14:02:51 UTC (rev 9007)
+++ branches/3.0/MgDev/Web/src/mapviewerjava/selectwithin.jsp 2016-07-27 14:03:11 UTC (rev 9008)
@@ -116,7 +116,8 @@
MgLayer layer = (MgLayer) selLayers.GetItem(i);
String filter = sel.GenerateFilter(layer, layer.GetFeatureClassName());
- MgFeatureQueryOptions query = new MgFeatureQueryOptions();
+ MgClassDefinition clsDef = layer.GetClassDefinition();
+ MgFeatureQueryOptions query = BuildFeatureQueryOptions(clsDef);
query.SetFilter(filter);
MgResourceIdentifier featureSource = new MgResourceIdentifier(layer.GetFeatureSourceId());
MgFeatureReader features = featureSrvc.SelectFeatures(featureSource, layer.GetFeatureClassName(), query);
Modified: branches/3.0/MgDev/Web/src/mapviewernet/buffer.aspx
===================================================================
--- branches/3.0/MgDev/Web/src/mapviewernet/buffer.aspx 2016-07-27 14:02:51 UTC (rev 9007)
+++ branches/3.0/MgDev/Web/src/mapviewernet/buffer.aspx 2016-07-27 14:03:11 UTC (rev 9008)
@@ -254,7 +254,8 @@
if (filter == null || filter.Length == 0)
continue;
- MgFeatureQueryOptions query = new MgFeatureQueryOptions();
+ MgClassDefinition clsDef = selLayer.GetClassDefinition();
+ MgFeatureQueryOptions query = BuildFeatureQueryOptions(clsDef);
query.SetFilter(filter);
MgResourceIdentifier featureSource = new MgResourceIdentifier(selLayer.GetFeatureSourceId());
Modified: branches/3.0/MgDev/Web/src/mapviewernet/common.aspx
===================================================================
--- branches/3.0/MgDev/Web/src/mapviewernet/common.aspx 2016-07-27 14:02:51 UTC (rev 9007)
+++ branches/3.0/MgDev/Web/src/mapviewernet/common.aspx 2016-07-27 14:03:11 UTC (rev 9008)
@@ -292,4 +292,54 @@
return validColorString;
}
+MgFeatureQueryOptions BuildFeatureQueryOptions(MgClassDefinition classDef)
+{
+ MgFeatureQueryOptions query = new MgFeatureQueryOptions();
+ String geomPropName = classDef.GetDefaultGeometryPropertyName();
+ MgPropertyDefinitionCollection propertyList = classDef.GetProperties();
+ for (int i = 0; i < propertyList.GetCount(); i++)
+ {
+ MgPropertyDefinition propertyDef = propertyList.GetItem(i);
+ String property = propertyDef.GetName();
+
+ if ((property != geomPropName) && (propertyDef.GetPropertyType() == MgFeaturePropertyType.DataProperty))
+ {
+ MgDataPropertyDefinition dp = (MgDataPropertyDefinition)propertyDef;
+ int propertyType = dp.GetDataType();
+ switch (propertyType) {
+ case MgPropertyType.Boolean:
+ query.AddFeatureProperty(property);
+ break;
+ case MgPropertyType.Byte:
+ query.AddFeatureProperty(property);
+ break;
+ case MgPropertyType.DateTime:
+ query.AddFeatureProperty(property);
+ break;
+ case MgPropertyType.Single:
+ query.AddFeatureProperty(property);
+ break;
+ case MgPropertyType.Double:
+ query.AddFeatureProperty(property);
+ break;
+ case MgPropertyType.Int16:
+ query.AddFeatureProperty(property);
+ break;
+ case MgPropertyType.Int32:
+ query.AddFeatureProperty(property);
+ break;
+ case MgPropertyType.Int64:
+ query.AddFeatureProperty(property);
+ break;
+ case MgPropertyType.String:
+ query.AddFeatureProperty(property);
+ break;
+ }
+ } else if (property == geomPropName) {
+ query.AddFeatureProperty(property);
+ }
+ }
+ return query;
+}
+
</script>
Modified: branches/3.0/MgDev/Web/src/mapviewernet/search.aspx
===================================================================
--- branches/3.0/MgDev/Web/src/mapviewernet/search.aspx 2016-07-27 14:02:51 UTC (rev 9007)
+++ branches/3.0/MgDev/Web/src/mapviewernet/search.aspx 2016-07-27 14:03:11 UTC (rev 9008)
@@ -103,7 +103,8 @@
bool displayAll = (resProps.Count == 0);
//query the features
- MgFeatureQueryOptions opts = new MgFeatureQueryOptions();
+ MgClassDefinition clsDef = layer.GetClassDefinition();
+ MgFeatureQueryOptions opts = BuildFeatureQueryOptions(clsDef);
opts.SetFilter(filter);
String featureClassName = layer.GetFeatureClassName();
features = layer.SelectFeatures(opts);
Modified: branches/3.0/MgDev/Web/src/mapviewernet/selectwithin.aspx
===================================================================
--- branches/3.0/MgDev/Web/src/mapviewernet/selectwithin.aspx 2016-07-27 14:02:51 UTC (rev 9007)
+++ branches/3.0/MgDev/Web/src/mapviewernet/selectwithin.aspx 2016-07-27 14:03:11 UTC (rev 9008)
@@ -113,7 +113,8 @@
MgLayer layer = (MgLayer) selLayers.GetItem(i);
String filter = sel.GenerateFilter(layer, layer.GetFeatureClassName());
- MgFeatureQueryOptions query = new MgFeatureQueryOptions();
+ MgClassDefinition clsDef = layer.GetClassDefinition();
+ MgFeatureQueryOptions query = BuildFeatureQueryOptions(clsDef);
query.SetFilter(filter);
MgResourceIdentifier featureSource = new MgResourceIdentifier(layer.GetFeatureSourceId());
MgFeatureReader features = featureSrvc.SelectFeatures(featureSource, layer.GetFeatureClassName(), query);
Modified: branches/3.0/MgDev/Web/src/mapviewerphp/buffer.php
===================================================================
--- branches/3.0/MgDev/Web/src/mapviewerphp/buffer.php 2016-07-27 14:02:51 UTC (rev 9007)
+++ branches/3.0/MgDev/Web/src/mapviewerphp/buffer.php 2016-07-27 14:03:11 UTC (rev 9008)
@@ -241,7 +241,8 @@
if($filter == "")
continue;
- $query = new MgFeatureQueryOptions();
+ $clsDef = $selLayer->GetClassDefinition();
+ $query = BuildFeatureQueryOptions($clsDef);
$query->SetFilter($filter);
$featureSource = new MgResourceIdentifier($selLayer->GetFeatureSourceId());
Modified: branches/3.0/MgDev/Web/src/mapviewerphp/common.php
===================================================================
--- branches/3.0/MgDev/Web/src/mapviewerphp/common.php 2016-07-27 14:02:51 UTC (rev 9007)
+++ branches/3.0/MgDev/Web/src/mapviewerphp/common.php 2016-07-27 14:03:11 UTC (rev 9008)
@@ -282,4 +282,54 @@
return $paramValue;
}
+function BuildFeatureQueryOptions($classDef)
+{
+ $query = new MgFeatureQueryOptions();
+ $geomPropName = $classDef->GetDefaultGeometryPropertyName();
+ $propertyList = $classDef->GetProperties();
+
+ for ($i = 0; $i < $propertyList->GetCount(); $i++)
+ {
+ $propertyDef = $propertyList->GetItem($i);
+ $property = $propertyList->GetItem($i)->GetName();
+
+ if (($property != $geomPropName) && ($propertyDef->GetPropertyType() == MgFeaturePropertyType::DataProperty))
+ {
+ $propertyType = $propertyList->GetItem($i)->GetDataType();
+ switch ($propertyType) {
+ case MgPropertyType::Boolean:
+ $query->AddFeatureProperty($property);
+ break;
+ case MgPropertyType::Byte:
+ $query->AddFeatureProperty($property);
+ break;
+ case MgPropertyType::DateTime:
+ $query->AddFeatureProperty($property);
+ break;
+ case MgPropertyType::Single:
+ $query->AddFeatureProperty($property);
+ break;
+ case MgPropertyType::Double:
+ $query->AddFeatureProperty($property);
+ break;
+ case MgPropertyType::Int16:
+ $query->AddFeatureProperty($property);
+ break;
+ case MgPropertyType::Int32:
+ $query->AddFeatureProperty($property);
+ break;
+ case MgPropertyType::Int64:
+ $query->AddFeatureProperty($property);
+ break;
+ case MgPropertyType::String:
+ $query->AddFeatureProperty($property);
+ break;
+ }
+ } else if ($property == $geomPropName){
+ $query->AddFeatureProperty($property);
+ }
+ }
+ return $query;
+}
+
?>
Modified: branches/3.0/MgDev/Web/src/mapviewerphp/search.php
===================================================================
--- branches/3.0/MgDev/Web/src/mapviewerphp/search.php 2016-07-27 14:02:51 UTC (rev 9007)
+++ branches/3.0/MgDev/Web/src/mapviewerphp/search.php 2016-07-27 14:03:11 UTC (rev 9008)
@@ -103,7 +103,8 @@
$displayAll = (count($resProps) == 0);
//query the features
- $opts = new MgFeatureQueryOptions();
+ $clsDef = $layer->GetClassDefinition();
+ $opts = BuildFeatureQueryOptions($clsDef);
$opts->SetFilter($filter);
$featureClassName = $layer->GetFeatureClassName();
$features = $layer->SelectFeatures($opts);
Modified: branches/3.0/MgDev/Web/src/mapviewerphp/selectwithin.php
===================================================================
--- branches/3.0/MgDev/Web/src/mapviewerphp/selectwithin.php 2016-07-27 14:02:51 UTC (rev 9007)
+++ branches/3.0/MgDev/Web/src/mapviewerphp/selectwithin.php 2016-07-27 14:03:11 UTC (rev 9008)
@@ -99,7 +99,8 @@
{
$layer = $selLayers->GetItem($i);
$filter = $sel->GenerateFilter($layer, $layer->GetFeatureClassName());
- $query = new MgFeatureQueryOptions();
+ $clsDef = $layer->GetClassDefinition();
+ $query = BuildFeatureQueryOptions($clsDef);
$query->SetFilter($filter);
$featureSource = new MgResourceIdentifier($layer->GetFeatureSourceId());
$features = $featureSrvc->SelectFeatures($featureSource, $layer->GetFeatureClassName(), $query);
More information about the mapguide-commits
mailing list