public MapTemplateClass(int int_1, MapCartoTemplateLib.MapTemplateGallery mapTemplateGallery_1) { this.OID = int_1; this.MapTemplateGallery = mapTemplateGallery_1; if (int_1 == -1) { this.Guid = System.Guid.NewGuid().ToString(); } else { IRow row = null; row = this.MapTemplateGallery.MapTemplateClassTable.GetRow(this.OID); try { this.Guid = RowAssisant.GetFieldValue(row, "Guid").ToString(); } catch { } if (string.IsNullOrEmpty(this.Guid)) { this.Guid = System.Guid.NewGuid().ToString(); RowAssisant.SetFieldValue(row, "Guid", this.Guid); row.Store(); } } }
public static MapTemplateElement CreateMapTemplateElement(IPropertySet pPropertySet, MapCartoTemplateLib.MapTemplate pMapTemplate) { string typeName = Convert.ToString(pPropertySet.GetProperty("ElementType")); MapCartoTemplateLib.MapTemplateGallery mapTemplateGallery = pMapTemplate.MapTemplateGallery; Type type = Type.GetType(typeName); try { MapTemplateElement element = Activator.CreateInstance(type, new object[] { -1, pMapTemplate }) as MapTemplateElement; element.Load(pPropertySet); return(element); } catch (Exception) { } return(null); }
public static MapTemplateElement CreateMapTemplateElement(int id, MapCartoTemplateLib.MapTemplate pMapTemplate) { MapCartoTemplateLib.MapTemplateGallery mapTemplateGallery = pMapTemplate.MapTemplateGallery; IRow row = null; row = mapTemplateGallery.MapTemplateElementTable.GetRow(id); int index = row.Fields.FindField("ElementType"); Type type = Type.GetType(row.get_Value(index).ToString()); try { MapTemplateElement element = Activator.CreateInstance(type, new object[] { id, pMapTemplate }) as MapTemplateElement; element.Initlize(); return(element); } catch (Exception) { } return(null); }