Skip to content

Commit fe7561a

Browse files
committed
* pending fixes from merge
1 parent 4e198f4 commit fe7561a

File tree

3 files changed

+10
-80
lines changed

3 files changed

+10
-80
lines changed

src/AasxCsharpLibrary/Extensions/ExtendAssetAdministrationShell.cs

+10-35
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,16 @@ public static bool HasSubmodelReference(this IAssetAdministrationShell aas, Refe
6262
return aas.FindSubmodelReference(smRef) != null;
6363
}
6464

65+
public static void AddSubmodelReference(this IAssetAdministrationShell assetAdministrationShell, IReference newSubmodelReference)
66+
{
67+
if (assetAdministrationShell.Submodels == null)
68+
{
69+
assetAdministrationShell.Submodels = new List<IReference>();
70+
}
71+
72+
assetAdministrationShell.Submodels.Add(newSubmodelReference);
73+
}
74+
6575
/// <summary>
6676
/// Enumerates any references to Submodels in the AAS. Will not return <c>null</c>.
6777
/// Is tolerant, if the list is <c>null</c>.
@@ -109,41 +119,6 @@ public static void Add(this IAssetAdministrationShell aas, IReference newSmRef)
109119
aas.Submodels.Add(newSmRef);
110120
}
111121

112-
/// <summary>
113-
/// Returns the <c>index</c>-th Submodel, if exists. Returns <c>null</c> in any other case.
114-
/// </summary>
115-
public static IReference SubmodelByIndex(this IAssetAdministrationShell aas, int index)
116-
{
117-
if (aas?.Submodels == null || index < 0 || index >= aas.Submodels.Count)
118-
return null;
119-
return aas.Submodels[index];
120-
/// <summary>
121-
/// Removes the reference, if contained in list. Might set the list to <c>null</c> !!
122-
/// Note: <c>smRef</c> must be the exact object, not only match it!
123-
/// </summary>
124-
public static void Remove(this IAssetAdministrationShell aas, IReference smRef)
125-
{
126-
if (aas?.Submodels == null)
127-
return;
128-
if (aas.Submodels.Contains(smRef))
129-
aas.Submodels.Remove(smRef);
130-
if (aas.Submodels.Count < 1)
131-
aas.Submodels = null;
132-
}
133-
134-
/// <summary>
135-
/// Adds. Might create the list.
136-
/// </summary>
137-
public static void Add(this IAssetAdministrationShell aas, IReference newSmRef)
138-
{
139-
if (aas == null)
140-
return;
141-
if (aas.Submodels == null)
142-
aas.Submodels = new List<IReference>();
143-
144-
aas.Submodels.Add(newSmRef);
145-
}
146-
147122
/// <summary>
148123
/// Removes the reference, if contained in list. Might set the list to <c>null</c> !!
149124
/// Note: <c>smRef</c> must be the exact object, not only match it!

src/AasxCsharpLibrary/Extensions/ExtendEnvironment.cs

-23
Original file line numberDiff line numberDiff line change
@@ -496,29 +496,6 @@ public static IConceptDescription AddConceptDescriptionOrReturnExisting(
496496
return cd;
497497
}
498498

499-
public static IConceptDescription AddConceptDescriptionOrReturnExisting(
500-
this AasCore.Aas3_0.IEnvironment env, IConceptDescription cd)
501-
{
502-
if (cd == null)
503-
{
504-
return null;
505-
}
506-
if (env.ConceptDescriptions != null)
507-
{
508-
var existingCd = env.ConceptDescriptions.Where(c => c.Id == cd.Id).FirstOrDefault();
509-
if (existingCd != null)
510-
{
511-
return existingCd;
512-
}
513-
else
514-
{
515-
env.ConceptDescriptions.Add(cd);
516-
}
517-
}
518-
519-
return cd;
520-
}
521-
522499
/// <summary>
523500
/// Adds the Submodel. If env.Submodels are <c>null</c>, then
524501
/// the list will be created.

src/AasxPackageLogic/VisualAasxElements.cs

-22
Original file line numberDiff line numberDiff line change
@@ -1297,28 +1297,6 @@ public override void RefreshFromMainData()
12971297
this.Info += " = " + vl;
12981298
}
12991299

1300-
// SAMM?
1301-
var sammType = DispEditHelperSammModules.CheckReferableForSammExtensionType(theCD);
1302-
var sammName = DispEditHelperSammModules.CheckReferableForSammExtensionTypeName(sammType);
1303-
if (sammName?.HasContent() == true)
1304-
{
1305-
// completely reformat the Caption
1306-
this.Caption = $"\"{"" + theCD.IdShort}\" \uff5f{sammName}\uff60 {"" + theCD.Id}";
1307-
1308-
// do model element colors?
1309-
var ri = Samm.Constants.GetRenderInfo(sammType);
1310-
if (ri != null)
1311-
{
1312-
this.TagString = "" + ri.Abbreviation;
1313-
this.Border = new AnyUiColor(ri.Background);
1314-
this.Background = new AnyUiColor(Samm.Constants.RenderBackground);
1315-
this.TagBg = new AnyUiColor(ri.Background);
1316-
this.TagFg = new AnyUiColor(ri.Foreground);
1317-
1318-
this.HasSpecialColors = true;
1319-
}
1320-
}
1321-
13221300
// SAMM?
13231301
var sammType = DispEditHelperSammModules.CheckReferableForSammExtensionType(theCD);
13241302
var sammName = DispEditHelperSammModules.CheckReferableForSammExtensionTypeName(sammType);

0 commit comments

Comments
 (0)