// // Qualifiable // public void DisplayOrEditEntityQualifierCollection(AnyUiStackPanel stack, AdminShell.QualifierCollection qualifiers, Action <AdminShell.QualifierCollection> setOutput, AdminShell.Referable relatedReferable = null) { // access if (stack == null) { return; } // members this.AddGroup(stack, "Qualifiable:", levelColors.SubSection); if (this.SafeguardAccess( stack, repo, qualifiers, "Qualifiers:", "Create empty list of Qualifiers!", v => { setOutput?.Invoke(new AdminShell.QualifierCollection()); this.AddDiaryEntry(relatedReferable, new DiaryEntryStructChange()); return(new AnyUiLambdaActionRedrawEntity()); })) { this.QualifierHelper(stack, repo, qualifiers, relatedReferable: relatedReferable); } }
public XmiHandle AddClass(AdminShell.Referable rf) { // the Referable shall enumerate children (if not, then its not a class) if (!(rf is AdminShell.IEnumerateChildren rfec)) { return(null); } var features = rfec.EnumerateChildren().ToList(); // add var classId = RegisterObject(rf); var classContainer = CreateAppendElement(Package, "packagedElement", new[] { "xmi:type", "uml:Class", "xmi:id", classId, "name", "" + rf.idShort, "visibility", "public" }); AddFeatures(classContainer, features); return(new XmiHandle() { Id = classId, Elem = classContainer }); }
public override List <ConvertOfferBase> CheckForOffers(AdminShell.Referable currentReferable) { // collectResults var res = new List <ConvertOfferBase>(); // use pre-definitions var defs = new AasxPredefinedConcepts.DefinitionsVDI2770.SetOfDefsVDI2770( new AasxPredefinedConcepts.DefinitionsVDI2770()); var sm = currentReferable as AdminShell.Submodel; if (sm != null && true == sm.GetSemanticKey()?.Matches(defs.SM_VDI2770_Documentation.GetSemanticKey())) { res.Add(new ConvertOfferDocumentationSg2ToHsu(this, $"Convert Submodel '{"" + sm.idShort}' for Documentation SG2 to HSU")); } // MIHO, 2020-07-31: temporary have code to allow conversion of Festo MCAD / ECAD models as well //// if (sm != null && true == sm.GetSemanticKey()?.Matches("Submodel", false, "IRI", //// "http://smart.festo.com/AAS/Submodel/ComputerAidedDesign/1/0", AdminShell.Key.MatchMode.Relaxed)) //// res.Add(new ConvertOfferDocumentationSg2ToHsu(this, //// $"Convert Submodel '{"" + sm.idShort}' for Documentation SG2 to HSU")); return(res); }
public VisualElementOperationVariable( VisualElementGeneric parent, TreeViewLineCache cache, AdminShell.AdministrationShellEnv env, AdminShell.Referable parentContainer, AdminShell.OperationVariable opvar, AdminShell.OperationVariable.Direction dir) : base() { this.Parent = parent; this.Cache = cache; this.theEnv = env; this.theContainer = parentContainer; this.theOpVar = opvar; this.theDir = dir; this.Background = Brushes.White; this.Border = Brushes.White; this.TagBg = (SolidColorBrush)System.Windows.Application.Current.Resources["DarkestAccentColor"]; this.TagFg = Brushes.White; this.TagString = "In"; if (this.theDir == AdminShell.OperationVariable.Direction.Out) { this.TagString = "Out"; } if (this.theDir == AdminShell.OperationVariable.Direction.InOut) { this.TagString = "InOut"; } this.TagBg = (SolidColorBrush)(new BrushConverter().ConvertFrom("#707070"));; this.TagFg = Brushes.White; RefreshFromMainData(); RestoreFromCache(); }
public VisualElementPluginExtension( VisualElementGeneric parent, TreeViewLineCache cache, AdminShellPackageEnv package, AdminShell.Referable referable, Plugins.PluginInstance plugin, AasxIntegrationBase.AasxPluginResultVisualExtension ext) : base() { this.Parent = parent; this.Cache = cache; this.thePackage = package; this.theReferable = referable; this.thePlugin = plugin; this.theExt = ext; this.Background = (SolidColorBrush)(new BrushConverter().ConvertFrom("#A0A0A0")); this.Border = (SolidColorBrush)(new BrushConverter().ConvertFrom("#707070")); this.TagBg = (SolidColorBrush)System.Windows.Application.Current.Resources["DarkestAccentColor"]; this.TagFg = Brushes.White; this.TagString = "" + ext?.Tag; RefreshFromMainData(); RestoreFromCache(); }
// // List of References // public void DisplayOrEditEntityListOfReferences(AnyUiStackPanel stack, List <AdminShell.Reference> references, Action <List <AdminShell.Reference> > setOutput, string entityName, string[] addPresetNames = null, AdminShell.Key[] addPresetKeys = null, AdminShell.Referable relatedReferable = null) { // access if (stack == null) { return; } // hasDataSpecification are MULTIPLE references. That is: multiple x multiple keys! if (this.SafeguardAccess( stack, this.repo, references, $"{entityName}:", "Create data element!", v => { setOutput?.Invoke(new List <AdminShell.Reference>()); return(new AnyUiLambdaActionRedrawEntity()); })) { this.AddGroup(stack, $"{entityName}:", levelColors.SubSection); if (editMode) { // let the user control the number of references this.AddAction( stack, $"{entityName}:", new[] { "Add Reference", "Delete last reference" }, repo, (buttonNdx) => { if (buttonNdx == 0) { references.Add(new AdminShell.Reference()); } if (buttonNdx == 1 && references.Count > 0) { references.RemoveAt(references.Count - 1); } return(new AnyUiLambdaActionRedrawEntity()); }); } // now use the normal mechanism to deal with editMode or not .. if (references != null && references.Count > 0) { for (int i = 0; i < references.Count; i++) { this.AddKeyListKeys( stack, String.Format("reference[{0}]", i), references[i].Keys, repo, packages, PackageCentral.PackageCentral.Selector.MainAux, AdminShell.Key.AllElements, addEclassIrdi: true, relatedReferable: relatedReferable); } } } }
public CAEXObject GetAmlObject(AdminShell.Referable aasReferable) { if (aasToAml.ContainsKey(aasReferable)) { return(aasToAml[aasReferable]); } return(null); }
public AasValidationRecord(AasValidationSeverity Severity, AdminShell.Referable Source, string Message, Action Fix = null) { this.Severity = Severity; this.Source = Source; this.Message = Message; this.Fix = Fix; }
/// <summary> /// Use this always to lookup node records from Referable /// </summary> /// <param name="referable"></param> /// <returns></returns> public NodeRecord LookupNodeRecordFromReferable(AdminShell.Referable referable) { if (NodeRecordFromReferable == null || !NodeRecordFromReferable.ContainsKey(referable)) { return(null); } return(NodeRecordFromReferable[referable]); }
public CopyPasteItemSME( AdminShell.AdministrationShellEnv env, AdminShell.Referable parentContainer, AdminShell.SubmodelElementWrapper wrapper, AdminShell.SubmodelElement sme) { this.env = env; this.parentContainer = parentContainer; this.wrapper = wrapper; this.sme = sme; }
public CopyPasteItemSME( AdminShell.AdministrationShellEnv env, AdminShell.Referable parentContainer, AdminShell.SubmodelElementWrapper wrapper, AdminShell.SubmodelElement sme, AdminShell.EnumerationPlacmentBase placement = null) { this.env = env; this.parentContainer = parentContainer; this.wrapper = wrapper; this.sme = sme; this.Placement = placement; }
public UmlHandle AddClass(AdminShell.Referable rf) { // the Referable shall enumerate children (if not, then its not a class) if (!(rf is AdminShell.IEnumerateChildren rfec)) { return(null); } var features = rfec.EnumerateChildren().ToList(); // add var classId = RegisterObject(rf); var stereotype = EvalFeatureType(rf); if (stereotype.HasContent()) { stereotype = "<<" + stereotype + ">>"; } Writeln($"class {FormatAs(rf.idShort, classId)} {stereotype} {{"); foreach (var smw in features) { if (smw?.submodelElement is AdminShell.SubmodelElement sme) { var type = EvalFeatureType(sme); var multiplicity = EvalUmlMultiplicity(sme, noOne: true); var initialValue = EvalInitialValue(sme, _options.LimitInitialValue); var ln = $" +{sme.idShort}"; if (type.HasContent()) { ln += $" : {type}"; } if (multiplicity.HasContent()) { ln += $" [{multiplicity}]"; } if (initialValue.HasContent()) { ln += $" = \"{initialValue}\""; } Writeln(ln); } } Writeln($"}}"); Writeln(""); return(new UmlHandle() { Id = classId }); }
// Dynamic behaviour //================== protected void InitReferable(AdminShell.Referable rf) { if (rf == null) { return; } rf.idShort = this.PresetIdShort; rf.category = this.PresetCategory; if (this.PresetDescription != null) { rf.description = new AdminShell.Description(this.PresetDescription); } }
/// <summary> /// Create new event data. /// </summary> /// <param name="container">Identification of the container</param> /// <param name="reason">The reason</param> /// <param name="thisRef">Changed Referable itself</param> /// <param name="parentRef">A Referable, which contains the changed Referable.</param> /// <param name="createAtIndex">If create, at which index; else: -1</param> /// <param name="info">Human readable information</param> public PackCntChangeEventData(PackageContainerBase container, PackCntChangeEventReason reason, AdminShell.Referable thisRef = null, AdminShell.Referable parentRef = null, int createAtIndex = -1, string info = null) { Container = container; Reason = reason; ThisElem = thisRef; ParentElem = parentRef; NewIndex = createAtIndex; Info = info; }
public string EvalFeatureType(AdminShell.Referable rf) { if (rf is AdminShell.SubmodelElement sme) { if (sme is AdminShell.Property p && p.valueType.HasContent()) { return(p.valueType); } return(AdminShell.SubmodelElementWrapper.GetElementNameByAdequateType(sme)); } return(rf.GetElementName()); }
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { // Load JObject from stream JObject jObject = JObject.Load(reader); // Create target object based on JObject object target = new AdminShell.Referable(); if (jObject.ContainsKey(UpperClassProperty)) { var j2 = jObject[UpperClassProperty]; if (j2 != null) { foreach (var c in j2.Children()) { var cprop = c as Newtonsoft.Json.Linq.JProperty; if (cprop == null) { continue; } if (cprop.Name == LowerClassProperty && cprop.Value.Type.ToString() == "String") { var cpval = cprop.Value.ToObject <string>(); if (cpval == null) { continue; } // Info MIHO 21 APR 2020: use Referable.CreateAdequateType instead of SMW... var o = AdminShell.Referable.CreateAdequateType(cpval); if (o != null) { target = o; } } } } } // Populate the object properties serializer.Populate(jObject.CreateReader(), target); return(target); }
public void DisplayOrEditEntityModelingKind(AnyUiStackPanel stack, AdminShell.ModelingKind kind, Action <AdminShell.ModelingKind> setOutput, string instanceExceptionStatement = null, AdminShell.Referable relatedReferable = null) { // access if (stack == null) { return; } // members this.AddGroup(stack, "Kind (of model):", levelColors.SubSection); this.AddHintBubble(stack, hintMode, new[] { new HintCheck( () => { return(kind == null); }, "Providing kind information is mandatory. Typically you want to model instances. " + "A manufacturer would define types of assets, as well.", breakIfTrue: true), new HintCheck( () => { return(kind.kind.Trim().ToLower() != "instance"); }, "Check for kind setting. 'Instance' is the usual choice." + instanceExceptionStatement, severityLevel: HintCheck.Severity.Notice) }); if (this.SafeguardAccess( stack, repo, kind, "kind:", "Create data element!", v => { setOutput?.Invoke(new AdminShell.ModelingKind()); return(new AnyUiLambdaActionRedrawEntity()); } )) { this.AddKeyValueRef( stack, "kind", kind, ref kind.kind, null, repo, v => { kind.kind = v as string; this.AddDiaryEntry(relatedReferable, new DiaryEntryStructChange()); return(new AnyUiLambdaActionNone()); }, new[] { AdminShell.ModelingKind.Template, AdminShell.ModelingKind.Instance }); } }
// Factory public static CopyPasteItemBase FactoryConvertFrom(AdminShell.Referable rf) { // try fake a copy paste item (order matters!) CopyPasteItemBase res = CopyPasteItemSME.ConvertFrom(rf); if (res == null) { res = CopyPasteItemSubmodel.ConvertFrom(rf); } if (res == null) { res = CopyPasteItemIdentifiable.ConvertFrom(rf); } // ok return(res); }
public XmiHandle ProcessEntity( AdminShell.Referable parent, AdminShell.Referable rf) { // access if (rf == null) { return(null); } // act flexible var dstTuple = AddClass(rf); // recurse if (rf is AdminShell.IEnumerateChildren rfec) { var childs = rfec.EnumerateChildren(); if (childs != null) { foreach (var c in childs) { if (c?.submodelElement is AdminShell.SubmodelElement sme) { // create further entities var srcTuple = ProcessEntity(rf, sme); // make associations (often, srcTuple will be null, because not a class!) var job = new XmiTupleAssociationJob() { AssocType = "Aggr", Name = "" + sme.idShort, Multiplicity = "" + EvalUmlMultiplicity(sme), SrcTuple = srcTuple, DstTuple = dstTuple }; if (job.Valid) { _associationJobs.Add(job); } } } } } return(dstTuple); }
public VisualElementSubmodelElement(VisualElementGeneric parent, TreeViewLineCache cache, AdminShell.AdministrationShellEnv env, AdminShell.Referable parentContainer, AdminShell.SubmodelElementWrapper wrap) : base() { this.Parent = parent; this.Cache = cache; this.theEnv = env; this.theContainer = parentContainer; this.theWrapper = wrap; this.Background = Brushes.White; this.Border = Brushes.White; this.TagString = "Elem"; if (wrap != null && wrap.submodelElement != null) { if (wrap.submodelElement is AdminShell.Property) { this.TagString = "Prop"; } if (wrap.submodelElement is AdminShell.File) { this.TagString = "File"; } if (wrap.submodelElement is AdminShell.Blob) { this.TagString = "Blob"; } if (wrap.submodelElement is AdminShell.ReferenceElement) { this.TagString = "Ref"; } if (wrap.submodelElement is AdminShell.RelationshipElement) { this.TagString = "Rel"; } if (wrap.submodelElement is AdminShell.SubmodelElementCollection) { this.TagString = "Coll"; } } this.TagBg = (SolidColorBrush)(new BrushConverter().ConvertFrom("#707070"));; this.TagFg = Brushes.White; RefreshFromMainData(); RestoreFromCache(); }
public static List <ConvertOfferBase> CheckForOffers(AdminShell.Referable currentReferable) { var res = new List <ConvertOfferBase>(); var providers = GetAllProviders(); foreach (var prov in providers) { var offers = prov.CheckForOffers(currentReferable); if (offers != null) { foreach (var o in offers) { res.Add(o); } } } return(res); }
public static CopyPasteItemIdentifiable ConvertFrom(AdminShell.Referable rf) { // access var idf = rf as AdminShell.Identifiable; if (idf == null || !(idf is AdminShell.AdministrationShell || idf is AdminShell.Asset || idf is AdminShell.ConceptDescription)) { return(null); } // create return(new CopyPasteItemIdentifiable() { entity = idf }); }
private void repReferable(string head, AdminShell.Referable rf) { //-9- {Referable}.{idShort, category, description, description[@en..], elementName, parent} if (rf.idShort != null) { rep(head + "idShort", rf.idShort); } if (rf.category != null) { rep(head + "category", rf.category); } if (rf.description != null) { repListOfLangStr(head + "description", rf.description.langString); } rep(head + "elementName", "" + rf.GetElementName()); rep(head + "parent", "" + ((rf.parent?.idShort != null) ? rf.parent.idShort : "-")); }
public UmlHandle ProcessEntity( AdminShell.Referable parent, AdminShell.Referable rf) { // access if (rf == null) { return(null); } // act flexible var dstTuple = AddClass(rf); // recurse if (rf is AdminShell.IEnumerateChildren rfec) { var childs = rfec.EnumerateChildren(); if (childs != null) { foreach (var c in childs) { if (c?.submodelElement is AdminShell.SubmodelElement sme) { // create further entities var srcTuple = ProcessEntity(rf, sme); // make associations (often, srcTuple will be null, because not a class!) if (srcTuple?.Valid == true && dstTuple?.Valid == true) { var multiplicity = EvalUmlMultiplicity(sme, noOne: true); if (multiplicity.HasContent()) { multiplicity = "\"" + multiplicity + "\""; } Writeln(post: true, line: $"{dstTuple.Id} *-- {multiplicity} {srcTuple.Id} " + $": \"{ClearName(sme.idShort)}\""); } } } } } return(dstTuple); }
public override List <ConvertOfferBase> CheckForOffers(AdminShell.Referable currentReferable) { // collectResults var res = new List <ConvertOfferBase>(); // use pre-definitions var defs = new AasxPredefinedConcepts.DefinitionsVDI2770.SetOfDefsVDI2770( new AasxPredefinedConcepts.DefinitionsVDI2770()); var sm = currentReferable as AdminShell.Submodel; if (sm != null && true == sm.GetSemanticKey()?.Matches(defs.SM_VDI2770_Documentation.GetSemanticKey())) { res.Add(new ConvertOfferDocumentationSg2ToV11(this, $"Convert Submodel '{"" + sm.idShort}' for Documentation SG2 (V1.0) to V1.1")); } return(res); }
public override List <ConvertOfferBase> CheckForOffers(AdminShell.Referable currentReferable) { // collectResults var res = new List <ConvertOfferBase>(); // use pre-definitions var defs = new AasxPredefinedConcepts.DefinitionsZveiDigitalTypeplate.SetOfDocumentation( new AasxPredefinedConcepts.DefinitionsZveiDigitalTypeplate()); var sm = currentReferable as AdminShell.Submodel; if (sm != null && true == sm.GetSemanticKey()?.Matches(defs.SM_Document.GetSemanticKey())) { res.Add(new ConvertOfferDocumentationHsuToSg2(this, $"Convert Submodel '{"" + sm.idShort}' for Documentation HSU to SG2")); } return(res); }
public override List <ConvertOfferBase> CheckForOffers(AdminShell.Referable currentReferable) { // collectResults var res = new List <ConvertOfferBase>(); // use pre-definitions var defs = new AasxPredefinedConcepts.DefinitionsZveiTechnicalData.SetOfDefs( new AasxPredefinedConcepts.DefinitionsZveiTechnicalData()); var sm = currentReferable as AdminShell.Submodel; if (sm != null && true == sm.GetSemanticKey()?.Matches(defs.SM_TechnicalData.GetSemanticKey())) { res.Add(new ConvertOfferTechnicalDataV10ToV11(this, $"Convert Submodel '{"" + sm.idShort}' for Technical Data (ZVEI) V1.0 to V1.1")); } return(res); }
public override List <ConvertOfferBase> CheckForOffers(AdminShell.Referable currentReferable) { // collectResults var res = new List <ConvertOfferBase>(); // use pre-definitions var defs = new AasxPredefinedConcepts.DefinitionsZveiDigitalTypeplate.SetOfNameplate( new AasxPredefinedConcepts.DefinitionsZveiDigitalTypeplate()); var sm = currentReferable as AdminShell.Submodel; if (sm != null && true == sm.GetSemanticKey()?.Matches(defs.SM_Nameplate.GetSemanticKey(), AdminShellV20.Key.MatchMode.Relaxed)) { res.Add(new ConvertOfferNameplateHsuToZveiV10(this, $"Convert Submodel '{"" + sm.idShort}' for Digital Nameplate HSU to ZVEI V1.0")); } return(res); }
public AnimateState GetState( AdminShell.Referable rf, bool createIfNeeded = false) { if (rf == null) { return(null); } if (_states.ContainsKey(rf)) { return(_states[rf]); } if (createIfNeeded) { var nas = new AnimateState(); _states.Add(rf, nas); return(nas); } return(null); }
public VisualElementSubmodelElement( VisualElementGeneric parent, TreeViewLineCache cache, AdminShell.AdministrationShellEnv env, AdminShell.Referable parentContainer, AdminShell.SubmodelElementWrapper wrap) : base() { this.Parent = parent; this.Cache = cache; this.theEnv = env; this.theContainer = parentContainer; this.theWrapper = wrap; this.Background = Brushes.White; this.Border = Brushes.White; this.TagBg = (SolidColorBrush)System.Windows.Application.Current.Resources["DarkestAccentColor"]; this.TagFg = Brushes.White; this.TagString = wrap.GetElementAbbreviation(); RefreshFromMainData(); RestoreFromCache(); }