internal RedlineLayer[] GetAvailableLayers(MgMapBase map) { var fsId = GetRegistryFeatureSource(); MgLayerCollection mapLayers = map.GetLayers(); List <RedlineLayer> layers = new List <RedlineLayer>(); MgFeatureReader reader = null; try { reader = _featSvc.SelectFeatures(fsId, "Default:MarkupRegistry", null); while (reader.ReadNext()) { layers.Add(new RedlineLayer(reader.GetString("Name"), reader.GetString("ResourceId"), reader.GetString("LayerDefinition"), reader.GetInt32("GeometryTypes"), (RedlineStylizationType)reader.GetInt32("StyleType"))); } } finally { if (reader != null) { reader.Close(); } } return(layers.ToArray()); }
/// <summary>Получает строковое представление поля _property_name из текущей записи _reader</summary> /// <param name="_reader"></param> /// <param name="_property_name"></param> /// <returns></returns> internal static string PropertyValueToString(MgFeatureReader _reader, string _property_name) { MgPropertyDefinitionCollection prop_defs = _reader.GetClassDefinition().GetProperties(); if (String.IsNullOrEmpty(_property_name) || !prop_defs.Contains(_property_name)) { return(null); } int property_type = _reader.GetPropertyType(_property_name); if (_reader.IsNull(_property_name)) { return(null); } else if (property_type == MgPropertyType.Boolean) { return(_reader.GetBoolean(_property_name).ToString()); } else if (property_type == MgPropertyType.Byte) { return(_reader.GetByte(_property_name).ToString()); } else if (property_type == MgPropertyType.DateTime) { return(_reader.GetDateTime(_property_name).ToString()); } else if (property_type == MgPropertyType.Double) { return(_reader.GetDouble(_property_name).ToString()); } else if (property_type == MgPropertyType.Int16) { return(_reader.GetInt16(_property_name).ToString()); } else if (property_type == MgPropertyType.Int32) { return(_reader.GetInt32(_property_name).ToString()); } else if (property_type == MgPropertyType.Int64) { return(_reader.GetInt64(_property_name).ToString()); } else if (property_type == MgPropertyType.Single) { return(_reader.GetSingle(_property_name).ToString()); } else if (property_type == MgPropertyType.String) { return(_reader.GetString(_property_name)); } else { return(null); } } //method
private void btnQueryDistrict1_Click(object sender, EventArgs e) { MgMapBase map = _viewer.GetMap(); MgLayerCollection layers = map.GetLayers(); MgLayerBase districts = layers.GetItem("Districts"); MgLayerBase parcels = layers.GetItem("Parcels"); //Query the geometry of district 1 MgFeatureQueryOptions districtQuery = new MgFeatureQueryOptions(); districtQuery.SetFilter("Autogenerated_SDF_ID = 1"); MgFeatureReader reader = districts.SelectFeatures(districtQuery); MgGeometry districtGeom = null; MgAgfReaderWriter agfRw = new MgAgfReaderWriter(); try { reader.ReadNext(); MgByteReader geomAgf = reader.GetGeometry(districts.GetFeatureGeometryName()); districtGeom = agfRw.Read(geomAgf); } finally { reader.Close(); } //Now use this geometry as the basis of our 2nd query MgFeatureQueryOptions parcelQuery = new MgFeatureQueryOptions(); parcelQuery.SetFilter("RNAME LIKE 'SCHMITT%'"); parcelQuery.SetSpatialFilter(parcels.GetFeatureGeometryName(), districtGeom, MgFeatureSpatialOperations.Inside); //Select the features reader = parcels.SelectFeatures(parcelQuery); List <string> results = new List <string>(); try { while (reader.ReadNext()) { if (!reader.IsNull("RPROPAD")) { results.Add(reader.GetString("RPROPAD")); } } } finally { reader.Close(); } new ParcelQueryResultWindow(results).ShowDialog(); }
public void LoadResults(MgLayerBase layer, MgFeatureQueryOptions query) { MgClassDefinition clsDef = layer.GetClassDefinition(); MgPropertyDefinitionCollection idProps = clsDef.GetIdentityProperties(); MgPropertyDefinition idProp = idProps[0]; string idPropName = idProp.Name; string geomName = layer.FeatureGeometryName; MgFeatureReader reader = layer.SelectFeatures(query); MgAgfReaderWriter agfRw = new MgAgfReaderWriter(); try { while (reader.ReadNext()) { var res = new ParcelFeatureModel(); res.ID = reader.GetInt32(idPropName); res.Owner = reader.IsNull("RNAME") ? "(unknown)" : reader.GetString("RNAME"); res.Address = reader.IsNull("RPROPAD") ? "(unknown)" : reader.GetString("RPROPAD"); if (!reader.IsNull(geomName)) { MgByteReader agf = reader.GetGeometry(geomName); MgGeometry geom = agfRw.Read(agf); MgPoint center = geom.Centroid; MgCoordinate coord = center.Coordinate; res.X = coord.X; res.Y = coord.Y; } this.Results.Add(res); } } finally { reader.Close(); } }
private void mgMapViewer1_SelectionChanged(object sender, EventArgs e) { MgSelectionBase selection = mgMapViewer1.GetSelection(); MgReadOnlyLayerCollection layers = selection.GetLayers(); if (layers != null) { for (int i = 0; i < layers.GetCount(); i++) { MgLayerBase layer = layers.GetItem(i); if (layer.Name == "Parcels") //The selected layer is parcels { //Check that we only have one selected object int count = selection.GetSelectedFeaturesCount(layer, layer.FeatureClassName); if (count == 1) { MgFeatureReader reader = null; try { reader = selection.GetSelectedFeatures(layer, layer.FeatureClassName, false); if (reader.ReadNext()) { //Address is in the RPROPAD property if (reader.IsNull("RPROPAD")) { MessageBox.Show("Selected parcel has no address"); } else { MessageBox.Show("Address: " + reader.GetString("RPROPAD")); } } } finally //Must close all readers, otherwise connections will leak { reader.Close(); } } else { MessageBox.Show("Please select only one parcel"); } break; } } } }
public IEnumerable <RedlineObject> GetAllFeatures() { MgMapBase map = _viewer.GetMap(); MgLayerCollection layers = map.GetLayers(); MgLayerBase redlineLayer = layers.GetItem(_layer.SystemName); MgResourceIdentifier resId = new MgResourceIdentifier(redlineLayer.GetFeatureSourceId()); MgFeatureReader reader = null; try { reader = _featSvc.SelectFeatures(resId, RedlineSchemaFactory.CLASS_NAME, null); //HACK: Another leaky abstraction. SHP will always choose FeatId, so once again //use the class definition to determine the identity property name MgClassDefinition cls = reader.GetClassDefinition(); MgPropertyDefinitionCollection idProps = cls.GetIdentityProperties(); MgPropertyDefinition keyProp = idProps.GetItem(0); string idName = keyProp.GetName(); while (reader.ReadNext()) { int id = reader.GetInt32(idName); string text = reader.IsNull(RedlineSchemaFactory.TEXT_NAME) ? string.Empty : reader.GetString(RedlineSchemaFactory.TEXT_NAME); yield return(new RedlineObject(id, text)); } } finally { if (reader != null) { reader.Close(); } } }
private MgFeature CreateFeatureFromReader(MgFeatureReader reader) { var feature = new MgFeature(); var hash = feature.Properties; for (int i = 0; i < reader.GetPropertyCount(); i++) { var pt = reader.GetPropertyType(i); //Skip un-presentable types if (pt == MgPropertyType.Null || pt == MgPropertyType.Raster || pt == MgPropertyType.Blob || pt == MgPropertyType.Feature || pt == MgPropertyType.Clob) continue; string name = reader.GetPropertyName(i); if (reader.IsNull(i)) { hash[name] = null; } else { switch (pt) { case MgPropertyType.Boolean: hash[name] = reader.GetBoolean(i); break; case MgPropertyType.Byte: hash[name] = reader.GetByte(i); break; case MgPropertyType.DateTime: { var dt = reader.GetDateTime(i); hash[name] = new DateTime(dt.Year, dt.Month, dt.Day, dt.Hour, dt.Minute, dt.Second, 0); } break; case MgPropertyType.Double: case MgPropertyType.Decimal: hash[name] = reader.GetDouble(i); break; case MgPropertyType.Int16: hash[name] = reader.GetInt16(i); break; case MgPropertyType.Int32: hash[name] = reader.GetInt32(i); break; case MgPropertyType.Int64: hash[name] = reader.GetInt64(i); break; case MgPropertyType.Single: hash[name] = reader.GetSingle(i); break; case MgPropertyType.String: hash[name] = reader.GetString(i); break; case MgPropertyType.Geometry: { MgByteReader agf = reader.GetGeometry(i); feature.Geometry = _agfRw.Read(agf); } break; } } } return feature; }
/// <summary>Получает набор свойств MgPropertyCollection из текущей записи _reader в соответствии со списком _listed_prop_defs</summary> /// <param name="_reader"></param> /// <param name="_listed_prop_defs"></param> /// <returns></returns> internal static MgPropertyCollection GetPropertiesFromReader(MgFeatureReader _reader, MgPropertyDefinitionCollection _listed_prop_defs) { MgPropertyCollection result_props = new MgPropertyCollection(); MgPropertyDefinitionCollection reader_prop_defs = _reader.GetClassDefinition().GetProperties(); foreach (MgPropertyDefinition curr_prop_def in _listed_prop_defs) { if (!reader_prop_defs.Contains(curr_prop_def.Name) || _reader.IsNull(curr_prop_def.Name)) { continue; } int property_type = _reader.GetPropertyType(curr_prop_def.Name); if (property_type == MgPropertyType.Blob) { result_props.Add( new MgBlobProperty(curr_prop_def.Name, _reader.GetBLOB(curr_prop_def.Name)) ); } else if (property_type == MgPropertyType.Boolean) { result_props.Add( new MgBooleanProperty(curr_prop_def.Name, _reader.GetBoolean(curr_prop_def.Name)) ); } else if (property_type == MgPropertyType.Byte) { result_props.Add( new MgByteProperty(curr_prop_def.Name, _reader.GetByte(curr_prop_def.Name)) ); } else if (property_type == MgPropertyType.Clob) { result_props.Add( new MgClobProperty(curr_prop_def.Name, _reader.GetCLOB(curr_prop_def.Name)) ); } else if (property_type == MgPropertyType.DateTime) { result_props.Add( new MgDateTimeProperty(curr_prop_def.Name, _reader.GetDateTime(curr_prop_def.Name)) ); } else if (property_type == MgPropertyType.Double) { result_props.Add( new MgDoubleProperty(curr_prop_def.Name, _reader.GetDouble(curr_prop_def.Name)) ); } else if (property_type == MgPropertyType.Feature) { result_props.Add( new MgFeatureProperty(curr_prop_def.Name, _reader.GetFeatureObject(curr_prop_def.Name)) ); } else if (property_type == MgPropertyType.Geometry) { result_props.Add( new MgGeometryProperty(curr_prop_def.Name, _reader.GetGeometry(curr_prop_def.Name)) ); } else if (property_type == MgPropertyType.Int16) { result_props.Add( new MgInt16Property(curr_prop_def.Name, _reader.GetInt16(curr_prop_def.Name)) ); } else if (property_type == MgPropertyType.Int32) { result_props.Add( new MgInt32Property(curr_prop_def.Name, _reader.GetInt32(curr_prop_def.Name)) ); } else if (property_type == MgPropertyType.Int64) { result_props.Add( new MgInt64Property(curr_prop_def.Name, _reader.GetInt64(curr_prop_def.Name)) ); } else if (property_type == MgPropertyType.Raster) { result_props.Add( new MgRasterProperty(curr_prop_def.Name, _reader.GetRaster(curr_prop_def.Name)) ); } else if (property_type == MgPropertyType.Single) { result_props.Add( new MgSingleProperty(curr_prop_def.Name, _reader.GetSingle(curr_prop_def.Name)) ); } else if (property_type == MgPropertyType.String) { result_props.Add( new MgStringProperty(curr_prop_def.Name, _reader.GetString(curr_prop_def.Name)) ); } } //foreach return(result_props); }
public LocalNativeFeature(MgFeatureReader reader, FixedWKTReader mgReader, MgAgfReaderWriter agfRw, MgWktReaderWriter wktRw) : base(Utility.ConvertClassDefinition(reader.GetClassDefinition())) { for (int i = 0; i < reader.GetPropertyCount(); i++) { string name = _ordinalMap[i]; GetByteReaderMethod getblob = () => { return(reader.GetBLOB(name)); }; GetByteReaderMethod getclob = () => { return(reader.GetCLOB(name)); }; GetByteReaderMethod getgeom = () => { return(reader.GetGeometry(name)); }; if (!reader.IsNull(name)) { var pt = (PropertyValueType)reader.GetPropertyType(name); switch (pt) { case PropertyValueType.Blob: ((BlobValue)_values[name]).Value = Utility.StreamAsArray(new MgReadOnlyStream(getblob)); break; case PropertyValueType.Boolean: ((BooleanValue)_values[name]).Value = reader.GetBoolean(name); break; case PropertyValueType.Byte: ((ByteValue)_values[name]).Value = reader.GetByte(name); break; case PropertyValueType.Clob: byte[] b = Utility.StreamAsArray(new MgReadOnlyStream(getclob)); ((ClobValue)_values[name]).Value = Encoding.UTF8.GetChars(b); break; case PropertyValueType.DateTime: ((DateTimeValue)_values[name]).Value = Utility.ConvertMgDateTime(reader.GetDateTime(name)); break; case PropertyValueType.Double: ((DoubleValue)_values[name]).Value = reader.GetDouble(name); break; case PropertyValueType.Feature: ((FeatureValue)_values[name]).Value = GetFeatureArray(reader, name); break; case PropertyValueType.Geometry: //TODO: See if SWIG issues come into play here try { //TODO: See if SWIG issues come into play here var geom = agfRw.Read(reader.GetGeometry(name)); var wkt = wktRw.Write(geom); ((GeometryValue)_values[name]).Value = mgReader.Read(wkt); } catch //Invalid geometry fail! { ((GeometryValue)_values[name]).SetNull(); } break; case PropertyValueType.Int16: ((Int16Value)_values[name]).Value = reader.GetInt16(name); break; case PropertyValueType.Int32: ((Int32Value)_values[name]).Value = reader.GetInt32(name); break; case PropertyValueType.Int64: ((Int64Value)_values[name]).Value = reader.GetInt64(name); break; case PropertyValueType.Single: ((SingleValue)_values[name]).Value = reader.GetSingle(name); break; case PropertyValueType.String: ((StringValue)_values[name]).Value = reader.GetString(name); break; } } } }
public LocalNativeFeature(MgFeatureReader reader, FixedWKTReader mgReader, MgAgfReaderWriter agfRw, MgWktReaderWriter wktRw) : base(Utility.ConvertClassDefinition(reader.GetClassDefinition())) { for (int i = 0; i < reader.GetPropertyCount(); i++) { string name = _ordinalMap[i]; GetByteReaderMethod getblob = () => { return reader.GetBLOB(name); }; GetByteReaderMethod getclob = () => { return reader.GetCLOB(name); }; GetByteReaderMethod getgeom = () => { return reader.GetGeometry(name); }; if (!reader.IsNull(name)) { var pt = (PropertyValueType)reader.GetPropertyType(name); switch (pt) { case PropertyValueType.Blob: ((BlobValue)_values[name]).Value = Utility.StreamAsArray(new MgReadOnlyStream(getblob)); break; case PropertyValueType.Boolean: ((BooleanValue)_values[name]).Value = reader.GetBoolean(name); break; case PropertyValueType.Byte: ((ByteValue)_values[name]).Value = reader.GetByte(name); break; case PropertyValueType.Clob: byte[] b = Utility.StreamAsArray(new MgReadOnlyStream(getclob)); ((ClobValue)_values[name]).Value = Encoding.UTF8.GetChars(b); break; case PropertyValueType.DateTime: ((DateTimeValue)_values[name]).Value = Utility.ConvertMgDateTime(reader.GetDateTime(name)); break; case PropertyValueType.Double: ((DoubleValue)_values[name]).Value = reader.GetDouble(name); break; case PropertyValueType.Feature: ((FeatureValue)_values[name]).Value = GetFeatureArray(reader, name); break; case PropertyValueType.Geometry: //TODO: See if SWIG issues come into play here try { //TODO: See if SWIG issues come into play here var geom = agfRw.Read(reader.GetGeometry(name)); var wkt = wktRw.Write(geom); ((GeometryValue)_values[name]).Value = mgReader.Read(wkt); } catch //Invalid geometry fail! { ((GeometryValue)_values[name]).SetNull(); } break; case PropertyValueType.Int16: ((Int16Value)_values[name]).Value = reader.GetInt16(name); break; case PropertyValueType.Int32: ((Int32Value)_values[name]).Value = reader.GetInt32(name); break; case PropertyValueType.Int64: ((Int64Value)_values[name]).Value = reader.GetInt64(name); break; case PropertyValueType.Single: ((SingleValue)_values[name]).Value = reader.GetSingle(name); break; case PropertyValueType.String: ((StringValue)_values[name]).Value = reader.GetString(name); break; } } } }
//--------------------------------------------------------------------------------------- // // ���ܣ�δ֪��ѯ����е��������ݵ����͵Ĵ������ // // // ���ߣ� // // ���ڣ� 2007.5.23 // // ����ʷ���� // //--------------------------------------------------------------------------------------- public void GetPropertyValue(MgFeatureReader featureReader, int propertyType, string propertyName) { switch (propertyType ) { case MgPropertyType.Null: break; case MgPropertyType.Boolean: bool val1 = featureReader.GetBoolean(propertyName); break; case MgPropertyType.Byte: Byte val2 = featureReader.GetByte(propertyName); break; case MgPropertyType.DateTime: MgDateTime val3 = featureReader.GetDateTime(propertyName); break; case MgPropertyType.Single: float val4 = featureReader.GetSingle(propertyName); break; case MgPropertyType.Double: double val5 = featureReader.GetDouble(propertyName); break; case MgPropertyType.Int16: Int16 val6 = featureReader.GetInt16(propertyName); break; case MgPropertyType.Int32: Int32 val7 = featureReader.GetInt32(propertyName); break; case MgPropertyType.Int64: Int64 val8 = featureReader.GetInt64(propertyName); break; case MgPropertyType.String: string val9 = featureReader.GetString(propertyName); break; case MgPropertyType.Blob: string val10 = propertyName + " ��Blob����"; break; case MgPropertyType.Clob: string val11 = propertyName + " ��Clob����"; break; case MgPropertyType.Feature: MgFeatureReader val12 = featureReader.GetFeatureObject(propertyName); break; case MgPropertyType.Geometry: MgByteReader va13l = featureReader.GetGeometry(propertyName); MgAgfReaderWriter agfReader = new MgAgfReaderWriter(); MgGeometry districtGeometry = agfReader.Read(va13l); break; case MgPropertyType.Raster: MgRaster val14 = featureReader.GetRaster(propertyName) ; break; default: string val13 = "δ֪����"; break; } }
private MgFeature CreateFeatureFromReader(MgFeatureReader reader) { var feature = new MgFeature(); var hash = feature.Properties; for (int i = 0; i < reader.GetPropertyCount(); i++) { var pt = reader.GetPropertyType(i); //Skip un-presentable types if (pt == MgPropertyType.Null || pt == MgPropertyType.Raster || pt == MgPropertyType.Blob || pt == MgPropertyType.Feature || pt == MgPropertyType.Clob) { continue; } string name = reader.GetPropertyName(i); if (reader.IsNull(i)) { hash[name] = null; } else { switch (pt) { case MgPropertyType.Boolean: hash[name] = reader.GetBoolean(i); break; case MgPropertyType.Byte: hash[name] = reader.GetByte(i); break; case MgPropertyType.DateTime: { var dt = reader.GetDateTime(i); hash[name] = new DateTime(dt.Year, dt.Month, dt.Day, dt.Hour, dt.Minute, dt.Second, 0); } break; case MgPropertyType.Double: case MgPropertyType.Decimal: hash[name] = reader.GetDouble(i); break; case MgPropertyType.Int16: hash[name] = reader.GetInt16(i); break; case MgPropertyType.Int32: hash[name] = reader.GetInt32(i); break; case MgPropertyType.Int64: hash[name] = reader.GetInt64(i); break; case MgPropertyType.Single: hash[name] = reader.GetSingle(i); break; case MgPropertyType.String: hash[name] = reader.GetString(i); break; case MgPropertyType.Geometry: { MgByteReader agf = reader.GetGeometry(i); feature.Geometry = _agfRw.Read(agf); } break; } } } return(feature); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { string sessionId = GetRequestParameters(Request)["SESSION"]; string mapName = GetRequestParameters(Request)["MAPNAME"]; string locale = GetRequestParameters(Request)["LOCALE"]; if (string.IsNullOrEmpty(sessionId)) { Response.Clear(); Response.End(); return; } if (string.IsNullOrEmpty(mapName)) { Response.Clear(); Response.End(); return; } MgResourceService resourceSrvc = GetMgResurceService(sessionId); MgFeatureService featureSrvc = GetMgFeatureService(sessionId); MgMap map = new MgMap(); map.Open(resourceSrvc, mapName); string layernames = GetRequestParameters(Request)["LAYERNAMES"]; string GEOMETRY = GetRequestParameters(Request)["GEOMETRY"]; string selVar = GetRequestParameters(Request)["SELECTIONVARIANT"]; string type = GetRequestParameters(Request)["tp"]; string inputSel = GetRequestParameters(Request)["SELECTION"]; bool hasInputGeom = false; if (!string.IsNullOrEmpty(GEOMETRY)) { hasInputGeom = true; } //selection ima prednost pred podano geometrijo ... MgWktReaderWriter wktrw = new MgWktReaderWriter(); if (!string.IsNullOrEmpty(inputSel)) { MgGeometry inputGeom = MultiGeometryFromSelection(featureSrvc, map, inputSel); GEOMETRY = wktrw.Write(inputGeom); } MgAgfReaderWriter agfRW = new MgAgfReaderWriter(); int nLayer = 0; // pobrišem in zgradim na novo samo tiste, ki imajo zadetke ... int nSloj = 0; string filter = ""; StringBuilder sbOut = new StringBuilder(); sbOut.Append("<table width=\"100%\" class=\"results\">"); sbOut.Append("<tr><td class='header'></td><td class='header'>" + "Layer" + "</td><td class='header' align=\"center\">" + "Select" + "</td><td class='header' align=\"center\">" + "Report" + "</td></tr>"); MgSelection selAll = new MgSelection(map); foreach (MgLayer layer in map.GetLayers()) { if (type != "2") { if (!layer.IsVisible()) { goto nextlay; } } if (layer.LegendLabel == "") { goto nextlay; } try { nLayer++; filter = String.Format("{0} {1} GeomFromText('{2}')", layer.GetFeatureGeometryName(), selVar, GEOMETRY); //preveriti še filter na Layerju. Ker ne gre drugače, je potrebno pogledati v XML MgResourceIdentifier layerDefResId = layer.GetLayerDefinition(); MgByteReader byteReader = resourceSrvc.GetResourceContent(layerDefResId); System.Xml.XmlDocument doc = new System.Xml.XmlDocument(); String xmlLayerDef = byteReader.ToString(); doc.LoadXml(xmlLayerDef); KALI.MGE.Objects.KALILayerDefinition.LayerDefinition ld = KALI.MGE.Objects.KALILayerDefinition.LayerDefinition.Parse(xmlLayerDef); if (!string.IsNullOrEmpty(ld.VectorLayerDefinition.Filter)) { filter += " AND (" + ld.VectorLayerDefinition.Filter + ")"; } //query the features MgFeatureQueryOptions opts = new MgFeatureQueryOptions(); opts.SetFilter(filter); String featureClassName = layer.GetFeatureClassName(); MgResourceIdentifier srcId = new MgResourceIdentifier(layer.GetFeatureSourceId()); MgFeatureReader features = featureSrvc.SelectFeatures(srcId, featureClassName, opts); bool hasResult = features.ReadNext(); if (hasResult) { nSloj++; int n = 0; MgClassDefinition classDef = features.GetClassDefinition(); MgPropertyDefinitionCollection classDefProps = classDef.GetIdentityProperties(); ArrayList idPropNames = new ArrayList(classDefProps.GetCount()); for (int j = 0; j < classDefProps.GetCount(); j++) { MgPropertyDefinition idProp = classDefProps.GetItem(j); idPropNames.Add(idProp.GetName()); } MgSelection sel = new MgSelection(map); do { // Generate XML to selection this feature MgPropertyCollection idProps = new MgPropertyCollection(); foreach (string id in idPropNames) { int idPropType = features.GetPropertyType(id); switch (idPropType) { case MgPropertyType.Int32: idProps.Add(new MgInt32Property(id, features.GetInt32(id))); break; case MgPropertyType.String: idProps.Add(new MgStringProperty(id, features.GetString(id))); break; case MgPropertyType.Int64: idProps.Add(new MgInt64Property(id, features.GetInt64(id))); break; case MgPropertyType.Double: idProps.Add(new MgDoubleProperty(id, features.GetDouble(id))); break; case MgPropertyType.Single: idProps.Add(new MgSingleProperty(id, features.GetSingle(id))); break; case MgPropertyType.DateTime: idProps.Add(new MgDateTimeProperty(id, features.GetDateTime(id))); break; default: //throw new SearchError(String.Format(MgLocalizer.GetString("SEARCHTYYPENOTSUP", locale), new Object[] { idPropType.ToString() }), searchError); break; } } sel.AddFeatureIds(layer, featureClassName, idProps); selAll.AddFeatureIds(layer, featureClassName, idProps); n++; //if (n > 1000) break; } while (features.ReadNext()); features.Close(); features.Dispose(); string selText = EscapeForHtml(sel.ToXml()); string seljs = "<div class=\"allLay\" onclick=\"parent.SetSelectionXML('" + selText + "');\"><img width=\"16\" height=\"16\" style=\"border:0\" src=\"images/mActionZoomToSelected.png\"/></div>"; string seljs3 = "<div class=\"allLay\" onclick=\"parent.MultiGridShow('" + selText + "');\"><img width=\"16\" height=\"16\" style=\"border:0\" src=\"images/mActionOpenTable.png\"/></div>"; string linfo = "<b>" + layer.LegendLabel + "</b><br />" + n.ToString() + " " + "Hits"; sbOut.Append("<tr><td class=\"results\">" + nSloj.ToString() + "</td><td class=\"results\">" + linfo + "</td><td align=\"center\" class=\"results\">" + seljs + "</td><td align=\"center\" class=\"results\">" + seljs3 + "</td></tr>"); } } catch (Exception) { continue; } nextlay: continue; } sbOut.Append("</table>"); string selAllText = EscapeForHtml(selAll.ToXml()); string seljsAll = "<div class=\"allLay\" onclick=\"parent.SetSelectionXML('" + selAllText + "');\"><img width=\"16\" height=\"16\" style=\"border:0\" src=\"images/mActionZoomToSelected.png\"/>" + "Select All" + "</div>"; string seljsAll3 = "<div class=\"allLay\" onclick=\"parent.MultiGridShow('" + selAllText + "');\"><img width=\"16\" height=\"16\" style=\"border:0\" src=\"images/mActionOpenTable.png\"/>" + "Report All" + "</div>"; sbOut.Append(string.Format("<br /><table width=\"100%\" class=\"results\"><tr><td class=\"results\">{0}</td><td class=\"results\">{1}</td></tr></table>", seljsAll, seljsAll3)); featureSrvc.Dispose(); resourceSrvc.Dispose(); if (nSloj > 0) { litPrebodi.Text = sbOut.ToString(); } else { litPrebodiTitle.Visible = false; litPrebodi.Text = "<b>" + "None layer lies below the selected item/area!" + "</b>"; } MgGeometry inGeom = wktrw.Read(GEOMETRY); double rw = map.ViewScale / Math.Sqrt(inGeom.Area); //koordinate if (hasInputGeom & rw > 400) { string output = ""; output = pointTransformAndWriteZ(GEOMETRY, map); litKoordinate.Text = output; litKoordinateTitle.Text = "Coordinates of selected points:"; } } }