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

Commit

Permalink
* let BOM select som AAS entities
Browse files Browse the repository at this point in the history
* new ICON
  • Loading branch information
festo-i40 committed Aug 3, 2023
1 parent 1b04536 commit b07d453
Show file tree
Hide file tree
Showing 18 changed files with 251 additions and 44 deletions.
7 changes: 6 additions & 1 deletion src/AasxIntegrationBase/AasxPluginInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,12 @@ public class AasxPluginResultEventNavigateToReference : AasxPluginResultEventBas
public Aas.IReference targetReference = null;
}

public class AasxPluginResultEventDisplayContentFile : AasxPluginResultEventBase
public class AasxPluginResultEventVisualSelectEntities : AasxPluginResultEventBase
{
public List<Aas.IReferable> Referables = null;
}

public class AasxPluginResultEventDisplayContentFile : AasxPluginResultEventBase
{
public string fn = null;
public string mimeType = null;
Expand Down
6 changes: 4 additions & 2 deletions src/AasxPackageExplorer/AasxPackageExplorer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>aasx.ico</ApplicationIcon>
<ApplicationIcon>aasx-icon-blue-zipper.ico</ApplicationIcon>
</PropertyGroup>
<PropertyGroup>
<ErrorOnDuplicatePublishOutputFiles>false</ErrorOnDuplicatePublishOutputFiles>
Expand Down Expand Up @@ -112,12 +112,12 @@
<None Update="qualifier-presets.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<Resource Include="icon-set-blue-zipper\aasx-icon-blue-zipper.ico" />
<Resource Include="Resources\IDTA_AAS-Logo_312x281_RGB.png" />
<Resource Include="Resources\USB_Hexagon_offen.jpeg" />
<Resource Include="Resources\Festo_t.png" />
<Resource Include="Resources\round_down.png" />
<Resource Include="Resources\round_right.png" />
<Resource Include="Resources\thumb-aasxplore.ico" />
<None Update="SpecPI40_t.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
Expand All @@ -132,7 +132,9 @@
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Remove="i4AASCS.xml" />
<None Remove="icon-set-blue-zipper\aasx-icon-blue-zipper.ico" />
<None Remove="Resources\IDTA_AAS-Logo_312x281_RGB.png" />
<Content Include="aasx-icon-blue-zipper.ico" />
<None Update="Opc.Ua.SampleClient.Config.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
Expand Down
34 changes: 31 additions & 3 deletions src/AasxPackageExplorer/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1719,10 +1719,38 @@ private async Task HandleApplicationEvent(
await UiHandleNavigateTo(evtNavTo.targetReference);
}

// Display Content Url
//====================
// Visually select referables in the tree
//=======================================

if (evt is AasxIntegrationBase.AasxPluginResultEventDisplayContentFile evtDispCont
if (evt is AasxIntegrationBase.AasxPluginResultEventVisualSelectEntities evtVisSel
&& evtVisSel.Referables != null && evtVisSel.Referables.Count > 0)
{
// quite EXPERIMENTAL!
// info
Log.Singleton.Info($"Plugin request to select {evtVisSel.Referables.Count} Referables.");

// set all parents required?
foreach (var sm in PackageCentral.Main?.AasEnv?.OverSubmodelsOrEmpty())
sm?.SetAllParents();

// ugly 3 step approach

// step 1 : expand all nodes in order to search them ..
DisplayElements.ExpandAllItems();
await Task.Delay(1000);

// step 2 : wait for expand events to be internally digested by treeview
DisplayElements.TryExpandMainDataObjects(evtVisSel.Referables);
await Task.Delay(1000);

// step 3 : now select
DisplayElements.TrySelectMainDataObjects(evtVisSel.Referables);
}

// Display Content Url
//====================

if (evt is AasxIntegrationBase.AasxPluginResultEventDisplayContentFile evtDispCont
&& evtDispCont.fn != null)
try
{
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
1 change: 1 addition & 0 deletions src/AasxPackageExplorer/icon-set-blue-zipper/how-to.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
https://redketchup.io/icon-editor
3 changes: 2 additions & 1 deletion src/AasxPackageExplorer/options-debug.MIHO.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@
/* "AasxToLoad": "C:\\MIHO\\Develop\\Aasx\\repo\\Festo_SPAU_VR3.aasx", */
// "AasxToLoad": "C:\\HOMI\\Develop\\Aasx\\repo\\PxC_aasT_2900542_ELR_H3_I_SC__24DC_500AC_0_6.aasx",
// "AasxToLoad": "C:\\HOMI\\Develop\\Aasx\\repo\\Festo_SPAU-B2R-H-G18FD-L-PNLK-PNVBA-M8U_V3a.aasx",
"AasxToLoad": "C:\\HOMI\\Develop\\Aasx\\repo\\01_Festo_SPAU_VR3_DPPV2.aasx",
// "AasxToLoad": "C:\\HOMI\\Develop\\Aasx\\repo\\01_Festo_SPAU_VR3_DPPV2.aasx",
// "AasxToLoad": "C:\\HOMI\\Develop\\Aasx\\repo\\bomtest1.aasx",
"AasxToLoad": "C:\\HOMI\\Develop\\Aasx\\repo\\leitungssatz_tier1.aasx",
// "AasxToLoad": "C:\\HOMI\\Develop\\Aasx\\repo\\IDTA 02006-2-1_Template_Digital Nameplate_V3_lang.aasx",
// "AasxToLoad": "C:\\HOMI\\Develop\\Aasx\\repo\\SMT_Sample_B.aasx",
// "AuxToLoad": "C:\\HOMI\\Develop\\Aasx\\repo\\SMT_Sample_A.aasx",
Expand Down
6 changes: 6 additions & 0 deletions src/AasxPackageLogic/VisualAasxElements.cs
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,12 @@ public void SetIsExpandedIfNotTouched(bool isExpanded)
_isExpanded = isExpanded;
}

public bool HiddenSelected
{
get { return _isSelected; }
set { _isSelected = value; }
}

/// <summary>
/// Gets/sets whether the TreeViewItem
/// associated with this object is selected.
Expand Down
63 changes: 49 additions & 14 deletions src/AasxPluginBomStructure/GenericBomControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,20 @@ public void SetEventStack(PluginEventStack es)
this.eventStack = es;
}

protected StackPanel CreateTopPanel()
protected WrapPanel CreateTopPanel()
{
// create TOP controls
var spTop = new StackPanel();
spTop.Orientation = Orientation.Horizontal;
var wpTop = new WrapPanel();
wpTop.Orientation = Orientation.Horizontal;

// style

spTop.Children.Add(new Label() { Content = "Layout style: " });
wpTop.Children.Add(new Label() { Content = "Layout style: " });

var cbli = new ComboBox();
var cbli = new ComboBox()
{
Margin = new Thickness(0, 0, 0, 5)
};
foreach (var psn in this.PresetSettingNames)
cbli.Items.Add(psn);
cbli.SelectedIndex = _creatorOptions.LayoutIndex;
Expand All @@ -79,11 +82,11 @@ protected StackPanel CreateTopPanel()
RememberSettings();
RedrawGraph();
};
spTop.Children.Add(cbli);
wpTop.Children.Add(cbli);

// spacing

spTop.Children.Add(new Label() { Content = "Spacing: " });
wpTop.Children.Add(new Label() { Content = "Spacing: " });

var sli = new Slider()
{
Expand All @@ -94,7 +97,7 @@ protected StackPanel CreateTopPanel()
TickFrequency = 10,
IsSnapToTickEnabled = true,
Value = _creatorOptions.LayoutSpacing,
Margin = new System.Windows.Thickness(10, 0, 10, 0),
Margin = new System.Windows.Thickness(10, 0, 10, 5),
VerticalAlignment = System.Windows.VerticalAlignment.Center
};
sli.ValueChanged += (s, e) =>
Expand All @@ -103,14 +106,14 @@ protected StackPanel CreateTopPanel()
RememberSettings();
RedrawGraph();
};
spTop.Children.Add(sli);
wpTop.Children.Add(sli);

// Compact labels

var cbcomp = new CheckBox()
{
Content = "Compact labels",
Margin = new System.Windows.Thickness(10, 0, 10, 0),
Margin = new System.Windows.Thickness(10, 0, 10, 5),
VerticalContentAlignment = System.Windows.VerticalAlignment.Center,
IsChecked = _creatorOptions.CompactLabels,
};
Expand All @@ -122,14 +125,14 @@ protected StackPanel CreateTopPanel()
};
cbcomp.Checked += cbcomb_changed;
cbcomp.Unchecked += cbcomb_changed;
spTop.Children.Add(cbcomp);
wpTop.Children.Add(cbcomp);

// show asset ids

var cbaid = new CheckBox()
{
Content = "Show Asset ids",
Margin = new System.Windows.Thickness(10, 0, 10, 0),
Margin = new System.Windows.Thickness(10, 0, 10, 5),
VerticalContentAlignment = System.Windows.VerticalAlignment.Center,
IsChecked = _creatorOptions.CompactLabels,
};
Expand All @@ -141,9 +144,41 @@ protected StackPanel CreateTopPanel()
};
cbaid.Checked += cbaid_changed;
cbaid.Unchecked += cbaid_changed;
spTop.Children.Add(cbaid);
wpTop.Children.Add(cbaid);

// "select" button

var btnSelect = new Button()
{
Content = "Selection \U0001f846 tree",
Margin = new Thickness(0, 0, 0, 5),
Padding = new Thickness(4, 0, 4, 0)
};
btnSelect.Click += (s3, e3) =>
{
// check for marked entities
var markedRf = new List<Aas.IReferable>();
if (theViewer != null)
foreach (var vn in theViewer.GetViewerNodes())
if (vn.MarkedForDragging && vn.Node?.UserData is Aas.IReferable rf)
markedRf.Add(rf);
if (markedRf.Count < 1)
return;
// send event to main application
var evt = new AasxPluginResultEventVisualSelectEntities()
{
Referables = markedRf
};
this.eventStack.PushEvent(evt);
};
wpTop.Children.Add(btnSelect);

// return

return spTop;
return wpTop;
}

public object FillWithWpfControls(
Expand Down
3 changes: 2 additions & 1 deletion src/AasxPluginBomStructure/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ public class AasxPlugin : AasxPluginBase
return ListActionsBasicHelper(
enableCheckVisualExt: true,
enablePanelWpf: true,
enableMenuItems: true).ToArray();
enableMenuItems: true,
enableEventsGet: true).ToArray();
}

public new AasxPluginResultBase ActivateAction(string action, params object[] args)
Expand Down
6 changes: 3 additions & 3 deletions src/AasxPluginWebBrowser/AasxPluginWebBrowser.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
<OutputType>library</OutputType>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<UseWPF>true</UseWPF>
<Platforms>x64</Platforms>
<Platform>x64</Platform>
<PlatformTarget>x64</PlatformTarget>
<RuntimeIdentifiers>win7-x64</RuntimeIdentifiers>

<!-- force NuGet / Build to put required.dll and more to bin folder -->
Expand All @@ -15,9 +18,6 @@
* Dotnet CLI will only recognize "Platform",
* Visual Studio will only recognize "Platforms".
-->
<Platforms>x64</Platforms>
<Platform>x64</Platform>
<PlatformTarget>x64</PlatformTarget>

<CefSharpBuildAction>Content</CefSharpBuildAction>
<ErrorOnDuplicatePublishOutputFiles>false</ErrorOnDuplicatePublishOutputFiles>
Expand Down
4 changes: 4 additions & 0 deletions src/AasxWpfControlLibrary/AasxWpfControlLibrary.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
<ErrorOnDuplicatePublishOutputFiles>false</ErrorOnDuplicatePublishOutputFiles>
</PropertyGroup>
<ItemGroup>
<None Remove="Resources\aasx-icon-blue-zipper.png" />
<None Remove="Resources\aasx-icon-blue-zipper_72x72.png" />
<None Remove="Resources\IDTA_AAS-Logo_80x72_RGB.png" />
</ItemGroup>
<ItemGroup>
Expand All @@ -28,6 +30,8 @@
<EmbeddedResource Include="Resources\LICENSE.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
<Resource Include="Resources\aasx-icon-blue-zipper.png" />
<Resource Include="Resources\aasx-icon-blue-zipper_72x72.png" />
<Resource Include="Resources\Icon_AASX_32x32_2_W.bmp" />
<Resource Include="Resources\Icon_AASX_40x40_W.bmp" />
<Resource Include="Resources\IDTA_AAS-Logo_80x72_RGB.png" />
Expand Down
Loading

0 comments on commit b07d453

Please sign in to comment.