private async Task <(DataFrame?, Graphic[]?)> loadDataAsync() { DataFrame?data = await QueryDbAsync(OilGasQueries.WellsData); Graphic[]? dataJson = null; if (data != null) { List <Graphic> rows = new List <Graphic>((int)data.Rows.Count); AttributeProperties attributeProperties; for (int i = 0; i < data.Rows.Count; ++i) { attributeProperties = new AttributeProperties(); attributeProperties.AddProperty("ObjectId", i + 1); attributeProperties.AddProperty("Api", data.Rows[i][0].StringValue()); attributeProperties.AddProperty("ReservoirName", data.Rows[i][1].StringValue()); attributeProperties.AddProperty("ReservoirDepth", data.Rows[i][2].DoubleValue() ?? 0.0); attributeProperties.AddProperty("GasSpecificGravity", data.Rows[i][3].DoubleValue() ?? 0.0); attributeProperties.AddProperty("OilApiGravity", data.Rows[i][4].DoubleValue() ?? 0.0); attributeProperties.AddProperty("SurfaceEasting", data.Rows[i][5].DoubleValue() ?? 0.0); attributeProperties.AddProperty("SurfaceNorthing", data.Rows[i][6].DoubleValue() ?? 0.0); attributeProperties.AddProperty("BottomEasting", data.Rows[i][7].DoubleValue() ?? 0.0); attributeProperties.AddProperty("BottomNorthing", data.Rows[i][8].DoubleValue() ?? 0.0); rows.Add(new Graphic { Geometry = new Geometry { Type = "point", X = data.Rows[i][5].DoubleValue() ?? 0.0, Y = data.Rows[i][6].DoubleValue() ?? 0.0 }, Attributes = attributeProperties }); } dataJson = rows.ToArray(); //locationsJson = "[" + string.Join(", ", rows) + "]"; //ArcGisService.StoreDataAsync("WellLocations", source); } //Sequence.LinearSpacing //DataFrame? data = await ArcGisService.QueryDbAsync(locationQuery); //if (locationsJson != null) //{ // jsInteropService.StoreSessionDataAsync("WellLocations", locationsJson).GetAwaiter().GetResult(); // Action? addFeaturesFromStorage = jsInteropService.BuildJsAction("window.addFeaturesFromStorage"); // addFeaturesFromStorage?.Invoke(); //} return(data, dataJson); }
public override void WriteStartAttribute(string prefix, string localName, string ns) { if (ns.Length == 0) { if (base.attrEndPos == base.bufPos) { base.bufBytes[base.bufPos++] = 0x20; } base.RawText(localName); if ((this.currentElementProperties & (ElementProperties.BOOL_PARENT | ElementProperties.NAME_PARENT | ElementProperties.URI_PARENT)) != ElementProperties.DEFAULT) { this.currentAttributeProperties = ((AttributeProperties)attributePropertySearch.FindCaseInsensitiveString(localName)) & ((AttributeProperties)this.currentElementProperties); if ((this.currentAttributeProperties & AttributeProperties.BOOLEAN) != AttributeProperties.DEFAULT) { base.inAttributeValue = true; return; } } else { this.currentAttributeProperties = AttributeProperties.DEFAULT; } base.bufBytes[base.bufPos++] = 0x3d; base.bufBytes[base.bufPos++] = 0x22; } else { base.WriteStartAttribute(prefix, localName, ns); this.currentAttributeProperties = AttributeProperties.DEFAULT; } base.inAttributeValue = true; }
// ---------------- Functions ---------------- public int AddAssetType(AssetTypeBuilder builder) { ArgumentChecker.IsNotNull(builder, nameof(builder)); builder.Validate(); Guid databaseId = builder.DatabaseId; this.GuidCheck(databaseId); using (DatabaseConnection conn = new DatabaseConnection(this.databaseConfigs[databaseId])) { DateTime timestamp = DateTime.UtcNow; AssetType assetType = new AssetType { Name = builder.Name, CreationDate = timestamp, ModifiedDate = timestamp }; conn.AssetTypes.Add(assetType); foreach (IAttributeType key in builder.AttributeTypes) { AttributeKeys attributeKey = new AttributeKeys { Name = key.Key, AttributeType = key.AttributeType }; conn.AttributeKeys.Add(attributeKey); AttributeProperties properties = new AttributeProperties { DefaultValue = key.SerializeDefaultValue(), PossibleValues = key.SerializePossibleValues(), Required = key.Required }; conn.AttributeProperties.Add(properties); AssetTypeAttributesMap map = new AssetTypeAttributesMap { AssetType = assetType, AttributeKey = attributeKey, AttributeProperties = properties }; conn.AssetTypeAttributesMaps.Add(map); } conn.SaveChanges(); return(assetType.Id); // Must come after SaveChanges() so the ID gets updated. } }
// 1. How the outputBooleanAttribute(fBOOL) and outputHtmlUriText(fURI) being set? // When SA is called. // // BOOL_PARENT URI_PARENT Others // fURI // URI att false true false // // fBOOL // BOOL att true false false // // How they change the attribute output behaviors? // // 1) fURI=true fURI=false // SA a=" a=" // AT HtmlURIText HtmlText // EA " " // // 2) fBOOL=true fBOOL=false // SA a a=" // AT HtmlText output nothing // EA output nothing " // // When they get reset? // At the end of attribute. // 2. How the outputXmlTextElementScoped(fENs) and outputXmlTextattributeScoped(fANs) are set? // fANs is in the scope of the fENs. // // SE(localName) SE(ns, pre, localName) SA(localName) SA(ns, pre, localName) // fENs false(default) true(action) // fANs false(default) false(default) false(default) true(action) // how they get reset? // // EE(localName) EE(ns, pre, localName) EENC(ns, pre, localName) EA(localName) EA(ns, pre, localName) // fENs false(action) // fANs false(action) // How they change the TextOutput? // // fENs | fANs Else // AT XmlText HtmlText // // // 3. Flags for processing &{ split situations // // When the flag is set? // // AT src[lastchar]='&' flag&{ = true; // // when it get result? // // AT method. // // How it changes the behaviors? // // flag&{=true // // AT if (src[0] == '{') { // output "&{" // } // else { // output & // } // // EA output amp; // // SA if (flagBOOL == false) { output =";} // // AT if (flagBOOL) { return}; // if (flagNS) {XmlText;} { // } // else if (flagURI) { // HtmlURIText; // } // else { // HtmlText; // } // // AT if (flagNS) {XmlText;} { // } // else if (flagURI) { // HtmlURIText; // } // else if (!flagBOOL) { // HtmlText; //flag&{ handling // } // // // EA if (flagBOOL == false) { output " // } // else if (flag&{) { // output amp; // } // public override void WriteStartAttribute(string prefix, string localName, string ns) { Debug.Assert(localName != null && localName.Length != 0 && prefix != null && ns != null); if (ns.Length == 0) { Debug.Assert(prefix.Length == 0); if (trackTextContent && inTextContent != false) { ChangeTextContentMark(false); } if (base.attrEndPos == bufPos) { base.bufChars[bufPos++] = (char)' '; } base.RawText(localName); if ((currentElementProperties & (ElementProperties.BOOL_PARENT | ElementProperties.URI_PARENT | ElementProperties.NAME_PARENT)) != 0) { _currentAttributeProperties = (AttributeProperties)attributePropertySearch.FindCaseInsensitiveString(localName) & (AttributeProperties)currentElementProperties; if ((_currentAttributeProperties & AttributeProperties.BOOLEAN) != 0) { base.inAttributeValue = true; return; } } else { _currentAttributeProperties = AttributeProperties.DEFAULT; } base.bufChars[bufPos++] = (char)'='; base.bufChars[bufPos++] = (char)'"'; } else { base.WriteStartAttribute(prefix, localName, ns); _currentAttributeProperties = AttributeProperties.DEFAULT; } base.inAttributeValue = true; }
public override void WriteStartAttribute(string prefix, string localName, string ns) { Debug.Assert(localName != null && localName.Length != 0 && prefix != null && ns != null); if (ns.Length == 0) { Debug.Assert(prefix.Length == 0); if (_trackTextContent && _inTextContent) { ChangeTextContentMark(false); } if (base._attrEndPos == _bufPos) { base._bufChars[_bufPos++] = (char)' '; } base.RawText(localName); if ((_currentElementProperties & (ElementProperties.BOOL_PARENT | ElementProperties.URI_PARENT | ElementProperties.NAME_PARENT)) != 0) { _currentAttributeProperties = TernaryTreeReadOnly.FindAttributeProperty(localName) & (AttributeProperties)_currentElementProperties; if ((_currentAttributeProperties & AttributeProperties.BOOLEAN) != 0) { base._inAttributeValue = true; return; } } else { _currentAttributeProperties = AttributeProperties.DEFAULT; } base._bufChars[_bufPos++] = (char)'='; base._bufChars[_bufPos++] = (char)'"'; } else { base.WriteStartAttribute(prefix, localName, ns); _currentAttributeProperties = AttributeProperties.DEFAULT; } base._inAttributeValue = true; }
public override void WriteStartAttribute(string prefix, string localName, string ns) { Debug.Assert(localName != null && localName.Length != 0 && prefix != null && ns != null); if (ns.Length == 0) { Debug.Assert(prefix.Length == 0); if (base._attrEndPos == _bufPos) { base._bufBytes[_bufPos++] = (byte)' '; } base.RawText(localName); if ((_currentElementProperties & (ElementProperties.BOOL_PARENT | ElementProperties.URI_PARENT | ElementProperties.NAME_PARENT)) != 0) { _currentAttributeProperties = (AttributeProperties)_attributePropertySearch.FindCaseInsensitiveString(localName) & (AttributeProperties)_currentElementProperties; if ((_currentAttributeProperties & AttributeProperties.BOOLEAN) != 0) { base._inAttributeValue = true; return; } } else { _currentAttributeProperties = AttributeProperties.DEFAULT; } base._bufBytes[_bufPos++] = (byte)'='; base._bufBytes[_bufPos++] = (byte)'"'; } else { base.WriteStartAttribute(prefix, localName, ns); _currentAttributeProperties = AttributeProperties.DEFAULT; } base._inAttributeValue = true; }
// 1. How the outputBooleanAttribute(fBOOL) and outputHtmlUriText(fURI) being set? // When SA is called. // // BOOL_PARENT URI_PARENT Others // fURI // URI att false true false // // fBOOL // BOOL att true false false // // How they change the attribute output behaviors? // // 1) fURI=true fURI=false // SA a=" a=" // AT HtmlURIText HtmlText // EA " " // // 2) fBOOL=true fBOOL=false // SA a a=" // AT HtmlText output nothing // EA output nothing " // // When they get reset? // At the end of attribute. // 2. How the outputXmlTextElementScoped(fENs) and outputXmlTextattributeScoped(fANs) are set? // fANs is in the scope of the fENs. // // SE(localName) SE(ns, pre, localName) SA(localName) SA(ns, pre, localName) // fENs false(default) true(action) // fANs false(default) false(default) false(default) true(action) // how they get reset? // // EE(localName) EE(ns, pre, localName) EENC(ns, pre, localName) EA(localName) EA(ns, pre, localName) // fENs false(action) // fANs false(action) // How they change the TextOutput? // // fENs | fANs Else // AT XmlText HtmlText // // // 3. Flags for processing &{ split situations // // When the flag is set? // // AT src[lastchar]='&' flag&{ = true; // // when it get result? // // AT method. // // How it changes the behaviors? // // flag&{=true // // AT if (src[0] == '{') { // output "&{" // } // else { // output & // } // // EA output amp; // // SA if (flagBOOL == false) { output =";} // // AT if (flagBOOL) { return}; // if (flagNS) {XmlText;} { // } // else if (flagURI) { // HtmlURIText; // } // else { // HtmlText; // } // // AT if (flagNS) {XmlText;} { // } // else if (flagURI) { // HtmlURIText; // } // else if (!flagBOOL) { // HtmlText; //flag&{ handling // } // // // EA if (flagBOOL == false) { output " // } // else if (flag&{) { // output amp; // } // public override void WriteStartAttribute(string prefix, string localName, string ns) { Debug.Assert(localName != null && localName.Length != 0 && prefix != null && ns != null); if (ns.Length == 0) { Debug.Assert(prefix.Length == 0); if (base.attrEndPos == bufPos) { base.bufBytes[bufPos++] = (byte)' '; } base.RawText(localName); if ((currentElementProperties & (ElementProperties.BOOL_PARENT | ElementProperties.URI_PARENT | ElementProperties.NAME_PARENT)) != 0) { _currentAttributeProperties = (AttributeProperties)attributePropertySearch.FindCaseInsensitiveString(localName) & (AttributeProperties)currentElementProperties; if ((_currentAttributeProperties & AttributeProperties.BOOLEAN) != 0) { base.inAttributeValue = true; return; } } else { _currentAttributeProperties = AttributeProperties.DEFAULT; } base.bufBytes[bufPos++] = (byte)'='; base.bufBytes[bufPos++] = (byte)'"'; } else { base.WriteStartAttribute(prefix, localName, ns); _currentAttributeProperties = AttributeProperties.DEFAULT; } base.inAttributeValue = true; }
private async Task <(DataFrame?, Graphic[]?)> loadLocationsAsync() { //DataFrame? locations = QueryDb(OilGasQueries.WellsKarnesLocations); DataFrame?locations = await QueryDbAsync(OilGasQueries.AllWellsLocations); Graphic[]? locationsJson = null; if (locations != null) { List <Graphic> rows = new List <Graphic>((int)locations.Rows.Count); AttributeProperties attributeProperties; for (int i = 0; i < locations.Rows.Count; ++i) { attributeProperties = new AttributeProperties(); attributeProperties.AddProperty("ObjectId", i + 1); attributeProperties.AddProperty("Api", locations.Rows[i][0].StringValue()); rows.Add(new Graphic { Geometry = new Geometry { Type = "polyline", Paths = new List <List <double> > { new List <double> { locations.Rows[i][1].DoubleValue() ?? 0.0, locations.Rows[i][2].DoubleValue() ?? 0.0 }, new List <double> { locations.Rows[i][3].DoubleValue() ?? 0.0, locations.Rows[i][4].DoubleValue() ?? 0.0 } } }, Attributes = attributeProperties }); } locationsJson = rows.ToArray(); //locationsJson = "[" + string.Join(", ", rows) + "]"; //ArcGisService.StoreDataAsync("WellLocations", source); } //Sequence.LinearSpacing //DataFrame? locations = await ArcGisService.QueryDbAsync(locationQuery); //if (locationsJson != null) //{ // jsInteropService.StoreSessionDataAsync("WellLocations", locationsJson).GetAwaiter().GetResult(); // Action? addFeaturesFromStorage = jsInteropService.BuildJsAction("window.addFeaturesFromStorage"); // addFeaturesFromStorage?.Invoke(); //} return(locations, locationsJson); }
private void Reset() { AttributeName = string.Empty; AttributeProperties.Clear(); }
protected void ValueEntered(ChangeEventArgs e) { AttributeProperties.Add(e.Value as string); }
private void CreateAttribute() { (Owner as DynamicObject).Attributes.Add(new KeyValuePair <Type, object[]>(AttributeType, AttributeProperties.ToArray())); }
public override void WriteStartAttribute(string prefix, string localName, string ns) { if (ns.Length == 0) { if (base.attrEndPos == base.bufPos) { base.bufBytes[base.bufPos++] = 0x20; } base.RawText(localName); if ((this.currentElementProperties & (ElementProperties.BOOL_PARENT | ElementProperties.NAME_PARENT | ElementProperties.URI_PARENT)) != ElementProperties.DEFAULT) { this.currentAttributeProperties = ((AttributeProperties) attributePropertySearch.FindCaseInsensitiveString(localName)) & ((AttributeProperties) this.currentElementProperties); if ((this.currentAttributeProperties & AttributeProperties.BOOLEAN) != AttributeProperties.DEFAULT) { base.inAttributeValue = true; return; } } else { this.currentAttributeProperties = AttributeProperties.DEFAULT; } base.bufBytes[base.bufPos++] = 0x3d; base.bufBytes[base.bufPos++] = 0x22; } else { base.WriteStartAttribute(prefix, localName, ns); this.currentAttributeProperties = AttributeProperties.DEFAULT; } base.inAttributeValue = true; }