Skip to content
This repository has been archived by the owner on Apr 16, 2024. It is now read-only.

Commit

Permalink
* temp commit
Browse files Browse the repository at this point in the history
  • Loading branch information
festo-i40 committed Jan 1, 2024
1 parent 71b7b39 commit 9af8f96
Show file tree
Hide file tree
Showing 29 changed files with 2,077 additions and 133 deletions.
6 changes: 5 additions & 1 deletion src/AasxCsharpLibrary/AdminShellUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -458,10 +458,14 @@ public static string ToSingleLineShortened(string str, int maxLen, string textNe
/// <code doctest="true">Assert.AreEqual("someName", AdminShellUtil.FilterFriendlyName("someName"));</code>
/// <code doctest="true">Assert.AreEqual("some__name", AdminShellUtil.FilterFriendlyName("some!;name"));</code>
/// </example>
public static string FilterFriendlyName(string src)
public static string FilterFriendlyName(string src, bool pascalCase = false)
{
if (src == null)
return null;

if (pascalCase && src.Length > 0)
src = char.ToUpper(src[0]) + src.Substring(1);

return Regex.Replace(src, @"[^a-zA-Z0-9\-_]", "_");
}

Expand Down
12 changes: 12 additions & 0 deletions src/AasxCsharpLibrary/Extensions/ExtendIReferable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,18 @@ public static void BaseValidation(this IReferable referable, AasValidationRecord
}));
}

/// <summary>
/// Tells, if the IReferable can sub-structure more elements
/// </summary>
public static bool IsStructured(this IReferable rf)
{
return (rf is ISubmodel
|| rf is ISubmodelElementCollection
|| rf is ISubmodelElementList
|| rf is IOperation
|| rf is IEntity);
}

/// <summary>
/// Tells, if the IReferable is used with an index instead of <c>idShort</c>.
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion src/AasxCsharpLibrary/Extensions/ExtendKey.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace Extensions
{
public static class ExtendKey
{
public static IKey CreateFrom(Reference r)
public static IKey CreateFrom(Reference r)
{
if (r == null || r.Count() != 1)
return null;
Expand Down
6 changes: 6 additions & 0 deletions src/AasxCsharpLibrary/Extensions/ExtendReference.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ public static Reference CreateNew(List<IKey> lk)
return res;
}

public static Reference CreateFromString(string id, KeyTypes keyType = KeyTypes.GlobalReference)
{
var k = new Key(keyType, id);
return new Reference(ReferenceTypes.ExternalReference, new List<IKey>(new IKey[] { k }));
}

// TODO (Jui, 2023-01-05): Check why the generic Copy<T> does not apply here?!
public static Reference Copy(this Reference original)
{
Expand Down
28 changes: 28 additions & 0 deletions src/AasxIntegrationBase/AasForms/AasFormUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,26 @@ namespace AasxIntegrationBase.AasForms
{
public static class AasFormUtils
{
public static FormMultiplicity? GetCardinality(List<Aas.IQualifier> qs)
{
if (qs == null)
return null;

var multiTrigger = new[] { "Multiplicity", "Cardinality", "SMT/Cardinality" };
foreach (var mt in multiTrigger)
{
var q = qs?.FindQualifierOfType(mt);
if (q != null)
{
foreach (var m in (FormMultiplicity[])Enum.GetValues(typeof(FormMultiplicity)))
if (("" + q.Value) == Enum.GetName(typeof(FormMultiplicity), m))
return m;
}
}

return null;
}

private static void RecurseExportAsTemplate(
List<Aas.ISubmodelElement> smwc, FormDescListOfElement tels,
Aas.Environment env = null, List<Aas.ConceptDescription> cds = null)
Expand Down Expand Up @@ -115,6 +135,9 @@ private static void RecurseExportAsTemplate(
if (q != null)
tsme.FormEditDescription = q.Value.Trim().ToLower() == "true";

// TODO (MIHO, 24-01-01): reorganize access to qualifiers

#if __old__
var multiTrigger = new[] { "Multiplicity", "Cardinality", "SMT/Cardinality" };
foreach (var mt in multiTrigger)
{
Expand All @@ -126,6 +149,11 @@ private static void RecurseExportAsTemplate(
tsme.Multiplicity = m;
}
}
#else
var mlc = GetCardinality(qs);
if (mlc.HasValue)
tsme.Multiplicity = mlc.Value;
#endif

q = qs?.FindQualifierOfType("PresetValue");
if (q != null && tsme is FormDescProperty)
Expand Down
2 changes: 1 addition & 1 deletion src/AasxPackageExplorer.sln
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AasxPluginDigitalNameplate"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AasxPluginContactInformation", "AasxPluginContactInformation\AasxPluginContactInformation.csproj", "{938BB137-DC45-4A84-B0C9-AC46DA321FDB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AasxCore.Samm2_2_0", "AasxCore.Samm2_2_0\AasxCore.Samm2_2_0.csproj", "{DCFD6C2F-A7C5-4AA2-82F3-0D3856E7EA99}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AasxCore.Samm2_2_0", "AasxCore.Samm2_2_0\AasxCore.Samm2_2_0.csproj", "{DCFD6C2F-A7C5-4AA2-82F3-0D3856E7EA99}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
4 changes: 3 additions & 1 deletion src/AasxPackageExplorer/debug.MIHO.script
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
// Tool("sammaspectimport", "File", "C:\\HOMI\\Develop\\Aasx\\repo\\samm-test\\BatteryPass-spiel.ttl");
// Tool("sammaspectimport", "File", "C:\\HOMI\\Develop\\Aasx\\repo\\samm-test\\Batch-MM-2_0_0.ttl");
Tool("editkey");
Tool("sammaspectimport", "File", "C:\\HOMI\\Develop\\Aasx\\repo\\samm-test\\Aspect_Example_SML_MLP.ttl");
Select("Submodel", "First");
// Tool("sammaspectimport", "File", "C:\\HOMI\\Develop\\Aasx\\repo\\samm-test\\Aspect_Example_SML_MLP.ttl");
Tool("exportpredefineconcepts", "File", "C:\HOMI\Develop\Aasx\repo\aid\new.txt");
// Tool("submodelinstancefromsmtconcepts");
// Select("ConceptDescription", "First");
// Select("ConceptDescription", "Next");
Expand Down
16 changes: 9 additions & 7 deletions src/AasxPackageExplorer/options-debug.MIHO.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
// "AasxToLoad": "C:\\HOMI\\Develop\\Aasx\\repo\\Test1.aasx",
// "AasxToLoad": "C:\\HOMI\\Develop\\Aasx\\repo\\samm-test\\SMT_and_SAMM_Showcase_v02.aasx",
// "AasxToLoad": "C:\\HOMI\\Develop\\Aasx\\repo\\samm-test\\Aspect_Example_SML_MLP.ttl",
// "AasxToLoad": "C:\\HOMI\\Develop\\Aasx\\repo\\8001203_SPAU-P10R-T-R18M-L-PNLK-PNVBA-M8D_060ff64f-9fd2-422d-81ce-b17e49f007c5_work.aasx",
"AasxToLoad": "C:\\HOMI\\Develop\\Aasx\\repo\\aid\\2023_AID1.0_Template_Rework_MIHO.aasx",
// "AasxRepositoryFn": "C:\\HOMI\\Develop\\Aasx\\repo_Festo_demo_case_V3\\Festo-DemoCase-repo-V3-local.json",
"WindowLeft": 200,
"WindowTop": -1,
"WindowWidth": 900,
Expand Down Expand Up @@ -164,22 +167,21 @@
{
"Path": "..\\..\\..\\..\\..\\..\\AasxPluginExportTable\\bin\\Debug\\net6.0-windows\\AasxPluginExportTable.dll",
"Args": []
} /* ,
,
},
{
"Path": "..\\..\\..\\..\\..\\..\\AasxPluginWebBrowser\\bin\\x64\\Debug\\net6.0-windows\\AasxPluginWebBrowser.dll",
"Path": "..\\..\\..\\..\\..\\..\\AasxPluginWebBrowser\\bin\\x64\\Debug\\AasxPluginWebBrowser.dll",
"Args": []
}
},

// Festo specific from here on
{
"Path": "..\\..\\..\\..\\..\\..\\..\\AasxFesto\\AasxFesto\\AasxPluginFluiddrawViewer\\bin\\Debug\\net6.0-windows\\AasxPluginFluiddrawViewer.dll",
"Path": "..\\..\\..\\..\\..\\..\\..\\..\\AasxFesto\\AasxFesto\\AasxPluginFluiddrawViewer\\bin\\Debug\\net6.0-windows\\AasxPluginFluiddrawViewer.dll",
"Args": []
},
{
"Path": "..\\..\\..\\..\\..\\..\\..\\AasxFesto\\AasxFesto\\AasxPluginFluiddrawBom\\bin\\Debug\\net6.0-windows\\AasxPluginFluiddrawBom.dll",
"Path": "..\\..\\..\\..\\..\\..\\..\\..\\AasxFesto\\AasxFesto\\AasxPluginFluiddrawBom\\bin\\Debug\\net6.0-windows\\AasxPluginFluiddrawBom.dll",
"Args": []
}
} /*
// Festo specific from here on
{
"Path": "..\\..\\..\\..\\..\\..\\..\\AasxFesto\\AasxFesto\\AasxPluginFluiddrawViewer\\bin\\Debug\\AasxPluginFluiddrawViewer.dll",
Expand Down
4 changes: 2 additions & 2 deletions src/AasxPackageLogic/DispEditHelperBasics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -955,9 +955,9 @@ public void AddKeyListLangStr<T>(
// check here, if to hightlight
if (tbStr != null && this.highlightField != null &&
this.highlightField.fieldHash == langStr[currentI].Text.GetHashCode() &&
//(this.highlightField.containingObject == langStr[currentI]))
(this.highlightField.containingObject == (object) langStr[currentI]))
//TODO (jtikekar, 0000-00-00): need to test
CompareUtils.Compare<IAbstractLangString>((IAbstractLangString)this.highlightField.containingObject, langStr[currentI]))
// CompareUtils.Compare<IAbstractLangString>((IAbstractLangString)this.highlightField.containingObject, langStr[currentI]))
this.HighligtStateElement(tbStr, true);

// button [-]
Expand Down
40 changes: 29 additions & 11 deletions src/AasxPackageLogic/DispEditHelperMultiElement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -254,18 +254,22 @@ public string PerformWildcardReplace(string input, string pattern)
input = "";
}

if (p0 == '^')
if (pattern.Length >= 1 && pattern.StartsWith('>'))
{
metaChar = true;
res += input.ToUpper();
input = "";
}
// greed variants with ^*, §*
if (p0 == '^')
{
metaChar = true;
res += input.ToUpper();
input = "";
}

if (p0 == '§')
{
metaChar = true;
res += input.ToLower();
input = "";
if (p0 == '§')
{
metaChar = true;
res += input.ToLower();
input = "";
}
}

// only with input
Expand All @@ -278,6 +282,20 @@ public string PerformWildcardReplace(string input, string pattern)
input = input.Remove(0, 1);
}

// normal variant, not greedy
if (p0 == '^')
{
metaChar = true;
res += char.ToUpper(input[0]);
input = input.Remove(0, 1);
}
if (p0 == '§')
{
metaChar = true;
res += char.ToLower(input[0]);
input = input.Remove(0, 1);
}

if (p0 == '~')
{
metaChar = true;
Expand Down Expand Up @@ -669,7 +687,7 @@ public void DisplayOrEditAasEntityMultipleElements(
AddActionPanel(stack, "Actions:",
repo: repo, superMenu: superMenu,
ticketMenu: new AasxMenu()
.AddAction("aas-elem-cut", "Change attribute ..",
.AddAction("change-attr", "Change attribute ..",
"Changes common attributes of multiple selected elements.")
.AddAction("remove-extension", "Remove extensions ..",
"Removes a specific selected extension from elements."),
Expand Down
2 changes: 1 addition & 1 deletion src/AasxPackageLogic/ExplorerMenuFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ public static AasxMenu CreateMainMenu()
.AddWpfBlazor(name: "ExportPredefineConcepts",
header: "Export Submodel as snippet for PredefinedConcepts …",
args: new AasxMenuListOfArgDefs()
.Add("File", "OPC UA Nodeset2.xml file to write.")
.Add("File", "Text file to write.")
.Add("Location", "Location selection", hidden: true))
.AddWpfBlazor(name: "SubmodelTDExport", header: "Export Submodel as Thing Description JSON LD document",
help: "Export Thing Description (TD) file in JSON LD format from an existing Submodel.",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
/*
Copyright (c) 2018-2023 Festo SE & Co. KG <https://www.festo.com/net/de_de/Forms/web/contact_international>
Author: Michael Hoffmeister
This source code is licensed under the Apache License 2.0 (see LICENSE.txt).
This source code may use other Open Source software components (see LICENSE.txt).
*/

using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Media;
using System.Xml;
using System.Xml.Schema;
using AasxIntegrationBase;
using AasxIntegrationBase.AasForms;
using Newtonsoft.Json;
using Aas = AasCore.Aas3_0;
using AdminShellNS;
using Extensions;
using AnyUi;

namespace AasxPackageLogic
{
public static class ChangeElementAttributesFlyoutAnyUiFlyout
{
public static AnyUiDialogueDataModalPanel CreateModelDialogue(
AnyUiDialogueDataChangeElementAttributes innerDiaData)
{
// ok, go on ..
var uc = new AnyUiDialogueDataModalPanel(innerDiaData.Caption);
uc.ActivateRenderPanel(innerDiaData,
(uci) =>
{
// create panel
var panel = new AnyUiStackPanel();
var helper = new AnyUiSmallWidgetToolkit();
var g = helper.AddSmallGrid(5, 4, new[] { "220:", "3*", "100:", "1*" },
padding: new AnyUiThickness(0, 5, 0, 5));
g.RowDefinitions[1].MinHeight = 16.0;
g.RowDefinitions[3].MinHeight = 16.0;
panel.Add(g);
// Row 0 : Attribute and language
helper.AddSmallLabelTo(g, 0, 0, content: "Attribute:", verticalCenter: true);
AnyUiUIElement.SetIntFromControl(
helper.Set(
helper.AddSmallComboBoxTo(g, 0, 1,
items: AnyUiDialogueDataChangeElementAttributes.AttributeNames,
selectedIndex: (int)innerDiaData.AttributeToChange),
minWidth: 400),
(i) => { innerDiaData.AttributeToChange = (AnyUiDialogueDataChangeElementAttributes.AttributeEnum)i; });
helper.AddSmallLabelTo(g, 0, 2, content: "Language:", verticalCenter: true);
AnyUiUIElement.SetStringFromControl(
helper.Set(
helper.AddSmallComboBoxTo(g, 0, 3,
text: innerDiaData.AttributeLang,
items: AasxLanguageHelper.GetLangCodes().ToArray(),
isEditable: true),
minWidth: 200),
(s) => { innerDiaData.AttributeLang = s; });
// Row 2 : Change pattern
helper.AddSmallLabelTo(g, 2, 0, content: "Change pattern:", verticalCenter: true);
AnyUiUIElement.SetStringFromControl(
helper.Set(
helper.AddSmallComboBoxTo(g, 2, 1,
text: innerDiaData.Pattern,
items: AnyUiDialogueDataChangeElementAttributes.PatternPresets,
isEditable: true),
minWidth: 600,
colSpan: 3),
(s) => { innerDiaData.Pattern = s; });
// Row 4 : Help
helper.AddSmallLabelTo(g, 4, 0, content: "Help:");
helper.Set(
helper.AddSmallLabelTo(g, 4, 1,
margin: new AnyUiThickness(0, 2, 2, 2),
content: string.Join(System.Environment.NewLine, AnyUiDialogueDataChangeElementAttributes.HelpLines),
verticalAlignment: AnyUiVerticalAlignment.Top,
verticalContentAlignment: AnyUiVerticalAlignment.Top,
fontSize: 0.7,
wrapping: AnyUiTextWrapping.Wrap),
colSpan: 3,
minHeight: 100,
horizontalAlignment: AnyUiHorizontalAlignment.Stretch);
// give back
return panel;
});
return uc;
}
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 6 additions & 4 deletions src/AasxPluginDocumentShelf/AasxPluginDocumentShelf.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@
<ErrorOnDuplicatePublishOutputFiles>false</ErrorOnDuplicatePublishOutputFiles>
</PropertyGroup>
<ItemGroup>
<Compile Remove="Resources\**" />
<EmbeddedResource Remove="Resources\**" />
<None Remove="Resources\**" />
<Page Remove="Resources\**" />
<None Remove="Resources\bin-preview.png" />
<None Remove="Resources\zip-preview.png" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Resources\bin-preview.png" />
<EmbeddedResource Include="Resources\zip-preview.png" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\AasxIntegrationBaseGdi\AasxIntegrationBaseGdi.csproj" />
Expand Down
Loading

0 comments on commit 9af8f96

Please sign in to comment.