public virtual bool ReadRawData( DGObjects objs, string tableNameSQL, string orderSQL, string conditionSQL) { objs.rawDataSet = Globals.iS3Service.DataService.Query(tableNameSQL, orderSQL, conditionSQL); // Add a field 'IsSelected' to the first DataTable, so we can // set and track the selection state of each row if (objs.rawDataSet.Tables != null && objs.rawDataSet.Tables.Count > 0) { DataTable dt = objs.rawDataSet.Tables[0]; DataColumn column = null; if (dt.Columns.Contains("IsSelected")) { column = dt.Columns["IsSelected"]; } else { column = dt.Columns.Add("IsSelected", typeof(bool)); } foreach (DataRow row in dt.Rows) { row.SetField(column, false); } } return(true); }
public void ReloadAll(string conditionSQL = null) { if (Globals.project == null) { return; } Domain domainMon = Globals.project.getDomain(DomainType.Monitoring); if (domainMon == null) { return; } DbContext dbContext = Globals.project.getDbContext(); foreach (var def in domainMon.objsDefinitions.Values) { if (def.Type == "MonPoint") { DGObjects objs = domainMon.objsContainer[def.Name]; Globals.mainframe.output("\nLoading " + objs.definition.Name + "..."); ReloadObjs(objs, dbContext, conditionSQL); } } Globals.mainframe.output("\nDone.\n"); Globals.mainframe.output(""); }
//资源树左击事件 private void DomainTreeView_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { try { //获取点击树节点绑定的TreeDefinition TreeDefinition treeDefinition = DomainTreeView.SelectedItem as TreeDefinition; if (treeDefinition == null) { return; } //获取点击对象的DGObjects实例 DGObjects refObjs = Globals.project.getDomain(treeDefinition.Domain).GetDGObjects(treeDefinition.RefObjID); if (refObjs == null) { return; } //根据点击的树,添加对应的Filter(临时) refObjs.definition.Filter = treeDefinition.Filter; //传递对象组选择事件到上一级 if (DGObjectsSelectionChangedHandler != null) { DGObjectsSelectionChangedHandler(this, new DGObjectsSelectionChangedEvent() { newObjs = refObjs, }); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
void _ReadWaterProperties( DGObjects objs, string tableNameSQL, string conditionSQL, string orderSQL) { ReadRawData(objs, tableNameSQL, orderSQL, conditionSQL); DataTable table = objs.rawDataSet.Tables[0]; foreach (DataRow reader in table.Rows) { if (IsDbNull(reader, "ID")) continue; WaterProperty wp = new WaterProperty(reader); wp.ID = ReadInt(reader, "ID").Value; wp.BoreholeName = ReadString(reader, "BoreholeName"); wp.Cl = ReadDouble(reader, "Cl"); wp.SO4 = ReadDouble(reader, "SO4"); wp.Mg = ReadDouble(reader, "Mg"); wp.NH = ReadDouble(reader, "NH"); wp.pH = ReadDouble(reader, "pH"); wp.CO2 = ReadDouble(reader, "CO2"); wp.Corrosion = ReadString(reader, "Corrosion"); objs[wp.key] = wp; } }
public override bool LoadObjs(DGObjects objs) { GeologyDGObjectLoader loader2 = new GeologyDGObjectLoader(); bool success = loader2.LoadSoilProperties(objs); return(success); }
private decimal getvalue7() { string domain = "Construction"; string objType_name = "SCHE"; DGObjects objs = Globals.project.objsDefIndex[objType_name]; Type objType = iS3Property.GetType(domain, objType_name); MethodInfo mi = typeof(iS3Property).GetMethod("GetProperty").MakeGenericMethod(objType); Pile ageo_mileage; foreach (DGObject ageo in objs.objContainer) { List <PropertyDef> _propertyDefs = mi.Invoke(new iS3Property(), new object[] { ageo }) as List <PropertyDef>; string st1, st2; st1 = _propertyDefs.Find(s => s.key.Equals("PROG_CCJD")).value; st2 = _propertyDefs.Find(s => s.key.Equals("PROG_ECJD")).value; if ((st1 == null) || (st2 == null)) { continue; } ageo_mileage = DrawObjects.getSectionPos(st1); decimal v1 = ageo_mileage.pilepoint; ageo_mileage = DrawObjects.getSectionPos(st2); decimal v2 = ageo_mileage.pilepoint; if (Math.Abs(v1 - v2) > 120) { return(2); } } return(0); }
void _ReadSecondlining( DGObjects objs, string tableNameSQL, string conditionSQL, string orderSQL) { ReadRawData(objs, tableNameSQL, orderSQL, conditionSQL); DataTable table = objs.rawDataSet.Tables[0]; foreach (DataRow row in table.Rows) { if (IsDbNull(row, "ID")) { continue; } Secondlining sl = new Secondlining(row); sl.id = ReadInt(row, "ID").Value; sl.name = ReadString(row, "ID"); //sl.name = ReadString(row, "name"); //sl.fullName = ReadString(row, "FullName"); //sl.description = ReadString(row, "Description"); //sl.shape = ReadShape(row); //sl.concretetype = ReadString(row, "二衬混凝土型号"); //sl.thickness = ReadDouble(row, "二衬厚度").Value; //sl.radius_roof = ReadDouble(row, "拱顶内轮廓半径").Value; //sl.radius_foot = ReadDouble(row, "拱脚内轮廓半径").Value; //sl.radius_invert = ReadDouble(row, "仰拱内轮廓半径").Value; //sl.length = ReadDouble(row, "二衬长度").Value; objs[sl.key] = sl; } }
// Summary: // Project loaded call back function // Remarks: // When project data is loaded, the relationship between MonGroup // and MonPoint need to be established. void mainframe_projectLoaded(object sender, EventArgs e) { if (Globals.project == null) { return; } Domain domainMon = Globals.project.getDomain(DomainType.Monitoring); if (domainMon == null) { return; } foreach (var def in domainMon.objsDefinitions.Values) { if (def.Type == "MonGroup") { DGObjects objs = domainMon.objsContainer[def.Name]; foreach (var obj in objs.values) { MonGroup group = obj as MonGroup; if (group == null) { continue; } resumeGroup2PointRelationship(group, domainMon); } } } }
public override bool LoadObjs(DGObjects objs) { GeologyDGObjectLoader loader2 = new GeologyDGObjectLoader(); bool success = loader2.LoadStratumSections(objs); return(success); }
void _ReadRiverWaters( DGObjects objs, string tableNameSQL, string conditionSQL, string orderSQL) { ReadRawData(objs, tableNameSQL, orderSQL, conditionSQL); DataTable table = objs.rawDataSet.Tables[0]; foreach (DataRow reader in table.Rows) { if (IsDbNull(reader, "ID")) continue; RiverWater rw = new RiverWater(reader); rw.ID = ReadInt(reader, "ID").Value; rw.ObservationLocation = ReadString(reader, "ObservationLocation"); rw.HighestTidalLevel = ReadDouble(reader, "HighestTidalLevel"); rw.HighestTidalLevelDate = ReadDateTime(reader, "HighestTidalLevelDate"); rw.LowestTidalLevel = ReadDouble(reader, "LowestTidalLevel"); rw.LowestTidalLevelDate = ReadDateTime(reader, "LowestTidalLevelDate"); rw.AvHighTidalLevel = ReadDouble(reader, "AvHighTidalLevel"); rw.AvLowTidalLevel = ReadDouble(reader, "AvLowTidalLevel"); rw.AvTidalRange = ReadDouble(reader, "AvTidalRange"); rw.DurationOfRise = ReadTimeSpan(reader, "DurationOfRise").ToString(); rw.DurationOfFall = ReadTimeSpan(reader, "DurationOfFall").ToString(); objs[rw.key] = rw; } }
// Read boreholes // public bool ReadBoreholes(DGObjects objs, string tableNameSQL, List<int> objsIDs) { string conditionSQL = WhereSQL(objsIDs); return ReadBoreholes(objs, tableNameSQL, conditionSQL, null); }
void _ReadStrata( DGObjects objs, string tableNameSQL, string conditionSQL, string orderSQL) { ReadRawData(objs, tableNameSQL, orderSQL, conditionSQL); DataTable table = objs.rawDataSet.Tables[0]; foreach (DataRow row in table.Rows) { if (IsDbNull(row, "ID")) continue; Stratum st = new Stratum(row); st.Name = ReadString(row, "Name"); st.FullName = ReadString(row, "FullName"); st.Description = ReadString(row, "Description"); st.ID = ReadInt(row, "ID").Value; st.GeologyAge = ReadString(row, "GeologicalAge"); st.FormationType = ReadString(row, "FormationType"); st.Compaction = ReadString(row, "Compaction"); st.ElevationRange = ReadString(row, "ElevationOfStratumBottom"); st.ThicknessRange = ReadString(row, "Thickness"); st.shape = ReadShape(row); objs[st.key] = st; } }
public override bool LoadObjs(DGObjects objs) { NATMstrctureDGObjectLoader loader = new NATMstrctureDGObjectLoader(); bool success = loader.LoadSecondlining(objs); return(success); }
public override bool LoadObjs(DGObjects objs) { GeologyDGObjectLoader loader2 = new GeologyDGObjectLoader(); bool success = loader2.LoadRiverWaters(objs); return(success); }
// Summary: // Read monitoring points public bool ReadMonPoints(DGObjects objs, string tableNameSQL, List <int> objsIDs) { string conditionSQL = WhereSQL(objsIDs); return(ReadMonPoints(objs, tableNameSQL, conditionSQL, null)); }
void _ReadMonGroups(DGObjects objs, string tableNameSQL, string conditionSQL, string orderSQL) { DataTable table = objs.rawDataSet.Tables[0]; foreach (DataRow row in table.Rows) { if (IsDbNull(row, "ID") || IsDbNull(row, "Name")) { continue; } MonGroup obj = new MonGroup(row); obj.id = ReadInt(row, "ID").Value; obj.name = ReadString(row, "Name"); obj.fullName = ReadString(row, "FullName"); obj.description = ReadString(row, "Description"); obj.shape = ReadShape(row); obj.groupShape = ReadString(row, "groupShape"); string str = ReadString(row, "monPntNames"); if (str != null) { obj.monPntNames = str.Split(_separator); } objs[obj.key] = obj; } }
private decimal getvalue8() { string domain = "Construction"; string objType_name = "SKTH"; DGObjects objs = Globals.project.objsDefIndex[objType_name]; Type objType = iS3Property.GetType(domain, objType_name); MethodInfo mi = typeof(iS3Property).GetMethod("GetProperty").MakeGenericMethod(objType); foreach (DGObject ageo in objs.objContainer) { List <PropertyDef> _propertyDefs = mi.Invoke(new iS3Property(), new object[] { ageo }) as List <PropertyDef>; string t1 = _propertyDefs.Find(s => s.key.Equals("SKTH_CHAI")).value; Pile ageo_mileage; if ((t1 == null) || (t1 == "")) { continue; } ageo_mileage = DrawObjects.getSectionPos(t1); bool pos_flag = false; if (ageo_mileage.piletype == Piletype.point) { if ((risk_position >= ageo_mileage.pilepoint - 40) && (risk_position <= ageo_mileage.pilepoint + 40)) { pos_flag = true; } } else { if ((risk_position >= ageo_mileage.startpile) && (risk_position <= ageo_mileage.endpile)) { pos_flag = true; } } if (pos_flag == true) { string st1; st1 = _propertyDefs.Find(s => s.key.Equals("SKTH_WATG")).value; if (st1 == null) { continue; } if (st1.Contains("淋雨状")) { return(3); } else { if (st1.Contains("大股")) { return(5); } } } } return(0); }
void _ReadConfinedWaters( DGObjects objs, string tableNameSQL, string conditionSQL, string orderSQL) { ReadRawData(objs, tableNameSQL, orderSQL, conditionSQL); DataTable table = objs.rawDataSet.Tables[0]; foreach (DataRow reader in table.Rows) { if (IsDbNull(reader, "ID")) continue; ConfinedWater cw = new ConfinedWater(reader); cw.ID = ReadInt(reader, "ID").Value; cw.BoreholeName = ReadString(reader, "BoreholeName"); cw.SiteName = ReadString(reader, "SiteName"); cw.TopElevation = ReadDouble(reader, "TopElevation"); cw.ObservationDepth = ReadDouble(reader, "ObservationDepth"); cw.StratumName = ReadString(reader, "StatumName"); cw.Layer = ReadInt(reader, "Layer"); cw.WaterTable = ReadDouble(reader, "WaterTable"); cw.ObservationDate = ReadDateTime(reader, "ObservationDate"); objs[cw.key] = cw; } }
public override bool LoadObjs(DGObjects objs, DbContext dbContext) { GeologyDGObjectLoader loader = new GeologyDGObjectLoader(dbContext); bool success = loader.LoadBoreholes(objs); return(success); }
void _ReadBoreholes( DGObjects objs, string tableNameSQL, string conditionSQL, string orderSQL) { ReadRawData(objs, tableNameSQL, orderSQL, conditionSQL); DataTable table = objs.rawDataSet.Tables[0]; foreach (DataRow row in table.Rows) { if (IsDbNull(row, "ID")) continue; Borehole bh = new Borehole(row); bh.ID = ReadInt(row, "ID").Value; bh.Name = ReadString(row, "Name"); bh.FullName = ReadString(row, "FullName"); bh.Description = ReadString(row, "Description"); bh.shape = ReadShape(row); bh.Type = ReadString(row, "BoreholeType"); bh.Top = ReadDouble(row, "TopElevation").Value; bh.Base = bh.Top - ReadDouble(row, "BoreholeLength").Value; bh.Mileage = ReadDouble(row, "Mileage"); objs[bh.key] = bh; } }
public override bool LoadObjs(DGObjects objs, DbContext dbContext) { GeologyDGObjectLoader loader2 = new GeologyDGObjectLoader(dbContext); bool success = loader2.LoadStrata(objs); return(success); }
// Summary: // Object selection event listener (function). // It will broadcast the event to views and datagrid. public async void objSelectionChangedListener(object sender, ObjSelectionChangedEventArgs e) { // get detail information of obj from server // Dictionary <string, IEnumerable <DGObject> > detailDict = new Dictionary <string, IEnumerable <DGObject> >(); if (e.addedObjs != null) { foreach (string key in e.addedObjs.Keys) { List <DGObject> tempList = new List <DGObject>(); IEnumerable <DGObject> objs = e.addedObjs[key]; List <DGObject> objlist = objs.ToList(); DGObjects dGObjects = Globals.project.objsDefIndex[key]; List <DGObject> detailObjList = new List <DGObject>(); foreach (DGObject _obj in objlist) { DGObject obj = await _obj.parent.QueryObjByID(_obj.ID); tempList.Add(obj); } detailDict[key] = tempList.AsEnumerable(); } } e.addedObjs = detailDict; // Distribution the objselectionchanged events // if (objSelectionChangedTrigger != null) { objSelectionChangedTrigger(sender, e); } }
public virtual bool ReadDGObjects(DGObjects objs, string tableNameSQL, List <int> IDs) { string condition = WhereSQL(IDs); return(ReadDGObjects(objs, tableNameSQL, null, null, condition)); }
public void Func(string Params) { //获取数据 Project _prj = Globals.project; Domain _constructionDoamin2 = _prj.getDomain("Construction"); DGObjects _tfsiDGObjects2 = _constructionDoamin2.DGObjectsList.Where(x => x.definition.Type == "TFSI").FirstOrDefault(); //通知对象组改变事件 Globals.mainFrame.DGObjectsSelectionChangedListener(this, new DGObjectsSelectionChangedEvent() { newObjs = _tfsiDGObjects2 }); //二维视图改变 IMainFrame mainFrame = Globals.mainFrame; //获取要添加图元的视图view IView2D _inputView = (mainFrame.views.Where(x => x.name == "右幅剖面图").FirstOrDefault()) as IView2D; List <string> dynamiclayerlist = new List <string>() { "TFSI" }; _inputView.Opendynamiclayers(dynamiclayerlist, "地质剖面"); iS3Legned legeng_SPZL = new iS3Legned() { legndTitle = "地质预报图例", iS3SymbolList = new List <iS3Symbol>() { new iS3Symbol() { colorName = "Green", label = "地质预报", symbolType = SymbolType.Rectangle } } }; _inputView.holder.setlegend(legeng_SPZL); _inputView.holder.setLegendShow(true); _inputView = (mainFrame.views.Where(x => x.name == "左幅剖面图").FirstOrDefault()) as IView2D; dynamiclayerlist = new List <string>() { "TFSI" }; _inputView.Opendynamiclayers(dynamiclayerlist, "地质剖面"); legeng_SPZL = new iS3Legned() { legndTitle = "地质预报图例", iS3SymbolList = new List <iS3Symbol>() { new iS3Symbol() { colorName = "Green", label = "地质预报", symbolType = SymbolType.Rectangle } } }; _inputView.holder.setlegend(legeng_SPZL); _inputView.holder.setLegendShow(true); }
private void ViewHolder_SelectionChanged(object sender, RadSelectionChangedEventArgs e) { if (((sender as RadPaneGroup).SelectedItem as RadDocumentPane) == null) { return; } if (((sender as RadPaneGroup).SelectedItem as RadDocumentPane).Name == "Map3D") { if ((temp2 != null) && (my3dView != null)) { if (!map3DState) { temp.Child = null; temp2.Content = my3dView; map3DState = true; } } } else { if ((temp != null) && (my3dView != null)) { if (map3DState) { temp2.Content = null; temp.Child = my3dView; map3DState = false; } } } if (((sender as RadPaneGroup).SelectedItem as RadDocumentPane).Name == "右幅剖面图") { Domain _constructionDoamin2 = _prj.getDomain("Construction"); DGObjects _gprfDGObjects2 = _constructionDoamin2.DGObjectsList.Where(x => x.definition.Type == "ACHE").FirstOrDefault(); if (_lastDGObjects == null) { _lastDGObjects = _gprfDGObjects2; } ComonObjsViewHolder.viewholderindex = 0; DGObjectsSelectionChangedListener(this, new DGObjectsSelectionChangedEvent() { newObjs = _lastDGObjects }); } if (((sender as RadPaneGroup).SelectedItem as RadDocumentPane).Name == "左幅剖面图") { Domain _constructionDoamin2 = _prj.getDomain("Construction"); DGObjects _gprfDGObjects2 = _constructionDoamin2.DGObjectsList.Where(x => x.definition.Type == "ACHE").FirstOrDefault(); if (_lastDGObjects == null) { _lastDGObjects = _gprfDGObjects2; } ComonObjsViewHolder.viewholderindex = 1; DGObjectsSelectionChangedListener(this, new DGObjectsSelectionChangedEvent() { newObjs = _lastDGObjects }); } }
public override bool LoadObjs(DGObjects objs) { MonitoringDGObjectLoader loader = new MonitoringDGObjectLoader(); bool success = loader.LoadMonGroups(objs); return(success); }
public override bool LoadObjs(DGObjects objs, DbContext dbContext) { MonitoringDGObjectLoader loader = new MonitoringDGObjectLoader(dbContext); bool success = loader.LoadMonPoints(objs); return(success); }
public override bool LoadObjs(DGObjects objs) { StructureDGObjectLoader loader = new StructureDGObjectLoader(); bool success = loader.LoadPillar(objs); return(success); }
void _ReadSoilProperties( DGObjects objs, string tableNameSQL, string conditionSQL, string orderSQL) { ReadRawData(objs, tableNameSQL, orderSQL, conditionSQL); DataTable table = objs.rawDataSet.Tables[0]; foreach (DataRow reader in table.Rows) { if (IsDbNull(reader, "ID")) continue; SoilProperty soilProp = new SoilProperty(reader); soilProp.ID = ReadInt(reader, "ID").Value; soilProp.Name = ReadString(reader, "Name"); soilProp.StratumID = ReadInt(reader, "StratumID").Value; soilProp.StratumSectionID = ReadInt(reader, "StratumSectionID"); soilProp.StaticProp.w = ReadDouble(reader, "w"); soilProp.StaticProp.gama = ReadDouble(reader, "gama"); soilProp.StaticProp.c = ReadDouble(reader, "c"); soilProp.StaticProp.fai = ReadDouble(reader, "fai"); soilProp.StaticProp.cuu = ReadDouble(reader, "cuu"); soilProp.StaticProp.faiuu = ReadDouble(reader, "faiuu"); soilProp.StaticProp.Cs = ReadDouble(reader, "Cs"); soilProp.StaticProp.qu = ReadDouble(reader, "qu"); soilProp.StaticProp.K0 = ReadDouble(reader, "K0"); soilProp.StaticProp.Kv = ReadDouble(reader, "Kv"); soilProp.StaticProp.Kh = ReadDouble(reader, "Kh"); soilProp.StaticProp.e = ReadDouble(reader, "e"); soilProp.StaticProp.av = ReadDouble(reader, "av"); soilProp.StaticProp.Cu = ReadDouble(reader, "Cu"); soilProp.StaticProp.G = ReadDouble(reader, "G"); soilProp.StaticProp.Sr = ReadDouble(reader, "Sr"); soilProp.StaticProp.ccq = ReadDouble(reader, "ccq"); soilProp.StaticProp.faicq = ReadDouble(reader, "faicq"); soilProp.StaticProp.c_s = ReadDouble(reader, "c_s"); soilProp.StaticProp.fais = ReadDouble(reader, "fais"); soilProp.StaticProp.a01_02 = ReadDouble(reader, "a01_02"); soilProp.StaticProp.Es01_02 = ReadDouble(reader, "Es01_02"); soilProp.StaticProp.ccu = ReadDouble(reader, "ccu"); soilProp.StaticProp.faicu = ReadDouble(reader, "faicu"); soilProp.StaticProp.cprime = ReadDouble(reader, "cprime"); soilProp.StaticProp.faiprime = ReadDouble(reader, "faiprime"); soilProp.StaticProp.E015_0025 = ReadDouble(reader, "E015_0025"); soilProp.StaticProp.E02_0025 = ReadDouble(reader, "E02_0025"); soilProp.StaticProp.E04_0025 = ReadDouble(reader, "E04_0025"); SoilDynamicProperty dynamicProp = new SoilDynamicProperty(); soilProp.DynamicProp.G0 = ReadDouble(reader, "G0"); soilProp.DynamicProp.ar = ReadDouble(reader, "ar"); soilProp.DynamicProp.br = ReadDouble(reader, "br"); objs[soilProp.key] = soilProp; } }
void _ReadMonReadings(DGObjects objs) { if (objs.rawDataSet.Tables.Count <= 1) { return; } DataTable dt = objs.rawDataSet.Tables[1]; foreach (DataRow row in dt.Rows) { if (IsDbNull(row, "monPointName") || IsDbNull(row, "time")) { continue; } // if both the reading and the value are null, skip it if (IsDbNull(row, "reading") && IsDbNull(row, "value")) { continue; } MonReading reading = new MonReading(); reading.monPointName = ReadString(row, "monPointName"); reading.time = ReadDateTime(row, "time").Value; reading.component = ReadString(row, "component"); reading.reading = ReadString(row, "reading"); reading.unit = ReadString(row, "unit"); double?value = ReadDouble(row, "value"); if (value == null) { try { reading.value = Double.Parse(reading.reading); } catch (Exception) { // do nothing } } else { reading.value = value.Value; } MonPoint monPnt; if (objs.containsKey(reading.monPointName)) { monPnt = objs[reading.monPointName] as MonPoint; } else { continue; } _AddReading(monPnt, reading); } }
public bool Load(DGObjects objs) { DGObjectsDefinition def = objs.definition; if (def == null) return false; bool success = _dbLoader.ReadDGObjects(objs, def.TableNameSQL, def.DefNamesSQL, def.OrderSQL, def.ConditionSQL); return success; }