BT-MatML-Editor 0.1.4
Editor for the MatML 3.1 XML Schema
BT_MatML_Utilities_GUI.h
1
2// Name: BT_MatML_Utilities_GUI.h
3// Purpose: Classes of Utilities_GUI Base and Derived Misc.
4// fn used in other classes.
5// Author: Paul McGrath
6// Modified by:
7// Created:
8// Copyright: (c) Paul McGrath
9// Licence: CC licence
11#pragma once
12
13#include <boost/shared_ptr.hpp>
14#include <boost/algorithm/string.hpp>
15#include <boost/algorithm/string/classification.hpp>
16
17#include <wx/treebase.h>
18
19#include <list>
20#include <vector>
21
22#include "matml31.hxx"
23#include "matml31_strongtypedef.h"
24
25#include "BT_MatML_TreeCtrlSorted.h"
26#include "BT_MatML_MatMLTreeItemData.h"
27
28namespace bellshire {
29
30 //Utility for std:string and wxString
31#define _std2wx(var) wxString (var.c_str(),wxConvUTF8)
32#define _wx2std(var) std::string(var.mb_str())
33
38 {
39 public:
40 static wxTreeItemId MatMLtoTreeCtrl(TreeCtrlSorted* MatMLTreeCtrl, Material* MatMLMaterial);
41 static std::list< std::pair< Material*, xml_schema::string > > GetMaterialIDPair(::boost::shared_ptr<MatML_Doc> MatMLDoc, std::list<xml_schema::string> ClassFilters = std::list<xml_schema::string>());
42 static bool InFilter(Material* material, std::list<xml_schema::string> Filter);
43 static bool InFilter(Material* material, xml_schema::string* Filter);
44
45 static std::list<Name*> GetMatMLDocClassNames(::boost::shared_ptr<MatML_Doc> MatMLDoc);
46 static std::list<Name*> GetBulkDetailsClassNames(Material* material);
47 static bool CompareName( Name*& first, Name*& second);
48 static bool SameName(Name*& first, Name*& second);
49
50 static ::std::string Label(::std::string name, ::std::string id);
51 static ::std::string LabelToId(::std::string label);
52
53 static std::list<xml_schema::string> wx2std(const wxArrayString& wxstr);
54 static wxArrayString std2wx(const std::list<xml_schema::string>& stdstr);
55
56 void CollectBranchMaterials(boost::shared_ptr<MatML_Doc> doc, Material* m, std::vector<Material*>& ms);
57 void CollectBranchMaterialsBackwards(Material* m, std::vector<Material*>& ms);
58 void CollectBranchMaterialsForewards(boost::shared_ptr<MatML_Doc> doc, Material* m, std::vector<Material*>& ms);
59
60 };
61
62};//namespace bellshire
Definition: matml31.hxx:2299
Definition: matml31.hxx:2658
Definition: BT_MatML_TreeCtrlSorted.h:19
Definition: BT_MatML_Utilities_GUI.h:38
static std::list< Name * > GetBulkDetailsClassNames(Material *material)
Get the Materials BulkDetails->Class->Names
Definition: BT_MatML_Utilities_GUI.cpp:169
static std::list< std::pair< Material *, xml_schema::string > > GetMaterialIDPair(::boost::shared_ptr< MatML_Doc > MatMLDoc, std::list< xml_schema::string > ClassFilters=std::list< xml_schema::string >())
Gather Material* and Material->ID paired together in a list.
Definition: BT_MatML_Utilities_GUI.cpp:40
::std::string Label(::std::string name, ::std::string id)
Creates a string of the Labels used in wxWidgets displays
Definition: BT_MatML_Utilities_GUI.cpp:214
static bool SameName(Name *&first, Name *&second)
Compare if the First Name and Second Name are the same a binary predicate implemented as a function
Definition: BT_MatML_Utilities_GUI.cpp:206
static wxTreeItemId MatMLtoTreeCtrl(TreeCtrlSorted *MatMLTreeCtrl, Material *MatMLMaterial)
Searches the TreeCtrl to find the MatML Element
Definition: BT_MatML_Utilities_GUI.cpp:12
static std::list< xml_schema::string > wx2std(const wxArrayString &wxstr)
Converts wxArrayString to std::list of xml_schema::string
Definition: BT_MatML_Utilities_GUI.cpp:237
static wxArrayString std2wx(const std::list< xml_schema::string > &stdstr)
Converts list of xml_schema::string to wxArrayString
Definition: BT_MatML_Utilities_GUI.cpp:254
void CollectBranchMaterials(boost::shared_ptr< MatML_Doc > doc, Material *m, std::vector< Material * > &ms)
Collect Branch of Materials
Definition: BT_MatML_Utilities_GUI.cpp:270
static bool InFilter(Material *material, std::list< xml_schema::string > Filter)
Determines if the Material has a Class->Name for each of the ClassFilter strings If the filter is emp...
Definition: BT_MatML_Utilities_GUI.cpp:90
void CollectBranchMaterialsForewards(boost::shared_ptr< MatML_Doc > doc, Material *m, std::vector< Material * > &ms)
Collect Branch of Materials in the Forwards direction
Definition: BT_MatML_Utilities_GUI.cpp:316
static bool CompareName(Name *&first, Name *&second)
Comparision of the First Name to the Second Name
Definition: BT_MatML_Utilities_GUI.cpp:194
void CollectBranchMaterialsBackwards(Material *m, std::vector< Material * > &ms)
Collect Branch of Materials in the Backwards direction
Definition: BT_MatML_Utilities_GUI.cpp:281
static std::list< Name * > GetMatMLDocClassNames(::boost::shared_ptr< MatML_Doc > MatMLDoc)
Gathers within the MatMLDoc all of the materials->BulkDetails->Class->Name
Definition: BT_MatML_Utilities_GUI.cpp:140
Contains the GUI and GUI associated classes. OnInit() calls the creation of the MaterialFrame GUI
Definition: BT_MatML_App.h:39