[] viewmap, DocPublication docPublication, ref int sequence)
@@ -2886,17 +3019,14 @@ public void WriteEntityAttributes(DocEntity entity, DocEntity treeleaf, DocModel
if (this.m_included == null || this.m_included.ContainsKey(attr))
{
- if(attr.GetAggregation() != DocAggregationEnum.NONE)
+ if(attr.IsOptional)
{
- this.WriteAttributeAggregation(attr);
+ this.m_writer.Write("? ");
}
- else if ((attr.AttributeFlags & 1) != 0)
- {
- this.m_writer.Write("[0:1]");
- }
- else
+
+ if(attr.GetAggregation() != DocAggregationEnum.NONE)
{
- this.m_writer.Write("[1:1]");
+ this.WriteAttributeAggregation(attr);
}
}
@@ -2938,20 +3068,16 @@ public void WriteEntityAttributes(DocEntity entity, DocEntity treeleaf, DocModel
this.m_writer.Write("");
- if (attr.GetAggregation() != DocAggregationEnum.NONE)
+ if(attr.IsOptional)
{
- this.WriteAttributeAggregation(attr);
+ this.m_writer.Write("? ");
}
- else if ((attr.AttributeFlags & 1) != 0)
- {
- this.m_writer.Write("[0:1]");
- }
- else
+
+ if (attr.GetAggregation() != DocAggregationEnum.NONE)
{
- this.m_writer.Write("[1:1]");
+ this.WriteAttributeAggregation(attr);
}
-
this.m_writer.Write(" | ");
this.WriteDocumentationMarkup(attr.Documentation, entity, docPublication);
this.m_writer.Write(" | ");
@@ -3011,17 +3137,14 @@ public void WriteEntityAttributes(DocEntity entity, DocEntity treeleaf, DocModel
this.m_writer.Write("");
//this.m_writer.Write(" := ");
- if (attr.GetAggregation() != DocAggregationEnum.NONE)
- {
- this.WriteAttributeAggregation(attr);
- }
- else if ((attr.AttributeFlags & 1) != 0)
+ if (attr.IsOptional)
{
- this.m_writer.Write("[0:1]");
+ this.m_writer.Write("? ");
}
- else
+
+ if (attr.GetAggregation() != DocAggregationEnum.NONE)
{
- this.m_writer.Write("[1:1]");
+ this.WriteAttributeAggregation(attr);
}
this.m_writer.Write(" | ");
@@ -3057,12 +3180,22 @@ internal void WriteTerm(DocTerm docRef)
this.WriteLine("");
}
- internal void WriteChangeLog(DocDefinition entity, DocProject docProject)
+ internal void WriteChangeLog(DocObject entity, List listChangeSets, DocPublication docPublication)
{
Dictionary mapChange = new Dictionary();
- foreach (DocChangeSet docChangeSet in docProject.ChangeSets)
+ foreach (DocChangeSet docChangeSet in listChangeSets)
{
- foreach (DocChangeAction docChangeSection in docChangeSet.ChangesEntities)
+ List listActions = docChangeSet.ChangesEntities;
+ if(entity is DocPropertySet || entity is DocPropertyEnumeration)
+ {
+ listActions = docChangeSet.ChangesProperties;
+ }
+ else if(entity is DocQuantitySet)
+ {
+ listActions = docChangeSet.ChangesQuantities;
+ }
+
+ foreach (DocChangeAction docChangeSection in listActions)
{
foreach (DocChangeAction docChangeSchema in docChangeSection.Changes)
{
@@ -3099,8 +3232,7 @@ internal void WriteChangeLog(DocDefinition entity, DocProject docProject)
if (mapChange.Count > 0)
{
- this.WriteLine("");
- this.WriteLine("Change log");
+ this.WriteSummaryHeader("Change log", true, docPublication);
this.WriteLine("");
this.WriteLine("" +
@@ -3120,7 +3252,7 @@ internal void WriteChangeLog(DocDefinition entity, DocProject docProject)
this.WriteLine(" ");
- this.WriteLine(" ");
+ this.WriteSummaryFooter(docPublication);
}
diff --git a/FormatJAV.cs b/FormatJAV.cs
index a5fcda0a..31e15445 100644
--- a/FormatJAV.cs
+++ b/FormatJAV.cs
@@ -485,7 +485,7 @@ public string FormatDefined(DocDefined docDefined)
return "/* " + docDefined.Name + " : " + docDefined.DefinedType + " (Java does not support structures, so usage of defined types are inline for efficiency.) */\r\n";
}
- public string FormatDefinitions(DocProject docProject, Dictionary map, Dictionary included)
+ public string FormatDefinitions(DocProject docProject, DocPublication docPublication, Dictionary map, Dictionary included)
{
StringBuilder sb = new StringBuilder();
foreach (DocSection docSection in docProject.Sections)
diff --git a/FormatOWL.cs b/FormatOWL.cs
index 4ae594a0..986f27bb 100644
--- a/FormatOWL.cs
+++ b/FormatOWL.cs
@@ -723,7 +723,7 @@ public string createListClass(string defined)
return sb.ToString();
}
- public string FormatDefinitions(DocProject docProject, Dictionary map, Dictionary included)
+ public string FormatDefinitions(DocProject docProject, DocPublication docPublication, Dictionary map, Dictionary included)
{
// clear containers
listPropertiesOutput.Clear();
@@ -733,11 +733,11 @@ public string FormatDefinitions(DocProject docProject, Dictionary .");
diff --git a/FormatPNG.cs b/FormatPNG.cs
index 63f86cce..ab6c7354 100644
--- a/FormatPNG.cs
+++ b/FormatPNG.cs
@@ -66,8 +66,8 @@ private static void DrawAttribute(
DocModelView docView,
DocModelRuleAttribute ruleAttribute,
Dictionary map,
- int offset,
- Dictionary layout,
+ int offset,
+ Dictionary layout,
DocProject docProject,
DocSchema docSchema,
SEntity instance)
@@ -356,8 +356,8 @@ private static void DrawEntity(
DocModelView docView,
DocTemplateDefinition docTemplate,
DocModelRuleEntity docRule,
- Dictionary map,
- Dictionary layout,
+ Dictionary map,
+ Dictionary layout,
DocProject docProject,
DocSchema docSchema,
object instance)
@@ -489,7 +489,14 @@ private static void DrawEntity(
// record rectangle
if (layout != null)
{
- layout.Add(new Rectangle(x, y, CX - DX, CY + CY * listAttr.Count), docRule);
+ try
+ {
+ layout.Add(new Rectangle(x, y, CX - DX, CY + CY * listAttr.Count), docRule);
+ }
+ catch
+ {
+ //...
+ }
}
SortedList> mapAttribute = new SortedList>();
@@ -646,6 +653,61 @@ private static void DrawEntity(
int offset = -mapAttribute.Values.Count / 2;
+ if(docRule != null)
+ {
+ offset -= docRule.References.Count / 2;
+
+ foreach (DocTemplateDefinition dtdRef in docRule.References)
+ {
+ int targetY = lanes[lane + 1] + FormatPNG.Border;
+
+ if (g != null)
+ {
+ // draw the template box
+ g.FillRectangle(Brushes.Blue, x + CX, targetY, CX - DX, CY);
+ g.DrawRectangle(Pens.Blue, x + CX, targetY, CX - DX, CY);
+ using (Font font = new Font(FontFamily.GenericSansSerif, 8.0f))
+ {
+ g.DrawString(dtdRef.Name, font, Brushes.White, x + CX, targetY);
+ }
+
+ // draw the line connecting entity to the template
+ int dest = FormatPNG.Border;
+ if (lanes.Count > lane + 1)
+ {
+ dest = lanes[lane + 1] + FormatPNG.Border;
+ }
+
+ int x0 = x + CX - DX;
+ int y0 = y + CY / 2;
+ int x1 = x + CX;
+ int y1 = dest + CY / 2;
+ int xM = x0 + DX / 2 - offset * 2;
+
+ g.DrawLine(Pens.Blue, x0, y0, xM, y0);
+ g.DrawLine(Pens.Blue, xM, y0, xM, y1);
+ g.DrawLine(Pens.Blue, xM, y1, x1, y1);
+
+ }
+
+ // record rectangle
+ if (layout != null)
+ {
+ layout.Add(new Rectangle(x + CX, targetY, CX - DX, CY), dtdRef);
+ }
+
+ // increment lane offset for all lanes
+ int tempminlane = targetY + CY * 2;
+ int i = lane + 1;
+ if (lanes[i] < tempminlane)
+ {
+ lanes[i] = tempminlane;
+ }
+
+ offset++;
+ }
+ }
+
DocTemplateDefinition lastTemplate = null;
foreach (List listSort in mapAttribute.Values)
{
@@ -721,7 +783,6 @@ private static void DrawEntity(
{
lanes[lane] = minlane;
}
-
}
///
@@ -734,7 +795,7 @@ private static void DrawEntity(
///
///
///
- internal static Image CreateConceptDiagram(DocEntity docEntity, DocModelView docView, Dictionary map, Dictionary layout, DocProject docProject, SEntity instance)
+ internal static Image CreateConceptDiagram(DocEntity docEntity, DocModelView docView, Dictionary map, Dictionary layout, DocProject docProject, SEntity instance)
{
DocSchema docSchema = docProject.GetSchemaOfDefinition(docEntity);
@@ -789,7 +850,7 @@ internal static Image CreateConceptDiagram(DocEntity docEntity, DocModelView doc
///
///
///
- internal static Image CreateTemplateDiagram(DocTemplateDefinition docTemplate, Dictionary map, Dictionary layout, DocProject docProject, SEntity instance)
+ internal static Image CreateTemplateDiagram(DocTemplateDefinition docTemplate, Dictionary map, Dictionary layout, DocProject docProject, SEntity instance)
{
DocObject docTarget = null;
if (docTemplate.Type == null || !map.TryGetValue(docTemplate.Type, out docTarget) || !(docTarget is DocEntity))
@@ -1208,9 +1269,33 @@ internal static Image CreateSchemaDiagram(DocSchema docSchema, Dictionary ptA.X)
+ {
+ ptB.X -= cap;
+ }
+ else if (ptB.X < ptA.X)
+ {
+ ptB.X += cap;
+ }
+ if (ptB.Y > ptA.Y)
+ {
+ ptB.Y -= cap;
+ }
+ else if (ptB.Y < ptA.Y)
+ {
+ ptB.Y += cap;
+ }
+
+ }
+
+ g.DrawLine(penBlue, ptA, ptB);
}
}
}
@@ -1430,7 +1515,7 @@ private static int DrawEndCap(Graphics g, Point ptA, Point ptB, DiagramFormat fo
// filled if composition...
}
- return rad;
+ return rad * 2;
}
private static void DrawTree(Graphics g, DocLine docSub, double factor, Point ptLast, DiagramFormat format)
@@ -1441,6 +1526,8 @@ private static void DrawTree(Graphics g, DocLine docSub, double factor, Point pt
float penwidth = 0.0f;
if(format == DiagramFormat.ExpressG)
{
+ // draw circle at subtype
+
penwidth = 3.0f;
}
else if (format == DiagramFormat.UML)
@@ -1481,6 +1568,11 @@ private static void DrawTree(Graphics g, DocLine docSub, double factor, Point pt
g.DrawLine(pen, ptA, ptB);
g.DrawLine(pen, ptB, ptC);
+
+ if (docSub.Tree.Count == 0 && i == docSub.DiagramLine.Count - 2 && format == DiagramFormat.ExpressG)
+ {
+ DrawEndCap(g, ptB, ptC, format);
+ }
}
}
}
diff --git a/FormatSMF.cs b/FormatSMF.cs
index 133d6b77..a22cc6e6 100644
--- a/FormatSMF.cs
+++ b/FormatSMF.cs
@@ -502,11 +502,6 @@ private bool WriteEntityAttributes(SEntity o)
private void WriteAttribute(SEntity o, FieldInfo f, DocXsdFormat format)
{
- if (f.Name.Equals("ConversionFactor") && this is IfcDoc.Format.JSN.FormatJSN)
- {
- this.ToString();
- }
-
object v = f.GetValue(o);
if (v == null)
return;
@@ -515,7 +510,7 @@ private void WriteAttribute(SEntity o, FieldInfo f, DocXsdFormat format)
Type ft = f.FieldType;
- if (format == null || format.XsdFormat != DocXsdFormatEnum.Attribute)
+ if (format == null || format.XsdFormat != DocXsdFormatEnum.Attribute || f.Name.Equals("InnerCoordIndices")) //hackhack -- need to resolve...
{
this.WriteOpenElement();
}
@@ -527,6 +522,28 @@ private void WriteAttribute(SEntity o, FieldInfo f, DocXsdFormat format)
// for nested lists, flatten; e.g. IfcBSplineSurfaceWithKnots.ControlPointList
if (typeof(System.Collections.ICollection).IsAssignableFrom(ft.GetGenericArguments()[0]))
{
+ // special case
+ if(f.Name.Equals("InnerCoordIndices")) //hack
+ {
+ foreach (System.Collections.ICollection innerlist in list)
+ {
+ string entname = "Seq-IfcPositiveInteger-wrapper"; // hack
+ this.WriteStartElementEntity(entname, null);
+ this.WriteOpenElement();
+ foreach(object e in innerlist)
+ {
+ object ev = e.GetType().GetField("Value").GetValue(e);
+
+ this.m_writer.Write(ev.ToString());
+ this.m_writer.Write(" ");
+ }
+ this.m_writer.WriteLine();
+ this.WriteEndElementEntity(entname);
+ }
+ WriteEndElementAttribute(f.Name);
+ return;
+ }
+
System.Collections.ArrayList flatlist = new System.Collections.ArrayList();
foreach (System.Collections.ICollection innerlist in list)
{
@@ -699,7 +716,33 @@ private void WriteValueWrapper(object v)
}
string encodedvalue = String.Empty;
- if (v != null)
+ if (v is System.Collections.IList)
+ {
+ // IfcIndexedPolyCurve.Segments
+ System.Collections.IList list = (System.Collections.IList)v;
+ StringBuilder sb = new StringBuilder();
+ foreach(object o in list)
+ {
+ if(sb.Length > 0)
+ {
+ sb.Append(" ");
+ }
+
+ FieldInfo fieldValueInner = o.GetType().GetField("Value");
+ if (fieldValueInner != null)
+ {
+ object vInner = fieldValueInner.GetValue(o);
+ sb.Append(vInner.ToString());
+ }
+ else
+ {
+ sb.Append(o.ToString());
+ }
+ }
+
+ encodedvalue = sb.ToString();
+ }
+ else if (v != null)
{
encodedvalue = System.Security.SecurityElement.Escape(v.ToString());
}
diff --git a/FormatSML.cs b/FormatSML.cs
index 48a300e0..c542e65a 100644
--- a/FormatSML.cs
+++ b/FormatSML.cs
@@ -212,16 +212,11 @@ protected override void WriteHeader()
"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" " +
"xmlns:ifc=\"" + this.m_xsdURI + "\" " +
"xmlns=\"" + this.m_xsdURI + "\">";
- /*
- string schema = ""; // TBD: make configurable
- */
+
if (this.m_markup)
{
- header = System.Net.WebUtility.HtmlEncode(header);// +" ";
- schema = System.Net.WebUtility.HtmlEncode(schema);// +" ";
+ header = System.Net.WebUtility.HtmlEncode(header);
+ schema = System.Net.WebUtility.HtmlEncode(schema);
}
this.m_writer.WriteLine(header);
diff --git a/FormatSPF.cs b/FormatSPF.cs
index 4aa113dc..929fddbe 100644
--- a/FormatSPF.cs
+++ b/FormatSPF.cs
@@ -1216,6 +1216,11 @@ private System.Collections.IList ParseList(Type t, string line)
m_markup.Append(strval);
m_markup.Append("");
}
+ else if(value is System.Collections.IList)
+ {
+ // do nothing -- already formatted
+ this.ToString();
+ }
else if(value == null || value.GetType() == elemtype) // capture raw values (e.g. IfcCartesianPoint.Points, and avoid wrapped value types)
{
m_markup.Append(strval);
@@ -1710,6 +1715,11 @@ private void ParseField(FieldInfo field, object instance, string strval)
{
foreach (FieldInfo fieldInverse in listField)
{
+ if(itemSource.GetType().Name.Contains("Door") && fieldInverse.Name.Contains("InStructure"))
+ {
+ this.ToString();
+ }
+
if (fieldInverse.DeclaringType.IsInstanceOfType(itemSource) &&
typeof(IList).IsAssignableFrom(fieldInverse.FieldType))
{
@@ -1749,7 +1759,7 @@ private void ParseField(FieldInfo field, object instance, string strval)
if (m_markup != null && this.m_parsescope == ParseScope.DataFields)
{
- m_markup.Append("");
+ //m_markup.Append("");
}
}
@@ -1761,7 +1771,7 @@ public void InitHeaders(string filename, string schema)
FILE_NAME hName = new FILE_NAME();
hName.Name = filename;
hName.OriginatingSystem = "buildingSMART IFC Documentation Generator";
- hName.PreprocessorVersion = "buildingSMART IFCDOC 10.4"; // was "buildingSMART IFCDOC" for 2.7 and earlier;
+ hName.PreprocessorVersion = "buildingSMART IFCDOC 11.2"; // was "buildingSMART IFCDOC" for 2.7 and earlier;
//hName.Author.Add(System.Environment.UserName);
//hName.Organization.Add(System.Environment.UserDomainName);
hName.Timestamp = DateTime.UtcNow;
diff --git a/FormatSQL.cs b/FormatSQL.cs
index 7d76a5b8..4406e2fa 100644
--- a/FormatSQL.cs
+++ b/FormatSQL.cs
@@ -138,7 +138,7 @@ public string FormatDefined(DocDefined docDefined)
return null; // nothing to define
}
- public string FormatDefinitions(DocProject docProject, Dictionary map, Dictionary included)
+ public string FormatDefinitions(DocProject docProject, DocPublication docPublication, Dictionary map, Dictionary included)
{
StringBuilder sb = new StringBuilder();
foreach (DocSection docSection in docProject.Sections)
@@ -222,39 +222,67 @@ public string FormatData(DocProject docProject, DocPublication docPublication, D
}
}
+ // check if there are any instances to populate table
+ if (included)
+ {
+ included = false;
+ foreach (SEntity e in instances.Values)
+ {
+ string eachname = e.GetType().Name;
+ if (docRoot.ApplicableEntity.IsInstanceOfType(e))
+ {
+ included = true;
+ break;
+ }
+ }
+ }
+
if (included)
{
string table = docConcept.Items[0].GetParameterValue("Table");
string query = docConcept.Items[0].GetParameterValue("Reference");
- //if (query == null)
- //{
- // query = String.Empty;
- //}
-
- //int cap = query.IndexOf('.');
- //string typename = query.Substring(0, cap);
-
- // find corresponding type?
- //instance.GetType().Assembly.GetType(typename);
-
- // query all data of given type
- //...
-
sb.AppendLine("" + docConcept.Name + "");
sb.AppendLine("");
+ List colstyles = new List();
+ List colformat = new List();
+ List colmaps = new List();
+
// generate header row
sb.AppendLine("");
foreach (DocTemplateItem docItem in docConcept.Items)
{
string name = docItem.GetParameterValue("Name");
- string color = docItem.GetParameterValue("Color");
- //... use color...
+ string disp = "#" + docItem.GetColor().ToArgb().ToString("X8"); //docItem.GetParameterValue("Color");docItem.GetParameterValue("Color");
+ string expr = docItem.GetParameterValue("Reference");
+ string form = docItem.GetParameterValue("Format");
+
+ string style = "";
+ if (!String.IsNullOrEmpty(disp))
+ {
+ style = " style=\"background-color:" + disp + ";\"";
+ }
+ colstyles.Add(style);
+
+ string format = "";
+ if (!String.IsNullOrEmpty(form))
+ {
+ format = form;
+ }
+ colformat.Add(format);
- sb.Append("");
+ string desc = "";
+ CvtValuePath valpath = CvtValuePath.Parse(expr, map); //todo: move out of loop
+ colmaps.Add(valpath);
+ if (valpath != null)
+ {
+ desc = /*valpath.GetDescription(map) + "
" + */valpath.ToString().Replace("\\", "
");
+ }
+
+ sb.Append(" | ");
sb.Append(name);
- sb.Append(" | ");
+ sb.Append("");
};
sb.AppendLine(" ");
@@ -264,15 +292,23 @@ public string FormatData(DocProject docProject, DocPublication docPublication, D
string eachname = e.GetType().Name;
if (docRoot.ApplicableEntity.IsInstanceOfType(e))
{
- sb.Append("");
+ bool includerow = true;
+ StringBuilder sbRow = new StringBuilder();
+
+ sbRow.Append(" ");
+ int iCol = 0;
foreach (DocTemplateItem docItem in docConcept.Items)
{
- sb.Append("");
+ sbRow.Append(" | ");
+
+ sbRow.Append(((Double)value).ToString("N3"));
+ }
+ else if(value is List)
+ {
+ sbRow.Append(">");
+
+ // latitude or longitude
+ List intlist = (List)value;
+ if(intlist.Count >= 3)
+ {
+ sbRow.Append(intlist[0] + "° " + intlist[1] + "' " + intlist[2] + "\"");
+ }
+ }
+ else if (value != null)
{
- sb.Append(value.ToString()); // todo: html-encode
+ sbRow.Append(">");
+ sbRow.Append(value.ToString()); // todo: html-encode
}
}
else
{
- sb.Append(" ");
+ sbRow.Append(">");
+ sbRow.Append(" ");
}
}
+ else
+ {
+ sbRow.Append(">");
+ }
- sb.Append(" | ");
+ sbRow.Append("");
+ }
+ sbRow.AppendLine(" ");
+
+ if(includerow)
+ {
+ sb.Append(sbRow.ToString());
}
- sb.AppendLine("");
}
}
diff --git a/FormatTTL.cs b/FormatTTL.cs
index 1131b019..5e9f2c6d 100644
--- a/FormatTTL.cs
+++ b/FormatTTL.cs
@@ -1,4 +1,4 @@
-// Name: FormatTTL.cs
+// Name: FormatTTL.cs
// Description: Reads/writes TTL File (RDF, compliant with ifcOWL).
// Author: Pieter Pauwels
// Origination: Work performed for BuildingSmart by Pieter Pauwels
@@ -19,7 +19,7 @@
namespace IfcDoc
{
- public class FormatTTL: IDisposable,
+ public class FormatTTL : IDisposable,
IFormatData
{
Stream m_stream;
@@ -39,19 +39,16 @@ public class FormatTTL: IDisposable,
Dictionary m_fullpropertynames = new Dictionary();
HashSet m_saved; // keeps track of entities already written, which can be referenced
-
- long m_nextID = 0;
- public FormatTTL() : this(new System.IO.MemoryStream(), "http://ifcowl.openbimstandards.org/IFC4_ADD1")
- {
- }
+ long m_nextID = 0;
public FormatTTL(Stream stream, string owlURI)
{
this.m_stream = stream;
this.m_owlURI = owlURI;
string timeLog = DateTime.Now.ToString("yyyyMMdd_HHmmss"); //h:mm:ss tt
- this.m_baseURI = "http://linkedbuildingdata.net/ifc/resources" + timeLog + "/";
+ this.m_baseURI = "http://linkedbuildingdata.net/ifc/resources" + timeLog + "/";
+ // TWC: URIs are now dynamically configured and made consistent for all formats, so above could be updated to rely on parameters instead
}
private class ListObject
@@ -101,7 +98,7 @@ public ObjectProperty(string domain, string originalName, string name, string se
public string name;
public string setorlist; //ENTITY, SET, LIST, LISTOFLIST, ARRAY || ACTUALLY, ONLY ENTITY, SET, AND LIST are available here (see FormatTTL.FormatData())
}
-
+
///
/// The dictionary with all project instances
///
@@ -112,7 +109,7 @@ public Dictionary Instances
this.m_instances = value;
}
}
-
+
///
/// Whether to save as HTML with hyperlinks for object references (to anchors within file) and entity references (to topics within documentation).
///
@@ -127,7 +124,7 @@ public bool Markup
this.m_markup = value;
}
}
-
+
//WRITING ENTITIES
public void Save()
{
@@ -136,10 +133,10 @@ public void Save()
//get highest available ID and start counting from there
m_nextID = m_instances.Keys.Aggregate((l, r) => l > r ? l : r);
-
+
// pass 2: write to file -- clear save map; retain ID map
//this.m_saved.Clear(); //NOT NECESSARY WHEN NOT DOING THE ABOVE FIRST RUN
-
+
this.m_saved = new HashSet();
this.m_writer = new StreamWriter(this.m_stream);
this.m_valueObjects = new Dictionary();
@@ -205,7 +202,7 @@ public void Save()
this.m_writer.Flush();
}
}
-
+
private void WriteEntity(SEntity o, long ID)
{
string newline = "\r\n";
@@ -214,17 +211,17 @@ private void WriteEntity(SEntity o, long ID)
Type t = o.GetType();
string hyperlink = "../../schema/" + t.Namespace.ToLower() + "/lexical/" + t.Name.ToLower() + "_" + ID + ".htm";
- this.WriteStartElement(t.Name+"_"+ID, hyperlink);
-
+ this.WriteStartElement(t.Name + "_" + ID, hyperlink);
+
this.m_writer.Write(newline);
m_indent++;
Console.Out.WriteLine("\r\n--- Writing entity : " + t.Name.ToString());
Console.Out.WriteLine("-----------------------------------");
- this.WriteType("ifcowl:" + t.Name.ToString());
+ this.WriteType("ifcowl:" + t.Name.ToString());
this.WriteEntityAttributes(o);
Console.Out.WriteLine("--------------done---------------------");
}
-
+
///
///
///
@@ -261,7 +258,7 @@ private void WriteEntityAttributes(SEntity o)
if (isvaluelistlist || isvaluelist || ft.IsValueType)
- {
+ {
if (isvaluelistlist)
{
System.Collections.IList list = (System.Collections.IList)v;
@@ -291,9 +288,10 @@ private void WriteEntityAttributes(SEntity o)
WriteListWithEntities(t, f, list);
}
}
- else {
+ else
+ {
//non-list attributes
- ObjectProperty p = GetObjectProperty(f.Name + "_" + o.GetType().Name);
+ ObjectProperty p = GetObjectProperty(f.Name + "_" + o.GetType().Name);
WriteAnyOtherThing(f, p, v);
}
}
@@ -473,9 +471,9 @@ private void WriteListOfListWithValues(Type t, FieldInfo f, System.Collections.I
}
//create listObject
- #if VERBOSE
+#if VERBOSE
Console.Out.WriteLine("Message: Creating ListOfListWithValues with XSDType : " + fieldValue.FieldType.Name);
- #endif
+#endif
newListObject = GetListObject(ft.Name + "_List_", ft.Name, valuelist, fieldValue.FieldType.Name);
//add to listOfList
@@ -499,15 +497,16 @@ private void WriteListWithEntities(Type t, FieldInfo f, System.Collections.IList
for (int i = 0; i < list.Count; i++)
{
if (list[i] is SEntity)
- {
+ {
Type vt = list[i].GetType();
this.m_writer.Write(";" + "\r\n");
this.WriteIndent();
- this.m_writer.Write("ifcowl:" + p.name + " ");
+ this.m_writer.Write("ifcowl:" + p.name + " ");
this.m_writer.Write("inst:" + vt.Name + "_" + ((SEntity)list[i]).OID);
//Console.Out.WriteLine("written object prop to SET:" + p.name + " - " + vt.Name + "_" + ((SEntity)list[i]).OID);
}
- else{
+ else
+ {
Console.Out.WriteLine("WARNING: We found an unhandled SET of things that are NOT entities: " + f.Name);
}
}
@@ -664,20 +663,20 @@ private void WriteListWithEntities(Type t, FieldInfo f, System.Collections.IList
this.m_writer.Write("inst:" + newListObject.URI);
//IfcRepresentation_List_#121_#145_#137
}
- }
+ }
}
}
private void WriteListWithValues(Type t, FieldInfo f, System.Collections.IList list)
{
//Console.Out.WriteLine("\r\n++ writing attribute: " + f.Name);
- ObjectProperty p = GetObjectProperty(f.Name + "_" + t.Name);
-
+ ObjectProperty p = GetObjectProperty(f.Name + "_" + t.Name);
+
if (p.setorlist == "SET")
{
//SET, such as IfcRecurrencePattern.weekdayComponent > IfcDayInWeekNumber
for (int i = 0; i < list.Count; i++)
- WriteTypeValue(t,f,list[i]);
+ WriteTypeValue(t, f, list[i]);
}
else
{
@@ -734,7 +733,7 @@ private void WriteListWithValues(Type t, FieldInfo f, System.Collections.IList l
private void WriteTypeValue(Type t, FieldInfo f, object v)
{
Type ft = f.FieldType;
- if (ft.IsGenericType && (ft.GetGenericTypeDefinition() == typeof(Nullable<>)||ft.GetGenericTypeDefinition() == typeof(List<>)))
+ if (ft.IsGenericType && (ft.GetGenericTypeDefinition() == typeof(Nullable<>) || ft.GetGenericTypeDefinition() == typeof(List<>)))
{
// special case for Nullable types
ft = ft.GetGenericArguments()[0];
@@ -823,7 +822,7 @@ private void WriteTypeValue(Type t, FieldInfo f, object v)
this.WriteIndent();
ObjectProperty p = GetObjectProperty(f.Name + "_" + t.Name);
this.m_writer.Write("ifcowl:" + p.name + " ");
-
+
string s = ft.Name;
if (s == "Int64" || s == "Double" || s == "String" || s == "Number" || s == "Real" || s == "Integer" || s == "Logical" || s == "Boolean" || s == "Binary" || s == "Byte[]")
s = CheckForExpressPrimaryTypes(s);
@@ -967,7 +966,8 @@ private string CheckForExpressPrimaryTypes(string owlClass)
return "LOGICAL";
else if (owlClass.Equals("string", StringComparison.CurrentCultureIgnoreCase))
return "STRING";
- else {
+ else
+ {
Console.Out.WriteLine("WARNING: found xsdType " + owlClass + " - not sure what to do with it");
}
@@ -976,14 +976,14 @@ private string CheckForExpressPrimaryTypes(string owlClass)
private void WriteLiteralValue(string xsdType, string literalString)
{
- #if VERBOSE
+#if VERBOSE
Console.Out.WriteLine("WriteLiteralValue: " + "xsdtype: " + xsdType + " - literalString " + literalString);
- #endif
+#endif
this.WriteIndent();
if (xsdType.Equals("integer", StringComparison.CurrentCultureIgnoreCase) || xsdType.Equals("Int64", StringComparison.CurrentCultureIgnoreCase))
this.m_writer.Write("express:hasInteger" + " " + literalString + " ");
else if (xsdType.Equals("double", StringComparison.CurrentCultureIgnoreCase))
- this.m_writer.Write("express:has" + xsdType + " \"" + literalString.Replace(',','.') + "\"^^xsd:double ");
+ this.m_writer.Write("express:has" + xsdType + " \"" + literalString.Replace(',', '.') + "\"^^xsd:double ");
else if (xsdType.Equals("hexBinary", StringComparison.CurrentCultureIgnoreCase))
this.m_writer.Write("express:has" + xsdType + " \"" + literalString + "\"^^xsd:hexBinary ");
else if (xsdType.Equals("boolean", StringComparison.CurrentCultureIgnoreCase))
@@ -1001,7 +1001,8 @@ private void WriteLiteralValue(string xsdType, string literalString)
}
else if (xsdType.Equals("string", StringComparison.CurrentCultureIgnoreCase))
this.m_writer.Write("express:has" + xsdType + " \"" + literalString + "\" ");
- else {
+ else
+ {
this.m_writer.Write("express:has" + xsdType + " \"" + literalString + "\" ");
Console.Out.WriteLine("WARNING: found xsdType " + xsdType + " - not sure what to do with it");
}
@@ -1019,17 +1020,17 @@ private void WriteExtraEntity(URIObject obj)
if (obj.ifcowlclass.Equals("INTEGER") || obj.ifcowlclass.Equals("REAL") || obj.ifcowlclass.Equals("DOUBLE") || obj.ifcowlclass.Equals("BINARY") || obj.ifcowlclass.Equals("BOOLEAN") || obj.ifcowlclass.Equals("LOGICAL") || obj.ifcowlclass.Equals("STRING"))
ns = "express:";
WriteType(ns + obj.ifcowlclass + ";\r\n");
- #if VERBOSE
+#if VERBOSE
Console.Out.WriteLine("WriteExtraEntity: " + "obj.URI: " + obj.URI + " - xsdtype " + obj.XSDType);
- #endif
+#endif
WriteLiteralValue(obj.XSDType, obj.encodedvalue);
this.m_writer.Write(".\r\n\r\n");
- #if VERBOSE
+#if VERBOSE
Console.Out.WriteLine("written URIObject: " + "inst:" + obj.URI + " with VALUE " + obj.encodedvalue + " and TYPE " + obj.XSDType);
- #endif
+#endif
return;
}
-
+
private void WriteExtraListOfListObject(ListObject obj)
{
if (obj.XSDType == "###LISTOFLIST###")
@@ -1045,18 +1046,18 @@ private void WriteExtraListOfListObject(ListObject obj)
if (i == 0)
{
this.m_writer.Write("inst:" + obj.URI + "\r\n");
- #if VERBOSE
+#if VERBOSE
Console.Out.WriteLine("written ListOfListObject: " + "inst:" + obj.URI + " with TYPE " + obj.XSDType);
- #endif
+#endif
}
else
{
this.m_writer.Write("inst:" + obj.ifcowlclass + "_List_List_" + m_nextID + "\r\n");
- #if VERBOSE
+#if VERBOSE
Console.Out.WriteLine("written ListOfListObject: " + "inst:" + obj.ifcowlclass + "_List_List_" + m_nextID + " with TYPE " + obj.XSDType);
- #endif
+#endif
}
-
+
//m_writer.Write("inst:" + obj.URI + "\r\n");
m_indent++;
WriteType(ns + obj.ifcowlclass + "_List_List" + ";\r\n");
@@ -1089,7 +1090,7 @@ private void WriteExtraListObject(ListObject obj)
string ns = "ifcowl:";
if (obj.listtype.Equals("INTEGER") || obj.listtype.Equals("REAL") || obj.listtype.Equals("DOUBLE") || obj.listtype.Equals("BINARY") || obj.listtype.Equals("BOOLEAN") || obj.listtype.Equals("LOGICAL") || obj.listtype.Equals("STRING"))
ns = "express:";
-
+
for (int i = 0; i < obj.values.Count; i++)
{
m_indent = 0;
@@ -1097,14 +1098,14 @@ private void WriteExtraListObject(ListObject obj)
if (i == 0)
//{
this.m_writer.Write("inst:" + obj.URI + "\r\n");
- //Console.Out.WriteLine("written ListObject: " + "inst:" + obj.URI + " with TYPE " + obj.XSDType);
+ //Console.Out.WriteLine("written ListObject: " + "inst:" + obj.URI + " with TYPE " + obj.XSDType);
//}
else
//{
this.m_writer.Write("inst:" + obj.listtype + "_" + m_nextID + "\r\n");
// Console.Out.WriteLine("written ListObject: " + "inst:" + obj.listtype + "_" + m_nextID + " with TYPE " + obj.XSDType);
//}
-
+
m_indent++;
this.WriteType(ns + obj.listtype + ";\r\n");
this.WriteIndent();
@@ -1114,14 +1115,14 @@ private void WriteExtraListObject(ListObject obj)
//generate
m_nextID++;
- if ((obj.values.Count-i) > 1)
+ if ((obj.values.Count - i) > 1)
{
this.m_writer.Write(";\r\n");
this.WriteIndent();
this.m_writer.Write("list:hasNext inst:" + obj.listtype + "_" + m_nextID);
}
this.m_writer.Write(".\r\n\r\n");
- }
+ }
return;
}
@@ -1133,7 +1134,7 @@ private bool URIObjectExists(string URIObjectconcat)
else
return true;
}
-
+
private bool ListOfListObjectExists(string ListObjectConcat)
{
if (!m_listOfListObjects.ContainsKey(ListObjectConcat))
@@ -1156,12 +1157,12 @@ private ObjectProperty GetObjectProperty(string x)
private URIObject GetURIObject(string domain, string encodedvalue, string XSDType)
{
- #if VERBOSE
+#if VERBOSE
if (XSDType.Equals("RTFieldInfo", StringComparison.CurrentCultureIgnoreCase))
Console.Out.WriteLine("Warning: Found RTFieldInfo XSDType for encodedvalue: " + encodedvalue);
else
Console.Out.WriteLine("Found seemingly ok XSDType for encodedvalue : " + encodedvalue + " - " + domain);
- #endif
+#endif
//WARNING: _VALUE_ and _TYPE_ could be in the other strings
string fullObject = domain + "_VALUE_" + encodedvalue + "_TYPE_" + XSDType;
@@ -1172,7 +1173,8 @@ private URIObject GetURIObject(string domain, string encodedvalue, string XSDTyp
obj = new URIObject(domain + "_" + m_nextID, domain, encodedvalue, XSDType);
m_valueObjects.Add(fullObject, obj);
}
- else {
+ else
+ {
obj = (URIObject)m_valueObjects[fullObject];
}
@@ -1200,7 +1202,8 @@ private ListObject GetListOfListObject(string ifcowlclass, List values,
m_listOfListObjects.Add(encodedvalue, obj);
return obj;
}
- else {
+ else
+ {
obj = (ListObject)m_listOfListObjects[encodedvalue];
return obj;
}
@@ -1212,14 +1215,14 @@ private ListObject GetListObject(string listname, string ifcowlclass, List m_included;
@@ -28,7 +29,7 @@ public FormatXSD(string path)
this.m_filename = path;
}
- public DocProject Instance
+ public DocProject Project
{
get
{
@@ -40,6 +41,18 @@ public DocProject Instance
}
}
+ public DocPublication Publication
+ {
+ get
+ {
+ return this.m_publication;
+ }
+ set
+ {
+ this.m_publication = value;
+ }
+ }
+
///
/// Optional model views for filtering definitions.
///
@@ -101,9 +114,22 @@ public void Save()
}
}
- string content = this.FormatDefinitions(this.m_project, map, this.m_included);
+ string content = this.FormatDefinitions(this.m_project, this.m_publication, map, this.m_included);
+ string dirpath = System.IO.Path.GetDirectoryName(this.m_filename);
+ if (!System.IO.Directory.Exists(dirpath))
+ {
+ System.IO.Directory.CreateDirectory(dirpath);
+ }
+ using (System.IO.StreamWriter writer = new System.IO.StreamWriter(this.m_filename))
+ {
+ if (writer.BaseStream.CanSeek)
+ {
+ writer.BaseStream.SetLength(0);
+ }
+ writer.Write(content);
+ }
}
public static bool IsAttributeOverridden(DocEntity ent, DocAttribute attr, Dictionary map)
@@ -134,11 +160,49 @@ public static bool IsAttributeOverridden(DocEntity ent, DocAttribute attr, Dicti
private static string FormatAttribute(DocEntity docEntity, DocAttribute docAttr, Dictionary map)
{
+ if(docAttr.Name.Equals("InnerCoordIndices"))
+ {
+ docAttr.ToString();
+ }
+
DocObject mapDef = null;
map.TryGetValue(docAttr.DefinedType, out mapDef);
+ string xsdtype = ToXsdType(docAttr.DefinedType);
+
StringBuilder sb = new StringBuilder();
+
+ bool sequencewrapper = (mapDef is DocDefined && docAttr.AggregationUpper == "?" && docAttr.AggregationAttribute != null && docAttr.AggregationAttribute.AggregationUpper == "?");
+ if (sequencewrapper)
+ {
+ // IfcIndexPolygonalFaceWithVoids.InnerCoordIndices
+
+ sb.Append("\t\t\t\t\t");
+ sb.AppendLine();
+
+ sb.Append("\t\t\t\t\t\t |