private static bool ImportScheme(MapWinGIS.ShapefileColorScheme sch, MapWinGIS.Shapefile sf, XmlElement e) { string FldName; int i; MapWinGIS.ShapefileColorBreak brk; XmlNode n; bool foundField = false; if (e == null) { return(false); } FldName = e.Attributes["FieldName"].InnerText; for (i = 0; i < sf.NumFields; i++) { if (sf.Field[i].Name.ToLower() == FldName.ToLower()) { sch.FieldIndex = i; foundField = true; break; } } if (!foundField) { MapWinGIS.Utility.Logger.Message("无法找到 field \'" + FldName + "\' 无法导入coloring scheme."); return(false); } sch.Key = e.Attributes["Key"].InnerText; for (i = 0; i < e.ChildNodes.Count; i++) { n = e.ChildNodes[i]; brk = new MapWinGIS.ShapefileColorBreak(); brk.Caption = n.Attributes["Caption"].InnerText; brk.StartColor = ColorScheme.ColorToUInt(Color.FromArgb(System.Convert.ToInt32(n.Attributes["StartColor"].InnerText))); brk.EndColor = ColorScheme.ColorToUInt(Color.FromArgb(System.Convert.ToInt32(n.Attributes["EndColor"].InnerText))); brk.StartValue = n.Attributes["StartValue"].InnerText; brk.EndValue = n.Attributes["EndValue"].InnerText; sch.Add(brk); } return(true); }
protected void LaunchPopup(Dictionary <string, string> oContext) { TabName.ucCaption = RS.Resources.CodeMap_TabName; FldName.ucCaption = RS.Resources.CodeMap_FldName; Value.ucCaption = RS.Resources.CodeMap_Value; Description.ucCaption = RS.Resources.CodeMap_Description; Remark.ucCaption = RS.Resources.CodeMap_Remark; TabName.ucIsRequire = true; FldName.ucIsRequire = true; Value.ucIsRequire = true; Description.ucIsRequire = true; TabName.ucIsReadOnly = false; FldName.ucIsReadOnly = false; Value.ucIsReadOnly = false; TabName.ucTextData = ""; FldName.ucTextData = ""; Value.ucTextData = ""; Description.ucTextData = ""; Remark.ucTextData = ""; if (!string.IsNullOrEmpty(oContext["DataKeys"])) { DbHelper db = new DbHelper(_DBName); CommandHelper sb = db.CreateCommandHelper(); sb.Reset(); sb.AppendStatement(string.Format(_MainQrySQL, _TableName)); sb.Append(" And TabName = ").AppendParameter("TabName", oContext["DataKeys"].Split(',')[0]); sb.Append(" And FldName = ").AppendParameter("FldName", oContext["DataKeys"].Split(',')[1]); sb.Append(" And Value = ").AppendParameter("Value", oContext["DataKeys"].Split(',')[2]); DataRow dr = db.ExecuteDataSet(sb.BuildCommand()).Tables[0].Rows[0]; TabName.ucTextData = dr["TabName"].ToString(); FldName.ucTextData = dr["FldName"].ToString(); Value.ucTextData = dr["Value"].ToString(); Description.ucTextData = dr["Description"].ToString(); Remark.ucTextData = dr["Remark"].ToString(); TabName.ucIsReadOnly = (oContext["Mode"] != "Copy") ? true : false; FldName.ucIsReadOnly = (oContext["Mode"] != "Copy") ? true : false; Value.ucIsReadOnly = (oContext["Mode"] != "Copy") ? true : false; if (!string.IsNullOrEmpty(_TabName)) { TabName.ucTextData = _TabName; TabName.ucIsReadOnly = true; } if (!string.IsNullOrEmpty(_FldName)) { FldName.ucTextData = _FldName; FldName.ucIsReadOnly = true; } } else { if (!string.IsNullOrEmpty(_TabName)) { TabName.ucTextData = _TabName; TabName.ucIsReadOnly = true; } if (!string.IsNullOrEmpty(_FldName)) { FldName.ucTextData = _FldName; FldName.ucIsReadOnly = true; } } TabName.Refresh(); FldName.Refresh(); Value.Refresh(); ucModalPopup1.Reset(); ucModalPopup1.ucPopupWidth = 580; ucModalPopup1.ucPopupHeight = 320; ucModalPopup1.ucContextData = Util.getJSON(oContext); ucModalPopup1.ucPanelID = pnlEdit.ID; ucModalPopup1.Show(); }